@signalk/tracks-plugin 3.0.3 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/harness.test-utils.d.ts +5 -0
- package/dist/index.js +59 -11
- package/dist/index.js.map +1 -1
- package/dist/sqliteStore.d.ts +18 -0
- package/dist/timeWindow.d.ts +5 -1
- package/dist/trackApi.d.ts +6 -0
- package/dist/trackProvider.d.ts +9 -0
- package/dist/trackStoreWorker.js +99 -13
- package/dist/trackStoreWorker.js.map +1 -1
- package/dist/types.d.ts +17 -0
- package/dist/{utils-DOEyuPRy.js → utils-CGIGp4Xf.js} +62 -5
- package/dist/utils-CGIGp4Xf.js.map +1 -0
- package/dist/utils.d.ts +13 -0
- package/package.json +1 -1
- package/dist/utils-DOEyuPRy.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trackStoreWorker.js","names":["exports","BigFloat32","s2","geojson"],"sources":["../node_modules/bigfloat/dist/umd/index.js","../node_modules/s2js/dist/s2js.esm.js","../src/sqliteStore.ts","../src/trackStoreWorker.ts"],"sourcesContent":["(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (factory((global.bigfloat = {})));\n}(this, (function (exports) { 'use strict';\n\n // This file is part of bigfloat, copyright (c) 2015- BusFaster Ltd.\n // Released under the MIT license, see LICENSE.\n /** Base for calculations, the bigger the better but must fit in 32 bits. */\n var limbSize32 = Math.pow(2, 32);\n var limbInv32 = Math.pow(2, -32);\n var limbsPerDigit32 = Math.log(10) / (32 * Math.log(2));\n /** Create a string with the given number of zero digits. */\n function zeroes(count) {\n return (new Array(count + 1).join('0'));\n }\n var BaseInfo32 = /** @class */ (function () {\n function BaseInfo32(base) {\n this.base = base;\n /** Average number of digits per limb. */\n this.limbDigitsExact = Math.log(limbSize32) / Math.log(this.base);\n /** Number of entire digits per limb. */\n this.limbDigits = ~~this.limbDigitsExact;\n /** Maximum power of base that fits in a limb. */\n this.limbBase = Math.pow(this.base, this.limbDigits);\n /** String of zeroes for padding an empty limb. */\n this.pad = zeroes(this.limbDigits);\n }\n BaseInfo32.init = function (base) {\n return (BaseInfo32.baseTbl[base] || (BaseInfo32.baseTbl[base] = new BaseInfo32(base)));\n };\n BaseInfo32.baseTbl = {};\n return BaseInfo32;\n }());\n\n // This file is part of bigfloat, copyright (c) 2015- BusFaster Ltd.\n /** Remove leading and trailing insignificant zero digits. */\n function trimNumber(str) {\n return (str\n .replace(/^(-?)0+([1-9a-z]|0(\\.|$))/, '$1$2')\n .replace(/(\\.|(\\.[0-9a-z]*[1-9a-z]))0+$/, '$2'));\n }\n /** Output EXACT value of an IEEE 754 double in any base supported by Number.toString.\n * Exponent must be between -2 and 61, and last 3 bits of mantissa must be 0.\n * Useful for debugging. */\n function numberToString(dbl, base) {\n if (base === void 0) { base = 10; }\n var _a = BaseInfo32.init(base), pad = _a.pad, limbBase = _a.limbBase;\n var sign = '';\n var out = '';\n var limb;\n var limbStr;\n if (isNaN(dbl))\n return ('NaN');\n // For negative numbers, output sign and get absolute value.\n if (dbl < 0) {\n sign = '-';\n dbl = -dbl;\n }\n if (!isFinite(dbl))\n return (sign + 'Inf');\n if (dbl < 1) {\n out += '0';\n }\n else {\n var iPart = Math.floor(dbl);\n dbl -= iPart;\n while (iPart) {\n // Extract groups of digits starting from the least significant.\n limb = iPart % limbBase;\n iPart = (iPart - limb) / limbBase;\n limbStr = limb.toString(base);\n // Prepend digits to result.\n out = limbStr + out;\n // If more limbs remain, pad with zeroes to group length.\n if (iPart)\n out = pad.substr(limbStr.length) + out;\n }\n }\n // Is there a fractional part remaining?\n if (dbl > 0) {\n out += '.';\n if (limbBase != limbSize32) {\n limbBase = base;\n pad = '';\n }\n while (dbl) {\n // Extract groups of digits starting from the most significant.\n dbl *= limbBase;\n limb = dbl >>> 0;\n dbl -= limb;\n limbStr = limb.toString(base);\n // Append digits to result and pad with zeroes to group length.\n out += pad.substr(limbStr.length) + limbStr;\n }\n }\n // Remove trailing zeroes.\n return (sign + out.replace(/(\\.[0-9a-z]*[1-9a-z])0+$/, '$1'));\n }\n\n // This file is part of bigfloat, copyright (c) 2015- BusFaster Ltd.\n var BigFloat32 = /** @class */ (function () {\n function BigFloat32(value, base) {\n /** List of digits in base 2^32, least significant first. */\n this.limbList = [];\n value ? this.setValue(value, base) : this.setZero();\n }\n BigFloat32.prototype.clone = function () {\n return (new BigFloat32().setBig(this));\n };\n BigFloat32.prototype.setZero = function () {\n this.sign = 1;\n this.fractionLen = 0;\n this.len = 0;\n return (this);\n };\n BigFloat32.prototype.setValue = function (other, base) {\n if (typeof (other) == 'number') {\n return (this.setNumber(other));\n }\n if (other instanceof BigFloat32) {\n return (this.setBig(other));\n }\n return (this.setString(other.toString(), base || 10));\n };\n BigFloat32.prototype.setBig = function (other) {\n var len = other.len;\n this.sign = other.sign;\n this.fractionLen = other.fractionLen;\n this.len = len;\n for (var pos = 0; pos < len; ++pos) {\n this.limbList[pos] = other.limbList[pos];\n }\n return (this);\n };\n /** Set value from a floating point number (probably IEEE 754 double). */\n BigFloat32.prototype.setNumber = function (value) {\n if (value < 0) {\n value = -value;\n this.sign = -1;\n }\n else {\n this.sign = 1;\n }\n var iPart = Math.floor(value);\n var fPart = value - iPart;\n var fractionLen = 0;\n var limbList = this.limbList;\n var limb;\n var len = 0;\n // Handle fractional part.\n while (fPart) {\n // Extract limbs starting from the most significant.\n fPart *= limbSize32;\n limb = fPart >>> 0;\n fPart -= limb;\n // Append limb to value (limbs are reversed later).\n limbList[len++] = limb;\n ++fractionLen;\n }\n // Reverse array from 0 to len.\n var pos = 0;\n while (--len > pos) {\n limb = limbList[pos];\n limbList[pos++] = limbList[len];\n limbList[len] = limb;\n }\n len += pos + 1;\n // Handle integer part.\n while (iPart) {\n // Extract limbs starting from the least significant.\n limb = iPart % limbSize32; // Could also be iPart >>> 0\n iPart = (iPart - limb) / limbSize32;\n // Append limb to value.\n limbList[len++] = limb;\n }\n this.limbList = limbList;\n this.fractionLen = fractionLen;\n this.len = len;\n return (this);\n };\n BigFloat32.prototype.parseFraction = function (value, base, start, offset, limbBase, limbDigits) {\n var limbList = this.limbList;\n var pos = value.length;\n // Set limbs to zero, because divInt uses them as input.\n var limbNum = offset - 1;\n while (limbNum) {\n limbList[--limbNum] = 0;\n }\n // Read initial digits so their count becomes divisible by limbDigits.\n var posNext = pos - ((pos - start + limbDigits - 1) % limbDigits + 1);\n limbList[offset - 1] = parseInt(value.substr(posNext, pos - posNext), base);\n this.divInt(Math.pow(base, pos - posNext), offset);\n pos = posNext;\n // Read rest of the digits in limbDigits sized chunks.\n while (pos > start) {\n pos -= limbDigits;\n limbList[offset - 1] = parseInt(value.substr(pos, limbDigits), base);\n // Divide by maximum power of base that fits in a limb.\n this.divInt(limbBase, offset);\n }\n };\n BigFloat32.prototype.setString = function (value, base) {\n var _a = BaseInfo32.init(base), limbBase = _a.limbBase, limbDigits = _a.limbDigits, limbDigitsExact = _a.limbDigitsExact;\n var limbList = this.limbList;\n var pos = -1;\n var c;\n this.sign = 1;\n // Handle leading signs and zeroes.\n while (1) {\n c = value.charAt(++pos);\n switch (c) {\n case '-':\n this.sign = -1;\n case '+':\n case '0':\n continue;\n }\n break;\n }\n var posDot = (value.indexOf('.', pos) + 1 || value.length + 1) - 1;\n // Handle fractional part.\n if (posDot < value.length - 1) {\n // Reserve enough limbs to contain digits in fractional part.\n var len = ~~((value.length - posDot - 1) / limbDigitsExact) + 1;\n this.parseFraction(value, base, posDot + 1, len + 1, limbBase, limbDigits);\n this.fractionLen = len;\n this.len = len;\n // Remove trailing zeroes.\n this.trimLeast();\n }\n else {\n this.fractionLen = 0;\n this.len = 0;\n }\n var offset = this.fractionLen;\n // Handle integer part.\n if (posDot > pos) {\n // Read initial digits so their count becomes divisible by limbDigits.\n var posNext = pos + (posDot - pos + limbDigits - 1) % limbDigits + 1;\n ++this.len;\n limbList[offset] = parseInt(value.substr(pos, posNext - pos), base);\n pos = posNext;\n // Read rest of the digits in limbDigits sized chunks.\n while (pos < posDot) {\n // Multiply by maximum power of base that fits in a limb.\n if (this.mulInt(limbBase, limbList, offset, offset, 0))\n ++this.len;\n // Add latest limb.\n limbList[offset] += parseInt(value.substr(pos, limbDigits), base);\n pos += limbDigits;\n }\n }\n return (this);\n };\n /** Trim zero limbs from most significant end. */\n BigFloat32.prototype.trimMost = function () {\n var limbList = this.limbList;\n var fractionLen = this.fractionLen;\n var len = this.len;\n while (len > fractionLen && !limbList[len - 1])\n --len;\n this.len = len;\n };\n /** Trim zero limbs from least significant end. */\n BigFloat32.prototype.trimLeast = function () {\n var limbList = this.limbList;\n var len = this.fractionLen;\n var pos = 0;\n while (pos < len && !limbList[pos])\n ++pos;\n if (pos)\n this.truncate(len - pos);\n };\n /** Multiply by an integer and write output limbs to another list. */\n BigFloat32.prototype.mulInt = function (factor, dstLimbList, srcPos, dstPos, overwriteMask) {\n if (!factor)\n return (0);\n var limbList = this.limbList;\n var limbCount = this.len;\n var limb;\n var lo;\n var carry = 0;\n // limbList is an array of 32-bit ints but split here into 16-bit low\n // and high words for multiplying by a 32-bit term, so the intermediate\n // 48-bit multiplication results fit into 53 bits of IEEE 754 mantissa.\n while (srcPos < limbCount) {\n limb = limbList[srcPos++];\n // Multiply lower half of limb with factor, making carry temporarily take 48 bits.\n carry += factor * (limb & 0xffff);\n // Get lowest 16 bits of full product.\n lo = carry & 0xffff;\n // Right shift by dividing because >> and >>> truncate to 32 bits before shifting.\n carry = (carry - lo) / 65536;\n // Multiply higher half of limb and combine with lowest 16 bits of full product.\n carry += factor * (limb >>> 16);\n lo |= carry << 16;\n // Lowest 32 bits of full product are added to output limb.\n limb = ((dstLimbList[dstPos] & overwriteMask) + lo) >>> 0;\n dstLimbList[dstPos++] = limb;\n // Highest 32 bits of full product stay in carry, also increment by 1 if previous sum overflowed.\n carry = (carry / 65536) >>> 0;\n // Bit twiddle equivalent to: if(limb < (lo >>> 0)) ++carry;\n carry += (lo ^ (((limb - lo) ^ lo) & ~(limb ^ lo))) >>> 31;\n }\n // Extend result by one more limb if it overflows.\n if (carry)\n dstLimbList[dstPos] = carry;\n return (carry);\n };\n BigFloat32.prototype.mulBig = function (multiplier, product) {\n if (this.isZero() || multiplier.isZero())\n return (product.setZero());\n var multiplierLimbs = multiplier.limbList;\n var lenMultiplier = multiplier.len;\n var productLimbs = product.limbList;\n var posProduct = this.len + lenMultiplier;\n product.len = posProduct;\n // TODO: Only clear from len to len + lenMultiplier\n while (posProduct--) {\n productLimbs[posProduct] = 0;\n }\n this.mulInt(multiplierLimbs[0], productLimbs, 0, 0, 0);\n for (var posMultiplier = 1; posMultiplier < lenMultiplier; ++posMultiplier) {\n this.mulInt(multiplierLimbs[posMultiplier], productLimbs, 0, posMultiplier, 0xffffffff);\n }\n product.sign = this.sign * multiplier.sign;\n product.fractionLen = this.fractionLen + multiplier.fractionLen;\n product.trimMost();\n product.trimLeast();\n return (product);\n };\n /** Multiply and return product in a new BigFloat32. */\n BigFloat32.prototype.mul = function (multiplier, product) {\n product = product || new BigFloat32();\n if (typeof (multiplier) == 'number') {\n multiplier = temp32.setNumber(multiplier);\n }\n if (product == this)\n throw (new Error('Multiplication in place is unsupported'));\n return (this.mulBig(multiplier, product));\n };\n BigFloat32.prototype.absDeltaFrom = function (other) {\n if (typeof (other) == 'number') {\n other = temp32.setNumber(other);\n }\n var limbList = this.limbList;\n var otherList = other.limbList;\n var limbCount = this.len;\n var otherCount = other.len;\n // Compare lengths.\n // Note: leading zeroes in integer part must be trimmed for this to work!\n var d = (limbCount - this.fractionLen) - (otherCount - other.fractionLen);\n // If lengths are equal, compare each limb from most to least significant.\n while (!d && limbCount && otherCount)\n d = limbList[--limbCount] - otherList[--otherCount];\n if (d)\n return (d);\n if (limbCount) {\n do\n d = limbList[--limbCount];\n while (!d && limbCount);\n }\n else if (otherCount) {\n do\n d = -otherList[--otherCount];\n while (!d && otherCount);\n }\n return (d);\n };\n BigFloat32.prototype.isZero = function () {\n return (this.len == 0);\n };\n BigFloat32.prototype.getSign = function () {\n return (this.len && this.sign);\n };\n /** Return an arbitrary number with sign matching the result of this - other. */\n BigFloat32.prototype.deltaFrom = function (other) {\n if (typeof (other) == 'number') {\n other = temp32.setNumber(other);\n }\n return (\n // Make positive and negative zero equal.\n this.len + other.len && (\n // Compare signs.\n this.sign - other.sign ||\n // Finally compare full values.\n this.absDeltaFrom(other) * this.sign));\n };\n BigFloat32.prototype.addBig = function (addend, sum) {\n var augend = this;\n var fractionLen = augend.fractionLen;\n var len = fractionLen - addend.fractionLen;\n if (len < 0) {\n len = -len;\n fractionLen += len;\n augend = addend;\n addend = this;\n }\n sum.sign = this.sign;\n sum.fractionLen = fractionLen;\n var sumLimbs = sum.limbList;\n var augendLimbs = augend.limbList;\n var addendLimbs = addend.limbList;\n var posAugend = 0;\n var posAddend = 0;\n var carry = 0;\n var limbSum;\n // If one input has more fractional limbs, just copy the leftovers to output.\n while (posAugend < len) {\n sumLimbs[posAugend] = augendLimbs[posAugend];\n ++posAugend;\n }\n var lenAddend = addend.len;\n len = augend.len - posAugend;\n if (len > lenAddend)\n len = lenAddend;\n // Calculate sum where input numbers overlap.\n while (posAddend < len) {\n carry += augendLimbs[posAugend] + addendLimbs[posAddend++];\n limbSum = carry >>> 0;\n carry = carry - limbSum && 1;\n sumLimbs[posAugend++] = limbSum;\n }\n var posSum = posAugend;\n if (len < lenAddend) {\n len = lenAddend;\n augend = addend;\n posAugend = posAddend;\n augendLimbs = addendLimbs;\n }\n else\n len = augend.len;\n // Copy leftover most significant limbs to output, propagating carry.\n while (posAugend < len) {\n carry += augendLimbs[posAugend++];\n limbSum = carry >>> 0;\n carry = carry - limbSum && 1;\n sumLimbs[posSum++] = limbSum;\n }\n if (carry)\n sumLimbs[posSum++] = carry;\n sum.len = posSum;\n sum.trimLeast();\n return (sum);\n };\n BigFloat32.prototype.subBig = function (subtrahend, difference) {\n var minuend = this;\n difference.sign = this.sign;\n // Make sure the subtrahend is the smaller number.\n if (minuend.absDeltaFrom(subtrahend) < 0) {\n minuend = subtrahend;\n subtrahend = this;\n difference.sign = -this.sign;\n }\n var fractionLen = minuend.fractionLen;\n var len = fractionLen - subtrahend.fractionLen;\n var differenceLimbs = difference.limbList;\n var minuendLimbs = minuend.limbList;\n var subtrahendLimbs = subtrahend.limbList;\n var lenMinuend = minuend.len;\n var lenSubtrahend = subtrahend.len;\n var lenFinal = lenMinuend;\n var posMinuend = 0;\n var posSubtrahend = 0;\n var posDifference = 0;\n var carry = 0;\n var limbDiff;\n if (len >= 0) {\n while (posMinuend < len) {\n differenceLimbs[posMinuend] = minuendLimbs[posMinuend];\n ++posMinuend;\n }\n len += lenSubtrahend;\n if (len > lenMinuend)\n len = lenMinuend;\n posDifference = posMinuend;\n }\n else {\n len = -len;\n fractionLen += len;\n lenFinal += len;\n while (posSubtrahend < len) {\n carry -= subtrahendLimbs[posSubtrahend];\n limbDiff = carry >>> 0;\n carry = -(carry < 0);\n differenceLimbs[posSubtrahend++] = limbDiff;\n }\n len += lenMinuend;\n if (len > lenSubtrahend)\n len = lenSubtrahend;\n posDifference = posSubtrahend;\n }\n difference.fractionLen = fractionLen;\n // Calculate difference where input numbers overlap.\n while (posDifference < len) {\n carry += minuendLimbs[posMinuend++] - subtrahendLimbs[posSubtrahend++];\n limbDiff = carry >>> 0;\n carry = -(carry < 0);\n differenceLimbs[posDifference++] = limbDiff;\n }\n // Copy leftover most significant limbs to output, propagating carry.\n while (posDifference < lenFinal) {\n carry += minuendLimbs[posMinuend++];\n limbDiff = carry >>> 0;\n carry = -(carry < 0);\n differenceLimbs[posDifference++] = limbDiff;\n }\n difference.len = posDifference;\n difference.trimMost();\n difference.trimLeast();\n return (difference);\n };\n BigFloat32.prototype.addSub = function (addend, sign, result) {\n result = result || new BigFloat32();\n if (result == this)\n throw (new Error('Addition and subtraction in place is unsupported'));\n if (typeof (addend) == 'number') {\n addend = temp32.setNumber(addend);\n }\n if (this.sign * addend.sign * sign < 0) {\n return (this.subBig(addend, result));\n }\n else {\n return (this.addBig(addend, result));\n }\n };\n /** Add and return sum in a new BigFloat32. */\n BigFloat32.prototype.add = function (addend, sum) {\n return (this.addSub(addend, 1, sum));\n };\n /** Subtract and return difference in a new BigFloat32. */\n BigFloat32.prototype.sub = function (subtrahend, difference) {\n return (this.addSub(subtrahend, -1, difference));\n };\n /** Round towards zero, to given number of base 2^32 fractional digits. */\n BigFloat32.prototype.truncate = function (fractionLimbCount) {\n var diff = this.fractionLen - fractionLimbCount;\n if (diff > 0) {\n this.fractionLen = fractionLimbCount;\n this.len -= diff;\n var len = this.len;\n var limbList = this.limbList;\n for (var pos = 0; pos < len; ++pos) {\n limbList[pos] = limbList[pos + diff];\n }\n }\n return (this);\n };\n BigFloat32.prototype.round = function (decimalCount) {\n return (this.truncate(1 + ~~(decimalCount * limbsPerDigit32)));\n };\n /** Divide by integer, replacing current value by quotient. Return integer remainder. */\n BigFloat32.prototype.divInt = function (divisor, pos) {\n var limbList = this.limbList;\n var limb;\n var hi, lo;\n var carry = 0;\n // If most significant limb is zero after dividing, decrement number of limbs remaining.\n if (limbList[pos - 1] < divisor) {\n carry = limbList[--pos];\n this.len = pos;\n }\n while (pos--) {\n limb = limbList[pos];\n carry = carry * 0x10000 + (limb >>> 16);\n hi = (carry / divisor) >>> 0;\n carry = carry - hi * divisor;\n carry = carry * 0x10000 + (limb & 0xffff);\n lo = (carry / divisor) >>> 0;\n carry = carry - lo * divisor;\n limbList[pos] = ((hi << 16) | lo) >>> 0;\n }\n return (carry);\n };\n BigFloat32.prototype.fractionToString = function (base, digitList) {\n var _a = BaseInfo32.init(base), pad = _a.pad, limbBase = _a.limbBase;\n var limbList = this.limbList;\n var limbCount = this.fractionLen;\n var limbNum = 0;\n var limbStr;\n if (base & 1) {\n throw (new Error('Conversion of floating point values to odd bases is unsupported'));\n }\n // Skip least significant limbs that equal zero.\n while (limbNum < limbCount && !limbList[limbNum])\n ++limbNum;\n if (limbNum >= limbCount)\n return;\n digitList.push('.');\n var fPart = temp32;\n fPart.limbList = limbList.slice(limbNum, limbCount);\n fPart.len = limbCount - limbNum;\n limbNum = 0;\n while (limbNum < fPart.len) {\n if (fPart.limbList[limbNum]) {\n var carry = fPart.mulInt(limbBase, fPart.limbList, limbNum, limbNum, 0);\n limbStr = carry.toString(base);\n digitList.push(pad.substr(limbStr.length) + limbStr);\n }\n else\n ++limbNum;\n }\n };\n BigFloat32.prototype.getExpansion = function (output) {\n var limbList = this.limbList;\n var len = this.len;\n var exp = this.sign;\n var pos = this.fractionLen;\n while (pos--) {\n exp *= limbInv32;\n }\n while (++pos < len) {\n output[pos] = limbList[pos] * exp;\n exp *= limbSize32;\n }\n return (len);\n };\n BigFloat32.prototype.valueOf = function () {\n var limbList = this.limbList;\n var result = 0;\n var exp = limbInv32 * this.sign;\n var len = this.fractionLen;\n var pos = 0;\n while (pos < len) {\n result = result * limbInv32 + limbList[pos++];\n }\n len = this.len;\n while (pos < len) {\n result = result * limbInv32 + limbList[pos++];\n exp *= limbSize32;\n }\n return (result * exp);\n };\n /** Convert to string in any even base supported by Number.toString.\n * @return String in lower case. */\n BigFloat32.prototype.toString = function (base) {\n if (base === void 0) { base = 10; }\n var _a = BaseInfo32.init(base), pad = _a.pad, limbBase = _a.limbBase;\n var digitList = [];\n var limbList = this.limbList;\n var limbStr;\n if (limbBase != limbSize32) {\n var iPart = temp32;\n iPart.limbList = limbList.slice(this.fractionLen, this.len);\n iPart.len = this.len - this.fractionLen;\n // Loop while 2 or more limbs remain, requiring arbitrary precision division to extract digits.\n while (iPart.len > 1) {\n limbStr = iPart.divInt(limbBase, iPart.len).toString(base);\n // Prepend digits into final result, padded with zeroes to 9 digits.\n // Since more limbs still remain, whole result will not have extra padding.\n digitList.push(pad.substr(limbStr.length) + limbStr);\n }\n // Prepend last remaining limb and sign to result.\n digitList.push('' + (iPart.limbList[0] || 0));\n if (this.sign < 0)\n digitList.push('-');\n digitList.reverse();\n // Handle fractional part.\n this.fractionToString(base, digitList);\n }\n else {\n var limbNum = this.len;\n var fractionPos = this.fractionLen;\n if (this.sign < 0)\n digitList.push('-');\n if (limbNum == fractionPos)\n digitList.push('0');\n while (limbNum--) {\n limbStr = limbList[limbNum].toString(base);\n if (limbNum == fractionPos - 1)\n digitList.push('.');\n digitList.push(pad.substr(limbStr.length) + limbStr);\n }\n }\n // Remove leading and trailing zeroes.\n return (trimNumber(digitList.join('')));\n };\n return BigFloat32;\n }());\n BigFloat32.prototype.cmp = BigFloat32.prototype.deltaFrom;\n var temp32 = new BigFloat32();\n\n // This file is part of bigfloat, copyright (c) 2018- BusFaster Ltd.\n var dekkerSplitter = (1 << 27) + 1;\n var limbsPerDigit53 = Math.log(10) / (53 * Math.log(2));\n /** See Shewchuk page 7. */\n /*\n function fastTwoSum(a: number, b: number, sum: number[]) {\n const estimate = a + b;\n\n sum[0] = b - (estimate - a);\n sum[1] = estimate;\n\n return(sum);\n }\n */\n /** Error-free addition of two floating point numbers.\n * See Shewchuk page 8. Note that output order is swapped! */\n function twoSum(a, b, sum) {\n var estimate = a + b;\n var b2 = estimate - a;\n var a2 = estimate - b2;\n sum[0] = (a - a2) + (b - b2);\n sum[1] = estimate;\n return (sum);\n }\n /** Error-free product of two floating point numbers.\n * Store approximate result in global variable tempProduct.\n * See Shewchuk page 20.\n *\n * @return Rounding error. */\n function twoProduct(a, b) {\n tempProduct = a * b;\n var a2 = a * dekkerSplitter;\n var aHi = a2 - (a2 - a);\n var aLo = a - aHi;\n var b2 = b * dekkerSplitter;\n var bHi = b2 - (b2 - b);\n var bLo = b - bHi;\n return (aLo * bLo - (tempProduct - aHi * bHi - aLo * bHi - aHi * bLo));\n }\n /** Arbitrary precision floating point number. Based on a multiple-component\n * expansion format and error free transformations.\n *\n * Maximum exponent is the same as for plain JavaScript numbers,\n * least significant representable binary digit is 2^-1074. */\n var BigFloat53 = /** @class */ (function () {\n /** @param value Initial value, a plain JavaScript floating point number\n * (IEEE 754 double precision). */\n function BigFloat53(value, base) {\n /** List of components ordered by increasing exponent. */\n this.limbList = [];\n if (value)\n this.setValue(value, base);\n }\n BigFloat53.prototype.clone = function () {\n return (new BigFloat53().setBig(this));\n };\n /** Set value to zero.\n *\n * @return This object, for chaining. */\n BigFloat53.prototype.setZero = function () {\n this.len = 0;\n return (this);\n };\n BigFloat53.prototype.setValue = function (other, base) {\n if (typeof (other) == 'number') {\n return (this.setNumber(other));\n }\n if (other instanceof BigFloat53) {\n return (this.setBig(other));\n }\n return (this.setString(other.toString(), base || 10));\n };\n BigFloat53.prototype.setBig = function (other) {\n var len = other.len;\n this.len = len;\n for (var pos = 0; pos < len; ++pos) {\n this.limbList[pos] = other.limbList[pos];\n }\n return (this);\n };\n /** Set value to a plain JavaScript floating point number\n * (IEEE 754 double precision).\n *\n * @param value New value.\n * @return This object, for chaining. */\n BigFloat53.prototype.setNumber = function (value) {\n this.limbList[0] = value;\n this.len = value && 1;\n return (this);\n };\n BigFloat53.prototype.setString = function (value, base) {\n temp32$1[0].setValue(value, base);\n this.len = temp32$1[0].getExpansion(this.limbList);\n this.normalize();\n return (this);\n };\n /** Set value to the sum of two JavaScript numbers.\n *\n * @param a Augend.\n * @param b Addend.\n * @return This object, for chaining. */\n BigFloat53.prototype.setSum = function (a, b) {\n this.len = 2;\n twoSum(a, b, this.limbList);\n return (this);\n };\n /** Set value to the product of two JavaScript numbers.\n * @param a Multiplicand.\n * @param b Multiplier.\n * @return This object, for chaining. */\n BigFloat53.prototype.setProduct = function (a, b) {\n this.len = 2;\n this.limbList[0] = twoProduct(a, b);\n this.limbList[1] = tempProduct;\n return (this);\n };\n /** See Compress from Shewchuk page 25. */\n // TODO: Test.\n BigFloat53.prototype.normalize = function () {\n var limbList = this.limbList;\n var len = this.len;\n var limb;\n if (len) {\n var a = len - 1;\n var b = len - 1;\n var q = limbList[a];\n var err = void 0;\n while (a) {\n limb = limbList[--a];\n err = q;\n q += limb;\n err = limb - (q - err);\n limbList[b] = q;\n b -= err && 1;\n q = err || q;\n }\n limbList[b] = q;\n while (++b < len) {\n limb = limbList[b];\n err = q;\n q += limb;\n err -= q - limb;\n limbList[a] = err;\n a += err && 1;\n }\n limbList[a] = q;\n this.len = a + (q && 1);\n }\n return (this);\n };\n /** Multiply this arbitrary precision float by a number.\n * See Scale-Expansion from Shewchuk page 21.\n *\n * @param b Multiplier, a JavaScript floating point number.\n * @param product Arbitrary precision float to overwrite with result.\n * @return Modified product object. */\n BigFloat53.prototype.mulSmall = function (b, product) {\n var limbList = this.limbList;\n var productLimbs = product.limbList;\n var count = this.len;\n var t1, t2, t3;\n var srcPos = 0, dstPos = 0;\n /** Write output limb and move to next, unless a zero was written. */\n function writeLimb(limb) {\n productLimbs[dstPos] = limb;\n dstPos += limb && 1;\n }\n writeLimb(twoProduct(limbList[srcPos++], b));\n var q = tempProduct;\n while (srcPos < count) {\n t1 = twoProduct(limbList[srcPos++], b);\n t2 = q + t1;\n t3 = t2 - q;\n writeLimb(q - (t2 - t3) + (t1 - t3));\n q = tempProduct + t2;\n writeLimb(t2 - (q - tempProduct));\n }\n productLimbs[dstPos] = q;\n product.len = dstPos + (q && 1);\n return (product);\n };\n /** Multiply this by an arbitrary precision multiplier.\n * Pass all components of the multiplier to mulSmall and sum the products.\n *\n * @param multiplier Number or arbitrary precision float.\n * @param product Arbitrary precision float to overwrite with result.\n * @return Modified product object. */\n BigFloat53.prototype.mulBig = function (multiplier, product) {\n var limbList = multiplier.limbList;\n var pos = multiplier.len;\n if (!pos)\n return (product.setZero());\n --pos;\n this.mulSmall(limbList[pos], pos ? temp53[pos & 1] : product);\n while (pos) {\n --pos;\n this.mulSmall(limbList[pos], product).addBig(temp53[~pos & 1], 1, pos ? temp53[pos & 1] : product);\n }\n return (product);\n };\n /** Multiply number or arbitrary precision float with this one\n * and store result in another BigFloat53.\n *\n * @param multiplier Number or arbitrary precision float.\n * @param product Arbitrary precision float to overwrite with result.\n * If omitted, a new one is allocated.\n * @return Modified product object. */\n BigFloat53.prototype.mul = function (multiplier, product) {\n product = product || new BigFloat53();\n if (typeof (multiplier) == 'number') {\n return (this.mulSmall(multiplier, product));\n }\n if (product == this)\n throw (new Error('Cannot multiply in place'));\n return (this.mulBig(multiplier, product));\n };\n BigFloat53.prototype.isZero = function () {\n var limbList = this.limbList;\n var pos = this.len;\n while (pos--) {\n if (limbList[pos])\n return (false);\n }\n return (true);\n };\n BigFloat53.prototype.getSign = function () {\n var t = this.len;\n return (t && (t = this.limbList[t - 1]) && (t > 0 ? 1 : -1));\n };\n /** Return an arbitrary number with sign matching the result of this - other. */\n // TODO: Test.\n BigFloat53.prototype.deltaFrom = function (other) {\n var t = this.len;\n var sign = this.getSign();\n var diff = sign;\n if (typeof (other) != 'number') {\n t = other.len;\n diff -= t && (t = other.limbList[t - 1]) && (t > 0 ? 1 : -1);\n if (diff || !sign)\n return (diff);\n this.addBig(other, -1, temp53[0]);\n }\n else {\n diff -= other && (other > 0 ? 1 : -1);\n if (diff || !sign)\n return (diff);\n this.addSmall(-other, temp53[0]);\n }\n t = temp53[0].len;\n return (t && temp53[0].limbList[t - 1]);\n };\n /** Add a number to this arbitrary precision float.\n * See Grow-Expansion from Shewchuk page 10.\n *\n * @param b JavaScript floating point number to add.\n * @param sum Arbitrary precision float to overwrite with result.\n * @return Modified sum object. */\n BigFloat53.prototype.addSmall = function (b, sum) {\n var limbList = this.limbList;\n var sumLimbs = sum.limbList;\n var count = this.len;\n var estimate;\n var a, b2, err;\n var srcPos = 0, dstPos = 0;\n while (srcPos < count) {\n a = limbList[srcPos++];\n estimate = a + b;\n b2 = estimate - a;\n a -= estimate - b2;\n err = a + (b - b2);\n sumLimbs[dstPos] = err;\n dstPos += err && 1;\n b = estimate;\n }\n sumLimbs[dstPos] = b;\n sum.len = dstPos + (b && 1);\n return (sum);\n };\n /** Add another arbitrary precision float (multiplied by sign) to this one.\n * See Fast-Expansion-Sum from Shewchuk page 13.\n *\n * @param sign Multiplier for negating addend to implement subtraction.\n * @param sum Arbitrary precision float to overwrite with result.\n * @return Modified sum object. */\n BigFloat53.prototype.addBig = function (addend, sign, sum) {\n var augendLimbs = this.limbList;\n var addendLimbs = addend.limbList;\n var sumLimbs = sum.limbList;\n var count = this.len + addend.len;\n var nextAugendPos = 0;\n var nextAddendPos = 0;\n var nextSumPos = 0;\n /** Latest limb of augend. */\n var a = augendLimbs[nextAugendPos++];\n /** Latest limb of addend. */\n var b = addendLimbs[nextAddendPos++] * sign;\n /** Magnitude of latest augend limb. */\n var a2 = a < 0 ? -a : a;\n /** Magnitude of latest addend limb. */\n var b2 = b < 0 ? -b : b;\n var nextLimb, nextLimb2, prevLimb;\n var err;\n if (!count)\n return (sum.setZero());\n // Append sentinel limbs to avoid testing for end of array.\n augendLimbs[this.len] = Infinity;\n addendLimbs[addend.len] = Infinity;\n /** Get next smallest limb from either augend or addend.\n * This avoids merging the two limb lists. */\n function getNextLimb() {\n var result;\n if (a2 < b2) {\n result = a;\n a = augendLimbs[nextAugendPos++];\n a2 = a < 0 ? -a : a;\n }\n else {\n result = b;\n b = addendLimbs[nextAddendPos++] * sign;\n b2 = b < 0 ? -b : b;\n }\n return (result);\n }\n var limb = getNextLimb();\n while (--count) {\n nextLimb = getNextLimb();\n prevLimb = limb;\n limb += nextLimb;\n nextLimb2 = limb - prevLimb;\n err = (prevLimb - (limb - nextLimb2)) + (nextLimb - nextLimb2);\n sumLimbs[nextSumPos] = err;\n nextSumPos += err && 1;\n }\n sumLimbs[nextSumPos] = limb;\n sum.len = nextSumPos + (limb && 1);\n return (sum);\n };\n BigFloat53.prototype.addSub = function (addend, sign, result) {\n result = result || new BigFloat53();\n if (typeof (addend) == 'number')\n return (this.addSmall(sign * addend, result));\n return (this.addBig(addend, sign, result));\n };\n /** Add number or arbitrary precision float to this one\n * and store result in another BigFloat53.\n *\n * @param addend Number or arbitrary precision float.\n * @param sum Arbitrary precision float to overwrite with result.\n * If omitted, a new one is allocated.\n * @return Modified sum object. */\n BigFloat53.prototype.add = function (addend, sum) {\n return (this.addSub(addend, 1, sum));\n };\n /** Subtract number or arbitrary precision float from this one\n * and store result in another BigFloat53.\n *\n * @param subtrahend Number or arbitrary precision float.\n * @param difference Arbitrary precision float to overwrite with result.\n * If omitted, a new one is allocated.\n * @return Modified difference object. */\n BigFloat53.prototype.sub = function (subtrahend, difference) {\n return (this.addSub(subtrahend, -1, difference));\n };\n /** Round towards zero, to (at least) given number of base 2^53 fractional digits. */\n BigFloat53.prototype.truncate = function (fractionLimbCount) {\n this.normalize();\n var limbList = this.limbList;\n var len = this.len;\n // Use binary search to find last |limb| < 1.\n var lo = 0;\n var hi = len;\n var mid = 0;\n var limb = 0;\n while (lo < hi) {\n mid = (lo + hi) >> 1;\n limb = limbList[mid];\n if (limb > -1 && limb < 1) {\n lo = mid + 1;\n }\n else {\n hi = mid;\n }\n }\n if (mid && (limb <= -1 || limb >= 1)) {\n limb = limbList[--mid];\n }\n // Slice off limbs before and including it,\n // except the fractionLimbCount last ones.\n mid -= fractionLimbCount - 1;\n if (mid > 0) {\n this.len -= mid;\n len = this.len;\n for (var pos = 0; pos < len; ++pos) {\n limbList[pos] = limbList[pos + mid];\n }\n }\n return (this);\n };\n BigFloat53.prototype.round = function (decimalCount) {\n return (this.truncate(1 + ~~(decimalCount * limbsPerDigit53)));\n };\n BigFloat53.prototype.valueOf = function () {\n var limbList = this.limbList;\n var len = this.len;\n var result = 0;\n for (var pos = 0; pos < len; ++pos) {\n result += limbList[pos];\n }\n return (result);\n };\n /** Convert to string in any even base supported by Number.toString.\n * @return String in lower case. */\n BigFloat53.prototype.toString = function (base) {\n var limbList = this.limbList;\n var pos = this.len;\n temp32$1[pos & 1].setZero();\n while (pos--) {\n temp32$1[~pos & 1].add(limbList[pos], temp32$1[pos & 1]);\n }\n return (temp32$1[~pos & 1].toString(base));\n };\n return BigFloat53;\n }());\n BigFloat53.prototype.cmp = BigFloat53.prototype.deltaFrom;\n /** Latest approximate product from twoProduct. */\n var tempProduct = 0;\n /** Temporary values for internal calculations. */\n var temp32$1 = [new BigFloat32(), new BigFloat32()];\n /** Temporary values for internal calculations. */\n var temp53 = [new BigFloat53(), new BigFloat53()];\n\n // This file is part of bigfloat, copyright (c) 2018- BusFaster Ltd.\n /** Simpler replacement for the default TypeScript helper.\n * Ignores static members and avoids rollup warnings. */\n function __extends(child, parent) {\n function helper() { this.constructor = child; }\n helper.prototype = parent.prototype;\n child.prototype = new helper();\n }\n var BigComplex = /** @class */ (function () {\n function BigComplex(real, imag, base) {\n this.real = typeof (real) == 'object' ? real : new this.Base(real, base);\n this.imag = typeof (imag) == 'object' ? imag : new this.Base(imag, base);\n }\n BigComplex.prototype.clone = function () {\n var other = new this.constructor(this.real.clone(), this.imag.clone());\n return (other);\n };\n BigComplex.prototype.setZero = function () {\n this.real.setZero();\n this.imag.setZero();\n return (this);\n };\n BigComplex.prototype.setValue = function (other) {\n this.real.setValue(other.real);\n this.imag.setValue(other.imag);\n return (this);\n };\n BigComplex.prototype.mul = function (multiplier, product) {\n product = product || new this.constructor();\n if (multiplier instanceof BigComplex) {\n this.real.mul(multiplier.real, this.temp1);\n this.imag.mul(multiplier.imag, this.temp2);\n this.temp1.sub(this.temp2, product.real);\n this.real.mul(multiplier.imag, this.temp1);\n this.imag.mul(multiplier.real, this.temp2);\n this.temp1.add(this.temp2, product.imag);\n }\n else {\n this.real.mul(multiplier, product.real);\n this.imag.mul(multiplier, product.imag);\n }\n return (product);\n };\n BigComplex.prototype.sqr = function (product) {\n product = product || new this.constructor();\n this.real.mul(this.real, this.temp1);\n this.imag.mul(this.imag, this.temp2);\n this.temp1.sub(this.temp2, product.real);\n this.real.mul(this.imag, this.temp1);\n this.temp1.add(this.temp1, product.imag);\n return (product);\n };\n BigComplex.prototype.add = function (addend, sum) {\n sum = sum || new this.constructor();\n if (addend instanceof BigComplex) {\n this.real.add(addend.real, sum.real);\n this.imag.add(addend.imag, sum.imag);\n }\n else {\n this.real.add(addend, sum.real);\n }\n return (sum);\n };\n BigComplex.prototype.sub = function (subtrahend, difference) {\n difference = difference || new this.constructor();\n if (subtrahend instanceof BigComplex) {\n this.real.sub(subtrahend.real, difference.real);\n this.imag.sub(subtrahend.imag, difference.imag);\n }\n else {\n this.real.sub(subtrahend, difference.real);\n }\n return (difference);\n };\n BigComplex.prototype.truncate = function (fractionLimbCount) {\n this.real.truncate(fractionLimbCount);\n this.imag.truncate(fractionLimbCount);\n return (this);\n };\n return BigComplex;\n }());\n var BigComplex32 = /** @class */ (function (_super) {\n __extends(BigComplex32, _super);\n function BigComplex32() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return BigComplex32;\n }(BigComplex));\n var BigComplex53 = /** @class */ (function (_super) {\n __extends(BigComplex53, _super);\n function BigComplex53() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return BigComplex53;\n }(BigComplex));\n BigComplex32.prototype.Base = BigFloat32;\n BigComplex32.prototype.temp1 = new BigFloat32();\n BigComplex32.prototype.temp2 = new BigFloat32();\n BigComplex53.prototype.Base = BigFloat53;\n BigComplex53.prototype.temp1 = new BigFloat53();\n BigComplex53.prototype.temp2 = new BigFloat53();\n\n // This file is part of bigfloat, copyright (c) 2015- BusFaster Ltd.\n\n exports.BigFloat32 = BigFloat32;\n exports.BigFloat53 = BigFloat53;\n exports.BigComplex32 = BigComplex32;\n exports.BigComplex53 = BigComplex53;\n exports.trimNumber = trimNumber;\n exports.numberToString = numberToString;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n","import { BigFloat32 } from 'bigfloat';\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _construct(t, e, r) {\n if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);\n var o = [null];\n o.push.apply(o, e);\n var p = new (t.bind.apply(t, o))();\n return r && _setPrototypeOf(p, r.prototype), p;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _getPrototypeOf(t) {\n return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {\n return t.__proto__ || Object.getPrototypeOf(t);\n }, _getPrototypeOf(t);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _isNativeFunction(t) {\n try {\n return -1 !== Function.toString.call(t).indexOf(\"[native code]\");\n } catch (n) {\n return \"function\" == typeof t;\n }\n}\nfunction _isNativeReflectConstruct() {\n try {\n var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n } catch (t) {}\n return (_isNativeReflectConstruct = function () {\n return !!t;\n })();\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\nfunction _wrapNativeSuper(t) {\n var r = \"function\" == typeof Map ? new Map() : void 0;\n return _wrapNativeSuper = function (t) {\n if (null === t || !_isNativeFunction(t)) return t;\n if (\"function\" != typeof t) throw new TypeError(\"Super expression must either be null or a function\");\n if (void 0 !== r) {\n if (r.has(t)) return r.get(t);\n r.set(t, Wrapper);\n }\n function Wrapper() {\n return _construct(t, arguments, _getPrototypeOf(this).constructor);\n }\n return Wrapper.prototype = Object.create(t.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), _setPrototypeOf(Wrapper, t);\n }, _wrapNativeSuper(t);\n}\n\n/**\r\n * Interval represents a closed interval on ℝ.\r\n * Zero-length intervals (where lo == hi) represent single points.\r\n * If lo > hi then the interval is empty.\r\n */\nvar Interval = /*#__PURE__*/function () {\n /**\r\n * Returns a new Interval.\r\n * @category Constructors\r\n */\n function Interval(lo, hi) {\n this.lo = 0.0;\n this.hi = 0.0;\n this.lo = lo;\n this.hi = hi;\n }\n /**\r\n * Reports whether the interval is empty.\r\n */\n var _proto = Interval.prototype;\n _proto.isEmpty = function isEmpty() {\n return this.lo > this.hi;\n }\n /**\r\n * Returns true iff the interval contains the same points as oi.\r\n */;\n _proto.equals = function equals(oi) {\n return this.lo == oi.lo && this.hi == oi.hi || this.isEmpty() && oi.isEmpty();\n }\n /**\r\n * Returns the midpoint of the interval.\r\n * Behaviour is undefined for empty intervals.\r\n */;\n _proto.center = function center() {\n return 0.5 * (this.lo + this.hi);\n }\n /**\r\n * Returns the length of the interval.\r\n * The length of an empty interval is negative.\r\n */;\n _proto.length = function length() {\n return this.hi - this.lo;\n }\n /**\r\n * Returns true iff the interval contains p.\r\n */;\n _proto.contains = function contains(p) {\n return this.lo <= p && p <= this.hi;\n }\n /**\r\n * Returns true iff the interval contains oi.\r\n */;\n _proto.containsInterval = function containsInterval(oi) {\n if (oi.isEmpty()) return true;\n return this.lo <= oi.lo && oi.hi <= this.hi;\n }\n /**\r\n * Returns true iff the interval strictly contains p.\r\n */;\n _proto.interiorContains = function interiorContains(p) {\n return this.lo < p && p < this.hi;\n }\n /**\r\n * Returns true iff the interval strictly contains oi.\r\n */;\n _proto.interiorContainsInterval = function interiorContainsInterval(oi) {\n if (oi.isEmpty()) return true;\n return this.lo < oi.lo && oi.hi < this.hi;\n }\n /**\r\n * Returns true iff the interval contains any points in common with oi.\r\n */;\n _proto.intersects = function intersects(oi) {\n if (this.lo <= oi.lo) return oi.lo <= this.hi && oi.lo <= oi.hi; // oi.lo ∈ i and oi is not empty\n return this.lo <= oi.hi && this.lo <= this.hi; // i.lo ∈ oi and i is not empty\n }\n /**\r\n * Returns true iff the interior of the interval contains any points in common with oi, including the latter's boundary.\r\n */;\n _proto.interiorIntersects = function interiorIntersects(oi) {\n return oi.lo < this.hi && this.lo < oi.hi && this.lo < this.hi && oi.lo <= oi.hi;\n }\n /**\r\n * Returns the interval containing all points common to i and j.\r\n * Empty intervals do not need to be special-cased.\r\n */;\n _proto.intersection = function intersection(j) {\n return new Interval(Math.max(this.lo, j.lo), Math.min(this.hi, j.hi));\n }\n /**\r\n * Returns the smallest interval that contains this interval and the given interval.\r\n */;\n _proto.union = function union(oi) {\n if (this.isEmpty()) return oi;\n if (oi.isEmpty()) return this;\n return new Interval(Math.min(this.lo, oi.lo), Math.max(this.hi, oi.hi));\n }\n /**\r\n * Returns the interval expanded so that it contains the given point.\r\n */;\n _proto.addPoint = function addPoint(p) {\n if (this.isEmpty()) return new Interval(p, p);\n if (p < this.lo) return new Interval(p, this.hi);\n if (p > this.hi) return new Interval(this.lo, p);\n return this;\n }\n /**\r\n * Returns the closest point in the interval to the given point p.\r\n * The interval must be non-empty.\r\n */;\n _proto.clampPoint = function clampPoint(p) {\n return Math.max(this.lo, Math.min(this.hi, p));\n }\n /**\r\n * Returns an interval that has been expanded on each side by margin.\r\n * If margin is negative, then the function shrinks the interval on each side by margin instead.\r\n * The resulting interval may be empty.\r\n * Any expansion of an empty interval remains empty.\r\n */;\n _proto.expanded = function expanded(margin) {\n if (this.isEmpty()) return this;\n return new Interval(this.lo - margin, this.hi + margin);\n }\n /**\r\n * Reports whether the interval can be transformed into the given interval by moving each endpoint a small distance.\r\n * The empty interval is considered to be positioned arbitrarily on the real line, so any interval with a small enough length will match the empty interval.\r\n */;\n _proto.approxEqual = function approxEqual(oi, epsilon) {\n if (epsilon === void 0) {\n epsilon = 1e-15;\n }\n if (this.isEmpty()) return oi.length() <= 2 * epsilon;\n if (oi.isEmpty()) return this.length() <= 2 * epsilon;\n return Math.abs(oi.lo - this.lo) <= epsilon && Math.abs(oi.hi - this.hi) <= epsilon;\n }\n /**\r\n * Returns the Hausdorff distance to the given interval. For two intervals x and y, this distance is defined as:\r\n * h(x, y) = max_{p in x} min_{q in y} d(p, q).\r\n */;\n _proto.directedHausdorffDistance = function directedHausdorffDistance(oi) {\n if (this.isEmpty()) return 0;\n if (oi.isEmpty()) return Infinity;\n return Math.max(0, Math.max(this.hi - oi.hi, oi.lo - this.lo));\n }\n /**\r\n * Truncates {lo, hi} floats to n digits of precision.\r\n */;\n _proto.trunc = function trunc(n) {\n if (n === void 0) {\n n = 15;\n }\n var p = Number(\"1e\" + n);\n var trunc = function trunc(dim) {\n return Math.round(dim * p) / p;\n };\n return new Interval(trunc(this.lo), trunc(this.hi));\n }\n /**\r\n * Generates a human readable string.\r\n */;\n _proto.toString = function toString() {\n var t = this.trunc(7);\n return \"[\" + t.lo.toFixed(7) + \", \" + t.hi.toFixed(7) + \"]\";\n }\n /**\r\n * Returns an empty interval.\r\n * @category Constructors\r\n */;\n Interval.empty = function empty() {\n return new Interval(1, 0);\n }\n /**\r\n * Returns an interval representing a single point.\r\n * @category Constructors\r\n */;\n Interval.fromPoint = function fromPoint(p) {\n return new Interval(p, p);\n };\n return Interval;\n}();\n\n/**\r\n * Module r1 implements types and functions for working with geometry in ℝ¹.\r\n * @module r1\r\n */\n\nvar _index = {\n __proto__: null,\n Interval: Interval\n};\n\n/**\r\n * Point represents a point in ℝ².\r\n */\nvar Point = /*#__PURE__*/function () {\n /**\r\n * Returns a new Point.\r\n * @category Constructors\r\n */\n function Point(x, y) {\n if (x === void 0) {\n x = 0.0;\n }\n if (y === void 0) {\n y = 0.0;\n }\n this.x = 0.0;\n this.y = 0.0;\n this.x = x;\n this.y = y;\n }\n /** Returns the sum of p and op. */\n var _proto = Point.prototype;\n _proto.add = function add(op) {\n return new Point(this.x + op.x, this.y + op.y);\n }\n /** Returns the difference of p and op. */;\n _proto.sub = function sub(op) {\n return new Point(this.x - op.x, this.y - op.y);\n }\n /** Returns the scalar product of p and m. */;\n _proto.mul = function mul(m) {\n return new Point(this.x * m, this.y * m);\n }\n /** Returns a counterclockwise orthogonal point with the same norm. */;\n _proto.ortho = function ortho() {\n return new Point(-this.y, this.x);\n }\n /** Returns the dot product between p and op. */;\n _proto.dot = function dot(op) {\n return this.x * op.x + this.y * op.y;\n }\n /** Returns the cross product of p and op. */;\n _proto.cross = function cross(op) {\n return this.x * op.y - this.y * op.x;\n }\n /** Returns the vector's norm. */;\n _proto.norm = function norm() {\n return Math.hypot(this.x, this.y);\n }\n /** Returns a unit point in the same direction as p. */;\n _proto.normalize = function normalize() {\n if (this.x == 0.0 && this.y == 0.0) return this;\n return this.mul(1 / this.norm());\n }\n /** Truncates {x, y} floats to n digits of precision. */;\n _proto.trunc = function trunc(n) {\n if (n === void 0) {\n n = 15;\n }\n var p = Number(\"1e\" + n);\n var trunc = function trunc(dim) {\n return Math.round(dim * p) / p;\n };\n return new Point(trunc(this.x), trunc(this.y));\n }\n /**\r\n * Reports whether this point equals another point.\r\n */;\n _proto.equals = function equals(op) {\n return this.x === op.x && this.y === op.y;\n }\n /** Generates a human readable string. */;\n _proto.toString = function toString() {\n var t = this.trunc(12);\n return \"(\" + t.x.toFixed(12) + \", \" + t.y.toFixed(12) + \")\";\n };\n return Point;\n}();\n\n/**\r\n * Rect represents a closed axis-aligned rectangle in the (x,y) plane.\r\n */\nvar Rect = /*#__PURE__*/function () {\n /**\r\n * Returns a new Rect.\r\n * @category Constructors\r\n */\n function Rect(x, y) {\n if (x === void 0) {\n x = new Interval(0, 0);\n }\n if (y === void 0) {\n y = new Interval(0, 0);\n }\n this.x = x;\n this.y = y;\n }\n /**\r\n * Reports whether the rectangle is valid.\r\n * This requires the width to be empty iff the height is empty.\r\n */\n var _proto = Rect.prototype;\n _proto.isValid = function isValid() {\n return this.x.isEmpty() == this.y.isEmpty();\n }\n /**\r\n * Reports whether the rectangle is empty.\r\n */;\n _proto.isEmpty = function isEmpty() {\n return this.x.isEmpty();\n }\n /**\r\n * Vertices returns all four vertices of the rectangle.\r\n * Vertices are returned in CCW direction starting with the lower left corner.\r\n */;\n _proto.vertices = function vertices() {\n return [new Point(this.x.lo, this.y.lo), new Point(this.x.hi, this.y.lo), new Point(this.x.hi, this.y.hi), new Point(this.x.lo, this.y.hi)];\n }\n /**\r\n * VertexIJ returns the vertex in direction i along the X-axis (0=left, 1=right) and direction j along the Y-axis (0=down, 1=up).\r\n */;\n _proto.vertexIJ = function vertexIJ(i, j) {\n var x = this.x.lo;\n if (i == 1) x = this.x.hi;\n var y = this.y.lo;\n if (j == 1) y = this.y.hi;\n return new Point(x, y);\n }\n /**\r\n * Returns the low corner of the rect.\r\n */;\n _proto.lo = function lo() {\n return new Point(this.x.lo, this.y.lo);\n }\n /**\r\n * Returns the high corner of the rect.\r\n */;\n _proto.hi = function hi() {\n return new Point(this.x.hi, this.y.hi);\n }\n /**\r\n * Returns the center of the rectangle in (x,y)-space.\r\n */;\n _proto.center = function center() {\n return new Point(this.x.center(), this.y.center());\n }\n /**\r\n * Returns the width and height of this rectangle in (x,y)-space.\r\n * Empty rectangles have a negative width and height.\r\n */;\n _proto.size = function size() {\n return new Point(this.x.length(), this.y.length());\n }\n /**\r\n * Reports whether the rectangle contains the given point.\r\n * Rectangles are closed regions, i.e. they contain their boundary.\r\n */;\n _proto.containsPoint = function containsPoint(p) {\n return this.x.contains(p.x) && this.y.contains(p.y);\n }\n /**\r\n * Returns true iff the given point is contained in the interior of the region (i.e. the region excluding its boundary).\r\n */;\n _proto.interiorContainsPoint = function interiorContainsPoint(p) {\n return this.x.interiorContains(p.x) && this.y.interiorContains(p.y);\n }\n /**\r\n * Reports whether the rectangle contains the given rectangle.\r\n */;\n _proto.contains = function contains(or) {\n return this.x.containsInterval(or.x) && this.y.containsInterval(or.y);\n }\n /**\r\n * Reports whether the interior of this rectangle contains all of the points of the given or: Rectangle (including its boundary).\r\n */;\n _proto.interiorContains = function interiorContains(or) {\n return this.x.interiorContainsInterval(or.x) && this.y.interiorContainsInterval(or.y);\n }\n /**\r\n * Reports whether this rectangle and the or: Rectangle have any points in common.\r\n */;\n _proto.intersects = function intersects(or) {\n return this.x.intersects(or.x) && this.y.intersects(or.y);\n }\n /**\r\n * Reports whether the interior of this rectangle intersects any point (including the boundary) of the given or: Rectangle.\r\n */;\n _proto.interiorIntersects = function interiorIntersects(or) {\n return this.x.interiorIntersects(or.x) && this.y.interiorIntersects(or.y);\n }\n /**\r\n * Expands the rectangle to include the given point.\r\n * The rectangle is expanded by the minimum amount possible.\r\n */;\n _proto.addPoint = function addPoint(p) {\n return new Rect(this.x.addPoint(p.x), this.y.addPoint(p.y));\n }\n /**\r\n * Expands the rectangle to include the given rectangle.\r\n * This is the same as replacing the rectangle by the union of the two rectangles, but is more efficient.\r\n */;\n _proto.addRect = function addRect(or) {\n return new Rect(this.x.union(or.x), this.y.union(or.y));\n }\n /**\r\n * Returns the closest point in the rectangle to the given point.\r\n * The rectangle must be non-empty.\r\n */;\n _proto.clampPoint = function clampPoint(p) {\n return new Point(this.x.clampPoint(p.x), this.y.clampPoint(p.y));\n }\n /**\r\n * Returns a rectangle that has been expanded in the x-direction by margin.X, and in y-direction by margin.Y.\r\n * If either margin is empty, then shrink the interval on the corresponding sides instead.\r\n * The resulting rectangle may be empty.\r\n * Any expansion of an empty rectangle remains empty.\r\n */;\n _proto.expanded = function expanded(margin) {\n var xx = this.x.expanded(margin.x);\n var yy = this.y.expanded(margin.y);\n if (xx.isEmpty() || yy.isEmpty()) {\n return Rect.empty();\n }\n return new Rect(xx, yy);\n }\n /**\r\n * Returns a Rect that has been expanded by the amount on all sides.\r\n */;\n _proto.expandedByMargin = function expandedByMargin(margin) {\n return this.expanded(new Point(margin, margin));\n }\n /**\r\n * Returns the smallest rectangle containing the union of this rectangle and the given rectangle.\r\n */;\n _proto.union = function union(or) {\n return new Rect(this.x.union(or.x), this.y.union(or.y));\n }\n /**\r\n * Returns the smallest rectangle containing the intersection of this rectangle and the given rectangle.\r\n */;\n _proto.intersection = function intersection(or) {\n var xx = this.x.intersection(or.x);\n var yy = this.y.intersection(or.y);\n if (xx.isEmpty() || yy.isEmpty()) {\n return Rect.empty();\n }\n return new Rect(xx, yy);\n }\n /**\r\n * Returns true if the x- and y-intervals of the two rectangles are the same up to the given tolerance.\r\n */;\n _proto.approxEqual = function approxEqual(or) {\n return this.x.approxEqual(or.x) && this.y.approxEqual(or.y);\n }\n /** Generates a human readable string. */;\n _proto.string = function string() {\n return \"[\" + this.lo().toString() + \", \" + this.hi.toString() + \"]\";\n }\n /**\r\n * Constructs a Rect that contains the given points.\r\n * @category Constructors\r\n */;\n Rect.fromPoints = function fromPoints() {\n for (var _len = arguments.length, pts = new Array(_len), _key = 0; _key < _len; _key++) {\n pts[_key] = arguments[_key];\n }\n // Because the default value on interval is 0,0, we need to manually\n // define the interval from the first point passed in as our starting\n // interval, otherwise we end up with the case of passing in\n // Point{0.2, 0.3} and getting the starting Rect of {0, 0.2}, {0, 0.3}\n // instead of the Rect {0.2, 0.2}, {0.3, 0.3} which is not correct.\n if (pts.length == 0) return new Rect();\n var r = new Rect(new Interval(pts[0].x, pts[0].x), new Interval(pts[0].y, pts[0].y));\n for (var i = 1; i < pts.length; i++) r = r.addPoint(pts[i]);\n return r;\n }\n /**\r\n * Constructs a rectangle with the given center and size.\r\n * Both dimensions of size must be non-negative.\r\n * @category Constructors\r\n */;\n Rect.fromCenterSize = function fromCenterSize(center, size) {\n return new Rect(new Interval(center.x - size.x / 2, center.x + size.x / 2), new Interval(center.y - size.y / 2, center.y + size.y / 2));\n }\n /**\r\n * Constructs a rectangle from another rectangle (ie. make a copy)\r\n * @category Constructors\r\n */;\n Rect.fromRect = function fromRect(or) {\n return new Rect(new Interval(or.x.lo, or.x.hi), new Interval(or.y.lo, or.y.hi));\n }\n /**\r\n * Constructs the canonical empty rectangle.\r\n * Use isEmpty() to test for empty rectangles, since they have more than one representation.\r\n * new Interval(0, 0) is not the same as the empty Rect.\r\n * @category Constructors\r\n */;\n Rect.empty = function empty() {\n return new Rect(Interval.empty(), Interval.empty());\n };\n return Rect;\n}();\n\n/**\r\n * Module r2 implements types and functions for working with geometry in ℝ².\r\n * @module r2\r\n */\n\nvar _index$1 = {\n __proto__: null,\n Point: Point,\n Rect: Rect\n};\n\n/**\r\n * Vector represents a point in ℝ³\r\n */\nvar Vector = /*#__PURE__*/function () {\n /**\r\n * Returns a new Vector.\r\n * @category Constructors\r\n */\n function Vector(x, y, z) {\n this.x = 0.0;\n this.y = 0.0;\n this.z = 0.0;\n this.x = x;\n this.y = y;\n this.z = z;\n }\n /** Reports whether v and ov are equal within a small epsilon. */\n var _proto = Vector.prototype;\n _proto.approxEqual = function approxEqual(ov) {\n var epsilon = 1e-16;\n return Math.abs(this.x - ov.x) < epsilon && Math.abs(this.y - ov.y) < epsilon && Math.abs(this.z - ov.z) < epsilon;\n }\n /**\r\n * Generates a human readable string.\r\n */;\n _proto.toString = function toString() {\n return \"(\" + this.x.toFixed(24) + \", \" + this.y.toFixed(24) + \", \" + this.z.toFixed(24) + \")\";\n }\n // Returns the vector's norm.\n ;\n _proto.norm = function norm() {\n return Math.sqrt(this.dot(this));\n }\n /** Returns the square of the norm. */;\n _proto.norm2 = function norm2() {\n return this.dot(this);\n }\n /** Returns a unit vector in the same direction as v. */;\n _proto.normalize = function normalize() {\n var n2 = this.norm2();\n if (n2 == 0) return new Vector(0, 0, 0);\n return this.mul(1 / Math.sqrt(n2));\n }\n /** Returns whether this vector is of approximately unit length. */;\n _proto.isUnit = function isUnit() {\n var epsilon = 5e-14;\n return Math.abs(this.norm2() - 1) <= epsilon;\n }\n /** Returns the vector with nonnegative components. */;\n _proto.abs = function abs() {\n return new Vector(Math.abs(this.x), Math.abs(this.y), Math.abs(this.z));\n }\n /** Returns the standard vector sum of v and ov. */;\n _proto.add = function add(ov) {\n return new Vector(this.x + ov.x, this.y + ov.y, this.z + ov.z);\n }\n /** Returns the standard vector difference of v and ov. */;\n _proto.sub = function sub(ov) {\n return new Vector(this.x - ov.x, this.y - ov.y, this.z - ov.z);\n }\n /** Returns the standard scalar product of v and m. */;\n _proto.mul = function mul(m) {\n return new Vector(m * this.x, m * this.y, m * this.z);\n }\n /** Returns the standard dot product of v and ov. */;\n _proto.dot = function dot(ov) {\n return this.x * ov.x + this.y * ov.y + this.z * ov.z || 0;\n }\n /** Returns the standard cross product of v and ov. */;\n _proto.cross = function cross(ov) {\n return new Vector(this.y * ov.z - this.z * ov.y, this.z * ov.x - this.x * ov.z, this.x * ov.y - this.y * ov.x);\n }\n /** Returns the Euclidean distance between v and ov. */;\n _proto.distance = function distance(ov) {\n return this.sub(ov).norm();\n }\n /** Returns the angle between v and ov. */;\n _proto.angle = function angle(ov) {\n return Math.atan2(this.cross(ov).norm(), this.dot(ov));\n }\n /**\r\n * Returns a unit vector that is orthogonal to v.\r\n * ortho(-v) = -ortho(v) for all v.\r\n */;\n _proto.ortho = function ortho() {\n var ov = new Vector(0, 0, 0);\n var lc = this.largestComponent();\n if (lc === Vector.X_AXIS) ov.z = 1;else if (lc === Vector.Y_AXIS) ov.x = 1;else ov.y = 1;\n return this.cross(ov).normalize();\n }\n /** Returns the Axis that represents the largest component in this vector. */;\n _proto.largestComponent = function largestComponent() {\n var t = this.abs();\n if (t.x > t.y) {\n if (t.x > t.z) return Vector.X_AXIS;\n return Vector.Z_AXIS;\n }\n if (t.y > t.z) return Vector.Y_AXIS;\n return Vector.Z_AXIS;\n }\n /** Returns the Axis that represents the smallest component in this vector. */;\n _proto.smallestComponent = function smallestComponent() {\n var t = this.abs();\n if (t.x < t.y) {\n if (t.x < t.z) return Vector.X_AXIS;\n return Vector.Z_AXIS;\n }\n if (t.y < t.z) return Vector.Y_AXIS;\n return Vector.Z_AXIS;\n }\n /**\r\n * Reports whether this Vector equals another Vector.\r\n */;\n _proto.equals = function equals(ov) {\n return this.x == ov.x && this.y == ov.y && this.z == ov.z;\n }\n /**\r\n * Compares v and ov lexicographically and returns:\r\n *\r\n * \t-1 if v < ov\r\n * \t 0 if v == ov\r\n * \t+1 if v > ov\r\n *\r\n * This method is based on C++'s std::lexicographical_compare. Two entities\r\n * are compared element by element with the given operator. The first mismatch\r\n * defines which is less (or greater) than the other. If both have equivalent\r\n * values they are lexicographically equal.\r\n */;\n _proto.cmp = function cmp(ov) {\n if (this.x < ov.x) return -1;\n if (this.x > ov.x) return 1;\n // First elements were the same, try the next.\n if (this.y < ov.y) return -1;\n if (this.y > ov.y) return 1;\n // Second elements were the same return the final compare.\n if (this.z < ov.z) return -1;\n if (this.z > ov.z) return 1;\n // Both are equal\n return 0;\n };\n return Vector;\n}();\n/**\r\n * @categoryDescription Axis\r\n * The three axes of ℝ³.\r\n */\n/**\r\n * X Axis\r\n * @category Axis\r\n */\nVector.X_AXIS = 0;\n/**\r\n * Y Axis\r\n * @category Axis\r\n */\nVector.Y_AXIS = 1;\n/**\r\n * Z Axis\r\n * @category Axis\r\n */\nVector.Z_AXIS = 2;\n\n/**\r\n * Represents a point in ℝ³ using high-precision values.\r\n * Note that this is NOT a complete implementation because there are some operations that Vector supports that are not feasible with arbitrary precision math.\r\n */\nvar PreciseVector = /*#__PURE__*/function () {\n /**\r\n * Returns a new PreciseVector.\r\n * @category Constructors\r\n */\n function PreciseVector(x, y, z) {\n this.x = x;\n this.y = y;\n this.z = z;\n }\n /**\r\n * Creates a high precision vector from the given Vector.\r\n * @category Constructors\r\n */\n PreciseVector.fromVector = function fromVector(v) {\n return new PreciseVector(new BigFloat32(v.x), new BigFloat32(v.y), new BigFloat32(v.z));\n }\n /**\r\n * Converts this precise vector to a Vector.\r\n */;\n var _proto = PreciseVector.prototype;\n _proto.vector = function vector() {\n return new Vector(this.x.valueOf(), this.y.valueOf(), this.z.valueOf()).normalize();\n }\n /**\r\n * Reports whether this vector and another precise vector are equal.\r\n */;\n _proto.equals = function equals(ov) {\n return this.x.cmp(ov.x) === 0 && this.y.cmp(ov.y) === 0 && this.z.cmp(ov.z) === 0;\n }\n /**\r\n * Returns a string representation of the vector.\r\n */;\n _proto.toString = function toString() {\n return \"(\" + this.x.toString() + \", \" + this.y.toString() + \", \" + this.z.toString() + \")\";\n }\n /**\r\n * Returns the square of the norm.\r\n */;\n _proto.norm2 = function norm2() {\n return this.dot(this);\n }\n /**\r\n * Reports whether this vector is of unit length.\r\n */;\n _proto.isUnit = function isUnit() {\n return this.norm2().cmp(new BigFloat32(1)) === 0;\n }\n /**\r\n * Returns the vector with nonnegative components.\r\n */;\n _proto.abs = function abs() {\n var x = this.x.mul(this.x.getSign());\n var y = this.y.mul(this.y.getSign());\n var z = this.z.mul(this.z.getSign());\n return new PreciseVector(x, y, z);\n }\n /**\r\n * Returns the standard vector sum of this vector and another.\r\n */;\n _proto.add = function add(ov) {\n return new PreciseVector(this.x.add(ov.x), this.y.add(ov.y), this.z.add(ov.z));\n }\n /**\r\n * Returns the standard vector difference of this vector and another.\r\n */;\n _proto.sub = function sub(ov) {\n return new PreciseVector(this.x.sub(ov.x), this.y.sub(ov.y), this.z.sub(ov.z));\n }\n /**\r\n * Returns the standard scalar product of this vector and a BigFloat.\r\n */;\n _proto.mul = function mul(f) {\n return new PreciseVector(this.x.mul(f), this.y.mul(f), this.z.mul(f));\n }\n /**\r\n * Returns the standard scalar product of this vector and a float.\r\n */;\n _proto.mulByFloat64 = function mulByFloat64(f) {\n return this.mul(new BigFloat32(f));\n }\n /**\r\n * Returns the standard dot product of this vector and another.\r\n */;\n _proto.dot = function dot(ov) {\n return this.x.mul(ov.x).add(this.y.mul(ov.y).add(this.z.mul(ov.z)));\n }\n /**\r\n * Returns the standard cross product of this vector and another.\r\n */;\n _proto.cross = function cross(ov) {\n return new PreciseVector(this.y.mul(ov.z).sub(this.z.mul(ov.y)), this.z.mul(ov.x).sub(this.x.mul(ov.z)), this.x.mul(ov.y).sub(this.y.mul(ov.x)));\n }\n /**\r\n * Returns the axis that represents the largest component in this vector.\r\n */;\n _proto.largestComponent = function largestComponent() {\n var t = this.abs();\n if (t.x.cmp(t.y) > 0) {\n if (t.x.cmp(t.z) > 0) return Vector.X_AXIS;\n return Vector.Z_AXIS;\n }\n if (t.y.cmp(t.z) > 0) return Vector.Y_AXIS;\n return Vector.Z_AXIS;\n }\n /**\r\n * Returns the axis that represents the smallest component in this vector.\r\n */;\n _proto.smallestComponent = function smallestComponent() {\n var t = this.abs();\n if (t.x.cmp(t.y) < 0) {\n if (t.x.cmp(t.z) < 0) return Vector.X_AXIS;\n return Vector.Z_AXIS;\n }\n if (t.y.cmp(t.z) < 0) return Vector.Y_AXIS;\n return Vector.Z_AXIS;\n }\n /**\r\n * Reports if this vector is exactly 0 efficiently.\r\n */;\n _proto.isZero = function isZero() {\n return this.x.isZero() && this.y.isZero() && this.z.isZero();\n };\n return PreciseVector;\n}();\n\n/**\r\n * Module r3 implements types and functions for working with geometry in ℝ³\r\n * @module r3\r\n */\n\nvar _index$2 = {\n __proto__: null,\n Vector: Vector,\n PreciseVector: PreciseVector\n};\n\n// angle units.\nvar DEGREE = Math.PI / 180;\n\n/** Computes the IEEE 754 floating-point remainder of x / y. */\nvar remainder = function remainder(x, y) {\n if (isNaN(x) || isNaN(y) || !isFinite(x) || y === 0) return NaN;\n var quotient = x / y;\n var n = Math.round(quotient);\n // When quotient is exactly halfway between two integers, round to the nearest even integer\n if (Math.abs(quotient - n) === 0.5) n = 2 * Math.round(quotient / 2);\n var rem = x - n * y;\n return !rem ? Math.sign(x) * 0 : rem;\n};\n/** Returns the next representable floating-point value after x towards y. */\nvar nextAfter = function nextAfter(x, y) {\n if (isNaN(x) || isNaN(y)) return NaN;\n if (x === y) return y;\n if (x === 0) return y > 0 ? Number.MIN_VALUE : -Number.MIN_VALUE;\n var buffer = new ArrayBuffer(8);\n var view = new DataView(buffer);\n view.setFloat64(0, x, true);\n var bits = view.getBigUint64(0, true);\n if (x > 0 === y > x) bits += 1n;else bits -= 1n;\n view.setBigUint64(0, bits, true);\n return view.getFloat64(0, true);\n};\n/**\r\n * Returns the offset of the lest significant bit set.\r\n * Offset 0 corresponds to the rightmost bit, 63 is the leftmost bit.\r\n * If none of the rightmost 64 bits are set then 64 is returned.\r\n */\nvar findLSBSetNonZero64 = function findLSBSetNonZero64(i) {\n var lsb = i & -i & 0xffffffffffffffffn;\n if (lsb === 0n) return 64;\n var lo = Math.clz32(Number(lsb & 0xffffffffn));\n if (lo < 32) return 31 - lo;\n var hi = Math.clz32(Number(lsb >> 32n & 0xffffffffn));\n return 63 - hi;\n};\n/**\r\n * Returns the offset of the most significant bit set.\r\n * Offset 0 corresponds to the rightmost bit, 63 is the leftmost bit.\r\n * If none of the rightmost 64 bits are set then 64 is returned.\r\n */\nvar findMSBSetNonZero64 = function findMSBSetNonZero64(i) {\n var msb = i & 0xffffffffffffffffn;\n if (msb === 0n) return 64;\n var hi = Math.clz32(Number(msb >> 32n & 0xffffffffn));\n if (hi < 32) return 63 - hi;\n var lo = Math.clz32(Number(msb & 0xffffffffn));\n return 31 - lo;\n};\n/**\r\n * Returns the result of multiplying `frac` by 2 raised to the power of `exp`.\r\n */\nvar ldexp = function ldexp(frac, exp) {\n return frac * Math.pow(2, exp);\n};\n/**\r\n * Returns the binary exponent of the absolute value of x.\r\n * This is the exponent of the value when expressed as a normalized\r\n * floating-point number.\r\n *\r\n * - For a normal positive floating-point number x, Ilogb returns floor(log2(x)).\r\n * - For zero, it returns -Infinity.\r\n * - For infinity, it returns Infinity.\r\n * - For NaN, it returns NaN.\r\n */\nvar ilogb = function ilogb(x) {\n if (isNaN(x)) return NaN;\n if (x === 0) return -Infinity;\n if (!isFinite(x)) return Infinity;\n x = Math.abs(x);\n if (x < Number.MIN_VALUE) return -1074; // Special case for denormalized numbers\n return Math.floor(Math.log2(x));\n};\n\n/**\r\n * Angle represents a 1D angle. The internal representation is a double precision value in radians, so conversion to and from radians is exact.\r\n * Conversions between E5, E6, E7, and Degrees are not always exact.\r\n *\r\n * For example, Degrees(3.1) is different from E6(3100000) or E7(31000000).\r\n *\r\n * The following conversions between degrees and radians are exact:\r\n *\r\n * \t Degree*180 == Radian*Math.PI\r\n * \tDegree*(180/n) == Radian*(Math.PI/n) for n == 0..8\r\n *\r\n * These identities hold when the arguments are scaled up or down by any power of 2. Some similar identities are also true, for example,\r\n *\r\n * \tDegree*60 == Radian*(Math.PI/3)\r\n *\r\n * But be aware that this type of identity does not hold in general.\r\n * For example:\r\n *\r\n * \tDegree*3 != Radian*(Math.PI/60)\r\n *\r\n * Similarly, the conversion to radians means that (Angle(x)*Degree).Degrees() does not always equal x.\r\n * For example:\r\n *\r\n * \t(Angle(45*n)*Degree).Degrees() == 45*n for n == 0..8\r\n *\r\n * but\r\n *\r\n * \t(60*Degree).Degrees() != 60\r\n *\r\n * When testing for equality, you should allow for numerical errors (ApproxEqual)\r\n * or convert to discrete E5/E6/E7 values first.\r\n *\r\n * @module angle\r\n */\n/**\r\n * Returns the angle in radians.\r\n */\nvar radians = function radians(a) {\n return a;\n};\n/**\r\n * Returns the angle in degrees.\r\n */\nvar degrees = function degrees(a) {\n return a / DEGREE || 0;\n};\n/**\r\n * Returns the value rounded to nearest as an int32.\r\n * This does not match C++ exactly for the case of x.5.\r\n */\nvar round = function round(a) {\n return Math.round(a) || 0;\n};\n/** Returns an angle larger than any finite angle. */\nvar infAngle = function infAngle() {\n return Infinity;\n};\n/** Reports whether this Angle is infinite. */\nvar isInf = function isInf(a) {\n return a == Infinity;\n};\n/** Returns the angle in hundred thousandths of degrees. */\nvar e5 = function e5(a) {\n return round(degrees(a) * 1e5);\n};\n/** Returns the angle in millionths of degrees. */\nvar e6 = function e6(a) {\n return round(degrees(a) * 1e6);\n};\n/** Returns the angle in ten millionths of degrees. */\nvar e7 = function e7(a) {\n return round(degrees(a) * 1e7);\n};\n/** Returns the absolute value of the angle. */\nvar abs = function abs(a) {\n return Math.abs(a);\n};\n/** Returns an equivalent angle in (-π, π]. */\nvar normalized = function normalized(a) {\n var rad = remainder(a, 2 * Math.PI);\n if (rad <= -Math.PI) rad = Math.PI;\n return rad || 0;\n};\n/**\r\n * Generates a human readable string.\r\n */\nvar toString = function toString(a) {\n return degrees(a).toFixed(7);\n};\n/** Reports whether the two angles are the same up to a small tolerance. */\nvar approxEqual = function approxEqual(a, oa, epsilon) {\n if (epsilon === void 0) {\n epsilon = 1e-15;\n }\n return Math.abs(a - oa) <= epsilon;\n};\n\nvar angle = {\n __proto__: null,\n radians: radians,\n degrees: degrees,\n round: round,\n infAngle: infAngle,\n isInf: isInf,\n e5: e5,\n e6: e6,\n e7: e7,\n abs: abs,\n normalized: normalized,\n toString: toString,\n approxEqual: approxEqual\n};\n\n/**\r\n * Represents a zero angle.\r\n */\n/**\r\n * Represents a chord angle smaller than the zero angle.\r\n * The only valid operations on a NEGATIVE_CHORDANGLE are comparisons,\r\n * Angle conversions, and Successor/Predecessor.\r\n */\nvar NEGATIVE_CHORDANGLE = -1;\n/** Represents a chord angle of 90 degrees (a \"right angle\"). */\nvar RIGHT_CHORDANGLE = 2;\n/**\r\n * Represents a chord angle of 180 degrees (a \"straight angle\").\r\n * This is the maximum finite chord angle.\r\n */\nvar STRAIGHT_CHORDANGLE = 4;\n/** The square of the maximum length allowed in a ChordAngle. */\nvar MAX_LENGTH2 = 4.0;\n\nvar EPSILON = 1e-15;\nvar DBL_EPSILON = 2.220446049e-16;\n\n/**\r\n * ChordAngle represents the angle subtended by a chord (i.e., the straight line segment connecting two points on the sphere).\r\n * Its representation makes it very efficient for computing and comparing distances, but unlike Angle it is only capable of representing angles between 0 and π radians.\r\n * Generally, ChordAngle should only be used in loops where many angles need to be calculated and compared.\r\n * Otherwise it is simpler to use Angle.\r\n *\r\n * ChordAngle loses some accuracy as the angle approaches π radians.\r\n * There are several different ways to measure this error, including the representational error (i.e., how accurately ChordAngle can represent angles near π radians), the conversion error (i.e., how much precision is lost when an Angle is converted to an ChordAngle), and the measurement error (i.e., how accurate the ChordAngle(a, b) constructor is when the points A and B are separated by angles close to π radians).\r\n * All of these errors differ by a small constant factor.\r\n *\r\n * For the measurement error (which is the largest of these errors and also the most important in practice), let the angle between A and B be (π - x) radians, i.e. A and B are within \"x\" radians of being antipodal.\r\n * The corresponding chord length is:\r\n *\r\n * \tr = 2 * sin((π - x) / 2) = 2 * cos(x / 2)\r\n *\r\n * For values of x not close to π the relative error in the squared chord length is at most 4.5 * dblEpsilon (see MaxPointError below).\r\n * The relative error in \"r\" is thus at most 2.25 * dblEpsilon ~= 5e-16.\r\n * To convert this error into an equivalent angle, we have:\r\n *\r\n * \t|dr / dx| = sin(x / 2)\r\n *\r\n * and therefore:\r\n *\r\n * \t|dx| = dr / sin(x / 2)\r\n * \t = 5e-16 * (2 * cos(x / 2)) / sin(x / 2)\r\n * \t = 1e-15 / tan(x / 2)\r\n *\r\n * The maximum error is attained when:\r\n *\r\n * \tx = |dx|\r\n * \t = 1e-15 / tan(x / 2)\r\n * \t ~= 1e-15 / (x / 2)\r\n * \t ~= sqrt(2e-15)\r\n *\r\n * In summary, the measurement error for an angle (π - x) is at most:\r\n *\r\n * \tdx = min(1e-15 / tan(x / 2), sqrt(2e-15))\r\n * \t (~= min(2e-15 / x, sqrt(2e-15)) when x is small)\r\n *\r\n * On the Earth's surface (assuming a radius of 6371km), this corresponds to the following worst-case measurement errors:\r\n *\r\n * \tAccuracy: Unless antipodal to within:\r\n * \t--------- ---------------------------\r\n * \t6.4 nanometers 10,000 km (90 degrees)\r\n * \t1 micrometer 81.2 kilometers\r\n * \t1 millimeter 81.2 meters\r\n * \t1 centimeter 8.12 meters\r\n * \t28.5 centimeters 28.5 centimeters\r\n *\r\n * The representational and conversion errors referred to earlier are somewhat smaller than this.\r\n * For example, maximum distance between adjacent representable ChordAngle values is only 13.5 cm rather than 28.5 cm.\r\n * To see this, observe that the closest representable value to r^2 = 4 is r^2 = 4 * (1 - dblEpsilon / 2).\r\n * Thus r = 2 * (1 - dblEpsilon / 4) and the angle between these two representable values is:\r\n *\r\n * \tx = 2 * acos(r / 2)\r\n * \t = 2 * acos(1 - dblEpsilon / 4)\r\n * \t ~= 2 * asin(sqrt(dblEpsilon / 2)\r\n * \t ~= sqrt(2 * dblEpsilon)\r\n * \t ~= 2.1e-8\r\n *\r\n * which is 13.5 cm on the Earth's surface.\r\n *\r\n * The worst case rounding error occurs when the value halfway between these two representable values is rounded up to 4.\r\n * This halfway value is r^2 = (4 * (1 - dblEpsilon / 4)), thus r = 2 * (1 - dblEpsilon / 8) and the worst case rounding error is:\r\n *\r\n * \tx = 2 * acos(r / 2)\r\n * \t = 2 * acos(1 - dblEpsilon / 8)\r\n * \t ~= 2 * asin(sqrt(dblEpsilon / 4)\r\n * \t ~= sqrt(dblEpsilon)\r\n * \t ~= 1.5e-8\r\n *\r\n * which is 9.5 cm on the Earth's surface.\r\n *\r\n * @module chordangle\r\n */\n/**\r\n * Returns a ChordAngle from the given Angle.\r\n * @category Constructors\r\n * */\nvar fromAngle = function fromAngle(a) {\n if (a < 0) return NEGATIVE_CHORDANGLE;\n if (isInf(a)) return infChordAngle();\n var l = 2 * Math.sin(0.5 * Math.min(Math.PI, radians(a)));\n return l * l;\n};\n/**\r\n * Returns a ChordAngle from the squared chord length.\r\n * Note that the argument is automatically clamped to a maximum of 4 to handle possible roundoff errors.\r\n * The argument must be non-negative.\r\n * @category Constructors\r\n */\nvar fromSquaredLength = function fromSquaredLength(l) {\n return l > MAX_LENGTH2 ? STRAIGHT_CHORDANGLE : l;\n};\n/**\r\n * Returns a new ChordAngle that has been adjusted by the given error bound (which can be positive or negative).\r\n * Error should be the value returned by either MaxPointError or MaxAngleError. For example:\r\n *\r\n * let a = fromPoints(x, y)\r\n * let a1 = a.expanded(a.maxPointError())\r\n */\nvar expanded = function expanded(c, e) {\n // If the angle is special, don't change it.\n // Otherwise clamp it to the valid range.\n if (isSpecial(c)) return c;\n return Math.max(0.0, Math.min(MAX_LENGTH2, c + e));\n};\n/** Converts this chordangle to an angle. */\nvar angle$1 = function angle$1(c) {\n if (c < 0) return -1;\n if (isInfinity(c)) return infAngle();\n return 2 * Math.asin(0.5 * Math.sqrt(c));\n};\n/**\r\n * Returns a chord angle larger than any finite chord angle.\r\n * The only valid operations on an InfChordAngle are comparisons, Angle conversions, and Successor/Predecessor.\r\n */\nvar infChordAngle = function infChordAngle() {\n return Infinity;\n};\n/** Reports whether this chordangle is infinite. */\nvar isInfinity = function isInfinity(c) {\n return c == Infinity;\n};\n/** Reports whether this chordangle is one of the special cases. */\nvar isSpecial = function isSpecial(c) {\n return c < 0 || isInfinity(c);\n};\n/** Reports whether this chordangle is valid or not. */\nvar isValid = function isValid(c) {\n return c >= 0 && c <= MAX_LENGTH2 || isSpecial(c);\n};\n/**\r\n * Returns the smallest representable ChordAngle larger than this one.\r\n * This can be used to convert a \"<\" comparison to a \"<=\" comparison.\r\n *\r\n * Note the following special cases:\r\n *\r\n * \tNegativeChordAngle.Successor == 0\r\n * \tStraightChordAngle.Successor == InfChordAngle\r\n * \tInfChordAngle.Successor == InfChordAngle\r\n */\nvar successor = function successor(c) {\n if (c >= MAX_LENGTH2) return infChordAngle();\n if (c < 0) return 0;\n return nextAfter(c, 10.0);\n};\n/**\r\n * Returns the largest representable ChordAngle less than this one.\r\n *\r\n * Note the following special cases:\r\n *\r\n * \tInfChordAngle.Predecessor == StraightChordAngle\r\n * \tChordAngle(0).Predecessor == NegativeChordAngle\r\n * \tNegativeChordAngle.Predecessor == NegativeChordAngle\r\n */\nvar predecessor = function predecessor(c) {\n if (c <= 0) return NEGATIVE_CHORDANGLE;\n if (c > MAX_LENGTH2) return STRAIGHT_CHORDANGLE;\n return nextAfter(c, -10.0);\n};\n/**\r\n * Returns the maximum error size for a ChordAngle constructed from 2 Points x and y, assuming that x and y are normalized to within the bounds guaranteed by s2.Point.Normalize.\r\n * The error is defined with respect to the true distance after the points are projected to lie exactly on the sphere.\r\n */\nvar maxPointError = function maxPointError(c) {\n /**\r\n * There is a relative error of (2.5*dblEpsilon) when computing the squared\r\n * distance, plus a relative error of 2 * dblEpsilon, plus an absolute error\r\n * of (16 * dblEpsilon**2) because the lengths of the input points may differ\r\n * from 1 by up to (2*dblEpsilon) each. (This is the maximum error in Normalize).\r\n */\n return 4.5 * DBL_EPSILON * c + 16 * DBL_EPSILON * DBL_EPSILON;\n};\n/**\r\n * Returns the maximum error for a ChordAngle constructed as an Angle distance.\r\n */\nvar maxAngleError = function maxAngleError(c) {\n return DBL_EPSILON * c;\n};\n/**\r\n * Adds the other ChordAngle to this one and returns the resulting value.\r\n * This method assumes the ChordAngles are not special.\r\n */\nvar add = function add(c, oc) {\n // missinglink: use slower method which doesn't produce errors for input\n // such as (0.05641360112609339, 0.08434543246929838).\n // @todo: performance\n return fromAngle(angle$1(c) + angle$1(oc));\n};\n/**\r\n * Subtracts the other ChordAngle from this one and returns the resulting value.\r\n * This method assumes the ChordAngles are not special.\r\n */\nvar sub = function sub(c, oc) {\n if (oc == 0) return c;\n if (c <= oc) return 0;\n var x = c * (1 - 0.25 * oc);\n var y = oc * (1 - 0.25 * c);\n return Math.max(0.0, x + y - 2 * Math.sqrt(x * y));\n};\n/**\r\n * Returns the sine of this chord angle.\r\n * This method is more efficient than converting to Angle and performing the computation.\r\n */\nvar sin = function sin(c) {\n return Math.sqrt(sin2(c)) || 0;\n};\n/**\r\n * Returns the square of the sine of this chord angle.\r\n * It is more efficient than Sin.\r\n *\r\n * Let a be the (non-squared) chord length, and let A be the corresponding\r\n * half-angle (a = 2*sin(A)). The formula below can be derived from:\r\n * sin(2*A) = 2 * sin(A) * cos(A)\r\n * cos^2(A) = 1 - sin^2(A)\r\n * This is much faster than converting to an angle and computing its sine.\r\n */\nvar sin2 = function sin2(c) {\n return c * (1 - 0.25 * c) || 0;\n};\n/**\r\n * Returns the cosine of this chord angle.\r\n * This method is more efficient than converting to Angle and performing the computation.\r\n *\r\n * cos(2*A) = cos^2(A) - sin^2(A) = 1 - 2*sin^2(A)\r\n */\nvar cos = function cos(c) {\n return 1 - 0.5 * c || 0;\n};\n/** Returns the tangent of this chord angle. */\nvar tan = function tan(c) {\n return sin(c) / cos(c) || 0;\n};\n\nvar chordangle = {\n __proto__: null,\n fromAngle: fromAngle,\n fromSquaredLength: fromSquaredLength,\n expanded: expanded,\n angle: angle$1,\n infChordAngle: infChordAngle,\n isInfinity: isInfinity,\n isSpecial: isSpecial,\n isValid: isValid,\n successor: successor,\n predecessor: predecessor,\n maxPointError: maxPointError,\n maxAngleError: maxAngleError,\n add: add,\n sub: sub,\n sin: sin,\n sin2: sin2,\n cos: cos,\n tan: tan\n};\n\n/**\r\n * An Interval represents a closed interval on a unit circle (also known as a 1-dimensional sphere).\r\n * It is capable of representing the empty interval (containing no points), the full interval (containing all points), and zero-length intervals (containing a single point).\r\n *\r\n * Points are represented by the angle they make with the positive x-axis in the range [-π, π].\r\n * An interval is represented by its lower and upper bounds (both inclusive, since the interval is closed).\r\n * The lower bound may be greater than the upper bound, in which case the interval is \"inverted\" (i.e. it passes through the point (-1, 0)).\r\n *\r\n * The point (-1, 0) has two valid representations, π and -π.\r\n * The normalized representation of this point is π, so that endpoints of normal intervals are in the range (-π, π].\r\n * We normalize the latter to the former in intervalFromEndpoints.\r\n * However, we take advantage of the point -π to construct two special intervals:\r\n *\r\n * The full interval is [-π, π]\r\n * The empty interval is [π, -π].\r\n *\r\n * Treat the exported fields as read-only.\r\n */\nvar Interval$1 = /*#__PURE__*/function () {\n function Interval(lo, hi) {\n this.lo = lo;\n this.hi = hi;\n }\n /**\r\n * Constructs a new interval from endpoints.\r\n * Both arguments must be in the range [-π,π].\r\n * This function allows inverted intervals to be created.\r\n * @category Constructors\r\n */\n Interval.fromEndpoints = function fromEndpoints(lo, hi) {\n var i = new Interval(lo, hi);\n if (lo === -Math.PI && hi !== Math.PI) i.lo = Math.PI;\n if (hi === -Math.PI && lo !== Math.PI) i.hi = Math.PI;\n return i;\n }\n /**\r\n * Returns the minimal interval containing the two given points.\r\n * Both arguments must be in [-π,π].\r\n * @category Constructors\r\n */;\n Interval.fromPointPair = function fromPointPair(a, b) {\n if (a === -Math.PI) a = Math.PI;\n if (b === -Math.PI) b = Math.PI;\n if (Interval.positiveDistance(a, b) <= Math.PI) return new Interval(a, b);\n return new Interval(b, a);\n }\n /**\r\n * Returns an empty interval.\r\n * @category Constructors\r\n */;\n Interval.emptyInterval = function emptyInterval() {\n return new Interval(Math.PI, -Math.PI);\n }\n /**\r\n * Returns a full interval.\r\n * @category Constructors\r\n */;\n Interval.fullInterval = function fullInterval() {\n return new Interval(-Math.PI, Math.PI);\n }\n /**\r\n * Reports whether the interval is valid.\r\n */;\n var _proto = Interval.prototype;\n _proto.isValid = function isValid() {\n return Math.abs(this.lo) <= Math.PI && Math.abs(this.hi) <= Math.PI && !(this.lo === -Math.PI && this.hi !== Math.PI) && !(this.hi === -Math.PI && this.lo !== Math.PI);\n }\n /**\r\n * Reports whether the interval is full.\r\n */;\n _proto.isFull = function isFull() {\n return this.lo === -Math.PI && this.hi === Math.PI;\n }\n /**\r\n * Reports whether the interval is empty.\r\n */;\n _proto.isEmpty = function isEmpty() {\n return this.lo === Math.PI && this.hi === -Math.PI;\n }\n /**\r\n * Reports whether the interval is inverted; that is, whether lo > hi.\r\n */;\n _proto.isInverted = function isInverted() {\n return this.lo > this.hi;\n }\n /**\r\n * Returns true iff the interval equals oi.\r\n */;\n _proto.equals = function equals(oi) {\n return this.lo == oi.lo && this.hi == oi.hi || this.isEmpty() && oi.isEmpty();\n }\n /**\r\n * Returns the interval with endpoints swapped.\r\n */;\n _proto.invert = function invert() {\n return new Interval(this.hi, this.lo);\n }\n /**\r\n * Returns the midpoint of the interval.\r\n * It is undefined for full and empty intervals.\r\n */;\n _proto.center = function center() {\n var c = 0.5 * (this.lo + this.hi);\n if (!this.isInverted()) return c;\n if (c <= 0) return c + Math.PI;\n return c - Math.PI;\n }\n /**\r\n * Returns the length of the interval.\r\n * The length of an empty interval is negative.\r\n */;\n _proto.length = function length() {\n var l = this.hi - this.lo;\n if (l >= 0) return l;\n l += 2 * Math.PI;\n if (l > 0) return l;\n return -1;\n }\n /**\r\n * Assumes p ∈ (-π,π].\r\n */;\n _proto.fastContains = function fastContains(p) {\n if (this.isInverted()) return (p >= this.lo || p <= this.hi) && !this.isEmpty();\n return p >= this.lo && p <= this.hi;\n }\n /**\r\n * Returns true iff the interval contains p.\r\n * Assumes p ∈ [-π,π].\r\n */;\n _proto.contains = function contains(p) {\n if (p === -Math.PI) p = Math.PI;\n return this.fastContains(p);\n }\n /**\r\n * Returns true iff the interval contains oi.\r\n */;\n _proto.containsInterval = function containsInterval(oi) {\n if (this.isInverted()) {\n if (oi.isInverted()) return oi.lo >= this.lo && oi.hi <= this.hi;\n return (oi.lo >= this.lo || oi.hi <= this.hi) && !this.isEmpty();\n }\n if (oi.isInverted()) return this.isFull() || oi.isEmpty();\n return oi.lo >= this.lo && oi.hi <= this.hi;\n }\n /**\r\n * Returns true iff the interior of the interval contains p.\r\n * Assumes p ∈ [-π,π].\r\n */;\n _proto.interiorContains = function interiorContains(p) {\n if (p === -Math.PI) p = Math.PI;\n if (this.isInverted()) return p > this.lo || p < this.hi;\n return p > this.lo && p < this.hi || this.isFull();\n }\n /**\r\n * Returns true iff the interior of the interval contains oi.\r\n */;\n _proto.interiorContainsInterval = function interiorContainsInterval(oi) {\n if (this.isInverted()) {\n if (oi.isInverted()) return oi.lo > this.lo && oi.hi < this.hi || oi.isEmpty();\n return oi.lo > this.lo || oi.hi < this.hi;\n }\n if (oi.isInverted()) return this.isFull() || oi.isEmpty();\n return oi.lo > this.lo && oi.hi < this.hi || this.isFull();\n }\n /**\r\n * Returns true iff the interval contains any points in common with oi.\r\n */;\n _proto.intersects = function intersects(oi) {\n if (this.isEmpty() || oi.isEmpty()) return false;\n if (this.isInverted()) return oi.isInverted() || oi.lo <= this.hi || oi.hi >= this.lo;\n if (oi.isInverted()) return oi.lo <= this.hi || oi.hi >= this.lo;\n return oi.lo <= this.hi && oi.hi >= this.lo;\n }\n /**\r\n * Returns true iff the interior of the interval contains any points in common with oi, including the latter's boundary.\r\n */;\n _proto.interiorIntersects = function interiorIntersects(oi) {\n if (this.isEmpty() || oi.isEmpty() || this.lo === this.hi) return false;\n if (this.isInverted()) return oi.isInverted() || oi.lo < this.hi || oi.hi > this.lo;\n if (oi.isInverted()) return oi.lo < this.hi || oi.hi > this.lo;\n return oi.lo < this.hi && oi.hi > this.lo || this.isFull();\n }\n /**\r\n * Compute distance from a to b in [0,2π], in a numerically stable way.\r\n */;\n Interval.positiveDistance = function positiveDistance(a, b) {\n var d = b - a;\n if (d >= 0) return d;\n return b + Math.PI - (a - Math.PI);\n }\n /**\r\n * Returns the smallest interval that contains both the interval and oi.\r\n */;\n _proto.union = function union(oi) {\n if (oi.isEmpty()) return this;\n if (this.fastContains(oi.lo)) {\n if (this.fastContains(oi.hi)) {\n if (this.containsInterval(oi)) return this;\n return Interval.fullInterval();\n }\n return new Interval(this.lo, oi.hi);\n }\n if (this.fastContains(oi.hi)) return new Interval(oi.lo, this.hi);\n if (this.isEmpty() || oi.fastContains(this.lo)) return oi;\n if (Interval.positiveDistance(oi.hi, this.lo) < Interval.positiveDistance(this.hi, oi.lo)) return new Interval(oi.lo, this.hi);\n return new Interval(this.lo, oi.hi);\n }\n /**\r\n * Returns the smallest interval that contains the intersection of the interval and oi.\r\n */;\n _proto.intersection = function intersection(oi) {\n if (oi.isEmpty()) return Interval.emptyInterval();\n if (this.fastContains(oi.lo)) {\n if (this.fastContains(oi.hi)) {\n if (oi.length() < this.length()) return oi;\n return this;\n }\n return new Interval(oi.lo, this.hi);\n }\n if (this.fastContains(oi.hi)) return new Interval(this.lo, oi.hi);\n if (oi.fastContains(this.lo)) return this;\n return Interval.emptyInterval();\n }\n /**\r\n * Returns the interval expanded by the minimum amount necessary such\r\n * that it contains the given point \"p\" (an angle in the range [-π, π]).\r\n */;\n _proto.addPoint = function addPoint(p) {\n if (Math.abs(p) > Math.PI) return this;\n if (p === -Math.PI) p = Math.PI;\n if (this.fastContains(p)) return this;\n if (this.isEmpty()) return new Interval(p, p);\n if (Interval.positiveDistance(p, this.lo) < Interval.positiveDistance(this.hi, p)) return new Interval(p, this.hi);\n return new Interval(this.lo, p);\n }\n /**\r\n * Expanded returns an interval that has been expanded on each side by margin.\r\n * If margin is negative, then the function shrinks the interval on\r\n * each side by margin instead. The resulting interval may be empty or\r\n * full. Any expansion (positive or negative) of a full interval remains\r\n * full, and any expansion of an empty interval remains empty.\r\n */;\n _proto.expanded = function expanded(margin) {\n if (margin >= 0) {\n if (this.isEmpty()) return this;\n if (this.length() + 2 * margin + 2 * DBL_EPSILON >= 2 * Math.PI) return Interval.fullInterval();\n } else {\n if (this.isFull()) return this;\n if (this.length() + 2 * margin - 2 * DBL_EPSILON <= 0) return Interval.emptyInterval();\n }\n var result = Interval.fromEndpoints(remainder(this.lo - margin, 2 * Math.PI), remainder(this.hi + margin, 2 * Math.PI));\n if (result.lo <= -Math.PI) result.lo = Math.PI;\n return result;\n }\n /**\r\n * ApproxEqual reports whether this interval can be transformed into the given\r\n * interval by moving each endpoint by at most ε, without the\r\n * endpoints crossing (which would invert the interval). Empty and full\r\n * intervals are considered to start at an arbitrary point on the unit circle,\r\n * so any interval with (length <= 2*ε) matches the empty interval, and\r\n * any interval with (length >= 2*π - 2*ε) matches the full interval.\r\n */;\n _proto.approxEqual = function approxEqual(other) {\n if (this.isEmpty()) return other.length() <= 2 * EPSILON;\n if (other.isEmpty()) return this.length() <= 2 * EPSILON;\n if (this.isFull()) return other.length() >= 2 * (Math.PI - EPSILON);\n if (other.isFull()) return this.length() >= 2 * (Math.PI - EPSILON);\n return Math.abs(remainder(other.lo - this.lo, 2 * Math.PI)) <= EPSILON && Math.abs(remainder(other.hi - this.hi, 2 * Math.PI)) <= EPSILON && Math.abs(this.length() - other.length()) <= 2 * EPSILON;\n };\n _proto.toString = function toString() {\n return \"[\" + this.lo.toFixed(7) + \", \" + this.hi.toFixed(7) + \"]\";\n }\n /**\r\n * Complement returns the complement of the interior of the interval. An interval and\r\n * its complement have the same boundary but do not share any interior\r\n * values. The complement operator is not a bijection, since the complement\r\n * of a singleton interval (containing a single value) is the same as the\r\n * complement of an empty interval.\r\n */;\n _proto.complement = function complement() {\n if (this.lo === this.hi) return Interval.fullInterval();\n return new Interval(this.hi, this.lo);\n }\n /**\r\n * ComplementCenter returns the midpoint of the complement of the interval. For full and empty\r\n * intervals, the result is arbitrary. For a singleton interval (containing a\r\n * single point), the result is its antipodal point on S1.\r\n */;\n _proto.complementCenter = function complementCenter() {\n if (this.lo !== this.hi) return this.complement().center();\n if (this.hi <= 0) return this.hi + Math.PI;\n return this.hi - Math.PI;\n }\n /**\r\n * DirectedHausdorffDistance returns the Hausdorff distance to the given interval.\r\n * For two intervals i and y, this distance is defined by\r\n *\r\n * h(i, y) = max_{p in i} min_{q in y} d(p, q),\r\n *\r\n * where d(.,.) is measured along S1.\r\n */;\n _proto.directedHausdorffDistance = function directedHausdorffDistance(y) {\n if (y.containsInterval(this)) return 0;\n if (y.isEmpty()) return Math.PI;\n var yComplementCenter = y.complementCenter();\n if (this.contains(yComplementCenter)) return Interval.positiveDistance(y.hi, yComplementCenter);\n var hiHi = 0.0;\n if (Interval.fromEndpoints(y.hi, yComplementCenter).contains(this.hi)) {\n hiHi = Interval.positiveDistance(y.hi, this.hi);\n }\n var loLo = 0.0;\n if (Interval.fromEndpoints(yComplementCenter, y.lo).contains(this.lo)) {\n loLo = Interval.positiveDistance(this.lo, y.lo);\n }\n return Math.max(hiHi, loLo);\n }\n /**\r\n * Project returns the closest point in the interval to the given point p.\r\n * The interval must be non-empty.\r\n */;\n _proto.project = function project(p) {\n if (p === -Math.PI) p = Math.PI;\n if (this.fastContains(p)) return p;\n var dlo = Interval.positiveDistance(p, this.lo);\n var dhi = Interval.positiveDistance(this.hi, p);\n if (dlo < dhi) return this.lo;\n return this.hi;\n };\n return Interval;\n}();\n\n/**\r\n * Module s1 implements types and functions for working with geometry in S¹ (circular geometry).\r\n * @module s1\r\n */\n\nvar _index$3 = {\n __proto__: null,\n angle: angle,\n chordangle: chordangle,\n Interval: Interval$1\n};\n\nvar LOOKUP_BITS = 4;\nvar SWAP_MASK = 0x01;\nvar INVERT_MASK = 0x02;\nvar ijToPos = [[0, 1, 3, 2], [0, 3, 1, 2], [2, 3, 1, 0], [2, 1, 3, 0] // swapped & inverted\n];\nvar posToIJ = [[0, 1, 3, 2], [0, 2, 3, 1], [3, 2, 0, 1], [3, 1, 0, 2] // swapped & inverted: (1,1), (0,1), (0,0), (1,0)\n];\nvar posToOrientation = [SWAP_MASK, 0, 0, INVERT_MASK | SWAP_MASK];\nvar lookupIJ = [];\nvar lookupPos = [];\ninitLookupCell(0, 0, 0, 0, 0, 0);\ninitLookupCell(0, 0, 0, SWAP_MASK, 0, SWAP_MASK);\ninitLookupCell(0, 0, 0, INVERT_MASK, 0, INVERT_MASK);\ninitLookupCell(0, 0, 0, SWAP_MASK | INVERT_MASK, 0, SWAP_MASK | INVERT_MASK);\n// initLookupCell initializes the lookupIJ lookupIJ at init time.\nfunction initLookupCell(level, i, j, origOrientation, pos, orientation) {\n if (level == LOOKUP_BITS) {\n var ij = (i << LOOKUP_BITS) + j;\n lookupPos[(ij << 2) + origOrientation] = (pos << 2) + orientation;\n lookupIJ[(pos << 2) + origOrientation] = (ij << 2) + orientation;\n return;\n }\n level++;\n i <<= 1;\n j <<= 1;\n pos <<= 2;\n var r = posToIJ[orientation];\n initLookupCell(level, i + (r[0] >> 1), j + (r[0] & 1), origOrientation, pos, orientation ^ posToOrientation[0]);\n initLookupCell(level, i + (r[1] >> 1), j + (r[1] & 1), origOrientation, pos + 1, orientation ^ posToOrientation[1]);\n initLookupCell(level, i + (r[2] >> 1), j + (r[2] & 1), origOrientation, pos + 2, orientation ^ posToOrientation[2]);\n initLookupCell(level, i + (r[3] >> 1), j + (r[3] & 1), origOrientation, pos + 3, orientation ^ posToOrientation[3]);\n}\n\n/**\r\n * Number of bits used to encode the face number\r\n **/\nvar FACE_BITS = 3;\n/**\r\n * Number of faces\r\n */\nvar NUM_FACES = 6;\n/**\r\n * Number of levels needed to specify a leaf cell\r\n */\nvar MAX_LEVEL = 30;\n/**\r\n * Total number of position bits.\r\n * The extra bit (61 rather than 60) lets us encode each cell as its Hilbert curve position at the cell center (which is halfway along the portion of the Hilbert curve that fills that cell).\r\n */\nvar POS_BITS = 2 * MAX_LEVEL + 1;\n/**\r\n * MaxSize is the maximum index of a valid leaf cell plus one. The range of\r\n * valid leaf cell indices is [0..MaxSize-1].\r\n */\nvar MAX_SIZE = /*#__PURE__*/Number(1n << /*#__PURE__*/BigInt(MAX_LEVEL));\n//\nvar WRAP_OFFSET = /*#__PURE__*/BigInt(NUM_FACES) << /*#__PURE__*/BigInt(POS_BITS);\n\n/**\r\n * This file contains documentation of the various coordinate systems used throughout the library.\r\n * Most importantly, S2 defines a framework for decomposing the unit sphere into a hierarchy of \"cells\".\r\n * Each cell is a quadrilateral bounded by four geodesics.\r\n * The top level of the hierarchy is obtained by projecting the six faces of a cube onto the unit sphere, and lower levels are obtained by subdividing each cell into four children recursively.\r\n * Cells are numbered such that sequentially increasing cells follow a continuous space-filling curve over the entire sphere.\r\n * The transformation is designed to make the cells at each level fairly uniform in size.\r\n */\n/**\r\n * S2 Cell Decomposition\r\n *\r\n * The following methods define the cube-to-sphere projection used by\r\n * the Cell decomposition.\r\n *\r\n * In the process of converting a latitude-longitude pair to a 64-bit cell\r\n * id, the following coordinate systems are used:\r\n *\r\n * (id)\r\n * An CellID is a 64-bit encoding of a face and a Hilbert curve position\r\n * on that face. The Hilbert curve position implicitly encodes both the\r\n * position of a cell and its subdivision level (see s2cellid.go).\r\n *\r\n * (face, i, j)\r\n * Leaf-cell coordinates. \"i\" and \"j\" are integers in the range\r\n * [0,(2**30)-1] that identify a particular leaf cell on the given face.\r\n * The (i, j) coordinate system is right-handed on each face, and the\r\n * faces are oriented such that Hilbert curves connect continuously from\r\n * one face to the next.\r\n *\r\n * (face, s, t)\r\n * Cell-space coordinates. \"s\" and \"t\" are real numbers in the range\r\n * [0,1] that identify a point on the given face. For example, the point\r\n * (s, t) = (0.5, 0.5) corresponds to the center of the top-level face\r\n * cell. This point is also a vertex of exactly four cells at each\r\n * subdivision level greater than zero.\r\n *\r\n * (face, si, ti)\r\n * Discrete cell-space coordinates. These are obtained by multiplying\r\n * \"s\" and \"t\" by 2**31 and rounding to the nearest unsigned integer.\r\n * Discrete coordinates lie in the range [0,2**31]. This coordinate\r\n * system can represent the edge and center positions of all cells with\r\n * no loss of precision (including non-leaf cells). In binary, each\r\n * coordinate of a level-k cell center ends with a 1 followed by\r\n * (30 - k) 0s. The coordinates of its edges end with (at least)\r\n * (31 - k) 0s.\r\n *\r\n * (face, u, v)\r\n * Cube-space coordinates in the range [-1,1]. To make the cells at each\r\n * level more uniform in size after they are projected onto the sphere,\r\n * we apply a nonlinear transformation of the form u=f(s), v=f(t).\r\n * The (u, v) coordinates after this transformation give the actual\r\n * coordinates on the cube face (modulo some 90 degree rotations) before\r\n * it is projected onto the unit sphere.\r\n *\r\n * (face, u, v, w)\r\n * Per-face coordinate frame. This is an extension of the (face, u, v)\r\n * cube-space coordinates that adds a third axis \"w\" in the direction of\r\n * the face normal. It is always a right-handed 3D coordinate system.\r\n * Cube-space coordinates can be converted to this frame by setting w=1,\r\n * while (u,v,w) coordinates can be projected onto the cube face by\r\n * dividing by w, i.e. (face, u/w, v/w).\r\n *\r\n * (x, y, z)\r\n * Direction vector (Point). Direction vectors are not necessarily unit\r\n * length, and are often chosen to be points on the biunit cube\r\n * [-1,+1]x[-1,+1]x[-1,+1]. They can be be normalized to obtain the\r\n * corresponding point on the unit sphere.\r\n *\r\n * (lat, lng)\r\n * Latitude and longitude (LatLng). Latitudes must be between -90 and\r\n * 90 degrees inclusive, and longitudes must be between -180 and 180\r\n * degrees inclusive.\r\n *\r\n * Note that the (i, j), (s, t), (si, ti), and (u, v) coordinate systems are\r\n * right-handed on all six faces.\r\n *\r\n *\r\n * There are a number of different projections from cell-space (s,t) to\r\n * cube-space (u,v): linear, quadratic, and tangent. They have the following\r\n * tradeoffs:\r\n *\r\n * Linear - This is the fastest transformation, but also produces the least\r\n * uniform cell sizes. Cell areas vary by a factor of about 5.2, with the\r\n * largest cells at the center of each face and the smallest cells in\r\n * the corners.\r\n *\r\n * Tangent - Transforming the coordinates via Atan makes the cell sizes\r\n * more uniform. The areas vary by a maximum ratio of 1.4 as opposed to a\r\n * maximum ratio of 5.2. However, each call to Atan is about as expensive\r\n * as all of the other calculations combined when converting from points to\r\n * cell ids, i.e. it reduces performance by a factor of 3.\r\n *\r\n * Quadratic - This is an approximation of the tangent projection that\r\n * is much faster and produces cells that are almost as uniform in size.\r\n * It is about 3 times faster than the tangent projection for converting\r\n * cell ids to points or vice versa. Cell areas vary by a maximum ratio of\r\n * about 2.1.\r\n *\r\n * Here is a table comparing the cell uniformity using each projection. Area\r\n * Ratio is the maximum ratio over all subdivision levels of the largest cell\r\n * area to the smallest cell area at that level, Edge Ratio is the maximum\r\n * ratio of the longest edge of any cell to the shortest edge of any cell at\r\n * the same level, and Diag Ratio is the ratio of the longest diagonal of\r\n * any cell to the shortest diagonal of any cell at the same level.\r\n *\r\n * Area Edge Diag\r\n * Ratio Ratio Ratio\r\n * -----------------------------------\r\n * Linear: 5.200 2.117 2.959\r\n * Tangent: 1.414 1.414 1.704\r\n * Quadratic: 2.082 1.802 1.932\r\n *\r\n * The worst-case cell aspect ratios are about the same with all three\r\n * projections. The maximum ratio of the longest edge to the shortest edge\r\n * within the same cell is about 1.4 and the maximum ratio of the diagonals\r\n * within the same cell is about 1.7.\r\n *\r\n * For Go we have chosen to use only the Quadratic approach. Other language\r\n * implementations may offer other choices.\r\n */\n/**\r\n * The maximum value of an si- or ti-coordinate.\r\n * It is one shift more than MaxSize.\r\n * The range of valid (si,ti) values is [0..maxSiTi].\r\n */\nvar MAX_SiTi = /*#__PURE__*/Number(/*#__PURE__*/BigInt(MAX_SIZE) << 1n);\n/**\r\n * Converts an si- or ti-value to the corresponding s- or t-value.\r\n * Value is capped at 1.0 because there is no DCHECK in JavaScript.\r\n */\nvar siTiToST = function siTiToST(si) {\n if (si > MAX_SiTi) return 1.0;\n return si / MAX_SiTi;\n};\n/**\r\n * Converts an s or t value to the corresponding u or v value.\r\n * This is a non-linear transformation from [-1,1] to [-1,1] that\r\n * attempts to make the cell sizes more uniform.\r\n * This uses what the C++ version calls 'the quadratic transform'.\r\n */\nvar stToUV = function stToUV(s) {\n if (s >= 0.5) return 1 / 3 * (4 * s * s - 1);\n return 1 / 3 * (1 - 4 * (1 - s) * (1 - s));\n};\n/**\r\n * Inverse of the stToUV transformation. Note that it\r\n * is not always true that uvToST(stToUV(x)) == x due to numerical errors.\r\n */\nvar uvToST = function uvToST(u) {\n if (u >= 0) return 0.5 * Math.sqrt(1 + 3 * u);\n return 1 - 0.5 * Math.sqrt(1 - 3 * u);\n};\n/**\r\n * Returns face ID from 0 to 5 containing the r. For points on the\r\n * boundary between faces, the result is arbitrary but deterministic.\r\n */\nvar face = function face(v) {\n var f = v.largestComponent();\n switch (f) {\n case Vector.X_AXIS:\n if (v.x < 0) f += 3;\n break;\n case Vector.Y_AXIS:\n if (v.y < 0) f += 3;\n break;\n case Vector.Z_AXIS:\n if (v.z < 0) f += 3;\n break;\n }\n return f;\n};\n/**\r\n * Given a valid face for the given point r (meaning that dot product of r with the face normal is positive),\r\n * returns the corresponding u and v values, which may lie outside the range [-1,1].\r\n */\nvar validFaceXYZToUV = function validFaceXYZToUV(face, r) {\n switch (face) {\n case 0:\n return [r.y / r.x, r.z / r.x];\n case 1:\n return [-r.x / r.y, r.z / r.y];\n case 2:\n return [-r.x / r.z, -r.y / r.z];\n case 3:\n return [r.z / r.x, r.y / r.x];\n case 4:\n return [r.z / r.y, -r.x / r.y];\n default:\n return [-r.y / r.z, -r.x / r.z];\n }\n};\n/**\r\n * Converts a direction vector (not necessarily unit length) to (face, u, v) coordinates.\r\n */\nvar xyzToFaceUV = function xyzToFaceUV(r) {\n var f = face(r);\n var _validFaceXYZToUV = validFaceXYZToUV(f, r),\n u = _validFaceXYZToUV[0],\n v = _validFaceXYZToUV[1];\n return [f, u, v];\n};\n/**\r\n * Turns face and UV coordinates into an unnormalized 3 vector.\r\n */\nvar faceUVToXYZ = function faceUVToXYZ(face, u, v) {\n switch (face) {\n case 0:\n return new Vector(1, u, v);\n case 1:\n return new Vector(-u, 1, v);\n case 2:\n return new Vector(-u, -v, 1);\n case 3:\n return new Vector(-1, -v, -u);\n case 4:\n return new Vector(v, -1, -u);\n default:\n return new Vector(v, u, -1);\n }\n};\n/**\r\n * Returns the u and v values (which may lie outside the range [-1, 1]).\r\n * If the dot product of the point p with the given face normal is positive.\r\n */\nvar faceXYZToUV = function faceXYZToUV(face, vect) {\n switch (face) {\n case 0:\n if (vect.x <= 0) return [0, 0, false];\n break;\n case 1:\n if (vect.y <= 0) return [0, 0, false];\n break;\n case 2:\n if (vect.z <= 0) return [0, 0, false];\n break;\n case 3:\n if (vect.x >= 0) return [0, 0, false];\n break;\n case 4:\n if (vect.y >= 0) return [0, 0, false];\n break;\n default:\n if (vect.z >= 0) return [0, 0, false];\n break;\n }\n var _validFaceXYZToUV2 = validFaceXYZToUV(face, vect),\n u = _validFaceXYZToUV2[0],\n v = _validFaceXYZToUV2[1];\n return [u, v, true];\n};\n/**\r\n * Transforms the given point P to the (u,v,w) coordinate frame of the given face where the w-axis represents the face normal.\r\n */\nvar faceXYZtoUVW = function faceXYZtoUVW(face, v) {\n // The result coordinates are simply the dot products of P with the (u,v,w)\n // axes for the given face (see faceUVWAxes).\n switch (face) {\n case 0:\n return new Vector(v.y, v.z, v.x);\n case 1:\n return new Vector(-v.x, v.z, v.y);\n case 2:\n return new Vector(-v.x, -v.y, v.z);\n case 3:\n return new Vector(-v.z, -v.y, -v.x);\n case 4:\n return new Vector(-v.z, v.x, -v.y);\n default:\n return new Vector(v.y, v.x, -v.z);\n }\n};\n/**\r\n * Transforms the (si, ti) coordinates to a (not necessarily unit length) Point on the given face.\r\n */\nvar faceSiTiToXYZ = function faceSiTiToXYZ(face, si, ti) {\n return faceUVToXYZ(face, stToUV(siTiToST(si)), stToUV(siTiToST(ti)));\n};\n/**\r\n * Returns the right-handed normal (not necessarily unit length) for an\r\n * edge in the direction of the positive v-axis at the given u-value on\r\n * the given face. (This vector is perpendicular to the plane through\r\n * the sphere origin that contains the given edge.)\r\n */\nvar uNorm = function uNorm(face, u) {\n switch (face) {\n case 0:\n return new Vector(u, -1, 0);\n case 1:\n return new Vector(1, u, 0);\n case 2:\n return new Vector(1, 0, u);\n case 3:\n return new Vector(-u, 0, 1);\n case 4:\n return new Vector(0, -u, 1);\n default:\n return new Vector(0, -1, -u);\n }\n};\n/**\r\n * Returns the right-handed normal (not necessarily unit length) for an\r\n * edge in the direction of the positive u-axis at the given v-value on\r\n * the given face.\r\n */\nvar vNorm = function vNorm(face, v) {\n switch (face) {\n case 0:\n return new Vector(-v, 0, 1);\n case 1:\n return new Vector(0, -v, 1);\n case 2:\n return new Vector(0, -1, -v);\n case 3:\n return new Vector(v, -1, 0);\n case 4:\n return new Vector(1, v, 0);\n default:\n return new Vector(1, 0, v);\n }\n};\n/** The U, V, and W axes for each face. */\nvar faceUVWAxes = [[/*#__PURE__*/new Vector(0, 1, 0), /*#__PURE__*/new Vector(0, 0, 1), /*#__PURE__*/new Vector(1, 0, 0)], [/*#__PURE__*/new Vector(-1, 0, 0), /*#__PURE__*/new Vector(0, 0, 1), /*#__PURE__*/new Vector(0, 1, 0)], [/*#__PURE__*/new Vector(-1, 0, 0), /*#__PURE__*/new Vector(0, -1, 0), /*#__PURE__*/new Vector(0, 0, 1)], [/*#__PURE__*/new Vector(0, 0, -1), /*#__PURE__*/new Vector(0, -1, 0), /*#__PURE__*/new Vector(-1, 0, 0)], [/*#__PURE__*/new Vector(0, 0, -1), /*#__PURE__*/new Vector(1, 0, 0), /*#__PURE__*/new Vector(0, -1, 0)], [/*#__PURE__*/new Vector(0, 1, 0), /*#__PURE__*/new Vector(1, 0, 0), /*#__PURE__*/new Vector(0, 0, -1)]];\n/** The precomputed neighbors of each face. */\nvar faceUVWFaces = [[[4, 1], [5, 2], [3, 0]], [[0, 3], [5, 2], [4, 1]], [[0, 3], [1, 4], [5, 2]], [[2, 5], [1, 4], [0, 3]], [[2, 5], [3, 0], [1, 4]], [[4, 1], [3, 0], [2, 5]]];\n/**\r\n * Returns the given axis of the given face.\r\n */\nvar uvwAxis = function uvwAxis(face, axis) {\n return faceUVWAxes[face][axis];\n};\n/**\r\n * Returns the face in the (u,v,w) coordinate system on the given axis in the given direction.\r\n */\nvar uvwFace = function uvwFace(face, axis, direction) {\n return faceUVWFaces[face][axis][direction];\n};\n/**\r\n * Returns the u-axis for the given face.\r\n */\nvar uAxis = function uAxis(face) {\n return uvwAxis(face, 0);\n};\n/**\r\n * Returns the v-axis for the given face.\r\n */\nvar vAxis = function vAxis(face) {\n return uvwAxis(face, 1);\n};\n\nvar NORTH_POLE_LAT = Math.PI / 2;\nvar SOUTH_POLE_LAT = -NORTH_POLE_LAT;\n/**\r\n * Represents a point on the unit sphere as a pair of angles.\r\n */\nvar LatLng = /*#__PURE__*/function () {\n /**\r\n * Returns a new LatLng.\r\n * @category Constructors\r\n */\n function LatLng(lat, lng) {\n this.lat = lat;\n this.lng = lng;\n }\n /**\r\n * Returns a LatLng for the coordinates given in degrees.\r\n * @category Constructors\r\n */\n LatLng.fromDegrees = function fromDegrees(lat, lng) {\n return new LatLng(lat * DEGREE, lng * DEGREE);\n }\n /**\r\n * Returns the latitude of the given point.\r\n */;\n LatLng.latitude = function latitude(p) {\n var v = p.vector;\n return Math.atan2(v.z, Math.sqrt(v.x * v.x + v.y * v.y));\n }\n /**\r\n * Returns the longitude of the given point.\r\n */;\n LatLng.longitude = function longitude(p) {\n return Math.atan2(p.vector.y, p.vector.x);\n }\n /**\r\n * Returns a LatLng for a given Point.\r\n * @category Constructors\r\n */;\n LatLng.fromPoint = function fromPoint(p) {\n return new LatLng(this.latitude(p), this.longitude(p));\n }\n /**\r\n * Returns true if and only if the LatLng is normalized,\r\n * with lat ∈ [-π/2,π/2] and lng ∈ [-π,π].\r\n */;\n var _proto = LatLng.prototype;\n _proto.isValid = function isValid() {\n return Math.abs(this.lat) <= Math.PI / 2 && Math.abs(this.lng) <= Math.PI;\n }\n /**\r\n * Returns the normalized version of the LatLng,\r\n * with lat clamped to [-π/2,π/2] and lng wrapped in [-π,π].\r\n */;\n _proto.normalized = function normalized() {\n var lat = this.lat;\n if (lat > NORTH_POLE_LAT) lat = NORTH_POLE_LAT;else if (lat < SOUTH_POLE_LAT) lat = SOUTH_POLE_LAT;\n var lng = remainder(this.lng, 2 * Math.PI);\n return new LatLng(lat, lng);\n }\n /**\r\n * Returns the string representation of the LatLng.\r\n */;\n _proto.toString = function toString$1() {\n return \"[\" + toString(this.lat) + \", \" + toString(this.lng) + \"]\";\n }\n /**\r\n * Returns the angle between two LatLngs.\r\n */;\n _proto.distance = function distance(oll) {\n var dlat = Math.sin(0.5 * (oll.lat - this.lat));\n var dlng = Math.sin(0.5 * (oll.lng - this.lng));\n var x = dlat * dlat + dlng * dlng * Math.cos(this.lat) * Math.cos(oll.lat);\n return 2 * Math.atan2(Math.sqrt(x), Math.sqrt(Math.max(0, 1 - x)));\n }\n /**\r\n * Reports whether the latitude and longitude of the two LatLngs\r\n * are the same up to a small tolerance.\r\n */;\n _proto.approxEqual = function approxEqual$1(oll) {\n return approxEqual(this.lat, oll.lat) && approxEqual(this.lng, oll.lng);\n };\n return LatLng;\n}();\n\n/**\r\n * Returns the given column as a Point.\r\n */\nvar col = function col(m, _col) {\n return new Point$1(m[0][_col], m[1][_col], m[2][_col]);\n};\n/**\r\n * Sets the specified column to the value in the given Point.\r\n */\nvar setCol = function setCol(m, col, p) {\n m[0][col] = p.x;\n m[1][col] = p.y;\n m[2][col] = p.z;\n return m;\n};\n/**\r\n * Returns the multiplication of m by the Point p and converts the\r\n * resulting 1x3 matrix into a Point.\r\n */\nvar mul = function mul(m, p) {\n return new Point$1(m[0][0] * p.x + m[0][1] * p.y + m[0][2] * p.z, m[1][0] * p.x + m[1][1] * p.y + m[1][2] * p.z, m[2][0] * p.x + m[2][1] * p.y + m[2][2] * p.z);\n};\n/**\r\n * Reflects the matrix along its diagonal and returns the result.\r\n */\nvar transpose = function transpose(m) {\n return [[m[0][0], m[1][0], m[2][0]], [m[0][1], m[1][1], m[2][1]], [m[0][2], m[1][2], m[2][2]]];\n};\n/**\r\n * Returns the orthonormal frame for the given point on the unit sphere.\r\n */\nvar getFrame = function getFrame(p) {\n // Given the point p on the unit sphere, extend this into a right-handed\n // coordinate frame of unit-length column vectors m = (x,y,z). Note that\n // the vectors (x,y) are an orthonormal frame for the tangent space at point p,\n // while p itself is an orthonormal frame for the normal space at p.\n var m = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];\n setCol(m, 2, p);\n setCol(m, 1, Point$1.ortho(p));\n setCol(m, 0, Point$1.fromVector(col(m, 1).vector.cross(p.vector)));\n return m;\n};\n/**\r\n * Returns the coordinates of the given point with respect to its orthonormal basis m.\r\n * The resulting point q satisfies the identity (m * q == p).\r\n *\r\n * The inverse of an orthonormal matrix is its transpose.\r\n */\nvar toFrame = function toFrame(m, p) {\n return mul(transpose(m), p);\n};\n/**\r\n * Returns the coordinates of the given point in standard axis-aligned basis\r\n * from its orthonormal basis m.\r\n * The resulting point p satisfies the identity (p == m * q).\r\n */\nvar fromFrame = function fromFrame(m, q) {\n return mul(m, q);\n};\n\nvar CLOCKWISE = -1;\nvar INDETERMINATE = 0;\nvar COUNTERCLOCKWISE = 1;\n/**\r\n * Small number representing a reasonable level of noise between two\r\n * values that can be considered equal.\r\n */\nvar EPSILON$1 = 1e-15;\n/**\r\n * A smaller number for values that require more precision,\r\n * equivalent to C++ DBL_EPSILON.\r\n */\nvar DBL_EPSILON$1 = 2.220446049250313e-16;\n/**\r\n * Maximum error in computing (AxB).C where all vectors are unit length.\r\n * Using standard inequalities, it can be shown that\r\n *\r\n * fl(AxB) = AxB + D where |D| <= (|AxB| + (2/sqrt(3))*|A|*|B|) * e\r\n *\r\n * where \"fl()\" denotes a calculation done in floating-point arithmetic,\r\n * |x| denotes either absolute value or the L2-norm as appropriate, and\r\n * e is a reasonably small value near the noise level of floating point\r\n * number accuracy. Similarly,\r\n *\r\n * fl(B.C) = B.C + d where |d| <= (|B.C| + 2*|B|*|C|) * e .\r\n *\r\n * Applying these bounds to the unit-length vectors A,B,C and neglecting\r\n * relative error (which does not affect the sign of the result), we get\r\n *\r\n * fl((AxB).C) = (AxB).C + d where |d| <= (3 + 2/sqrt(3)) * e\r\n */\nvar MAX_DETERMINANT_ERROR = 1.8274 * DBL_EPSILON$1;\n/**\r\n * The factor to scale the magnitudes by when checking for the sign of set of\r\n * points with certainty. Using a similar technique to the one used for\r\n * maxDeterminantError, the error is at most:\r\n *\r\n * |d| <= (3 + 6/sqrt(3)) * |A-C| * |B-C| * e\r\n *\r\n * If the determinant magnitude is larger than this value then we know\r\n * its sign with certainty.\r\n */\nvar DET_ERROR_MULTIPLIER = 3.2321 * DBL_EPSILON$1;\n/**\r\n * Returns true if the points A, B, C are strictly counterclockwise,\r\n * and returns false if the points are clockwise or collinear (i.e. if they are all\r\n * contained on some great circle).\r\n *\r\n * Due to numerical errors, situations may arise that are mathematically\r\n * impossible, e.g. ABC may be considered strictly CCW while BCA is not.\r\n * However, the implementation guarantees the following:\r\n *\r\n * If sign(a,b,c), then !sign(c,b,a) for all a,b,c.\r\n */\nvar sign = function sign(a, b, c) {\n // We compute the signed volume of the parallelepiped ABC. The usual\n // formula for this is (A ⨯ B) · C, but we compute it here using (C ⨯ A) · B\n // in order to ensure that ABC and CBA are not both CCW. This follows\n // from the following identities (which are true numerically, not just\n // mathematically):\n //\n // (1) x ⨯ y == -(y ⨯ x)\n // (2) -x · y == -(x · y)\n return c.vector.cross(a.vector).dot(b.vector) > 0;\n};\n/**\r\n * Returns a Direction representing the ordering of the points.\r\n * CounterClockwise is returned if the points are in counter-clockwise order,\r\n * Clockwise for clockwise, and Indeterminate if any two points are the same (collinear),\r\n * or the sign could not completely be determined.\r\n *\r\n * This function has additional logic to make sure that the above properties hold even\r\n * when the three points are coplanar, and to deal with the limitations of\r\n * floating-point arithmetic.\r\n *\r\n * robustSign satisfies the following conditions:\r\n *\r\n * (1) robustSign(a,b,c) == Indeterminate if and only if a == b, b == c, or c == a\r\n * (2) robustSign(b,c,a) == robustSign(a,b,c) for all a,b,c\r\n * (3) robustSign(c,b,a) == -robustSign(a,b,c) for all a,b,c\r\n *\r\n * In other words:\r\n *\r\n * (1) The result is Indeterminate if and only if two points are the same.\r\n * (2) Rotating the order of the arguments does not affect the result.\r\n * (3) Exchanging any two arguments inverts the result.\r\n *\r\n * On the other hand, note that it is not true in general that\r\n * robustSign(-a,b,c) == -robustSign(a,b,c), or any similar identities\r\n * involving antipodal points.\r\n */\nvar robustSign = function robustSign(a, b, c) {\n var sign = triageSign(a, b, c);\n if (sign === INDETERMINATE) {\n sign = expensiveSign(a, b, c);\n }\n return sign;\n};\n/**\r\n * Reports the direction sign of the points in a numerically stable way.\r\n * Unlike triageSign, this method can usually compute the correct determinant sign\r\n * even when all three points are as collinear as possible. For example if three\r\n * points are spaced 1km apart along a random line on the Earth's surface using\r\n * the nearest representable points, there is only a 0.4% chance that this method\r\n * will not be able to find the determinant sign. The probability of failure\r\n * decreases as the points get closer together; if the collinear points are 1 meter\r\n * apart, the failure rate drops to 0.0004%.\r\n *\r\n * This method could be extended to also handle nearly-antipodal points, but antipodal\r\n * points are rare in practice so it seems better to simply fall back to\r\n * exact arithmetic in that case.\r\n */\nvar stableSign = function stableSign(a, b, c) {\n var ab = b.vector.sub(a.vector);\n var ab2 = ab.norm2();\n var bc = c.vector.sub(b.vector);\n var bc2 = bc.norm2();\n var ca = a.vector.sub(c.vector);\n var ca2 = ca.norm2();\n // Now compute the determinant ((A-C)x(B-C)).C, where the vertices have been\n // cyclically permuted if necessary so that AB is the longest edge. (This\n // minimizes the magnitude of cross product.) At the same time we also\n // compute the maximum error in the determinant.\n // The two shortest edges, pointing away from their common point.\n var e1;\n var e2;\n var ov;\n if (ab2 >= bc2 && ab2 >= ca2) {\n // AB is the longest edge.\n e1 = ca;\n e2 = bc;\n ov = c.vector;\n } else if (bc2 >= ca2) {\n // BC is the longest edge.\n e1 = ab;\n e2 = ca;\n ov = a.vector;\n } else {\n // CA is the longest edge.\n e1 = bc;\n e2 = ab;\n ov = b.vector;\n }\n var det = -e1.cross(e2).dot(ov);\n var maxErr = DET_ERROR_MULTIPLIER * Math.sqrt(e1.norm2() * e2.norm2());\n // If the determinant isn't zero, within maxErr, we know definitively the point ordering.\n if (det > maxErr) return COUNTERCLOCKWISE;\n if (det < -maxErr) return CLOCKWISE;\n return INDETERMINATE;\n};\n/**\r\n * Returns the direction sign of the points. It returns Indeterminate if two\r\n * points are identical or the result is uncertain. Uncertain cases can be resolved, if\r\n * desired, by calling expensiveSign.\r\n *\r\n * The purpose of this method is to allow additional cheap tests to be done without\r\n * calling expensiveSign.\r\n */\nvar triageSign = function triageSign(a, b, c) {\n var det = a.vector.cross(b.vector).dot(c.vector);\n if (det > MAX_DETERMINANT_ERROR) return COUNTERCLOCKWISE;\n if (det < -MAX_DETERMINANT_ERROR) return CLOCKWISE;\n return INDETERMINATE;\n};\n/**\r\n * Reports the direction sign of the points. It returns Indeterminate\r\n * if two of the input points are the same. It uses multiple-precision arithmetic\r\n * to ensure that its results are always self-consistent.\r\n */\nvar expensiveSign = function expensiveSign(a, b, c) {\n // Return Indeterminate if and only if two points are the same.\n // This ensures robustSign(a,b,c) == Indeterminate if and only if a == b, b == c, or c == a.\n // ie. Property 1 of robustSign.\n if (a.equals(b) || b.equals(c) || c.equals(a)) return INDETERMINATE;\n // Next we try recomputing the determinant still using floating-point\n // arithmetic but in a more precise way. This is more expensive than the\n // simple calculation done by triageSign, but it is still *much* cheaper\n // than using arbitrary-precision arithmetic. This optimization is able to\n // compute the correct determinant sign in virtually all cases except when\n // the three points are truly collinear (e.g., three points on the equator).\n var detSign = stableSign(a, b, c);\n if (detSign !== INDETERMINATE) return detSign;\n // Otherwise fall back to exact arithmetic and symbolic permutations.\n return exactSign(a, b, c, true);\n};\n/**\r\n * Reports the direction sign of the points computed using high-precision\r\n * arithmetic and/or symbolic perturbations.\r\n */\nvar exactSign = function exactSign(a, b, c, perturb) {\n // Sort the three points in lexicographic order, keeping track of the sign\n // of the permutation. (Each exchange inverts the sign of the determinant.)\n var permSign = COUNTERCLOCKWISE;\n var pa = a;\n var pb = b;\n var pc = c;\n if (pa.vector.cmp(pb.vector) > 0) {\n var _ref = [pb, pa];\n pa = _ref[0];\n pb = _ref[1];\n permSign = -permSign;\n }\n if (pb.vector.cmp(pc.vector) > 0) {\n var _ref2 = [pc, pb];\n pb = _ref2[0];\n pc = _ref2[1];\n permSign = -permSign;\n }\n if (pa.vector.cmp(pb.vector) > 0) {\n var _ref3 = [pb, pa];\n pa = _ref3[0];\n pb = _ref3[1];\n permSign = -permSign;\n }\n // Construct multiple-precision versions of the sorted points and compute\n // their precise 3x3 determinant.\n var xa = PreciseVector.fromVector(pa.vector);\n var xb = PreciseVector.fromVector(pb.vector);\n var xc = PreciseVector.fromVector(pc.vector);\n var xbCrossXc = xb.cross(xc);\n var det = xa.dot(xbCrossXc);\n // The precision of big.Float is high enough that the result should always\n // be exact enough (no rounding was performed).\n // If the exact determinant is non-zero, we're done.\n var detSign = det.getSign();\n if (detSign === INDETERMINATE && perturb) {\n // Otherwise, we need to resort to symbolic perturbations to resolve the\n // sign of the determinant.\n detSign = symbolicallyPerturbedSign(xa, xb, xc, xbCrossXc);\n }\n return permSign * detSign;\n};\n/**\r\n * Reports the sign of the determinant of three points A, B, C under a model where\r\n * every possible Point is slightly perturbed by a unique infinitesmal amount such that\r\n * no three perturbed points are collinear and no four points are coplanar. The perturbations\r\n * are so small that they do not change the sign of any determinant that was non-zero\r\n * before the perturbations, and therefore can be safely ignored unless the\r\n * determinant of three points is exactly zero (using multiple-precision arithmetic).\r\n * This returns CounterClockwise or Clockwise according to the sign of the determinant\r\n * after the symbolic perturbations are taken into account.\r\n *\r\n * Since the symbolic perturbation of a given point is fixed (i.e., the\r\n * perturbation is the same for all calls to this method and does not depend\r\n * on the other two arguments), the results of this method are always\r\n * self-consistent. It will never return results that would correspond to an\r\n * impossible configuration of non-degenerate points.\r\n *\r\n * This requires that the 3x3 determinant of A, B, C must be exactly zero.\r\n * And the points must be distinct, with A < B < C in lexicographic order.\r\n *\r\n * Reference:\r\n *\r\n * \"Simulation of Simplicity\" (Edelsbrunner and Muecke, ACM Transactions on\r\n * Graphics, 1990).\r\n */\nvar symbolicallyPerturbedSign = function symbolicallyPerturbedSign(a, b, c, bCrossC) {\n // This method requires that the points are sorted in lexicographically\n // increasing order. This is because every possible Point has its own\n // symbolic perturbation such that if A < B then the symbolic perturbation\n // for A is much larger than the perturbation for B.\n //\n // Alternatively, we could sort the points in this method and keep track of\n // the sign of the permutation, but it is more efficient to do this before\n // converting the inputs to the multi-precision representation, and this\n // also lets us re-use the result of the cross product B x C.\n //\n // Every input coordinate x[i] is assigned a symbolic perturbation dx[i].\n // We then compute the sign of the determinant of the perturbed points,\n // i.e.\n // | a.X+da.X a.Y+da.Y a.Z+da.Z |\n // | b.X+db.X b.Y+db.Y b.Z+db.Z |\n // | c.X+dc.X c.Y+dc.Y c.Z+dc.Z |\n //\n // The perturbations are chosen such that\n //\n // da.Z > da.Y > da.X > db.Z > db.Y > db.X > dc.Z > dc.Y > dc.X\n //\n // where each perturbation is so much smaller than the previous one that we\n // don't even need to consider it unless the coefficients of all previous\n // perturbations are zero. In fact, it is so small that we don't need to\n // consider it unless the coefficient of all products of the previous\n // perturbations are zero. For example, we don't need to consider the\n // coefficient of db.Y unless the coefficient of db.Z *da.X is zero.\n //\n // The follow code simply enumerates the coefficients of the perturbations\n // (and products of perturbations) that appear in the determinant above, in\n // order of decreasing perturbation magnitude. The first non-zero\n // coefficient determines the sign of the result. The easiest way to\n // enumerate the coefficients in the correct order is to pretend that each\n // perturbation is some tiny value \"eps\" raised to a power of two:\n //\n // eps** 1 2 4 8 16 32 64 128 256\n // da.Z da.Y da.X db.Z db.Y db.X dc.Z dc.Y dc.X\n //\n // Essentially we can then just count in binary and test the corresponding\n // subset of perturbations at each step. So for example, we must test the\n // coefficient of db.Z*da.X before db.Y because eps**12 > eps**16.\n //\n // Of course, not all products of these perturbations appear in the\n // determinant above, since the determinant only contains the products of\n // elements in distinct rows and columns. Thus we don't need to consider\n // da.Z*da.Y, db.Y *da.Y, etc. Furthermore, sometimes different pairs of\n // perturbations have the same coefficient in the determinant; for example,\n // da.Y*db.X and db.Y*da.X have the same coefficient (c.Z). Therefore\n // we only need to test this coefficient the first time we encounter it in\n // the binary order above (which will be db.Y*da.X).\n //\n // The sequence of tests below also appears in Table 4-ii of the paper\n // referenced above, if you just want to look it up, with the following\n // translations: [a,b,c] -> [i,j,k] and [0,1,2] -> [1,2,3]. Also note that\n // some of the signs are different because the opposite cross product is\n // used (e.g., B x C rather than C x B).\n var detSign = bCrossC.z.getSign(); // da.Z\n if (detSign !== 0) return detSign;\n detSign = bCrossC.y.getSign(); // da.Y\n if (detSign !== 0) return detSign;\n detSign = bCrossC.x.getSign(); // da.X\n if (detSign !== 0) return detSign;\n detSign = c.x.mul(a.y).sub(c.y.mul(a.x)).getSign(); // db.Z\n if (detSign !== 0) return detSign;\n detSign = c.x.getSign(); // db.Z * da.Y\n if (detSign !== 0) return detSign;\n // @ts-ignore Typescript doesn't understand this negation is valid\n detSign = -c.y.getSign(); // db.Z * da.X\n if (detSign !== 0) return detSign;\n detSign = c.z.mul(a.x).sub(c.x.mul(a.z)).getSign(); // db.Y\n if (detSign !== 0) return detSign;\n detSign = c.z.getSign(); // db.Y * da.X\n if (detSign !== 0) return detSign;\n // The following test is listed in the paper, but it is redundant because\n // the previous tests guarantee that C == (0, 0, 0).\n // (c.y*a.z - c.z*a.y).getSign() // db.X\n detSign = a.x.mul(b.y).sub(a.y.mul(b.x)).getSign(); // dc.Z\n if (detSign !== 0) return detSign;\n // @ts-ignore Typescript doesn't understand this negation is valid\n detSign = -b.x.getSign(); // dc.Z * da.Y\n if (detSign !== 0) return detSign;\n detSign = b.y.getSign(); // dc.Z * da.X\n if (detSign !== 0) return detSign;\n detSign = a.x.getSign(); // dc.Z * db.Y\n if (detSign !== 0) return detSign;\n return COUNTERCLOCKWISE; // dc.Z * db.Y * da.X\n};\n\n/**\r\n * Point represents a point on the unit sphere as a normalized 3D vector.\r\n * Fields should be treated as read-only. Use one of the factory methods for creation.\r\n *\r\n * @beta incomplete\r\n */\nvar Point$1 = /*#__PURE__*/function () {\n /**\r\n * Returns a new Point.\r\n * @category Constructors\r\n */\n function Point(x, y, z) {\n this.vector = new Vector(x, y, z);\n }\n /**\r\n * Returns the x dimension value.\r\n */\n /**\r\n * Point represents a point on the unit sphere as a normalized 3D vector.\r\n * Fields should be treated as read-only. Use one of the factory methods for creation.\r\n * @category Constructors\r\n */\n Point.fromVector = function fromVector(vector) {\n return new Point(vector.x, vector.y, vector.z);\n }\n /**\r\n * Returns a Point for the given LatLng.\r\n * @category Constructors\r\n */;\n Point.fromLatLng = function fromLatLng(ll) {\n var phi = ll.lat;\n var theta = ll.lng;\n var cosphi = Math.cos(phi);\n return new Point(Math.cos(theta) * cosphi, Math.sin(theta) * cosphi, Math.sin(phi));\n }\n /**\r\n * Creates a new normalized point from coordinates.\r\n *\r\n * This always returns a valid point. If the given coordinates can not be normalized\r\n * the origin point will be returned.\r\n *\r\n * This behavior is different from the C++ construction of a S2Point from coordinates\r\n * (i.e. S2Point(x, y, z)) in that in C++ they do not Normalize.\r\n * @category Constructors\r\n */;\n Point.fromCoords = function fromCoords(x, y, z) {\n if (x === 0 && y === 0 && z === 0) return this.originPoint();\n return Point.fromVector(new Vector(x, y, z).normalize());\n }\n /**\r\n * Returns a unique \"origin\" on the sphere for operations that need a fixed\r\n * reference point. In particular, this is the \"point at infinity\" used for\r\n * point-in-polygon testing (by counting the number of edge crossings).\r\n *\r\n * It should *not* be a point that is commonly used in edge tests in order\r\n * to avoid triggering code to handle degenerate cases (this rules out the\r\n * north and south poles). It should also not be on the boundary of any\r\n * low-level S2Cell for the same reason.\r\n * @category Constructors\r\n */;\n Point.originPoint = function originPoint() {\n return new Point(-0.0099994664350250197, 0.0025924542609324121, 0.99994664350250195);\n }\n /**\r\n * Returns a Point that is orthogonal to both p and op. This is similar to\r\n * p.Cross(op) (the true cross product) except that it does a better job of\r\n * ensuring orthogonality when the Point is nearly parallel to op, it returns\r\n * a non-zero result even when p == op or p == -op and the result is a Point.\r\n *\r\n * It satisfies the following properties (f == PointCross):\r\n *\r\n * \t(1) f(p, op) != 0 for all p, op\r\n * \t(2) f(op,p) == -f(p,op) unless p == op or p == -op\r\n * \t(3) f(-p,op) == -f(p,op) unless p == op or p == -op\r\n * \t(4) f(p,-op) == -f(p,op) unless p == op or p == -op\r\n */;\n var _proto = Point.prototype;\n _proto.pointCross = function pointCross(op) {\n var v = this.vector.add(op.vector).cross(op.vector.sub(this.vector));\n if (v.x === 0 && v.y === 0 && v.z === 0) v = this.vector.ortho();\n return Point.fromVector(v);\n }\n /**\r\n * Returns true if the edges OA, OB, and OC are encountered in that\r\n * order while sweeping CCW around the point O.\r\n *\r\n * You can think of this as testing whether A <= B <= C with respect to the\r\n * CCW ordering around O that starts at A, or equivalently, whether B is\r\n * contained in the range of angles (inclusive) that starts at A and extends\r\n * CCW to C. Properties:\r\n *\r\n * \t(1) If OrderedCCW(a,b,c,o) && OrderedCCW(b,a,c,o), then a == b\r\n * \t(2) If OrderedCCW(a,b,c,o) && OrderedCCW(a,c,b,o), then b == c\r\n * \t(3) If OrderedCCW(a,b,c,o) && OrderedCCW(c,b,a,o), then a == b == c\r\n * \t(4) If a == b or b == c, then OrderedCCW(a,b,c,o) is true\r\n * \t(5) Otherwise if a == c, then OrderedCCW(a,b,c,o) is false\r\n */;\n Point.orderedCCW = function orderedCCW(a, b, c, o) {\n var sum = 0;\n if (robustSign(b, o, a) !== CLOCKWISE) sum++;\n if (robustSign(c, o, b) !== CLOCKWISE) sum++;\n if (robustSign(a, o, c) === COUNTERCLOCKWISE) sum++;\n return sum >= 2;\n }\n /**\r\n * Returns the angle between this point and another point.\r\n */;\n _proto.distance = function distance(b) {\n return this.vector.angle(b.vector);\n }\n /**\r\n * Reports whether this point equals another point.\r\n */;\n _proto.equals = function equals(op) {\n return this.vector.equals(op.vector);\n }\n /**\r\n * Reports whether this point is similar enough to be equal to another point.\r\n */;\n _proto.approxEqual = function approxEqual(op, eps) {\n if (eps === void 0) {\n eps = EPSILON$1;\n }\n return this.vector.angle(op.vector) <= eps;\n }\n /**\r\n * Reports the angle between two vectors with better precision when\r\n * the two are nearly parallel.\r\n *\r\n * The .Angle() member function uses atan(|AxB|, A.B) to compute the angle\r\n * between A and B, which can lose about half its precision when A and B are\r\n * nearly (anti-)parallel.\r\n *\r\n * Kahan provides a much more stable form:\r\n *\r\n * \t2*atan2(| A*|B| - |A|*B |, | A*|B| + |A|*B |)\r\n *\r\n * Since Points are unit magnitude by construction we can simplify further:\r\n *\r\n * \t2*atan2(|A-B|,|A+B|)\r\n *\r\n * This likely can't replace Vectors Angle since it requires four magnitude\r\n * calculations, each of which takes 5 operations + a square root, plus 6\r\n * operations to find the sum and difference of the vectors, for a total of 26 +\r\n * 4 square roots. Vectors Angle requires 19 + 1 square root.\r\n *\r\n * Since we always have unit vectors, we can elide two of those magnitude\r\n * calculations for a total of 16 + 2 square roots which is competitive with\r\n * Vectors Angle performance.\r\n *\r\n * Reference: Kahan, W. (2006, Jan 11). \"How Futile are Mindless Assessments of\r\n * Roundoff in Floating-Point Computation?\" (p. 47).\r\n * https://people.eecs.berkeley.edu/~wkahan/Mindless.pdf\r\n *\r\n * The 2 points must be normalized.\r\n */;\n _proto.stableAngle = function stableAngle(op) {\n return 2 * Math.atan2(this.vector.sub(op.vector).norm(), this.vector.add(op.vector).norm());\n }\n /**\r\n * Constructs a ChordAngle corresponding to the distance between the two given points.\r\n */;\n Point.chordAngleBetweenPoints = function chordAngleBetweenPoints(x, y) {\n return Math.min(4.0, x.vector.sub(y.vector).norm2());\n }\n /**\r\n * Generates a slice of points shaped as a regular polygon with the specified number of vertices,\r\n * all located on a circle of the specified angular radius around the center.\r\n */;\n Point.regularPoints = function regularPoints(center, radius, numVertices) {\n return this.regularPointsForFrame(getFrame(center), radius, numVertices);\n }\n /**\r\n * Generates a slice of points shaped as a regular polygon with the specified number of vertices,\r\n * all on a circle of the specified angular radius around the center.\r\n */;\n Point.regularPointsForFrame = function regularPointsForFrame(frame, radius, numVertices) {\n var z = Math.cos(radius);\n var r = Math.sin(radius);\n var radianStep = 2 * Math.PI / numVertices;\n var vertices = [];\n for (var i = 0; i < numVertices; i++) {\n var angle = i * radianStep;\n var p = new Point(r * Math.cos(angle), r * Math.sin(angle), z);\n vertices.push(Point.fromVector(fromFrame(frame, p).vector.normalize()));\n }\n return vertices;\n }\n // /** Returns a bounding cap for this point. */\n // capBound(): Cap {\n // return Cap.fromPoint(this)\n // }\n // /** Returns a bounding latitude-longitude rectangle from this point. */\n // rectBound(): Rect {\n // return Rect.fromLatLng(LatLng.fromPoint(this))\n // }\n /** Returns false as Points do not contain any other S2 types. */;\n _proto.containsCell = function containsCell(_c) {\n return false;\n }\n /** Reports whether this Point intersects the given cell. */;\n _proto.intersectsCell = function intersectsCell(c) {\n return c.containsPoint(this);\n }\n /**\r\n * Reports if this Point contains the other Point.\r\n * (This method is named to satisfy the Region interface.)\r\n */;\n _proto.containsPoint = function containsPoint(other) {\n return this.contains(other);\n }\n /** Computes a covering of the Point. */;\n _proto.cellUnionBound = function cellUnionBound() {\n return [fromPoint(this)];\n }\n /**\r\n * Reports if this Point contains the other Point.\r\n * (This method matches all other S2 types where the reflexive Contains\r\n * method does not contain the type's name.)\r\n */;\n _proto.contains = function contains(other) {\n return this.equals(other);\n }\n /**\r\n * Returns a unit-length vector to use as the reference direction for\r\n * deciding whether a polygon with semi-open boundaries contains the given vertex \"a\"\r\n * (see ContainsVertexQuery). The result is unit length and is guaranteed\r\n * to be different from the given point \"a\".\r\n */;\n _proto.referenceDir = function referenceDir() {\n return Point.ortho(this);\n };\n _proto.toString = function toString() {\n return this.vector.toString();\n }\n /**\r\n * Returns a unit-length vector that is orthogonal to this point.\r\n * Satisfies Ortho(-a) = -Ortho(a) for all a.\r\n *\r\n * Note that Vector3 also defines an \"Ortho\" method, but this one is\r\n * preferred for use in S2 code because it explicitly tries to avoid result\r\n * coordinates that are zero. (This is a performance optimization that\r\n * reduces the amount of time spent in functions that handle degeneracies.)\r\n */;\n Point.ortho = function ortho(a) {\n var lc = a.vector.largestComponent();\n var op = new Vector(0.012, 0.0053, 0.00457);\n if (lc === Vector.X_AXIS) op.z = 1;else if (lc === Vector.Y_AXIS) op.x = 1;else op.y = 1;\n return Point.fromVector(a.vector.cross(op).normalize());\n }\n /**\r\n * Sorts the array of Points in place.\r\n */;\n Point.sortPoints = function sortPoints(points) {\n points.sort(function (a, b) {\n return a.vector.cmp(b.vector);\n });\n };\n return _createClass(Point, [{\n key: \"x\",\n get: function get() {\n return this.vector.x;\n }\n /**\r\n * Returns the y dimension value.\r\n */\n }, {\n key: \"y\",\n get: function get() {\n return this.vector.y;\n }\n /**\r\n * Returns the z dimension value.\r\n */\n }, {\n key: \"z\",\n get: function get() {\n return this.vector.z;\n }\n }]);\n}();\n\n/** Returns the number closest to x within the range min..max. */\nvar clampInt = function clampInt(x, min, max) {\n if (x < min) return min;\n if (x > max) return max;\n return x;\n};\n/** Returns the largest of the given numbers. */\nvar max = function max(first) {\n var max = first;\n for (var _len = arguments.length, others = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n others[_key - 1] = arguments[_key];\n }\n for (var _i = 0, _others = others; _i < _others.length; _i++) {\n var y = _others[_i];\n if (y > max) max = y;\n }\n return max;\n};\n/** Returns the smallest of the given numbers. */\nvar min = function min(first) {\n var min = first;\n for (var _len2 = arguments.length, others = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n others[_key2 - 1] = arguments[_key2];\n }\n for (var _i2 = 0, _others2 = others; _i2 < _others2.length; _i2++) {\n var y = _others2[_i2];\n if (y < min) min = y;\n }\n return min;\n};\n/** Returns the absolute value of a bigint. */\nvar abs$1 = function abs(n) {\n return n < 0n ? -n : n;\n};\n/** Returns the largest of the given ChordAngle values. */\nvar maxChordAngle = function maxChordAngle(first) {\n for (var _len5 = arguments.length, others = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {\n others[_key5 - 1] = arguments[_key5];\n }\n return max.apply(void 0, [first].concat(others));\n};\n/** Returns the smallest of the given ChordAngle values. */\nvar minChordAngle = function minChordAngle(first) {\n for (var _len6 = arguments.length, others = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {\n others[_key6 - 1] = arguments[_key6];\n }\n return min.apply(void 0, [first].concat(others));\n};\n/**\r\n * Performs a binary search to find the smallest index `i` in the range [0, n) where the function `f` is true.\r\n *\r\n * missinglink: port of Go `sort.Search`\r\n */\nvar binarySearch = function binarySearch(n, f) {\n var i = 0;\n var j = n;\n while (i < j) {\n var h = Math.floor((i + j) / 2); // calculate mid-point\n if (!f(h)) {\n i = h + 1; // move to the right half\n } else {\n j = h; // move to the left half\n }\n }\n return i;\n};\n\n/**\r\n * An invalid cell ID guaranteed to be larger than any valid cell ID.\r\n * It is used primarily by ShapeIndex.\r\n * The value is also used by some S2 types when encoding data.\r\n * Note that the sentinel's RangeMin == RangeMax == itself.\r\n */\nvar SentinelCellID = (1n << 64n) - 1n;\n/**\r\n * Returns the cube face for this cell id, in the range [0,5].\r\n */\nvar face$1 = function face(ci) {\n return Number(ci >> BigInt(POS_BITS));\n};\n/**\r\n * Returns the position along the Hilbert curve of this cell id, in the range [0,2^POS_BITS-1].\r\n */\nvar pos = function pos(ci) {\n return ci & SentinelCellID >> BigInt(FACE_BITS);\n};\n/**\r\n * Returns the subdivision level of this cell id, in the range [0, MAX_LEVEL].\r\n */\nvar level = function level(ci) {\n return MAX_LEVEL - (findLSBSetNonZero64(ci) >>> 1);\n};\n/**\r\n * Returns the cell id at the given level, which must be no greater than the current level.\r\n */\nvar parent = function parent(ci, level) {\n var lsb = lsbForLevel(level);\n return ci & -lsb | lsb;\n};\n/**\r\n * Returns the immediate parent of the cell.\r\n * This method is cheaper than `parent`, but assumes the cell is not a face cell.\r\n */\nvar immediateParent = function immediateParent(ci) {\n var nlsb = lsb(ci) << 2n;\n return ci & -nlsb | nlsb;\n};\n/** Returns whether this is a top-level (face) cell. */\nvar isFace = function isFace(ci) {\n return (ci & lsbForLevel(0) - 1n) === 0n;\n};\n/**\r\n * Returns true is cell id is valid.\r\n */\nvar valid = function valid(ci) {\n if (typeof ci !== 'bigint' || BigInt.asUintN(64, ci) != ci) return false;\n return face$1(ci) <= NUM_FACES && (lsb(ci) & 0x1555555555555555n) != 0n;\n};\n/**\r\n * Returns whether this cell ID is at the deepest level; that is, the level at which the cells are smallest.\r\n */\nvar isLeaf = function isLeaf(ci) {\n return (ci & 1n) != 0n;\n};\n/**\r\n * Returns the child position (0..3) of this cell's ancestor at the given level, relative to its parent.\r\n * The argument should be in the range 1..MaxLevel.\r\n * For example, childPosition(1) returns the position of this cell's level-1 ancestor within its top-level face cell.\r\n */\nvar childPosition = function childPosition(ci, level) {\n return Number(ci >> 2n * BigInt(MAX_LEVEL - level) + 1n) & 3;\n};\n// Bitwise\n/**\r\n * Returns the least significant bit that is set\r\n */\nvar lsb = function lsb(ci) {\n return ci & -ci;\n};\n/**\r\n * Returns the lowest-numbered bit that is on for cells at the given level.\r\n */\nvar lsbForLevel = function lsbForLevel(level) {\n return 1n << BigInt(2 * (MAX_LEVEL - level));\n};\n/**\r\n * Returns the four immediate children of this cell.\r\n * If the cell is a leaf cell, it returns four identical cells that are not the children.\r\n */\nvar children = function children(ci) {\n var ch = [ci, ci, ci, ci];\n var _lsb = lsb(ci);\n ch[0] = ci - _lsb + (_lsb >> 2n);\n _lsb >>= 1n;\n ch[1] = ch[0] + _lsb;\n ch[2] = ch[1] + _lsb;\n ch[3] = ch[2] + _lsb;\n return ch;\n};\n/**\r\n * Returns all neighbors of this cell at the given level. Two cells X and Y are neighbors\r\n * if their boundaries intersect but their interiors do not. In particular, two cells that\r\n * intersect at a single point are neighbors. Note that for cells adjacent to a face vertex,\r\n * the same neighbor may be returned more than once. There could be up to eight neighbors\r\n * including the diagonal ones that share the vertex.\r\n *\r\n * This requires level >= ci.level().\r\n */\nvar allNeighbors = function allNeighbors(ci, lvl) {\n var neighbors = [];\n var _faceIJOrientation = faceIJOrientation(ci),\n f = _faceIJOrientation.f,\n i = _faceIJOrientation.i,\n j = _faceIJOrientation.j;\n // Find the coordinates of the lower left-hand leaf cell. We need to\n // normalize (i,j) to a known position within the cell because level\n // may be larger than this cell's level.\n var size = sizeIJ(level(ci));\n i &= -size;\n j &= -size;\n var nbrSize = sizeIJ(lvl);\n // Compute the top-bottom, left-right, and diagonal neighbors in one pass.\n for (var k = -nbrSize;; k += nbrSize) {\n var sameFace = void 0;\n if (k < 0) {\n sameFace = j + k >= 0;\n } else if (k >= size) {\n sameFace = j + k < MAX_SIZE;\n } else {\n sameFace = true;\n // Top and bottom neighbors.\n neighbors.push(parent(fromFaceIJSame(f, i + k, j - nbrSize, j - size >= 0), lvl));\n neighbors.push(parent(fromFaceIJSame(f, i + k, j + size, j + size < MAX_SIZE), lvl));\n }\n // Left, right, and diagonal neighbors.\n neighbors.push(parent(fromFaceIJSame(f, i - nbrSize, j + k, sameFace && i - size >= 0), lvl));\n neighbors.push(parent(fromFaceIJSame(f, i + size, j + k, sameFace && i + size < MAX_SIZE), lvl));\n if (k >= size) break;\n }\n return neighbors;\n};\n// Ranges\n/**\r\n * Returns the minimum CellID that is contained within this cell.\r\n */\nvar rangeMin = function rangeMin(ci) {\n return ci - (lsb(ci) - 1n);\n};\n/**\r\n * Returns the maximum CellID that is contained within this cell.\r\n */\nvar rangeMax = function rangeMax(ci) {\n return ci + (lsb(ci) - 1n);\n};\n/**\r\n * Returns true iff ci contains oci.\r\n */\nvar contains = function contains(ci, oci) {\n return rangeMin(ci) <= oci && oci <= rangeMax(ci);\n};\n/**\r\n * Returns true iff ci intersects oci.\r\n */\nvar intersects = function intersects(ci, oci) {\n return rangeMin(oci) <= rangeMax(ci) && rangeMax(oci) >= rangeMin(ci);\n};\n// Token\n/**\r\n * Returns a hex-encoded string of the uint64 cell id, with leading zeros included but trailing zeros stripped\r\n */\nvar toToken = function toToken(ci) {\n var s = ci.toString(16).padStart(16, '0').replace(/0+$/, '');\n if (s.length === 0) return 'X';\n return s;\n};\n/**\r\n * Returns a cell id given a hex-encoded string.\r\n * @category Constructors\r\n */\nvar fromToken = function fromToken(t) {\n if (t.length > 16) return 0n;\n if (!/^[A-F0-9]+$/i.test(t)) return 0n;\n var ci = BigInt('0x' + t);\n if (t.length < 16) ci = ci << BigInt(4 * (16 - t.length));\n return ci;\n};\n/**\r\n * Returns the string representation of the cell ID in the form \"1/3210\".\r\n */\nvar toString$1 = function toString(ci) {\n if (!valid(ci)) return \"Invalid: \" + ci.toString(16);\n var result = face$1(ci) + \"/\";\n for (var l = 1; l <= level(ci); l++) result += childPosition(ci, l);\n return result;\n};\n/**\r\n * Converts a string in the form \"1/3210\" to a CellID.\r\n * @category Constructors\r\n */\nvar fromString = function fromString(s) {\n var level = s.length - 2;\n if (level < 0 || level > MAX_LEVEL) return 0n;\n var face = parseInt(s[0], 10);\n if (isNaN(face) || face < 0 || face > 5 || s[1] !== '/') return 0n;\n var cid = fromFace(face);\n for (var i = 2; i < s.length; i++) {\n var childPos = parseInt(s[i], 10);\n if (isNaN(childPos) || childPos < 0 || childPos > 3) return 0n;\n cid = children(cid)[childPos];\n }\n return cid;\n};\n// Constructors\n/**\r\n * Returns a cell id given its face in the range [0,5], the 61-bit Hilbert curve position pos within that face, and the level in the range [0,MAX_LEVEL].\r\n * The position in the cell id will be truncated to correspond to the Hilbert curve position at the center of the returned cell.\r\n * @category Constructors\r\n */\nvar fromFacePosLevel = function fromFacePosLevel(face, pos, level) {\n return parent((BigInt(face) << BigInt(POS_BITS)) + (pos || 1n), level);\n};\n/**\r\n * Returns the cell corresponding to a given S2 cube face.\r\n * @category Constructors\r\n */\nvar fromFace = function fromFace(face) {\n return (BigInt(face) << BigInt(POS_BITS)) + lsbForLevel(0);\n};\n/**\r\n * Returns a leaf cell containing point p.\r\n * Usually there is exactly one such cell, but for points along the edge of a cell, any adjacent cell may be (deterministically) chosen.\r\n * This is because CellIDs are considered to be closed sets.\r\n * The returned cell will always contain the given point, i.e.\r\n *\r\n * \tCellFromPoint(p).ContainsPoint(p)\r\n *\r\n * is always true.\r\n * @category Constructors\r\n */\nvar fromPoint = function fromPoint(p) {\n var _xyzToFaceUV = xyzToFaceUV(p.vector),\n f = _xyzToFaceUV[0],\n u = _xyzToFaceUV[1],\n v = _xyzToFaceUV[2];\n var i = stToIJ(uvToST(u));\n var j = stToIJ(uvToST(v));\n return fromFaceIJ(f, i, j);\n};\n/**\r\n * Returns the leaf cell containing ll.\r\n * @category Constructors\r\n */\nvar fromLatLng = function fromLatLng(ll) {\n return fromPoint(Point$1.fromLatLng(ll));\n};\n// stuv\n/** Converts a value in ST coordinates to a value in IJ coordinates. */\nvar stToIJ = function stToIJ(s) {\n return clampInt(Math.floor(MAX_SIZE * s), 0, MAX_SIZE - 1);\n};\nvar sizeIJ = function sizeIJ(level) {\n return 1 << clampInt(MAX_LEVEL - level, 0, MAX_LEVEL);\n};\n/** Returns the edge length of this CellID in (s,t)-space at the given level. */\nvar sizeST = function sizeST(level) {\n return ijToSTMin(sizeIJ(level));\n};\n/**\r\n * Converts the i- or j-index of a leaf cell to the minimum corresponding s- or t-value contained by that cell.\r\n * The argument must be in the range [0..2**30].\r\n * i.e. up to one position beyond the normal range of valid leaf cell indices.\r\n */\nvar ijToSTMin = function ijToSTMin(i) {\n return i / MAX_SIZE;\n};\n/**\r\n * Returns the center of this CellID in (u,v)-space.\r\n * Note that the center of the cell is defined as the point at which it is recursively subdivided into four children; in general, it is not at the midpoint of the (u,v) rectangle covered by the cell.\r\n */\nvar centerUV = function centerUV(ci) {\n var _faceSiTi = faceSiTi(ci),\n si = _faceSiTi.si,\n ti = _faceSiTi.ti;\n return new Point(stToUV(siTiToST(si)), stToUV(siTiToST(ti)));\n};\n// boundUV returns the bound of this CellID in (u,v)-space.\nvar boundUV = function boundUV(ci) {\n var _faceIJOrientation2 = faceIJOrientation(ci),\n i = _faceIJOrientation2.i,\n j = _faceIJOrientation2.j;\n return ijLevelToBoundUV(i, j, level(ci));\n};\n/**\r\n * Returns a leaf cell given its cube face (range 0..5) and IJ coordinates.\r\n * @category Constructors\r\n */\nvar fromFaceIJ = function fromFaceIJ(f, i, j) {\n /** Note that this value gets shifted one bit to the left at the end of the function. */\n var n = BigInt(f) << BigInt(POS_BITS - 1);\n /**\r\n * Alternating faces have opposite Hilbert curve orientations; this\r\n * is necessary in order for all faces to have a right-handed\r\n * coordinate system.\r\n */\n var bits = f & SWAP_MASK;\n /**\r\n * Each iteration maps 4 bits of \"i\" and \"j\" into 8 bits of the Hilbert curve position.\r\n * The lookup table transforms a 10-bit key of the form \"iiiijjjjoo\" to a 10-bit value of the form \"ppppppppoo\", where the\r\n * letters [ijpo] denote bits of \"i\", \"j\", Hilbert curve position, and Hilbert curve orientation respectively.\r\n */\n for (var k = 7; k >= 0; k--) {\n var mask = (1 << LOOKUP_BITS) - 1;\n bits += (i >> k * LOOKUP_BITS & mask) << LOOKUP_BITS + 2;\n bits += (j >> k * LOOKUP_BITS & mask) << 2;\n bits = lookupPos[bits];\n n |= BigInt(bits >> 2) << BigInt(k * 2 * LOOKUP_BITS);\n bits &= SWAP_MASK | INVERT_MASK;\n }\n return n * 2n + 1n;\n};\nvar fromFaceIJWrap = function fromFaceIJWrap(f, i, j) {\n // Convert i and j to the coordinates of a leaf cell just beyond the\n // boundary of this face. This prevents 32-bit overflow in the case\n // of finding the neighbors of a face cell.\n i = clampInt(i, -1, MAX_SIZE);\n j = clampInt(j, -1, MAX_SIZE);\n // We want to wrap these coordinates onto the appropriate adjacent face.\n // The easiest way to do this is to convert the (i,j) coordinates to (x,y,z)\n // (which yields a point outside the normal face boundary), and then call\n // xyzToFaceUV to project back onto the correct face.\n //\n // The code below converts (i,j) to (si,ti), and then (si,ti) to (u,v) using\n // the linear projection (u=2*s-1 and v=2*t-1). (The code further below\n // converts back using the inverse projection, s=0.5*(u+1) and t=0.5*(v+1).\n // Any projection would work here, so we use the simplest.) We also clamp\n // the (u,v) coordinates so that the point is barely outside the\n // [-1,1]x[-1,1] face rectangle, since otherwise the reprojection step\n // (which divides by the new z coordinate) might change the other\n // coordinates enough so that we end up in the wrong leaf cell.\n var scale = 1.0 / MAX_SIZE;\n var limit = nextAfter(1, 2);\n var u = Math.max(-limit, Math.min(limit, scale * (Number(BigInt(i) << 1n) + 1 - MAX_SIZE)));\n var v = Math.max(-limit, Math.min(limit, scale * (Number(BigInt(j) << 1n) + 1 - MAX_SIZE)));\n var _xyzToFaceUV2 = xyzToFaceUV(faceUVToXYZ(f, u, v));\n f = _xyzToFaceUV2[0];\n u = _xyzToFaceUV2[1];\n v = _xyzToFaceUV2[2];\n return fromFaceIJ(f, stToIJ(0.5 * (u + 1)), stToIJ(0.5 * (v + 1)));\n};\n/**\r\n * @category Constructors\r\n */\nvar fromFaceIJSame = function fromFaceIJSame(f, i, j, sameFace) {\n if (sameFace) return fromFaceIJ(f, i, j);\n return fromFaceIJWrap(f, i, j);\n};\n/**\r\n * Uses the global lookupIJ table to unfiddle the bits of ci.\r\n */\nvar faceIJOrientation = function faceIJOrientation(ci) {\n var f = face$1(ci);\n var orientation = f & SWAP_MASK;\n var nbits = MAX_LEVEL - 7 * LOOKUP_BITS; // first iteration\n var i = 0;\n var j = 0;\n // Each iteration maps 8 bits of the Hilbert curve position into\n // 4 bits of \"i\" and \"j\". The lookup table transforms a key of the\n // form \"ppppppppoo\" to a value of the form \"iiiijjjjoo\", where the\n // letters [ijpo] represents bits of \"i\", \"j\", the Hilbert curve\n // position, and the Hilbert curve orientation respectively.\n //\n // On the first iteration we need to be careful to clear out the bits\n // representing the cube face.\n for (var k = 7; k >= 0; k--) {\n orientation += Number((ci >> BigInt(k * 2 * LOOKUP_BITS + 1) & (1n << BigInt(2 * nbits)) - 1n) << 2n);\n orientation = lookupIJ[orientation];\n i += orientation >> LOOKUP_BITS + 2 << k * LOOKUP_BITS;\n j += (orientation >> 2 & (1 << LOOKUP_BITS) - 1) << k * LOOKUP_BITS;\n orientation &= SWAP_MASK | INVERT_MASK;\n nbits = LOOKUP_BITS; // following iterations\n }\n // The position of a non-leaf cell at level \"n\" consists of a prefix of\n // 2*n bits that identifies the cell, followed by a suffix of\n // 2*(MAX_LEVEL-n)+1 bits of the form 10*. If n==MAX_LEVEL, the suffix is\n // just \"1\" and has no effect. Otherwise, it consists of \"10\", followed\n // by (MAX_LEVEL-n-1) repetitions of \"00\", followed by \"0\". The \"10\" has\n // no effect, while each occurrence of \"00\" has the effect of reversing\n // the SWAP_MASK bit.\n if ((lsb(ci) & BigInt('0x1111111111111110')) != 0n) orientation ^= SWAP_MASK;\n return {\n f: f,\n i: i,\n j: j,\n orientation: orientation\n };\n};\n/**\r\n * Returns the Face/Si/Ti coordinates of the center of the cell.\r\n */\nvar faceSiTi = function faceSiTi(ci) {\n var _faceIJOrientation3 = faceIJOrientation(ci),\n face = _faceIJOrientation3.f,\n i = _faceIJOrientation3.i,\n j = _faceIJOrientation3.j;\n var delta = 0;\n if (isLeaf(ci)) delta = 1;else if (((BigInt(i) ^ ci >> 2n) & 1n) != 0n) delta = 2;\n return {\n face: face,\n si: 2 * i + delta,\n ti: 2 * j + delta\n };\n};\n/**\r\n * Returns the bounds in (u,v)-space for the cell at the given\r\n * level containing the leaf cell with the given (i,j)-coordinates.\r\n */\nvar ijLevelToBoundUV = function ijLevelToBoundUV(i, j, level) {\n var cellSize = sizeIJ(level);\n var xLo = i & -cellSize;\n var yLo = j & -cellSize;\n return new Rect(new Interval(stToUV(ijToSTMin(xLo)), stToUV(ijToSTMin(xLo + cellSize))), new Interval(stToUV(ijToSTMin(yLo)), stToUV(ijToSTMin(yLo + cellSize))));\n};\n/**\r\n * Returns the number of steps along the Hilbert curve that this cell is from the first node\r\n * in the S2 hierarchy at our level. (i.e., FromFace(0).ChildBeginAtLevel(ci.Level())).\r\n * This is analogous to Pos(), but for this cell's level.\r\n * The return value is always non-negative.\r\n */\nvar distanceFromBegin = function distanceFromBegin(ci) {\n return ci >> 2n * BigInt(MAX_LEVEL - level(ci)) + 1n;\n};\n/**\r\n * Returns an unnormalized r3 vector from the origin through the center\r\n * of the s2 cell on the sphere.\r\n */\nvar rawPoint = function rawPoint(ci) {\n var _faceSiTi2 = faceSiTi(ci),\n face = _faceSiTi2.face,\n si = _faceSiTi2.si,\n ti = _faceSiTi2.ti;\n return faceSiTiToXYZ(face, si, ti);\n};\n/**\r\n * Returns the center of the s2 cell on the sphere as a Point.\r\n * The maximum directional error in Point (compared to the exact\r\n * mathematical result) is 1.5 * dblEpsilon radians, and the maximum length\r\n * error is 2 * dblEpsilon (the same as Normalize).\r\n */\nvar point = function point(ci) {\n return Point$1.fromVector(rawPoint(ci).normalize());\n};\n/**\r\n * Returns the center of the s2 cell on the sphere as a LatLng.\r\n */\nvar latLng = function latLng(ci) {\n return LatLng.fromPoint(Point$1.fromVector(rawPoint(ci)));\n};\n/**\r\n * Returns the four cells that are adjacent across the cell's four edges.\r\n * Edges 0, 1, 2, 3 are in the down, right, up, left directions in the face space.\r\n * All neighbors are guaranteed to be distinct.\r\n */\nvar edgeNeighbors = function edgeNeighbors(ci) {\n var lvl = level(ci);\n var size = sizeIJ(lvl);\n var _faceIJOrientation4 = faceIJOrientation(ci),\n f = _faceIJOrientation4.f,\n i = _faceIJOrientation4.i,\n j = _faceIJOrientation4.j;\n return [parent(fromFaceIJWrap(f, i, j - size), lvl), parent(fromFaceIJWrap(f, i + size, j), lvl), parent(fromFaceIJWrap(f, i, j + size), lvl), parent(fromFaceIJWrap(f, i - size, j), lvl)];\n};\n/**\r\n * Returns the neighboring cellIDs with vertex closest to this cell at the given level.\r\n * (Normally there are four neighbors, but the closest vertex may only have three neighbors if it is one of\r\n * the 8 cube vertices.)\r\n */\nvar vertexNeighbors = function vertexNeighbors(ci, level) {\n var halfSize = sizeIJ(level + 1);\n var size = halfSize << 1;\n var _faceIJOrientation5 = faceIJOrientation(ci),\n f = _faceIJOrientation5.f,\n i = _faceIJOrientation5.i,\n j = _faceIJOrientation5.j;\n var isame = false;\n var jsame = false;\n var ioffset = 0;\n var joffset = 0;\n if ((i & halfSize) != 0) {\n ioffset = size;\n isame = i + size < MAX_SIZE;\n } else {\n ioffset = -size;\n isame = i - size >= 0;\n }\n if ((j & halfSize) != 0) {\n joffset = size;\n jsame = j + size < MAX_SIZE;\n } else {\n joffset = -size;\n jsame = j - size >= 0;\n }\n var results = [parent(ci, level), parent(fromFaceIJSame(f, i + ioffset, j, isame), level), parent(fromFaceIJSame(f, i, j + joffset, jsame), level)];\n if (isame || jsame) {\n results.push(parent(fromFaceIJSame(f, i + ioffset, j + joffset, isame && jsame), level));\n }\n return results;\n};\n/**\r\n * Returns the first child in a traversal of the children of this cell, in Hilbert curve order.\r\n *\r\n * \tfor (let ci = c.childBegin(); ci != c.childEnd(); ci = ci.next()) {\r\n * \t ...\r\n * \t}\r\n */\nvar childBegin = function childBegin(ci) {\n var ol = lsb(ci);\n return ci - ol + (ol >> 2n);\n};\n/**\r\n * Returns the first cell in a traversal of children a given level deeper than this cell, in\r\n * Hilbert curve order. The given level must be no smaller than the cell's level.\r\n * See ChildBegin for example use.\r\n */\nvar childBeginAtLevel = function childBeginAtLevel(ci, level) {\n return ci - lsb(ci) + lsbForLevel(level);\n};\n/**\r\n * Returns the first cell after a traversal of the children of this cell in Hilbert curve order.\r\n * The returned cell may be invalid.\r\n */\nvar childEnd = function childEnd(ci) {\n var ol = lsb(ci);\n return ci + ol + (ol >> 2n);\n};\n/**\r\n * Returns the first cell after the last child in a traversal of children a given level deeper\r\n * than this cell, in Hilbert curve order.\r\n * The given level must be no smaller than the cell's level.\r\n * The returned cell may be invalid.\r\n */\nvar childEndAtLevel = function childEndAtLevel(ci, level) {\n return ci + lsb(ci) + lsbForLevel(level);\n};\n/**\r\n * Returns the next cell along the Hilbert curve.\r\n * This is expected to be used with ChildBegin and ChildEnd,\r\n * or ChildBeginAtLevel and ChildEndAtLevel.\r\n */\nvar next = function next(ci) {\n return ci + (lsb(ci) << 1n) & SentinelCellID;\n};\n/** Returns the previous cell along the Hilbert curve. */\nvar prev = function prev(ci) {\n return ci - (lsb(ci) << 1n) & SentinelCellID;\n};\n/**\r\n * Returns the next cell along the Hilbert curve, wrapping from last to\r\n * first as necessary. This should not be used with ChildBegin and ChildEnd.\r\n */\nvar nextWrap = function nextWrap(ci) {\n var n = next(ci);\n if (n < WRAP_OFFSET) return n;\n return n - WRAP_OFFSET & SentinelCellID;\n};\n/**\r\n * Returns the previous cell along the Hilbert curve, wrapping around from\r\n * first to last as necessary. This should not be used with ChildBegin and ChildEnd.\r\n */\nvar prevWrap = function prevWrap(ci) {\n var p = prev(ci);\n if (p < WRAP_OFFSET) return p;\n return p + WRAP_OFFSET & SentinelCellID;\n};\n/**\r\n * Advances or retreats the indicated number of steps along the\r\n * Hilbert curve at the current level and returns the new position. The\r\n * position wraps between the first and last faces as necessary.\r\n */\nvar advanceWrap = function advanceWrap(ci, steps) {\n if (steps === 0n) return ci;\n // We clamp the number of steps if necessary to ensure that we do not\n // advance past the End() or before the Begin() of this level.\n var shift = BigInt(2 * (MAX_LEVEL - level(ci)) + 1);\n if (steps < 0n) {\n var min = -(ci >> shift);\n if (steps < min) {\n var wrap = WRAP_OFFSET >> shift;\n steps %= wrap;\n if (steps < min) {\n steps += wrap;\n }\n }\n } else {\n // Unlike Advance(), we don't want to return End(level).\n var max = WRAP_OFFSET - ci >> shift;\n if (steps > max) {\n var _wrap = WRAP_OFFSET >> shift;\n steps %= _wrap;\n if (steps > max) {\n steps -= _wrap;\n }\n }\n }\n // If steps is negative, then shifting it left has undefined behavior.\n // Cast to uint64 for a 2's complement answer.\n return ci + (steps << abs$1(shift));\n};\n/**\r\n * Returns the level of the common ancestor of the two S2 CellIDs.\r\n */\nvar commonAncestorLevel = function commonAncestorLevel(ci, other) {\n var bits = ci ^ other;\n if (bits < lsb(ci)) bits = lsb(ci);\n if (bits < lsb(other)) bits = lsb(other);\n var msbPos = findMSBSetNonZero64(bits);\n if (msbPos > 60) return [0, false];\n return [60 - msbPos >> 1, true];\n};\n/**\r\n * Returns the largest cell with the same RangeMin such that\r\n * RangeMax < limit.RangeMin. It returns limit if no such cell exists.\r\n * This method can be used to generate a small set of CellIDs that covers\r\n * a given range (a tiling). This example shows how to generate a tiling\r\n * for a semi-open range of leaf cells [start, limit):\r\n *\r\n * for id = start.maxTile(limit); id !== limit; id = id.next().maxTile(limit)) { ... }\r\n *\r\n * Note that in general the cells in the tiling will be of different sizes;\r\n * they gradually get larger (near the middle of the range) and then\r\n * gradually get smaller as limit is approached.\r\n */\nvar maxTile = function maxTile(ci, limit) {\n var start = rangeMin(ci);\n if (start >= rangeMin(limit)) return limit;\n if (rangeMax(ci) >= limit) {\n // The cell is too large, shrink it. Note that when generating coverings\n // of CellID ranges, this loop usually executes only once. Also because\n // ci.RangeMin() < limit.RangeMin(), we will always exit the loop by the\n // time we reach a leaf cell.\n while (true) {\n ci = children(ci)[0];\n if (rangeMax(ci) < limit) break;\n }\n return ci;\n }\n // The cell may be too small. Grow it if necessary.\n while (!isFace(ci)) {\n var _parent = immediateParent(ci);\n if (rangeMin(_parent) !== start || rangeMax(_parent) >= limit) break;\n ci = _parent;\n }\n return ci;\n};\n/**\r\n * Advances or retreats the indicated number of steps along the\r\n * Hilbert curve at the current level, and returns the new position. The\r\n * position is never advanced past End() or before Begin().\r\n */\nvar advance = function advance(ci, steps) {\n if (steps === 0n) return ci;\n // We clamp the number of steps if necessary to ensure that we do not\n // advance past the End() or before the Begin() of this level.\n var stepShift = BigInt(2 * (MAX_LEVEL - level(ci)) + 1);\n if (steps < 0n) {\n var minSteps = -(ci >> stepShift);\n if (steps < minSteps) {\n steps = minSteps;\n }\n } else {\n var maxSteps = WRAP_OFFSET + lsb(ci) - ci >> stepShift;\n if (steps > maxSteps) {\n steps = maxSteps;\n }\n }\n return ci + (steps << stepShift);\n};\n/**\r\n * Sorts CellIDs ascending\r\n */\nvar ascending = function ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n};\n/**\r\n * Sorts CellIDs descending\r\n */\nvar descending = function descending(a, b) {\n return a > b ? -1 : a < b ? 1 : 0;\n};\n\nvar cellid = {\n __proto__: null,\n SentinelCellID: SentinelCellID,\n face: face$1,\n pos: pos,\n level: level,\n parent: parent,\n immediateParent: immediateParent,\n isFace: isFace,\n valid: valid,\n isLeaf: isLeaf,\n childPosition: childPosition,\n lsb: lsb,\n lsbForLevel: lsbForLevel,\n children: children,\n allNeighbors: allNeighbors,\n rangeMin: rangeMin,\n rangeMax: rangeMax,\n contains: contains,\n intersects: intersects,\n toToken: toToken,\n fromToken: fromToken,\n toString: toString$1,\n fromString: fromString,\n fromFacePosLevel: fromFacePosLevel,\n fromFace: fromFace,\n fromPoint: fromPoint,\n fromLatLng: fromLatLng,\n stToIJ: stToIJ,\n sizeIJ: sizeIJ,\n sizeST: sizeST,\n ijToSTMin: ijToSTMin,\n centerUV: centerUV,\n boundUV: boundUV,\n fromFaceIJ: fromFaceIJ,\n fromFaceIJWrap: fromFaceIJWrap,\n fromFaceIJSame: fromFaceIJSame,\n faceIJOrientation: faceIJOrientation,\n faceSiTi: faceSiTi,\n ijLevelToBoundUV: ijLevelToBoundUV,\n distanceFromBegin: distanceFromBegin,\n rawPoint: rawPoint,\n point: point,\n latLng: latLng,\n edgeNeighbors: edgeNeighbors,\n vertexNeighbors: vertexNeighbors,\n childBegin: childBegin,\n childBeginAtLevel: childBeginAtLevel,\n childEnd: childEnd,\n childEndAtLevel: childEndAtLevel,\n next: next,\n prev: prev,\n nextWrap: nextWrap,\n prevWrap: prevWrap,\n advanceWrap: advanceWrap,\n commonAncestorLevel: commonAncestorLevel,\n maxTile: maxTile,\n advance: advance,\n ascending: ascending,\n descending: descending\n};\n\n/**\r\n * EdgeCrosser allows edges to be efficiently tested for intersection with a\r\n * given fixed edge AB. It is especially efficient when testing for\r\n * intersection with an edge chain connecting vertices v0, v1, v2, ...\r\n *\r\n * Example usage:\r\n *\r\n * ```\r\n * function countIntersections(a: Point, b: Point, edges: Edge[]): number {\r\n * let count = 0;\r\n * const crosser = newEdgeCrosser(a, b);\r\n * for (const edge of edges) {\r\n * if (crosser.crossingSign(edge.first, edge.second) !== DO_NOT_CROSS) {\r\n * count++;\r\n * }\r\n * }\r\n * return count;\r\n * }\r\n * ```\r\n */\nvar EdgeCrosser = /*#__PURE__*/function () {\n /**\r\n * Returns an EdgeCrosser with the fixed edge AB.\r\n *\r\n * @category Constructors\r\n */\n function EdgeCrosser(a, b) {\n var norm = a.pointCross(b);\n this.a = a;\n this.b = b;\n this.aXb = Point$1.fromVector(a.vector.cross(b.vector));\n this.aTangent = Point$1.fromVector(a.vector.cross(norm.vector));\n this.bTangent = Point$1.fromVector(norm.vector.cross(b.vector));\n this.c = new Point$1(0, 0, 0);\n this.acb = CROSS;\n }\n /**\r\n * A convenience constructor that uses AB as the fixed edge,\r\n * and C as the first vertex of the vertex chain (equivalent to calling restartAt(c)).\r\n *\r\n * You don't need to use this or any of the chain functions unless you're trying to\r\n * squeeze out every last drop of performance. Essentially all you are saving is a test\r\n * whether the first vertex of the current edge is the same as the second vertex of the\r\n * previous edge.\r\n *\r\n * @category Constructors\r\n */\n EdgeCrosser.newChainEdgeCrosser = function newChainEdgeCrosser(a, b, c) {\n var e = new EdgeCrosser(a, b);\n e.restartAt(c);\n return e;\n }\n /**\r\n * Reports whether the edge AB intersects the edge CD. If any two\r\n * vertices from different edges are the same, returns MAYBE_CROSS. If either edge\r\n * is degenerate (A == B or C == D), returns either DO_NOT_CROSS or MAYBE_CROSS.\r\n *\r\n * Properties of crossingSign:\r\n * (1) crossingSign(b,a,c,d) == crossingSign(a,b,c,d)\r\n * (2) crossingSign(c,d,a,b) == crossingSign(a,b,c,d)\r\n * (3) crossingSign(a,b,c,d) == MAYBE_CROSS if a==c, a==d, b==c, b==d\r\n * (3) crossingSign(a,b,c,d) == DO_NOT_CROSS or MAYBE_CROSS if a==b or c==d\r\n *\r\n * Note that if you want to check an edge against a chain of other edges,\r\n * it is slightly more efficient to use the single-argument version\r\n * chainCrossingSign below.\r\n */;\n var _proto = EdgeCrosser.prototype;\n _proto.crossingSign = function crossingSign(c, d) {\n if (!c.equals(this.c)) this.restartAt(c);\n return this.chainCrossingSign(d);\n }\n /**\r\n * Reports whether if CrossingSign(c, d) > 0, or AB and CD share a vertex and VertexCrossing(a, b, c, d) is true.\r\n *\r\n * This method extends the concept of a \"crossing\" to the case where AB\r\n * and CD have a vertex in common. The two edges may or may not cross,\r\n * according to the rules defined in VertexCrossing above. The rules\r\n * are designed so that point containment tests can be implemented simply\r\n * by counting edge crossings. Similarly, determining whether one edge\r\n * chain crosses another edge chain can be implemented by counting.\r\n */;\n _proto.edgeOrVertexCrossing = function edgeOrVertexCrossing(c, d) {\n if (!c.equals(this.c)) this.restartAt(c);\n return this.edgeOrVertexChainCrossing(d);\n }\n /**\r\n * Sets the current point of the edge crosser to be c.\r\n * Call this method when your chain 'jumps' to a new place.\r\n * The argument must point to a value that persists until the next call.\r\n */;\n _proto.restartAt = function restartAt(c) {\n this.c = c;\n this.acb = -triageSign(this.a, this.b, this.c);\n }\n /**\r\n * Like crossingSign, but uses the last vertex passed to one of\r\n * the crossing methods (or restartAt) as the first vertex of the current edge.\r\n */;\n _proto.chainCrossingSign = function chainCrossingSign(d) {\n // For there to be an edge crossing, the triangles ACB, CBD, BDA, DAC must\n // all be oriented the same way (CW or CCW). We keep the orientation of ACB\n // as part of our state. When each new point D arrives, we compute the\n // orientation of BDA and check whether it matches ACB. This checks whether\n // the points C and D are on opposite sides of the great circle through AB.\n // Recall that triageSign is invariant with respect to rotating its\n // arguments, i.e. ABD has the same orientation as BDA.\n var bda = triageSign(this.a, this.b, d);\n if (this.acb === -bda && bda !== INDETERMINATE) {\n this.c = d;\n this.acb = -bda;\n return DO_NOT_CROSS;\n }\n return this._crossingSign(d, bda);\n }\n /**\r\n * Like EdgeOrVertexCrossing, but uses the last vertex\r\n * passed to one of the crossing methods (or RestartAt) as the first vertex of the current edge.\r\n */;\n _proto.edgeOrVertexChainCrossing = function edgeOrVertexChainCrossing(d) {\n // We need to copy this.c since it is clobbered by ChainCrossingSign.\n var c = Point$1.fromVector(this.c.vector);\n switch (this.chainCrossingSign(d)) {\n case DO_NOT_CROSS:\n return false;\n case CROSS:\n return true;\n }\n return vertexCrossing(this.a, this.b, c, d);\n }\n /**\r\n * Handle the slow path of crossingSign.\r\n */;\n _proto._crossingSign = function _crossingSign(d, bda) {\n var maxError = (1.5 + 1 / Math.sqrt(3)) * DBL_EPSILON$1;\n // At this point, a very common situation is that A,B,C,D are four points on\n // a line such that AB does not overlap CD. (For example, this happens when\n // a line or curve is sampled finely, or when geometry is constructed by\n // computing the union of S2CellIds.) Most of the time, we can determine\n // that AB and CD do not intersect using the two outward-facing\n // tangents at A and B (parallel to AB) and testing whether AB and CD are on\n // opposite sides of the plane perpendicular to one of these tangents. This\n // is moderately expensive but still much cheaper than expensiveSign.\n // The error in RobustCrossProd is insignificant. The maximum error in\n // the call to CrossProd (i.e., the maximum norm of the error vector) is\n // (0.5 + 1/sqrt(3)) * dblEpsilon. The maximum error in each call to\n // DotProd below is dblEpsilon. (There is also a small relative error\n // term that is insignificant because we are comparing the result against a\n // constant that is very close to zero.)\n if (this.c.vector.dot(this.aTangent.vector) > maxError && d.vector.dot(this.aTangent.vector) > maxError || this.c.vector.dot(this.bTangent.vector) > maxError && d.vector.dot(this.bTangent.vector) > maxError) {\n this.c = d;\n this.acb = -bda;\n return DO_NOT_CROSS;\n }\n // Otherwise, eliminate the cases where two vertices from different edges are\n // equal. (These cases could be handled in the code below, but we would rather\n // avoid calling ExpensiveSign if possible.)\n if (this.a.equals(this.c) || this.a.equals(d) || this.b.equals(this.c) || this.b.equals(d)) {\n this.c = d;\n this.acb = -bda;\n return MAYBE_CROSS;\n }\n // Eliminate the cases where an input edge is degenerate. (Note that in\n // most cases, if CD is degenerate then this method is not even called\n // because acb and bda have different signs.)\n if (this.a.equals(this.b) || this.c.equals(d)) {\n this.c = d;\n this.acb = -bda;\n return DO_NOT_CROSS;\n }\n // Otherwise it's time to break out the big guns.\n if (this.acb === INDETERMINATE) this.acb = -expensiveSign(this.a, this.b, this.c);\n if (bda === INDETERMINATE) bda = expensiveSign(this.a, this.b, d);\n if (bda !== this.acb) {\n this.c = d;\n this.acb = -bda;\n return DO_NOT_CROSS;\n }\n var cbd = -robustSign(this.c, d, this.b);\n if (cbd !== this.acb) {\n this.c = d;\n this.acb = -bda;\n return DO_NOT_CROSS;\n }\n var dac = robustSign(this.c, d, this.a);\n if (dac !== this.acb) {\n this.c = d;\n this.acb = -bda;\n return DO_NOT_CROSS;\n }\n this.c = d;\n this.acb = -bda;\n return CROSS;\n };\n return EdgeCrosser;\n}();\n\nvar CROSS = 0;\nvar MAYBE_CROSS = 1;\nvar DO_NOT_CROSS = 2;\n/**\r\n * Reports whether the edge AB intersects the edge CD.\r\n * If AB crosses CD at a point that is interior to both edges, Cross is returned.\r\n * If any two vertices from different edges are the same it returns MAYBE_CROSS.\r\n * Otherwise it returns DO_NOT_CROSS.\r\n * If either edge is degenerate (A == B or C == D), the return value is MAYBE_CROSS\r\n * if two vertices from different edges are the same and DO_NOT_CROSS otherwise.\r\n *\r\n * Properties of crossingSign:\r\n * (1) crossingSign(b,a,c,d) == crossingSign(a,b,c,d)\r\n * (2) crossingSign(c,d,a,b) == crossingSign(a,b,c,d)\r\n * (3) crossingSign(a,b,c,d) == MAYBE_CROSS if a==c, a==d, b==c, b==d\r\n * (3) crossingSign(a,b,c,d) == DO_NOT_CROSS or MAYBE_CROSS if a==b or c==d\r\n *\r\n * This method implements an exact, consistent perturbation model such\r\n * that no three points are ever considered to be collinear. This means\r\n * that even if you have 4 points A, B, C, D that lie exactly in a line\r\n * (say, around the equator), C and D will be treated as being slightly to\r\n * one side or the other of AB. This is done in a way such that the\r\n * results are always consistent (see RobustSign).\r\n */\nvar crossingSign = function crossingSign(a, b, c, d) {\n var crosser = EdgeCrosser.newChainEdgeCrosser(a, b, c);\n return crosser.chainCrossingSign(d);\n};\n/**\r\n * Reports whether two edges \"cross\" in such a way that point-in-polygon\r\n * containment tests can be implemented by counting the number of edge crossings.\r\n *\r\n * Given two edges AB and CD where at least two vertices are identical\r\n * (i.e. CrossingSign(a,b,c,d) == 0), the basic rule is that a \"crossing\"\r\n * occurs if AB is encountered after CD during a CCW sweep around the shared\r\n * vertex starting from a fixed reference point.\r\n *\r\n * Note that according to this rule, if AB crosses CD then in general CD\r\n * does not cross AB. However, this leads to the correct result when\r\n * counting polygon edge crossings. For example, suppose that A,B,C are\r\n * three consecutive vertices of a CCW polygon. If we now consider the edge\r\n * crossings of a segment BP as P sweeps around B, the crossing number\r\n * changes parity exactly when BP crosses BA or BC.\r\n *\r\n * Useful properties of VertexCrossing (VC):\r\n * (1) VC(a,a,c,d) == VC(a,b,c,c) == false\r\n * (2) VC(a,b,a,b) == VC(a,b,b,a) == true\r\n * (3) VC(a,b,c,d) == VC(a,b,d,c) == VC(b,a,c,d) == VC(b,a,d,c)\r\n * (3) If exactly one of a,b equals one of c,d, then exactly one of\r\n * VC(a,b,c,d) and VC(c,d,a,b) is true\r\n *\r\n * It is an error to call this method with 4 distinct vertices.\r\n */\nvar vertexCrossing = function vertexCrossing(a, b, c, d) {\n if (a.equals(b) || c.equals(d)) return false;\n switch (true) {\n case a.equals(c):\n return b.equals(d) || Point$1.orderedCCW(a.referenceDir(), d, b, a);\n case b.equals(d):\n return Point$1.orderedCCW(b.referenceDir(), c, a, b);\n case a.equals(d):\n return b.equals(c) || Point$1.orderedCCW(a.referenceDir(), c, b, a);\n case b.equals(c):\n return Point$1.orderedCCW(b.referenceDir(), d, a, b);\n }\n return false;\n};\n/**\r\n * Reports if the angle ABC contains its vertex B.\r\n * Containment is defined such that if several polygons tile the region around\r\n * a vertex, then exactly one of those polygons contains that vertex.\r\n * Returns false for degenerate angles of the form ABA.\r\n *\r\n * Note that this method is not sufficient to determine vertex containment in\r\n * polygons with duplicate vertices (such as the polygon ABCADE). Use\r\n * ContainsVertexQuery for such polygons. AngleContainsVertex(a, b, c)\r\n * is equivalent to using ContainsVertexQuery as follows:\r\n *\r\n * ```\r\n * ContainsVertexQuery query(b);\r\n * query.AddEdge(a, -1); // incoming\r\n * query.AddEdge(c, 1); // outgoing\r\n * return query.ContainsVertex() > 0;\r\n * ```\r\n *\r\n * Useful properties of AngleContainsVertex:\r\n * (1) AngleContainsVertex(a,b,a) == false\r\n * (2) AngleContainsVertex(a,b,c) == !AngleContainsVertex(c,b,a) unless a == c\r\n * (3) Given vertices v_1 ... v_k ordered cyclically CCW around vertex b,\r\n * AngleContainsVertex(v_{i+1}, b, v_i) is true for exactly one value of i.\r\n *\r\n * REQUIRES: a != b && b != c\r\n */\nvar angleContainsVertex = function angleContainsVertex(a, b, c) {\n return !Point$1.orderedCCW(b.referenceDir(), c, a, b);\n};\n\n/**\r\n * Represents a closed latitude-longitude rectangle.\r\n *\r\n * @beta incomplete\r\n */\nvar Rect$1 = /*#__PURE__*/function () {\n /**\r\n * Returns a new Rect.\r\n * @category Constructors\r\n */\n function Rect(lat, lng) {\n this.lat = lat;\n this.lng = lng;\n }\n /**\r\n * Returns the empty rectangle.\r\n * @category Constructors\r\n */\n Rect.emptyRect = function emptyRect() {\n return new Rect(Interval.empty(), Interval$1.emptyInterval());\n }\n /**\r\n * Returns the full rectangle.\r\n * @category Constructors\r\n */;\n Rect.fullRect = function fullRect() {\n return new Rect(Rect.validRectLatRange, Rect.validRectLngRange);\n }\n /**\r\n * Constructs a rectangle containing a single point p.\r\n * @category Constructors\r\n */;\n Rect.fromLatLng = function fromLatLng(p) {\n return new Rect(new Interval(radians(p.lat), radians(p.lat)), new Interval$1(radians(p.lng), radians(p.lng)));\n }\n /**\r\n * Constructs a rectangle with the given size and center.\r\n * @category Constructors\r\n */;\n Rect.fromCenterSize = function fromCenterSize(center, size) {\n var half = new LatLng(size.lat / 2, size.lng / 2);\n return Rect.fromLatLng(center).expanded(half);\n }\n /**\r\n * Reports whether this rect equals another rect.\r\n */;\n var _proto = Rect.prototype;\n _proto.equals = function equals(or) {\n return this.lat.equals(or.lat) && this.lng.equals(or.lng);\n }\n /**\r\n * Returns true if the rectangle is valid.\r\n */;\n _proto.isValid = function isValid() {\n return Math.abs(this.lat.lo) <= Math.PI / 2 && Math.abs(this.lat.hi) <= Math.PI / 2 && this.lng.isValid() && this.lat.isEmpty() === this.lng.isEmpty();\n }\n /**\r\n * Reports whether the rectangle is empty.\r\n */;\n _proto.isEmpty = function isEmpty() {\n return this.lat.isEmpty();\n }\n /**\r\n * Reports whether the rectangle is full.\r\n */;\n _proto.isFull = function isFull() {\n return this.lat.equals(Rect.validRectLatRange) && this.lng.isFull();\n }\n /**\r\n * Reports whether the rectangle is a single point.\r\n */;\n _proto.isPoint = function isPoint() {\n return this.lat.lo === this.lat.hi && this.lng.lo === this.lng.hi;\n }\n /**\r\n * Returns the i-th vertex of the rectangle (i = 0,1,2,3) in CCW order.\r\n */;\n _proto.vertex = function vertex(i) {\n var lat, lng;\n switch (i) {\n case 0:\n lat = this.lat.lo;\n lng = this.lng.lo;\n break;\n case 1:\n lat = this.lat.lo;\n lng = this.lng.hi;\n break;\n case 2:\n lat = this.lat.hi;\n lng = this.lng.hi;\n break;\n default:\n // case 4\n lat = this.lat.hi;\n lng = this.lng.lo;\n break;\n }\n return new LatLng(lat, lng);\n }\n /**\r\n * Returns one corner of the rectangle.\r\n */;\n _proto.lo = function lo() {\n return new LatLng(this.lat.lo, this.lng.lo);\n }\n /**\r\n * Returns the other corner of the rectangle.\r\n */;\n _proto.hi = function hi() {\n return new LatLng(this.lat.hi, this.lng.hi);\n }\n /**\r\n * Returns the center of the rectangle.\r\n */;\n _proto.center = function center() {\n return new LatLng(this.lat.center(), this.lng.center());\n }\n /**\r\n * Returns the size of the Rect.\r\n */;\n _proto.size = function size() {\n return new LatLng(this.lat.length(), this.lng.length());\n }\n /**\r\n * Returns the surface area of the Rect.\r\n */;\n _proto.area = function area() {\n if (this.isEmpty()) return 0;\n var capDiff = Math.abs(Math.sin(this.lat.hi) - Math.sin(this.lat.lo));\n return this.lng.length() * capDiff;\n }\n /**\r\n * Increases the size of the rectangle to include the given point.\r\n */;\n _proto.addPoint = function addPoint(ll) {\n if (!ll.isValid()) return this;\n return new Rect(this.lat.addPoint(radians(ll.lat)), this.lng.addPoint(radians(ll.lng)));\n }\n /**\r\n * Returns a rectangle that has been expanded by margin.lat on each side in the latitude direction,\r\n * and by margin.lng on each side in the longitude direction.\r\n */;\n _proto.expanded = function expanded(margin) {\n var lat = this.lat.expanded(radians(margin.lat));\n var lng = this.lng.expanded(radians(margin.lng));\n if (lat.isEmpty() || lng.isEmpty()) return Rect.emptyRect();\n return new Rect(lat.intersection(Rect.validRectLatRange), lng);\n };\n _proto.toString = function toString() {\n return \"[Lo\" + this.lo() + \", Hi\" + this.hi() + \"]\";\n }\n /**\r\n * Returns the rectangle unmodified if it does not include either pole.\r\n * If it includes either pole, returns an expansion of the rectangle along the longitudinal range.\r\n */;\n _proto.polarClosure = function polarClosure() {\n if (this.lat.lo === -Math.PI / 2 || this.lat.hi === Math.PI / 2) {\n return new Rect(this.lat, Interval$1.fullInterval());\n }\n return this;\n }\n /**\r\n * Returns the smallest Rect containing the union of this rectangle and the given rectangle.\r\n */;\n _proto.union = function union(other) {\n return new Rect(this.lat.union(other.lat), this.lng.union(other.lng));\n }\n /**\r\n * Returns the smallest rectangle containing the intersection of this rectangle and the given rectangle.\r\n */;\n _proto.intersection = function intersection(other) {\n var lat = this.lat.intersection(other.lat);\n var lng = this.lng.intersection(other.lng);\n if (lat.isEmpty() || lng.isEmpty()) return Rect.emptyRect();\n return new Rect(lat, lng);\n }\n /**\r\n * Reports whether this rectangle and the other have any points in common.\r\n */;\n _proto.intersects = function intersects(other) {\n return this.lat.intersects(other.lat) && this.lng.intersects(other.lng);\n }\n /**\r\n * Returns a cap that contains the Rect.\r\n */;\n _proto.capBound = function capBound() {\n if (this.isEmpty()) return Cap.emptyCap();\n var poleZ, poleAngle;\n if (this.lat.hi + this.lat.lo < 0) {\n poleZ = -1;\n poleAngle = Math.PI / 2 + this.lat.hi;\n } else {\n poleZ = 1;\n poleAngle = Math.PI / 2 - this.lat.lo;\n }\n var poleCap = Cap.fromCenterAngle(new Point$1(0, 0, poleZ), poleAngle);\n if (remainder(this.lng.hi - this.lng.lo, 2 * Math.PI) >= 0 && this.lng.hi - this.lng.lo < 2 * Math.PI) {\n var midCap = Cap.fromPoint(Point$1.fromLatLng(this.center())).addPoint(Point$1.fromLatLng(this.lo())).addPoint(Point$1.fromLatLng(this.hi()));\n if (midCap.height() < poleCap.height()) return midCap;\n }\n return poleCap;\n }\n /**\r\n * Returns itself.\r\n */;\n _proto.rectBound = function rectBound() {\n return this;\n }\n /**\r\n * Reports whether this Rect contains the other Rect.\r\n */;\n _proto.contains = function contains(other) {\n return this.lat.containsInterval(other.lat) && this.lng.containsInterval(other.lng);\n }\n /**\r\n * Reports whether the given Cell is contained by this Rect.\r\n */;\n _proto.containsCell = function containsCell(c) {\n return this.contains(c.rectBound());\n }\n /**\r\n * Reports whether the given LatLng is within the Rect.\r\n */;\n _proto.containsLatLng = function containsLatLng(ll) {\n if (!ll.isValid()) return false;\n return this.lat.contains(radians(ll.lat)) && this.lng.contains(radians(ll.lng));\n }\n /**\r\n * Reports whether the given Point is within the Rect.\r\n */;\n _proto.containsPoint = function containsPoint(p) {\n return this.containsLatLng(LatLng.fromPoint(p));\n }\n /**\r\n * Computes a covering of the Rect.\r\n */;\n _proto.cellUnionBound = function cellUnionBound() {\n return this.capBound().cellUnionBound();\n }\n /**\r\n * Reports whether the latitude and longitude intervals of the two rectangles are the same up to a small tolerance.\r\n */;\n _proto.approxEqual = function approxEqual(other) {\n return this.lat.approxEqual(other.lat) && this.lng.approxEqual(other.lng);\n }\n /**\r\n * Returns the intersection of longitude 0 with the bisector of an edge on longitude 'lng' and spanning latitude range 'lat'.\r\n */;\n Rect.bisectorIntersection = function bisectorIntersection(lat, lng) {\n lng = Math.abs(lng);\n var latCenter = lat.center();\n var orthoBisector = new LatLng(latCenter - Math.PI / 2, lng);\n if (latCenter < 0) orthoBisector = new LatLng(-latCenter - Math.PI / 2, lng - Math.PI);\n var orthoLng = new Point$1(0, -1, 0);\n return orthoLng.pointCross(Point$1.fromLatLng(orthoBisector));\n }\n /**\r\n * Centroid returns the true centroid of the given Rect multiplied by its\r\n * surface area. The result is not unit length, so you may want to normalize it.\r\n * Note that in general the centroid is *not* at the center of the rectangle, and\r\n * in fact it may not even be contained by the rectangle. (It is the \"center of\r\n * mass\" of the rectangle viewed as subset of the unit sphere, i.e. it is the\r\n * point in space about which this curved shape would rotate.)\r\n *\r\n * The reason for multiplying the result by the rectangle area is to make it\r\n * easier to compute the centroid of more complicated shapes. The centroid\r\n * of a union of disjoint regions can be computed simply by adding their\r\n * Centroid results.\r\n */;\n _proto.centroid = function centroid() {\n // When a sphere is divided into slices of constant thickness by a set\n // of parallel planes, all slices have the same surface area. This\n // implies that the z-component of the centroid is simply the midpoint\n // of the z-interval spanned by the Rect.\n //\n // Similarly, it is easy to see that the (x,y) of the centroid lies in\n // the plane through the midpoint of the rectangle's longitude interval.\n // We only need to determine the distance \"d\" of this point from the\n // z-axis.\n //\n // Let's restrict our attention to a particular z-value. In this\n // z-plane, the Rect is a circular arc. The centroid of this arc\n // lies on a radial line through the midpoint of the arc, and at a\n // distance from the z-axis of\n //\n // r * (sin(alpha) / alpha)\n //\n // where r = sqrt(1-z^2) is the radius of the arc, and \"alpha\" is half\n // of the arc length (i.e., the arc covers longitudes [-alpha, alpha]).\n //\n // To find the centroid distance from the z-axis for the entire\n // rectangle, we just need to integrate over the z-interval. This gives\n //\n // d = Integrate[sqrt(1-z^2)*sin(alpha)/alpha, z1..z2] / (z2 - z1)\n //\n // where [z1, z2] is the range of z-values covered by the rectangle.\n // This simplifies to\n //\n // d = sin(alpha)/(2*alpha*(z2-z1))*(z2*r2 - z1*r1 + theta2 - theta1)\n //\n // where [theta1, theta2] is the latitude interval, z1=sin(theta1),\n // z2=sin(theta2), r1=cos(theta1), and r2=cos(theta2).\n //\n // Finally, we want to return not the centroid itself, but the centroid\n // scaled by the area of the rectangle. The area of the rectangle is\n //\n // A = 2 * alpha * (z2 - z1)\n //\n // which fortunately appears in the denominator of \"d\".\n if (this.isEmpty()) return new Point$1(0, 0, 0);\n var z1 = Math.sin(this.lat.lo);\n var z2 = Math.sin(this.lat.hi);\n var r1 = Math.cos(this.lat.lo);\n var r2 = Math.cos(this.lat.hi);\n var alpha = 0.5 * this.lng.length();\n var r0 = Math.sin(alpha) * (r2 * z2 - r1 * z1 + this.lat.length());\n var lng = this.lng.center();\n var z = alpha * (z2 + z1) * (z2 - z1); // scaled by the area\n return new Point$1(r0 * Math.cos(lng), r0 * Math.sin(lng), z);\n }\n /**\r\n * Reports whether this rectangle intersects the given cell. This is an exact test and may be fairly expensive.\r\n */;\n _proto.intersectsCell = function intersectsCell(c) {\n // First we eliminate the cases where one region completely contains the other.\n // Once these are disposed of, then the regions will intersect if and only if their boundaries intersect.\n if (this.isEmpty()) return false;\n if (this.containsPoint(Point$1.fromVector(rawPoint(c.id)))) return true;\n if (c.containsPoint(Point$1.fromLatLng(this.center()))) return true;\n // Quick rejection test (not required for correctness).\n if (!this.intersects(c.rectBound())) return false;\n // Precompute the cell vertices as points and latitude-longitudes.\n // We also check whether the Cell contains any corner of the rectangle, or vice-versa,\n // since the edge-crossing tests only check the edge interiors.\n var vertices = [];\n var latlngs = [];\n for (var i = 0; i < 4; i++) {\n var vertex = c.vertex(i);\n vertices.push(vertex);\n var latlng = LatLng.fromPoint(vertex);\n latlngs.push(latlng);\n if (this.containsLatLng(latlng)) return true;\n if (c.containsPoint(Point$1.fromLatLng(this.vertex(i)))) return true;\n }\n // Now check whether the boundaries intersect.\n // Unfortunately, a latitude-longitude rectangle does not have straight edges:\n // two edges are curved, and at least one of them is concave.\n for (var _i = 0; _i < 4; _i++) {\n var edgeLng = Interval$1.fromEndpoints(latlngs[_i].lng, latlngs[_i + 1 & 3].lng);\n if (!this.lng.intersects(edgeLng)) continue;\n var a = vertices[_i];\n var b = vertices[_i + 1 & 3];\n if (edgeLng.contains(this.lng.lo) && intersectsLngEdge(a, b, this.lat, this.lng.lo)) {\n return true;\n }\n if (edgeLng.contains(this.lng.hi) && intersectsLngEdge(a, b, this.lat, this.lng.hi)) {\n return true;\n }\n if (intersectsLatEdge(a, b, this.lat.lo, this.lng)) {\n return true;\n }\n if (intersectsLatEdge(a, b, this.lat.hi, this.lng)) {\n return true;\n }\n }\n return false;\n };\n return Rect;\n}();\nRect$1.validRectLatRange = /*#__PURE__*/new Interval(-Math.PI / 2, Math.PI / 2);\nRect$1.validRectLngRange = /*#__PURE__*/Interval$1.fullInterval();\n/**\r\n * Reports whether the edge AB intersects the given edge of constant latitude.\r\n * Requires the points to have unit length.\r\n */\nvar intersectsLatEdge = function intersectsLatEdge(a, b, lat, lng) {\n // Unfortunately, lines of constant latitude are curves on the sphere.\n // They can intersect a straight edge in 0, 1, or 2 points.\n // First, compute the normal to the plane AB that points vaguely north.\n var z = a.vector.cross(b.vector).normalize();\n if (z.z < 0) z = z.mul(-1);\n // Extend this to an orthonormal frame (x,y,z) where x is the direction\n // where the great circle through AB achieves its maximum latitude.\n var y = z.cross(Point$1.fromCoords(0, 0, 1).vector).normalize();\n var x = y.cross(z);\n // Compute the angle \"theta\" from the x-axis (in the x-y plane defined\n // above) where the great circle intersects the given line of latitude.\n var sinLat = Math.sin(radians(lat));\n if (Math.abs(sinLat) >= x.z) {\n // The great circle does not reach the given latitude.\n return false;\n }\n var cosTheta = sinLat / x.z;\n var sinTheta = Math.sqrt(1 - cosTheta * cosTheta);\n var theta = Math.atan2(sinTheta, cosTheta);\n // The candidate intersection points are located +/- theta in the x-y plane.\n // For an intersection to be valid, we need to check that the intersection\n // point is contained in the interior of the edge AB and also that it is\n // contained within the given longitude interval \"lng\".\n // Compute the range of theta values spanned by the edge AB.\n var abTheta = Interval$1.fromPointPair(Math.atan2(a.vector.dot(y), a.vector.dot(x)), Math.atan2(b.vector.dot(y), b.vector.dot(x)));\n if (abTheta.contains(theta)) {\n // Check if the intersection point is also in the given lng interval.\n var isect = x.mul(cosTheta).add(y.mul(sinTheta));\n if (lng.contains(Math.atan2(isect.y, isect.x))) {\n return true;\n }\n }\n if (abTheta.contains(-theta)) {\n // Check if the other intersection point is also in the given lng interval.\n var _isect = x.mul(cosTheta).sub(y.mul(sinTheta));\n if (lng.contains(Math.atan2(_isect.y, _isect.x))) {\n return true;\n }\n }\n return false;\n};\n/**\r\n * Reports whether the edge AB intersects the given edge of constant longitude.\r\n * Requires the points to have unit length.\r\n */\nvar intersectsLngEdge = function intersectsLngEdge(a, b, lat, lng) {\n // The nice thing about edges of constant longitude is that they are straight lines on the sphere (geodesics).\n return crossingSign(a, b, Point$1.fromLatLng(new LatLng(lat.lo, lng)), Point$1.fromLatLng(new LatLng(lat.hi, lng))) === CROSS;\n};\n\n/**\r\n * This file implements functions for various S2 measurements.\r\n */\n/**\r\n * A Metric is a measure for cells. It is used to describe the shape and size\r\n * of cells. They are useful for deciding which cell level to use in order to\r\n * satisfy a given condition (e.g. that cell vertices must be no further than\r\n * \"x\" apart). You can use the Value(level) method to compute the corresponding\r\n * length or area on the unit sphere for cells at a given level. The minimum\r\n * and maximum bounds are valid for cells at all levels, but they may be\r\n * somewhat conservative for very large cells (e.g. face cells).\r\n */\nvar Metric = /*#__PURE__*/function () {\n /**\r\n * Returns a new Metric.\r\n * @category Constructors\r\n */\n function Metric(dim, deriv) {\n this.dim = dim;\n this.deriv = deriv;\n }\n /**\r\n * Returns the value of the metric at the given level.\r\n */\n var _proto = Metric.prototype;\n _proto.value = function value(level) {\n return ldexp(this.deriv, -this.dim * level);\n }\n /**\r\n * Returns the minimum level such that the metric is at most the given value, or MaxLevel (30) if there is no such level.\r\n *\r\n * For example, MinLevel(0.1) returns the minimum level such that all cell diagonal lengths are 0.1 or smaller.\r\n * The returned value is always a valid level.\r\n */;\n _proto.minLevel = function minLevel(val) {\n if (val <= 0) return MAX_LEVEL; // missinglink <0 to <=0\n var level = -(ilogb(val / this.deriv) >> this.dim - 1);\n if (level > MAX_LEVEL) level = MAX_LEVEL;\n if (level < 0) level = 0;\n return level || 0;\n }\n /**\r\n * Returns the maximum level such that the metric is at least the given value, or zero if there is no such level.\r\n *\r\n * For example, MaxLevel(0.1) returns the maximum level such that all cells have a minimum width of 0.1 or larger.\r\n * The returned value is always a valid level.\r\n */;\n _proto.maxLevel = function maxLevel(val) {\n if (val <= 0) return MAX_LEVEL;\n var level = ilogb(this.deriv / val) >> this.dim - 1;\n if (level > MAX_LEVEL) level = MAX_LEVEL;\n if (level < 0) level = 0;\n return level || 0;\n }\n /**\r\n * Returns the level at which the metric has approximately the given value.\r\n * The return value is always a valid level.\r\n * For example, AvgEdgeMetric.ClosestLevel(0.1) returns the level at which the average cell edge length is approximately 0.1.\r\n */;\n _proto.closestLevel = function closestLevel(val) {\n var x = Math.SQRT2;\n if (this.dim === 2) x = 2;\n return this.minLevel(x * val);\n };\n return Metric;\n}();\n\n/**\r\n * The width of geometric figure is defined as the distance between two\r\n * parallel bounding lines in a given direction. For cells, the minimum\r\n * width is always attained between two opposite edges, and the maximum\r\n * width is attained between two opposite vertices. However, for our\r\n * purposes we redefine the width of a cell as the perpendicular distance\r\n * between a pair of opposite edges. A cell therefore has two widths, one\r\n * in each direction. The minimum width according to this definition agrees\r\n * with the classic geometric one, but the maximum width is different. (The\r\n * maximum geometric width corresponds to MaxDiag defined below.)\r\n *\r\n * The average width in both directions for all cells at level k is approximately\r\n * AvgWidthMetric.Value(k).\r\n *\r\n * The width is useful for bounding the minimum or maximum distance from a\r\n * point on one edge of a cell to the closest point on the opposite edge.\r\n * For example, this is useful when growing regions by a fixed distance.\r\n */\nvar MinWidthMetric = /*#__PURE__*/new Metric(1, 2 * Math.SQRT2 / 3);\nvar AvgEdgeMetric = /*#__PURE__*/new Metric(1, 1.459213746386106062);\nvar AvgAreaMetric = /*#__PURE__*/new Metric(2, 4 * Math.PI / 6);\n\n/**\r\n * Returns the distance of point X from line segment AB.\r\n * The points are expected to be normalized. The result is very accurate for small\r\n * distances but may have some numerical error if the distance is large\r\n * (approximately pi/2 or greater). The case A == B is handled correctly.\r\n */\nvar distanceFromSegment = function distanceFromSegment(x, a, b) {\n return angle$1(_updateMinDistance(x, a, b, 0, true).dist);\n};\n/**\r\n * Checks if the distance from X to the edge AB is less\r\n * than minDist, and if so, returns the updated value and true.\r\n * The case A == B is handled correctly.\r\n *\r\n * Use this method when you want to compute many distances and keep track of\r\n * the minimum. It is significantly faster than using distanceFromSegment\r\n * because (1) using ChordAngle is much faster than Angle, and (2) it\r\n * can save a lot of work by not actually computing the distance when it is\r\n * obviously larger than the current minimum.\r\n */\nvar updateMinDistance = function updateMinDistance(x, a, b, minDist) {\n return _updateMinDistance(x, a, b, minDist, false);\n};\n/**\r\n * Checks if the distance from X to the edge AB is greater\r\n * than maxDist, and if so, returns the updated value and true.\r\n * Otherwise it returns false. The case A == B is handled correctly.\r\n */\nvar updateMaxDistance = function updateMaxDistance(x, a, b, maxDist) {\n var dist = maxChordAngle(Point$1.chordAngleBetweenPoints(x, a), Point$1.chordAngleBetweenPoints(x, b));\n if (dist > RIGHT_CHORDANGLE) {\n var _updateMinDistance2 = _updateMinDistance(Point$1.fromVector(x.vector.mul(-1)), a, b, dist, true);\n dist = _updateMinDistance2.dist;\n dist = STRAIGHT_CHORDANGLE - dist;\n }\n if (maxDist < dist) return {\n dist: dist,\n less: true\n };\n return {\n dist: maxDist,\n less: false\n };\n};\n/**\r\n * Returns the point along the edge AB that is closest to the point X.\r\n * The fractional distance of this point along the edge AB can be obtained\r\n * using distanceFraction.\r\n *\r\n * This requires that all points are unit length.\r\n */\nvar project = function project(x, a, b) {\n var aXb = a.pointCross(b);\n // Find the closest point to X along the great circle through AB.\n var v = x.vector.sub(aXb.vector.mul(x.vector.dot(aXb.vector) / aXb.vector.norm2()));\n // If this point is on the edge AB, then it's the closest point.\n if (sign(aXb, a, Point$1.fromVector(v)) && sign(Point$1.fromVector(v), b, aXb)) return Point$1.fromVector(v.normalize());\n // Otherwise, the closest point is either A or B.\n if (x.vector.sub(a.vector).norm2() <= x.vector.sub(b.vector).norm2()) return a;\n return b;\n};\n/**\r\n * Returns the point X along the line segment AB whose\r\n * distance from A is the angle ax.\r\n */\nvar interpolateAtDistance = function interpolateAtDistance(ax, a, b) {\n var aRad = ax;\n // Use PointCross to compute the tangent vector at A towards B. The\n // result is always perpendicular to A, even if A=B or A=-B, but it is not\n // necessarily unit length. (We effectively normalize it below.)\n var normal = a.pointCross(b);\n var tangent = normal.vector.cross(a.vector);\n // Now compute the appropriate linear combination of A and \"tangent\". With\n // infinite precision the result would always be unit length, but we\n // normalize it anyway to ensure that the error is within acceptable bounds.\n // (Otherwise errors can build up when the result of one interpolation is\n // fed into another interpolation.)\n return Point$1.fromVector(a.vector.mul(Math.cos(aRad)).add(tangent.mul(Math.sin(aRad) / tangent.norm())).normalize());\n};\n/**\r\n * Returns the maximum error in the result of\r\n * updateMinDistance (and the associated functions such as\r\n * updateMinInteriorDistance, isDistanceLess, etc), assuming that all\r\n * input points are normalized to within the bounds guaranteed by r3.Vector's\r\n * normalize. The error can be added or subtracted from an ChordAngle\r\n * using its expanded method.\r\n */\nvar minUpdateDistanceMaxError = function minUpdateDistanceMaxError(dist) {\n // There are two cases for the maximum error in updateMinDistance(),\n // depending on whether the closest point is interior to the edge.\n return Math.max(minUpdateInteriorDistanceMaxError(dist), maxPointError(dist));\n};\n/**\r\n * Returns the maximum error in the result of\r\n * updateMinInteriorDistance, assuming that all input points are normalized\r\n * to within the bounds guaranteed by Point's normalize. The error can be added\r\n * or subtracted from an ChordAngle using its expanded method.\r\n *\r\n * Note that accuracy goes down as the distance approaches 0 degrees or 180\r\n * degrees (for different reasons). Near 0 degrees the error is acceptable\r\n * for all practical purposes (about 1.2e-15 radians ~= 8 nanometers). For\r\n * exactly antipodal points the maximum error is quite high (0.5 meters),\r\n * but this error drops rapidly as the points move away from antipodality\r\n * (approximately 1 millimeter for points that are 50 meters from antipodal,\r\n * and 1 micrometer for points that are 50km from antipodal).\r\n *\r\n\n * TODO: Currently the error bound does not hold for edges whose endpoints\r\n * are antipodal to within about 1e-15 radians (less than 1 micron). This could\r\n * be fixed by extending PointCross to use higher precision when necessary.\r\n */\nvar minUpdateInteriorDistanceMaxError = function minUpdateInteriorDistanceMaxError(dist) {\n // If a point is more than 90 degrees from an edge, then the minimum\n // distance is always to one of the endpoints, not to the edge interior.\n if (dist >= RIGHT_CHORDANGLE) return 0.0;\n // This bound includes all sources of error, assuming that the input points\n // are normalized. a and b are components of chord length that are\n // perpendicular and parallel to a plane containing the edge respectively.\n var b = Math.min(1.0, 0.5 * dist);\n var a = Math.sqrt(b * (2 - b));\n return ((2.5 + 2 * Math.sqrt(3) + 8.5 * a) * a + (2 + 2 * Math.sqrt(3) / 3 + 6.5 * (1 - b)) * b + (23 + 16 / Math.sqrt(3)) * DBL_EPSILON$1) * DBL_EPSILON$1;\n};\n/**\r\n * Computes the distance from a point X to a line segment AB,\r\n * and if either the distance was less than the given minDist, or alwaysUpdate is\r\n * true, the value and whether it was updated are returned.\r\n */\nvar _updateMinDistance = function _updateMinDistance(x, a, b, minDist, alwaysUpdate) {\n var _interiorDist = interiorDist(x, a, b, minDist, alwaysUpdate),\n d = _interiorDist.dist,\n ok = _interiorDist.less;\n if (ok) {\n // Minimum distance is attained along the edge interior.\n return {\n dist: d,\n less: true\n };\n }\n // Otherwise the minimum distance is to one of the endpoints.\n var xa2 = x.vector.sub(a.vector).norm2();\n var xb2 = x.vector.sub(b.vector).norm2();\n var dist = Math.min(xa2, xb2);\n if (!alwaysUpdate && dist >= minDist) return {\n dist: minDist,\n less: false\n };\n return {\n dist: dist,\n less: true\n };\n};\n/**\r\n * Returns the shortest distance from point x to edge ab, assuming\r\n * that the closest point to X is interior to AB. If the closest point is not\r\n * interior to AB, interiorDist returns (minDist, false). If alwaysUpdate is set to\r\n * false, the distance is only updated when the value exceeds certain the given minDist.\r\n */\nvar interiorDist = function interiorDist(x, a, b, minDist, alwaysUpdate) {\n // Chord distance of x to both end points a and b.\n var xa2 = x.vector.sub(a.vector).norm2();\n var xb2 = x.vector.sub(b.vector).norm2();\n // The closest point on AB could either be one of the two vertices (the\n // vertex case) or in the interior (the interior case). Let C = A x B.\n // If X is in the spherical wedge extending from A to B around the axis\n // through C, then we are in the interior case. Otherwise we are in the\n // vertex case.\n //\n // Check whether we might be in the interior case. For this to be true, XAB\n // and XBA must both be acute angles. Checking this condition exactly is\n // expensive, so instead we consider the planar triangle ABX (which passes\n // through the sphere's interior). The planar angles XAB and XBA are always\n // less than the corresponding spherical angles, so if we are in the\n // interior case then both of these angles must be acute.\n //\n // We check this by computing the squared edge lengths of the planar\n // triangle ABX, and testing whether angles XAB and XBA are both acute using\n // the law of cosines:\n //\n // | XA^2 - XB^2 | < AB^2 (*)\n //\n // This test must be done conservatively (taking numerical errors into\n // account) since otherwise we might miss a situation where the true minimum\n // distance is achieved by a point on the edge interior.\n //\n // There are two sources of error in the expression above (*). The first is\n // that points are not normalized exactly; they are only guaranteed to be\n // within 2 * dblEpsilon of unit length. Under the assumption that the two\n // sides of (*) are nearly equal, the total error due to normalization errors\n // can be shown to be at most\n //\n // 2 * dblEpsilon * (XA^2 + XB^2 + AB^2) + 8 * dblEpsilon ^ 2 .\n //\n // The other source of error is rounding of results in the calculation of (*).\n // Each of XA^2, XB^2, AB^2 has a maximum relative error of 2.5 * dblEpsilon,\n // plus an additional relative error of 0.5 * dblEpsilon in the final\n // subtraction which we further bound as 0.25 * dblEpsilon * (XA^2 + XB^2 +\n // AB^2) for convenience. This yields a final error bound of\n //\n // 4.75 * dblEpsilon * (XA^2 + XB^2 + AB^2) + 8 * dblEpsilon ^ 2 .\n var ab2 = a.vector.sub(b.vector).norm2();\n var maxError = 4.75 * DBL_EPSILON$1 * (xa2 + xb2 + ab2) + 8 * DBL_EPSILON$1 * DBL_EPSILON$1;\n if (Math.abs(xa2 - xb2) >= ab2 + maxError) return {\n dist: minDist,\n less: false\n };\n // The minimum distance might be to a point on the edge interior. Let R\n // be closest point to X that lies on the great circle through AB. Rather\n // than computing the geodesic distance along the surface of the sphere,\n // instead we compute the \"chord length\" through the sphere's interior.\n //\n // The squared chord length XR^2 can be expressed as XQ^2 + QR^2, where Q\n // is the point X projected onto the plane through the great circle AB.\n // The distance XQ^2 can be written as (X.C)^2 / |C|^2 where C = A x B.\n // We ignore the QR^2 term and instead use XQ^2 as a lower bound, since it\n // is faster and the corresponding distance on the Earth's surface is\n // accurate to within 1% for distances up to about 1800km.\n var c = a.pointCross(b);\n var c2 = c.vector.norm2();\n var xDotC = x.vector.dot(c.vector);\n var xDotC2 = xDotC * xDotC;\n if (!alwaysUpdate && xDotC2 > c2 * minDist) {\n // The closest point on the great circle AB is too far away. We need to\n // test this using \">\" rather than \">=\" because the actual minimum bound\n // on the distance is (xDotC2 / c2), which can be rounded differently\n // than the (more efficient) multiplicative test above.\n return {\n dist: minDist,\n less: false\n };\n }\n // Otherwise we do the exact, more expensive test for the interior case.\n // This test is very likely to succeed because of the conservative planar\n // test we did initially.\n //\n // TODO: Ensure that the errors in test are accurately reflected in the\n // minUpdateInteriorDistanceMaxError.\n var cx = c.vector.cross(x.vector);\n if (a.vector.sub(x.vector).dot(cx) >= 0 || b.vector.sub(x.vector).dot(cx) <= 0) {\n return {\n dist: minDist,\n less: false\n };\n }\n // Compute the squared chord length XR^2 = XQ^2 + QR^2 (see above).\n // This calculation has good accuracy for all chord lengths since it\n // is based on both the dot product and cross product (rather than\n // deriving one from the other). However, note that the chord length\n // representation itself loses accuracy as the angle approaches π.\n var qr = 1 - Math.sqrt(cx.norm2() / c2);\n var dist = xDotC2 / c2 + qr * qr;\n if (!alwaysUpdate && dist >= minDist) {\n return {\n dist: minDist,\n less: false\n };\n }\n return {\n dist: dist,\n less: true\n };\n};\n\nvar CENTER_POINT = /*#__PURE__*/Point$1.fromCoords(1.0, 0, 0);\n/**\r\n * Cap represents a disc-shaped region defined by a center and radius.\r\n * Technically this shape is called a \"spherical cap\" (rather than disc)\r\n * because it is not planar; the cap represents a portion of the sphere that\r\n * has been cut off by a plane. The boundary of the cap is the circle defined\r\n * by the intersection of the sphere and the plane. For containment purposes,\r\n * the cap is a closed set, i.e. it contains its boundary.\r\n *\r\n * For the most part, you can use a spherical cap wherever you would use a\r\n * disc in planar geometry. The radius of the cap is measured along the\r\n * surface of the sphere (rather than the straight-line distance through the\r\n * interior). Thus a cap of radius π/2 is a hemisphere, and a cap of radius\r\n * π covers the entire sphere.\r\n *\r\n * The center is a point on the surface of the unit sphere. (Hence the need for\r\n * it to be of unit length.)\r\n *\r\n * A cap can also be defined by its center point and height. The height is the\r\n * distance from the center point to the cutoff plane. There is also support for\r\n * \"empty\" and \"full\" caps, which contain no points and all points respectively.\r\n *\r\n * Here are some useful relationships between the cap height (h), the cap\r\n * radius (r), the maximum chord length from the cap's center (d), and the\r\n * radius of cap's base (a).\r\n *\r\n * h = 1 - Math.cos(r)\r\n * = 2 * Math.sin^2(r/2)\r\n * d^2 = 2 * h\r\n * = a^2 + h^2\r\n *\r\n * The zero value of Cap is an invalid cap. Use emptyCap to get a valid empty cap.\r\n *\r\n * @beta incomplete\r\n */\nvar Cap = /*#__PURE__*/function () {\n /**\r\n * Returns a new Cap.\r\n * @category Constructors\r\n */\n function Cap(center, radius) {\n this.center = center;\n this.rad = radius;\n }\n /**\r\n * Constructs a cap containing a single point.\r\n * @category Constructors\r\n */\n Cap.fromPoint = function fromPoint(p) {\n return Cap.fromCenterChordAngle(p, 0);\n }\n /**\r\n * Constructs a cap with the given center and angle.\r\n * @category Constructors\r\n */;\n Cap.fromCenterAngle = function fromCenterAngle(center, angle) {\n return Cap.fromCenterChordAngle(center, fromAngle(angle));\n }\n /**\r\n * Constructs a cap where the angle is expressed as an ChordAngle.\r\n * This constructor is more efficient than using an Angle.\r\n * @category Constructors\r\n */;\n Cap.fromCenterChordAngle = function fromCenterChordAngle(center, radius) {\n return new Cap(center, radius);\n }\n /**\r\n * Constructs a cap with the given center and height.\r\n * A negative height yields an empty cap; a height of 2 or more yields a full cap.\r\n * The center should be unit length.\r\n * @category Constructors\r\n */;\n Cap.fromCenterHeight = function fromCenterHeight(center, height) {\n return Cap.fromCenterChordAngle(center, fromSquaredLength(2 * height));\n }\n /**\r\n * Constructs a cap with the given center and surface area.\r\n * Note that the area can also be interpreted as the solid angle subtended by the cap (because the sphere has unit radius).\r\n * A negative area yields an empty cap; an area of 4*π or more yields a full cap.\r\n * @category Constructors\r\n */;\n Cap.fromCenterArea = function fromCenterArea(center, area) {\n return Cap.fromCenterChordAngle(center, fromSquaredLength(area / Math.PI));\n }\n /**\r\n * Constructs a copy of cap.\r\n * @category Constructors\r\n */;\n Cap.fromCap = function fromCap(c) {\n return new Cap(Point$1.fromVector(c.center.vector), c.rad);\n }\n /**\r\n * Returns a cap that contains no points.\r\n */;\n Cap.emptyCap = function emptyCap() {\n return Cap.fromCenterChordAngle(CENTER_POINT, NEGATIVE_CHORDANGLE);\n }\n /**\r\n * Returns a cap that contains all points.\r\n */;\n Cap.fullCap = function fullCap() {\n return Cap.fromCenterChordAngle(CENTER_POINT, STRAIGHT_CHORDANGLE);\n }\n /**\r\n * Reports whether the Cap is considered valid.\r\n */;\n var _proto = Cap.prototype;\n _proto.isValid = function isValid() {\n return this.center.vector.isUnit() && this.rad <= STRAIGHT_CHORDANGLE;\n }\n /**\r\n * Reports whether the cap is empty, i.e. it contains no points.\r\n */;\n _proto.isEmpty = function isEmpty() {\n return this.rad < 0;\n }\n /**\r\n * Reports whether the cap is full, i.e. it contains all points.\r\n */;\n _proto.isFull = function isFull() {\n return this.rad == STRAIGHT_CHORDANGLE;\n }\n /**\r\n * Returns the cap's center point.\r\n */;\n _proto.centerPoint = function centerPoint() {\n return this.center;\n }\n /**\r\n * Returns the height of the cap.\r\n * This is the distance from the center point to the cutoff plane.\r\n */;\n _proto.height = function height() {\n return 0.5 * this.rad;\n }\n /**\r\n * Returns the cap radius as an Angle.\r\n * Note that the cap angle is stored internally as a ChordAngle, so this method requires a trigonometric operation and may yield a slightly different result than the value passed to Cap.fromCenterAngle.\r\n */;\n _proto.radius = function radius() {\n return angle$1(this.rad);\n }\n /**\r\n * Returns the surface area of the Cap on the unit sphere.\r\n */;\n _proto.area = function area() {\n return 2.0 * Math.PI * Math.max(0, this.height());\n }\n /**\r\n * Reports whether this cap contains the other.\r\n */;\n _proto.contains = function contains(other) {\n if (this.isFull() || other.isEmpty()) return true;\n return this.rad >= add(Point$1.chordAngleBetweenPoints(this.center, other.center), other.rad);\n }\n /**\r\n * Reports whether this cap intersects the other cap.\r\n */;\n _proto.intersects = function intersects(other) {\n if (this.isEmpty() || other.isEmpty()) return false;\n return add(this.rad, other.rad) >= Point$1.chordAngleBetweenPoints(this.center, other.center);\n }\n /**\r\n * Reports whether this cap's interior intersects the other cap.\r\n */;\n _proto.interiorIntersects = function interiorIntersects(other) {\n if (this.rad <= 0 || other.isEmpty()) return false;\n return add(this.rad, other.rad) > Point$1.chordAngleBetweenPoints(this.center, other.center);\n }\n /**\r\n * Reports whether the cap intersects the cell.\r\n */;\n _proto.intersectsCell = function intersectsCell(cell) {\n // If the cap contains any cell vertex, return true.\n var vertices = [];\n for (var k = 0; k < 4; k++) {\n vertices[k] = cell.vertex(k);\n if (this.containsPoint(vertices[k])) return true;\n }\n return this._intersects(cell, vertices);\n }\n /**\r\n * Reports whether the cap intersects any point of the cell excluding\r\n * its vertices (which are assumed to already have been checked).\r\n */;\n _proto._intersects = function _intersects(cell, vertices) {\n // If the cap is a hemisphere or larger, the cell and the complement of the cap\n // are both convex. Therefore since no vertex of the cell is contained, no other\n // interior point of the cell is contained either.\n if (this.rad >= RIGHT_CHORDANGLE) return false;\n // We need to check for empty caps due to the center check just below.\n if (this.isEmpty()) return false;\n // Optimization: return true if the cell contains the cap center. This allows half\n // of the edge checks below to be skipped.\n if (cell.containsPoint(this.center)) return true;\n // At this point we know that the cell does not contain the cap center, and the cap\n // does not contain any cell vertex. The only way that they can intersect is if the\n // cap intersects the interior of some edge.\n var sin2Angle = sin2(this.rad);\n for (var k = 0; k < 4; k++) {\n var edge = cell.edge(k).vector;\n var dot = this.center.vector.dot(edge);\n if (dot > 0) {\n // The center is in the interior half-space defined by the edge. We do not need\n // to consider these edges, since if the cap intersects this edge then it also\n // intersects the edge on the opposite side of the cell, because the center is\n // not contained with the cell.\n continue;\n }\n // The Norm2() factor is necessary because \"edge\" is not normalized.\n if (dot * dot > sin2Angle * edge.norm2()) return false;\n // Otherwise, the great circle containing this edge intersects the interior of the cap. We just\n // need to check whether the point of closest approach occurs between the two edge endpoints.\n var dir = edge.cross(this.center.vector);\n if (dir.dot(vertices[k].vector) < 0 && dir.dot(vertices[k + 1 & 3].vector) > 0) {\n return true;\n }\n }\n return false;\n }\n /**\r\n * Reports whether this cap contains the point.\r\n */;\n _proto.containsPoint = function containsPoint(p) {\n return Point$1.chordAngleBetweenPoints(this.center, p) <= this.rad;\n }\n /** Reports whether the cap contains the given cell. */;\n _proto.containsCell = function containsCell(cell) {\n // If the cap does not contain all cell vertices, return false.\n var vertices = [];\n for (var k = 0; k < 4; k++) {\n vertices[k] = cell.vertex(k);\n if (!this.containsPoint(vertices[k])) return false;\n }\n // Otherwise, return true if the complement of the cap does not intersect the cell.\n return !this.complement()._intersects(cell, vertices);\n }\n /**\r\n * Reports whether the point is within the interior of this cap.\r\n */;\n _proto.interiorContainsPoint = function interiorContainsPoint(p) {\n return this.isFull() || Point$1.chordAngleBetweenPoints(this.center, p) < this.rad;\n }\n /**\r\n * Returns the complement of the interior of the cap. A cap and its complement have the same boundary but do not share any interior points. The complement operator is not a bijection because the complement of a singleton cap (containing a single point) is the same as the complement of an empty cap.\r\n * @returns {Cap}\r\n */;\n _proto.complement = function complement() {\n if (this.isFull()) return Cap.emptyCap();\n if (this.isEmpty()) return Cap.fullCap();\n return Cap.fromCenterChordAngle(Point$1.fromVector(this.center.vector.mul(-1)), sub(STRAIGHT_CHORDANGLE, this.rad));\n }\n /**\r\n * Returns a bounding spherical cap. This is not guaranteed to be exact.\r\n */;\n _proto.capBound = function capBound() {\n return this;\n }\n /**\r\n * Returns a bounding latitude-longitude rectangle. The bounds are not guaranteed to be tight.\r\n */;\n _proto.rectBound = function rectBound() {\n if (this.isEmpty()) return Rect$1.emptyRect();\n var capAngle = this.radius();\n var allLongitudes = false;\n var lat = new Interval(LatLng.latitude(this.center) - capAngle, LatLng.latitude(this.center) + capAngle);\n var lng = Interval$1.fullInterval();\n // Check whether cap includes the south pole.\n if (lat.lo <= -Math.PI / 2) {\n lat.lo = -Math.PI / 2;\n allLongitudes = true;\n }\n // Check whether cap includes the north pole.\n if (lat.hi >= Math.PI / 2) {\n lat.hi = Math.PI / 2;\n allLongitudes = true;\n }\n if (!allLongitudes) {\n // Compute the range of longitudes covered by the cap. We use the law\n // of sines for spherical triangles. Consider the triangle ABC where\n // A is the north pole, B is the center of the cap, and C is the point\n // of tangency between the cap boundary and a line of longitude. Then\n // C is a right angle, and letting a,b,c denote the sides opposite A,B,C,\n // we have sin(a)/sin(A) = sin(c)/sin(C), or sin(A) = sin(a)/sin(c).\n // Here \"a\" is the cap angle, and \"c\" is the colatitude (90 degrees\n // minus the latitude). This formula also works for negative latitudes.\n //\n // The formula for sin(a) follows from the relationship h = 1 - cos(a).\n var sinA = sin(this.rad);\n var sinC = Math.cos(LatLng.latitude(this.center));\n if (sinA <= sinC) {\n var angleA = Math.asin(sinA / sinC);\n lng.lo = remainder(LatLng.longitude(this.center) - angleA, Math.PI * 2);\n lng.hi = remainder(LatLng.longitude(this.center) + angleA, Math.PI * 2);\n }\n }\n return new Rect$1(lat, lng);\n }\n /**\r\n * Reports whether this cap is equal to the other cap.\r\n */;\n _proto.equals = function equals(other) {\n return this.rad === other.rad && this.center.equals(other.center) || this.isEmpty() && other.isEmpty() || this.isFull() && other.isFull();\n }\n /**\r\n * Reports whether this cap is equal to the other cap within the given tolerance.\r\n */;\n _proto.approxEqual = function approxEqual(other) {\n var epsilon = 1e-14;\n var r2 = this.rad;\n var otherR2 = other.rad;\n return this.center.approxEqual(other.center) && Math.abs(r2 - otherR2) <= epsilon || this.isEmpty() && otherR2 <= epsilon || other.isEmpty() && r2 <= epsilon || this.isFull() && otherR2 >= 2 - epsilon || other.isFull() && r2 >= 2 - epsilon;\n }\n /**\r\n * Increases the cap if necessary to include the given point.\r\n * If this cap is empty, then the center is set to the point with a zero height\r\n * p must be unit-length.\r\n */;\n _proto.addPoint = function addPoint(p) {\n if (this.isEmpty()) return new Cap(p, 0);\n // After calling cap.AddPoint(p), cap.Contains(p) must be true. However\n // we don't need to do anything special to achieve this because Contains()\n // does exactly the same distance calculation that we do here.\n var newRad = Point$1.chordAngleBetweenPoints(this.center, p);\n if (newRad > this.rad) this.rad = newRad;\n return this;\n }\n /**\r\n * Increases the cap height if necessary to include the other cap. If this cap is empty, it is set to the other cap.\r\n */;\n _proto.addCap = function addCap(other) {\n if (this.isEmpty()) return other;\n if (other.isEmpty()) return this;\n // We round up the distance to ensure that the cap is actually contained.\n var dist = add(Point$1.chordAngleBetweenPoints(this.center, other.center), other.rad);\n var newRad = expanded(dist, DBL_EPSILON$1 * dist);\n if (newRad > this.rad) this.rad = newRad;\n return this;\n }\n /**\r\n * Returns a new cap expanded by the given angle. If the cap is empty, it returns an empty cap.\r\n */;\n _proto.expanded = function expanded(distance) {\n if (this.isEmpty()) return Cap.emptyCap();\n return Cap.fromCenterChordAngle(this.center, add(this.rad, fromAngle(distance)));\n };\n _proto.toString = function toString() {\n return \"[Center=\" + this.center.vector + \", Radius=\" + degrees(this.radius()) + \"]\";\n }\n /**\r\n * Converts an Angle into the height of the cap.\r\n */;\n Cap.radiusToHeight = function radiusToHeight(r) {\n if (r < 0) return NEGATIVE_CHORDANGLE;\n if (r >= Math.PI) return RIGHT_CHORDANGLE;\n return 0.5 * fromAngle(r);\n }\n /**\r\n * Computes a covering of the Cap.\r\n * In general the covering consists of at most 4 cells except for very large caps, which may need up to 6 cells.\r\n * The output is not sorted.\r\n */;\n _proto.cellUnionBound = function cellUnionBound() {\n // TODO(roberts): The covering could be made quite a bit tighter by mapping\n // the cap to a rectangle in (i,j)-space and finding a covering for that.\n // Find the maximum level such that the cap contains at most one cell vertex\n // and such that CellID.AppendVertexNeighbors() can be called.\n var level = MinWidthMetric.maxLevel(this.radius()) - 1;\n // If level < 0, more than three face cells are required.\n if (level < 0) {\n var cellIDs = [];\n for (var face = 0; face < 6; face++) {\n cellIDs[face] = fromFace(face);\n }\n return cellIDs;\n }\n // The covering consists of the 4 cells at the given level that share the\n // cell vertex that is closest to the cap center.\n return vertexNeighbors(fromPoint(this.center), level);\n }\n /**\r\n * Returns the true centroid of the cap multiplied by its surface area.\r\n * The result lies on the ray from the origin through the cap's center, but it is not unit length.\r\n * Note that if you just want the \"surface centroid\", i.e. the normalized result, then it is simpler to call CENTER_POINT.\r\n *\r\n * The reason for multiplying the result by the cap area is to make it easier to compute the centroid of more complicated shapes.\r\n * The centroid of a union of disjoint regions can be computed simply by adding their centroid results.\r\n * Caveat: for caps that contain a single point (i.e., zero radius), this method always returns the origin (0, 0, 0).\r\n * This is because shapes with no area don't affect the centroid of a union whose total area is positive.\r\n */;\n _proto.centroid = function centroid() {\n if (this.isEmpty()) return new Point$1(0, 0, 0);\n var r = 1 - 0.5 * this.height();\n return Point$1.fromVector(this.center.vector.mul(r * this.area()));\n }\n /**\r\n * Returns the smallest cap which encloses this cap and another cap.\r\n */;\n _proto.union = function union(oc) {\n var c = this;\n // If the other cap is larger, swap c and other for the rest of the computations.\n if (c.rad < oc.rad) {\n var _ref = [oc, c];\n c = _ref[0];\n oc = _ref[1];\n }\n if (c.isFull() || oc.isEmpty()) return c;\n var cRadius = c.radius();\n var otherRadius = oc.radius();\n var distance = c.center.distance(oc.center);\n if (cRadius >= distance + otherRadius) return c;\n var resRadius = 0.5 * (distance + cRadius + otherRadius);\n var resCenter = interpolateAtDistance(0.5 * (distance - cRadius + otherRadius), c.center, oc.center);\n return Cap.fromCenterAngle(resCenter, resRadius);\n };\n return Cap;\n}();\n\n/**\r\n * Returns the area of triangle ABC. This method combines two different\r\n * algorithms to get accurate results for both large and small triangles.\r\n * The maximum error is about 5e-15 (about 0.25 square meters on the Earth's\r\n * surface), the same as GirardArea below, but unlike that method it is\r\n * also accurate for small triangles. Example: when the true area is 100\r\n * square meters, PointArea yields an error about 1 trillion times smaller than\r\n * GirardArea.\r\n *\r\n * All points should be unit length, and no two points should be antipodal.\r\n * The area is always positive.\r\n */\nvar pointArea = function pointArea(a, b, c) {\n var sa = b.stableAngle(c);\n var sb = c.stableAngle(a);\n var sc = a.stableAngle(b);\n var s = 0.5 * (sa + sb + sc);\n if (s >= 3e-4) {\n var dmin = s - Math.max(sa, sb, sc);\n if (dmin < 1e-2 * s * s * s * s * s) {\n var area = girardArea(a, b, c);\n if (dmin < s * 0.1 * (area + 5e-15)) return area;\n }\n }\n return 4 * Math.atan(Math.sqrt(Math.max(0.0, Math.tan(0.5 * s) * Math.tan(0.5 * (s - sa)) * Math.tan(0.5 * (s - sb)) * Math.tan(0.5 * (s - sc)))));\n};\n/**\r\n * Returns the area of the triangle computed using Girard's formula.\r\n * All points should be unit length, and no two points should be antipodal.\r\n *\r\n * This method is about twice as fast as PointArea() but has poor relative\r\n * accuracy for small triangles. The maximum error is about 5e-15 (about\r\n * 0.25 square meters on the Earth's surface) and the average error is about\r\n * 1e-15. These bounds apply to triangles of any size, even as the maximum\r\n * edge length of the triangle approaches 180 degrees. But note that for\r\n * such triangles, tiny perturbations of the input points can change the\r\n * true mathematical area dramatically.\r\n */\nvar girardArea = function girardArea(a, b, c) {\n var ab = a.pointCross(b);\n var bc = b.pointCross(c);\n var ac = a.pointCross(c);\n var area = ab.vector.angle(ac.vector) - ab.vector.angle(bc.vector) + bc.vector.angle(ac.vector);\n if (area < 0) area = 0;\n return area;\n};\n/**\r\n * Returns a positive value for counterclockwise triangles and a negative\r\n * value otherwise (similar to PointArea).\r\n */\nvar signedArea = function signedArea(a, b, c) {\n return robustSign(a, b, c) * pointArea(a, b, c);\n};\n/**\r\n * Returns the exterior angle at vertex B in the triangle ABC. The\r\n * return value is positive if ABC is counterclockwise and negative otherwise.\r\n * If you imagine an ant walking from A to B to C, this is the angle that the\r\n * ant turns at vertex B (positive = left = CCW, negative = right = CW).\r\n * This quantity is also known as the \"geodesic curvature\" at B.\r\n *\r\n * Ensures that TurnAngle(a,b,c) == -TurnAngle(c,b,a) for all distinct\r\n * a,b,c. The result is undefined if (a == b || b == c), but is either\r\n * -Pi or Pi if (a == c). All points should be normalized.\r\n */\nvar turnAngle = function turnAngle(a, b, c) {\n var angle = a.pointCross(b).vector.angle(b.pointCross(c).vector);\n return robustSign(a, b, c) === COUNTERCLOCKWISE ? angle : -angle;\n};\n\nvar POLE_MIN_LAT = /*#__PURE__*/Math.asin(/*#__PURE__*/Math.sqrt(1.0 / 3)) - 0.5 * DBL_EPSILON$1;\n/**\r\n * Cell is an S2 region object that represents a cell.\r\n * Unlike CellIDs, it supports efficient containment and intersection tests.\r\n * However, it is also a more expensive representation.\r\n */\nvar Cell = /*#__PURE__*/function () {\n /**\r\n * Returns a new Cell.\r\n * @category Constructors\r\n */\n function Cell(face, level, orientation, id, uv) {\n this.face = face;\n this.level = level;\n this.orientation = orientation;\n this.id = id;\n this.uv = uv;\n }\n /**\r\n * Constructs a Cell corresponding to the given CellID.\r\n * @category Constructors\r\n */\n Cell.fromCellID = function fromCellID(id) {\n var _cellid$faceIJOrienta = faceIJOrientation(id),\n f = _cellid$faceIJOrienta.f,\n i = _cellid$faceIJOrienta.i,\n j = _cellid$faceIJOrienta.j,\n orientation = _cellid$faceIJOrienta.orientation;\n var level$1 = level(id);\n return new Cell(f, level$1, orientation, id, ijLevelToBoundUV(i, j, level$1));\n }\n /**\r\n * Constructs a cell for the given Point.\r\n * @category Constructors\r\n */;\n Cell.fromPoint = function fromPoint$1(p) {\n return Cell.fromCellID(fromPoint(p));\n }\n /**\r\n * Constructs a cell for the given LatLng.\r\n * @category Constructors\r\n */;\n Cell.fromLatLng = function fromLatLng$1(ll) {\n return Cell.fromCellID(fromLatLng(ll));\n }\n /**\r\n * Returns the face opposite the given face.\r\n */;\n Cell.oppositeFace = function oppositeFace(face) {\n return (face + 3) % 6;\n }\n /**\r\n * Returns whether this Cell is a leaf or not.\r\n */;\n var _proto = Cell.prototype;\n _proto.isLeaf = function isLeaf() {\n return this.level === MAX_LEVEL;\n }\n /**\r\n * Returns the edge length of this cell in (i,j)-space.\r\n */;\n _proto.sizeIJ = function sizeIJ$1() {\n return sizeIJ(this.level);\n }\n /**\r\n * Returns the edge length of this cell in (s,t)-space.\r\n */;\n _proto.sizeST = function sizeST$1() {\n return sizeST(this.level);\n }\n /**\r\n * Returns the k-th vertex of the cell (k = 0,1,2,3) in CCW order\r\n * (lower left, lower right, upper right, upper left in the UV plane).\r\n */;\n _proto.vertex = function vertex(k) {\n var vertex = this.uv.vertices()[k];\n return Point$1.fromVector(faceUVToXYZ(this.face, vertex.x, vertex.y).normalize());\n }\n /**\r\n * Returns the inward-facing normal of the great circle passing through\r\n * the CCW ordered edge from vertex k to vertex k+1 (mod 4) (for k = 0,1,2,3).\r\n */;\n _proto.edge = function edge(k) {\n switch (k) {\n case 0:\n return Point$1.fromVector(vNorm(this.face, this.uv.y.lo).normalize());\n // Bottom\n case 1:\n return Point$1.fromVector(uNorm(this.face, this.uv.x.hi).normalize());\n // Right\n case 2:\n return Point$1.fromVector(vNorm(this.face, this.uv.y.hi).mul(-1.0).normalize());\n // Top\n default:\n return Point$1.fromVector(uNorm(this.face, this.uv.x.lo).mul(-1.0).normalize());\n // Left\n }\n }\n /**\r\n * Returns the bounds of this cell in (u,v)-space.\r\n */;\n _proto.boundUV = function boundUV() {\n return this.uv;\n }\n /**\r\n * Returns the direction vector corresponding to the center in\r\n * (s,t)-space of the given cell. This is the point at which the cell is\r\n * divided into four subcells; it is not necessarily the centroid of the\r\n * cell in (u,v)-space or (x,y,z)-space\r\n */;\n _proto.center = function center() {\n return Point$1.fromVector(rawPoint(this.id).normalize());\n }\n /**\r\n * Returns the four direct children of this cell in traversal order\r\n * and returns true. If this is a leaf cell, or the children could not be created,\r\n * false is returned.\r\n * The C++ method is called Subdivide.\r\n */;\n _proto.children = function children() {\n var children = [];\n if (isLeaf(this.id)) return children;\n // Compute the cell midpoint in uv-space.\n var uvMid = centerUV(this.id);\n // Create four children with the appropriate bounds.\n var cid = childBegin(this.id);\n for (var pos = 0; pos < 4; pos++) {\n var child = new Cell(this.face, this.level + 1, this.orientation ^ posToOrientation[pos], cid, Rect.empty());\n // We want to split the cell in half in u and v. To decide which\n // side to set equal to the midpoint value, we look at cell's (i,j)\n // position within its parent. The index for i is in bit 1 of ij.\n var ij = posToIJ[this.orientation][pos];\n var i = ij >> 1;\n var j = ij & 1;\n if (i === 1) {\n child.uv.x.hi = this.uv.x.hi;\n child.uv.x.lo = uvMid.x;\n } else {\n child.uv.x.lo = this.uv.x.lo;\n child.uv.x.hi = uvMid.x;\n }\n if (j === 1) {\n child.uv.y.hi = this.uv.y.hi;\n child.uv.y.lo = uvMid.y;\n } else {\n child.uv.y.lo = this.uv.y.lo;\n child.uv.y.hi = uvMid.y;\n }\n cid = next(cid);\n children.push(child);\n }\n return children;\n }\n /**\r\n * Returns the area of this cell as accurately as possible.\r\n */;\n _proto.exactArea = function exactArea() {\n var v0 = this.vertex(0);\n var v1 = this.vertex(1);\n var v2 = this.vertex(2);\n var v3 = this.vertex(3);\n return pointArea(v0, v1, v2) + pointArea(v0, v2, v3);\n }\n /**\r\n * Returns the approximate area of this cell. This method is accurate\r\n * to within 3% percent for all cell sizes and accurate to within 0.1% for cells\r\n * at level 5 or higher (i.e. squares 350km to a side or smaller on the Earth's\r\n * surface). It is moderately cheap to compute.\r\n */;\n _proto.approxArea = function approxArea() {\n if (this.level < 2) return this.averageArea();\n // Compute the approximate area of the cell when projected perpendicular to its normal.\n var flatArea = 0.5 * this.vertex(2).vector.sub(this.vertex(0).vector).cross(this.vertex(3).vector.sub(this.vertex(1).vector)).norm();\n // Compensate for the curvature of the cell surface by pretending\n // that the cell is shaped like a spherical cap.\n return flatArea * 2 / (1 + Math.sqrt(1 - Math.min(1 / Math.PI * flatArea, 1)));\n }\n /**\r\n * Returns the average area of cells at the level of this cell.\r\n * This is accurate to within a factor of 1.7.\r\n */;\n _proto.averageArea = function averageArea() {\n return AvgAreaMetric.value(this.level);\n }\n /**\r\n * Reports whether the intersection of this cell and the other cell is not nil.\r\n */;\n _proto.intersectsCell = function intersectsCell(oc) {\n return intersects(this.id, oc.id);\n }\n /**\r\n * Reports whether this cell contains the other cell.\r\n */;\n _proto.containsCell = function containsCell(oc) {\n return contains(this.id, oc.id);\n }\n /**\r\n * Computes a covering of the Cell.\r\n */;\n _proto.cellUnionBound = function cellUnionBound() {\n return this.capBound().cellUnionBound();\n }\n /**\r\n * Returns the latitude of the cell vertex in radians given by (i,j),\r\n * where i and j indicate the Hi (1) or Lo (0) corner.\r\n */;\n _proto.latitude = function latitude(i, j) {\n var u, v;\n switch (true) {\n case i === 0 && j === 0:\n u = this.uv.x.lo;\n v = this.uv.y.lo;\n break;\n case i === 0 && j === 1:\n u = this.uv.x.lo;\n v = this.uv.y.hi;\n break;\n case i === 1 && j === 0:\n u = this.uv.x.hi;\n v = this.uv.y.lo;\n break;\n case i === 1 && j === 1:\n u = this.uv.x.hi;\n v = this.uv.y.hi;\n break;\n default:\n throw new Error('i and/or j is out of bounds');\n }\n return LatLng.latitude(Point$1.fromVector(faceUVToXYZ(this.face, u, v)));\n }\n /**\r\n * Returns the longitude of the cell vertex in radians given by (i,j),\r\n * where i and j indicate the Hi (1) or Lo (0) corner.\r\n */;\n _proto.longitude = function longitude(i, j) {\n var u, v;\n switch (true) {\n case i === 0 && j === 0:\n u = this.uv.x.lo;\n v = this.uv.y.lo;\n break;\n case i === 0 && j === 1:\n u = this.uv.x.lo;\n v = this.uv.y.hi;\n break;\n case i === 1 && j === 0:\n u = this.uv.x.hi;\n v = this.uv.y.lo;\n break;\n case i === 1 && j === 1:\n u = this.uv.x.hi;\n v = this.uv.y.hi;\n break;\n default:\n throw new Error('i and/or j is out of bounds');\n }\n return LatLng.longitude(Point$1.fromVector(faceUVToXYZ(this.face, u, v)));\n }\n /**\r\n * Returns the bounding rectangle of this cell.\r\n */;\n _proto.rectBound = function rectBound() {\n if (this.level > 0) {\n var u = this.uv.x.lo + this.uv.x.hi;\n var v = this.uv.y.lo + this.uv.y.hi;\n var i, j;\n if (uAxis(this.face).z === 0) {\n i = u < 0 ? 1 : 0;\n } else {\n i = u > 0 ? 1 : 0;\n }\n if (vAxis(this.face).z === 0) {\n j = v < 0 ? 1 : 0;\n } else {\n j = v > 0 ? 1 : 0;\n }\n var lat = Interval.fromPoint(this.latitude(i, j)).addPoint(this.latitude(1 - i, 1 - j));\n var lng = Interval$1.emptyInterval().addPoint(this.longitude(i, 1 - j)).addPoint(this.longitude(1 - i, j));\n return new Rect$1(lat, lng).expanded(new LatLng(2 * DBL_EPSILON$1, 2 * DBL_EPSILON$1)).polarClosure();\n }\n var bound;\n switch (this.face) {\n case 0:\n bound = new Rect$1(new Interval(-Math.PI / 4, Math.PI / 4), new Interval$1(-Math.PI / 4, Math.PI / 4));\n break;\n case 1:\n bound = new Rect$1(new Interval(-Math.PI / 4, Math.PI / 4), new Interval$1(Math.PI / 4, 3 * Math.PI / 4));\n break;\n case 2:\n bound = new Rect$1(new Interval(POLE_MIN_LAT, Math.PI / 2), Interval$1.fullInterval());\n break;\n case 3:\n bound = new Rect$1(new Interval(-Math.PI / 4, Math.PI / 4), new Interval$1(3 * Math.PI / 4, -3 * Math.PI / 4));\n break;\n case 4:\n bound = new Rect$1(new Interval(-Math.PI / 4, Math.PI / 4), new Interval$1(-3 * Math.PI / 4, -Math.PI / 4));\n break;\n default:\n bound = new Rect$1(new Interval(-Math.PI / 2, -POLE_MIN_LAT), Interval$1.fullInterval());\n }\n return bound.expanded(new LatLng(DBL_EPSILON$1, 0));\n }\n /**\r\n * Returns the bounding cap of this cell.\r\n */;\n _proto.capBound = function capBound() {\n var cap = Cap.fromPoint(Point$1.fromVector(faceUVToXYZ(this.face, this.uv.center().x, this.uv.center().y).normalize()));\n for (var k = 0; k < 4; k++) {\n cap = cap.addPoint(this.vertex(k));\n }\n return cap;\n }\n /**\r\n * Reports whether this cell contains the given point.\r\n * Note that unlike Loop/Polygon, a Cell is considered to be a closed set.\r\n * This means that a point on a Cell's edge or vertex belongs to the Cell and the relevant adjacent Cells too.\r\n *\r\n * If you want every point to be contained by exactly one Cell, you will need to convert the Cell to a Loop.\r\n */;\n _proto.containsPoint = function containsPoint(p) {\n // We can't just call XYZtoFaceUV, because for points that lie on the\n // boundary between two faces (i.e. u or v is +1/-1) we need to return\n // true for both adjacent cells.\n //\n // We can get away with not checking the face if the point matches the face of\n // the cell here because, for the 4 faces adjacent to c.face, p will be\n // projected outside the range of ([-1,1]x[-1,1]) and thus can't intersect the\n // cell bounds (except on the face boundary which we want).\n //\n // For the face opposite c.face, the sign of the UV coordinates of P will be\n // flipped so it will automatically fall outside the cell boundary as no cells\n // cross the origin.\n var _faceXYZToUV = faceXYZToUV(this.face, p.vector),\n x = _faceXYZToUV[0],\n y = _faceXYZToUV[1],\n ok = _faceXYZToUV[2];\n if (!ok) return false;\n // Expand the (u,v) bound to ensure that\n //\n // CellFromPoint(p).ContainsPoint(p)\n //\n // is always true. To do this, we need to account for the error when\n // converting from (u,v) coordinates to (s,t) coordinates. In the\n // normal case the total error is at most dblEpsilon.\n return this.uv.expandedByMargin(DBL_EPSILON$1).containsPoint(new Point(x, y));\n }\n /**\r\n * Returns the squared chord distance from point P to the\r\n * given corner vertex specified by the Hi or Lo values of each.\r\n */;\n _proto.vertexChordDist2 = function vertexChordDist2(p, xHi, yHi) {\n var x = this.uv.x.lo;\n var y = this.uv.y.lo;\n if (xHi) x = this.uv.x.hi;\n if (yHi) y = this.uv.y.hi;\n return Point$1.chordAngleBetweenPoints(p, Point$1.fromCoords(x, y, 1));\n }\n /**\r\n * Reports whether a point P is closer to the interior of the specified\r\n * Cell edge (either the lower or upper edge of the Cell) or to the endpoints.\r\n */;\n _proto.uEdgeIsClosest = function uEdgeIsClosest(p, vHi) {\n var u0 = this.uv.x.lo;\n var u1 = this.uv.x.hi;\n var v = this.uv.y.lo;\n if (vHi) v = this.uv.y.hi;\n var dir0 = new Vector(v * v + 1, -u0 * v, -u0);\n var dir1 = new Vector(v * v + 1, -u1 * v, -u1);\n return p.vector.dot(dir0) > 0 && p.vector.dot(dir1) < 0;\n }\n /**\r\n * Reports whether a point P is closer to the interior of the specified\r\n * Cell edge (either the right or left edge of the Cell) or to the endpoints.\r\n */;\n _proto.vEdgeIsClosest = function vEdgeIsClosest(p, uHi) {\n var v0 = this.uv.y.lo;\n var v1 = this.uv.y.hi;\n var u = this.uv.x.lo;\n if (uHi) u = this.uv.x.hi;\n var dir0 = new Vector(-u * v0, u * u + 1, -v0);\n var dir1 = new Vector(-u * v1, u * u + 1, -v1);\n return p.vector.dot(dir0) > 0 && p.vector.dot(dir1) < 0;\n }\n /**\r\n * Reports the distance from a Point P to a given Cell edge. The point\r\n * P is given by its dot product, and the uv edge by its normal in the\r\n * given coordinate value.\r\n */;\n Cell.edgeDistance = function edgeDistance(ij, uv) {\n var pq2 = ij * ij / (1 + uv * uv);\n var qr = 1 - Math.sqrt(1 - pq2);\n return fromSquaredLength(pq2 + qr * qr);\n }\n /**\r\n * Reports the distance from the given point to the interior of\r\n * the cell if toInterior is true or to the boundary of the cell otherwise.\r\n */;\n _proto.distanceInternal = function distanceInternal(targetXYZ, toInterior) {\n var target = Point$1.fromVector(faceXYZtoUVW(this.face, targetXYZ.vector));\n var dir00 = target.x - target.z * this.uv.x.lo;\n var dir01 = target.x - target.z * this.uv.x.hi;\n var dir10 = target.y - target.z * this.uv.y.lo;\n var dir11 = target.y - target.z * this.uv.y.hi;\n var inside = true;\n if (dir00 < 0) {\n inside = false;\n if (this.vEdgeIsClosest(target, false)) return Cell.edgeDistance(-dir00, this.uv.x.lo);\n }\n if (dir01 > 0) {\n inside = false;\n if (this.vEdgeIsClosest(target, true)) return Cell.edgeDistance(dir01, this.uv.x.hi);\n }\n if (dir10 < 0) {\n inside = false;\n if (this.uEdgeIsClosest(target, false)) return Cell.edgeDistance(-dir10, this.uv.y.lo);\n }\n if (dir11 > 0) {\n inside = false;\n if (this.uEdgeIsClosest(target, true)) return Cell.edgeDistance(dir11, this.uv.y.hi);\n }\n if (inside) return toInterior ? 0 : minChordAngle(Cell.edgeDistance(-dir00, this.uv.x.lo), Cell.edgeDistance(dir01, this.uv.x.hi), Cell.edgeDistance(-dir10, this.uv.y.lo), Cell.edgeDistance(dir11, this.uv.y.hi));\n return minChordAngle(this.vertexChordDist2(target, false, false), this.vertexChordDist2(target, true, false), this.vertexChordDist2(target, false, true), this.vertexChordDist2(target, true, true));\n }\n /**\r\n * Reports the distance from the cell to the given point. Returns zero if\r\n * the point is inside the cell.\r\n */;\n _proto.distance = function distance(target) {\n return this.distanceInternal(target, true);\n }\n /**\r\n * Reports the maximum distance from the cell (including its interior) to the\r\n * given point.\r\n */;\n _proto.maxDistance = function maxDistance(target) {\n var targetUVW = Point$1.fromVector(faceXYZtoUVW(this.face, target.vector));\n var maxDist = maxChordAngle(this.vertexChordDist2(targetUVW, false, false), this.vertexChordDist2(targetUVW, true, false), this.vertexChordDist2(targetUVW, false, true), this.vertexChordDist2(targetUVW, true, true));\n if (maxDist <= RIGHT_CHORDANGLE) return maxDist;\n return STRAIGHT_CHORDANGLE - this.distance(Point$1.fromVector(target.vector.mul(-1)));\n }\n /**\r\n * Reports the distance from the cell boundary to the given point.\r\n */;\n _proto.boundaryDistance = function boundaryDistance(target) {\n return this.distanceInternal(target, false);\n }\n /**\r\n * Returns the minimum distance from the cell to the given edge AB. Returns\r\n * zero if the edge intersects the cell interior.\r\n */;\n _proto.distanceToEdge = function distanceToEdge(a, b) {\n var minDist = minChordAngle(this.distance(a), this.distance(b));\n if (minDist === 0) return minDist;\n var crosser = EdgeCrosser.newChainEdgeCrosser(a, b, this.vertex(3));\n for (var i = 0; i < 4; i++) {\n if (crosser.chainCrossingSign(this.vertex(i)) !== DO_NOT_CROSS) return 0;\n }\n for (var _i = 0; _i < 4; _i++) {\n minDist = updateMinDistance(this.vertex(_i), a, b, minDist).dist;\n }\n return minDist;\n }\n /**\r\n * Returns the maximum distance from the cell (including its interior)\r\n * to the given edge AB.\r\n */;\n _proto.maxDistanceToEdge = function maxDistanceToEdge(a, b) {\n var maxDist = maxChordAngle(this.maxDistance(a), this.maxDistance(b));\n if (maxDist <= RIGHT_CHORDANGLE) return maxDist;\n return STRAIGHT_CHORDANGLE - this.distanceToEdge(Point$1.fromVector(a.vector.mul(-1)), Point$1.fromVector(b.vector.mul(-1)));\n }\n /**\r\n * Returns the minimum distance from this cell to the given cell.\r\n * It returns zero if one cell contains the other.\r\n */;\n _proto.distanceToCell = function distanceToCell(target) {\n if (this.face === target.face && this.uv.intersects(target.uv)) return 0;\n var va = [];\n var vb = [];\n for (var i = 0; i < 4; i++) {\n va.push(this.vertex(i));\n vb.push(target.vertex(i));\n }\n var minDist = infChordAngle();\n for (var _i2 = 0; _i2 < 4; _i2++) {\n for (var j = 0; j < 4; j++) {\n minDist = updateMinDistance(va[_i2], vb[j], vb[j + 1 & 3], minDist).dist;\n minDist = updateMinDistance(vb[_i2], va[j], va[j + 1 & 3], minDist).dist;\n }\n }\n return minDist;\n }\n /**\r\n * Returns the maximum distance from the cell (including its\r\n * interior) to the given target cell.\r\n */;\n _proto.maxDistanceToCell = function maxDistanceToCell(target) {\n var antipodalUV = new Rect(target.uv.y, target.uv.x);\n if (this.face === Cell.oppositeFace(target.face) && this.uv.intersects(antipodalUV)) {\n return STRAIGHT_CHORDANGLE;\n }\n var va = [];\n var vb = [];\n for (var i = 0; i < 4; i++) {\n va.push(this.vertex(i));\n vb.push(target.vertex(i));\n }\n var maxDist = NEGATIVE_CHORDANGLE;\n for (var _i3 = 0; _i3 < 4; _i3++) {\n for (var j = 0; j < 4; j++) {\n maxDist = updateMaxDistance(va[_i3], vb[j], vb[j + 1 & 3], maxDist).dist;\n maxDist = updateMaxDistance(vb[_i3], va[j], va[j + 1 & 3], maxDist).dist;\n }\n }\n return maxDist;\n };\n return Cell;\n}();\n\n/**\r\n * A special label indicating that the ContentsIterator done is true.\r\n */\nvar CELL_INDEX_DONE_CONTENTS = -1;\n/**\r\n * An iterator that seeks and iterates over a set of non-overlapping leaf cell\r\n * ranges that cover the entire sphere. The indexed (CellID, label) pairs that\r\n * intersect the current leaf cell range can be visited using\r\n * CellIndexContentsIterator (see below).\r\n */\nvar CellIndexRangeIterator = /*#__PURE__*/function () {\n /**\r\n * Creates an iterator for the given CellIndex.\r\n * The iterator is initially *unpositioned*; you must call a positioning\r\n * method such as begin() or seek() before accessing its contents.\r\n */\n function CellIndexRangeIterator(index, nonEmpty) {\n if (nonEmpty === void 0) {\n nonEmpty = false;\n }\n this.nonEmpty = nonEmpty;\n this.rangeNodes = index.rangeNodes;\n this.pos = 0;\n }\n /**\r\n * Reports the CellID of the start of the current range of leaf CellIDs.\r\n * If done is true, this returns the last possible CellID. This property means\r\n * that most loops do not need to test done explicitly.\r\n */\n var _proto = CellIndexRangeIterator.prototype;\n _proto.startID = function startID() {\n return this.rangeNodes[this.pos].startID;\n }\n /**\r\n * Reports the non-inclusive end of the current range of leaf CellIDs.\r\n * This assumes the iterator is not done.\r\n */;\n _proto.limitID = function limitID() {\n return this.rangeNodes[this.pos + 1].startID;\n }\n /**\r\n * Reports if no (CellID, label) pairs intersect this range.\r\n * Also returns true if done() is true.\r\n */;\n _proto.isEmpty = function isEmpty() {\n return this.rangeNodes[this.pos].contents === CELL_INDEX_DONE_CONTENTS;\n }\n /**\r\n * Positions the iterator at the first range of leaf cells (if any).\r\n */;\n _proto.begin = function begin() {\n this.pos = 0;\n while (this.nonEmpty && this.isEmpty() && !this.done()) {\n this.pos++;\n }\n }\n /**\r\n * Internal prev that doesn't check nonEmpty to prevent unwanted recursion.\r\n */;\n _proto.internalPrev = function internalPrev() {\n if (this.pos === 0) {\n return false;\n }\n this.pos--;\n return true;\n }\n /**\r\n * Internal prev for non-empty iterator.\r\n */;\n _proto.nonEmptyPrev = function nonEmptyPrev() {\n while (this.internalPrev()) {\n if (!this.isEmpty()) {\n return true;\n }\n }\n // Return the iterator to its original position.\n if (this.isEmpty() && !this.done()) {\n this.next();\n }\n return false;\n }\n /**\r\n * Positions the iterator at the previous entry and reports whether it was\r\n * not already positioned at the beginning.\r\n */;\n _proto.prev = function prev() {\n if (this.nonEmpty) {\n return this.nonEmptyPrev();\n }\n return this.internalPrev();\n }\n /**\r\n * Advances the iterator to the next range of leaf cells.\r\n * This assumes the iterator is not done.\r\n */;\n _proto.next = function next() {\n this.pos++;\n while (this.nonEmpty && this.isEmpty() && !this.done()) {\n this.pos++;\n }\n }\n /**\r\n * Reports if advancing would leave it positioned on a valid range. If the\r\n * value would not be valid, the positioning is not changed.\r\n */;\n _proto.advance = function advance(n) {\n // Note that the last element of rangeNodes is a sentinel value.\n if (n >= this.rangeNodes.length - 1 - this.pos) {\n return false;\n }\n this.pos += n;\n return true;\n }\n /**\r\n * Positions the iterator so that done is true.\r\n */;\n _proto.finish = function finish() {\n // Note that the last element of rangeNodes is a sentinel value.\n this.pos = this.rangeNodes.length - 1;\n }\n /**\r\n * Reports if the iterator is positioned beyond the last valid range.\r\n */;\n _proto.done = function done() {\n return this.pos >= this.rangeNodes.length - 1;\n }\n /**\r\n * Positions the iterator at the first range with startID >= target.\r\n * Such an entry always exists as long as \"target\" is a valid leaf cell.\r\n * Note that it is valid to access startID even when done is true.\r\n */;\n _proto.seek = function seek(target) {\n // Binary search to find the first range with startID > target.\n var lo = 0;\n var hi = this.rangeNodes.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (this.rangeNodes[mid].startID > target) {\n hi = mid;\n } else {\n lo = mid + 1;\n }\n }\n // Position at the previous range (which contains target), but ensure we don't go below 0.\n this.pos = Math.max(lo - 1, 0);\n // Non-empty iterator needs to find the next non-empty entry.\n while (this.nonEmpty && this.isEmpty() && !this.done()) {\n this.pos++;\n }\n };\n return CellIndexRangeIterator;\n}();\n/**\r\n * An iterator that visits the (CellID, label) pairs that cover a set of leaf\r\n * cell ranges (see CellIndexRangeIterator). Note that when multiple leaf cell\r\n * ranges are visited, this iterator only guarantees that each result will be\r\n * reported at least once, i.e. duplicate values may be suppressed. If you want\r\n * duplicate values to be reported again, be sure to call clear() first.\r\n *\r\n * In particular, the implementation guarantees that when multiple leaf cell\r\n * ranges are visited in monotonically increasing order, then each (CellID, label)\r\n * pair is reported exactly once.\r\n */\nvar CellIndexContentsIterator = /*#__PURE__*/function () {\n /**\r\n * Creates a new contents iterator.\r\n * Note that the iterator needs to be positioned using startUnion before\r\n * it can be safely used.\r\n */\n function CellIndexContentsIterator(index) {\n this.cellTree = index.cellTree;\n this.prevStartID = 0n;\n this.nodeCutoff = -1;\n this.nextNodeCutoff = -1;\n this.node = {\n cellID: 0n,\n label: CELL_INDEX_DONE_CONTENTS,\n parent: -1\n };\n }\n /**\r\n * Clears all state with respect to which range(s) have been visited.\r\n */\n var _proto2 = CellIndexContentsIterator.prototype;\n _proto2.clear = function clear() {\n this.prevStartID = 0n;\n this.nodeCutoff = -1;\n this.nextNodeCutoff = -1;\n this.node.label = CELL_INDEX_DONE_CONTENTS;\n }\n /**\r\n * Returns the current CellID.\r\n */;\n _proto2.cellID = function cellID() {\n return this.node.cellID;\n }\n /**\r\n * Returns the current Label.\r\n */;\n _proto2.label = function label() {\n return this.node.label;\n }\n /**\r\n * Advances the iterator to the next (CellID, label) pair covered by the\r\n * current leaf cell range. This requires the iterator to not be done.\r\n */;\n _proto2.next = function next() {\n if (this.node.parent <= this.nodeCutoff) {\n // We have already processed this node and its ancestors.\n this.nodeCutoff = this.nextNodeCutoff;\n this.node.label = CELL_INDEX_DONE_CONTENTS;\n } else {\n this.node = _extends({}, this.cellTree[this.node.parent]);\n }\n }\n /**\r\n * Reports if all (CellID, label) pairs have been visited.\r\n */;\n _proto2.done = function done() {\n return this.node.label === CELL_INDEX_DONE_CONTENTS;\n }\n /**\r\n * Positions the ContentsIterator at the first (cellID, label) pair that\r\n * covers the given leaf cell range. Note that when multiple leaf cell ranges\r\n * are visited using the same ContentsIterator, duplicate values may be\r\n * suppressed. If you don't want this behavior, call clear() first.\r\n */;\n _proto2.startUnion = function startUnion(r) {\n if (r.startID() < this.prevStartID) {\n this.nodeCutoff = -1; // Can't automatically eliminate duplicates.\n }\n this.prevStartID = r.startID();\n var contents = r.rangeNodes[r.pos].contents;\n if (contents <= this.nodeCutoff) {\n this.node.label = CELL_INDEX_DONE_CONTENTS;\n } else {\n this.node = _extends({}, this.cellTree[contents]);\n }\n // When visiting ancestors, we can stop as soon as the node index is smaller\n // than any previously visited node index. Because indexes are assigned\n // using a preorder traversal, such nodes are guaranteed to have already\n // been reported.\n this.nextNodeCutoff = contents;\n };\n return CellIndexContentsIterator;\n}();\n/**\r\n * Stores a collection of (CellID, label) pairs.\r\n *\r\n * The CellIDs may be overlapping or contain duplicate values. For example, a\r\n * CellIndex could store a collection of CellUnions, where each CellUnion\r\n * gets its own non-negative int32 label.\r\n *\r\n * Similar to ShapeIndex and PointIndex which map each stored element to an\r\n * identifier, CellIndex stores a label that is typically used to map the\r\n * results of queries back to client's specific data.\r\n *\r\n * To build a CellIndex where each Cell has a distinct label, call add() for each\r\n * (CellID, label) pair, and then build() the index. For example:\r\n *\r\n * ```typescript\r\n * // contents is a mapping of an identifier in my system (restaurantID,\r\n * // vehicleID, etc) to a CellID\r\n * const contents = new Map<number, CellID>([...])\r\n *\r\n * for (const [key, val] of contents) {\r\n * index.add(val, key)\r\n * }\r\n *\r\n * index.build()\r\n * ```\r\n *\r\n * There is also a helper method that adds all elements of CellUnion with the\r\n * same label:\r\n *\r\n * ```typescript\r\n * index.addCellUnion(cellUnion, label)\r\n * ```\r\n *\r\n * Note that the index is not dynamic; the contents of the index cannot be\r\n * changed once it has been built. Adding more after calling build() results in\r\n * undefined behavior of the index.\r\n *\r\n * There are several options for retrieving data from the index. The simplest\r\n * is to use a built-in method such as intersectingLabels (which returns\r\n * the labels of all cells that intersect a given target CellUnion):\r\n *\r\n * ```typescript\r\n * const labels = index.intersectingLabels(targetUnion)\r\n * ```\r\n *\r\n * Alternatively, you can use a ClosestCellQuery which computes the cell(s)\r\n * that are closest to a given target geometry.\r\n *\r\n * Internally, the index consists of a set of non-overlapping leaf cell ranges\r\n * that subdivide the sphere and such that each range intersects a particular\r\n * set of (cellID, label) pairs.\r\n *\r\n * Most clients should use either the methods such as visitIntersectingCells\r\n * and intersectingLabels, or a helper such as ClosestCellQuery.\r\n */\nvar CellIndex = /*#__PURE__*/function () {\n function CellIndex() {\n this.cellTree = [];\n this.rangeNodes = [];\n }\n /**\r\n * Adds the given CellID and Label to the index.\r\n */\n var _proto3 = CellIndex.prototype;\n _proto3.add = function add(id, label) {\n if (label < 0) {\n throw new Error('labels must be non-negative');\n }\n this.cellTree.push({\n cellID: id,\n label: label,\n parent: -1\n });\n }\n /**\r\n * Adds all of the elements of the given CellUnion to the index with the same label.\r\n */;\n _proto3.addCellUnion = function addCellUnion(cu, label) {\n if (label < 0) {\n throw new Error('labels must be non-negative');\n }\n for (var _iterator = _createForOfIteratorHelperLoose(cu), _step; !(_step = _iterator()).done;) {\n var cell = _step.value;\n this.add(cell, label);\n }\n }\n /**\r\n * Builds the index for use. This method should only be called once.\r\n */;\n _proto3.build = function build() {\n // To build the cell tree and leaf cell ranges, we maintain a stack of\n // (CellID, label) pairs that contain the current leaf cell. This struct\n // represents an instruction to push or pop a (cellID, label) pair.\n //\n // If label >= 0, the (cellID, label) pair is pushed on the stack.\n // If CellID == SentinelCellID, a pair is popped from the stack.\n // Otherwise the stack is unchanged but a rangeNode is still emitted.\n var deltas = [];\n // Create two deltas for each (cellID, label) pair: one to add the pair to\n // the stack (at the start of its leaf cell range), and one to remove it from\n // the stack (at the end of its leaf cell range).\n for (var _iterator2 = _createForOfIteratorHelperLoose(this.cellTree), _step2; !(_step2 = _iterator2()).done;) {\n var node = _step2.value;\n deltas.push({\n startID: rangeMin(node.cellID),\n cellID: node.cellID,\n label: node.label\n });\n deltas.push({\n startID: next(rangeMax(node.cellID)),\n cellID: SentinelCellID,\n label: -1\n });\n }\n // We also create two special deltas to ensure that a RangeNode is emitted at\n // the beginning and end of the CellID range.\n deltas.push({\n startID: childBeginAtLevel(fromFace(0), MAX_LEVEL),\n cellID: 0n,\n label: -1\n });\n deltas.push({\n startID: childEndAtLevel(fromFace(5), MAX_LEVEL),\n cellID: 0n,\n label: -1\n });\n // Sort deltas: first by startID, then in reverse order by cellID, then by label.\n // This is necessary to ensure that (1) larger cells are pushed on the stack\n // before smaller cells, and (2) cells are popped off the stack before any\n // new cells are added.\n deltas.sort(function (a, b) {\n if (a.startID !== b.startID) {\n return a.startID < b.startID ? -1 : 1;\n }\n if (a.cellID !== b.cellID) {\n // Reverse order by cellID.\n return a.cellID > b.cellID ? -1 : 1;\n }\n return a.label < b.label ? -1 : a.label > b.label ? 1 : 0;\n });\n // Now walk through the deltas to build the leaf cell ranges and cell tree\n // (which is essentially a permanent form of the \"stack\" described above).\n this.cellTree = [];\n this.rangeNodes = [];\n var contents = -1;\n for (var i = 0; i < deltas.length;) {\n var startID = deltas[i].startID;\n // Process all the deltas associated with the current startID.\n while (i < deltas.length && deltas[i].startID === startID) {\n if (deltas[i].label >= 0) {\n this.cellTree.push({\n cellID: deltas[i].cellID,\n label: deltas[i].label,\n parent: contents\n });\n contents = this.cellTree.length - 1;\n } else if (deltas[i].cellID === SentinelCellID) {\n contents = this.cellTree[contents].parent;\n }\n i++;\n }\n this.rangeNodes.push({\n startID: startID,\n contents: contents\n });\n }\n };\n return CellIndex;\n}();\n\n/**\r\n * A CellUnion is a collection of CellIDs.\r\n *\r\n * It is normalized if it is sorted and does not contain redundancy.\r\n * Specifically, it may not contain the same CellID twice, nor a CellID that\r\n * is contained by another, nor the four sibling CellIDs that are children of\r\n * a single higher-level CellID.\r\n *\r\n * CellUnions are not required to be normalized, but certain operations will\r\n * return different results if they are not (e.g. Contains).\r\n */\nvar CellUnion = /*#__PURE__*/function (_Array) {\n function CellUnion() {\n return _Array.apply(this, arguments) || this;\n }\n _inheritsLoose(CellUnion, _Array);\n /**\r\n * Creates a CellUnion that covers the half-open range of leaf cells [begin, end).\r\n * If begin == end, the resulting union is empty.\r\n * This requires that begin and end are both leaves, and begin <= end.\r\n * To create a closed-ended range, pass in end.next().\r\n * @category Constructors\r\n */\n CellUnion.fromRange = function fromRange(begin, end) {\n // We repeatedly add the largest cell we can.\n var cu = new CellUnion();\n for (var id = maxTile(begin, end); id !== end; id = maxTile(next(id), end)) {\n cu.push(id);\n }\n // The output is normalized because the cells are added in order by the iteration.\n return cu;\n }\n /**\r\n * Creates a CellUnion from the union of the given CellUnions.\r\n * @category Constructors\r\n */;\n CellUnion.fromUnion = function fromUnion() {\n for (var _len = arguments.length, cellUnions = new Array(_len), _key = 0; _key < _len; _key++) {\n cellUnions[_key] = arguments[_key];\n }\n var cu = _construct(CellUnion, cellUnions.flat(1));\n cu.normalize();\n return cu;\n }\n /**\r\n * Creates a CellUnion from the intersection of the given CellUnions.\r\n * @category Constructors\r\n */;\n CellUnion.fromIntersection = function fromIntersection(x, y) {\n var cu = new CellUnion();\n var i = 0,\n j = 0;\n while (i < x.length && j < y.length) {\n var iMin = rangeMin(x[i]);\n var jMin = rangeMin(y[j]);\n if (iMin > jMin) {\n if (x[i] <= rangeMax(y[j])) {\n cu.push(x[i]);\n i++;\n } else {\n j = y.lowerBound(j + 1, y.length, iMin);\n if (x[i] <= rangeMax(y[j - 1])) j--;\n }\n } else if (jMin > iMin) {\n if (y[j] <= rangeMax(x[i])) {\n cu.push(y[j]);\n j++;\n } else {\n i = x.lowerBound(i + 1, x.length, jMin);\n if (y[j] <= rangeMax(x[i - 1])) i--;\n }\n } else {\n if (x[i] < y[j]) {\n cu.push(x[i]);\n i++;\n } else {\n cu.push(y[j]);\n j++;\n }\n }\n }\n cu.normalize();\n return cu;\n }\n /**\r\n * Creates a CellUnion from the intersection of a CellUnion with the given CellID.\r\n * This can be useful for splitting a CellUnion into chunks.\r\n * @category Constructors\r\n */;\n CellUnion.fromIntersectionWithCellID = function fromIntersectionWithCellID(x, id) {\n var cu = new CellUnion();\n if (x.containsCellID(id)) {\n cu.push(id);\n cu.normalize();\n return cu;\n }\n var idMax = rangeMax(id);\n for (var i = x.lowerBound(0, x.length, rangeMin(id)); i < x.length && x[i] <= idMax; i++) cu.push(x[i]);\n cu.normalize();\n return cu;\n }\n /**\r\n * Creates a CellUnion from the difference (x - y) of the given CellUnions.\r\n * @category Constructors\r\n */;\n CellUnion.fromDifference = function fromDifference(x, y) {\n var cu = new CellUnion();\n for (var _iterator = _createForOfIteratorHelperLoose(x), _step; !(_step = _iterator()).done;) {\n var xid = _step.value;\n cu.cellUnionDifferenceInternal(xid, y);\n }\n return cu;\n }\n /**\r\n * Reports whether the CellUnion is valid, meaning that the CellIDs are valid, non-overlapping,\r\n * and sorted in increasing order.\r\n */;\n var _proto = CellUnion.prototype;\n _proto.isValid = function isValid() {\n for (var i = 0; i < this.length; i++) {\n var cid = this[i];\n if (!valid(cid)) return false;\n if (i > 0 && rangeMax(this[i - 1]) >= rangeMin(cid)) return false;\n }\n return true;\n }\n /**\r\n * Reports whether the CellUnion is normalized, meaning that it satisfies isValid\r\n * and that no four cells have a common parent.\r\n */;\n _proto.isNormalized = function isNormalized() {\n for (var i = 0; i < this.length; i++) {\n var cid = this[i];\n if (!valid(cid)) return false;\n if (i > 0 && rangeMax(this[i - 1]) >= rangeMin(cid)) return false;\n if (i >= 3 && CellUnion.areSiblings(this[i - 3], this[i - 2], this[i - 1], cid)) return false;\n }\n return true;\n }\n /**\r\n * Normalizes the CellUnion.\r\n */;\n _proto.normalize = function normalize() {\n this.sort(ascending);\n var output = [];\n // Loop invariant: output is a sorted list of cells with no redundancy.\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var ci = _step2.value;\n // The first two passes here either ignore this new candidate,\n // or remove previously accepted cells that are covered by this candidate.\n // Ignore this cell if it is contained by the previous one.\n // We only need to check the last accepted cell. The ordering of the\n // cells implies containment (but not the converse), and output has no redundancy,\n // so if this candidate is not contained by the last accepted cell\n // then it cannot be contained by any previously accepted cell.\n if (output.length > 0 && contains(output[output.length - 1], ci)) continue;\n // Discard any previously accepted cells contained by this one.\n // This could be any contiguous trailing subsequence, but it can't be\n // a discontiguous subsequence because of the containment property of\n // sorted S2 cells mentioned above.\n var j = output.length - 1; // last index to keep\n while (j >= 0) {\n if (!contains(ci, output[j])) break;\n j--;\n }\n output.length = j + 1;\n // See if the last three cells plus this one can be collapsed.\n // We loop because collapsing three accepted cells and adding a higher level cell\n // could cascade into previously accepted cells.\n while (output.length >= 3 && CellUnion.areSiblings(output[output.length - 3], output[output.length - 2], output[output.length - 1], ci)) {\n output.length -= 3;\n ci = immediateParent(ci); // checked !ci.isFace above\n }\n output.push(ci);\n }\n this.length = 0;\n this.push.apply(this, output);\n }\n /**\r\n * Reports whether this CellUnion intersects the given CellID.\r\n */;\n _proto.intersectsCellID = function intersectsCellID(id) {\n var i = this.lowerBound(0, this.length, id);\n if (i !== this.length && rangeMin(this[i]) <= rangeMax(id)) return true;\n return i !== 0 && rangeMax(this[i - 1]) >= rangeMin(id);\n }\n /**\r\n * Reports whether the CellUnion contains the given CellID.\r\n * Containment is defined with respect to regions, e.g., a cell contains its 4 children.\r\n *\r\n * CAVEAT: If you have constructed a non-normalized CellUnion, note that groups\r\n * of 4 child cells are *not* considered to contain their parent cell. To get\r\n * this behavior you must use one of the call normalize() explicitly.\r\n */;\n _proto.containsCellID = function containsCellID(id) {\n var i = this.lowerBound(0, this.length, id);\n if (i !== this.length && rangeMin(this[i]) <= id) return true;\n return i !== 0 && rangeMax(this[i - 1]) >= id;\n }\n /**\r\n * Denormalizes this CellUnion, expanding it by replacing any cell whose level is less than\r\n * minLevel or where (level - minLevel) is not a multiple of levelMod with its children,\r\n * until both conditions are satisfied or the maximum level is reached.\r\n */;\n _proto.denormalize = function denormalize(minLevel, levelMod) {\n var denorm = new CellUnion();\n for (var _iterator3 = _createForOfIteratorHelperLoose(this), _step3; !(_step3 = _iterator3()).done;) {\n var id = _step3.value;\n var level$1 = level(id);\n var newLevel = level$1;\n if (newLevel < minLevel) newLevel = minLevel;\n if (levelMod > 1) {\n newLevel += (MAX_LEVEL - (newLevel - minLevel)) % levelMod;\n if (newLevel > MAX_LEVEL) newLevel = MAX_LEVEL;\n }\n if (newLevel === level$1) denorm.push(id);else {\n var end = childEndAtLevel(id, newLevel);\n for (var ci = childBeginAtLevel(id, newLevel); ci !== end; ci = next(ci)) denorm.push(ci);\n }\n }\n this.length = 0;\n this.push.apply(this, denorm);\n }\n /**\r\n * Returns a Rect that bounds this entity.\r\n */;\n _proto.rectBound = function rectBound() {\n var bound = Rect$1.emptyRect();\n for (var _iterator4 = _createForOfIteratorHelperLoose(this), _step4; !(_step4 = _iterator4()).done;) {\n var c = _step4.value;\n bound = bound.union(Cell.fromCellID(c).rectBound());\n }\n return bound;\n }\n /**\r\n * Returns a Cap that bounds this entity.\r\n */;\n _proto.capBound = function capBound() {\n if (this.length === 0) return Cap.emptyCap();\n // Compute the approximate centroid of the region. This won't produce the\n // bounding cap of minimal area, but it should be close enough.\n var centroid = new Point$1(0, 0, 0);\n for (var _iterator5 = _createForOfIteratorHelperLoose(this), _step5; !(_step5 = _iterator5()).done;) {\n var ci = _step5.value;\n var area = AvgAreaMetric.value(level(ci));\n centroid = Point$1.fromVector(centroid.vector.add(point(ci).vector.mul(area)));\n }\n if (centroid.equals(new Point$1(0, 0, 0))) centroid = Point$1.fromCoords(1, 0, 0);else centroid = Point$1.fromVector(centroid.vector.normalize());\n // Use the centroid as the cap axis, and expand the cap angle so that it\n // contains the bounding caps of all the individual cells. Note that it is\n // *not* sufficient to just bound all the cell vertices because the bounding\n // cap may be concave (i.e. cover more than one hemisphere).\n var c = Cap.fromPoint(centroid);\n for (var _iterator6 = _createForOfIteratorHelperLoose(this), _step6; !(_step6 = _iterator6()).done;) {\n var _ci = _step6.value;\n c = c.addCap(Cell.fromCellID(_ci).capBound());\n }\n return c;\n }\n /**\r\n * Reports whether this CellUnion contains the given cell.\r\n */;\n _proto.containsCell = function containsCell(c) {\n return this.containsCellID(c.id);\n }\n /**\r\n * Reports whether this CellUnion intersects the given cell.\r\n */;\n _proto.intersectsCell = function intersectsCell(c) {\n return this.intersectsCellID(c.id);\n }\n /**\r\n * Reports whether this CellUnion contains the given point.\r\n */;\n _proto.containsPoint = function containsPoint(p) {\n return this.containsCell(Cell.fromPoint(p));\n }\n /**\r\n * Computes a covering of the CellUnion.\r\n */;\n _proto.cellUnionBound = function cellUnionBound() {\n return this.capBound().cellUnionBound();\n }\n /**\r\n * Reports the number of leaf cells covered by this CellUnion.\r\n * This will be no more than 6*2^60 for the whole sphere.\r\n */;\n _proto.leafCellsCovered = function leafCellsCovered() {\n var numLeaves = 0n;\n for (var _iterator7 = _createForOfIteratorHelperLoose(this), _step7; !(_step7 = _iterator7()).done;) {\n var c = _step7.value;\n numLeaves += 1n << BigInt(MAX_LEVEL - level(c) << 1);\n }\n return numLeaves;\n }\n /**\r\n * Returns true if the given four cells have a common parent.\r\n * This requires that the four CellIDs are distinct.\r\n */;\n CellUnion.areSiblings = function areSiblings(a, b, c, d) {\n // A necessary (but not sufficient) condition is that the XOR of the\n // four cell IDs must be zero. This is also very fast to test.\n if ((a ^ b ^ c) !== d) return false;\n // Now we do a slightly more expensive but exact test. First, compute a\n // mask that blocks out the two bits that encode the child position of\n // \"id\" with respect to its parent, then check that the other three\n // children all agree with \"mask\".\n var mask = lsb(d) << 1n;\n mask = ~(mask + (mask << 1n));\n var idMasked = d & mask;\n return (a & mask) === idMasked && (b & mask) === idMasked && (c & mask) === idMasked && !isFace(d);\n }\n /**\r\n * Reports whether this CellUnion contains all of the CellIDs of the given CellUnion.\r\n */;\n _proto.contains = function contains(o) {\n for (var _iterator8 = _createForOfIteratorHelperLoose(o), _step8; !(_step8 = _iterator8()).done;) {\n var id = _step8.value;\n if (!this.containsCellID(id)) return false;\n }\n return true;\n }\n /**\r\n * Reports whether this CellUnion intersects any of the CellIDs of the given CellUnion.\r\n */;\n _proto.intersects = function intersects(o) {\n for (var _iterator9 = _createForOfIteratorHelperLoose(this), _step9; !(_step9 = _iterator9()).done;) {\n var c = _step9.value;\n if (o.intersectsCellID(c)) return true;\n }\n return false;\n }\n /**\r\n * Returns the index in this CellUnion to the first element whose value is not considered\r\n * to go before the given cell id. If there is no match, then end is returned.\r\n */;\n _proto.lowerBound = function lowerBound(begin, end, id) {\n for (var i = begin; i < end; i++) if (this[i] >= id) return i;\n return end;\n }\n /**\r\n * Adds the difference between the CellID and the union to the result CellUnion.\r\n * If they intersect but the difference is non-empty, it divides and conquers.\r\n */;\n _proto.cellUnionDifferenceInternal = function cellUnionDifferenceInternal(id, other) {\n if (!other.intersectsCellID(id)) {\n this.push(id);\n return;\n }\n if (!other.containsCellID(id)) {\n for (var _iterator0 = _createForOfIteratorHelperLoose(children(id)), _step0; !(_step0 = _iterator0()).done;) {\n var child = _step0.value;\n this.cellUnionDifferenceInternal(child, other);\n }\n }\n }\n /**\r\n * Expands this CellUnion by adding a rim of cells at expandLevel around the union's boundary.\r\n *\r\n * For each cell c in the union, we add all cells at level\r\n * expandLevel that abut c. There are typically eight of those\r\n * (four edge-abutting and four sharing a vertex). However, if c is\r\n * finer than expandLevel, we add all cells abutting\r\n * c.Parent(expandLevel) as well as c.Parent(expandLevel) itself,\r\n * as an expandLevel cell rarely abuts a smaller cell.\r\n *\r\n * Note that the size of the output is exponential in\r\n * expandLevel. For example, if expandLevel == 20 and the input\r\n * has a cell at level 10, there will be on the order of 4000\r\n * adjacent cells in the output. For most applications the\r\n * ExpandByRadius method below is easier to use.\r\n */;\n _proto.expandAtLevel = function expandAtLevel(lvl) {\n var output = new CellUnion();\n var levelLsb = lsbForLevel(lvl);\n for (var i = this.length - 1; i >= 0; i--) {\n var id = this[i];\n if (lsb(id) < levelLsb) {\n id = parent(id, lvl);\n // Optimization: skip over any cells contained by this one. This is\n // especially important when very small regions are being expanded.\n while (i > 0 && contains(id, this[i - 1])) i--;\n }\n output.push(id);\n output.push.apply(output, allNeighbors(id, lvl));\n }\n output.sort(ascending);\n this.length = 0;\n this.push.apply(this, output);\n this.normalize();\n }\n /**\r\n * Expands this CellUnion such that it contains all points whose distance to the CellUnion\r\n * is at most minRadius, but does not use cells that are more than maxLevelDiff levels higher\r\n * than the largest cell in the input.\r\n */;\n _proto.expandByRadius = function expandByRadius(minRadius, maxLevelDiff) {\n var minLevel = MAX_LEVEL;\n for (var _iterator1 = _createForOfIteratorHelperLoose(this), _step1; !(_step1 = _iterator1()).done;) {\n var cid = _step1.value;\n minLevel = Math.min(minLevel, level(cid));\n }\n var radiusLevel = MinWidthMetric.maxLevel(minRadius);\n if (radiusLevel === 0 && minRadius > MinWidthMetric.value(0)) this.expandAtLevel(0);\n this.expandAtLevel(Math.min(minLevel + maxLevelDiff, radiusLevel));\n }\n /**\r\n * Reports whether the two CellUnions are equal.\r\n */;\n _proto.equals = function equals(o) {\n if (this.length !== o.length) return false;\n for (var i = 0; i < this.length; i++) if (this[i] !== o[i]) return false;\n return true;\n }\n /**\r\n * Returns the average area of this CellUnion.\r\n * This is accurate to within a factor of 1.7.\r\n */;\n _proto.averageArea = function averageArea() {\n return AvgAreaMetric.value(MAX_LEVEL) * Number(this.leafCellsCovered());\n }\n /**\r\n * Returns the approximate area of this CellUnion.\r\n * This method is accurate to within 3% for all cell sizes and accurate to within 0.1%\r\n * for cells at level 5 or higher within the union.\r\n */;\n _proto.approxArea = function approxArea() {\n var area = 0;\n for (var _iterator10 = _createForOfIteratorHelperLoose(this), _step10; !(_step10 = _iterator10()).done;) {\n var id = _step10.value;\n area += Cell.fromCellID(id).approxArea();\n }\n return area;\n }\n /**\r\n * Returns the area of this CellUnion as accurately as possible.\r\n */;\n _proto.exactArea = function exactArea() {\n var area = 0;\n for (var _iterator11 = _createForOfIteratorHelperLoose(this), _step11; !(_step11 = _iterator11()).done;) {\n var id = _step11.value;\n area += Cell.fromCellID(id).exactArea();\n }\n return area;\n };\n return CellUnion;\n}(/*#__PURE__*/_wrapNativeSuper(Array));\n\n/**\r\n * Represents a geodesic edge consisting of two vertices.\r\n * Zero-length edges are allowed, and can be used to represent points.\r\n */\nvar Edge = /*#__PURE__*/function () {\n /**\r\n * Returns a new Edge.\r\n * @category Constructors\r\n */\n function Edge(v0, v1) {\n this.v0 = v0;\n this.v1 = v1;\n }\n /**\r\n * Compares the two edges using the underlying Points' cmp method and returns:\r\n * -1 if e < other\r\n * 0 if e == other\r\n * +1 if e > other\r\n *\r\n * The two edges are compared by the first vertex, and then by the second vertex.\r\n */\n var _proto = Edge.prototype;\n _proto.cmp = function cmp(other) {\n var v0cmp = this.v0.vector.cmp(other.v0.vector);\n if (v0cmp !== 0) return v0cmp;\n return this.v1.vector.cmp(other.v1.vector);\n }\n /**\r\n * Reports whether this edge equals another edge.\r\n */;\n _proto.equals = function equals(other) {\n return this.v0.equals(other.v0) && this.v1.equals(other.v1);\n };\n return Edge;\n}();\n/**\r\n * Represents a range of edge IDs corresponding to a chain of connected\r\n * edges, specified as a (start, length) pair. The chain is defined to consist of\r\n * edge IDs {start, start + 1, ..., start + length - 1}.\r\n */\nvar Chain =\n/**\r\n * Returns a new Chain.\r\n * @category Constructors\r\n */\nfunction Chain(start, length) {\n this.start = start;\n this.length = length;\n};\n/**\r\n * Represents the position of an edge within a given edge chain,\r\n * specified as a (chainID, offset) pair. Chains are numbered sequentially\r\n * starting from zero, and offsets are measured from the start of each chain.\r\n */\nvar ChainPosition =\n/**\r\n * Returns a new ChainPosition.\r\n * @category Constructors\r\n */\nfunction ChainPosition(chainID, offset) {\n this.chainID = chainID;\n this.offset = offset;\n};\n/**\r\n * Consists of a point and a boolean indicating whether the point\r\n * is contained by a particular shape.\r\n */\nvar ReferencePoint =\n/**\r\n * Returns a new ReferencePoint.\r\n * @category Constructors\r\n */\nfunction ReferencePoint(point, contained) {\n this.point = point;\n this.contained = contained;\n};\n/**\r\n * Returns a ReferencePoint with the given value for contained and the origin point.\r\n * It should be used when all points or no points are contained.\r\n */\nvar originReferencePoint = function originReferencePoint(contained) {\n return new ReferencePoint(Point$1.originPoint(), contained);\n};\nvar TypeTagNone = 0;\nvar TypeTagPolygon = 1;\nvar TypeTagPolyline = 2;\n/**\r\n * Reports whether this shape contains no points.\r\n */\nvar defaultShapeIsEmpty = function defaultShapeIsEmpty(s) {\n return s.numEdges() === 0 && (s.dimension() !== 2 || s.numChains() === 0);\n};\n/**\r\n * Reports whether this shape contains all points on the sphere.\r\n */\nvar defaultShapeIsFull = function defaultShapeIsFull(s) {\n return s.numEdges() === 0 && s.dimension() === 2 && s.numChains() > 0;\n};\n// NilShape represents a Nil value\nvar NilShape = /*#__PURE__*/function () {\n function NilShape() {}\n var _proto3 = NilShape.prototype;\n _proto3.numEdges = function numEdges() {\n return 0;\n };\n _proto3.edge = function edge(_i) {\n return new Edge(Point$1.originPoint(), Point$1.originPoint());\n };\n _proto3.referencePoint = function referencePoint() {\n return originReferencePoint(false);\n };\n _proto3.numChains = function numChains() {\n return 0;\n };\n _proto3.chain = function chain(_chainID) {\n return new Chain(0, 0);\n };\n _proto3.chainEdge = function chainEdge(_chainID, _offset) {\n return new Edge(Point$1.originPoint(), Point$1.originPoint());\n };\n _proto3.chainPosition = function chainPosition(_edgeID) {\n return new ChainPosition(0, 0);\n };\n _proto3.dimension = function dimension() {\n return -1;\n };\n _proto3.isEmpty = function isEmpty() {\n return true;\n };\n _proto3.isFull = function isFull() {\n return false;\n };\n _proto3.typeTag = function typeTag() {\n return TypeTagNone;\n };\n _proto3.privateInterface = function privateInterface() {};\n return NilShape;\n}();\n\n/**\r\n * Represents the part of a shape that intersects a Cell.\r\n * It consists of the set of edge IDs that intersect that cell and a boolean\r\n * indicating whether the center of the cell is inside the shape (for shapes\r\n * that have an interior).\r\n *\r\n * Note that the edges themselves are not clipped; we always use the original\r\n * edges for intersection tests so that the results will be the same as the\r\n * original shape.\r\n */\nvar ShapeIndexClippedShape = /*#__PURE__*/function () {\n /**\r\n * Constructs a new clipped shape for the given shapeID and number of expected edges.\r\n *\r\n * @category Constructors\r\n */\n function ShapeIndexClippedShape(id, numEdges) {\n // indicates if the center of the CellID this shape has been\n // clipped to falls inside this shape. This is false for shapes that do not\n // have an interior.\n this.containsCenter = false;\n this.shapeID = id;\n this.containsCenter = false; // Default to false, can be set later\n this.edges = new Array(numEdges);\n }\n /**\r\n * Returns the number of edges that intersect the CellID of the Cell this was clipped to.\r\n */\n var _proto = ShapeIndexClippedShape.prototype;\n _proto.numEdges = function numEdges() {\n return this.edges.length;\n }\n /**\r\n * Reports if this clipped shape contains the given edge ID.\r\n */;\n _proto.containsEdge = function containsEdge(id) {\n // Linear search is fast because the number of edges per shape is typically\n // very small (less than 10).\n for (var _iterator = _createForOfIteratorHelperLoose(this.edges), _step; !(_step = _iterator()).done;) {\n var e = _step.value;\n if (e === id) return true;\n }\n return false;\n };\n return ShapeIndexClippedShape;\n}();\n// NilShapeIndexClippedShape represents a Nil value\nvar NilShapeIndexClippedShape = /*#__PURE__*/function () {\n function NilShapeIndexClippedShape() {\n this.shapeID = 0;\n this.containsCenter = false;\n this.edges = [];\n }\n var _proto2 = NilShapeIndexClippedShape.prototype;\n _proto2.numEdges = function numEdges() {\n return 0;\n };\n _proto2.containsEdge = function containsEdge(_id) {\n return false;\n };\n return NilShapeIndexClippedShape;\n}();\n\nvar ShapeIndexCell = /*#__PURE__*/function () {\n /**\r\n * Creates a new cell that is sized to hold the given number of shapes.\r\n *\r\n * @category Constructors\r\n */\n function ShapeIndexCell(numShapes) {\n this.shapes = new Array(numShapes);\n }\n /**\r\n * Reports the total number of edges in all clipped shapes in this cell.\r\n */\n var _proto = ShapeIndexCell.prototype;\n _proto.numEdges = function numEdges() {\n var e = 0;\n for (var _iterator = _createForOfIteratorHelperLoose(this.shapes), _step; !(_step = _iterator()).done;) {\n var cs = _step.value;\n e += cs.numEdges();\n }\n return e;\n }\n /**\r\n * Adds the given clipped shape to this index cell.\r\n */;\n _proto.add = function add(c) {\n // Note: Unlike the original C++ code, this does not check for duplicates.\n this.shapes.push(c);\n }\n /**\r\n * Returns the clipped shape that contains the given shapeID,\r\n * or null if none of the clipped shapes contain it.\r\n */;\n _proto.findByShapeID = function findByShapeID(shapeID) {\n // Linear search is used because the number of shapes per cell is typically\n // very small (most often 1), and is large only for pathological inputs\n // (e.g., very deeply nested loops).\n for (var _iterator2 = _createForOfIteratorHelperLoose(this.shapes), _step2; !(_step2 = _iterator2()).done;) {\n var clipped = _step2.value;\n if (clipped.shapeID === shapeID) {\n return clipped;\n }\n }\n return new NilShapeIndexClippedShape();\n };\n return ShapeIndexCell;\n}();\n// NilShapeIndexCell represents a Nil value\nvar NilShapeIndexCell = /*#__PURE__*/function () {\n function NilShapeIndexCell() {\n this.shapes = [];\n }\n var _proto2 = NilShapeIndexCell.prototype;\n _proto2.numEdges = function numEdges() {\n return 0;\n };\n _proto2.add = function add(_c) {};\n _proto2.findByShapeID = function findByShapeID(_shapeID) {\n return new NilShapeIndexClippedShape();\n };\n return NilShapeIndexCell;\n}();\n\n/** specifies the iterator should be positioned at the beginning of the index. */\nvar ITERATOR_BEGIN = 0;\n/** specifies the iterator should be positioned at the end of the index. */\nvar ITERATOR_END = 0;\n/**\r\n * An iterator that provides low-level access to the cells of the index.\r\n * Cells are returned in increasing order of CellID.\r\n *\r\n * \tfor it := index.Iterator(); !it.Done(); it.Next() {\r\n * \t fmt.Print(it.CellID())\r\n * \t}\r\n */\nvar ShapeIndexIterator = /*#__PURE__*/function () {\n /**\r\n * Creates a new iterator for the given index.\r\n * If a starting position is specified, the iterator is positioned at the given spot.\r\n * @category Constructors\r\n */\n function ShapeIndexIterator(index, pos) {\n this.index = index;\n this.position = 0;\n this.id = SentinelCellID;\n this.cell = new NilShapeIndexCell();\n if (pos !== undefined) {\n switch (pos) {\n case ITERATOR_BEGIN:\n this.begin();\n break;\n case ITERATOR_END:\n this.end();\n break;\n default:\n throw new Error('unknown ShapeIndexIteratorPos value');\n }\n }\n }\n /**\r\n * clone creates a copy of the current iterator.\r\n */\n var _proto = ShapeIndexIterator.prototype;\n _proto.clone = function clone() {\n var cloned = new ShapeIndexIterator(this.index);\n cloned.position = this.position;\n cloned.id = this.id;\n cloned.cell = this.cell;\n return cloned;\n }\n /**\r\n * cellID returns the CellID of the current index cell.\r\n * If done() is true, a value larger than any valid CellID is returned.\r\n */;\n _proto.cellID = function cellID() {\n return this.id;\n }\n /**\r\n * indexCell returns the current index cell.\r\n */;\n _proto.indexCell = function indexCell() {\n // TODO: C++ has this call a virtual method to allow subclasses\n // of ShapeIndexIterator to do other work before returning the cell. Do\n // we need such a thing?\n return this.cell;\n }\n /**\r\n * center returns the Point at the center of the current position of the iterator.\r\n */;\n _proto.center = function center() {\n return point(this.cellID());\n }\n /**\r\n * begin positions the iterator at the beginning of the index.\r\n */;\n _proto.begin = function begin() {\n if (!this.index.isFresh()) {\n this.index.maybeApplyUpdates();\n }\n this.position = 0;\n this.refresh();\n }\n /**\r\n * next positions the iterator at the next index cell.\r\n */;\n _proto.next = function next() {\n this.position++;\n this.refresh();\n }\n /**\r\n * prev advances the iterator to the previous cell in the index and returns true to\r\n * indicate it was not yet at the beginning of the index. If the iterator is at the\r\n * first cell the call does nothing and returns false.\r\n */;\n _proto.prev = function prev() {\n if (this.position <= 0) {\n return false;\n }\n this.position--;\n this.refresh();\n return true;\n }\n /**\r\n * end positions the iterator at the end of the index.\r\n */;\n _proto.end = function end() {\n this.position = this.index.cells.length;\n this.refresh();\n }\n /**\r\n * done reports if the iterator is positioned at or after the last index cell.\r\n */;\n _proto.done = function done() {\n return this.id === SentinelCellID;\n }\n /**\r\n * refresh updates the stored internal iterator values.\r\n */;\n _proto.refresh = function refresh() {\n if (this.position < this.index.cells.length) {\n this.id = this.index.cells[this.position];\n this.cell = this.index.cellMap.get(this.cellID()) || new NilShapeIndexCell();\n } else {\n this.id = SentinelCellID;\n this.cell = new NilShapeIndexCell();\n }\n }\n /**\r\n * seek positions the iterator at the first cell whose ID >= target, or at the\r\n * end of the index if no such cell exists.\r\n */;\n _proto.seek = function seek(target) {\n var _this = this;\n this.position = binarySearch(this.index.cells.length, function (i) {\n return _this.index.cells[i] >= target;\n });\n this.refresh();\n }\n /**\r\n * LocatePoint positions the iterator at the cell that contains the given Point.\r\n * If no such cell exists, the iterator position is unspecified, and false is returned.\r\n * The cell at the matched position is guaranteed to contain all edges that might\r\n * intersect the line segment between target and the cell's center.\r\n */;\n _proto.locatePoint = function locatePoint(p) {\n var target = fromPoint(p);\n this.seek(target);\n if (!this.done() && rangeMin(this.cellID()) <= target) return true;\n if (this.prev() && rangeMax(this.cellID()) >= target) return true;\n return false;\n }\n /**\r\n * LocateCellID attempts to position the iterator at the first matching index cell\r\n * in the index that has some relation to the given CellID. Let T be the target CellID.\r\n * If T is contained by (or equal to) some index cell I, then the iterator is positioned\r\n * at I and returns INDEXED. Otherwise if T contains one or more (smaller) index cells,\r\n * then the iterator is positioned at the first such cell I and return SUBDIVIDED.\r\n * Otherwise DISJOINT is returned and the iterator position is undefined.\r\n */;\n _proto.locateCellID = function locateCellID(target) {\n this.seek(rangeMin(target));\n if (!this.done()) {\n if (this.cellID() >= target && rangeMin(this.cellID()) <= target) return INDEXED;\n if (this.cellID() <= rangeMax(target)) return SUBDIVIDED;\n }\n if (this.prev() && rangeMax(this.cellID()) >= target) return INDEXED;\n return DISJOINT;\n };\n return ShapeIndexIterator;\n}();\n\nvar ShapeIndexTracker = /*#__PURE__*/function () {\n /**\r\n * Returns a new ShapeIndexTracker instance with the appropriate defaults.\r\n * @category Constructors\r\n */\n function ShapeIndexTracker() {\n this.isActive = false;\n this.a = this.b = ShapeIndexTracker.trackerOrigin();\n this.nextCellID = childBeginAtLevel(fromFace(0), MAX_LEVEL);\n this.crosser = null;\n this.shapeIDs = [];\n this.savedIDs = [];\n this.drawTo(Point$1.fromVector(faceUVToXYZ(0, -1, -1).normalize()));\n }\n /**\r\n * Returns the initial focus point when the tracker is created (corresponding to the start of the CellID space-filling curve).\r\n */\n ShapeIndexTracker.trackerOrigin = function trackerOrigin() {\n return Point$1.fromVector(faceUVToXYZ(0, -1, -1).normalize());\n }\n /**\r\n * Returns the current focus point of the tracker.\r\n */;\n var _proto = ShapeIndexTracker.prototype;\n _proto.focus = function focus() {\n return this.b;\n }\n /**\r\n * Adds a shape whose interior should be tracked.\r\n * If the focus point is inside the shape, it toggles the shape's state.\r\n */;\n _proto.addShape = function addShape(shapeID, containsFocus) {\n this.isActive = true;\n if (containsFocus) this.toggleShape(shapeID);\n }\n /**\r\n * Moves the focus of the tracker to the given point.\r\n */;\n _proto.moveTo = function moveTo(b) {\n this.b = b;\n }\n /**\r\n * Moves the focus of the tracker to the given point and updates the edge crosser.\r\n */;\n _proto.drawTo = function drawTo(b) {\n this.a = this.b;\n this.b = b;\n this.crosser = new EdgeCrosser(this.a, this.b);\n }\n /**\r\n * Checks if the given edge crosses the current edge, and if so, toggles the state of the given shapeID.\r\n */;\n _proto.testEdge = function testEdge(shapeID, edge) {\n var _this$crosser;\n if ((_this$crosser = this.crosser) != null && _this$crosser.edgeOrVertexCrossing(edge.v0, edge.v1)) this.toggleShape(shapeID);\n }\n /**\r\n * Indicates that the last argument to moveTo or drawTo was the entry vertex of the given CellID.\r\n */;\n _proto.setNextCellID = function setNextCellID(ci) {\n this.nextCellID = rangeMin(ci);\n }\n /**\r\n * Reports if the focus is already at the entry vertex of the given CellID.\r\n */;\n _proto.atCellID = function atCellID(ci) {\n return rangeMin(ci) === this.nextCellID;\n }\n /**\r\n * Adds or removes the given shapeID from the set of IDs it is tracking.\r\n */;\n _proto.toggleShape = function toggleShape(shapeID) {\n if (this.shapeIDs.length === 0) {\n this.shapeIDs.push(shapeID);\n return;\n }\n if (this.shapeIDs[0] === shapeID) {\n this.shapeIDs.shift();\n return;\n }\n for (var i = 0; i < this.shapeIDs.length; i++) {\n var s = this.shapeIDs[i];\n if (s < shapeID) continue;\n if (s === shapeID) {\n this.shapeIDs.splice(i, 1);\n return;\n }\n this.shapeIDs.splice(i, 0, shapeID);\n return;\n }\n this.shapeIDs.push(shapeID);\n }\n /**\r\n * Makes an internal copy of the state for shape IDs below the given limit, and then clears the state for those shapes.\r\n */;\n _proto.saveAndClearStateBefore = function saveAndClearStateBefore(limitShapeID) {\n var limit = this.lowerBound(limitShapeID);\n this.savedIDs = this.shapeIDs.slice(0, limit);\n this.shapeIDs = this.shapeIDs.slice(limit);\n }\n /**\r\n * Restores the state previously saved by saveAndClearStateBefore.\r\n */;\n _proto.restoreStateBefore = function restoreStateBefore(limitShapeID) {\n var limit = this.lowerBound(limitShapeID);\n this.shapeIDs = this.savedIDs.concat(this.shapeIDs.slice(limit));\n this.savedIDs = [];\n }\n /**\r\n * Returns the shapeID of the first entry where the value is greater than or equal to shapeID.\r\n */;\n _proto.lowerBound = function lowerBound(shapeID) {\n for (var i = 0; i < this.shapeIDs.length; i++) {\n if (this.shapeIDs[i] >= shapeID) return i;\n }\n return this.shapeIDs.length;\n };\n return ShapeIndexTracker;\n}();\n\n/**\r\n * VERTEX_MODEL_SEMI_OPEN means that polygon point containment is defined\r\n * such that if several polygons tile the region around a vertex, then\r\n * exactly one of those polygons contains that vertex.\r\n */\nvar VERTEX_MODEL_SEMI_OPEN = 1;\n/**\r\n * VERTEX_MODEL_CLOSED means all shapes contain their vertices (including\r\n * points and polylines).\r\n */\nvar VERTEX_MODEL_CLOSED = 2;\n/**\r\n * ContainsPointQuery determines whether one or more shapes in a ShapeIndex\r\n * contain a given Point. The ShapeIndex may contain any number of points,\r\n * polylines, and/or polygons (possibly overlapping). Shape boundaries may be\r\n * modeled as Open, SemiOpen, or Closed (this affects whether or not shapes are\r\n * considered to contain their vertices).\r\n *\r\n * This type is not safe for concurrent use.\r\n *\r\n * However, note that if you need to do a large number of point containment\r\n * tests, it is more efficient to re-use the query rather than creating a new\r\n * one each time.\r\n */\nvar ContainsPointQuery = /*#__PURE__*/function () {\n /**\r\n * Returns a new ContainsPointQuery.\r\n * @category Constructors\r\n */\n function ContainsPointQuery(index, model) {\n this.index = index;\n this.model = model;\n this.iter = index.iterator();\n }\n /** Reports whether any shape in the queries index contains the point p under the queries vertex model (Open, SemiOpen, or Closed). */\n var _proto = ContainsPointQuery.prototype;\n _proto.contains = function contains(p) {\n if (!this.iter.locatePoint(p)) return false;\n var cell = this.iter.indexCell();\n for (var _iterator = _createForOfIteratorHelperLoose(cell.shapes), _step; !(_step = _iterator()).done;) {\n var clipped = _step.value;\n if (this._shapeContains(clipped, this.iter.center(), p)) return true;\n }\n return false;\n }\n /** Reports whether the clippedShape from the iterator's center position contains the given point. */;\n _proto._shapeContains = function _shapeContains(clipped, center, p) {\n var inside = clipped.containsCenter;\n var numEdges = clipped.numEdges();\n if (numEdges <= 0) return inside;\n var shape = this.index.shape(clipped.shapeID);\n if (shape.dimension() !== 2) {\n // Points and polylines can be ignored unless the vertex model is Closed.\n if (this.model !== VERTEX_MODEL_CLOSED) return false;\n // Otherwise, the point is contained if and only if it matches a vertex.\n for (var _iterator2 = _createForOfIteratorHelperLoose(clipped.edges), _step2; !(_step2 = _iterator2()).done;) {\n var edgeID = _step2.value;\n var edge = shape.edge(edgeID);\n if (edge.v0.equals(p) || edge.v1.equals(p)) return true;\n }\n return false;\n }\n // Test containment by drawing a line segment from the cell center to the given point\n // and counting edge crossings.\n var crosser = new EdgeCrosser(center, p);\n for (var _iterator3 = _createForOfIteratorHelperLoose(clipped.edges), _step3; !(_step3 = _iterator3()).done;) {\n var _edgeID = _step3.value;\n var _edge = shape.edge(_edgeID);\n var sign = crosser.crossingSign(_edge.v0, _edge.v1);\n if (sign === DO_NOT_CROSS) continue;\n if (sign === MAYBE_CROSS) {\n // For the Open and Closed models, check whether p is a vertex.\n if (this.model !== VERTEX_MODEL_SEMI_OPEN && (_edge.v0.equals(p) || _edge.v1.equals(p))) {\n return this.model === VERTEX_MODEL_CLOSED;\n }\n if (vertexCrossing(crosser.a, crosser.b, _edge.v0, _edge.v1)) sign = CROSS;else sign = DO_NOT_CROSS;\n }\n inside = inside !== (sign === CROSS);\n }\n return inside;\n }\n /** Reports whether the given shape contains the point under this queries vertex model (Open, SemiOpen, or Closed). This requires the shape belongs to this queries index. */;\n _proto.shapeContains = function shapeContains(shape, p) {\n if (!shape || shape instanceof NilShape) return false;\n if (!this.iter.locatePoint(p)) return false;\n var iCell = this.iter.indexCell();\n var clipped = iCell.findByShapeID(this.index.idForShape(shape));\n if (!clipped) return false;\n return this._shapeContains(clipped, this.iter.center(), p);\n }\n /**\r\n * A type of function that can be called against shapes in an index.\r\n */;\n _proto.shapeVisitorFunc = function shapeVisitorFunc(_shape) {\n return true;\n }\n /**\r\n * Visits all shapes in the given index that contain the\r\n * given point p, terminating early if the given visitor function returns false,\r\n * in which case visitContainingShapes returns false. Each shape is\r\n * visited at most once.\r\n */;\n _proto.visitContainingShapes = function visitContainingShapes(p, f) {\n if (!this.iter.locatePoint(p)) return true;\n var cell = this.iter.indexCell();\n for (var _iterator4 = _createForOfIteratorHelperLoose(cell.shapes), _step4; !(_step4 = _iterator4()).done;) {\n var clipped = _step4.value;\n if (this._shapeContains(clipped, this.iter.center(), p) && !f(this.index.shape(clipped.shapeID))) return false;\n }\n return true;\n }\n /** Returns a slice of all shapes that contain the given point. */;\n _proto.containingShapes = function containingShapes(p) {\n var shapes = [];\n this.visitContainingShapes(p, function (shape) {\n shapes.push(shape);\n return true;\n });\n return shapes;\n };\n return ContainsPointQuery;\n}();\n\n/**\r\n * ShapeIndexRegion wraps a ShapeIndex and implements the Region interface.\r\n * This allows RegionCoverer to work with ShapeIndexes as well as being\r\n * able to be used by some of the Query types.\r\n */\nvar ShapeIndexRegion = /*#__PURE__*/function () {\n function ShapeIndexRegion(index, query) {\n if (query === void 0) {\n query = new ContainsPointQuery(index, VERTEX_MODEL_SEMI_OPEN);\n }\n this.index = index;\n this.containsQuery = query;\n this.iter = index.iterator();\n }\n /**\r\n * CapBound returns a bounding spherical cap for this collection of geometry.\r\n * This is not guaranteed to be exact.\r\n */\n var _proto = ShapeIndexRegion.prototype;\n _proto.capBound = function capBound() {\n var cu = _construct(CellUnion, this.cellUnionBound());\n return cu.capBound();\n }\n /**\r\n * RectBound returns a bounding rectangle for this collection of geometry.\r\n * The bounds are not guaranteed to be tight.\r\n */;\n _proto.rectBound = function rectBound() {\n var cu = _construct(CellUnion, this.cellUnionBound());\n return cu.rectBound();\n }\n /**\r\n * CellUnionBound returns the bounding CellUnion for this collection of geometry.\r\n * This method currently returns at most 4 cells, unless the index spans\r\n * multiple faces in which case it may return up to 6 cells.\r\n */;\n _proto.cellUnionBound = function cellUnionBound() {\n var cellIDs = [];\n // Find the last CellID in the index.\n this.iter.end();\n if (!this.iter.prev()) return cellIDs; // Empty index.\n var lastIndexID = this.iter.cellID();\n this.iter.begin();\n if (this.iter.cellID() !== lastIndexID) {\n // The index has at least two cells. Choose a CellID level such that\n // the entire index can be spanned with at most 6 cells (if the index\n // spans multiple faces) or 4 cells (if the index spans a single face).\n var _cellid$commonAncesto = commonAncestorLevel(this.iter.cellID(), lastIndexID),\n level = _cellid$commonAncesto[0];\n if (level === undefined) level = -1;\n level++;\n // For each cell C at the chosen level, compute the smallest Cell\n // that covers the ShapeIndex cells within C.\n var lastID = parent(lastIndexID, level);\n for (var id = parent(this.iter.cellID(), level); id != lastID; id = next(id)) {\n // If the cell C does not contain any index cells, then skip it.\n if (rangeMax(id) < this.iter.cellID()) continue;\n // Find the range of index cells contained by C and then shrink C so\n // that it just covers those cells.\n var first = this.iter.cellID();\n this.iter.seek(next(rangeMax(id)));\n this.iter.prev();\n cellIDs.push.apply(cellIDs, this.coverRange(first, this.iter.cellID(), []));\n this.iter.next();\n }\n }\n return this.coverRange(this.iter.cellID(), lastIndexID, cellIDs);\n }\n /**\r\n * coverRange computes the smallest CellID that covers the Cell range (first, last)\r\n * and returns the updated slice.\r\n *\r\n * This requires first and last have a common ancestor.\r\n */;\n _proto.coverRange = function coverRange(first, last, cellIDs) {\n if (first == last) return cellIDs.concat([first]);\n var _cellid$commonAncesto2 = commonAncestorLevel(first, last),\n level = _cellid$commonAncesto2[0],\n ok = _cellid$commonAncesto2[1];\n if (!ok) cellIDs.concat([0n]);\n return cellIDs.concat([parent(first, level)]);\n };\n return ShapeIndexRegion;\n}();\n// TODO: remaining methods\n/*\r\nContainsCell(target Cell): boolean {\r\nIntersectsCell(target Cell): boolean {\r\nContainsPoint(p Point): boolean {\r\ncontains(id CellID, clipped clippedShape, p Point): boolean {\r\nanyEdgeIntersects(clipped clippedShape, target Cell): boolean {\r\n*/\n\n/**\r\n * Constants related to clipping geodesic edges and 2D edges to rectangles.\r\n */\nvar EDGE_CLIP_ERROR_UV_COORD = 2.25 * DBL_EPSILON$1;\nvar FACE_CLIP_ERROR_RADIANS = 3 * DBL_EPSILON$1;\nvar FACE_CLIP_ERROR_UV_COORD = 9.0 * (1.0 / Math.SQRT2) * DBL_EPSILON$1;\nvar INTERSECTS_RECT_ERROR_UV_DIST = 3 * Math.SQRT2 * DBL_EPSILON$1;\n/**\r\n * Returns the (u,v) coordinates for the portion of the edge AB that intersects the given face,\r\n * or false if the edge AB does not intersect.\r\n * This method guarantees that the clipped vertices lie within the [-1,1]x[-1,1]\r\n * cube face rectangle and are within faceClipErrorUVDist of the line AB.\r\n */\nvar clipToFace = function clipToFace(a, b, face) {\n return clipToPaddedFace(a, b, face, 0.0);\n};\n/**\r\n * Returns the (u,v) coordinates for the portion of the edge AB that intersects the given face,\r\n * but clips to [-R,R]x[-R,R] where R=(1+padding).\r\n * Padding must be non-negative.\r\n */\nvar clipToPaddedFace = function clipToPaddedFace(a, b, f, padding) {\n // Fast path: both endpoints are on the given face.\n if (face(a.vector) === f && face(b.vector) === f) {\n var _validFaceXYZToUV = validFaceXYZToUV(f, a.vector),\n au = _validFaceXYZToUV[0],\n av = _validFaceXYZToUV[1];\n var _validFaceXYZToUV2 = validFaceXYZToUV(f, b.vector),\n bu = _validFaceXYZToUV2[0],\n bv = _validFaceXYZToUV2[1];\n return [new Point(au, av), new Point(bu, bv), true];\n }\n // Convert everything into the (u,v,w) coordinates of the given face. Note\n // that the cross product *must* be computed in the original (x,y,z)\n // coordinate system because PointCross (unlike the mathematical cross\n // product) can produce different results in different coordinate systems\n // when one argument is a linear multiple of the other, due to the use of\n // symbolic perturbations.\n var normUVW = new PointUVW(faceXYZtoUVW(f, a.pointCross(b).vector));\n var aUVW = new PointUVW(faceXYZtoUVW(f, a.vector));\n var bUVW = new PointUVW(faceXYZtoUVW(f, b.vector));\n // Padding is handled by scaling the u- and v-components of the normal.\n // Letting R=1+padding, this means that when we compute the dot product of\n // the normal with a cube face vertex (such as (-1,-1,1)), we will actually\n // compute the dot product with the scaled vertex (-R,-R,1). This allows\n // methods such as intersectsFace, exitAxis, etc, to handle padding\n // with no further modifications.\n var scaleUV = 1 + padding;\n var scaledN = new PointUVW(new Point$1(scaleUV * normUVW.x, scaleUV * normUVW.y, normUVW.z));\n if (!scaledN.intersectsFace()) return [null, null, false];\n // TODO(roberts): This is a workaround for extremely small vectors where some\n // loss of precision can occur in Normalize causing underflow. When PointCross\n // is updated to work around this, this can be removed.\n if (Math.max(Math.abs(normUVW.x), Math.max(Math.abs(normUVW.y), Math.abs(normUVW.z))) < ldexp(1, -511)) {\n normUVW = new PointUVW(Point$1.fromVector(normUVW.vector.mul(ldexp(1, 563))));\n }\n var normUVWNormalized = new PointUVW(Point$1.fromVector(normUVW.vector.normalize()));\n var aTan = new PointUVW(Point$1.fromVector(normUVWNormalized.vector.cross(aUVW.vector)));\n var bTan = new PointUVW(Point$1.fromVector(bUVW.vector.cross(normUVWNormalized.vector)));\n // As described in clipDestination, if the sum of the scores from clipping the two\n // endpoints is 3 or more, then the segment does not intersect this face.\n var _clipDestination = clipDestination(bUVW, aUVW, new PointUVW(Point$1.fromVector(scaledN.vector.mul(-1))), bTan, aTan, scaleUV),\n aUV = _clipDestination[0],\n aScore = _clipDestination[1];\n var _clipDestination2 = clipDestination(aUVW, bUVW, scaledN, aTan, bTan, scaleUV),\n bUV = _clipDestination2[0],\n bScore = _clipDestination2[1];\n return [aUV, bUV, aScore + bScore < 3];\n};\n/**\r\n * Reports whether u + v == w exactly.\r\n */\nvar sumEqual = function sumEqual(u, v, w) {\n return u + v === w && u === w - v && v === w - u;\n};\nvar AXIS_U = 0;\nvar AXIS_V = 1;\n/**\r\n * Represents a Point in (u,v,w) coordinate space of a cube face.\r\n */\nvar PointUVW = /*#__PURE__*/function (_Point) {\n function PointUVW(point) {\n return _Point.call(this, point.x, point.y, point.z) || this;\n }\n _inheritsLoose(PointUVW, _Point);\n var _proto = PointUVW.prototype;\n _proto.intersectsFace = function intersectsFace() {\n var u = Math.abs(this.x);\n var v = Math.abs(this.y);\n var w = Math.abs(this.z);\n return v >= w - u && u >= w - v;\n };\n _proto.intersectsOppositeEdges = function intersectsOppositeEdges() {\n var u = Math.abs(this.x);\n var v = Math.abs(this.y);\n var w = Math.abs(this.z);\n if (Math.abs(u - v) !== w) return Math.abs(u - v) >= w;\n return u >= v ? u - w >= v : v - w >= u;\n };\n _proto.exitAxis = function exitAxis() {\n if (this.intersectsOppositeEdges()) {\n return Math.abs(this.x) >= Math.abs(this.y) ? AXIS_V : AXIS_U;\n }\n var x = 0;\n var y = 0;\n var z = 0;\n if (Math.sign(this.x) < 0) x = 1;\n if (Math.sign(this.y) < 0) y = 1;\n if (Math.sign(this.z) < 0) z = 1;\n return (x ^ y ^ z) === 0 ? AXIS_V : AXIS_U;\n };\n _proto.exitPoint = function exitPoint(axis) {\n if (axis === AXIS_U) {\n var u = this.y > 0 ? 1.0 : -1.0;\n return new Point(u, (-u * this.x - this.z) / this.y);\n }\n var v = this.x < 0 ? 1.0 : -1.0;\n return new Point((-v * this.y - this.z) / this.x, v);\n };\n return PointUVW;\n}(Point$1);\n/**\r\n * Returns the score for the given endpoint to indicate if the clipped edge AB\r\n * on the given face intersects the face at all. If the sum of the scores from\r\n * both endpoints is 3 or more, then edge AB does not intersect this face.\r\n */\nvar clipDestination = function clipDestination(a, b, scaledN, aTan, bTan, scaleUV) {\n var maxSafeUVCoord = 1 - FACE_CLIP_ERROR_UV_COORD;\n if (b.z > 0) {\n var _uv = new Point(b.x / b.z, b.y / b.z);\n if (Math.max(Math.abs(_uv.x), Math.abs(_uv.y)) <= maxSafeUVCoord) return [_uv, 0];\n }\n var uv = scaledN.exitPoint(scaledN.exitAxis()).mul(scaleUV);\n var p = new PointUVW(new Point$1(uv.x, uv.y, 1.0));\n var score = 0;\n if (p.vector.sub(a.vector).dot(aTan.vector) < 0) {\n score = 2;\n } else if (p.vector.sub(b.vector).dot(bTan.vector) < 0) {\n score = 1;\n }\n if (score > 0) {\n if (b.z <= 0) score = 3;else uv = new Point(b.x / b.z, b.y / b.z);\n }\n return [uv, score];\n};\n/**\r\n * Updates the endpoint of the interval with the specified value.\r\n * If the value lies beyond the opposite endpoint, nothing is changed and false is returned.\r\n */\nvar updateEndpoint = function updateEndpoint(bound, highEndpoint, value) {\n if (!highEndpoint) {\n if (bound.hi < value) return [bound, false];\n if (bound.lo < value) bound.lo = value;\n return [bound, true];\n }\n if (bound.lo > value) return [bound, false];\n if (bound.hi > value) bound.hi = value;\n return [bound, true];\n};\n/**\r\n * Clips the bounding intervals for the given axes for the line segment\r\n * from (a0,a1) to (b0,b1) so that neither extends beyond the given clip interval.\r\n * Returns false if the clipping interval doesn't overlap the bounds.\r\n */\nvar clipBoundAxis = function clipBoundAxis(a0, b0, bound0, a1, b1, bound1, negSlope, clip) {\n var updated = false;\n if (bound0.lo < clip.lo) {\n if (bound0.hi < clip.lo) return [bound0, bound1, false];\n bound0.lo = clip.lo;\n var _updateEndpoint = updateEndpoint(bound1, negSlope, interpolateFloat64(clip.lo, a0, b0, a1, b1));\n bound1 = _updateEndpoint[0];\n updated = _updateEndpoint[1];\n if (!updated) return [bound0, bound1, false];\n }\n if (bound0.hi > clip.hi) {\n if (bound0.lo > clip.hi) return [bound0, bound1, false];\n bound0.hi = clip.hi;\n var _updateEndpoint2 = updateEndpoint(bound1, !negSlope, interpolateFloat64(clip.hi, a0, b0, a1, b1));\n bound1 = _updateEndpoint2[0];\n updated = _updateEndpoint2[1];\n if (!updated) return [bound0, bound1, false];\n }\n return [bound0, bound1, true];\n};\n/**\r\n * Reports whether the edge defined by AB intersects the given closed rectangle within the error bound.\r\n */\nvar edgeIntersectsRect = function edgeIntersectsRect(a, b, r) {\n if (!r.intersects(Rect.fromPoints(a, b))) return false;\n var n = b.sub(a).ortho();\n var i = n.x >= 0 ? 1 : 0;\n var j = n.y >= 0 ? 1 : 0;\n var max = n.dot(r.vertexIJ(i, j).sub(a));\n var min = n.dot(r.vertexIJ(1 - i, 1 - j).sub(a));\n return max >= 0 && min <= 0;\n};\n/**\r\n * Returns the bounding rectangle of the portion of the edge defined by AB intersected by clip.\r\n */\nvar clippedEdgeBound = function clippedEdgeBound(a, b, clip) {\n var bound = Rect.fromPoints(a, b);\n var _clipEdgeBound2 = clipEdgeBound(a, b, clip, bound),\n b1 = _clipEdgeBound2[0],\n intersects = _clipEdgeBound2[1];\n if (intersects) return b1;\n return Rect.empty();\n};\n/**\r\n * Clips an edge AB to a sequence of rectangles efficiently.\r\n * Represents the clipped edges by their bounding boxes rather than as a pair of endpoints.\r\n */\nvar clipEdgeBound = function clipEdgeBound(a, b, clip, bound) {\n var negSlope = a.x > b.x !== a.y > b.y;\n var _clipBoundAxis = clipBoundAxis(a.x, b.x, bound.x, a.y, b.y, bound.y, negSlope, clip.x),\n b0x = _clipBoundAxis[0],\n b0y = _clipBoundAxis[1],\n up1 = _clipBoundAxis[2];\n if (!up1) return [bound, false];\n var _clipBoundAxis2 = clipBoundAxis(a.y, b.y, b0y, a.x, b.x, b0x, negSlope, clip.y),\n b1y = _clipBoundAxis2[0],\n b1x = _clipBoundAxis2[1],\n up2 = _clipBoundAxis2[2];\n if (!up2) return [new Rect(b0x, b0y), false];\n return [new Rect(b1x, b1y), true];\n};\n/**\r\n * Interpolates a value with the same combination of a1 and b1 as the given value x is of a and b.\r\n */\nvar interpolateFloat64 = function interpolateFloat64(x, a, b, a1, b1) {\n return Math.abs(a - x) <= Math.abs(b - x) ? a1 + (b1 - a1) * (x - a) / (b - a) : b1 + (a1 - b1) * (x - b) / (a - b);\n};\n/**\r\n * Represents an edge AB clipped to an S2 cube face.\r\n */\nvar FaceSegment = /*#__PURE__*/function () {\n /**\r\n * Returns a new FaceSegment.\r\n * @category Constructors\r\n */\n function FaceSegment(face, a, b) {\n this.face = face;\n this.a = a;\n this.b = b;\n }\n /**\r\n * Returns a copy\r\n */\n var _proto2 = FaceSegment.prototype;\n _proto2.clone = function clone() {\n return new FaceSegment(this.face, new Point(this.a.x, this.a.y), new Point(this.b.x, this.b.y));\n };\n return FaceSegment;\n}();\n/**\r\n * FaceSegments subdivides the given edge AB at every point where it crosses the\r\n * boundary between two S2 cube faces and returns the corresponding FaceSegments.\r\n * The segments are returned in order from A toward B. The input points must be\r\n * unit length.\r\n *\r\n * This function guarantees that the returned segments form a continuous path\r\n * from A to B, and that all vertices are within faceClipErrorUVDist of the\r\n * line AB. All vertices lie within the [-1,1]x[-1,1] cube face rectangles.\r\n * The results are consistent with Sign, i.e. the edge is well-defined even its\r\n * endpoints are antipodal.\r\n */\nvar faceSegments = function faceSegments(a, b) {\n var segment = new FaceSegment(0, new Point(0, 0), new Point(0, 0));\n // Fast path: both endpoints are on the same face.\n var _xyzToFaceUV = xyzToFaceUV(a.vector),\n aFace = _xyzToFaceUV[0],\n aX = _xyzToFaceUV[1],\n aY = _xyzToFaceUV[2];\n var _xyzToFaceUV2 = xyzToFaceUV(b.vector),\n bFace = _xyzToFaceUV2[0],\n bX = _xyzToFaceUV2[1],\n bY = _xyzToFaceUV2[2];\n segment.a.x = aX;\n segment.a.y = aY;\n segment.b.x = bX;\n segment.b.y = bY;\n if (aFace === bFace) {\n segment.face = aFace;\n return [segment];\n }\n // Starting at A, we follow AB from face to face until we reach the face\n // containing B. The following code is designed to ensure that we always\n // reach B, even in the presence of numerical errors.\n //\n // First we compute the normal to the plane containing A and B. This normal\n // becomes the ultimate definition of the line AB; it is used to resolve all\n // questions regarding where exactly the line goes. Unfortunately due to\n // numerical errors, the line may not quite intersect the faces containing\n // the original endpoints. We handle this by moving A and/or B slightly if\n // necessary so that they are on faces intersected by the line AB.\n var ab = a.pointCross(b);\n var _moveOriginToValidFac = moveOriginToValidFace(aFace, a, ab, segment.a),\n newAFace = _moveOriginToValidFac[0],\n newA = _moveOriginToValidFac[1];\n var _moveOriginToValidFac2 = moveOriginToValidFace(bFace, b, Point$1.fromVector(ab.vector.mul(-1)), segment.b),\n newBFace = _moveOriginToValidFac2[0],\n newB = _moveOriginToValidFac2[1];\n segment.a = newA;\n segment.b = newB;\n // Now we simply follow AB from face to face until we reach B.\n var segments = [];\n segment.face = newAFace;\n var bSaved = segment.b;\n for (var _face = newAFace; _face !== newBFace;) {\n // Complete the current segment by finding the point where AB exits the current face.\n var z = faceXYZtoUVW(_face, ab.vector);\n var n = new PointUVW(z);\n var exitAxis = n.exitAxis();\n segment.b = n.exitPoint(exitAxis);\n segments.push(segment.clone());\n // Compute the next face intersected by AB, and translate the exit\n // point of the current segment into the (u,v) coordinates of the\n // next face. This becomes the first point of the next segment.\n var exitXyz = faceUVToXYZ(_face, segment.b.x, segment.b.y);\n _face = nextFace(_face, segment.b, exitAxis, n, newBFace);\n var exitUvw = faceXYZtoUVW(_face, exitXyz);\n segment.face = _face;\n segment.a = new Point(exitUvw.x, exitUvw.y);\n }\n // Finish the last segment.\n segment.b = bSaved;\n segments.push(segment);\n return segments;\n};\n/**\r\n * Updates the origin point to a valid face if necessary.\r\n * Given a line segment AB whose origin A has been projected onto a given cube\r\n * face, determine whether it is necessary to project A onto a different face\r\n * instead. This can happen because the normal of the line AB is not computed\r\n * exactly, so that the line AB (defined as the set of points perpendicular to\r\n * the normal) may not intersect the cube face containing A. Even if it does\r\n * intersect the face, the exit point of the line from that face may be on\r\n * the wrong side of A (i.e., in the direction away from B). If this happens,\r\n * we reproject A onto the adjacent face where the line AB approaches A most\r\n * closely. This moves the origin by a small amount, but never more than the\r\n * error tolerances.\r\n */\nvar moveOriginToValidFace = function moveOriginToValidFace(face, a, ab, aUV) {\n // Fast path: if the origin is sufficiently far inside the face, it is\n // always safe to use it.\n var maxSafeUVCoord = 1 - FACE_CLIP_ERROR_UV_COORD;\n if (Math.max(Math.abs(aUV.x), Math.abs(aUV.y)) <= maxSafeUVCoord) return [face, aUV];\n // Otherwise check whether the normal AB even intersects this face.\n var z = faceXYZtoUVW(face, ab.vector);\n var n = new PointUVW(z);\n if (n.intersectsFace()) {\n // Check whether the point where the line AB exits this face is on the\n // wrong side of A (by more than the acceptable error tolerance).\n var uv = n.exitPoint(n.exitAxis());\n var exit = faceUVToXYZ(face, uv.x, uv.y);\n var aTangent = ab.vector.normalize().cross(a.vector);\n // We can use the given face.\n if (exit.sub(a.vector).dot(aTangent) >= -FACE_CLIP_ERROR_RADIANS) return [face, aUV];\n }\n // Otherwise we reproject A to the nearest adjacent face. (If line AB does\n // not pass through a given face, it must pass through all adjacent faces.)\n var dir = 0;\n if (Math.abs(aUV.x) >= Math.abs(aUV.y)) {\n // U-axis\n if (aUV.x > 0) dir = 1;\n face = uvwFace(face, 0, dir);\n } else {\n // V-axis\n if (aUV.y > 0) dir = 1;\n face = uvwFace(face, 1, dir);\n }\n var _validFaceXYZToUV3 = validFaceXYZToUV(face, a.vector);\n aUV.x = _validFaceXYZToUV3[0];\n aUV.y = _validFaceXYZToUV3[1];\n aUV.x = Math.max(-1.0, Math.min(1.0, aUV.x));\n aUV.y = Math.max(-1.0, Math.min(1.0, aUV.y));\n return [face, aUV];\n};\n/**\r\n * Returns the next face that should be visited by FaceSegments, given that\r\n * we have just visited face and we are following the line AB (represented\r\n * by its normal N in the (u,v,w) coordinates of that face). The other\r\n * arguments include the point where AB exits face, the corresponding\r\n * exit axis, and the target face containing the destination point B.\r\n */\nvar nextFace = function nextFace(face, exit, axis, n, targetFace) {\n // const [exitA, exit1MinusA] = axis === AXIS_V ? [exit.x, exit.y] : [exit.y, exit.x]\n // const exitAPos = exitA > 0 ? 1 : 0\n // const exit1MinusAPos = exit1MinusA > 0 ? 1 : 0\n var exitA = exit.x;\n var exit1MinusA = exit.y;\n if (axis == AXIS_V) {\n exitA = exit.y;\n exit1MinusA = exit.x;\n }\n var exitAPos = 0;\n if (exitA > 0) {\n exitAPos = 1;\n }\n var exit1MinusAPos = 0;\n if (exit1MinusA > 0) {\n exit1MinusAPos = 1;\n }\n // We return the face that is adjacent to the exit point along the given\n // axis. If line AB exits *exactly* through a corner of the face, there are\n // two possible next faces. If one is the target face containing B, then\n // we guarantee that we advance to that face directly.\n //\n // The three conditions below check that (1) AB exits approximately through\n // a corner, (2) the adjacent face along the non-exit axis is the target\n // face, and (3) AB exits *exactly* through the corner. (The sumEqual\n // code checks whether the dot product of (u,v,1) and n is exactly zero.)\n if (Math.abs(exit1MinusA) === 1 && uvwFace(face, 1 - axis, exit1MinusAPos) === targetFace && sumEqual(exit.x * n.x, exit.y * n.y, -n.z)) {\n return targetFace;\n }\n // Otherwise return the face that is adjacent to the exit point in the\n // direction of the exit axis.\n return uvwFace(face, axis, exitAPos);\n};\n\n/**\r\n * Reports all intersections, even those where two edges\r\n * intersect only because they share a common vertex.\r\n */\nvar CROSSING_TYPE_ALL = 1;\n/**\r\n * RangeIterator is a wrapper over ShapeIndexIterator with extra methods\r\n * that are useful for merging the contents of two or more ShapeIndexes.\r\n */\nvar RangeIterator = /*#__PURE__*/function () {\n function RangeIterator(index) {\n this.rangeMin = SentinelCellID;\n this.rangeMax = SentinelCellID;\n this.it = index.iterator();\n this.refresh();\n }\n var _proto = RangeIterator.prototype;\n _proto.cellID = function cellID() {\n return this.it.cellID();\n };\n _proto.indexCell = function indexCell() {\n return this.it.indexCell();\n };\n _proto.next = function next() {\n this.it.next();\n this.refresh();\n };\n _proto.done = function done() {\n return this.it.done();\n }\n /**\r\n * Positions the iterator at the first cell that overlaps or follows\r\n * the current range minimum of the target iterator, i.e. such that its\r\n * rangeMax >= target.rangeMin.\r\n */;\n _proto.seekTo = function seekTo(target) {\n this.it.seek(target.rangeMin);\n // If the current cell does not overlap target, it is possible that the\n // previous cell is the one we are looking for. This can only happen when\n // the previous cell contains target but has a smaller CellID.\n if (this.it.done() || rangeMin(this.it.cellID()) > target.rangeMax) {\n if (this.it.prev() && rangeMax(this.it.cellID()) < target.cellID()) {\n this.it.next();\n }\n }\n this.refresh();\n }\n /**\r\n * Positions the iterator at the first cell that follows the current\r\n * range minimum of the target iterator. i.e. the first cell such that its\r\n * rangeMin > target.rangeMax.\r\n */;\n _proto.seekBeyond = function seekBeyond(target) {\n this.it.seek(next(target.rangeMax));\n if (!this.it.done() && rangeMin(this.it.cellID()) <= target.rangeMax) {\n this.it.next();\n }\n this.refresh();\n }\n /**\r\n * Updates the iterator's min and max values.\r\n */;\n _proto.refresh = function refresh() {\n this.rangeMin = rangeMin(this.cellID());\n this.rangeMax = rangeMax(this.cellID());\n };\n return RangeIterator;\n}();\n/**\r\n * containsBruteForce reports whether the given shape contains the given point.\r\n * Most clients should not use this method, since its running time is linear in\r\n * the number of shape edges. Instead clients should create a ShapeIndex and use\r\n * ContainsPointQuery, since this strategy is much more efficient when many\r\n * points need to be tested.\r\n *\r\n * Polygon boundaries are treated as being semi-open (see ContainsPointQuery\r\n * and VertexModel for other options).\r\n */\nvar containsBruteForce = function containsBruteForce(shape, point) {\n if (shape.dimension() !== 2) return false;\n var refPoint = shape.referencePoint();\n if (refPoint.point === point) return refPoint.contained;\n var crosser = new EdgeCrosser(refPoint.point, point);\n var inside = refPoint.contained;\n for (var e = 0; e < shape.numEdges(); e++) {\n var edge = shape.edge(e);\n inside = inside !== crosser.edgeOrVertexCrossing(edge.v0, edge.v1);\n }\n return inside;\n};\n\n/**\r\n * PaddedCell represents a Cell whose (u,v)-range has been expanded on\r\n * all sides by a given amount of \"padding\". Unlike Cell, its methods and\r\n * representation are optimized for clipping edges against Cell boundaries\r\n * to determine which cells are intersected by a given set of edges.\r\n */\nvar PaddedCell = /*#__PURE__*/function () {\n function PaddedCell() {\n this.id = 0n;\n this.padding = 0;\n this.boundRect = Rect.empty();\n this.middleRect = Rect.empty(); // A rect in (u, v)-space that belongs to all four children.\n this.iLo = 0; // Minimum (i,j)-coordinates of this cell before padding\n this.jLo = 0;\n this.orientation = 0; // Hilbert curve orientation of this cell.\n this.level = 0;\n }\n /**\r\n * Returns a new PaddedCell with the given padding.\r\n * @category Constructors\r\n */\n PaddedCell.fromCellID = function fromCellID(id, padding) {\n var p = new PaddedCell();\n p.id = id;\n p.padding = padding;\n p.middleRect = Rect.empty();\n // Fast path for constructing a top-level face (the most common case).\n if (isFace(id)) {\n var limit = padding + 1;\n p.boundRect = new Rect(new Interval(-limit, limit), new Interval(-limit, limit));\n p.middleRect = new Rect(new Interval(-padding, padding), new Interval(-padding, padding));\n p.orientation = face$1(id) & 1;\n return p;\n }\n var _cellid$faceIJOrienta = faceIJOrientation(id),\n i = _cellid$faceIJOrienta.i,\n j = _cellid$faceIJOrienta.j,\n orientation = _cellid$faceIJOrienta.orientation;\n p.iLo = i;\n p.jLo = j;\n p.orientation = orientation;\n p.level = level(id);\n p.boundRect = ijLevelToBoundUV(i, j, p.level).expandedByMargin(padding);\n var ijSize = sizeIJ(p.level);\n p.iLo &= -ijSize;\n p.jLo &= -ijSize;\n return p;\n }\n /**\r\n * Constructs the child of parent with the given (i,j) index.\r\n * The four child cells have indices of (0,0), (0,1), (1,0), (1,1), where the i and j\r\n * indices correspond to increasing u- and v-values respectively.\r\n * @category Constructors\r\n */;\n PaddedCell.fromParentIJ = function fromParentIJ(parent, i, j) {\n var pos = ijToPos[parent.orientation][2 * i + j];\n var p = new PaddedCell();\n p.id = children(parent.id)[pos];\n p.padding = parent.padding;\n p.boundRect = Rect.fromRect(parent.boundRect);\n p.orientation = parent.orientation ^ posToOrientation[pos];\n p.level = parent.level + 1;\n p.middleRect = Rect.empty();\n var ijSize = sizeIJ(p.level);\n p.iLo = parent.iLo + i * ijSize;\n p.jLo = parent.jLo + j * ijSize;\n var middle = parent.middle();\n if (i === 1) {\n p.boundRect.x.lo = middle.x.lo;\n } else {\n p.boundRect.x.hi = middle.x.hi;\n }\n if (j === 1) {\n p.boundRect.y.lo = middle.y.lo;\n } else {\n p.boundRect.y.hi = middle.y.hi;\n }\n return p;\n }\n /** Returns the CellID this padded cell represents. */;\n var _proto = PaddedCell.prototype;\n _proto.cellID = function cellID() {\n return this.id;\n }\n /** Returns the amount of padding on this cell. */;\n _proto.paddingValue = function paddingValue() {\n return this.padding;\n }\n /** Returns the level this cell is at. */;\n _proto.levelValue = function levelValue() {\n return this.level;\n }\n /** Returns the center of this cell. */;\n _proto.center = function center() {\n var ijSize = sizeIJ(this.level);\n var si = 2 * this.iLo + ijSize;\n var ti = 2 * this.jLo + ijSize;\n return Point$1.fromVector(faceSiTiToXYZ(face$1(this.id), si, ti).normalize());\n }\n /** Returns the rectangle in the middle of this cell that belongs to all four of its children in (u,v)-space. */;\n _proto.middle = function middle() {\n if (this.middleRect.isEmpty()) {\n var ijSize = sizeIJ(this.level);\n var u = stToUV(siTiToST(2 * this.iLo + ijSize));\n var v = stToUV(siTiToST(2 * this.jLo + ijSize));\n this.middleRect = new Rect(new Interval(u - this.padding, u + this.padding), new Interval(v - this.padding, v + this.padding));\n }\n return this.middleRect;\n }\n /** Returns the bounds for this cell in (u,v)-space including padding. */;\n _proto.bound = function bound() {\n return this.boundRect;\n }\n /** Returns the (i,j) coordinates for the child cell at the given traversal position. */;\n _proto.childIJ = function childIJ(pos) {\n var ij = posToIJ[this.orientation][pos];\n return [ij >> 1, ij & 1];\n }\n /** Returns the vertex where the space-filling curve enters this cell. */;\n _proto.entryVertex = function entryVertex() {\n var i = this.iLo;\n var j = this.jLo;\n if (this.orientation & INVERT_MASK) {\n var ijSize = sizeIJ(this.level);\n i += ijSize;\n j += ijSize;\n }\n return Point$1.fromVector(faceSiTiToXYZ(face$1(this.id), 2 * i, 2 * j).normalize());\n }\n /** Returns the vertex where the space-filling curve exits this cell. */;\n _proto.exitVertex = function exitVertex() {\n var i = this.iLo;\n var j = this.jLo;\n var ijSize = sizeIJ(this.level);\n if (this.orientation === 0 || this.orientation === SWAP_MASK + INVERT_MASK) {\n i += ijSize;\n } else {\n j += ijSize;\n }\n return Point$1.fromVector(faceSiTiToXYZ(face$1(this.id), 2 * i, 2 * j).normalize());\n }\n /** Returns the smallest CellID that contains all descendants of this padded cell whose bounds intersect the given rect. */;\n _proto.shrinkToFit = function shrinkToFit(rect) {\n if (this.level === 0) {\n if (rect.x.contains(0) || rect.y.contains(0)) return this.id;\n }\n var ijSize = sizeIJ(this.level);\n if (rect.x.contains(stToUV(siTiToST(2 * this.iLo + ijSize))) || rect.y.contains(stToUV(siTiToST(2 * this.jLo + ijSize)))) {\n return this.id;\n }\n var padded = rect.expandedByMargin(this.padding + 1.5 * DBL_EPSILON$1);\n var iMin = this.iLo;\n var jMin = this.jLo;\n var iXor = 0;\n var jXor = 0;\n if (iMin < stToIJ(uvToST(padded.x.lo))) {\n iMin = stToIJ(uvToST(padded.x.lo));\n }\n if (this.iLo + ijSize - 1 <= stToIJ(uvToST(padded.x.hi))) {\n iXor = iMin ^ this.iLo + ijSize - 1;\n } else {\n iXor = iMin ^ stToIJ(uvToST(padded.x.hi));\n }\n if (jMin < stToIJ(uvToST(padded.y.lo))) {\n jMin = stToIJ(uvToST(padded.y.lo));\n }\n if (this.jLo + ijSize - 1 <= stToIJ(uvToST(padded.y.hi))) {\n jXor = jMin ^ this.jLo + ijSize - 1;\n } else {\n jXor = jMin ^ stToIJ(uvToST(padded.y.hi));\n }\n var levelMSB = BigInt((iXor | jXor) << 1) + 1n;\n var level = MAX_LEVEL - findMSBSetNonZero64(levelMSB);\n if (level <= this.level) return this.id;\n return parent(fromFaceIJ(face$1(this.id), iMin, jMin), level);\n };\n return PaddedCell;\n}();\n\n/** The possible CellRelations for a ShapeIndex. */\nvar INDEXED = 0;\nvar SUBDIVIDED = 1;\nvar DISJOINT = 2;\nvar STALE = 0; // There are pending updates.\nvar FRESH = 2; // There are no pending updates.\n// CELL_PADDING defines the total error when clipping an edge which comes\n// from two sources:\n// (1) Clipping the original spherical edge to a cube face (the face edge).\n// The maximum error in this step is faceClipErrorUVCoord.\n// (2) Clipping the face edge to the u- or v-coordinate of a cell boundary.\n// The maximum error in this step is edgeClipErrorUVCoord.\n// Finally, since we encounter the same errors when clipping query edges, we\n// double the total error so that we only need to pad edges during indexing\n// and not at query time.\nvar CELL_PADDING = 2.0 * (FACE_CLIP_ERROR_UV_COORD + EDGE_CLIP_ERROR_UV_COORD);\n// CELL_SIZE_TO_LONG_EDGE_RATIO defines the cell size relative to the length of an\n// edge at which it is first considered to be long. Long edges do not\n// contribute toward the decision to subdivide a cell further. For example,\n// a value of 2.0 means that the cell must be at least twice the size of the\n// edge in order for that edge to be counted. There are two reasons for not\n// counting long edges: (1) such edges typically need to be propagated to\n// several children, which increases time and memory costs without much benefit,\n// and (2) in pathological cases, many long edges close together could force\n// subdivision to continue all the way to the leaf cell level.\nvar CELL_SIZE_TO_LONG_EDGE_RATIO = 1.0;\n/**\r\n * faceEdge represents an edge that has been projected onto a given face.\r\n */\nvar FaceEdge = /*#__PURE__*/function () {\n /**\r\n * Returns a new FaceEdge.\r\n * @category Constructors\r\n */\n function FaceEdge(shapeID, edgeID, maxLevel, hasInterior, a, b, edge) {\n if (shapeID === void 0) {\n shapeID = 0;\n }\n if (edgeID === void 0) {\n edgeID = 0;\n }\n if (maxLevel === void 0) {\n maxLevel = 0;\n }\n if (hasInterior === void 0) {\n hasInterior = false;\n }\n if (a === void 0) {\n a = new Point(0, 0);\n }\n if (b === void 0) {\n b = new Point(0, 0);\n }\n if (edge === void 0) {\n edge = new Edge(new Point$1(0, 0, 0), new Point$1(0, 0, 0));\n }\n this.shapeID = shapeID;\n this.edgeID = edgeID;\n this.maxLevel = maxLevel;\n this.hasInterior = hasInterior;\n this.a = a;\n this.b = b;\n this.edge = edge;\n }\n var _proto = FaceEdge.prototype;\n _proto.copy = function copy() {\n return new FaceEdge(this.shapeID, this.edgeID, this.maxLevel, this.hasInterior, new Point(this.a.x, this.a.y), new Point(this.b.x, this.b.y), new Edge(Point$1.fromVector(this.edge.v0.vector), Point$1.fromVector(this.edge.v1.vector)));\n };\n return FaceEdge;\n}();\n/**\r\n * ClippedEdge represents the portion of that edge that has been clipped to a given Cell.\r\n */\nvar ClippedEdge =\n/**\r\n * Returns a new ClippedEdge.\r\n * @category Constructors\r\n */\nfunction ClippedEdge(faceEdge, bound) {\n this.faceEdge = faceEdge;\n this.bound = bound;\n};\nvar ShapeIndex = /*#__PURE__*/function () {\n /**\r\n * Creates a new ShapeIndex.\r\n * @category Constructors\r\n */\n function ShapeIndex() {\n var _this = this;\n /**\r\n * Returns an iterator for this index.\r\n */\n this.iterator = function () {\n _this.maybeApplyUpdates();\n return new ShapeIndexIterator(_this, ITERATOR_BEGIN);\n };\n /**\r\n * Positions the iterator at the first cell in the index.\r\n */\n this.begin = function () {\n _this.maybeApplyUpdates();\n return new ShapeIndexIterator(_this, ITERATOR_BEGIN);\n };\n /**\r\n * Positions the iterator at the last cell in the index.\r\n */\n this.end = function () {\n _this.maybeApplyUpdates();\n return new ShapeIndexIterator(_this, ITERATOR_END);\n };\n /**\r\n * Returns a new ShapeIndexRegion for this ShapeIndex.\r\n */\n this.region = function () {\n return new ShapeIndexRegion(_this, new ContainsPointQuery(_this, VERTEX_MODEL_SEMI_OPEN));\n };\n /**\r\n * Reports the number of Shapes in this index.\r\n */\n this.len = function () {\n return _this.shapes.size;\n };\n /**\r\n * Resets the index to its original state.\r\n */\n this.reset = function () {\n _this.shapes.clear();\n _this.nextID = 0;\n _this.cellMap.clear();\n _this.cells = [];\n _this.status = FRESH;\n };\n /**\r\n * Returns the number of edges in this index.\r\n */\n this.numEdges = function () {\n var numEdges = 0;\n _this.shapes.forEach(function (shape) {\n numEdges += shape.numEdges();\n });\n return numEdges;\n };\n /**\r\n * Returns the number of edges in the given index, up to the given\r\n * limit. If the limit is encountered, the current running total is returned,\r\n * which may be more than the limit.\r\n */\n this.numEdgesUpTo = function (limit) {\n var numEdges = 0;\n for (var i = 0; i <= _this.nextID; i++) {\n var s = _this.shape(i);\n if (s instanceof NilShape) continue;\n numEdges += s.numEdges();\n if (numEdges >= limit) break;\n }\n return numEdges;\n };\n /**\r\n * Returns the shape with the given ID, or undefined if the shape has been removed from the index.\r\n */\n this.shape = function (id) {\n return _this.shapes.get(id) || new NilShape();\n };\n /**\r\n * Returns the id of the given shape in this index, or -1 if it is\r\n * not in the index.\r\n */\n this.idForShape = function (shape) {\n for (var _iterator = _createForOfIteratorHelperLoose(_this.shapes.entries()), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n k = _step$value[0],\n v = _step$value[1];\n if (v === shape) return k;\n }\n return -1;\n };\n /**\r\n * Adds the given shape to the index and returns the assigned ID.\r\n */\n this.add = function (shape) {\n _this.shapes.set(_this.nextID, shape);\n _this.nextID++;\n _this.status = STALE;\n return _this.nextID - 1;\n };\n /**\r\n * Removes the given shape from the index.\r\n */\n this.remove = function (shape) {\n var id = _this.idForShape(shape);\n if (!_this.shapes.has(id)) return;\n _this.shapes[\"delete\"](id);\n if (id >= _this.pendingAdditionsPos) return;\n var numEdges = shape.numEdges();\n var removed = new RemovedShape(id, shape.dimension() === 2, shape.referencePoint().contained, new Array(numEdges));\n for (var e = 0; e < numEdges; e++) {\n removed.edges[e] = shape.edge(e);\n }\n _this.pendingRemovals.push(removed);\n _this.status = STALE;\n };\n /**\r\n * Triggers the update of the index. Calls to Add and Release are normally\r\n * queued and processed on the first subsequent query. This has many advantages,\r\n * the most important of which is that sometimes there *is* no subsequent\r\n * query, which lets us avoid building the index completely.\r\n *\r\n * This method forces any pending updates to be applied immediately.\r\n */\n this.build = function () {\n return _this.maybeApplyUpdates();\n };\n /**\r\n * Reports if there are no pending updates that need to be applied.\r\n * This can be useful to avoid building the index unnecessarily, or for\r\n * choosing between two different algorithms depending on whether the index\r\n * is available.\r\n *\r\n * The returned index status may be slightly out of date if the index was\r\n * built in a different thread. This is fine for the intended use (as an\r\n * efficiency hint), but it should not be used by internal methods.\r\n */\n this.isFresh = function () {\n return _this.status === FRESH;\n };\n /**\r\n * Reports if this is the first update to the index.\r\n */\n this.isFirstUpdate = function () {\n return _this.pendingAdditionsPos === 0;\n };\n /**\r\n * Reports if the shape with the given ID is currently slated for removal.\r\n */\n this.isShapeBeingRemoved = function (shapeID) {\n return shapeID < _this.pendingAdditionsPos;\n };\n /**\r\n * Checks if the index pieces have changed, and if so, applies pending updates.\r\n */\n this.maybeApplyUpdates = function () {\n if (_this.status !== FRESH) {\n _this.applyUpdatesInternal();\n _this.status = FRESH;\n }\n };\n /**\r\n * Does the actual work of updating the index by applying all\r\n * pending additions and removals. It does *not* update the indexes status.\r\n */\n this.applyUpdatesInternal = function () {\n var t = new ShapeIndexTracker();\n var allEdges = Array.from({\n length: 6\n }, function () {\n return [];\n });\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this.pendingRemovals), _step2; !(_step2 = _iterator2()).done;) {\n var p = _step2.value;\n _this.removeShapeInternal(p, allEdges, t);\n }\n for (var id = _this.pendingAdditionsPos; id < _this.shapes.size; id++) {\n _this.addShapeInternal(id, allEdges, t);\n }\n for (var _face = 0; _face < 6; _face++) {\n _this.updateFaceEdges(_face, allEdges[_face], t);\n }\n _this.pendingRemovals.length = 0;\n _this.pendingAdditionsPos = _this.shapes.size;\n // It is the caller's responsibility to update the index status.\n };\n /**\r\n * Clips all edges of the given shape to the six cube faces,\r\n * adds the clipped edges to the set of allEdges, and starts tracking its\r\n * interior if necessary.\r\n */\n this.addShapeInternal = function (shapeID, allEdges, t) {\n var shape = _this.shapes.get(shapeID) || new NilShape();\n if (shape instanceof NilShape) return;\n var faceEdge = new FaceEdge(shapeID, undefined, undefined, shape.dimension() === 2);\n if (faceEdge.hasInterior) {\n t.addShape(shapeID, containsBruteForce(shape, t.focus()));\n }\n var numEdges = shape.numEdges();\n for (var e = 0; e < numEdges; e++) {\n var edge = shape.edge(e);\n faceEdge.edgeID = e;\n faceEdge.edge = edge;\n faceEdge.maxLevel = maxLevelForEdge(edge);\n _this.addFaceEdge(faceEdge, allEdges);\n }\n };\n /**\r\n * Adds the given faceEdge into the collection of all edges.\r\n */\n this.addFaceEdge = function (_fe, allEdges) {\n var fe = _fe.copy();\n var aFace = face(fe.edge.v0.vector);\n if (aFace === face(fe.edge.v1.vector)) {\n var _validFaceXYZToUV = validFaceXYZToUV(aFace, fe.edge.v0.vector),\n x = _validFaceXYZToUV[0],\n y = _validFaceXYZToUV[1];\n fe.a = new Point(x, y);\n var _validFaceXYZToUV2 = validFaceXYZToUV(aFace, fe.edge.v1.vector);\n x = _validFaceXYZToUV2[0];\n y = _validFaceXYZToUV2[1];\n fe.b = new Point(x, y);\n var maxUV = 1 - CELL_PADDING;\n if (Math.abs(fe.a.x) <= maxUV && Math.abs(fe.a.y) <= maxUV && Math.abs(fe.b.x) <= maxUV && Math.abs(fe.b.y) <= maxUV) {\n allEdges[aFace].push(fe);\n return;\n }\n }\n for (var _face2 = 0; _face2 < 6; _face2++) {\n var _clipToPaddedFace = clipToPaddedFace(fe.edge.v0, fe.edge.v1, _face2, CELL_PADDING),\n aClip = _clipToPaddedFace[0],\n bClip = _clipToPaddedFace[1],\n intersects = _clipToPaddedFace[2];\n if (intersects) {\n var fe2 = _fe.copy();\n fe2.a = aClip;\n fe2.b = bClip;\n allEdges[_face2].push(fe2);\n }\n }\n };\n /**\r\n * Adds or removes the various edges from the index.\r\n * An edge is added if shapes[id] is not null, and removed otherwise.\r\n */\n this.updateFaceEdges = function (face, faceEdges, t) {\n var numEdges = faceEdges.length;\n if (numEdges === 0 && t.shapeIDs.length === 0) return;\n var clippedEdges = Array(numEdges);\n var bound = Rect.empty();\n for (var e = 0; e < numEdges; e++) {\n var clipped = new ClippedEdge(faceEdges[e], Rect.fromPoints(faceEdges[e].a, faceEdges[e].b));\n clippedEdges[e] = clipped;\n bound = bound.addRect(clipped.bound);\n }\n var faceID = fromFace(face);\n var pcell = PaddedCell.fromCellID(faceID, CELL_PADDING);\n var disjointFromIndex = _this.isFirstUpdate();\n if (numEdges > 0) {\n var shrunkID = _this.shrinkToFit(pcell, bound);\n if (shrunkID !== pcell.id) {\n // All the edges are contained by some descendant of the face cell. We\n // can save a lot of work by starting directly with that cell, but if we\n // are in the interior of at least one shape then we need to create\n // index entries for the cells we are skipping over.\n _this.skipCellRange(rangeMin(faceID), rangeMin(shrunkID), t, disjointFromIndex);\n pcell = PaddedCell.fromCellID(shrunkID, CELL_PADDING);\n _this.updateEdges(pcell, clippedEdges, t, disjointFromIndex);\n _this.skipCellRange(next(rangeMax(shrunkID)), next(rangeMax(faceID)), t, disjointFromIndex);\n return;\n }\n }\n _this.updateEdges(pcell, clippedEdges, t, disjointFromIndex);\n };\n /**\r\n * Shrinks the PaddedCell to fit within the given bounds.\r\n */\n this.shrinkToFit = function (pcell, bound) {\n var shrunkID = pcell.shrinkToFit(bound);\n if (!_this.isFirstUpdate() && shrunkID !== pcell.id) {\n // Don't shrink any smaller than the existing index cells, since we need\n // to combine the new edges with those cells.\n var iter = _this.iterator();\n if (iter.locateCellID(shrunkID) === INDEXED) {\n shrunkID = iter.cellID();\n }\n }\n return shrunkID;\n };\n /**\r\n * Skips over the cells in the given range, creating index cells if we are\r\n * currently in the interior of at least one shape.\r\n */\n this.skipCellRange = function (begin, end, t, disjointFromIndex) {\n if (t.shapeIDs.length === 0) return;\n var skipped = CellUnion.fromRange(begin, end);\n for (var _iterator3 = _createForOfIteratorHelperLoose(skipped), _step3; !(_step3 = _iterator3()).done;) {\n var cell = _step3.value;\n var ClippedEdges = [];\n _this.updateEdges(PaddedCell.fromCellID(cell, CELL_PADDING), ClippedEdges, t, disjointFromIndex);\n }\n };\n /**\r\n * Adds or removes the given edges whose bounding boxes intersect a\r\n * given cell. disjointFromIndex is an optimization hint indicating that cellMap\r\n * does not contain any entries that overlap the given cell.\r\n */\n this.updateEdges = function (pcell, edges, t, disjointFromIndex) {\n // This function is recursive with a maximum recursion depth of 30 (MaxLevel).\n // Incremental updates are handled as follows. All edges being added or\n // removed are combined together in edges, and all shapes with interiors\n // are tracked using tracker. We subdivide recursively as usual until we\n // encounter an existing index cell. At this point we absorb the index\n // cell as follows:\n //\n // - Edges and shapes that are being removed are deleted from edges and\n // tracker.\n // - All remaining edges and shapes from the index cell are added to\n // edges and tracker.\n // - Continue subdividing recursively, creating new index cells as needed.\n // - When the recursion gets back to the cell that was absorbed, we\n // restore edges and tracker to their previous state.\n //\n // Note that the only reason that we include removed shapes in the recursive\n // subdivision process is so that we can find all of the index cells that\n // contain those shapes efficiently, without maintaining an explicit list of\n // index cells for each shape (which would be expensive in terms of memory).\n var indexCellAbsorbed = false;\n if (!disjointFromIndex) {\n // There may be existing index cells contained inside pcell. If we\n // encounter such a cell, we need to combine the edges being updated with\n // the existing cell contents by absorbing the cell.\n var iter = _this.iterator();\n var r = iter.locateCellID(pcell.id);\n if (r === DISJOINT) disjointFromIndex = true;else if (r === INDEXED) {\n // Absorb the index cell by transferring its contents to edges and\n // deleting it. We also start tracking the interior of any new shapes.\n _this.absorbIndexCell(pcell, iter, edges, t);\n indexCellAbsorbed = true;\n disjointFromIndex = true;\n }\n }\n // If there are existing index cells below us, then we need to keep\n // subdividing so that we can merge with those cells. Otherwise,\n // makeIndexCell checks if the number of edges is small enough, and creates\n // an index cell if possible (returning true when it does so).\n if (!disjointFromIndex || !_this.makeIndexCell(pcell, edges, t)) {\n // TODO(roberts): If it turns out to have memory problems when there\n // are 10M+ edges in the index, look into pre-allocating space so we\n // are not always appending.\n var childEdges = [[[], []], [[], []]];\n // Compute the middle of the padded cell, defined as the rectangle in\n // (u,v)-space that belongs to all four (padded) children. By comparing\n // against the four boundaries of middle we can determine which children\n // each edge needs to be propagated to.\n var middle = pcell.middle();\n // Build up a vector edges to be passed to each child cell. The (i,j)\n // directions are left (i=0), right (i=1), lower (j=0), and upper (j=1).\n // Note that the vast majority of edges are propagated to a single child.\n for (var _iterator4 = _createForOfIteratorHelperLoose(edges), _step4; !(_step4 = _iterator4()).done;) {\n var edge = _step4.value;\n if (edge.bound.x.hi <= middle.x.lo) {\n // Edge is entirely contained in the two left children.\n var _this$clipVAxis = _this.clipVAxis(edge, middle.y),\n a = _this$clipVAxis[0],\n b = _this$clipVAxis[1];\n if (a) childEdges[0][0].push(a);\n if (b) childEdges[0][1].push(b);\n } else if (edge.bound.x.lo >= middle.x.hi) {\n // Edge is entirely contained in the two right children.\n var _this$clipVAxis2 = _this.clipVAxis(edge, middle.y),\n _a = _this$clipVAxis2[0],\n _b = _this$clipVAxis2[1];\n if (_a) childEdges[1][0].push(_a);\n if (_b) childEdges[1][1].push(_b);\n } else if (edge.bound.y.hi <= middle.y.lo) {\n // Edge is entirely contained in the two lower children.\n var _a2 = _this.clipUBound(edge, 1, middle.x.hi);\n if (_a2) childEdges[0][0].push(_a2);\n var _b2 = _this.clipUBound(edge, 0, middle.x.lo);\n if (_b2) childEdges[1][0].push(_b2);\n } else if (edge.bound.y.lo >= middle.y.hi) {\n // Edge is entirely contained in the two upper children.\n var _a3 = _this.clipUBound(edge, 1, middle.x.hi);\n if (_a3) childEdges[0][1].push(_a3);\n var _b3 = _this.clipUBound(edge, 0, middle.x.lo);\n if (_b3) childEdges[1][1].push(_b3);\n } else {\n // The edge bound spans all four children. The edge\n // itself intersects either three or four padded children.\n var left = _this.clipUBound(edge, 1, middle.x.hi);\n var _this$clipVAxis3 = _this.clipVAxis(left, middle.y),\n _a4 = _this$clipVAxis3[0],\n _b4 = _this$clipVAxis3[1];\n if (_a4) childEdges[0][0].push(_a4);\n if (_b4) childEdges[0][1].push(_b4);\n var right = _this.clipUBound(edge, 0, middle.x.lo);\n var _this$clipVAxis4 = _this.clipVAxis(right, middle.y);\n _a4 = _this$clipVAxis4[0];\n _b4 = _this$clipVAxis4[1];\n if (_a4) childEdges[1][0].push(_a4);\n if (_b4) childEdges[1][1].push(_b4);\n }\n }\n // Now recursively update the edges in each child. We call the children in\n // increasing order of CellID so that when the index is first constructed,\n // all insertions into cellMap are at the end (which is much faster).\n for (var pos = 0; pos < 4; pos++) {\n var _pcell$childIJ = pcell.childIJ(pos),\n i = _pcell$childIJ[0],\n j = _pcell$childIJ[1];\n if (childEdges[i][j].length > 0 || t.shapeIDs.length > 0) {\n _this.updateEdges(PaddedCell.fromParentIJ(pcell, i, j), childEdges[i][j], t, disjointFromIndex);\n }\n }\n }\n // Restore the state for any edges being removed that we are tracking.\n if (indexCellAbsorbed) t.restoreStateBefore(_this.pendingAdditionsPos);\n };\n /**\r\n * Builds an indexCell from the given padded cell and set of edges and adds\r\n * it to the index. If the cell or edges are empty, no cell is added.\r\n */\n this.makeIndexCell = function (p, edges, t) {\n if (edges.length === 0 && t.shapeIDs.length === 0) return true;\n var count = 0;\n for (var _iterator5 = _createForOfIteratorHelperLoose(edges), _step5; !(_step5 = _iterator5()).done;) {\n var ce = _step5.value;\n if (p.level < ce.faceEdge.maxLevel) count++;\n if (count > _this.maxEdgesPerCell) return false;\n }\n if (t.isActive && edges.length !== 0) {\n if (!t.atCellID(p.id)) t.moveTo(p.entryVertex());\n t.drawTo(p.center());\n _this.testAllEdges(edges, t);\n }\n var cshapeIDs = t.shapeIDs;\n var numShapes = _this.countShapes(edges, cshapeIDs);\n var cell = new ShapeIndexCell(numShapes);\n var eNext = 0;\n var cNextIdx = 0;\n for (var i = 0; i < numShapes; i++) {\n var clipped = void 0;\n var eshapeID = _this.shapes.size;\n var cshapeID = eshapeID;\n if (eNext !== edges.length) eshapeID = edges[eNext].faceEdge.shapeID;\n if (cNextIdx < cshapeIDs.length) cshapeID = cshapeIDs[cNextIdx];\n var eBegin = eNext;\n if (cshapeID < eshapeID) {\n clipped = new ShapeIndexClippedShape(cshapeID, 0);\n clipped.containsCenter = true;\n cNextIdx++;\n } else {\n while (eNext < edges.length && edges[eNext].faceEdge.shapeID === eshapeID) eNext++;\n clipped = new ShapeIndexClippedShape(eshapeID, eNext - eBegin);\n for (var e = eBegin; e < eNext; e++) clipped.edges[e - eBegin] = edges[e].faceEdge.edgeID;\n if (cshapeID === eshapeID) {\n clipped.containsCenter = true;\n cNextIdx++;\n }\n }\n cell.shapes[i] = clipped;\n }\n _this.cellMap.set(p.id, cell);\n _this.cells.push(p.id);\n if (t.isActive && edges.length !== 0) {\n t.drawTo(p.exitVertex());\n _this.testAllEdges(edges, t);\n t.setNextCellID(next(p.id));\n }\n return true;\n };\n /**\r\n * Updates the specified endpoint of the given clipped edge and returns the\r\n * resulting clipped edge.\r\n */\n this.updateBound = function (edge, uEnd, u, vEnd, v) {\n var c = new ClippedEdge(edge.faceEdge, new Rect());\n if (uEnd === 0) {\n c.bound.x.lo = u;\n c.bound.x.hi = edge.bound.x.hi;\n } else {\n c.bound.x.lo = edge.bound.x.lo;\n c.bound.x.hi = u;\n }\n if (vEnd === 0) {\n c.bound.y.lo = v;\n c.bound.y.hi = edge.bound.y.hi;\n } else {\n c.bound.y.lo = edge.bound.y.lo;\n c.bound.y.hi = v;\n }\n return c;\n };\n /**\r\n * Clips the given endpoint (lo=0, hi=1) of the u-axis so that\r\n * it does not extend past the given value of the given edge.\r\n */\n this.clipUBound = function (edge, uEnd, u) {\n if (uEnd === 0 && edge.bound.x.lo >= u) return edge;\n if (uEnd === 1 && edge.bound.x.hi <= u) return edge;\n var e = edge.faceEdge;\n var v = edge.bound.y.clampPoint(interpolateFloat64(u, e.a.x, e.b.x, e.a.y, e.b.y));\n var positiveSlope = e.a.x > e.b.x === e.a.y > e.b.y;\n var vEnd = uEnd === 1 === positiveSlope ? 1 : 0;\n return _this.updateBound(edge, uEnd, u, vEnd, v);\n };\n /**\r\n * Clips the given endpoint (lo=0, hi=1) of the v-axis so that\r\n * it does not extend past the given value of the given edge.\r\n */\n this.clipVBound = function (edge, vEnd, v) {\n if (vEnd === 0 && edge.bound.y.lo >= v) return edge;\n if (vEnd === 1 && edge.bound.y.hi <= v) return edge;\n var e = edge.faceEdge;\n var u = edge.bound.x.clampPoint(interpolateFloat64(v, e.a.y, e.b.y, e.a.x, e.b.x));\n var positiveSlope = e.a.x > e.b.x === e.a.y > e.b.y;\n var uEnd = vEnd === 1 === positiveSlope ? 1 : 0;\n return _this.updateBound(edge, uEnd, u, vEnd, v);\n };\n /**\r\n * Returns the given edge clipped to within the boundaries of the middle\r\n * interval along the v-axis, and adds the result to its children.\r\n */\n this.clipVAxis = function (edge, middle) {\n if (edge.bound.y.hi <= middle.lo) return [edge, undefined];\n if (edge.bound.y.lo >= middle.hi) return [undefined, edge];\n return [_this.clipVBound(edge, 1, middle.hi), _this.clipVBound(edge, 0, middle.lo)];\n };\n /**\r\n * Absorbs an index cell by transferring its contents to edges\r\n * and/or \"tracker\", and then delete this cell from the index. If edges includes\r\n * any edges that are being removed, this method also updates their\r\n * InteriorTracker state to correspond to the exit vertex of this cell.\r\n */\n this.absorbIndexCell = function (p, iter, edges, t) {\n if (t.isActive && edges.length !== 0 && _this.isShapeBeingRemoved(edges[0].faceEdge.shapeID)) {\n if (!t.atCellID(p.id)) t.moveTo(p.entryVertex());\n t.drawTo(p.exitVertex());\n t.setNextCellID(next(p.id));\n for (var _iterator6 = _createForOfIteratorHelperLoose(edges), _step6; !(_step6 = _iterator6()).done;) {\n var edge = _step6.value;\n var fe = edge.faceEdge;\n if (!_this.isShapeBeingRemoved(fe.shapeID)) break;\n if (fe.hasInterior) t.testEdge(fe.shapeID, fe.edge);\n }\n }\n t.saveAndClearStateBefore(_this.pendingAdditionsPos);\n var faceEdges = [];\n var trackerMoved = false;\n var cell = iter.indexCell();\n if (cell) {\n for (var _iterator7 = _createForOfIteratorHelperLoose(cell.shapes), _step7; !(_step7 = _iterator7()).done;) {\n var clipped = _step7.value;\n var shapeID = clipped.shapeID;\n var shape = _this.shape(shapeID);\n if (!shape) continue;\n var numClipped = clipped.numEdges();\n var _edge = new FaceEdge(shapeID, undefined, undefined, shape.dimension() === 2);\n if (_edge.hasInterior) {\n t.addShape(shapeID, clipped.containsCenter);\n if (!trackerMoved && numClipped > 0) {\n t.moveTo(p.center());\n t.drawTo(p.entryVertex());\n t.setNextCellID(p.id);\n trackerMoved = true;\n }\n }\n for (var i = 0; i < numClipped; i++) {\n var edgeID = clipped.edges[i];\n _edge.edgeID = edgeID;\n _edge.edge = shape.edge(edgeID);\n _edge.maxLevel = maxLevelForEdge(_edge.edge);\n if (_edge.hasInterior) t.testEdge(shapeID, _edge.edge);\n var _clipToPaddedFace2 = clipToPaddedFace(_edge.edge.v0, _edge.edge.v1, face$1(p.id), CELL_PADDING),\n a = _clipToPaddedFace2[0],\n b = _clipToPaddedFace2[1],\n ok = _clipToPaddedFace2[2];\n if (!ok) throw new Error('invariant failure in ShapeIndex');\n _edge.a = a;\n _edge.b = b;\n faceEdges.push(_edge);\n }\n }\n }\n var newEdges = faceEdges.map(function (faceEdge) {\n return new ClippedEdge(faceEdge, clippedEdgeBound(faceEdge.a, faceEdge.b, p.bound()));\n });\n for (var _iterator8 = _createForOfIteratorHelperLoose(edges), _step8; !(_step8 = _iterator8()).done;) {\n var _clipped = _step8.value;\n if (!_this.isShapeBeingRemoved(_clipped.faceEdge.shapeID)) {\n newEdges.push.apply(newEdges, edges.slice(edges.indexOf(_clipped)));\n break;\n }\n }\n edges = newEdges;\n _this.cellMap[\"delete\"](p.id);\n };\n /**\r\n * Calls the trackers testEdge on all edges from shapes that have interiors.\r\n */\n this.testAllEdges = function (edges, t) {\n for (var _iterator9 = _createForOfIteratorHelperLoose(edges), _step9; !(_step9 = _iterator9()).done;) {\n var edge = _step9.value;\n if (edge.faceEdge.hasInterior) t.testEdge(edge.faceEdge.shapeID, edge.faceEdge.edge);\n }\n };\n /**\r\n * Reports the number of distinct shapes that are either associated with the\r\n * given edges, or that are currently stored in the InteriorTracker.\r\n */\n this.countShapes = function (edges, shapeIDs) {\n var count = 0;\n var lastShapeID = -1;\n var clippedNext = 0;\n var shapeIDidx = 0;\n for (var _iterator0 = _createForOfIteratorHelperLoose(edges), _step0; !(_step0 = _iterator0()).done;) {\n var edge = _step0.value;\n if (edge.faceEdge.shapeID === lastShapeID) continue;\n count++;\n lastShapeID = edge.faceEdge.shapeID;\n while (shapeIDidx < shapeIDs.length) {\n clippedNext = shapeIDs[shapeIDidx];\n if (clippedNext > lastShapeID) break;\n if (clippedNext < lastShapeID) count++;\n shapeIDidx++;\n }\n }\n count += shapeIDs.length - shapeIDidx;\n return count;\n };\n this.maxEdgesPerCell = 10;\n this.nextID = 0;\n this.shapes = new Map();\n this.cellMap = new Map();\n this.cells = [];\n this.status = FRESH;\n this.pendingAdditionsPos = 0;\n this.pendingRemovals = [];\n }\n /** Does the actual work for removing a given shape from the index. */\n var _proto2 = ShapeIndex.prototype;\n _proto2.removeShapeInternal = function removeShapeInternal(_removed, _allEdges, _t) {\n // not implemented\n };\n return ShapeIndex;\n}();\n/**\r\n * Reports the maximum level for a given edge.\r\n */\nvar maxLevelForEdge = function maxLevelForEdge(edge) {\n var cellSize = edge.v0.vector.sub(edge.v1.vector).norm() * CELL_SIZE_TO_LONG_EDGE_RATIO;\n return AvgEdgeMetric.minLevel(cellSize);\n};\n/**\r\n * Represents a set of edges from the given shape that is queued for removal.\r\n */\nvar RemovedShape =\n/**\r\n * Returns a new RemovedShape.\r\n * @category Constructors\r\n */\nfunction RemovedShape(shapeID, hasInterior, containsTrackerOrigin, edges) {\n this.shapeID = shapeID;\n this.hasInterior = hasInterior;\n this.containsTrackerOrigin = containsTrackerOrigin;\n this.edges = edges;\n};\n\n/**\r\n * Returns an empty result indicating no edge was found.\r\n */\nfunction emptyClosestEdgeQueryResult() {\n return {\n distance: infChordAngle(),\n shapeID: -1,\n edgeID: -1\n };\n}\n/**\r\n * Compares two results first by distance, then by (shapeID, edgeID).\r\n */\nfunction compareResults(a, b) {\n if (a.distance < b.distance) return -1;\n if (a.distance > b.distance) return 1;\n if (a.shapeID < b.shapeID) return -1;\n if (a.shapeID > b.shapeID) return 1;\n if (a.edgeID < b.edgeID) return -1;\n if (a.edgeID > b.edgeID) return 1;\n return 0;\n}\n/**\r\n * Options that control the set of edges returned. Note that by default\r\n * *all* edges are returned, so you will always want to set either the\r\n * maxResults option or the maxDistance option (or both).\r\n */\nvar ClosestEdgeQueryOptions = /*#__PURE__*/function () {\n function ClosestEdgeQueryOptions() {\n /**\r\n * Specifies that at most \"maxResults\" edges should be returned.\r\n * Default: Infinity (no limit)\r\n */\n this.maxResults = Infinity;\n /**\r\n * Specifies that only edges whose distance to the target is less than\r\n * \"maxDistance\" should be returned.\r\n *\r\n * Note that edges whose distance is exactly equal to \"maxDistance\" are\r\n * not returned. Normally this doesn't matter, because distances are not\r\n * computed exactly in the first place, but if such edges are needed then\r\n * see setInclusiveMaxDistance() below.\r\n *\r\n * Default: Infinity\r\n */\n this.maxDistance = infChordAngle();\n /**\r\n * Specifies that edges up to maxError further away than the true\r\n * closest edges may be substituted in the result set, as long as such\r\n * edges satisfy all the remaining search criteria (such as maxDistance).\r\n * This option only has an effect if maxResults is also specified;\r\n * otherwise all edges closer than maxDistance will always be returned.\r\n *\r\n * Default: 0\r\n */\n this.maxError = 0;\n /**\r\n * Specifies that polygon interiors should be included when measuring\r\n * distances. If true, the distance to a point inside a polygon is zero.\r\n *\r\n * Default: true\r\n */\n this.includeInteriors = true;\n /**\r\n * Specifies that distances should be computed by examining every edge\r\n * rather than using the ShapeIndex. This is useful for testing and\r\n * debugging, and also for very small indexes where the overhead of\r\n * building the index is not worthwhile.\r\n *\r\n * Default: false\r\n */\n this.useBruteForce = false;\n }\n /**\r\n * Sets maxDistance to the given value such that edges whose distance\r\n * is exactly equal to maxDistance are also returned.\r\n * Equivalent to setting maxDistance to maxDistance.successor().\r\n */\n var _proto = ClosestEdgeQueryOptions.prototype;\n _proto.setInclusiveMaxDistance = function setInclusiveMaxDistance(maxDistance) {\n this.maxDistance = successor(maxDistance);\n }\n /**\r\n * Sets maxDistance such that edges whose true distance is less than\r\n * or equal to maxDistance will be returned (along with some edges whose\r\n * true distance is slightly greater).\r\n *\r\n * This ensures that all edges whose true distance is less than or equal\r\n * to maxDistance will be returned. The maxDistance is increased by the\r\n * maximum error in the distance calculation.\r\n */;\n _proto.setConservativeMaxDistance = function setConservativeMaxDistance(maxDistance) {\n this.maxDistance = successor(expanded(maxDistance, minUpdateDistanceMaxError(maxDistance)));\n }\n /**\r\n * Creates a copy of these options.\r\n */;\n _proto.clone = function clone() {\n var copy = new ClosestEdgeQueryOptions();\n copy.maxResults = this.maxResults;\n copy.maxDistance = this.maxDistance;\n copy.maxError = this.maxError;\n copy.includeInteriors = this.includeInteriors;\n copy.useBruteForce = this.useBruteForce;\n return copy;\n };\n return ClosestEdgeQueryOptions;\n}();\n/**\r\n * Target subtype that computes the closest distance to a point.\r\n */\nvar PointTarget = /*#__PURE__*/function () {\n function PointTarget(point) {\n this._includeInteriors = true;\n this.point = point;\n }\n var _proto2 = PointTarget.prototype;\n _proto2.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n // Break-even points are approximately 80, 100, and 250 edges for point\n // cloud, fractal, and regular loop geometry respectively.\n return 120;\n };\n _proto2.updateMinDistanceToEdge = function updateMinDistanceToEdge(v0, v1, minDist) {\n var result = updateMinDistance(this.point, v0, v1, minDist);\n return {\n distance: result.dist,\n updated: result.less\n };\n };\n _proto2.updateMinDistanceToPoint = function updateMinDistanceToPoint(point, minDist) {\n var dist = Point$1.chordAngleBetweenPoints(this.point, point);\n if (dist < minDist) {\n return {\n distance: dist,\n updated: true\n };\n }\n return {\n distance: minDist,\n updated: false\n };\n };\n _proto2.updateMinDistanceToCell = function updateMinDistanceToCell(cell, minDist) {\n var dist = cell.distance(this.point);\n if (dist < minDist) {\n return {\n distance: dist,\n updated: true\n };\n }\n return {\n distance: minDist,\n updated: false\n };\n };\n _proto2.includeInteriors = function includeInteriors() {\n return this._includeInteriors;\n };\n _proto2.setIncludeInteriors = function setIncludeInteriors(includeInteriors) {\n this._includeInteriors = includeInteriors;\n };\n _proto2.setMaxError = function setMaxError(_maxError) {\n return false;\n };\n _proto2.visitContainingShapeIds = function visitContainingShapeIds(index, visitor) {\n var _this = this;\n var query = new ContainsPointQuery(index, VERTEX_MODEL_SEMI_OPEN);\n return query.visitContainingShapes(this.point, function (shape) {\n var shapeID = index.idForShape(shape);\n if (shapeID >= 0) {\n return visitor(shapeID, _this.point);\n }\n return true;\n });\n };\n _proto2.getCapBound = function getCapBound() {\n return {\n center: this.point,\n radius: 0\n };\n };\n return PointTarget;\n}();\n/**\r\n * Target subtype that computes the closest distance to an edge.\r\n */\nvar EdgeTarget = /*#__PURE__*/function () {\n function EdgeTarget(a, b) {\n this._includeInteriors = true;\n this.a = a;\n this.b = b;\n }\n var _proto3 = EdgeTarget.prototype;\n _proto3.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n // Break-even points are approximately 40, 50, and 100 edges.\n return 60;\n };\n _proto3.updateMinDistanceToEdge = function updateMinDistanceToEdge(v0, v1, minDist) {\n // Compute edge-to-edge distance.\n return updateEdgePairMinDistance(this.a, this.b, v0, v1, minDist);\n };\n _proto3.updateMinDistanceToPoint = function updateMinDistanceToPoint(point, minDist) {\n var result = updateMinDistance(point, this.a, this.b, minDist);\n return {\n distance: result.dist,\n updated: result.less\n };\n };\n _proto3.updateMinDistanceToCell = function updateMinDistanceToCell(cell, minDist) {\n var dist = cell.distanceToEdge(this.a, this.b);\n if (dist < minDist) {\n return {\n distance: dist,\n updated: true\n };\n }\n return {\n distance: minDist,\n updated: false\n };\n };\n _proto3.includeInteriors = function includeInteriors() {\n return this._includeInteriors;\n };\n _proto3.setIncludeInteriors = function setIncludeInteriors(includeInteriors) {\n this._includeInteriors = includeInteriors;\n };\n _proto3.setMaxError = function setMaxError(_maxError) {\n return false;\n };\n _proto3.visitContainingShapeIds = function visitContainingShapeIds(index, visitor) {\n // Check if either endpoint is contained.\n var query = new ContainsPointQuery(index, VERTEX_MODEL_SEMI_OPEN);\n var visited = new Set();\n var _loop = function _loop() {\n var point = _arr[_i];\n var result = query.visitContainingShapes(point, function (shape) {\n var shapeID = index.idForShape(shape);\n if (shapeID >= 0 && !visited.has(shapeID)) {\n visited.add(shapeID);\n return visitor(shapeID, point);\n }\n return true;\n });\n if (!result) return {\n v: false\n };\n },\n _ret;\n for (var _i = 0, _arr = [this.a, this.b]; _i < _arr.length; _i++) {\n _ret = _loop();\n if (_ret) return _ret.v;\n }\n return true;\n };\n _proto3.getCapBound = function getCapBound() {\n // Return cap centered at midpoint with radius to cover both endpoints.\n var mid = Point$1.fromVector(this.a.vector.add(this.b.vector).normalize());\n var radius = Math.max(Point$1.chordAngleBetweenPoints(mid, this.a), Point$1.chordAngleBetweenPoints(mid, this.b));\n return {\n center: mid,\n radius: radius\n };\n };\n return EdgeTarget;\n}();\n/**\r\n * Target subtype that computes the closest distance to an S2Cell\r\n * (including the interior of the cell).\r\n */\nvar CellTarget = /*#__PURE__*/function () {\n function CellTarget(cell) {\n this._includeInteriors = true;\n this.cell = cell;\n }\n var _proto4 = CellTarget.prototype;\n _proto4.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n // Break-even points are approximately 20, 25, and 40 edges.\n return 30;\n };\n _proto4.updateMinDistanceToEdge = function updateMinDistanceToEdge(v0, v1, minDist) {\n var dist = this.cell.distanceToEdge(v0, v1);\n if (dist < minDist) {\n return {\n distance: dist,\n updated: true\n };\n }\n return {\n distance: minDist,\n updated: false\n };\n };\n _proto4.updateMinDistanceToPoint = function updateMinDistanceToPoint(point, minDist) {\n var dist = this.cell.distance(point);\n if (dist < minDist) {\n return {\n distance: dist,\n updated: true\n };\n }\n return {\n distance: minDist,\n updated: false\n };\n };\n _proto4.updateMinDistanceToCell = function updateMinDistanceToCell(cell, minDist) {\n var dist = this.cell.distanceToCell(cell);\n if (dist < minDist) {\n return {\n distance: dist,\n updated: true\n };\n }\n return {\n distance: minDist,\n updated: false\n };\n };\n _proto4.includeInteriors = function includeInteriors() {\n return this._includeInteriors;\n };\n _proto4.setIncludeInteriors = function setIncludeInteriors(includeInteriors) {\n this._includeInteriors = includeInteriors;\n };\n _proto4.setMaxError = function setMaxError(_maxError) {\n return false;\n };\n _proto4.visitContainingShapeIds = function visitContainingShapeIds(index, visitor) {\n // Check if the cell center is contained.\n var query = new ContainsPointQuery(index, VERTEX_MODEL_SEMI_OPEN);\n var center = this.cell.center();\n return query.visitContainingShapes(center, function (shape) {\n var shapeID = index.idForShape(shape);\n if (shapeID >= 0) {\n return visitor(shapeID, center);\n }\n return true;\n });\n };\n _proto4.getCapBound = function getCapBound() {\n var center = this.cell.center();\n // Use max distance from center to any vertex as radius.\n var radius = 0;\n for (var i = 0; i < 4; i++) {\n var d = Point$1.chordAngleBetweenPoints(center, this.cell.vertex(i));\n if (d > radius) radius = d;\n }\n return {\n center: center,\n radius: radius\n };\n };\n return CellTarget;\n}();\n/**\r\n * Target subtype that computes the closest distance to an S2ShapeIndex\r\n * (an arbitrary collection of points, polylines, and/or polygons).\r\n *\r\n * By default, distances are measured to the boundary and interior of\r\n * polygons in the S2ShapeIndex rather than to polygon boundaries only.\r\n * If you wish to change this behavior, you may call:\r\n *\r\n * target.setIncludeInteriors(false)\r\n */\nvar ShapeIndexTarget = /*#__PURE__*/function () {\n function ShapeIndexTarget(index) {\n this._includeInteriors = true;\n this.index = index;\n this.query = new ContainsPointQuery(index, VERTEX_MODEL_SEMI_OPEN);\n }\n var _proto5 = ShapeIndexTarget.prototype;\n _proto5.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n // Break-even points are approximately 20, 30, and 40 edges.\n return 25;\n };\n _proto5.updateMinDistanceToEdge = function updateMinDistanceToEdge(v0, v1, minDist) {\n // Check if either endpoint is contained by a polygon.\n if (this._includeInteriors) {\n if (this.query.contains(v0) || this.query.contains(v1)) {\n return {\n distance: 0,\n updated: minDist > 0\n };\n }\n }\n // Compute distance to all edges in the target index.\n var updated = false;\n for (var _iterator = _createForOfIteratorHelperLoose(this.index.shapes), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n shape = _step$value[1];\n if (!shape) continue;\n var numEdges = shape.numEdges();\n for (var i = 0; i < numEdges; i++) {\n var edge = shape.edge(i);\n var result = updateEdgePairMinDistance(v0, v1, edge.v0, edge.v1, minDist);\n if (result.updated) {\n minDist = result.distance;\n updated = true;\n }\n if (minDist === 0) return {\n distance: 0,\n updated: updated\n };\n }\n }\n return {\n distance: minDist,\n updated: updated\n };\n };\n _proto5.updateMinDistanceToPoint = function updateMinDistanceToPoint(point, minDist) {\n // Check if the point is contained by a polygon.\n if (this._includeInteriors && this.query.contains(point)) {\n return {\n distance: 0,\n updated: minDist > 0\n };\n }\n // Compute distance to all edges in the target index.\n var updated = false;\n for (var _iterator2 = _createForOfIteratorHelperLoose(this.index.shapes), _step2; !(_step2 = _iterator2()).done;) {\n var _step2$value = _step2.value,\n shape = _step2$value[1];\n if (!shape) continue;\n var numEdges = shape.numEdges();\n for (var i = 0; i < numEdges; i++) {\n var edge = shape.edge(i);\n var result = updateMinDistance(point, edge.v0, edge.v1, minDist);\n if (result.less) {\n minDist = result.dist;\n updated = true;\n }\n if (minDist === 0) return {\n distance: 0,\n updated: updated\n };\n }\n }\n return {\n distance: minDist,\n updated: updated\n };\n };\n _proto5.updateMinDistanceToCell = function updateMinDistanceToCell(cell, minDist) {\n // Check if the cell center is contained by a polygon.\n if (this._includeInteriors && this.query.contains(cell.center())) {\n return {\n distance: 0,\n updated: minDist > 0\n };\n }\n // Compute distance to all edges in the target index.\n var updated = false;\n for (var _iterator3 = _createForOfIteratorHelperLoose(this.index.shapes), _step3; !(_step3 = _iterator3()).done;) {\n var _step3$value = _step3.value,\n shape = _step3$value[1];\n if (!shape) continue;\n var numEdges = shape.numEdges();\n for (var i = 0; i < numEdges; i++) {\n var edge = shape.edge(i);\n var dist = cell.distanceToEdge(edge.v0, edge.v1);\n if (dist < minDist) {\n minDist = dist;\n updated = true;\n }\n if (minDist === 0) return {\n distance: 0,\n updated: updated\n };\n }\n }\n return {\n distance: minDist,\n updated: updated\n };\n };\n _proto5.includeInteriors = function includeInteriors() {\n return this._includeInteriors;\n };\n _proto5.setIncludeInteriors = function setIncludeInteriors(includeInteriors) {\n this._includeInteriors = includeInteriors;\n };\n _proto5.setMaxError = function setMaxError(_maxError) {\n return false;\n };\n _proto5.visitContainingShapeIds = function visitContainingShapeIds(index, visitor) {\n // For each shape in the query index, check if it contains any point\n // from the target index.\n var queryContains = new ContainsPointQuery(index, VERTEX_MODEL_SEMI_OPEN);\n var visited = new Set();\n // Check if target shapes contain any query shape centers.\n for (var _iterator4 = _createForOfIteratorHelperLoose(this.index.shapes), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n shape = _step4$value[1];\n if (!shape) continue;\n var numEdges = shape.numEdges();\n for (var i = 0; i < numEdges; i++) {\n var edge = shape.edge(i);\n var _loop2 = function _loop2() {\n var point = _arr2[_i2];\n var result = queryContains.visitContainingShapes(point, function (queryShape) {\n var id = index.idForShape(queryShape);\n if (id >= 0 && !visited.has(id)) {\n visited.add(id);\n return visitor(id, point);\n }\n return true;\n });\n if (!result) return {\n v: false\n };\n },\n _ret2;\n for (var _i2 = 0, _arr2 = [edge.v0, edge.v1]; _i2 < _arr2.length; _i2++) {\n _ret2 = _loop2();\n if (_ret2) return _ret2.v;\n }\n }\n }\n return true;\n };\n _proto5.getCapBound = function getCapBound() {\n // Return null if the index is empty.\n if (this.index.len() === 0) return null;\n // Compute bounding cap over all edges.\n var center = null;\n var radius = 0;\n for (var _iterator5 = _createForOfIteratorHelperLoose(this.index.shapes), _step5; !(_step5 = _iterator5()).done;) {\n var _step5$value = _step5.value,\n shape = _step5$value[1];\n if (!shape) continue;\n var numEdges = shape.numEdges();\n for (var i = 0; i < numEdges; i++) {\n var edge = shape.edge(i);\n if (center === null) {\n center = edge.v0;\n }\n var d0 = Point$1.chordAngleBetweenPoints(center, edge.v0);\n var d1 = Point$1.chordAngleBetweenPoints(center, edge.v1);\n radius = Math.max(radius, d0, d1);\n }\n }\n if (center === null) return null;\n return {\n center: center,\n radius: radius\n };\n };\n return ShapeIndexTarget;\n}();\n/**\r\n * Computes the minimum distance between two edges.\r\n */\nfunction updateEdgePairMinDistance(a0, a1, b0, b1, minDist) {\n if (minDist === 0) return {\n distance: 0,\n updated: false\n };\n if (crossingSign(a0, a1, b0, b1) === CROSS) {\n return {\n distance: 0,\n updated: true\n };\n }\n // Otherwise, the minimum distance is achieved at an endpoint of at least\n // one of the two edges.\n var updated = false;\n var result = updateMinDistance(a0, b0, b1, minDist);\n if (result.less) {\n minDist = result.dist;\n updated = true;\n }\n result = updateMinDistance(a1, b0, b1, minDist);\n if (result.less) {\n minDist = result.dist;\n updated = true;\n }\n result = updateMinDistance(b0, a0, a1, minDist);\n if (result.less) {\n minDist = result.dist;\n updated = true;\n }\n result = updateMinDistance(b1, a0, a1, minDist);\n if (result.less) {\n minDist = result.dist;\n updated = true;\n }\n return {\n distance: minDist,\n updated: updated\n };\n}\n/**\r\n * S2ClosestEdgeQuery is a helper class for searching within an S2ShapeIndex\r\n * to find the closest edge(s) to a given point, edge, S2Cell, or geometry\r\n * collection.\r\n */\nvar ClosestEdgeQuery = /*#__PURE__*/function () {\n /**\r\n * Constructs a new ClosestEdgeQuery for the given ShapeIndex.\r\n * Options may be specified here or changed at any time using the options property.\r\n *\r\n * REQUIRES: \"index\" must persist for the lifetime of this object.\r\n * REQUIRES: reInit() must be called if \"index\" is modified.\r\n */\n function ClosestEdgeQuery(index, options) {\n if (options === void 0) {\n options = new ClosestEdgeQueryOptions();\n }\n this.indexNumEdges = 0;\n this.indexNumEdgesLimit = 0;\n this.index = index;\n this.options = options;\n this.iter = index.iterator();\n }\n /**\r\n * Reinitializes the query. This method must be called whenever the\r\n * underlying S2ShapeIndex is modified.\r\n */\n var _proto6 = ClosestEdgeQuery.prototype;\n _proto6.reInit = function reInit() {\n this.indexNumEdges = 0;\n this.indexNumEdgesLimit = 0;\n this.iter = this.index.iterator();\n }\n /**\r\n * Returns the closest edges to the given target that satisfy the current\r\n * options. This method may be called multiple times.\r\n *\r\n * Note that if options.includeInteriors is true, the result vector may\r\n * include some entries with edgeID == -1. This indicates that the target\r\n * intersects the indexed polygon with the given shapeID. Such results may\r\n * be identified by calling isInteriorResult().\r\n */;\n _proto6.findClosestEdges = function findClosestEdges(target, filter) {\n return this.findClosestEdgesInternal(target, this.options, filter);\n }\n /**\r\n * Calls a callback with the closest edges to the given target that satisfy\r\n * the given options. Edges are reported in order of increasing distance.\r\n *\r\n * Updating the state that the ShapeFilter accesses while visiting is allowed\r\n * and can be used to disable reporting of results on the fly.\r\n */;\n _proto6.visitClosestEdges = function visitClosestEdges(target, options, visitor, filter) {\n var results = this.findClosestEdgesInternal(target, options, filter);\n for (var _iterator6 = _createForOfIteratorHelperLoose(results), _step6; !(_step6 = _iterator6()).done;) {\n var result = _step6.value;\n if (!visitor(result)) break;\n }\n }\n /**\r\n * Calls a callback with the closest edge of each shape to the given target\r\n * that satisfies the given options. Shapes are reported in order of\r\n * increasing distance.\r\n */;\n _proto6.visitClosestShapes = function visitClosestShapes(target, options, visitor, filter) {\n var results = this.findClosestEdgesInternal(target, options, filter);\n var seenShapes = new Set();\n var lastShape = -1;\n for (var _iterator7 = _createForOfIteratorHelperLoose(results), _step7; !(_step7 = _iterator7()).done;) {\n var result = _step7.value;\n var shapeID = result.shapeID;\n if (shapeID !== lastShape && !seenShapes.has(shapeID)) {\n seenShapes.add(shapeID);\n lastShape = shapeID;\n if (!visitor(result)) break;\n }\n }\n }\n /**\r\n * Returns the closest edge to the target. If no edge satisfies the search\r\n * criteria, then the result object's isEmptyResult() will return true.\r\n *\r\n * Note that if options.includeInteriors is true, isInteriorResult()\r\n * should be called to check whether the result represents an interior point\r\n * (in which case edgeID == -1).\r\n */;\n _proto6.findClosestEdge = function findClosestEdge(target, filter) {\n var tmpOptions = this.options.clone();\n tmpOptions.maxResults = 1;\n var results = this.findClosestEdgesInternal(target, tmpOptions, filter);\n if (results.length === 0) {\n return emptyClosestEdgeQueryResult();\n }\n return results[0];\n }\n /**\r\n * Returns the minimum distance to the target. If the index or target is\r\n * empty, returns Infinity.\r\n *\r\n * Use isDistanceLess() if you only want to compare the distance against a\r\n * threshold value, since it is often much faster.\r\n */;\n _proto6.getDistance = function getDistance(target, filter) {\n return this.findClosestEdge(target, filter).distance;\n }\n /**\r\n * Returns true if the distance to \"target\" is less than \"limit\".\r\n *\r\n * This method is usually much faster than getDistance(), since it is much\r\n * less work to determine whether the minimum distance is above or below a\r\n * threshold than it is to calculate the actual minimum distance.\r\n */;\n _proto6.isDistanceLess = function isDistanceLess(target, limit, filter) {\n var tmpOptions = this.options.clone();\n tmpOptions.maxResults = 1;\n tmpOptions.maxDistance = limit;\n tmpOptions.maxError = STRAIGHT_CHORDANGLE;\n var result = this.findClosestEdgesInternal(target, tmpOptions, filter);\n return result.length > 0;\n }\n /**\r\n * Like isDistanceLess(), but also returns true if the distance to \"target\"\r\n * is exactly equal to \"limit\".\r\n */;\n _proto6.isDistanceLessOrEqual = function isDistanceLessOrEqual(target, limit, filter) {\n var tmpOptions = this.options.clone();\n tmpOptions.maxResults = 1;\n tmpOptions.setInclusiveMaxDistance(limit);\n tmpOptions.maxError = STRAIGHT_CHORDANGLE;\n var result = this.findClosestEdgesInternal(target, tmpOptions, filter);\n return result.length > 0;\n }\n /**\r\n * Like isDistanceLessOrEqual(), except that \"limit\" is increased by the\r\n * maximum error in the distance calculation. This ensures that this\r\n * function returns true whenever the true, exact distance is less than\r\n * or equal to \"limit\".\r\n *\r\n * For example, suppose that we want to test whether two geometries might\r\n * intersect each other after they are snapped together using S2Builder\r\n * (using the IdentitySnapFunction with a given \"snap_radius\"). Since\r\n * S2Builder uses exact distance predicates (s2predicates.h), we need to\r\n * measure the distance between the two geometries conservatively. If the\r\n * distance is definitely greater than \"snap_radius\", then the geometries\r\n * are guaranteed to not intersect after snapping.\r\n */;\n _proto6.isConservativeDistanceLessOrEqual = function isConservativeDistanceLessOrEqual(target, limit, filter) {\n var tmpOptions = this.options.clone();\n tmpOptions.maxResults = 1;\n tmpOptions.setConservativeMaxDistance(limit);\n tmpOptions.maxError = STRAIGHT_CHORDANGLE;\n var result = this.findClosestEdgesInternal(target, tmpOptions, filter);\n return result.length > 0;\n }\n /**\r\n * Returns the endpoints of the given result edge.\r\n * REQUIRES: !isInteriorResult(result)\r\n */;\n _proto6.getEdge = function getEdge(result) {\n var shape = this.index.shape(result.shapeID);\n return shape.edge(result.edgeID);\n }\n /**\r\n * Returns the point on given result edge that is closest to \"point\".\r\n */;\n _proto6.project = function project$1(point, result) {\n if (result.edgeID < 0) return point;\n var edge = this.getEdge(result);\n return project(point, edge.v0, edge.v1);\n }\n /**\r\n * Internal method that performs the actual query.\r\n */;\n _proto6.findClosestEdgesInternal = function findClosestEdgesInternal(target, options, filter) {\n var distanceLimit = options.maxDistance;\n var results = [];\n if (distanceLimit === 0) return results;\n // Handle include_interiors case.\n if (options.includeInteriors) {\n var shapeIds = new Set();\n target.visitContainingShapeIds(this.index, function (shapeID, _point) {\n if (!filter || filter(shapeID)) {\n shapeIds.add(shapeID);\n }\n return shapeIds.size < options.maxResults;\n });\n for (var _iterator8 = _createForOfIteratorHelperLoose(shapeIds), _step8; !(_step8 = _iterator8()).done;) {\n var shapeID = _step8.value;\n results.push({\n distance: 0,\n shapeID: shapeID,\n edgeID: -1\n });\n }\n if (distanceLimit === 0) return results;\n }\n // Determine whether to use brute force or optimized algorithm.\n var minOptimizedEdges = target.maxBruteForceIndexSize() + 1;\n if (minOptimizedEdges > this.indexNumEdgesLimit && this.indexNumEdges >= this.indexNumEdgesLimit) {\n this.indexNumEdges = this.countEdgesUpTo(minOptimizedEdges);\n this.indexNumEdgesLimit = minOptimizedEdges;\n }\n if (options.useBruteForce || this.indexNumEdges < minOptimizedEdges) {\n this.findClosestEdgesBruteForce(target, options, filter, distanceLimit, results);\n } else {\n this.findClosestEdgesOptimized(target, options, filter, distanceLimit, results);\n }\n // Sort and limit results.\n results.sort(compareResults);\n // Remove duplicates.\n var uniqueResults = [];\n for (var _i3 = 0, _results = results; _i3 < _results.length; _i3++) {\n var result = _results[_i3];\n if (uniqueResults.length === 0 || uniqueResults[uniqueResults.length - 1].shapeID !== result.shapeID || uniqueResults[uniqueResults.length - 1].edgeID !== result.edgeID) {\n uniqueResults.push(result);\n }\n }\n // Apply maxResults limit.\n if (uniqueResults.length > options.maxResults) {\n uniqueResults.length = options.maxResults;\n }\n return uniqueResults;\n }\n /**\r\n * Brute force algorithm that examines every edge.\r\n */;\n _proto6.findClosestEdgesBruteForce = function findClosestEdgesBruteForce(target, options, filter, distanceLimit, results) {\n for (var _iterator9 = _createForOfIteratorHelperLoose(this.index.shapes), _step9; !(_step9 = _iterator9()).done;) {\n var _step9$value = _step9.value,\n shapeID = _step9$value[0],\n shape = _step9$value[1];\n if (!shape) continue;\n if (filter && !filter(shapeID)) continue;\n var numEdges = shape.numEdges();\n for (var edgeID = 0; edgeID < numEdges; edgeID++) {\n var edge = shape.edge(edgeID);\n var result = target.updateMinDistanceToEdge(edge.v0, edge.v1, distanceLimit);\n if (result.updated) {\n var newResult = {\n distance: result.distance,\n shapeID: shapeID,\n edgeID: edgeID\n };\n if (options.maxResults === 1) {\n // Keep only the single best result.\n if (results.length === 0) {\n results.push(newResult);\n } else {\n results[0] = newResult;\n }\n distanceLimit = result.distance - options.maxError;\n } else if (options.maxResults === Infinity) {\n // Keep all results.\n results.push(newResult);\n } else {\n // Keep up to maxResults results.\n results.push(newResult);\n if (results.length > options.maxResults) {\n results.sort(compareResults);\n results.length = options.maxResults;\n distanceLimit = results[results.length - 1].distance - options.maxError;\n }\n }\n }\n }\n }\n }\n /**\r\n * Optimized algorithm using priority queue and cell hierarchy.\r\n */;\n _proto6.findClosestEdgesOptimized = function findClosestEdgesOptimized(target, options, filter, distanceLimit, results) {\n // Get the target's bounding cap.\n var capBound = target.getCapBound();\n if (!capBound) return; // Empty target.\n // Initialize iterator.\n this.iter = this.index.iterator();\n // Optimization: if looking for just the closest edge and the cap center\n // happens to intersect an index cell, process that cell first.\n if (options.maxResults === 1 && this.iter.locatePoint(capBound.center)) {\n var cell = this.iter.indexCell();\n distanceLimit = this.processIndexCell(target, options, filter, cell, distanceLimit, results);\n if (distanceLimit === 0) return;\n }\n // Build priority queue of cells to process.\n var queue = [];\n // Start by adding all top-level cells that intersect the target.\n this.iter.begin();\n while (!this.iter.done()) {\n var id = this.iter.cellID();\n var _cell = Cell.fromCellID(id);\n var result = target.updateMinDistanceToCell(_cell, distanceLimit);\n if (result.distance < distanceLimit) {\n queue.push({\n distance: result.distance,\n id: id,\n indexCell: this.iter.indexCell()\n });\n }\n this.iter.next();\n }\n // Sort queue by distance (ascending).\n queue.sort(function (a, b) {\n return a.distance - b.distance;\n });\n // Process cells in order of increasing distance.\n while (queue.length > 0) {\n var entry = queue.shift();\n if (entry.distance >= distanceLimit) break;\n if (entry.indexCell !== null) {\n // This is an index cell; process its edges.\n distanceLimit = this.processIndexCell(target, options, filter, entry.indexCell, distanceLimit, results);\n } else {\n // This is a parent cell; add its children to the queue.\n console.log(\"HEYYYY\");\n var childIds = children(entry.id);\n for (var _iterator0 = _createForOfIteratorHelperLoose(childIds), _step0; !(_step0 = _iterator0()).done;) {\n var childId = _step0.value;\n var relation = this.iter.locateCellID(childId);\n if (relation === INDEXED) {\n var _cell2 = Cell.fromCellID(this.iter.cellID());\n var _result = target.updateMinDistanceToCell(_cell2, distanceLimit);\n if (_result.distance < distanceLimit) {\n queue.push({\n distance: _result.distance,\n id: this.iter.cellID(),\n indexCell: this.iter.indexCell()\n });\n }\n } else if (relation === SUBDIVIDED) {\n var _cell3 = Cell.fromCellID(childId);\n var _result2 = target.updateMinDistanceToCell(_cell3, distanceLimit);\n if (_result2.distance < distanceLimit) {\n queue.push({\n distance: _result2.distance,\n id: childId,\n indexCell: null\n });\n }\n }\n }\n // Re-sort queue.\n queue.sort(function (a, b) {\n return a.distance - b.distance;\n });\n }\n }\n }\n /**\r\n * Process all edges in an index cell.\r\n */;\n _proto6.processIndexCell = function processIndexCell(target, options, filter, indexCell, distanceLimit, results) {\n for (var _iterator1 = _createForOfIteratorHelperLoose(indexCell.shapes), _step1; !(_step1 = _iterator1()).done;) {\n var clipped = _step1.value;\n var shapeID = clipped.shapeID;\n if (filter && !filter(shapeID)) continue;\n var shape = this.index.shape(shapeID);\n if (!shape) continue;\n for (var _iterator10 = _createForOfIteratorHelperLoose(clipped.edges), _step10; !(_step10 = _iterator10()).done;) {\n var edgeID = _step10.value;\n var edge = shape.edge(edgeID);\n var result = target.updateMinDistanceToEdge(edge.v0, edge.v1, distanceLimit);\n if (result.updated) {\n var newResult = {\n distance: result.distance,\n shapeID: shapeID,\n edgeID: edgeID\n };\n if (options.maxResults === 1) {\n if (results.length === 0) {\n results.push(newResult);\n } else {\n results[0] = newResult;\n }\n distanceLimit = result.distance - options.maxError;\n } else if (options.maxResults === Infinity) {\n results.push(newResult);\n } else {\n results.push(newResult);\n if (results.length > options.maxResults) {\n results.sort(compareResults);\n results.length = options.maxResults;\n distanceLimit = results[results.length - 1].distance - options.maxError;\n }\n }\n }\n }\n }\n return distanceLimit;\n }\n /**\r\n * Counts edges in the index up to a limit.\r\n */;\n _proto6.countEdgesUpTo = function countEdgesUpTo(limit) {\n var count = 0;\n for (var _iterator11 = _createForOfIteratorHelperLoose(this.index.shapes), _step11; !(_step11 = _iterator11()).done;) {\n var _step11$value = _step11.value,\n shape = _step11$value[1];\n if (!shape) continue;\n count += shape.numEdges();\n if (count >= limit) break;\n }\n return count;\n };\n return ClosestEdgeQuery;\n}();\n\n/**\r\n * Returns an empty result indicating no cell was found.\r\n */\nfunction emptyClosestCellQueryResult() {\n return {\n distance: infChordAngle(),\n cellID: 0n,\n label: -1\n };\n}\n/**\r\n * Reports whether the result is empty (no cell was found).\r\n */\nfunction isEmptyResult(result) {\n return result.label < 0;\n}\n/**\r\n * Options that control the set of cells returned. Note that by default\r\n * *all* cells are returned, so you will always want to set either the\r\n * maxResults option or the maxDistance option (or both).\r\n */\nvar ClosestCellQueryOptions = /*#__PURE__*/function () {\n function ClosestCellQueryOptions() {\n /**\r\n * Specifies that at most \"maxResults\" cells should be returned.\r\n * Default: Infinity (no limit)\r\n */\n this.maxResults = Infinity;\n /**\r\n * Specifies that only cells whose distance to the target is less than\r\n * \"maxDistance\" should be returned.\r\n *\r\n * Note that cells whose distance is exactly equal to \"maxDistance\" are\r\n * not returned. Normally this doesn't matter, because distances are not\r\n * computed exactly in the first place, but if such cells are needed then\r\n * see setInclusiveMaxDistance() below.\r\n *\r\n * Default: Infinity\r\n */\n this.maxDistance = infChordAngle();\n /**\r\n * Specifies that cells up to maxError further away than the true\r\n * closest cells may be substituted in the result set, as long as such\r\n * cells satisfy all the remaining search criteria (such as maxDistance).\r\n * This option only has an effect if maxResults is also specified;\r\n * otherwise all cells closer than maxDistance will always be returned.\r\n *\r\n * Default: 0\r\n */\n this.maxError = 0;\n }\n /**\r\n * Sets maxDistance to the given value such that cells whose distance\r\n * is exactly equal to maxDistance are also returned.\r\n * Equivalent to setting maxDistance to maxDistance.successor().\r\n */\n var _proto = ClosestCellQueryOptions.prototype;\n _proto.setInclusiveMaxDistance = function setInclusiveMaxDistance(maxDistance) {\n this.maxDistance = successor(maxDistance);\n }\n /**\r\n * Sets maxDistance such that cells whose true distance is less than\r\n * or equal to maxDistance will be returned (along with some cells whose\r\n * true distance is slightly greater).\r\n *\r\n * This ensures that all cells whose true distance is less than or equal\r\n * to maxDistance will be returned. The maxDistance is increased by the\r\n * maximum error in the distance calculation.\r\n */;\n _proto.setConservativeMaxDistance = function setConservativeMaxDistance(maxDistance) {\n this.maxDistance = successor(expanded(maxDistance, this.computeMaxDistanceError(maxDistance)));\n }\n /**\r\n * Computes the maximum error for the given distance.\r\n */;\n _proto.computeMaxDistanceError = function computeMaxDistanceError(distance) {\n // The maximum error depends on the distance computation method.\n // For now, return a conservative estimate.\n return maxPointError(distance);\n };\n return ClosestCellQueryOptions;\n}();\n/**\r\n * Target subtype that computes the closest distance to a point.\r\n */\nvar PointTarget$1 = /*#__PURE__*/function () {\n function PointTarget(point) {\n this.point = point;\n }\n var _proto2 = PointTarget.prototype;\n _proto2.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n return 100;\n };\n _proto2.distanceToCell = function distanceToCell(cell) {\n return cell.distance(this.point);\n };\n _proto2.distanceToPoint = function distanceToPoint(point) {\n return Point$1.chordAngleBetweenPoints(this.point, point);\n };\n return PointTarget;\n}();\n/**\r\n * Target subtype that computes the closest distance to an edge.\r\n */\nvar EdgeTarget$1 = /*#__PURE__*/function () {\n function EdgeTarget(a, b) {\n this.a = a;\n this.b = b;\n }\n var _proto3 = EdgeTarget.prototype;\n _proto3.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n return 100;\n };\n _proto3.distanceToCell = function distanceToCell(cell) {\n return cell.distanceToEdge(this.a, this.b);\n };\n _proto3.distanceToPoint = function distanceToPoint(point) {\n return updateMinDistance(point, this.a, this.b, infChordAngle()).dist;\n };\n return EdgeTarget;\n}();\n/**\r\n * Target subtype that computes the closest distance to an S2Cell\r\n * (including the interior of the cell).\r\n */\nvar CellTarget$1 = /*#__PURE__*/function () {\n function CellTarget(cell) {\n this.cell = cell;\n }\n var _proto4 = CellTarget.prototype;\n _proto4.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n return 100;\n };\n _proto4.distanceToCell = function distanceToCell(cell) {\n return this.cell.distanceToCell(cell);\n };\n _proto4.distanceToPoint = function distanceToPoint(point) {\n return this.cell.distance(point);\n };\n return CellTarget;\n}();\n/**\r\n * Target subtype that computes the closest distance to an S2CellUnion.\r\n */\nvar CellUnionTarget = /*#__PURE__*/function () {\n function CellUnionTarget(cellUnion) {\n this.cellUnion = cellUnion;\n }\n var _proto5 = CellUnionTarget.prototype;\n _proto5.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n return 100;\n };\n _proto5.distanceToCell = function distanceToCell(cell) {\n var minDist = infChordAngle();\n for (var _iterator = _createForOfIteratorHelperLoose(this.cellUnion), _step; !(_step = _iterator()).done;) {\n var id = _step.value;\n var unionCell = Cell.fromCellID(id);\n var dist = unionCell.distanceToCell(cell);\n if (dist < minDist) {\n minDist = dist;\n }\n if (minDist === 0) break;\n }\n return minDist;\n };\n _proto5.distanceToPoint = function distanceToPoint(point) {\n var minDist = infChordAngle();\n for (var _iterator2 = _createForOfIteratorHelperLoose(this.cellUnion), _step2; !(_step2 = _iterator2()).done;) {\n var id = _step2.value;\n var cell = Cell.fromCellID(id);\n var dist = cell.distance(point);\n if (dist < minDist) {\n minDist = dist;\n }\n if (minDist === 0) break;\n }\n return minDist;\n };\n return CellUnionTarget;\n}();\n/**\r\n * Target subtype that computes the closest distance to an S2ShapeIndex\r\n * (an arbitrary collection of points, polylines, and/or polygons).\r\n *\r\n * By default, distances are measured to the boundary and interior of\r\n * polygons in the S2ShapeIndex rather than to polygon boundaries only.\r\n * If you wish to change this behavior, you may call:\r\n *\r\n * target.setIncludeInteriors(false)\r\n */\nvar ShapeIndexTarget$1 = /*#__PURE__*/function () {\n function ShapeIndexTarget$1(index) {\n this.index = index;\n this.edgeTarget = new ShapeIndexTarget(index);\n }\n /**\r\n * Specifies whether distances should be measured to the boundary and\r\n * interior of polygons (true) or only to polygon boundaries (false).\r\n * The default is true.\r\n */\n var _proto6 = ShapeIndexTarget$1.prototype;\n _proto6.setIncludeInteriors = function setIncludeInteriors(includeInteriors) {\n this.edgeTarget.setIncludeInteriors(includeInteriors);\n };\n _proto6.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n return this.edgeTarget.maxBruteForceIndexSize();\n };\n _proto6.distanceToCell = function distanceToCell(cell) {\n var result = this.edgeTarget.updateMinDistanceToCell(cell, infChordAngle());\n return result.distance;\n };\n _proto6.distanceToPoint = function distanceToPoint(point) {\n var result = this.edgeTarget.updateMinDistanceToPoint(point, infChordAngle());\n return result.distance;\n };\n return ShapeIndexTarget$1;\n}();\n/**\r\n * S2ClosestCellQuery is a helper class for finding the closest cell(s) to a\r\n * given point, edge, S2Cell, S2CellUnion, or geometry collection.\r\n */\nvar ClosestCellQuery = /*#__PURE__*/function () {\n /**\r\n * Constructs a new ClosestCellQuery for the given CellIndex.\r\n * Options may be specified here or changed at any time using the options property.\r\n *\r\n */\n function ClosestCellQuery(index, options) {\n if (options === void 0) {\n options = new ClosestCellQueryOptions();\n }\n this.index = index;\n this.options = options;\n }\n /**\r\n * Find the closest cells to the target.\r\n * @param target - The target to find the closest cells to.\r\n * @returns An array of ClosestCellQueryResult objects.\r\n */\n var _proto7 = ClosestCellQuery.prototype;\n _proto7.findClosestCells = function findClosestCells(target) {\n // Iterate through all cells in the index and compute distances.\n var rangeIter = new CellIndexRangeIterator(this.index, true);\n var contentsIter = new CellIndexContentsIterator(this.index);\n // Collect all candidate cells.\n var candidates = [];\n for (rangeIter.begin(); !rangeIter.done(); rangeIter.next()) {\n contentsIter.startUnion(rangeIter);\n while (!contentsIter.done()) {\n var cellID = contentsIter.cellID();\n var label = contentsIter.label();\n var cell = Cell.fromCellID(cellID);\n // Check if this cell passes the region filter.\n if (this.options.region && !this.options.region.intersectsCell(cell)) {\n contentsIter.next();\n continue;\n }\n var distance = target.distanceToCell(cell);\n // Check distance constraint.\n if (distance < this.options.maxDistance) {\n candidates.push({\n cellID: cellID,\n label: label,\n distance: distance\n });\n }\n contentsIter.next();\n }\n }\n // Sort by distance.\n candidates.sort(function (a, b) {\n return a.distance - b.distance;\n });\n // Apply maxResults limit.\n var limit = Math.min(candidates.length, this.options.maxResults);\n return candidates.slice(0, limit);\n }\n /**\r\n * Returns the closest cell to the target. If no cell satisfies the search\r\n * criteria, then the Result object will have distance == Infinity and\r\n * isEmpty() == true.\r\n */;\n _proto7.findClosestCell = function findClosestCell(target) {\n var savedMaxResults = this.options.maxResults;\n this.options.maxResults = 1;\n var results = this.findClosestCells(target);\n this.options.maxResults = savedMaxResults;\n if (results.length === 0) {\n return emptyClosestCellQueryResult();\n }\n return results[0];\n }\n /**\r\n * Returns the minimum distance to the target. If the index or target is\r\n * empty, returns Infinity.\r\n *\r\n * Use isDistanceLess() if you only want to compare the distance against a\r\n * threshold value, since it is often much faster.\r\n */;\n _proto7.getDistance = function getDistance(target) {\n return this.findClosestCell(target).distance;\n }\n /**\r\n * Returns true if the distance to \"target\" is less than \"limit\".\r\n *\r\n * This method is usually much faster than getDistance(), since it is much\r\n * less work to determine whether the minimum distance is above or below a\r\n * threshold than it is to calculate the actual minimum distance.\r\n */;\n _proto7.isDistanceLess = function isDistanceLess(target, limit) {\n var savedMaxResults = this.options.maxResults;\n var savedMaxDistance = this.options.maxDistance;\n this.options.maxResults = 1;\n this.options.maxDistance = limit;\n var result = this.findClosestCell(target);\n this.options.maxResults = savedMaxResults;\n this.options.maxDistance = savedMaxDistance;\n return !isEmptyResult(result);\n }\n /**\r\n * Like isDistanceLess(), but also returns true if the distance to \"target\"\r\n * is exactly equal to \"limit\".\r\n */;\n _proto7.isDistanceLessOrEqual = function isDistanceLessOrEqual(target, limit) {\n return this.isDistanceLess(target, successor(limit));\n }\n /**\r\n * Like isDistanceLessOrEqual(), except that \"limit\" is increased by the\r\n * maximum error in the distance calculation. This ensures that this\r\n * function returns true whenever the true, exact distance is less than\r\n * or equal to \"limit\".\r\n */;\n _proto7.isConservativeDistanceLessOrEqual = function isConservativeDistanceLessOrEqual(target, limit) {\n return this.isDistanceLess(target, successor(expanded(limit, maxPointError(limit))));\n };\n return ClosestCellQuery;\n}();\n\n/**\r\n * Used to compute a bounding rectangle that contains all edges\r\n * defined by a vertex chain (v0, v1, v2, ...). All vertices must be unit length.\r\n * The bounding rectangle of an edge can be larger than the bounding\r\n * rectangle of its endpoints, e.g., consider an edge that passes through the North Pole.\r\n *\r\n * The bounds are calculated conservatively to account for numerical errors\r\n * when points are converted to LatLngs. This guarantees that if a point P is contained by the loop,\r\n * then `RectBound(L).ContainsPoint(LatLngFromPoint(P))` will be true.\r\n */\nvar RectBounder = /*#__PURE__*/function () {\n /**\r\n * Returns a new instance of a RectBounder.\r\n * @category Constructors\r\n */\n function RectBounder() {\n this.a = new Point$1(0, 0, 0);\n this.aLL = new LatLng(0, 0);\n this.bound = Rect$1.emptyRect();\n }\n /**\r\n * Returns the maximum error in RectBound provided that the result does not include either pole.\r\n * It is only used for testing purposes.\r\n */\n RectBounder.maxErrorForTests = function maxErrorForTests() {\n // The maximum error in the latitude calculation is\n // 3.84 * DBL_EPSILON for the PointCross calculation\n // 0.96 * DBL_EPSILON for the Latitude calculation\n // 5 * DBL_EPSILON added by AddPoint/RectBound to compensate for error\n // -----------------\n // 9.80 * DBL_EPSILON maximum error in result\n //\n // The maximum error in the longitude calculation is DBL_EPSILON. RectBound\n // does not do any expansion because this isn't necessary in order to\n // bound the *rounded* longitudes of contained points.\n return new LatLng(10 * DBL_EPSILON$1, 1 * DBL_EPSILON$1);\n }\n /**\r\n * Adds the given point to the chain. The Point must be unit length.\r\n */;\n var _proto = RectBounder.prototype;\n _proto.addPoint = function addPoint(b) {\n var bLL = LatLng.fromPoint(b);\n if (this.bound.isEmpty()) {\n this.a = b;\n this.aLL = bLL;\n this.bound = this.bound.addPoint(bLL);\n return;\n }\n // Compute the cross product N = A x B robustly. This is the normal\n // to the great circle through A and B. We don't use RobustSign\n // since that method returns an arbitrary vector orthogonal to A if the two\n // vectors are proportional, and we want the zero vector in that case.\n var n = this.a.vector.sub(b.vector).cross(this.a.vector.add(b.vector)); // N = 2 * (A x B)\n // Handle cases where the relative error in N gets large.\n var nNorm = n.norm();\n if (nNorm < 1.91346e-15) {\n if (this.a.vector.dot(b.vector) < 0) {\n this.bound = Rect$1.fullRect();\n } else {\n this.bound = this.bound.union(Rect$1.fromLatLng(this.aLL).addPoint(bLL));\n }\n this.a = b;\n this.aLL = bLL;\n return;\n }\n // Compute the longitude range spanned by AB.\n var lngAB = Interval$1.emptyInterval().addPoint(this.aLL.lng).addPoint(bLL.lng);\n if (lngAB.length() >= Math.PI - 2 * DBL_EPSILON$1) {\n lngAB = Interval$1.fullInterval();\n }\n /**\r\n * Next we compute the latitude range spanned by the edge AB. We start\r\n * with the range spanning the two endpoints of the edge:\r\n */\n var latAB = Interval.fromPoint(this.aLL.lat).addPoint(bLL.lat);\n // Check if AB crosses the plane through N and the Z-axis.\n var m = n.cross(new Vector(0, 0, 1));\n var mA = m.dot(this.a.vector);\n var mB = m.dot(b.vector);\n var mError = 6.06638e-16 * nNorm + 6.83174e-31;\n if (mA * mB < 0 || Math.abs(mA) <= mError || Math.abs(mB) <= mError) {\n var maxLat = Math.min(Math.atan2(Math.sqrt(n.x * n.x + n.y * n.y), Math.abs(n.z)) + 3 * DBL_EPSILON$1, Math.PI / 2);\n var latBudget = 2 * Math.asin(0.5 * this.a.vector.sub(b.vector).norm() * Math.sin(maxLat));\n var maxDelta = 0.5 * (latBudget - latAB.length()) + DBL_EPSILON$1;\n if (mA <= mError && mB >= -mError) latAB.hi = Math.min(maxLat, latAB.hi + maxDelta);\n if (mB <= mError && mA >= -mError) latAB.lo = Math.max(-maxLat, latAB.lo - maxDelta);\n }\n this.a = b;\n this.aLL = bLL;\n this.bound = this.bound.union(new Rect$1(latAB, lngAB));\n }\n /**\r\n * Returns the bounding rectangle of the edge chain that connects the vertices defined so far.\r\n */;\n _proto.rectBound = function rectBound() {\n return this.bound.expanded(new LatLng(2 * DBL_EPSILON$1, 0)).polarClosure();\n };\n return RectBounder;\n}();\n/**\r\n * Expands a bounding Rect so that it is guaranteed to contain the bounds of any subregion\r\n * whose bounds are computed using `ComputeRectBound`.\r\n *\r\n * For example, consider a loop L that defines a square.\r\n * This method ensures that if a point P is contained by this square, then LatLngFromPoint(P) is contained by the bound.\r\n * But now consider a diamond-shaped loop S contained by L.\r\n * It is possible that `GetBound` returns a *larger* bound for S than it does for L, due to rounding errors.\r\n * This method expands the bound for L so that it is guaranteed to contain the bounds of any subregion S.\r\n */\nRectBounder.expandForSubregions = function (bound) {\n if (bound.isEmpty()) return bound;\n var lngGap = Math.max(0, Math.PI - bound.lng.length() - 2.5 * DBL_EPSILON$1);\n var minAbsLat = Math.max(bound.lat.lo, -bound.lat.hi);\n var latGapSouth = Math.PI / 2 + bound.lat.lo;\n var latGapNorth = Math.PI / 2 - bound.lat.hi;\n if (minAbsLat >= 0) {\n if (2 * minAbsLat + lngGap < 1.354e-15) return Rect$1.fullRect();\n } else if (lngGap >= Math.PI / 2) {\n if (latGapSouth + latGapNorth < 1.687e-15) return Rect$1.fullRect();\n } else {\n if (Math.max(latGapSouth, latGapNorth) * lngGap < 1.765e-15) return Rect$1.fullRect();\n }\n var latExpansion = 9 * DBL_EPSILON$1;\n var lngExpansion = 0.0;\n if (lngGap <= 0) lngExpansion = Math.PI;\n return bound.expanded(new LatLng(latExpansion, lngExpansion)).polarClosure();\n};\n\n/**\r\n * Reports whether non-empty wedge A=(a0, ab1, a2) contains B=(b0, ab1, b2).\r\n * Equivalent to WedgeRelation == WEDGE_PROPERLY_CONTAINS || WEDGE_EQUALS.\r\n */\nvar wedgeContains = function wedgeContains(a0, ab1, a2, b0, b2) {\n return Point$1.orderedCCW(a2, b2, b0, ab1) && Point$1.orderedCCW(b0, a0, a2, ab1);\n};\n/**\r\n * Reports whether non-empty wedge A=(a0, ab1, a2) intersects B=(b0, ab1, b2).\r\n * Equivalent but faster than WedgeRelation != WEDGE_IS_DISJOINT.\r\n */\nvar wedgeIntersects = function wedgeIntersects(a0, ab1, a2, b0, b2) {\n return !(Point$1.orderedCCW(a0, b2, b0, ab1) && Point$1.orderedCCW(b0, a2, a0, ab1));\n};\n\n// CrossingEdgeQuery is used to find the Edge IDs of Shapes that are crossed by\n// a given edge(s).\n//\n// Note that if you need to query many edges, it is more efficient to declare\n// a single CrossingEdgeQuery instance and reuse it.\n//\n// If you want to find *all* the pairs of crossing edges, it is more efficient to\n// use the not yet implemented VisitCrossings in shapeutil.\nvar CrossingEdgeQuery = /*#__PURE__*/function () {\n /**\r\n * Returns a new CrossingEdgeQuery.\r\n * @category Constructors\r\n */\n function CrossingEdgeQuery(index) {\n this.a = new Point(0, 0);\n this.b = new Point(0, 0);\n this.index = index;\n this.iter = index.iterator();\n this.cells = [];\n }\n /**\r\n * Returns the set of edge IDs of the shape that intersect the given edge AB.\r\n * If the CrossingType is Interior, then only intersections at a point interior to both\r\n * edges are reported, while if it is CROSSING_TYPE_ALL then edges that share a vertex\r\n * are also reported.\r\n */\n var _proto = CrossingEdgeQuery.prototype;\n _proto.crossings = function crossings(a, b, shape, crossType) {\n var edges = this.candidates(a, b, shape);\n if (edges.length === 0) return [];\n var crosser = new EdgeCrosser(a, b);\n var out = 0;\n var n = edges.length;\n for (var inIdx = 0; inIdx < n; inIdx++) {\n var edge = shape.edge(edges[inIdx]);\n var sign = crosser.crossingSign(edge.v0, edge.v1);\n if (crossType === CROSSING_TYPE_ALL && (sign === MAYBE_CROSS || sign === CROSS) || crossType !== CROSSING_TYPE_ALL && sign === CROSS) {\n edges[out] = edges[inIdx];\n out++;\n }\n }\n if (out < n) edges = edges.slice(0, out);\n return edges;\n }\n /**\r\n * Returns the set of all edges in the index that intersect the given\r\n * edge AB. If crossType is CrossingTypeInterior, then only intersections at a\r\n * point interior to both edges are reported, while if it is CROSSING_TYPE_ALL\r\n * then edges that share a vertex are also reported.\r\n *\r\n * The edges are returned as a mapping from shape to the edges of that shape\r\n * that intersect AB. Every returned shape has at least one crossing edge.\r\n */;\n _proto.crossingsEdgeMap = function crossingsEdgeMap(a, b, crossType) {\n var edgeMap = this.candidatesEdgeMap(a, b);\n if (edgeMap.size === 0) return edgeMap;\n var crosser = new EdgeCrosser(a, b);\n edgeMap.forEach(function (edges, shape) {\n var n = edges.length;\n var out = 0;\n for (var inIdx = 0; inIdx < n; inIdx++) {\n var edge = shape.edge(edges[inIdx]);\n var sign = crosser.crossingSign(edge.v0, edge.v1);\n if (crossType === CROSSING_TYPE_ALL && (sign === MAYBE_CROSS || sign === CROSS) || crossType !== CROSSING_TYPE_ALL && sign === CROSS) {\n edges[out] = edges[inIdx];\n edgeMap.set(shape, edges);\n out++;\n }\n }\n if (out === 0) {\n edgeMap[\"delete\"](shape);\n } else if (out < n) {\n edgeMap.set(shape, edgeMap.get(shape).slice(0, out));\n }\n });\n return edgeMap;\n }\n /**\r\n * Returns a superset of the edges of the given shape that intersect the edge AB.\r\n */;\n _proto.candidates = function candidates(a, b, shape) {\n var edges = [];\n var maxBruteForceEdges = 27;\n var maxEdges = shape.numEdges();\n if (maxEdges <= maxBruteForceEdges) {\n edges = Array.from({\n length: maxEdges\n }, function (_, i) {\n return i;\n });\n return edges;\n }\n this.getCellsForEdge(a, b);\n if (this.cells.length === 0) return [];\n var shapeID = -1;\n this.index.shapes.forEach(function (v, k) {\n if (v === shape) shapeID = k;\n });\n for (var _iterator = _createForOfIteratorHelperLoose(this.cells), _step; !(_step = _iterator()).done;) {\n var _edges;\n var cell = _step.value;\n if (!cell) continue;\n var clipped = cell.findByShapeID(shapeID);\n if (clipped) (_edges = edges).push.apply(_edges, clipped.edges);\n }\n if (this.cells.length > 1) edges = CrossingEdgeQuery.uniqueInts(edges);\n return edges;\n }\n /**\r\n * Returns the sorted unique values from the given input.\r\n */;\n CrossingEdgeQuery.uniqueInts = function uniqueInts(ints) {\n var edges = [];\n var m = {};\n for (var _iterator2 = _createForOfIteratorHelperLoose(ints), _step2; !(_step2 = _iterator2()).done;) {\n var i = _step2.value;\n if (m[i]) continue;\n m[i] = true;\n edges.push(i);\n }\n edges.sort(function (a, b) {\n return a - b;\n });\n return edges;\n }\n /**\r\n * Returns a map from shapes to the superset of edges for that\r\n * shape that intersect the edge AB.\r\n *\r\n * CAVEAT: This method may return shapes that have an empty set of candidate edges.\r\n * However, the return value is non-empty only if at least one shape has a candidate edge.\r\n */;\n _proto.candidatesEdgeMap = function candidatesEdgeMap(a, b) {\n var edgeMap = new EdgeMap();\n if (this.index.shapes.size === 1) {\n var shape = this.index.shape(0);\n edgeMap.set(shape, this.candidates(a, b, shape));\n return edgeMap;\n }\n this.getCellsForEdge(a, b);\n if (this.cells.length === 0) return edgeMap;\n for (var _iterator3 = _createForOfIteratorHelperLoose(this.cells), _step3; !(_step3 = _iterator3()).done;) {\n var cell = _step3.value;\n for (var _iterator4 = _createForOfIteratorHelperLoose(cell.shapes), _step4; !(_step4 = _iterator4()).done;) {\n var clipped = _step4.value;\n var s = this.index.shape(clipped.shapeID);\n for (var j = 0; j < clipped.numEdges(); j++) {\n edgeMap.set(s, (edgeMap.get(s) || []).concat([clipped.edges[j]]));\n }\n }\n }\n if (this.cells.length > 1) {\n edgeMap.forEach(function (edges, shape) {\n edgeMap.set(shape, CrossingEdgeQuery.uniqueInts(edges));\n });\n }\n return edgeMap;\n }\n /**\r\n * Returns the set of ShapeIndexCells that might contain edges intersecting\r\n * the edge AB in the given cell root.\r\n */;\n _proto.getCells = function getCells(a, b, root) {\n var _clipToFace = clipToFace(a, b, face$1(root.id)),\n aUV = _clipToFace[0],\n bUV = _clipToFace[1],\n ok = _clipToFace[2];\n if (ok) {\n this.a = aUV;\n this.b = bUV;\n var edgeBound = Rect.fromPoints(this.a, this.b);\n if (root.bound().intersects(edgeBound)) this.computeCellsIntersected(root, edgeBound);\n }\n if (this.cells.length === 0) return [];\n return this.cells;\n }\n /**\r\n * Populates the cells field to the set of index cells intersected by an edge AB.\r\n */;\n _proto.getCellsForEdge = function getCellsForEdge(a, b) {\n this.cells = [];\n var segments = faceSegments(a, b);\n for (var _iterator5 = _createForOfIteratorHelperLoose(segments), _step5; !(_step5 = _iterator5()).done;) {\n var segment = _step5.value;\n this.a = segment.a;\n this.b = segment.b;\n var edgeBound = Rect.fromPoints(this.a, this.b);\n var pcell = PaddedCell.fromCellID(fromFace(segment.face), 0);\n var edgeRoot = pcell.shrinkToFit(edgeBound);\n var relation = this.iter.locateCellID(edgeRoot);\n if (relation === INDEXED) {\n this.cells.push(this.iter.indexCell());\n } else if (relation === SUBDIVIDED) {\n if (!isFace(edgeRoot)) pcell = PaddedCell.fromCellID(edgeRoot, 0);\n this.computeCellsIntersected(pcell, edgeBound);\n }\n }\n }\n /**\r\n * Computes the index cells intersected by the current\r\n * edge that are descendants of pcell and adds them to this queries set of cells.\r\n */;\n _proto.computeCellsIntersected = function computeCellsIntersected(pcell, edgeBound) {\n this.iter.seek(rangeMin(pcell.id));\n if (this.iter.done() || this.iter.cellID() > rangeMax(pcell.id)) return;\n if (this.iter.cellID() === pcell.id) {\n this.cells.push(this.iter.indexCell());\n return;\n }\n var center = pcell.middle().lo();\n if (edgeBound.x.hi < center.x) {\n this.clipVAxis(edgeBound, center.y, 0, pcell);\n return;\n } else if (edgeBound.x.lo >= center.x) {\n this.clipVAxis(edgeBound, center.y, 1, pcell);\n return;\n }\n var childBounds = this.splitUBound(edgeBound, center.x);\n if (edgeBound.y.hi < center.y) {\n this.computeCellsIntersected(PaddedCell.fromParentIJ(pcell, 0, 0), childBounds[0]);\n this.computeCellsIntersected(PaddedCell.fromParentIJ(pcell, 1, 0), childBounds[1]);\n } else if (edgeBound.y.lo >= center.y) {\n this.computeCellsIntersected(PaddedCell.fromParentIJ(pcell, 0, 1), childBounds[0]);\n this.computeCellsIntersected(PaddedCell.fromParentIJ(pcell, 1, 1), childBounds[1]);\n } else {\n this.clipVAxis(childBounds[0], center.y, 0, pcell);\n this.clipVAxis(childBounds[1], center.y, 1, pcell);\n }\n }\n /**\r\n * Computes the intersected cells recursively for a given padded cell.\r\n * Given either the left (i=0) or right (i=1) side of a padded cell pcell,\r\n * determine whether the current edge intersects the lower child, upper child,\r\n * or both children, and call computeCellsIntersected recursively on those children.\r\n * The center is the v-coordinate at the center of pcell.\r\n */;\n _proto.clipVAxis = function clipVAxis(edgeBound, center, i, pcell) {\n if (edgeBound.y.hi < center) {\n this.computeCellsIntersected(PaddedCell.fromParentIJ(pcell, i, 0), edgeBound);\n } else if (edgeBound.y.lo >= center) {\n this.computeCellsIntersected(PaddedCell.fromParentIJ(pcell, i, 1), edgeBound);\n } else {\n var childBounds = this.splitVBound(edgeBound, center);\n this.computeCellsIntersected(PaddedCell.fromParentIJ(pcell, i, 0), childBounds[0]);\n this.computeCellsIntersected(PaddedCell.fromParentIJ(pcell, i, 1), childBounds[1]);\n }\n }\n /**\r\n * Returns the bound for two children as a result of splitting the\r\n * current edge at the given value U.\r\n */;\n _proto.splitUBound = function splitUBound(edgeBound, u) {\n var v = edgeBound.y.clampPoint(interpolateFloat64(u, this.a.x, this.b.x, this.a.y, this.b.y));\n var diag = this.a.x > this.b.x !== this.a.y > this.b.y ? 1 : 0;\n return this.splitBound(edgeBound, 0, diag, u, v);\n }\n /**\r\n * Returns the bound for two children as a result of splitting the\r\n * current edge into two child edges at the given value V.\r\n */;\n _proto.splitVBound = function splitVBound(edgeBound, v) {\n var u = edgeBound.x.clampPoint(interpolateFloat64(v, this.a.y, this.b.y, this.a.x, this.b.x));\n var diag = this.a.x > this.b.x !== this.a.y > this.b.y ? 1 : 0;\n return this.splitBound(edgeBound, diag, 0, u, v);\n }\n /**\r\n * Returns the bounds for the two children as a result of splitting\r\n * the current edge into two child edges at the given point (u, v). uEnd and vEnd\r\n * indicate which bound endpoints of the first child will be updated.\r\n */;\n _proto.splitBound = function splitBound(edgeBound, uEnd, vEnd, u, v) {\n var childBounds = [Rect.fromRect(edgeBound), Rect.fromRect(edgeBound)];\n if (uEnd === 1) {\n childBounds[0].x.lo = u;\n childBounds[1].x.hi = u;\n } else {\n childBounds[0].x.hi = u;\n childBounds[1].x.lo = u;\n }\n if (vEnd === 1) {\n childBounds[0].y.lo = v;\n childBounds[1].y.hi = v;\n } else {\n childBounds[0].y.hi = v;\n childBounds[1].y.lo = v;\n }\n return childBounds;\n };\n return CrossingEdgeQuery;\n}();\n/** EdgeMap stores a sorted set of edge ids for each shape. */\nvar EdgeMap = /*#__PURE__*/function (_Map) {\n function EdgeMap() {\n return _Map.apply(this, arguments) || this;\n }\n _inheritsLoose(EdgeMap, _Map);\n return EdgeMap;\n}(/*#__PURE__*/_wrapNativeSuper(Map));\n\n/**\r\n * There are several notions of the \"centroid\" of a triangle. First, there\r\n * is the planar centroid, which is simply the centroid of the ordinary\r\n * (non-spherical) triangle defined by the three vertices. Second, there is\r\n * the surface centroid, which is defined as the intersection of the three\r\n * medians of the spherical triangle. It is possible to show that this\r\n * point is simply the planar centroid projected to the surface of the\r\n * sphere. Finally, there is the true centroid (mass centroid), which is\r\n * defined as the surface integral over the spherical triangle of (x,y,z)\r\n * divided by the triangle area. This is the point that the triangle would\r\n * rotate around if it was spinning in empty space.\r\n *\r\n * The best centroid for most purposes is the true centroid. Unlike the\r\n * planar and surface centroids, the true centroid behaves linearly as\r\n * regions are added or subtracted. That is, if you split a triangle into\r\n * pieces and compute the average of their centroids (weighted by triangle\r\n * area), the result equals the centroid of the original triangle. This is\r\n * not true of the other centroids.\r\n *\r\n * Also note that the surface centroid may be nowhere near the intuitive\r\n * \"center\" of a spherical triangle. For example, consider the triangle\r\n * with vertices A=(1,eps,0), B=(0,0,1), C=(-1,eps,0) (a quarter-sphere).\r\n * The surface centroid of this triangle is at S=(0, 2*eps, 1), which is\r\n * within a distance of 2*eps of the vertex B. Note that the median from A\r\n * (the segment connecting A to the midpoint of BC) passes through S, since\r\n * this is the shortest path connecting the two endpoints. On the other\r\n * hand, the true centroid is at M=(0, 0.5, 0.5), which when projected onto\r\n * the surface is a much more reasonable interpretation of the \"center\" of\r\n * this triangle.\r\n */\n/**\r\n * Returns the true centroid of the spherical triangle ABC\r\n * multiplied by the signed area of spherical triangle ABC. The reasons for\r\n * multiplying by the signed area are (1) this is the quantity that needs to be\r\n * summed to compute the centroid of a union or difference of triangles, and\r\n * (2) it's actually easier to calculate this way. All points must have unit length.\r\n *\r\n * Note that the result of this function is defined to be Point(0, 0, 0) if\r\n * the triangle is degenerate.\r\n */\nvar trueCentroid = function trueCentroid(a, b, c) {\n // Use Distance to get accurate results for small triangles.\n var ra = 1;\n var sa = b.distance(c);\n if (sa !== 0) ra = sa / Math.sin(sa);\n var rb = 1;\n var sb = c.distance(a);\n if (sb !== 0) rb = sb / Math.sin(sb);\n var rc = 1;\n var sc = a.distance(b);\n if (sc !== 0) rc = sc / Math.sin(sc);\n // Now compute a point M such that:\n //\n // [Ax Ay Az] [Mx] [ra]\n // [Bx By Bz] [My] = 0.5 * det(A,B,C) * [rb]\n // [Cx Cy Cz] [Mz] [rc]\n //\n // To improve the numerical stability we subtract the first row (A) from the\n // other two rows; this reduces the cancellation error when A, B, and C are\n // very close together. Then we solve it using Cramer's rule.\n //\n // The result is the true centroid of the triangle multiplied by the\n // triangle's area.\n //\n // This code still isn't as numerically stable as it could be.\n // The biggest potential improvement is to compute B-A and C-A more\n // accurately so that (B-A)x(C-A) is always inside triangle ABC.\n var x = new Vector(a.x, b.x - a.x, c.x - a.x);\n var y = new Vector(a.y, b.y - a.y, c.y - a.y);\n var z = new Vector(a.z, b.z - a.z, c.z - a.z);\n var r = new Vector(ra, rb - ra, rc - ra);\n return Point$1.fromVector(new Vector(y.cross(z).dot(r), z.cross(x).dot(r), x.cross(y).dot(r)).mul(0.5));\n};\n\n// These two points are used for the special Empty and Full loops.\nvar emptyLoopPoint = /*#__PURE__*/new Point$1(0, 0, 1);\nvar fullLoopPoint = /*#__PURE__*/new Point$1(0, 0, -1);\n/**\r\n * Loop represents a simple spherical polygon. It consists of a sequence\r\n * of vertices where the first vertex is implicitly connected to the\r\n * last. All loops are defined to have a CCW orientation, i.e. the interior of\r\n * the loop is on the left side of the edges. This implies that a clockwise\r\n * loop enclosing a small area is interpreted to be a CCW loop enclosing a\r\n * very large area.\r\n *\r\n * Loops are not allowed to have any duplicate vertices (whether adjacent or\r\n * not). Non-adjacent edges are not allowed to intersect, and furthermore edges\r\n * of length 180 degrees are not allowed (i.e., adjacent vertices cannot be\r\n * antipodal). Loops must have at least 3 vertices (except for the \"empty\" and\r\n * \"full\" loops discussed below).\r\n *\r\n * There are two special loops: the \"empty\" loop contains no points and the\r\n * \"full\" loop contains all points. These loops do not have any edges, but to\r\n * preserve the invariant that every loop can be represented as a vertex\r\n * chain, they are defined as having exactly one vertex each (see EmptyLoop\r\n * and FullLoop).\r\n *\r\n * @beta incomplete\r\n */\nvar Loop = /*#__PURE__*/function () {\n /**\r\n * Returns a new Loop.\r\n * @category Constructors\r\n */\n function Loop(pts) {\n this.originInside = false;\n this.depth = 0;\n this.bound = Rect$1.emptyRect();\n this.subregionBound = Rect$1.emptyRect();\n this.vertices = pts;\n this.index = new ShapeIndex();\n this.initOriginAndBound();\n }\n /**\r\n * Creates a new Loop from the given cell.\r\n * @category Constructors\r\n */\n Loop.fromCell = function fromCell(c) {\n var vertices = [c.vertex(0), c.vertex(1), c.vertex(2), c.vertex(3)];\n return new Loop(vertices);\n }\n /**\r\n * Constructs a loop from another loop (ie. make a copy)\r\n * @category Constructors\r\n */;\n Loop.fromLoop = function fromLoop(l) {\n return new Loop(l.vertices.map(function (p) {\n return Point$1.fromVector(p.vector);\n }));\n }\n /**\r\n * Returns the empty Loop.\r\n * @category Constructors\r\n */;\n Loop.emptyLoop = function emptyLoop() {\n return new Loop([emptyLoopPoint]);\n }\n /**\r\n * Returns the full Loop.\r\n * @category Constructors\r\n */;\n Loop.fullLoop = function fullLoop() {\n return new Loop([fullLoopPoint]);\n };\n var _proto = Loop.prototype;\n _proto.initOriginAndBound = function initOriginAndBound() {\n if (this.vertices.length < 3) {\n if (!this.isEmptyOrFull()) {\n this.originInside = false;\n return;\n }\n this.originInside = this.vertices[0].z < 0;\n } else {\n var v1Inside = this.vertices[0] !== this.vertices[1] && this.vertices[2] !== this.vertices[1] && angleContainsVertex(this.vertices[0], this.vertices[1], this.vertices[2]);\n this.originInside = false;\n if (v1Inside !== this.containsPoint(this.vertices[1])) {\n this.originInside = true;\n }\n }\n this.initBound();\n this.index.add(this);\n }\n // missinglink: replaces pointer assignment\n ;\n _proto.copyFrom = function copyFrom(ol) {\n this.vertices = ol.vertices;\n this.originInside = ol.originInside;\n this.depth = ol.depth;\n this.bound = ol.bound;\n this.subregionBound = ol.subregionBound;\n this.index = ol.index;\n };\n _proto.initBound = function initBound() {\n if (this.vertices.length === 0) {\n this.copyFrom(Loop.emptyLoop());\n return;\n }\n if (this.isEmptyOrFull()) {\n if (this.isEmpty()) {\n this.bound = Rect$1.emptyRect();\n } else {\n this.bound = Rect$1.fullRect();\n }\n this.subregionBound = this.bound;\n return;\n }\n var bounder = new RectBounder();\n for (var i = 0; i <= this.vertices.length; i++) {\n bounder.addPoint(this.vertex(i));\n }\n var b = bounder.rectBound();\n if (this.containsPoint(new Point$1(0, 0, 1))) {\n b = new Rect$1(new Interval(b.lat.lo, Math.PI / 2), Interval$1.fullInterval());\n }\n if (b.lng.isFull() && this.containsPoint(new Point$1(0, 0, -1))) {\n b.lat.lo = -Math.PI / 2;\n }\n this.bound = b;\n this.subregionBound = RectBounder.expandForSubregions(this.bound);\n };\n _proto.validate = function validate() {\n var err = this.findValidationErrorNoIndex();\n if (err) return err;\n return null;\n };\n _proto.findValidationErrorNoIndex = function findValidationErrorNoIndex() {\n for (var i = 0; i < this.vertices.length; i++) {\n var v = this.vertices[i];\n if (!v.vector.isUnit()) {\n return new Error(\"vertex \" + i + \" is not unit length\");\n }\n }\n if (this.vertices.length < 3) {\n if (this.isEmptyOrFull()) return null;\n return new Error('non-empty, non-full loops must have at least 3 vertices');\n }\n for (var _i = 0; _i < this.vertices.length; _i++) {\n if (this.vertices[_i].equals(this.vertex(_i + 1))) {\n return new Error(\"edge \" + _i + \" is degenerate (duplicate vertex)\");\n }\n var other = Point$1.fromVector(this.vertex(_i + 1).vector.mul(-1));\n if (this.vertices[_i].equals(other)) {\n return new Error(\"vertices \" + _i + \" and \" + (_i + 1) % this.vertices.length + \" are antipodal\");\n }\n }\n return null;\n };\n _proto.contains = function contains(o) {\n if (!this.subregionBound.contains(o.bound)) return false;\n if (this.isEmptyOrFull() || o.isEmptyOrFull()) {\n return this.isFull() || o.isEmpty();\n }\n var relation = new ContainsRelation();\n if (hasCrossingRelation(this, o, relation)) return false;\n if (relation.foundSharedVertex) return true;\n if (!this.containsPoint(o.vertex(0))) return false;\n if ((o.subregionBound.contains(this.bound) || o.bound.union(this.bound).isFull()) && o.containsPoint(this.vertex(0))) {\n return false;\n }\n return true;\n };\n _proto.intersects = function intersects(o) {\n if (!this.bound.intersects(o.bound)) return false;\n var relation = new IntersectsRelation();\n if (hasCrossingRelation(this, o, relation)) return true;\n if (relation.foundSharedVertex) return false;\n if (this.subregionBound.contains(o.bound) || this.bound.union(o.bound).isFull()) {\n if (this.containsPoint(o.vertex(0))) return true;\n }\n if (o.subregionBound.contains(this.bound)) {\n if (o.containsPoint(this.vertex(0))) return true;\n }\n return false;\n };\n _proto.equal = function equal(other) {\n if (this.vertices.length !== other.vertices.length) return false;\n for (var i = 0; i < this.vertices.length; i++) {\n if (this.vertices[i] !== other.vertex(i)) return false;\n }\n return true;\n };\n _proto.boundaryEqual = function boundaryEqual(o) {\n if (this.vertices.length !== o.vertices.length) return false;\n if (this.isEmptyOrFull()) return this.isEmpty() === o.isEmpty();\n for (var offset = 0; offset < this.vertices.length; offset++) {\n if (this.vertices[offset].equals(o.vertex(0))) {\n for (var i = 0; i < this.vertices.length; i++) {\n if (this.vertex(i + offset) !== o.vertex(i)) {\n return false;\n }\n }\n return true;\n }\n }\n return false;\n };\n _proto.compareBoundary = function compareBoundary(o) {\n if (!this.bound.intersects(o.bound)) return -1;\n if (this.isFull()) return 1;\n if (o.isFull()) return -1;\n var relation = new CompareBoundaryRelation(o.isHole());\n if (hasCrossingRelation(this, o, relation)) return 0;\n if (relation.foundSharedVertex) return relation.containsEdge ? 1 : -1;\n if (this.containsPoint(o.vertex(0))) return 1;\n return -1;\n };\n _proto.containsOrigin = function containsOrigin() {\n return this.originInside;\n };\n _proto.referencePoint = function referencePoint() {\n return originReferencePoint(this.originInside);\n };\n _proto.numEdges = function numEdges() {\n return this.isEmptyOrFull() ? 0 : this.vertices.length;\n };\n _proto.edge = function edge(i) {\n return new Edge(this.vertex(i), this.vertex(i + 1));\n };\n _proto.numChains = function numChains() {\n return this.isEmpty() ? 0 : 1;\n };\n _proto.chain = function chain(_chainID) {\n return new Chain(0, this.numEdges());\n };\n _proto.chainEdge = function chainEdge(_chainID, offset) {\n return new Edge(this.vertex(offset), this.vertex(offset + 1));\n };\n _proto.chainPosition = function chainPosition(edgeID) {\n return new ChainPosition(0, edgeID);\n };\n _proto.dimension = function dimension() {\n return 2;\n };\n _proto.typeTag = function typeTag() {\n return TypeTagNone;\n };\n _proto.privateInterface = function privateInterface() {};\n _proto.isEmpty = function isEmpty() {\n return this.isEmptyOrFull() && !this.containsOrigin();\n };\n _proto.isFull = function isFull() {\n return this.isEmptyOrFull() && this.containsOrigin();\n };\n _proto.isEmptyOrFull = function isEmptyOrFull() {\n return this.vertices.length === 1;\n };\n _proto.rectBound = function rectBound() {\n return this.bound;\n };\n _proto.capBound = function capBound() {\n return this.bound.capBound();\n };\n _proto.vertex = function vertex(i) {\n return this.vertices[i % this.vertices.length];\n };\n _proto.orientedVertex = function orientedVertex(i) {\n var j = i - this.vertices.length;\n if (j < 0) j = i;\n if (this.isHole()) j = this.vertices.length - 1 - j;\n return this.vertex(j);\n };\n _proto.numVertices = function numVertices() {\n return this.vertices.length;\n };\n _proto.bruteForceContainsPoint = function bruteForceContainsPoint(p) {\n var origin = Point$1.originPoint();\n var inside = this.originInside;\n var crosser = EdgeCrosser.newChainEdgeCrosser(origin, p, this.vertex(0));\n for (var i = 1; i <= this.vertices.length; i++) {\n inside = inside !== crosser.edgeOrVertexChainCrossing(this.vertex(i));\n }\n return inside;\n };\n _proto.containsPoint = function containsPoint(p) {\n if (!this.index.isFresh() && !this.bound.containsPoint(p)) return false;\n var maxBruteForceVertices = 32;\n if (this.index.shapes.size === 0 || this.vertices.length <= maxBruteForceVertices) {\n return this.bruteForceContainsPoint(p);\n }\n var it = this.index.iterator();\n if (!it.locatePoint(p)) return false;\n return this.iteratorContainsPoint(it, p);\n };\n _proto.containsCell = function containsCell(target) {\n var it = this.index.iterator();\n var relation = it.locateCellID(target.id);\n if (relation !== INDEXED) return false;\n if (this.boundaryApproxIntersects(it, target)) return false;\n return this.iteratorContainsPoint(it, target.center());\n };\n _proto.intersectsCell = function intersectsCell(target) {\n var it = this.index.iterator();\n var relation = it.locateCellID(target.id);\n if (relation === DISJOINT) return false;\n if (relation === SUBDIVIDED) return true;\n if (it.cellID() === target.id) return true;\n if (this.boundaryApproxIntersects(it, target)) return true;\n return this.iteratorContainsPoint(it, target.center());\n };\n _proto.cellUnionBound = function cellUnionBound() {\n return this.capBound().cellUnionBound();\n };\n _proto.boundaryApproxIntersects = function boundaryApproxIntersects(it, target) {\n var aClipped = it.indexCell().findByShapeID(0);\n if (aClipped.edges.length === 0) return false;\n if (it.cellID() === target.id) return true;\n var maxError = FACE_CLIP_ERROR_UV_COORD + INTERSECTS_RECT_ERROR_UV_DIST;\n var bound = target.boundUV().expandedByMargin(maxError);\n for (var _iterator = _createForOfIteratorHelperLoose(aClipped.edges), _step; !(_step = _iterator()).done;) {\n var ai = _step.value;\n var _clipToPaddedFace = clipToPaddedFace(this.vertex(ai), this.vertex(ai + 1), target.face, maxError),\n v0 = _clipToPaddedFace[0],\n v1 = _clipToPaddedFace[1],\n ok = _clipToPaddedFace[2];\n if (ok && edgeIntersectsRect(v0, v1, bound)) {\n return true;\n }\n }\n return false;\n };\n _proto.iteratorContainsPoint = function iteratorContainsPoint(it, p) {\n var _it$indexCell;\n var aClipped = (_it$indexCell = it.indexCell()) == null ? void 0 : _it$indexCell.findByShapeID(0);\n var inside = (aClipped == null ? void 0 : aClipped.containsCenter) || false;\n if (aClipped && aClipped.edges.length > 0) {\n var center = it.center();\n var crosser = new EdgeCrosser(center, p);\n var aiPrev = -2;\n for (var _iterator2 = _createForOfIteratorHelperLoose(aClipped.edges), _step2; !(_step2 = _iterator2()).done;) {\n var ai = _step2.value;\n if (ai !== aiPrev + 1) {\n crosser.restartAt(this.vertex(ai));\n }\n aiPrev = ai;\n inside = inside !== crosser.edgeOrVertexChainCrossing(this.vertex(ai + 1));\n }\n }\n return inside;\n };\n Loop.regularLoop = function regularLoop(center, radius, numVertices) {\n return Loop.regularLoopForFrame(getFrame(center), radius, numVertices);\n };\n Loop.regularLoopForFrame = function regularLoopForFrame(frame, radius, numVertices) {\n return new Loop(Point$1.regularPointsForFrame(frame, radius, numVertices));\n };\n _proto.canonicalFirstVertex = function canonicalFirstVertex() {\n var firstIdx = 0;\n var n = this.vertices.length;\n for (var i = 1; i < n; i++) {\n if (this.vertex(i).vector.cmp(this.vertex(firstIdx).vector) === -1) {\n firstIdx = i;\n }\n }\n if (this.vertex(firstIdx + 1).vector.cmp(this.vertex(firstIdx + n - 1).vector) === -1) {\n return [firstIdx, 1];\n }\n firstIdx += n;\n return [firstIdx, -1];\n };\n _proto.turningAngle = function turningAngle() {\n if (this.isEmptyOrFull()) {\n return this.containsOrigin() ? -2 * Math.PI : 2 * Math.PI;\n }\n if (this.vertices.length < 3) return 0;\n var _this$canonicalFirstV = this.canonicalFirstVertex(),\n i = _this$canonicalFirstV[0],\n dir = _this$canonicalFirstV[1];\n var sum = turnAngle(this.vertex((i + this.vertices.length - dir) % this.vertices.length), this.vertex(i), this.vertex((i + dir) % this.vertices.length));\n var compensation = 0;\n for (var n = this.vertices.length - 1; n > 0; n--) {\n i += dir;\n var angle = turnAngle(this.vertex(i - dir), this.vertex(i), this.vertex(i + dir));\n var oldSum = sum;\n sum += angle + compensation;\n compensation = oldSum - sum + angle;\n }\n var maxCurvature = 2 * Math.PI - 4 * DBL_EPSILON$1;\n return Math.max(-maxCurvature, Math.min(maxCurvature, dir * (sum + compensation)));\n };\n _proto.turningAngleMaxError = function turningAngleMaxError() {\n var maxErrorPerVertex = 11.25 * DBL_EPSILON$1;\n return maxErrorPerVertex * this.vertices.length;\n };\n _proto.isHole = function isHole() {\n return (this.depth & 1) !== 0;\n };\n _proto.sign = function sign() {\n return this.isHole() ? -1 : 1;\n };\n _proto.isNormalized = function isNormalized() {\n if (this.bound.lng.length() < Math.PI) return true;\n return this.turningAngle() >= -this.turningAngleMaxError();\n };\n _proto.normalize = function normalize() {\n if (!this.isNormalized()) this.invert();\n };\n _proto.invert = function invert() {\n this.index.reset();\n if (this.isEmptyOrFull()) {\n this.vertices[0] = this.isFull() ? emptyLoopPoint : fullLoopPoint;\n } else {\n for (var i = Math.floor(this.vertices.length / 2) - 1; i >= 0; i--) {\n var opp = this.vertices.length - 1 - i;\n var _ref = [this.vertices[opp], this.vertices[i]];\n this.vertices[i] = _ref[0];\n this.vertices[opp] = _ref[1];\n }\n }\n this.originInside = !this.originInside;\n if (this.bound.lat.lo > -Math.PI / 2 && this.bound.lat.hi < Math.PI / 2) {\n this.bound = Rect$1.fullRect();\n this.subregionBound = this.bound;\n } else {\n this.initBound();\n }\n this.index.add(this);\n };\n _proto.findVertex = function findVertex(p) {\n var notFound = 0;\n if (this.vertices.length < 10) {\n for (var i = 1; i <= this.vertices.length; i++) {\n if (this.vertex(i).equals(p)) return [i, true];\n }\n return [notFound, false];\n }\n var it = this.index.iterator();\n if (!it.locatePoint(p)) return [notFound, false];\n var aClipped = it.indexCell().findByShapeID(0);\n for (var _i2 = aClipped.numEdges() - 1; _i2 >= 0; _i2--) {\n var ai = aClipped.edges[_i2];\n if (this.vertex(ai).equals(p)) {\n return ai === 0 ? [this.vertices.length, true] : [ai, true];\n }\n if (this.vertex(ai + 1).equals(p)) {\n return [ai + 1, true];\n }\n }\n return [notFound, false];\n };\n _proto.containsNested = function containsNested(other) {\n if (!this.subregionBound.contains(other.bound)) return false;\n if (this.isEmptyOrFull() || other.numVertices() < 2) {\n return this.isFull() || other.isEmpty();\n }\n var _this$findVertex = this.findVertex(other.vertex(1)),\n m = _this$findVertex[0],\n ok = _this$findVertex[1];\n if (!ok) return this.containsPoint(other.vertex(1));\n return wedgeContains(this.vertex(m - 1), this.vertex(m), this.vertex(m + 1), other.vertex(0), other.vertex(2));\n };\n _proto.surfaceIntegralFloat64 = function surfaceIntegralFloat64(f) {\n var maxLength = Math.PI - 1e-5;\n var sum = 0;\n var origin = this.vertex(0);\n for (var i = 1; i + 1 < this.vertices.length; i++) {\n if (this.vertex(i + 1).vector.angle(origin.vector) > maxLength) {\n var oldOrigin = origin;\n if (origin.equals(this.vertex(0))) {\n origin = Point$1.fromVector(this.vertex(0).pointCross(this.vertex(i)).vector.normalize());\n } else if (this.vertex(i).vector.angle(this.vertex(0).vector) < maxLength) {\n origin = this.vertex(0);\n } else {\n origin = Point$1.fromVector(this.vertex(0).vector.cross(oldOrigin.vector));\n sum += f(this.vertex(0), oldOrigin, origin);\n }\n sum += f(oldOrigin, this.vertex(i), origin);\n }\n sum += f(origin, this.vertex(i), this.vertex(i + 1));\n }\n if (origin !== this.vertex(0)) {\n sum += f(origin, this.vertex(this.vertices.length - 1), this.vertex(0));\n }\n return sum;\n };\n _proto.surfaceIntegralPoint = function surfaceIntegralPoint(f) {\n var maxLength = Math.PI - 1e-5;\n var sum = new Point$1(0, 0, 0).vector;\n var origin = this.vertex(0);\n for (var i = 1; i + 1 < this.vertices.length; i++) {\n if (this.vertex(i + 1).vector.angle(origin.vector) > maxLength) {\n var oldOrigin = origin;\n if (origin.equals(this.vertex(0))) {\n origin = Point$1.fromVector(this.vertex(0).pointCross(this.vertex(i)).vector.normalize());\n } else if (this.vertex(i).vector.angle(this.vertex(0).vector) < maxLength) {\n origin = this.vertex(0);\n } else {\n origin = Point$1.fromVector(this.vertex(0).vector.cross(oldOrigin.vector));\n sum = sum.add(f(this.vertex(0), oldOrigin, origin).vector);\n }\n sum = sum.add(f(oldOrigin, this.vertex(i), origin).vector);\n }\n sum = sum.add(f(origin, this.vertex(i), this.vertex(i + 1)).vector);\n }\n if (origin !== this.vertex(0)) {\n sum = sum.add(f(origin, this.vertex(this.vertices.length - 1), this.vertex(0)).vector);\n }\n return Point$1.fromVector(sum);\n };\n _proto.area = function area() {\n if (this.isEmptyOrFull()) return this.containsOrigin() ? 4 * Math.PI : 0;\n var area = this.surfaceIntegralFloat64(signedArea);\n var maxError = this.turningAngleMaxError();\n if (area < 0) area += 4 * Math.PI;\n if (area > 4 * Math.PI) area = 4 * Math.PI;\n if (area < 0) area = 0;\n if (area < maxError && !this.isNormalized()) {\n return 4 * Math.PI;\n } else if (area > 4 * Math.PI - maxError && this.isNormalized()) {\n return 0;\n }\n return area;\n };\n _proto.centroid = function centroid() {\n return this.surfaceIntegralPoint(trueCentroid);\n }\n // xyzFaceSiTiVertices(): XyzFaceSiTi[] {\n // return this.vertices.map((v) => {\n // const [face, si, ti, level] = xyzToFaceSiTi(v)\n // return new XyzFaceSiTi(v, face, si, ti, level)\n // })\n // }\n /**\r\n * Reports whether given two loops whose boundaries\r\n * do not cross (see compareBoundary), if this loop contains the boundary of the\r\n * other loop. If reverse is true, the boundary of the other loop is reversed\r\n * first (which only affects the result when there are shared edges). This method\r\n * is cheaper than compareBoundary because it does not test for edge intersections.\r\n *\r\n * This function requires that neither loop is empty, and that if the other is full,\r\n * then reverse == false.\r\n */;\n _proto.containsNonCrossingBoundary = function containsNonCrossingBoundary(other, reverseOther) {\n // The bounds must intersect for containment.\n if (!this.bound.intersects(other.bound)) return false;\n // Full loops are handled as though the loop surrounded the entire sphere.\n if (this.isFull()) return true;\n if (other.isFull()) return false;\n var _this$findVertex2 = this.findVertex(other.vertex(0)),\n m = _this$findVertex2[0],\n ok = _this$findVertex2[1];\n if (!ok) {\n return this.containsPoint(other.vertex(0)); // Since the other loops vertex 0 is not shared, we can check if this contains it.\n }\n // Otherwise check whether the edge (b0, b1) is contained by this loop.\n return wedgeContainsSemiwedge(this.vertex(m - 1), this.vertex(m), this.vertex(m + 1), other.vertex(1), reverseOther);\n };\n return Loop;\n}();\nvar containsCenterMatches = function containsCenterMatches(a, target) {\n return !a.containsCenter && target === CROSSING_TARGET_DONT_CROSS || a.containsCenter && target === CROSSING_TARGET_CROSS;\n};\nvar hasCrossingRelation = function hasCrossingRelation(a, b, relation) {\n var ai = new RangeIterator(a.index);\n var bi = new RangeIterator(b.index);\n var ab = new LoopCrosser(a, b, relation, false);\n var ba = new LoopCrosser(b, a, relation, true);\n while (!ai.done() || !bi.done()) {\n if (ai.rangeMax < bi.rangeMin) {\n ai.seekTo(bi);\n } else if (bi.rangeMax < ai.rangeMin) {\n bi.seekTo(ai);\n } else {\n var abRelation = lsb(ai.it.cellID()) - lsb(bi.it.cellID());\n if (abRelation > 0) {\n if (ab.hasCrossingRelation(ai, bi)) {\n return true;\n }\n } else if (abRelation < 0) {\n if (ba.hasCrossingRelation(bi, ai)) {\n return true;\n }\n } else {\n var aClipped = ai.it.indexCell().shapes[0];\n var bClipped = bi.it.indexCell().shapes[0];\n if (containsCenterMatches(aClipped, ab.aCrossingTarget) && containsCenterMatches(bClipped, ab.bCrossingTarget)) {\n return true;\n }\n if (aClipped.numEdges() > 0 && bClipped.numEdges() > 0 && ab.cellCrossesCell(aClipped, bClipped)) {\n return true;\n }\n ai.next();\n bi.next();\n }\n }\n }\n return false;\n};\nvar CROSSING_TARGET_DONT_CARE = 0;\nvar CROSSING_TARGET_DONT_CROSS = 1;\nvar CROSSING_TARGET_CROSS = 2;\nvar ContainsRelation = /*#__PURE__*/function () {\n function ContainsRelation() {\n this.foundSharedVertex = false;\n }\n var _proto2 = ContainsRelation.prototype;\n _proto2.aCrossingTarget = function aCrossingTarget() {\n return CROSSING_TARGET_DONT_CROSS;\n };\n _proto2.bCrossingTarget = function bCrossingTarget() {\n return CROSSING_TARGET_CROSS;\n };\n _proto2.wedgesCross = function wedgesCross(a0, ab1, a2, b0, b2) {\n this.foundSharedVertex = true;\n return !wedgeContains(a0, ab1, a2, b0, b2);\n };\n return ContainsRelation;\n}();\nvar IntersectsRelation = /*#__PURE__*/function () {\n function IntersectsRelation() {\n this.foundSharedVertex = false;\n }\n var _proto3 = IntersectsRelation.prototype;\n _proto3.aCrossingTarget = function aCrossingTarget() {\n return CROSSING_TARGET_CROSS;\n };\n _proto3.bCrossingTarget = function bCrossingTarget() {\n return CROSSING_TARGET_CROSS;\n };\n _proto3.wedgesCross = function wedgesCross(a0, ab1, a2, b0, b2) {\n this.foundSharedVertex = true;\n return wedgeIntersects(a0, ab1, a2, b0, b2);\n };\n return IntersectsRelation;\n}();\nvar CompareBoundaryRelation = /*#__PURE__*/function () {\n function CompareBoundaryRelation(reverse) {\n this.foundSharedVertex = false;\n this.containsEdge = false;\n this.excludesEdge = false;\n this.reverse = reverse;\n }\n var _proto4 = CompareBoundaryRelation.prototype;\n _proto4.aCrossingTarget = function aCrossingTarget() {\n return CROSSING_TARGET_DONT_CARE;\n };\n _proto4.bCrossingTarget = function bCrossingTarget() {\n return CROSSING_TARGET_DONT_CARE;\n };\n _proto4.wedgesCross = function wedgesCross(a0, ab1, a2, _b0, b2) {\n this.foundSharedVertex = true;\n if (wedgeContainsSemiwedge(a0, ab1, a2, b2, this.reverse)) {\n this.containsEdge = true;\n } else {\n this.excludesEdge = true;\n }\n return this.containsEdge && this.excludesEdge;\n };\n return CompareBoundaryRelation;\n}();\nvar wedgeContainsSemiwedge = function wedgeContainsSemiwedge(a0, ab1, a2, b2, reverse) {\n if (b2.equals(a0) || b2.equals(a2)) return b2.equals(a0) === reverse;\n return Point$1.orderedCCW(a0, a2, b2, ab1);\n};\n// ----\n/**\r\n * LoopCrosser is a helper class for determining whether two loops cross.\r\n * It is instantiated twice for each pair of loops to be tested, once for the\r\n * pair (A,B) and once for the pair (B,A), in order to be able to process\r\n * edges in either loop nesting order.\r\n */\nvar LoopCrosser = /*#__PURE__*/function () {\n /**\r\n * Creates a LoopCrosser from the given values. If swapped is true,\r\n * the loops A and B have been swapped. This affects how arguments are passed to\r\n * the given loop relation, since for example A.Contains(B) is not the same as B.Contains(A).\r\n * @category Constructors\r\n */\n function LoopCrosser(a, b, relation, swapped) {\n this.crosser = null;\n this.aj = 0;\n this.bjPrev = -2;\n this.bCells = [];\n this.a = a;\n this.b = b;\n this.relation = relation;\n this.swapped = swapped;\n this.aCrossingTarget = relation.aCrossingTarget();\n this.bCrossingTarget = relation.bCrossingTarget();\n this.bQuery = new CrossingEdgeQuery(b.index);\n if (swapped) {\n var _ref2 = [this.bCrossingTarget, this.aCrossingTarget];\n this.aCrossingTarget = _ref2[0];\n this.bCrossingTarget = _ref2[1];\n }\n }\n /**\r\n * Sets the crosser's state for checking the given edge of loop A.\r\n */\n var _proto5 = LoopCrosser.prototype;\n _proto5.startEdge = function startEdge(aj) {\n this.crosser = new EdgeCrosser(this.a.vertex(aj), this.a.vertex(aj + 1));\n this.aj = aj;\n this.bjPrev = -2;\n }\n /**\r\n * Reports whether the current edge of loop A has any crossings with\r\n * edges of the index cell of loop B.\r\n */;\n _proto5.edgeCrossesCell = function edgeCrossesCell(bClipped) {\n var bNumEdges = bClipped.numEdges();\n for (var j = 0; j < bNumEdges; j++) {\n var _this$crosser2;\n var bj = bClipped.edges[j];\n if (bj !== this.bjPrev + 1) {\n var _this$crosser;\n (_this$crosser = this.crosser) == null || _this$crosser.restartAt(this.b.vertex(bj));\n }\n this.bjPrev = bj;\n var crossing = (_this$crosser2 = this.crosser) == null ? void 0 : _this$crosser2.chainCrossingSign(this.b.vertex(bj + 1));\n if (crossing === DO_NOT_CROSS) continue;\n if (crossing === CROSS) return true;\n if (this.a.vertex(this.aj + 1).equals(this.b.vertex(bj + 1))) {\n if (this.swapped) {\n if (this.relation.wedgesCross(this.b.vertex(bj), this.b.vertex(bj + 1), this.b.vertex(bj + 2), this.a.vertex(this.aj), this.a.vertex(this.aj + 2))) {\n return true;\n }\n } else {\n if (this.relation.wedgesCross(this.a.vertex(this.aj), this.a.vertex(this.aj + 1), this.a.vertex(this.aj + 2), this.b.vertex(bj), this.b.vertex(bj + 2))) {\n return true;\n }\n }\n }\n }\n return false;\n }\n /**\r\n * Reports whether there are any edge crossings or wedge crossings\r\n * within the two given cells.\r\n */;\n _proto5.cellCrossesCell = function cellCrossesCell(aClipped, bClipped) {\n for (var _iterator3 = _createForOfIteratorHelperLoose(aClipped.edges), _step3; !(_step3 = _iterator3()).done;) {\n var edge = _step3.value;\n this.startEdge(edge);\n if (this.edgeCrossesCell(bClipped)) return true;\n }\n return false;\n }\n /**\r\n * Reports whether given an index cell of A, there are any edge or wedge crossings\r\n * with any index cell of B contained within bID.\r\n */;\n _proto5.cellCrossesAnySubcell = function cellCrossesAnySubcell(aClipped, bID) {\n var bRoot = PaddedCell.fromCellID(bID, 0);\n for (var _iterator4 = _createForOfIteratorHelperLoose(aClipped.edges), _step4; !(_step4 = _iterator4()).done;) {\n var aj = _step4.value;\n this.bCells = this.bQuery.getCells(this.a.vertex(aj), this.a.vertex(aj + 1), bRoot);\n if (this.bCells.length === 0) continue;\n this.startEdge(aj);\n for (var _iterator5 = _createForOfIteratorHelperLoose(this.bCells), _step5; !(_step5 = _iterator5()).done;) {\n var cell = _step5.value;\n if (this.edgeCrossesCell(cell.shapes[0])) return true;\n }\n }\n return false;\n }\n /**\r\n * Reports whether given two iterators positioned such that\r\n * ai.cellID().ContainsCellID(bi.cellID()), there is an edge or wedge crossing\r\n * anywhere within ai.cellID().\r\n * This function advances bi only past ai.cellID().\r\n */;\n _proto5.hasCrossing = function hasCrossing(ai, bi) {\n var edgeQueryMinEdges = 20;\n var totalEdges = 0;\n this.bCells = [];\n while (true) {\n var n = bi.it.indexCell().shapes[0].numEdges();\n if (n > 0) {\n totalEdges += n;\n if (totalEdges >= edgeQueryMinEdges) {\n if (this.cellCrossesAnySubcell(ai.it.indexCell().shapes[0], ai.cellID())) return true;\n bi.seekBeyond(ai);\n return false;\n }\n this.bCells.push(bi.indexCell());\n }\n bi.next();\n if (bi.cellID() > ai.rangeMax) break;\n }\n for (var _iterator6 = _createForOfIteratorHelperLoose(this.bCells), _step6; !(_step6 = _iterator6()).done;) {\n var c = _step6.value;\n if (this.cellCrossesCell(ai.it.indexCell().shapes[0], c.shapes[0])) return true;\n }\n return false;\n }\n /**\r\n * Reports whether given two iterators positioned such that\r\n * ai.cellID().ContainsCellID(bi.cellID()), there is a crossing relationship\r\n * anywhere within ai.cellID().\r\n */;\n _proto5.hasCrossingRelation = function hasCrossingRelation(ai, bi) {\n var aClipped = ai.it.indexCell().shapes[0];\n if (aClipped.numEdges() !== 0) {\n if (this.hasCrossing(ai, bi)) return true;\n ai.next();\n return false;\n }\n if (containsCenterMatches(aClipped, this.aCrossingTarget)) {\n bi.seekBeyond(ai);\n ai.next();\n return false;\n }\n while (bi.cellID() <= ai.rangeMax) {\n var bClipped = bi.it.indexCell().shapes[0];\n if (containsCenterMatches(bClipped, this.bCrossingTarget)) return true;\n bi.next();\n }\n ai.next();\n return false;\n };\n return LoopCrosser;\n}();\n\n/**\r\n * Polygon represents a sequence of zero or more loops; recall that the\r\n * interior of a loop is defined to be its left-hand side (see Loop).\r\n *\r\n * When the polygon is initialized, the given loops are automatically converted\r\n * into a canonical form consisting of \"shells\" and \"holes\". Shells and holes\r\n * are both oriented CCW, and are nested hierarchically. The loops are\r\n * reordered to correspond to a pre-order traversal of the nesting hierarchy.\r\n *\r\n * Polygons may represent any region of the sphere with a polygonal boundary,\r\n * including the entire sphere (known as the \"full\" polygon). The full polygon\r\n * consists of a single full loop (see Loop), whereas the empty polygon has no\r\n * loops at all.\r\n *\r\n * Use FullPolygon() to construct a full polygon. The zero value of Polygon is\r\n * treated as the empty polygon.\r\n *\r\n * Polygons have the following restrictions:\r\n *\r\n * - Loops may not cross, i.e. the boundary of a loop may not intersect\r\n * both the interior and exterior of any other loop.\r\n *\r\n * - Loops may not share edges, i.e. if a loop contains an edge AB, then\r\n * no other loop may contain AB or BA.\r\n *\r\n * - Loops may share vertices, however no vertex may appear twice in a\r\n * single loop (see Loop).\r\n *\r\n * - No loop may be empty. The full loop may appear only in the full polygon.\r\n */\nvar Polygon = /*#__PURE__*/function () {\n /**\r\n * Constructs a polygon from the given set of loops. The polygon\r\n * interior consists of the points contained by an odd number of loops. (Recall\r\n * that a loop contains the set of points on its left-hand side.)\r\n *\r\n * This method determines the loop nesting hierarchy and assigns every loop a\r\n * depth. Shells have even depths, and holes have odd depths.\r\n *\r\n * Note: The given set of loops are reordered by this method so that the hierarchy\r\n * can be traversed using Parent, LastDescendant and the loops depths.\r\n * @category Constructors\r\n */\n function Polygon(loops) {\n var _this = this;\n if (loops === void 0) {\n loops = [];\n }\n this.loops = [];\n /** index is a spatial index of all the polygon loops. */\n this.index = new ShapeIndex();\n /** hasHoles tracks if this polygon has at least one hole. */\n this.hasHoles = false;\n /** numVertices keeps the running total of all of the vertices of the contained loops. */\n this.numVertices = 0;\n /** numEdges tracks the total number of edges in all the loops in this polygon. */\n this.nEdges = 0;\n /**\r\n * bound is a conservative bound on all points contained by this loop.\r\n * If l.ContainsPoint(P), then l.bound.ContainsPoint(P).\r\n */\n this.bound = Rect$1.emptyRect();\n /**\r\n * Since bound is not exact, it is possible that a loop A contains\r\n * another loop B whose bounds are slightly larger. subregionBound\r\n * has been expanded sufficiently to account for this error, i.e.\r\n * if A.Contains(B), then A.subregionBound.Contains(B.bound).\r\n */\n this.subregionBound = Rect$1.emptyRect();\n /**\r\n * A slice where element i is the cumulative number of edges in the\r\n * preceding loops in the polygon. This field is used for polygons that\r\n * have a large number of loops, and may be empty for polygons with few loops.\r\n */\n this.cumulativeEdges = [];\n /**\r\n * Walks the mapping of loops to all of their children, and adds them in\r\n * order into to the polygons set of loops.\r\n */\n this.initLoops = function (lm) {\n var stack = new Array();\n stack.push(null);\n var depth = -1;\n while (stack.length > 0) {\n var loop = stack.pop();\n if (loop != null) {\n depth = loop.depth;\n _this.loops.push(loop);\n }\n var children = lm.get(loop) || [];\n for (var i = children.length - 1; i >= 0; i--) {\n var child = children[i];\n child.depth = depth + 1;\n stack.push(child);\n }\n }\n };\n if (loops.length === 1 && loops[0].isEmpty()) {\n this.initLoopProperties();\n return;\n }\n this.loops = loops;\n this.initNested();\n }\n /**\r\n * PolygonFromOrientedLoops returns a Polygon from the given set of loops,\r\n * like PolygonFromLoops. It expects loops to be oriented such that the polygon\r\n * interior is on the left-hand side of all loops. This implies that shells\r\n * and holes should have opposite orientations in the input to this method.\r\n * (During initialization, loops representing holes will automatically be\r\n * inverted.)\r\n * @category Constructors\r\n */\n Polygon.fromOrientedLoops = function fromOrientedLoops(loops) {\n // Here is the algorithm:\n //\n // 1. Remember which of the given loops contain OriginPoint.\n //\n // 2. Invert loops as necessary to ensure that they are nestable (i.e., no\n // loop contains the complement of any other loop). This may result in a\n // set of loops corresponding to the complement of the given polygon, but\n // we will fix that problem later.\n //\n // We make the loops nestable by first normalizing all the loops (i.e.,\n // inverting any loops whose turning angle is negative). This handles\n // all loops except those whose turning angle is very close to zero\n // (within the maximum error tolerance). Any such loops are inverted if\n // and only if they contain OriginPoint(). (In theory this step is only\n // necessary if there are at least two such loops.) The resulting set of\n // loops is guaranteed to be nestable.\n //\n // 3. Build the polygon. This yields either the desired polygon or its\n // complement.\n //\n // 4. If there is at least one loop, we find a loop L that is adjacent to\n // OriginPoint() (where \"adjacent\" means that there exists a path\n // connecting OriginPoint() to some vertex of L such that the path does\n // not cross any loop). There may be a single such adjacent loop, or\n // there may be several (in which case they should all have the same\n // contains_origin() value). We choose L to be the loop containing the\n // origin whose depth is greatest, or loop(0) (a top-level shell) if no\n // such loop exists.\n //\n // 5. If (L originally contained origin) != (polygon contains origin), we\n // invert the polygon. This is done by inverting a top-level shell whose\n // turning angle is minimal and then fixing the nesting hierarchy. Note\n // that because we normalized all the loops initially, this step is only\n // necessary if the polygon requires at least one non-normalized loop to\n // represent it.\n var containedOrigin = new Map();\n for (var _iterator = _createForOfIteratorHelperLoose(loops), _step; !(_step = _iterator()).done;) {\n var _l = _step.value;\n containedOrigin.set(_l, _l.containsOrigin());\n }\n for (var _iterator2 = _createForOfIteratorHelperLoose(loops), _step2; !(_step2 = _iterator2()).done;) {\n var _l2 = _step2.value;\n var angle = _l2.turningAngle();\n if (Math.abs(angle) > _l2.turningAngleMaxError()) {\n if (angle < 0) _l2.invert(); // Normalize the loop.\n } else {\n if (_l2.containsOrigin()) _l2.invert(); // Ensure that the loop does not contain the origin.\n }\n }\n var p = new Polygon(loops);\n if (p.numLoops() > 0) {\n var originLoop = p.loop(0);\n var polygonContainsOrigin = false;\n for (var _iterator3 = _createForOfIteratorHelperLoose(p.loops), _step3; !(_step3 = _iterator3()).done;) {\n var l = _step3.value;\n if (l.containsOrigin()) {\n polygonContainsOrigin = !polygonContainsOrigin;\n originLoop = l;\n }\n }\n if (containedOrigin.get(originLoop) !== polygonContainsOrigin) {\n p.invert();\n }\n }\n return p;\n }\n /**\r\n * Invert inverts the polygon (replaces it by its complement).\r\n */;\n var _proto = Polygon.prototype;\n _proto.invert = function invert() {\n // Inverting any one loop will invert the polygon. The best loop to invert\n // is the one whose area is largest, since this yields the smallest area\n // after inversion. The loop with the largest area is always at depth 0.\n // The descendants of this loop all have their depth reduced by 1, while the\n // former siblings of this loop all have their depth increased by 1.\n // The empty and full polygons are handled specially.\n if (this.isEmpty()) {\n Object.assign(this, Polygon.fullPolygon());\n this.initLoopProperties();\n return;\n }\n if (this.isFull()) {\n Object.assign(this, new Polygon());\n this.initLoopProperties();\n return;\n }\n // Find the loop whose area is largest (i.e., whose turning angle is\n // smallest), minimizing calls to TurningAngle(). In particular, for\n // polygons with a single shell at level 0 there is no need to call\n // TurningAngle() at all. (This method is relatively expensive.)\n var best = 0;\n var none = 10.0;\n var bestAngle = none;\n for (var i = 1; i < this.numLoops(); i++) {\n if (this.loop(i).depth !== 0) continue;\n // We defer computing the turning angle of loop 0 until we discover\n // that the polygon has another top-level shell.\n if (bestAngle === none) bestAngle = this.loop(best).turningAngle();\n var angle = this.loop(i).turningAngle();\n // We break ties deterministically in order to avoid having the output\n // depend on the input order of the loops.\n if (angle < bestAngle || angle === bestAngle && this.compareLoops(this.loop(i), this.loop(best)) < 0) {\n best = i;\n bestAngle = angle;\n }\n }\n // Build the new loops vector, starting with the inverted loop.\n this.loop(best).invert();\n var newLoops = [];\n var lastBest = this.lastDescendant(best);\n newLoops.push(this.loop(best));\n // Add the former siblings of this loop as descendants.\n for (var _i = 0; _i < this.loops.length; _i++) {\n if (_i < best || _i > lastBest) {\n this.loop(_i).depth++;\n newLoops.push(this.loop(_i));\n }\n }\n // Add the former children of this loop as siblings.\n for (var _i2 = 0; _i2 < this.loops.length; _i2++) {\n if (_i2 > best && _i2 <= lastBest) {\n this.loop(_i2).depth--;\n newLoops.push(this.loop(_i2));\n }\n }\n this.loops = newLoops;\n this.initLoopProperties();\n }\n /**\r\n * Defines a total ordering on Loops that does not depend on the cyclic\r\n * order of loop vertices. This function is used to choose which loop to\r\n * invert in the case where several loops have exactly the same area.\r\n */;\n _proto.compareLoops = function compareLoops(a, b) {\n if (a.numVertices() !== b.numVertices()) return a.numVertices() - b.numVertices();\n var _a$canonicalFirstVert = a.canonicalFirstVertex(),\n ai = _a$canonicalFirstVert[0],\n aDir = _a$canonicalFirstVert[1];\n var _b$canonicalFirstVert = b.canonicalFirstVertex(),\n bi = _b$canonicalFirstVert[0],\n bDir = _b$canonicalFirstVert[1];\n if (aDir !== bDir) return aDir - bDir;\n for (var n = a.numVertices() - 1; n >= 0; n--, ai += aDir, bi += bDir) {\n var cmp = a.vertex(ai).vector.cmp(b.vertex(bi).vector);\n if (cmp !== 0) return cmp;\n }\n return 0;\n }\n /**\r\n * Returns a Polygon from a single loop created from the given Cell.\r\n * @category Constructors\r\n */;\n Polygon.fromCell = function fromCell(cell) {\n return new Polygon([Loop.fromCell(cell)]);\n }\n /**\r\n * Takes the set of loops in this polygon and performs the nesting\r\n * computations to set the proper nesting and parent/child relationships.\r\n */;\n _proto.initNested = function initNested() {\n if (this.loops.length === 1) {\n this.initOneLoop();\n return;\n }\n var lm = new LoopMap();\n this.loops.forEach(function (l) {\n lm.insertLoop(l, null);\n });\n // The loops have all been added to the loopMap for ordering. Clear the\n // loops slice because we add all the loops in-order in initLoops.\n this.loops = [];\n // Reorder the loops in depth-first traversal order.\n this.initLoops(lm);\n this.initLoopProperties();\n }\n /**\r\n * Set the properties for a polygon made of a single loop.\r\n */\n // TODO(roberts): Can this be merged with initLoopProperties\n ;\n _proto.initOneLoop = function initOneLoop() {\n this.hasHoles = false;\n this.numVertices = this.loops[0].vertices.length;\n this.bound = this.loops[0].rectBound();\n this.subregionBound = RectBounder.expandForSubregions(this.bound);\n // Ensure the loops depth is set correctly.\n this.loops[0].depth = 0;\n this.initEdgesAndIndex();\n }\n /**\r\n * Sets the properties for polygons with multiple loops.\r\n */;\n _proto.initLoopProperties = function initLoopProperties() {\n this.numVertices = 0;\n // the loops depths are set by initNested/initOriented prior to this.\n this.bound = Rect$1.emptyRect();\n this.hasHoles = false;\n for (var _iterator4 = _createForOfIteratorHelperLoose(this.loops), _step4; !(_step4 = _iterator4()).done;) {\n var l = _step4.value;\n if (l.isHole()) {\n this.hasHoles = true;\n } else {\n this.bound = this.bound.union(l.rectBound());\n }\n this.numVertices += l.numVertices();\n }\n this.subregionBound = RectBounder.expandForSubregions(this.bound);\n this.initEdgesAndIndex();\n }\n /**\r\n * Performs the shape related initializations and adds the final polygon to the index.\r\n */;\n _proto.initEdgesAndIndex = function initEdgesAndIndex() {\n this.nEdges = 0;\n this.cumulativeEdges = [];\n if (this.isFull()) return;\n var maxLinearSearchLoops = 12; // Based on benchmarks.\n if (this.loops.length > maxLinearSearchLoops) this.cumulativeEdges = [];\n for (var _iterator5 = _createForOfIteratorHelperLoose(this.loops), _step5; !(_step5 = _iterator5()).done;) {\n var l = _step5.value;\n if (this.cumulativeEdges.length > 0) {\n this.cumulativeEdges.push(this.nEdges);\n }\n this.nEdges += l.vertices.length;\n }\n this.index = new ShapeIndex();\n this.index.add(this);\n }\n /**\r\n * Returns a special \"full\" polygon.\r\n * @category Constructors\r\n */;\n Polygon.fullPolygon = function fullPolygon() {\n var fullLoop = Loop.fullLoop();\n var ret = new Polygon();\n ret.loops = [fullLoop];\n ret.numVertices = fullLoop.vertices.length;\n ret.bound = Rect$1.fullRect();\n ret.subregionBound = Rect$1.fullRect();\n ret.initEdgesAndIndex();\n return ret;\n }\n /**\r\n * Checks whether this is a valid polygon, including checking whether all the loops are themselves valid.\r\n */;\n _proto.validate = function validate() {\n for (var i = 0; i < this.loops.length; i++) {\n var l = this.loops[i];\n // Check for loop errors that don't require building a ShapeIndex.\n var err = l.findValidationErrorNoIndex();\n if (err) return new Error(\"loop \" + i + \": \" + err.message);\n // Check that no loop is empty, and that the full loop only appears in the full polygon.\n if (l.isEmpty()) return new Error(\"loop \" + i + \": empty loops are not allowed\");\n if (l.isFull() && this.loops.length > 1) return new Error(\"loop \" + i + \": full loop appears in non-full polygon\");\n }\n // Finally, verify the loop nesting hierarchy.\n return this.findLoopNestingError();\n }\n /**\r\n * Reports if there is an error in the loop nesting hierarchy.\r\n */;\n _proto.findLoopNestingError = function findLoopNestingError() {\n // First check that the loop depths make sense.\n var lastDepth = -1;\n for (var i = 0; i < this.loops.length; i++) {\n var depth = this.loops[i].depth;\n if (depth < 0 || depth > lastDepth + 1) return new Error(\"loop \" + i + \": invalid loop depth (\" + depth + \")\");\n lastDepth = depth;\n }\n // Then check that they correspond to the actual loop nesting. This test\n // is quadratic in the number of loops but the cost per iteration is small.\n for (var _i3 = 0; _i3 < this.loops.length; _i3++) {\n var l = this.loops[_i3];\n var last = this.lastDescendant(_i3);\n for (var j = 0; j < this.loops.length; j++) {\n if (_i3 === j) continue;\n var nested = j >= _i3 + 1 && j <= last;\n var reverseB = false;\n if (l.containsNonCrossingBoundary(this.loops[j], reverseB) !== nested) {\n var nestedStr = nested ? '' : 'not ';\n return new Error(\"invalid nesting: loop \" + _i3 + \" should \" + nestedStr + \"contain loop \" + j);\n }\n }\n }\n return null;\n }\n /** Reports whether this is the special \"empty\" polygon (consisting of no loops). */;\n _proto.isEmpty = function isEmpty() {\n return this.loops.length === 0;\n }\n /** Reports whether this is the special \"full\" polygon (consisting of a single loop that encompasses the entire sphere). */;\n _proto.isFull = function isFull() {\n return this.loops.length === 1 && this.loops[0].isFull();\n }\n /** Returns the number of loops in this polygon. */;\n _proto.numLoops = function numLoops() {\n return this.loops.length;\n }\n /**\r\n * Returns the loop at the given index. Note that during initialization,\r\n * the given loops are reordered according to a pre-order traversal of the loop\r\n * nesting hierarchy. This implies that every loop is immediately followed by\r\n * its descendants. This hierarchy can be traversed using the methods Parent,\r\n * LastDescendant, and Loop.depth.\r\n */;\n _proto.loop = function loop(k) {\n return this.loops[k];\n }\n /**\r\n * Returns the index of the parent of loop k.\r\n * If the loop does not have a parent, ok=false is returned.\r\n */;\n _proto.parent = function parent(k) {\n var _this$loops$k;\n // See where we are on the depth hierarchy.\n var depth = ((_this$loops$k = this.loops[k]) == null ? void 0 : _this$loops$k.depth) || 0;\n if (depth === 0) return [-1, false];\n // There may be several loops at the same nesting level as us that share a\n // parent loop with us. (Imagine a slice of swiss cheese, of which we are one loop.\n // we don't know how many may be next to us before we get back to our parent loop.)\n // Move up one position from us, and then begin traversing back through the set of loops\n // until we find the one that is our parent or we get to the top of the polygon.\n for (k--; k >= 0 && this.loops[k].depth <= depth; k--) {}\n return [k, true];\n }\n /**\r\n * Returns the index of the last loop that is contained within loop k.\r\n * If k is negative, it returns the last loop in the polygon.\r\n * Note that loops are indexed according to a pre-order traversal of the nesting\r\n * hierarchy, so the immediate children of loop k can be found by iterating over\r\n * the loops (k+1)..LastDescendant(k) and selecting those whose depth is equal\r\n * to Loop(k).depth+1.\r\n */;\n _proto.lastDescendant = function lastDescendant(k) {\n var _this$loops$k2;\n if (k < 0) return this.loops.length - 1;\n var depth = ((_this$loops$k2 = this.loops[k]) == null ? void 0 : _this$loops$k2.depth) || 0;\n // Find the next loop immediately past us in the set of loops, and then start\n // moving down the list until we either get to the end or find the next loop\n // that is higher up the hierarchy than we are.\n for (k++; k < this.loops.length && this.loops[k].depth > depth; k++) {}\n return k - 1;\n }\n /** Returns a bounding spherical cap. */;\n _proto.capBound = function capBound() {\n return this.bound.capBound();\n }\n /** Returns a bounding latitude-longitude rectangle. */;\n _proto.rectBound = function rectBound() {\n return this.bound;\n }\n /** Reports whether the polygon contains the point. */;\n _proto.containsPoint = function containsPoint(point) {\n // NOTE: A bounds check slows down this function by about 50%. It is\n // worthwhile only when it might allow us to delay building the index.\n if (!this.index.isFresh() && !this.bound.containsPoint(point)) return false;\n // For small polygons, and during initial construction, it is faster to just\n // check all the crossing.\n var maxBruteForceVertices = 32;\n if (this.numVertices < maxBruteForceVertices || this.index == null) {\n var inside = false;\n for (var _iterator6 = _createForOfIteratorHelperLoose(this.loops), _step6; !(_step6 = _iterator6()).done;) {\n var l = _step6.value;\n // use loops bruteforce to avoid building the index on each loop.\n inside = inside !== l.bruteForceContainsPoint(point);\n }\n return inside;\n }\n // Otherwise we look up the ShapeIndex cell containing this point.\n return new ContainsPointQuery(this.index, VERTEX_MODEL_SEMI_OPEN).contains(point);\n }\n /** Reports whether the polygon contains the given cell. */;\n _proto.containsCell = function containsCell(cell) {\n var it = this.index.iterator();\n var relation = it.locateCellID(cell.id);\n // If \"cell\" is disjoint from all index cells, it is not contained.\n // Similarly, if \"cell\" is subdivided into one or more index cells then it\n // is not contained, since index cells are subdivided only if they (nearly)\n // intersect a sufficient number of edges. (But note that if \"cell\" itself\n // is an index cell then it may be contained, since it could be a cell with\n // no edges in the loop interior.)\n if (relation !== INDEXED) return false;\n // Otherwise check if any edges intersect \"cell\".\n if (this.boundaryApproxIntersects(it, cell)) return false;\n // Otherwise check if the loop contains the center of \"cell\".\n return this.iteratorContainsPoint(it, cell.center());\n }\n /** Reports whether the polygon intersects the given cell. */;\n _proto.intersectsCell = function intersectsCell(cell) {\n var it = this.index.iterator();\n var relation = it.locateCellID(cell.id);\n // If cell does not overlap any index cell, there is no intersection.\n if (relation === DISJOINT) return false;\n // If cell is subdivided into one or more index cells, there is an\n // intersection to within the S2ShapeIndex error bound (see Contains).\n if (relation === SUBDIVIDED) return true;\n // If cell is an index cell, there is an intersection because index cells\n // are created only if they have at least one edge or they are entirely\n // contained by the loop.\n if (it.cellID() === cell.id) return true;\n // Otherwise check if any edges intersect cell.\n if (this.boundaryApproxIntersects(it, cell)) return true;\n // Otherwise check if the loop contains the center of cell.\n return this.iteratorContainsPoint(it, cell.center());\n }\n /** Computes a covering of the Polygon. */;\n _proto.cellUnionBound = function cellUnionBound() {\n return this.capBound().cellUnionBound();\n }\n /**\r\n * Reports whether the loop's boundary intersects cell.\r\n * It may also return true when the loop boundary does not intersect cell but\r\n * some edge comes within the worst-case error tolerance.\r\n *\r\n * This requires that it.Locate(cell) returned Indexed.\r\n */;\n _proto.boundaryApproxIntersects = function boundaryApproxIntersects(it, cell) {\n var aClipped = it.indexCell().findByShapeID(0);\n // If there are no edges, there is no intersection.\n if (aClipped.edges.length === 0) return false;\n // We can save some work if cell is the index cell itself.\n if (it.cellID() === cell.id) return true;\n // Otherwise check whether any of the edges intersect cell.\n var maxError = FACE_CLIP_ERROR_UV_COORD + INTERSECTS_RECT_ERROR_UV_DIST;\n var bound = cell.boundUV().expandedByMargin(maxError);\n for (var _iterator7 = _createForOfIteratorHelperLoose(aClipped.edges), _step7; !(_step7 = _iterator7()).done;) {\n var e = _step7.value;\n var edge = this.index.shape(0).edge(e);\n var _clipToPaddedFace = clipToPaddedFace(edge.v0, edge.v1, cell.face, maxError),\n v0 = _clipToPaddedFace[0],\n v1 = _clipToPaddedFace[1],\n ok = _clipToPaddedFace[2];\n if (ok && edgeIntersectsRect(v0, v1, bound)) return true;\n }\n return false;\n }\n /** Reports whether the iterator that is positioned at the ShapeIndexCell that may contain p, contains the point p. */;\n _proto.iteratorContainsPoint = function iteratorContainsPoint(it, point) {\n // Test containment by drawing a line segment from the cell center to the\n // given point and counting edge crossings.\n var aClipped = it.indexCell().findByShapeID(0);\n var inside = aClipped.containsCenter;\n if (aClipped.edges.length === 0) return inside;\n // This block requires ShapeIndex.\n var crosser = new EdgeCrosser(it.center(), point);\n var shape = this.index.shape(0);\n for (var _iterator8 = _createForOfIteratorHelperLoose(aClipped.edges), _step8; !(_step8 = _iterator8()).done;) {\n var e = _step8.value;\n var edge = shape.edge(e);\n inside = inside !== crosser.edgeOrVertexCrossing(edge.v0, edge.v1);\n }\n return inside;\n }\n // Shape Interface\n /** Returns the number of edges in this shape. */;\n _proto.numEdges = function numEdges() {\n return this.nEdges;\n }\n /** Returns endpoints for the given edge index. */;\n _proto.edge = function edge(e) {\n var i = 0;\n if (this.cumulativeEdges.length > 0) {\n for (i = 0; i < this.cumulativeEdges.length; i++) {\n if (i + 1 >= this.cumulativeEdges.length || e < this.cumulativeEdges[i + 1]) {\n e -= this.cumulativeEdges[i];\n break;\n }\n }\n } else {\n // When the number of loops is small, use linear search. Most often\n // there is exactly one loop and the code below executes zero times.\n for (i = 0; e >= this.loop(i).vertices.length; i++) {\n e -= this.loop(i).vertices.length;\n }\n }\n return new Edge(this.loop(i).orientedVertex(e), this.loop(i).orientedVertex(e + 1));\n }\n /** Returns the reference point for this polygon. */;\n _proto.referencePoint = function referencePoint() {\n var containsOrigin = false;\n for (var _iterator9 = _createForOfIteratorHelperLoose(this.loops), _step9; !(_step9 = _iterator9()).done;) {\n var l = _step9.value;\n containsOrigin = containsOrigin !== l.containsOrigin();\n }\n return originReferencePoint(containsOrigin);\n }\n /** Reports the number of contiguous edge chains in the Polygon. */;\n _proto.numChains = function numChains() {\n return this.numLoops();\n }\n /** Returns the i-th edge Chain (loop) in the Shape. */;\n _proto.chain = function chain(chainID) {\n if (this.cumulativeEdges.length > 0) {\n return new Chain(this.cumulativeEdges[chainID], this.loop(chainID).vertices.length);\n }\n var e = 0;\n for (var j = 0; j < chainID; j++) {\n e += this.loop(j).vertices.length;\n }\n // Polygon represents a full loop as a loop with one vertex, while\n // Shape represents a full loop as a chain with no vertices.\n var numVertices = this.loop(chainID).numVertices();\n if (numVertices !== 1) return new Chain(e, numVertices);\n return new Chain(e, 0);\n }\n /** Returns the j-th edge of the i-th edge Chain (loop). */;\n _proto.chainEdge = function chainEdge(i, j) {\n return new Edge(this.loop(i).orientedVertex(j), this.loop(i).orientedVertex(j + 1));\n }\n /** Returns a pair (i, j) such that edgeID is the j-th edge of the i-th edge Chain. */;\n _proto.chainPosition = function chainPosition(edgeID) {\n var i = 0;\n if (this.cumulativeEdges.length > 0) {\n for (i = 0; i < this.cumulativeEdges.length; i++) {\n if (i + 1 >= this.cumulativeEdges.length || edgeID < this.cumulativeEdges[i + 1]) {\n edgeID -= this.cumulativeEdges[i];\n break;\n }\n }\n } else {\n // When the number of loops is small, use linear search. Most often\n // there is exactly one loop and the code below executes zero times.\n for (i = 0; edgeID >= this.loop(i).vertices.length; i++) {\n edgeID -= this.loop(i).vertices.length;\n }\n }\n return new ChainPosition(i, edgeID);\n }\n /** Returns the dimension of the geometry represented by this Polygon. */;\n _proto.dimension = function dimension() {\n return 2;\n };\n _proto.typeTag = function typeTag() {\n return TypeTagPolygon;\n };\n _proto.privateInterface = function privateInterface() {}\n /**\r\n * Reports whether this polygon contains the other polygon.\r\n * Specifically, it reports whether all the points in the other polygon\r\n * are also in this polygon.\r\n */;\n _proto.contains = function contains(o) {\n // If both polygons have one loop, use the more efficient Loop method.\n // Note that Loop's Contains does its own bounding rectangle check.\n if (this.loops.length === 1 && o.loops.length === 1) {\n return this.loops[0].contains(o.loops[0]);\n }\n // Otherwise if neither polygon has holes, we can still use the more\n // efficient Loop's Contains method (rather than compareBoundary),\n // but it's worthwhile to do our own bounds check first.\n if (!this.subregionBound.contains(o.bound)) {\n // Even though Bound(A) does not contain Bound(B), it is still possible\n // that A contains B. This can only happen when union of the two bounds\n // spans all longitudes. For example, suppose that B consists of two\n // shells with a longitude gap between them, while A consists of one shell\n // that surrounds both shells of B but goes the other way around the\n // sphere (so that it does not intersect the longitude gap).\n if (!this.bound.lng.union(o.bound.lng).isFull()) return false;\n }\n if (!this.hasHoles && !o.hasHoles) {\n for (var _iterator0 = _createForOfIteratorHelperLoose(o.loops), _step0; !(_step0 = _iterator0()).done;) {\n var l = _step0.value;\n if (!this.anyLoopContains(l)) return false;\n }\n return true;\n }\n // Polygon A contains B iff B does not intersect the complement of A. From\n // the intersection algorithm below, this means that the complement of A\n // must exclude the entire boundary of B, and B must exclude all shell\n // boundaries of the complement of A. (It can be shown that B must then\n // exclude the entire boundary of the complement of A.) The first call\n // below returns false if the boundaries cross, therefore the second call\n // does not need to check for any crossing edges (which makes it cheaper).\n return this.containsBoundary(o) && o.excludesNonCrossingComplementShells(this);\n }\n /**\r\n * Reports whether this polygon intersects the other polygon, i.e.\r\n * if there is a point that is contained by both polygons.\r\n */;\n _proto.intersects = function intersects(o) {\n // If both polygons have one loop, use the more efficient Loop method.\n // Note that Loop Intersects does its own bounding rectangle check.\n if (this.loops.length === 1 && o.loops.length === 1) {\n return this.loops[0].intersects(o.loops[0]);\n }\n // Otherwise if neither polygon has holes, we can still use the more\n // efficient Loop.Intersects method. The polygons intersect if and\n // only if some pair of loop regions intersect.\n if (!this.bound.intersects(o.bound)) {\n return false;\n }\n if (!this.hasHoles && !o.hasHoles) {\n for (var _iterator1 = _createForOfIteratorHelperLoose(o.loops), _step1; !(_step1 = _iterator1()).done;) {\n var l = _step1.value;\n if (this.anyLoopIntersects(l)) {\n return true;\n }\n }\n return false;\n }\n // Polygon A is disjoint from B if A excludes the entire boundary of B and B\n // excludes all shell boundaries of A. (It can be shown that B must then\n // exclude the entire boundary of A.) The first call below returns false if\n // the boundaries cross, therefore the second call does not need to check\n // for crossing edges.\n return !this.excludesBoundary(o) || !o.excludesNonCrossingShells(this);\n }\n /**\r\n * Returns +1 if this polygon contains the boundary of B, -1 if A\r\n * excludes the boundary of B, and 0 if the boundaries of A and B cross.\r\n */;\n _proto.compareBoundary = function compareBoundary(o) {\n var result = -1;\n for (var i = 0; i < this.loops.length && result !== 0; i++) {\n // If B crosses any loop of A, the result is 0. Otherwise the result\n // changes sign each time B is contained by a loop of A.\n result *= -this.loops[i].compareBoundary(o);\n }\n return result;\n }\n /** Reports whether this polygon contains the entire boundary of B. */;\n _proto.containsBoundary = function containsBoundary(o) {\n for (var _iterator10 = _createForOfIteratorHelperLoose(o.loops), _step10; !(_step10 = _iterator10()).done;) {\n var l = _step10.value;\n if (this.compareBoundary(l) <= 0) {\n return false;\n }\n }\n return true;\n }\n /** Reports whether this polygon excludes the entire boundary of B. */;\n _proto.excludesBoundary = function excludesBoundary(o) {\n for (var _iterator11 = _createForOfIteratorHelperLoose(o.loops), _step11; !(_step11 = _iterator11()).done;) {\n var l = _step11.value;\n if (this.compareBoundary(l) >= 0) {\n return false;\n }\n }\n return true;\n }\n /**\r\n * Reports whether polygon A contains the boundary of loop B.\r\n * Shared edges are handled according to the rule described in loops containsNonCrossingBoundary.\r\n */;\n _proto.containsNonCrossingBoundary = function containsNonCrossingBoundary(o, reverse) {\n var inside = false;\n for (var _iterator12 = _createForOfIteratorHelperLoose(this.loops), _step12; !(_step12 = _iterator12()).done;) {\n var l = _step12.value;\n var x = l.containsNonCrossingBoundary(o, reverse);\n inside = inside != x;\n }\n return inside;\n }\n /**\r\n * Reports wheterh given two polygons A and B such that the\r\n * boundary of A does not cross any loop of B, if A excludes all shell boundaries of B.\r\n */;\n _proto.excludesNonCrossingShells = function excludesNonCrossingShells(o) {\n for (var _iterator13 = _createForOfIteratorHelperLoose(o.loops), _step13; !(_step13 = _iterator13()).done;) {\n var l = _step13.value;\n if (l.isHole()) continue;\n if (this.containsNonCrossingBoundary(l, false)) return false;\n }\n return true;\n }\n /**\r\n * Reports whether given two polygons A and B such that the boundary of A does not cross\r\n * any loop of B, if A excludes all shell boundaries of the complement of B.\r\n */;\n _proto.excludesNonCrossingComplementShells = function excludesNonCrossingComplementShells(o) {\n // Special case to handle the complement of the empty or full polygons.\n if (o.isEmpty()) return !this.isFull();\n if (o.isFull()) return true;\n // Otherwise the complement of B may be obtained by inverting loop(0) and\n // then swapping the shell/hole status of all other loops. This implies\n // that the shells of the complement consist of loop 0 plus all the holes of\n // the original polygon.\n for (var j = 0; j < o.loops.length; j++) {\n var l = o.loops[j];\n if (j > 0 && !l.isHole()) continue;\n // The interior of the complement is to the right of loop 0, and to the\n // left of the loops that were originally holes.\n if (this.containsNonCrossingBoundary(l, j === 0)) {\n return false;\n }\n }\n return true;\n }\n /** Reports whether any loop in this polygon contains the given loop. */;\n _proto.anyLoopContains = function anyLoopContains(o) {\n for (var _iterator14 = _createForOfIteratorHelperLoose(this.loops), _step14; !(_step14 = _iterator14()).done;) {\n var l = _step14.value;\n if (l.contains(o)) return true;\n }\n return false;\n }\n /** Reports whether any loop in this polygon intersects the given loop. */;\n _proto.anyLoopIntersects = function anyLoopIntersects(o) {\n for (var _iterator15 = _createForOfIteratorHelperLoose(this.loops), _step15; !(_step15 = _iterator15()).done;) {\n var l = _step15.value;\n if (l.intersects(o)) return true;\n }\n return false;\n }\n /**\r\n * Returns the area of the polygon interior, i.e. the region on the left side\r\n * of an odd number of loops. The return value is between 0 and 4*Pi.\r\n */;\n _proto.area = function area() {\n var area = 0;\n for (var _iterator16 = _createForOfIteratorHelperLoose(this.loops), _step16; !(_step16 = _iterator16()).done;) {\n var loop = _step16.value;\n area += loop.sign() * loop.area();\n }\n return area;\n }\n /**\r\n * Returns the true centroid of the polygon multiplied by the area of\r\n * the polygon. The result is not unit length, so you may want to normalize it.\r\n * Also note that in general, the centroid may not be contained by the polygon.\r\n *\r\n * We prescale by the polygon area for two reasons: (1) it is cheaper to\r\n * compute this way, and (2) it makes it easier to compute the centroid of\r\n * more complicated shapes (by splitting them into disjoint regions and\r\n * adding their centroids).\r\n */;\n _proto.centroid = function centroid() {\n var u = new Point$1(0, 0, 0).vector;\n for (var _iterator17 = _createForOfIteratorHelperLoose(this.loops), _step17; !(_step17 = _iterator17()).done;) {\n var loop = _step17.value;\n var v = loop.centroid().vector;\n if (loop.sign() < 0) {\n u = u.sub(v);\n } else {\n u = u.add(v);\n }\n }\n return Point$1.fromVector(u);\n };\n return Polygon;\n}();\n/**\r\n * LoopMap is a map of a loop to its immediate children with respect to nesting.\r\n * It is used to determine which loops are shells and which are holes.\r\n */\nvar LoopMap = /*#__PURE__*/function (_Map) {\n function LoopMap() {\n return _Map.apply(this, arguments) || this;\n }\n _inheritsLoose(LoopMap, _Map);\n var _proto2 = LoopMap.prototype;\n /**\r\n * insertLoop adds the given loop to the loop map under the specified parent.\r\n * All children of the new entry are checked to see if they need to move up to\r\n * a different level.\r\n */\n _proto2.insertLoop = function insertLoop(newLoop, parent) {\n var children = [];\n var done = false;\n while (!done) {\n children = _Map.prototype.get.call(this, parent) || [];\n done = true;\n for (var _iterator18 = _createForOfIteratorHelperLoose(children), _step18; !(_step18 = _iterator18()).done;) {\n var child = _step18.value;\n if (child.containsNested(newLoop)) {\n parent = child;\n done = false;\n break;\n }\n }\n }\n // Now, we have found a parent for this loop, it may be that some of the\n // children of the parent of this loop may now be children of the new loop.\n var newChildren = _Map.prototype.get.call(this, newLoop) || [];\n for (var i = 0; i < children.length;) {\n var _child = children[i];\n if (newLoop.containsNested(_child)) {\n newChildren.push(_child);\n children.splice(i, 1);\n } else {\n i++;\n }\n }\n _Map.prototype.set.call(this, newLoop, newChildren);\n _Map.prototype.set.call(this, parent, [].concat(children, [newLoop]));\n };\n return LoopMap;\n}(/*#__PURE__*/_wrapNativeSuper(Map));\n\n/**\r\n * Represents a sequence of zero or more vertices connected by\r\n * straight edges (geodesics). Edges of length 0 and 180 degrees are not\r\n * allowed, i.e. adjacent vertices should not be identical or antipodal.\r\n */\nvar Polyline = /*#__PURE__*/function () {\n /**\r\n * Returns a new Polyline.\r\n * @category Constructors\r\n */\n function Polyline(points) {\n if (points === void 0) {\n points = [];\n }\n this.points = points;\n }\n /**\r\n * Creates a new Polyline from the given LatLngs.\r\n * @category Constructors\r\n */\n Polyline.fromLatLngs = function fromLatLngs(points) {\n return new Polyline(points.map(Point$1.fromLatLng));\n }\n /**\r\n * Reverses the order of the Polyline vertices.\r\n */;\n var _proto = Polyline.prototype;\n _proto.reverse = function reverse() {\n var len = this.points.length;\n for (var i = 0; i < len / 2; i++) {\n var oppositeIndex = len - i - 1;\n var _ref = [this.points[oppositeIndex], this.points[i]];\n this.points[i] = _ref[0];\n this.points[oppositeIndex] = _ref[1];\n }\n }\n /**\r\n * Returns the length of this Polyline.\r\n */;\n _proto.length = function length() {\n var length = 0;\n for (var i = 1; i < this.points.length; i++) {\n length += this.points[i - 1].distance(this.points[i]);\n }\n return length;\n }\n /**\r\n * Returns the true centroid of the polyline multiplied by the length of the\r\n * polyline. The result is not unit length, so you may wish to normalize it.\r\n *\r\n * Scaling by the Polyline length makes it easy to compute the centroid\r\n * of several Polylines (by simply adding up their centroids).\r\n */;\n _proto.centroid = function centroid() {\n var centroid = new Point$1(0, 0, 0);\n for (var i = 1; i < this.points.length; i++) {\n var vSum = this.points[i - 1].vector.add(this.points[i].vector); // Length == 2*cos(theta)\n var vDiff = this.points[i - 1].vector.sub(this.points[i].vector); // Length == 2*sin(theta)\n centroid = Point$1.fromVector(centroid.vector.add(vSum.mul(Math.sqrt(vDiff.norm2() / vSum.norm2()))));\n }\n return centroid;\n }\n /**\r\n * Reports whether the given Polyline is exactly the same as this one.\r\n */;\n _proto.equal = function equal(b) {\n if (this.points.length !== b.points.length) return false;\n for (var i = 0; i < this.points.length; i++) {\n if (!this.points[i].equals(b.points[i])) return false;\n }\n return true;\n }\n /**\r\n * Reports whether two polylines have the same number of vertices,\r\n * and corresponding vertex pairs are separated by no more the provided margin.\r\n */;\n _proto.approxEqual = function approxEqual(o, maxError) {\n if (maxError === void 0) {\n maxError = EPSILON$1;\n }\n if (this.points.length !== o.points.length) return false;\n for (var i = 0; i < this.points.length; i++) {\n if (!this.points[i].approxEqual(o.points[i], maxError)) return false;\n }\n return true;\n }\n /**\r\n * Returns the bounding Cap for this Polyline.\r\n */;\n _proto.capBound = function capBound() {\n return this.rectBound().capBound();\n }\n /**\r\n * Returns the bounding Rect for this Polyline.\r\n */;\n _proto.rectBound = function rectBound() {\n var rb = new RectBounder();\n for (var _iterator = _createForOfIteratorHelperLoose(this.points), _step; !(_step = _iterator()).done;) {\n var v = _step.value;\n rb.addPoint(v);\n }\n return rb.rectBound();\n }\n /**\r\n * Reports whether this Polyline contains the given Cell. Always returns false\r\n * because \"containment\" is not numerically well-defined except at the Polyline vertices.\r\n */;\n _proto.containsCell = function containsCell(_cell) {\n return false;\n }\n /**\r\n * Reports whether this Polyline intersects the given Cell.\r\n */;\n _proto.intersectsCell = function intersectsCell(cell) {\n if (this.points.length === 0) return false;\n for (var _iterator2 = _createForOfIteratorHelperLoose(this.points), _step2; !(_step2 = _iterator2()).done;) {\n var v = _step2.value;\n if (cell.containsPoint(v)) return true;\n }\n var cellVertices = [cell.vertex(0), cell.vertex(1), cell.vertex(2), cell.vertex(3)];\n for (var j = 0; j < 4; j++) {\n var crosser = EdgeCrosser.newChainEdgeCrosser(cellVertices[j], cellVertices[j + 1 & 3], this.points[0]);\n for (var i = 1; i < this.points.length; i++) {\n if (crosser.chainCrossingSign(this.points[i]) !== DO_NOT_CROSS) return true;\n }\n }\n return false;\n }\n /**\r\n * Returns false since Polylines are not closed.\r\n */;\n _proto.containsPoint = function containsPoint(_point) {\n return false;\n }\n /**\r\n * Computes a covering of the Polyline.\r\n */;\n _proto.cellUnionBound = function cellUnionBound() {\n return this.capBound().cellUnionBound();\n }\n /**\r\n * Returns the number of edges in this shape.\r\n */;\n _proto.numEdges = function numEdges() {\n if (this.points.length === 0) return 0;\n return this.points.length - 1;\n }\n /**\r\n * Returns endpoints for the given edge index.\r\n */;\n _proto.edge = function edge(i) {\n return new Edge(this.points[i], this.points[i + 1]);\n }\n /**\r\n * Returns the default reference point with negative containment because Polylines are not closed.\r\n */;\n _proto.referencePoint = function referencePoint() {\n return originReferencePoint(false);\n }\n /**\r\n * Reports the number of contiguous edge chains in this Polyline.\r\n */;\n _proto.numChains = function numChains() {\n return Math.min(1, this.numEdges());\n }\n /**\r\n * Returns the i-th edge Chain in the Shape.\r\n */;\n _proto.chain = function chain(_chainID) {\n return new Chain(0, this.numEdges());\n }\n /**\r\n * Returns the j-th edge of the i-th edge Chain.\r\n */;\n _proto.chainEdge = function chainEdge(_chainID, offset) {\n return new Edge(this.points[offset], this.points[offset + 1]);\n }\n /**\r\n * Returns a pair (i, j) such that edgeID is the j-th edge\r\n */;\n _proto.chainPosition = function chainPosition(edgeID) {\n return new ChainPosition(0, edgeID);\n }\n /**\r\n * Returns the dimension of the geometry represented by this Polyline.\r\n */;\n _proto.dimension = function dimension() {\n return 1;\n }\n /**\r\n * Reports whether this shape contains no points.\r\n */;\n _proto.isEmpty = function isEmpty() {\n return defaultShapeIsEmpty(this);\n }\n /**\r\n * Reports whether this shape contains all points on the sphere.\r\n */;\n _proto.isFull = function isFull() {\n return defaultShapeIsFull(this);\n };\n _proto.typeTag = function typeTag() {\n return TypeTagPolyline;\n };\n _proto.privateInterface = function privateInterface() {\n // no-op function\n }\n /**\r\n * Reports the maximal end index such that the line segment between\r\n * the start index and this one such that the line segment between these two\r\n * vertices passes within the given tolerance of all interior vertices, in order.\r\n */;\n Polyline.findEndVertex = function findEndVertex(p, tolerance, index) {\n var origin = p.points[index];\n var frame = getFrame(origin);\n var currentWedge = Interval$1.fullInterval();\n var lastDistance = 0;\n for (index++; index < p.points.length; index++) {\n var candidate = p.points[index];\n var distance = origin.distance(candidate);\n if (distance > Math.PI / 2 && lastDistance > 0) break;\n if (distance < lastDistance && lastDistance > tolerance) break;\n lastDistance = distance;\n if (distance <= tolerance) continue;\n var direction = toFrame(frame, candidate);\n var center = Math.atan2(direction.y, direction.x);\n if (!currentWedge.contains(center)) break;\n var halfAngle = Math.asin(Math.sin(tolerance) / Math.sin(distance));\n var target = Interval$1.fromPointPair(center, center).expanded(halfAngle);\n currentWedge = currentWedge.intersection(target);\n }\n return index - 1;\n }\n /**\r\n * Returns a subsequence of vertex indices such that the\r\n * polyline connecting these vertices is never further than the given tolerance from\r\n * the original polyline.\r\n */;\n _proto.subsampleVertices = function subsampleVertices(tolerance) {\n var result = [];\n if (this.points.length < 1) return result;\n result.push(0);\n var clampedTolerance = Math.max(tolerance, 0);\n for (var index = 0; index + 1 < this.points.length;) {\n var nextIndex = Polyline.findEndVertex(this, clampedTolerance, index);\n if (!this.points[nextIndex].equals(this.points[index])) result.push(nextIndex);\n index = nextIndex;\n }\n return result;\n }\n /**\r\n * Returns a point on the polyline that is closest to the given point,\r\n * and the index of the next vertex after the projected point.\r\n */;\n _proto.project = function project$1(point) {\n if (this.points.length === 1) return [this.points[0], 1];\n var minDist = 10;\n var minIndex = -1;\n for (var i = 1; i < this.points.length; i++) {\n var dist = distanceFromSegment(point, this.points[i - 1], this.points[i]);\n if (dist < minDist) {\n minDist = dist;\n minIndex = i;\n }\n }\n var closest = project(point, this.points[minIndex - 1], this.points[minIndex]);\n if (closest.equals(this.points[minIndex])) minIndex++;\n return [closest, minIndex];\n }\n /**\r\n * Reports whether the point given is on the right hand side of the\r\n * polyline, using a naive definition of \"right-hand-sideness\".\r\n */;\n _proto.isOnRight = function isOnRight(point) {\n var _this$project = this.project(point),\n closest = _this$project[0],\n next = _this$project[1];\n if (closest.equals(this.points[next - 1]) && next > 1 && next < this.points.length) {\n if (point.equals(this.points[next - 1])) return false;\n return Point$1.orderedCCW(this.points[next - 2], point, this.points[next], this.points[next - 1]);\n }\n if (next === this.points.length) next--;\n return sign(point, this.points[next], this.points[next - 1]);\n }\n /**\r\n * Checks whether this is a valid polyline or not.\r\n */;\n _proto.validate = function validate() {\n for (var i = 0; i < this.points.length; i++) {\n if (!this.points[i].vector.isUnit()) return new Error(\"vertex \" + i + \" is not unit length\");\n }\n for (var _i = 1; _i < this.points.length; _i++) {\n var prev = this.points[_i - 1];\n var cur = this.points[_i];\n if (prev.equals(cur)) return new Error(\"vertices \" + (_i - 1) + \" and \" + _i + \" are identical\");\n if (prev.equals(Point$1.fromVector(cur.vector.mul(-1)))) return new Error(\"vertices \" + (_i - 1) + \" and \" + _i + \" are antipodal\");\n }\n return null;\n }\n /**\r\n * Reports whether this polyline intersects the given polyline.\r\n */;\n _proto.intersects = function intersects(o) {\n if (this.points.length === 0 || o.points.length === 0) return false;\n if (!this.rectBound().intersects(o.rectBound())) return false;\n for (var i = 1; i < this.points.length; i++) {\n var crosser = EdgeCrosser.newChainEdgeCrosser(this.points[i - 1], this.points[i], o.points[0]);\n for (var j = 1; j < o.points.length; j++) {\n if (crosser.chainCrossingSign(o.points[j]) !== DO_NOT_CROSS) return true;\n }\n }\n return false;\n }\n /**\r\n * Returns the point whose distance from vertex 0 along the polyline is\r\n * the given fraction of the polyline's total length, and the index of\r\n * the next vertex after the interpolated point P. Fractions less than zero\r\n * or greater than one are clamped. The return value is unit length. The cost of\r\n * this function is currently linear in the number of vertices.\r\n *\r\n * This method allows the caller to easily construct a given suffix of the\r\n * polyline by concatenating P with the polyline vertices starting at that next\r\n * vertex. Note that P is guaranteed to be different than the point at the next\r\n * vertex, so this will never result in a duplicate vertex.\r\n *\r\n * The polyline must not be empty. Note that if fraction >= 1.0, then the next\r\n * vertex will be set to len(p) (indicating that no vertices from the polyline\r\n * need to be appended). The value of the next vertex is always between 1 and\r\n * len(p).\r\n *\r\n * This method can also be used to construct a prefix of the polyline, by\r\n * taking the polyline vertices up to next vertex-1 and appending the\r\n * returned point P if it is different from the last vertex (since in this\r\n * case there is no guarantee of distinctness).\r\n */;\n _proto.interpolate = function interpolate(fraction) {\n if (fraction <= 0) return [this.points[0], 1];\n var target = fraction * this.length();\n for (var i = 1; i < this.points.length; i++) {\n var length = this.points[i - 1].distance(this.points[i]);\n if (target < length) {\n var result = interpolateAtDistance(target, this.points[i - 1], this.points[i]);\n if (result.equals(this.points[i])) return [result, i + 1];\n return [result, i];\n }\n target -= length;\n }\n return [this.points[this.points.length - 1], this.points.length];\n }\n /**\r\n * The inverse operation of interpolate. Given a point on the\r\n * polyline, it returns the ratio of the distance to the point from the\r\n * beginning of the polyline over the length of the polyline. The return\r\n * value is always between 0 and 1 inclusive.\r\n *\r\n * The polyline should not be empty. If it has fewer than 2 vertices, the\r\n * return value is zero.\r\n */;\n _proto.uninterpolate = function uninterpolate(point, nextVertex) {\n if (this.points.length < 2) return 0;\n var sum = 0;\n for (var i = 1; i < nextVertex; i++) {\n sum += this.points[i - 1].distance(this.points[i]);\n }\n var lengthToPoint = sum + this.points[nextVertex - 1].distance(point);\n for (var _i2 = nextVertex; _i2 < this.points.length; _i2++) {\n sum += this.points[_i2 - 1].distance(this.points[_i2]);\n }\n return Math.min(1.0, lengthToPoint / sum);\n };\n return Polyline;\n}();\n\n// NilRegion represents a Nil value\nvar NilRegion = /*#__PURE__*/function () {\n function NilRegion() {}\n var _proto = NilRegion.prototype;\n _proto.capBound = function capBound() {\n return Cap.emptyCap();\n };\n _proto.rectBound = function rectBound() {\n return Rect$1.emptyRect();\n };\n _proto.containsCell = function containsCell(_c) {\n return false;\n };\n _proto.intersectsCell = function intersectsCell(_c) {\n return false;\n };\n _proto.containsPoint = function containsPoint(_p) {\n return false;\n };\n _proto.cellUnionBound = function cellUnionBound() {\n return [];\n };\n return NilRegion;\n}();\n\n/**\r\n * RegionCoverer allows arbitrary regions to be approximated as unions of cells (CellUnion).\r\n * This is useful for implementing various sorts of search and precomputation operations.\r\n *\r\n * Typical usage:\r\n *\r\n * \trc = new RegionCoverer({ maxLevel: 30, maxCells: 5 })\r\n * \tr = Cap.fromCenterArea(center, area)\r\n * \tcovering = rc.covering(r)\r\n *\r\n * This yields a CellUnion of at most 5 cells that is guaranteed to cover the\r\n * given region (a disc-shaped region on the sphere).\r\n *\r\n * For covering, only cells where (level - MinLevel) is a multiple of LevelMod will be used.\r\n * This effectively allows the branching factor of the S2 CellID hierarchy to be increased.\r\n * Currently the only parameter values allowed are 1, 2, or 3, corresponding to\r\n * branching factors of 4, 16, and 64 respectively.\r\n *\r\n * Note the following:\r\n *\r\n * - MinLevel takes priority over MaxCells, i.e. cells below the given level will\r\n * never be used even if this causes a large number of cells to be returned.\r\n *\r\n * - For any setting of MaxCells, up to 6 cells may be returned if that\r\n * is the minimum number of cells required (e.g. if the region intersects\r\n * all six face cells). Up to 3 cells may be returned even for very tiny\r\n * convex regions if they happen to be located at the intersection of\r\n * three cube faces.\r\n *\r\n * - For any setting of MaxCells, an arbitrary number of cells may be\r\n * returned if MinLevel is too high for the region being approximated.\r\n *\r\n * - If MaxCells is less than 4, the area of the covering may be\r\n * arbitrarily large compared to the area of the original region even if\r\n * the region is convex (e.g. a Cap or Rect).\r\n *\r\n * The approximation algorithm is not optimal but does a pretty good job in\r\n * practice. The output does not always use the maximum number of cells\r\n * allowed, both because this would not always yield a better approximation,\r\n * and because MaxCells is a limit on how much work is done exploring the\r\n * possible covering as well as a limit on the final output size.\r\n *\r\n * Because it is an approximation algorithm, one should not rely on the\r\n * stability of the output. In particular, the output of the covering algorithm\r\n * may change across different versions of the library.\r\n *\r\n * One can also generate interior coverings, which are sets of cells which\r\n * are entirely contained within a region. Interior coverings can be\r\n * empty, even for non-empty regions, if there are no cells that satisfy\r\n * the provided constraints and are contained by the region. Note that for\r\n * performance reasons, it is wise to specify a MaxLevel when computing\r\n * interior coverings - otherwise for regions with small or zero area, the\r\n * algorithm may spend a lot of time subdividing cells all the way to leaf\r\n * level to try to find contained cells.\r\n *\r\n * @beta\r\n */\nvar RegionCoverer = /*#__PURE__*/function () {\n /**\r\n * Returns a new RegionCoverer with the appropriate defaults.\r\n *\r\n * @param options - RegionCoverer options\r\n *\r\n * @category Constructors\r\n */\n function RegionCoverer(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$minLevel = _ref.minLevel,\n minLevel = _ref$minLevel === void 0 ? 0 : _ref$minLevel,\n _ref$maxLevel = _ref.maxLevel,\n maxLevel = _ref$maxLevel === void 0 ? MAX_LEVEL : _ref$maxLevel,\n _ref$levelMod = _ref.levelMod,\n levelMod = _ref$levelMod === void 0 ? 1 : _ref$levelMod,\n _ref$maxCells = _ref.maxCells,\n maxCells = _ref$maxCells === void 0 ? 8 : _ref$maxCells;\n this.minLevel = minLevel;\n this.maxLevel = maxLevel;\n this.levelMod = levelMod;\n this.maxCells = maxCells;\n }\n /** Returns an instance of coverer with the same settings. */\n var _proto = RegionCoverer.prototype;\n _proto.coverer = function coverer() {\n return new Coverer(Math.max(0, Math.min(MAX_LEVEL, this.minLevel)), Math.max(0, Math.min(MAX_LEVEL, this.maxLevel)), Math.max(1, Math.min(3, this.levelMod)), this.maxCells);\n }\n /** Returns a CellUnion that covers the given region and satisfies the various restrictions. */;\n _proto.covering = function covering(region) {\n var covering = this.cellUnion(region);\n covering.denormalize(Math.max(0, Math.min(MAX_LEVEL, this.minLevel)), Math.max(1, Math.min(3, this.levelMod)));\n return covering;\n }\n /** Returns a CellUnion that is contained within the given region and satisfies the various restrictions. */;\n _proto.interiorCovering = function interiorCovering(region) {\n var intCovering = this.interiorCellUnion(region);\n intCovering.denormalize(Math.max(0, Math.min(MAX_LEVEL, this.minLevel)), Math.max(1, Math.min(3, this.levelMod)));\n return intCovering;\n }\n /**\r\n * Returns a normalized CellUnion that covers the given region and\r\n * satisfies the restrictions except for minLevel and levelMod. These criteria\r\n * cannot be satisfied using a cell union because cell unions are\r\n * automatically normalized by replacing four child cells with their parent\r\n * whenever possible. (Note that the list of cell ids passed to the CellUnion\r\n * constructor does in fact satisfy all the given restrictions.)\r\n */;\n _proto.cellUnion = function cellUnion(region) {\n var c = this.coverer();\n c.coveringInternal(region);\n var cu = c.result;\n cu.normalize();\n return cu;\n }\n /**\r\n * Returns a normalized CellUnion that is contained within the given region and\r\n * satisfies the restrictions except for minLevel and levelMod. These criteria\r\n * cannot be satisfied using a cell union because cell unions are\r\n * automatically normalized by replacing four child cells with their parent\r\n * whenever possible. (Note that the list of cell ids passed to the CellUnion\r\n * constructor does in fact satisfy all the given restrictions.)\r\n */;\n _proto.interiorCellUnion = function interiorCellUnion(region) {\n var c = this.coverer();\n c.interiorCovering = true;\n c.coveringInternal(region);\n var cu = c.result;\n cu.normalize();\n return cu;\n }\n /**\r\n * Returns a CellUnion that covers the given region similar to Covering,\r\n * except that this method is much faster and the coverings are not as tight.\r\n * All of the usual parameters are respected (MaxCells, MinLevel, MaxLevel, and LevelMod),\r\n * except that the implementation makes no attempt to take advantage of large values of\r\n * MaxCells. (A small number of cells will always be returned.)\r\n *\r\n * This function is useful as a starting point for algorithms that\r\n * recursively subdivide cells.\r\n */;\n _proto.fastCovering = function fastCovering(region) {\n var c = this.coverer();\n var cu = _construct(CellUnion, region.cellUnionBound());\n c.normalizeCovering(cu);\n return cu;\n }\n /**\r\n * Reports whether the given CellUnion represents a valid covering\r\n * that conforms to the current covering parameters. In particular:\r\n *\r\n * - All CellIDs must be valid.\r\n *\r\n * - CellIDs must be sorted and non-overlapping.\r\n *\r\n * - CellID levels must satisfy MinLevel, MaxLevel, and LevelMod.\r\n *\r\n * - If the covering has more than MaxCells, there must be no two cells with\r\n * a common ancestor at MinLevel or higher.\r\n *\r\n * - There must be no sequence of cells that could be replaced by an\r\n * ancestor (i.e. with LevelMod == 1, the 4 child cells of a parent).\r\n */;\n _proto.isCanonical = function isCanonical(covering) {\n return this.coverer().isCanonical(covering);\n };\n return RegionCoverer;\n}();\nvar Coverer = /*#__PURE__*/function () {\n /**\r\n * Returns a new Coverer.\r\n * @category Constructors\r\n */\n function Coverer(minLevel, maxLevel, levelMod, maxCells) {\n this.region = new NilRegion();\n this.result = new CellUnion();\n this.pq = new PriorityQueue();\n this.interiorCovering = false;\n this.minLevel = minLevel;\n this.maxLevel = maxLevel;\n this.levelMod = levelMod;\n this.maxCells = maxCells;\n }\n /**\r\n * Returns a new candidate with no children if the cell intersects the given region.\r\n * The candidate is marked as terminal if it should not be expanded further.\r\n */\n var _proto2 = Coverer.prototype;\n _proto2.newCandidate = function newCandidate(cell) {\n if (!this.region.intersectsCell(cell)) return new NilCandidate();\n var cand = new Candidate(cell);\n var level = cell.level;\n if (level >= this.minLevel) {\n if (this.interiorCovering) {\n if (this.region.containsCell(cell)) cand.terminal = true;else if (level + this.levelMod > this.maxLevel) return new NilCandidate();\n } else if (level + this.levelMod > this.maxLevel || this.region.containsCell(cell)) cand.terminal = true;\n }\n return cand;\n }\n /**\r\n * Populates the children of the candidate by expanding the given number of\r\n * levels from the given cell. Returns the number of children that were marked \"terminal\".\r\n */;\n _proto2.expandChildren = function expandChildren(cand, cell, numLevels) {\n numLevels--;\n var numTerminals = 0;\n var last = childEnd(cell.id);\n for (var ci = childBegin(cell.id); ci !== last; ci = next(ci)) {\n var childCell = Cell.fromCellID(ci);\n if (numLevels > 0) {\n if (this.region.intersectsCell(childCell)) {\n numTerminals += this.expandChildren(cand, childCell, numLevels);\n }\n continue;\n }\n var child = this.newCandidate(childCell);\n if (!(child instanceof NilCandidate)) {\n cand.children.push(child);\n cand.numChildren++;\n if (child.terminal) numTerminals++;\n }\n }\n return numTerminals;\n }\n /**\r\n * Adds the given candidate to the result if it is marked as \"terminal\",\r\n * otherwise expands its children and inserts it into the priority queue.\r\n * Passing an argument of nil does nothing.\r\n */;\n _proto2.addCandidate = function addCandidate(cand) {\n if (cand instanceof NilCandidate) return;\n if (cand.terminal) {\n this.result.push(cand.cell.id);\n return;\n }\n // Expand one level at a time until we hit minLevel to ensure that we don't skip over it.\n var numLevels = this.levelMod;\n var level = cand.cell.level;\n if (level < this.minLevel) numLevels = 1;\n var numTerminals = this.expandChildren(cand, cand.cell, numLevels);\n var maxChildrenShift = 2 * this.levelMod;\n if (cand.numChildren === 0) return;\n if (!this.interiorCovering && numTerminals === 1 << maxChildrenShift && level >= this.minLevel) {\n // Optimization: add the parent cell rather than all of its children.\n // We can't do this for interior coverings, since the children just\n // intersect the region, but may not be contained by it - we need to\n // subdivide them further.\n cand.terminal = true;\n this.addCandidate(cand);\n } else {\n // We negate the priority so that smaller absolute priorities are returned\n // first. The heuristic is designed to refine the largest cells first,\n // since those are where we have the largest potential gain. Among cells\n // of the same size, we prefer the cells with the fewest children.\n // Finally, among cells with equal numbers of children we prefer those\n // with the smallest number of children that cannot be refined further.\n cand.priority = -((level << maxChildrenShift) + cand.numChildren << maxChildrenShift + numTerminals);\n this.pq.push(cand);\n }\n }\n /**\r\n * Returns the reduced \"level\" so that it satisfies levelMod. Levels smaller than minLevel\r\n * are not affected (since cells at these levels are eventually expanded).\r\n */;\n _proto2.adjustLevel = function adjustLevel(level) {\n if (this.levelMod > 1 && level > this.minLevel) level -= (level - this.minLevel) % this.levelMod;\n return level;\n }\n /**\r\n * Ensures that all cells with level > minLevel also satisfy levelMod,\r\n * by replacing them with an ancestor if necessary. Cell levels smaller\r\n * than minLevel are not modified (see AdjustLevel). The output is\r\n * then normalized to ensure that no redundant cells are present.\r\n */;\n _proto2.adjustCellLevels = function adjustCellLevels(cells) {\n if (this.levelMod === 1) return;\n var out = 0;\n for (var _iterator = _createForOfIteratorHelperLoose(cells), _step; !(_step = _iterator()).done;) {\n var ci = _step.value;\n var level$1 = level(ci);\n var newLevel = this.adjustLevel(level$1);\n if (newLevel !== level$1) ci = parent(ci, newLevel);\n if (out > 0 && contains(cells[out - 1], ci)) continue;\n while (out > 0 && contains(ci, cells[out - 1])) out--;\n cells[out] = ci;\n out++;\n }\n cells.length = out;\n }\n /** Computes a set of initial candidates that cover the given region. */;\n _proto2.initialCandidates = function initialCandidates(region) {\n var temp = new RegionCoverer();\n temp.maxLevel = this.maxLevel;\n temp.levelMod = 1;\n temp.maxCells = Math.min(4, this.maxCells);\n var cells = temp.fastCovering(region);\n this.adjustCellLevels(cells);\n for (var _iterator2 = _createForOfIteratorHelperLoose(cells), _step2; !(_step2 = _iterator2()).done;) {\n var ci = _step2.value;\n this.addCandidate(this.newCandidate(Cell.fromCellID(ci)));\n }\n }\n /**\r\n * Generates a covering and stores it in result.\r\n * Strategy: Start with the 6 faces of the cube. Discard any\r\n * that do not intersect the shape. Then repeatedly choose the\r\n * largest cell that intersects the shape and subdivide it.\r\n *\r\n * result contains the cells that will be part of the output, while pq\r\n * contains cells that we may still subdivide further. Cells that are\r\n * entirely contained within the region are immediately added to the output,\r\n * while cells that do not intersect the region are immediately discarded.\r\n * Therefore pq only contains cells that partially intersect the region.\r\n * Candidates are prioritized first according to cell size (larger cells\r\n * first), then by the number of intersecting children they have (fewest\r\n * children first), and then by the number of fully contained children\r\n * (fewest children first).\r\n */;\n _proto2.coveringInternal = function coveringInternal(region) {\n this.region = region;\n this.initialCandidates(region);\n while (this.pq.length > 0 && (!this.interiorCovering || this.result.length < this.maxCells)) {\n var cand = this.pq.pop();\n // For interior covering we keep subdividing no matter how many children\n // candidate has. If we reach MaxCells before expanding all children,\n // we will just use some of them.\n // For exterior covering we cannot do this, because result has to cover the\n // whole region, so all children have to be used.\n // candidate.numChildren == 1 case takes care of the situation when we\n // already have more than MaxCells in result (minLevel is too high).\n // Subdividing of the candidate with one child does no harm in this case.\n if (this.interiorCovering || cand.cell.level < this.minLevel || cand.numChildren === 1 || this.result.length + this.pq.length + cand.numChildren <= this.maxCells) {\n for (var _iterator3 = _createForOfIteratorHelperLoose(cand.children), _step3; !(_step3 = _iterator3()).done;) {\n var child = _step3.value;\n if (!this.interiorCovering || this.result.length < this.maxCells) this.addCandidate(child);\n }\n } else {\n cand.terminal = true;\n this.addCandidate(cand);\n }\n }\n this.region = new NilRegion();\n this.pq.reset();\n // Rather than just returning the raw list of cell ids, we construct a cell\n // union and then denormalize it. This has the effect of replacing four\n // child cells with their parent whenever this does not violate the covering\n // parameters specified (min_level, level_mod, etc). This significantly\n // reduces the number of cells returned in many cases, and it is cheap\n // compared to computing the covering in the first place.\n this.result.normalize();\n if (this.minLevel > 0 || this.levelMod > 1) this.result.denormalize(this.minLevel, this.levelMod);\n }\n /**\r\n * Normalizes the \"covering\" so that it conforms to the\r\n * current covering parameters (maxCells, minLevel, MaxLevel, and levelMod).\r\n * This method makes no attempt to be optimal. In particular, if\r\n * minLevel > 0 or levelMod > 1 then it may return more than the\r\n * desired number of cells even when this isn't necessary.\r\n *\r\n * Note that when the covering parameters have their default values, almost\r\n * all of the code in this function is skipped.\r\n */;\n _proto2.normalizeCovering = function normalizeCovering(covering) {\n if (this.maxLevel < MAX_LEVEL || this.levelMod > 1) {\n for (var i = 0; i < covering.length; i++) {\n var level$1 = level(covering[i]);\n var newLevel = this.adjustLevel(Math.min(level$1, this.maxLevel));\n if (newLevel !== level$1) covering[i] = parent(covering[i], newLevel);\n }\n }\n // Sort the cells and simplify them.\n covering.normalize();\n // Make sure that the covering satisfies minLevel and levelMod,\n // possibly at the expense of satisfying MaxCells.\n if (this.minLevel > 0 || this.levelMod > 1) covering.denormalize(this.minLevel, this.levelMod);\n // If there are too many cells and the covering is very large, use the\n // RegionCoverer to compute a new covering. (This avoids possible O(n^2)\n // behavior of the simpler algorithm below.)\n var excess = covering.length - this.maxCells;\n if (excess <= 0 || this.isCanonical(covering)) return;\n if (excess * covering.length > 10000) {\n var rc = new RegionCoverer();\n var cov = rc.covering(covering);\n covering.length = 0;\n covering.push.apply(covering, cov);\n return;\n }\n // If there are still too many cells, then repeatedly replace two adjacent\n // cells in CellID order by their lowest common ancestor.\n while (covering.length > this.maxCells) {\n var bestIndex = -1;\n var bestLevel = -1;\n for (var _i = 0; _i + 1 < covering.length; _i++) {\n var _cellid$commonAncesto = commonAncestorLevel(covering[_i], covering[_i + 1]),\n _level = _cellid$commonAncesto[0],\n ok = _cellid$commonAncesto[1];\n if (!ok) continue;\n var adjustedLevel = this.adjustLevel(_level);\n if (adjustedLevel > bestLevel) {\n bestLevel = adjustedLevel;\n bestIndex = _i;\n }\n }\n if (bestLevel < this.minLevel) break;\n // Replace all cells contained by the new ancestor cell.\n var id = parent(covering[bestIndex], bestLevel);\n var replacements = this.replaceCellsWithAncestor(covering, id);\n covering.length = 0;\n covering.push.apply(covering, replacements);\n // Now repeatedly check whether all children of the parent cell are\n // present, in which case we can replace those cells with their parent.\n while (bestLevel > this.minLevel) {\n bestLevel -= this.levelMod;\n id = parent(id, bestLevel);\n if (!this.containsAllChildren(covering, id)) break;\n var _replacements = this.replaceCellsWithAncestor(covering, id);\n covering.length = 0;\n covering.push.apply(covering, _replacements);\n }\n }\n }\n /** Reports whether the covering is canonical. */;\n _proto2.isCanonical = function isCanonical(covering) {\n var trueMax = this.maxLevel;\n if (this.levelMod !== 1) trueMax = this.maxLevel - (this.maxLevel - this.minLevel) % this.levelMod;\n var tooManyCells = covering.length > this.maxCells;\n var sameParentCount = 1;\n var prevID = 0n;\n for (var _iterator4 = _createForOfIteratorHelperLoose(covering), _step4; !(_step4 = _iterator4()).done;) {\n var id = _step4.value;\n if (!valid(id)) return false;\n // Check that the CellID level is acceptable.\n var level$1 = level(id);\n if (level$1 < this.minLevel || level$1 > trueMax || this.levelMod > 1 && (level$1 - this.minLevel) % this.levelMod !== 0) return false;\n if (prevID !== 0n) {\n // Check that cells are sorted and non-overlapping.\n if (rangeMax(prevID) >= rangeMin(id)) return false;\n var _cellid$commonAncesto2 = commonAncestorLevel(id, prevID),\n lev = _cellid$commonAncesto2[0],\n ok = _cellid$commonAncesto2[1];\n // If there are too many cells, check that no pair of adjacent cells\n // could be replaced by an ancestor.\n if (tooManyCells && ok && lev >= this.minLevel) return false;\n // Check that there are no sequences of (4 ** level_mod) cells that all\n // have the same parent (considering only multiples of \"level_mod\").\n var pLevel = level$1 - this.levelMod;\n if (pLevel < this.minLevel || level$1 !== level(prevID) || parent(id, pLevel) !== parent(prevID, pLevel)) {\n sameParentCount = 1;\n } else {\n sameParentCount++;\n if (sameParentCount === 1 << 2 * this.levelMod) return false;\n }\n }\n prevID = id;\n }\n return true;\n };\n _proto2.containsAllChildren = function containsAllChildren(covering, id) {\n var pos = covering.findIndex(function (c) {\n return c >= rangeMin(id);\n });\n var level$1 = level(id) + this.levelMod;\n for (var child = childBeginAtLevel(id, level$1); child !== childEndAtLevel(id, level$1); child = next(child)) {\n if (pos === -1 || covering[pos] !== child) return false;\n pos++;\n }\n return true;\n }\n /**\r\n * Replaces all descendants of the given id in covering with id.\r\n * This requires the covering contains at least one descendant of id.\r\n */;\n _proto2.replaceCellsWithAncestor = function replaceCellsWithAncestor(covering, id) {\n var begin = binarySearch(covering.length, function (i) {\n return covering[i] > rangeMin(id);\n });\n var end = binarySearch(covering.length, function (i) {\n return covering[i] > rangeMax(id);\n });\n return [].concat(covering.slice(0, begin), [id], covering.slice(end));\n };\n return Coverer;\n}();\nvar Candidate =\n/**\r\n * Returns a new Candidate.\r\n * @category Constructors\r\n */\nfunction Candidate(cell) {\n this.terminal = false; // Cell should not be expanded further.\n this.numChildren = 0; // Number of children that intersect the region.\n this.children = []; // Actual size may be 0, 4, 16, or 64 elements.\n this.priority = 0; // Priority of the candidate.\n this.cell = cell;\n}; // NilCandidate represents a Nil value\nvar NilCandidate = function NilCandidate() {\n this.cell = Cell.fromCellID(SentinelCellID);\n this.terminal = false; // Cell should not be expanded further.\n this.numChildren = 0; // Number of children that intersect the region.\n this.children = []; // Actual size may be 0, 4, 16, or 64 elements.\n this.priority = 0; // Priority of the candidate.\n};\nvar PriorityQueue = /*#__PURE__*/function (_Array) {\n function PriorityQueue() {\n return _Array.apply(this, arguments) || this;\n }\n _inheritsLoose(PriorityQueue, _Array);\n var _proto3 = PriorityQueue.prototype;\n _proto3.len = function len() {\n return this.length;\n }\n // We want pop to give us the highest, not lowest, priority so we use greater than here.\n // less(i: number, j: number): boolean {\n // return this[i].priority > this[j].priority\n // }\n ;\n _proto3.swap = function swap(i, j) {\n var _ref2 = [this[j], this[i]];\n this[i] = _ref2[0];\n this[j] = _ref2[1];\n };\n _proto3.push = function push() {\n var _Array$prototype$push;\n for (var _len = arguments.length, x = new Array(_len), _key = 0; _key < _len; _key++) {\n x[_key] = arguments[_key];\n }\n var n = (_Array$prototype$push = _Array.prototype.push).call.apply(_Array$prototype$push, [this].concat(x));\n this.sort(PriorityQueue.ascending);\n return n;\n };\n _proto3.pop = function pop() {\n var x = _Array.prototype.pop.call(this);\n return x ? x : new NilCandidate();\n };\n _proto3.reset = function reset() {\n this.length = 0;\n };\n PriorityQueue.ascending = function ascending(a, b) {\n return a.priority < b.priority ? -1 : a.priority > b.priority ? 1 : 0;\n };\n return PriorityQueue;\n}(/*#__PURE__*/_wrapNativeSuper(Array));\n\n/**\r\n * Module s2 is a library for working with geometry in S² (spherical geometry).\r\n *\r\n * Its related modules, parallel to this one, are s1 (operates on S¹), r1 (operates on ℝ¹),\r\n * r2 (operates on ℝ²) and r3 (operates on ℝ³).\r\n\n * This package provides types and functions for the S2 cell hierarchy and coordinate systems.\r\n * The S2 cell hierarchy is a hierarchical decomposition of the surface of a unit sphere (S²) into “cells”; it is highly efficient, scales from continental size to under 1 cm² and preserves spatial locality (nearby cells have close IDs).\r\n *\r\n * More information including an in-depth introduction to S2 can be found on the S2 website https://s2geometry.io/\r\n * @module s2\r\n */\n// export { ShapeIndexCell } from './ShapeIndexCell'\n// export { ShapeIndexClippedShape } from './ShapeIndexClippedShape'\n// export { ShapeIndexIterator } from './ShapeIndexIterator'\n// export { ShapeIndexRegion } from './ShapeIndexRegion'\n// export { ShapeIndexTracker } from './ShapeIndexTracker'\n\nvar _index$4 = {\n __proto__: null,\n cellid: cellid,\n Cap: Cap,\n Cell: Cell,\n CellIndex: CellIndex,\n CellIndexRangeIterator: CellIndexRangeIterator,\n CellIndexContentsIterator: CellIndexContentsIterator,\n CellUnion: CellUnion,\n ClosestCellQuery: ClosestCellQuery,\n ClosestCellQueryOptions: ClosestCellQueryOptions,\n PointTarget: PointTarget$1,\n EdgeTarget: EdgeTarget$1,\n CellTarget: CellTarget$1,\n CellUnionTarget: CellUnionTarget,\n ShapeIndexTarget: ShapeIndexTarget$1,\n ClosestEdgeQuery: ClosestEdgeQuery,\n ClosestEdgeQueryOptions: ClosestEdgeQueryOptions,\n EdgeQueryPointTarget: PointTarget,\n EdgeQueryEdgeTarget: EdgeTarget,\n EdgeQueryCellTarget: CellTarget,\n EdgeQueryShapeIndexTarget: ShapeIndexTarget,\n LatLng: LatLng,\n Loop: Loop,\n Point: Point$1,\n Polygon: Polygon,\n Polyline: Polyline,\n Rect: Rect$1,\n RegionCoverer: RegionCoverer,\n Coverer: Coverer,\n ShapeIndex: ShapeIndex\n};\n\n/**\r\n * Returns a geojson Position given an s2 Point.\r\n * @category Constructors\r\n */\nvar marshal = function marshal(point) {\n var ll = LatLng.fromPoint(point);\n return [degrees(ll.lng), degrees(ll.lat)];\n};\n/**\r\n * Constructs an s2 Point given a geojson Position.\r\n * @category Constructors\r\n */\nvar unmarshal = function unmarshal(position) {\n return Point$1.fromLatLng(LatLng.fromDegrees(position[1], position[0]));\n};\n/**\r\n * Returns true IFF the two positions are equal.\r\n */\nvar equal = function equal(a, b, epsilon) {\n if (epsilon === void 0) {\n epsilon = 0;\n }\n if (epsilon == 0) return a[0] === b[0] && a[1] === b[1];\n return Math.abs(a[0] - b[0]) <= epsilon && Math.abs(a[1] - b[1]) <= epsilon;\n};\n\n/**\r\n * Returns a geojson Point geometry given an s2 Point.\r\n * @category Constructors\r\n */\nvar marshal$1 = function marshal$1(point) {\n return {\n type: 'Point',\n coordinates: marshal(point)\n };\n};\n/**\r\n * Constructs an s2 Point given a geojson Point geometry.\r\n * @category Constructors\r\n */\nvar unmarshal$1 = function unmarshal$1(geometry) {\n return unmarshal(geometry.coordinates);\n};\n/**\r\n * Returns a geojson MultiPoint geometry given s2 Points.\r\n * @category Constructors\r\n */\nvar marshalMulti = function marshalMulti(points) {\n return {\n type: 'MultiPoint',\n coordinates: points.map(marshal)\n };\n};\n/**\r\n * Constructs s2 Points given a geojson MultiPoint geometry.\r\n * @category Constructors\r\n */\nvar unmarshalMulti = function unmarshalMulti(geometry) {\n return geometry.coordinates.map(unmarshal);\n};\n\n/**\r\n * Returns a geojson LineString geometry given an s2 Polyline.\r\n * @category Constructors\r\n */\nvar marshal$2 = function marshal$1(polyline) {\n return {\n type: 'LineString',\n coordinates: polyline.points.map(marshal)\n };\n};\n/**\r\n * Constructs an s2 Polyline given a geojson LineString geometry.\r\n * @category Constructors\r\n */\nvar unmarshal$2 = function unmarshal$1(geometry) {\n return new Polyline(geometry.coordinates.map(unmarshal));\n};\n/**\r\n * Returns a geojson MultiLineString geometry given s2 Polylines.\r\n * @category Constructors\r\n */\nvar marshalMulti$1 = function marshalMulti(polylines) {\n return {\n type: 'MultiLineString',\n coordinates: polylines.map(function (polyline) {\n return polyline.points.map(marshal);\n })\n };\n};\n/**\r\n * Constructs s2 Polylines given a geojson MultiLineString geometry.\r\n * @category Constructors\r\n */\nvar unmarshalMulti$1 = function unmarshalMulti(geometry) {\n return geometry.coordinates.map(function (polyline) {\n return new Polyline(polyline.map(unmarshal));\n });\n};\n\n/**\r\n * Returns a geojson Polygon ring given an s2 Loop & ordinal.\r\n * @category Constructors\r\n */\nvar marshal$3 = function marshal$1(loop, ordinal) {\n var ring = loop.vertices.map(marshal);\n if (ordinal > 0) ring.reverse(); // outer ring remains CCW, inner rings become CW\n if (ring.length) ring.push(ring[0]); // add matching start/end points\n return ring;\n};\n/**\r\n * Constructs an s2 Loop given a geojson Polygon ring.\r\n * @category Constructors\r\n *\r\n * Handles differences between GeoJSON and S2:\r\n * - GeoJSON rings are oriented CCW for the exterior and CW for holes, in S2 all loops are oriented CCW.\r\n * - GeoJSON rings duplicate the start/end points, in S2 they do not.\r\n *\r\n * S2 Loops require the following properties be met:\r\n * - Loops are not allowed to have any duplicate vertices (whether adjacent or not).\r\n * - Non-adjacent edges are not allowed to intersect, and furthermore edges of length 180 degrees are not allowed (i.e., adjacent vertices cannot be antipodal).\r\n * - Loops must have at least 3 vertices.\r\n */\nvar unmarshal$3 = function unmarshal$1(ring) {\n if (ring.length < 3) return new Loop([]);\n ring = ring.slice(); // make a copy to avoid mutating input\n if (clockwise(ring)) ring.reverse(); // all rings must be CCW\n if (equal(ring.at(0), ring.at(-1))) ring.length -= 1; // remove matching start/end points\n // Loops are not allowed to have duplicate vertices (whether adjacent or not)\n if (containsDuplicateVertices(ring)) {\n // adjacent duplicates are fixable\n ring = removeAdjacentDuplicateVertices(ring, 0);\n if (ring.length < 3) return new Loop([]);\n // non-adjacent duplicates are not fixable\n if (containsDuplicateVertices(ring)) return new Loop([]);\n }\n return new Loop(ring.map(unmarshal));\n};\n/**\r\n * Removes *adjacent* duplicate (and near-duplicate) vertices from ring.\r\n */\nvar removeAdjacentDuplicateVertices = function removeAdjacentDuplicateVertices(ring, epsilon) {\n if (epsilon === void 0) {\n epsilon = 1e-8;\n }\n return ring.filter(function (p, i) {\n return !i || !equal(ring.at(i - 1), p, epsilon);\n });\n};\n/**\r\n * Returns true IFF ring contains duplicate vertices at any position.\r\n */\nvar containsDuplicateVertices = function containsDuplicateVertices(ring) {\n return new Set(ring.map(function (c) {\n return c[0] + \"|\" + c[1];\n })).size !== ring.length;\n};\n/**\r\n * Returns true IFF ring is oriented Clockwise.\r\n */\nvar clockwise = function clockwise(ring) {\n var sum = 0;\n for (var i = 1; i < ring.length; i++) {\n sum += (ring[i][0] - ring[i - 1][0]) * (ring[i][1] + ring[i - 1][1]);\n }\n return sum > 0;\n};\n\n/**\r\n * Returns a geojson Polygon geometry given an s2 Polygon.\r\n * @category Constructors\r\n */\nvar marshal$4 = function marshal(polygon) {\n return {\n type: 'Polygon',\n coordinates: polygon.loops.map(marshal$3)\n };\n};\n/**\r\n * Constructs an s2 Polygon given a geojson Polygon geometry.\r\n * @category Constructors\r\n */\nvar unmarshal$4 = function unmarshal(geometry) {\n return new Polygon(geometry.coordinates.map(unmarshal$3));\n};\n/**\r\n * Returns a geojson MultiPolygon geometry given s2 Polygons.\r\n * @category Constructors\r\n */\nvar marshalMulti$2 = function marshalMulti(polygons) {\n return {\n type: 'MultiPolygon',\n coordinates: polygons.map(function (polygon) {\n return polygon.loops.map(marshal$3);\n })\n };\n};\n/**\r\n * Constructs s2 Polygons given a geojson MultiPolygon geometry.\r\n * @category Constructors\r\n */\nvar unmarshalMulti$2 = function unmarshalMulti(geometry) {\n return geometry.coordinates.map(function (coords) {\n return new Polygon(coords.map(unmarshal$3));\n });\n};\n\n/**\r\n * Returns a geojson Polygon geometry given an s2 Rect.\r\n * @category Constructors\r\n */\nvar marshal$5 = function marshal(rect) {\n var loop = new Loop(Array.from({\n length: 4\n }, function (_, i) {\n return Point$1.fromLatLng(rect.vertex(i));\n }));\n return marshal$4(Polygon.fromOrientedLoops([loop]));\n};\n/**\r\n * Constructs an s2 Rect given a geojson Polygon geometry.\r\n * @category Constructors\r\n */\nvar unmarshal$5 = function unmarshal(geometry) {\n var ring = geometry.coordinates[0];\n var lngLo = Math.min(ring[0][0], ring[2][0]);\n var lngHi = Math.max(ring[0][0], ring[2][0]);\n var latLo = Math.min(ring[0][1], ring[2][1]);\n var latHi = Math.max(ring[0][1], ring[2][1]);\n return new Rect$1(new Interval(latLo * DEGREE, latHi * DEGREE), Interval$1.fromEndpoints(lngLo * DEGREE, lngHi * DEGREE));\n};\n/**\r\n * Returns true iff the geojson Polygon represents a valid Rect.\r\n * @category Constructors\r\n */\nvar valid$1 = function valid(geometry) {\n if ((geometry == null ? void 0 : geometry.type) !== 'Polygon') return false;\n if ((geometry == null ? void 0 : geometry.coordinates.length) !== 1) return false;\n var ring = geometry.coordinates[0];\n if (ring.length !== 5) return false;\n if (!pointsEqual(ring[0], ring[4])) return false;\n if (!lngEqual(ring[0], ring[3])) return false;\n if (!lngEqual(ring[1], ring[2])) return false;\n if (!latEqual(ring[0], ring[1])) return false;\n if (!latEqual(ring[2], ring[3])) return false;\n return true;\n};\nvar lngEqual = function lngEqual(a, b) {\n return a[0] === b[0];\n};\nvar latEqual = function latEqual(a, b) {\n return a[1] === b[1];\n};\nvar pointsEqual = function pointsEqual(a, b) {\n return lngEqual(a, b) && latEqual(a, b);\n};\n\n/**\r\n * Returns a geojson Geometry given a s2 shape(s).\r\n * @category Constructors\r\n */\nvar toGeoJSON = function toGeoJSON(shape) {\n var _shape;\n if (typeof shape === 'bigint') shape = Cell.fromCellID(shape);\n if (shape instanceof Cell) shape = Polygon.fromCell(shape);\n if (shape instanceof Point$1) return marshal$1(shape);\n if (shape instanceof Polyline) return marshal$2(shape);\n if (shape instanceof Polygon) return marshal$4(shape);\n if (shape instanceof Rect$1) return marshal$5(shape);\n if (Array.isArray(shape) && shape.length) {\n if (shape.every(function (g) {\n return g instanceof Point$1;\n })) return marshalMulti(shape);\n if (shape.every(function (g) {\n return g instanceof Polyline;\n })) return marshalMulti$1(shape);\n if (shape.every(function (g) {\n return g instanceof Polygon;\n })) return marshalMulti$2(shape);\n }\n throw new Error(\"unsupported: \" + (((_shape = shape) == null || (_shape = _shape.constructor) == null ? void 0 : _shape.name) || typeof shape));\n};\n/**\r\n * Constructs s2 shape(s) given a geojson geometry.\r\n * @category Constructors\r\n */\nvar fromGeoJSON = function fromGeoJSON(geometry) {\n var t = geometry == null ? void 0 : geometry.type;\n if (t === 'Point') return unmarshal$1(geometry);\n if (t === 'LineString') return unmarshal$2(geometry);\n if (t === 'Polygon') {\n if (valid$1(geometry)) return unmarshal$5(geometry);\n return unmarshal$4(geometry);\n }\n if (t === 'MultiPoint') return unmarshalMulti(geometry);\n if (t === 'MultiLineString') return unmarshalMulti$1(geometry);\n if (t === 'MultiPolygon') return unmarshalMulti$2(geometry);\n throw new Error(\"unsupported: \" + (t || 'UnknownGeometryType'));\n};\n\n/**\r\n * RegionCoverer allows arbitrary GeoJSON geometries to be approximated as unions of cells (CellUnion).\r\n *\r\n * Typical usage:\r\n *\r\n * \tfeature = loadGeoJSON()\r\n * \trc = new RegionCoverer({ maxCells: 256, memberMaxCells: 64 })\r\n * \tcovering = rc.covering(feature.geometry)\r\n *\r\n * @beta unstable API\r\n */\nvar RegionCoverer$1 = /*#__PURE__*/function () {\n /**\r\n * Returns a new RegionCoverer with the appropriate defaults.\r\n *\r\n * @param options - RegionCoverer options\r\n *\r\n * @category Constructors\r\n */\n function RegionCoverer$1(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$minLevel = _ref.minLevel,\n minLevel = _ref$minLevel === void 0 ? 0 : _ref$minLevel,\n _ref$maxLevel = _ref.maxLevel,\n maxLevel = _ref$maxLevel === void 0 ? MAX_LEVEL : _ref$maxLevel,\n _ref$levelMod = _ref.levelMod,\n levelMod = _ref$levelMod === void 0 ? 1 : _ref$levelMod,\n _ref$maxCells = _ref.maxCells,\n maxCells = _ref$maxCells === void 0 ? 8 : _ref$maxCells,\n _ref$memberMaxCells = _ref.memberMaxCells,\n memberMaxCells = _ref$memberMaxCells === void 0 ? Math.max(Math.floor(maxCells / 10), 8) : _ref$memberMaxCells,\n _ref$compactAt = _ref.compactAt,\n compactAt = _ref$compactAt === void 0 ? 65536 : _ref$compactAt,\n _ref$smallAreaEpsilon = _ref.smallAreaEpsilon,\n smallAreaEpsilon = _ref$smallAreaEpsilon === void 0 ? 1e-6 : _ref$smallAreaEpsilon;\n this.coverer = new RegionCoverer({\n minLevel: minLevel,\n maxLevel: maxLevel,\n levelMod: levelMod,\n maxCells: maxCells\n });\n this.memberCoverer = new RegionCoverer({\n minLevel: minLevel,\n maxLevel: maxLevel,\n levelMod: levelMod,\n maxCells: memberMaxCells\n });\n this.compactAt = compactAt;\n this.smallAreaEpsilon = smallAreaEpsilon;\n }\n /** Computes the covering of a multi-member geometry (ie. MultiPoint, MultiLineString, MultiPolygon). */\n var _proto = RegionCoverer$1.prototype;\n _proto.mutliMemberCovering = function mutliMemberCovering(shapes) {\n var _this = this;\n // sort shapes from largest to smallest\n shapes.sort(function (a, b) {\n return RegionCoverer$1.area(b) - RegionCoverer$1.area(a);\n });\n var union = new CellUnion();\n shapes.forEach(function (shape) {\n var area = RegionCoverer$1.area(shape);\n var isPolygon = shape instanceof Polygon;\n // discard zero-area polygons\n if (isPolygon && area <= 0) return;\n // optionally elect to use a fast covering method for small areas\n var fast = union.length >= _this.memberCoverer.maxCells && area < _this.smallAreaEpsilon;\n var cov = fast ? _this.memberCoverer.fastCovering(shape) : _this.memberCoverer.covering(shape);\n // discard errorneous members which cover the entire planet\n if (!RegionCoverer$1.validCovering(shape, cov)) return;\n // append covering to union\n union = CellUnion.fromUnion(union, cov);\n // force compact large coverings to avoid OOM errors\n if (union.length >= _this.compactAt) union = _this.coverer.covering(union);\n });\n // reduce the global covering to maxCells\n return this.coverer.covering(union);\n }\n /** Returns a CellUnion that covers the given GeoJSON geometry and satisfies the various restrictions. */;\n _proto.covering = function covering(geometry) {\n var shape = fromGeoJSON(geometry);\n if (Array.isArray(shape)) return this.mutliMemberCovering(shape);\n // discard zero-area polygons\n if (shape instanceof Polygon && RegionCoverer$1.area(shape) <= 0) return new CellUnion();\n // discard errorneous shapes which cover the entire planet\n var cov = this.coverer.covering(shape);\n if (!RegionCoverer$1.validCovering(shape, cov)) return new CellUnion();\n return cov;\n }\n /** Computes the area of a shape */;\n RegionCoverer$1.area = function area(shape) {\n if (shape instanceof Polygon) return shape.area();\n if (shape instanceof Polyline) shape.capBound().area();\n if (shape instanceof Rect$1) shape.capBound().area();\n return 0;\n }\n /** Attempts to detect invalid geometries which produce global coverings */;\n RegionCoverer$1.validCovering = function validCovering(shape, covering) {\n if (covering.length !== 6 || !covering.every(isFace)) return true;\n // compare the polygon covering with a covering of the outer ring as a linestring\n if (shape instanceof Polygon) {\n var union = new Polyline(shape.loop(0).vertices).cellUnionBound();\n return union.length === 6 && union.every(isFace);\n }\n // area is too small to have a global covering\n return this.area(shape) < Math.PI * 2;\n };\n return RegionCoverer$1;\n}();\n\n\n\nvar _index$5 = {\n __proto__: null,\n toGeoJSON: toGeoJSON,\n fromGeoJSON: fromGeoJSON,\n RegionCoverer: RegionCoverer$1\n};\n\nexport { _index$5 as geojson, _index as r1, _index$1 as r2, _index$2 as r3, _index$3 as s1, _index$4 as s2 };\n//# sourceMappingURL=s2js.esm.js.map\n","import { DatabaseSync } from 'node:sqlite'\nimport type { StatementSync } from 'node:sqlite'\nimport { s2, geojson } from 's2js'\nimport { thin } from './timeWindow.js'\nimport type { TrackQuery } from './timeWindow.js'\nimport type { TrackStore } from './store.js'\nimport { createInBounds, createMatcher, splitAtAntimeridian } from './utils.js'\nimport type {\n Context,\n Debug,\n GeoBounds,\n LatLngTuple,\n TimedPosition,\n TimedTrackCollection,\n TimeWindow,\n TrackCollection,\n TrackParams,\n} from './types.js'\n\nexport class TransactionStateError extends Error {}\n\n/**\n * S2 cell ids are unsigned 64-bit; SQLite's INTEGER is signed 64-bit, and\n * node:sqlite refuses to bind a bigint above INT64_MAX outright:\n *\n * TypeError: BigInt value is too large to bind\n *\n * Reinterpreting the same bits as signed is lossless in both directions, which\n * casting to Number is not — a real cell id is far above Number's 2^53 exact\n * range and comes back off by one.\n */\nconst toSigned = (id: bigint): bigint => BigInt.asIntN(64, id)\nconst toUnsigned = (id: bigint): bigint => BigInt.asUintN(64, id)\n\n/** Inclusive id range covering every cell contained by `cellId`. */\nconst cellRange = (cellId: bigint): { start: bigint; end: bigint } => {\n if (cellId === 0n) {\n return { start: 0n, end: 2n }\n }\n let lsb = 0n\n let temp = cellId\n while ((temp & 1n) === 0n) {\n temp >>= 1n\n lsb++\n }\n return {\n start: cellId & (cellId - 1n),\n end: cellId | (1n << (lsb + 1n)) | ((1n << lsb) - 1n),\n }\n}\n\nconst cellIdFor = ([lat, lng]: LatLngTuple): bigint => s2.cellid.fromLatLng(s2.LatLng.fromDegrees(lat, lng))\n\n/**\n * Cover a bounds with S2 cells, splitting it at the antimeridian first.\n *\n * maxCells is a deliberate trade: a coarse covering is a superset of the box,\n * so every query post-filters by exact bounds anyway. Asking for more cells\n * buys a tighter prefilter at the cost of a longer WHERE clause.\n */\nconst coveringFor = (bounds: GeoBounds, maxCells: number): bigint[] => {\n const coverer = new geojson.RegionCoverer({ maxLevel: 30, maxCells })\n return splitAtAntimeridian(bounds).flatMap(({ sw, ne }) => {\n const [south, west] = sw\n const [north, east] = ne\n return coverer.covering({\n type: 'Polygon',\n coordinates: [\n [\n [west, south],\n [west, north],\n [east, north],\n [east, south],\n [west, south],\n ],\n ],\n })\n })\n}\n\ninterface PositionRow {\n context: string\n timestamp: number\n lat: number\n lon: number\n}\n\nexport interface SqliteStoreConfig {\n /** Absolute path to the database file, or ':memory:'. */\n file: string\n /**\n * Minimum spacing between stored positions, in ms. 0 stores every one.\n *\n * The same `resolution` the in-memory accumulator applies with\n * `throttleTime`, enforced here on write instead. Without it a boat emitting\n * position at 8 Hz writes ~700k rows a day rather than the ~1.4k a 60s\n * resolution implies — a difference that lands on an SD card.\n */\n resolution?: number\n /** Drop positions older than this many ms. 0 keeps everything. */\n retention?: number\n /** Cells per bounding box covering. */\n maxCells?: number\n /** A gap longer than this ms starts a new track segment. */\n segmentGap?: number\n}\n\nconst DEFAULT_MAX_CELLS = 8\nconst DEFAULT_SEGMENT_GAP = 5 * 60 * 1000\n\n/**\n * A position store backed by SQLite, so tracks survive a restart.\n *\n * Uses node:sqlite rather than better-sqlite3: it is built into Node >= 22, so\n * installing the plugin on a Raspberry Pi needs no native compilation.\n *\n * The spatial index is Teppo Kurki's design from SignalK/tracks#11 — an S2 cell\n * id per position, queried as id ranges — as is segmenting a track on a time\n * gap. Both are reimplemented here rather than rebased; see that PR for the\n * original.\n */\nexport class SqliteTrackStore implements TrackStore {\n private readonly db: DatabaseSync\n private readonly insert: StatementSync\n private readonly insertName: StatementSync\n private readonly selectName: StatementSync\n private readonly maxCells: number\n private readonly segmentGap: number\n private readonly retention: number\n private readonly resolution: number\n private readonly debug: Debug\n /** Timestamp of the last position stored per context, for throttling. */\n private readonly lastStored = new Map<string, number>()\n /**\n * The stored name per context, dated by its newest report. A name arrives\n * with every position, so a repeat is answered here instead of committing a\n * row that has not changed.\n */\n private readonly lastName = new Map<string, { name: string; timestamp: number }>()\n\n constructor(config: SqliteStoreConfig, debug: Debug) {\n this.maxCells = config.maxCells ?? DEFAULT_MAX_CELLS\n this.segmentGap = config.segmentGap ?? DEFAULT_SEGMENT_GAP\n this.retention = config.retention ?? 0\n this.resolution = config.resolution ?? 0\n this.debug = debug\n\n this.db = new DatabaseSync(config.file)\n // WAL keeps a reader from blocking the writer, which matters because\n // positions arrive continuously while a query is being served.\n this.db.exec('PRAGMA journal_mode = WAL')\n // node:sqlite defaults to FULL, an fsync on every commit, and on an SD\n // card each one can take seconds. NORMAL syncs only at checkpoints. A\n // power cut can then lose the most recent commits but never corrupts the\n // database, and a process crash loses nothing. It is a per-connection\n // setting, so it is set on every open.\n this.db.exec('PRAGMA synchronous = NORMAL')\n // A lock held by another connection, a backup or an sqlite3 shell say, is\n // waited out rather than failing the write at once.\n this.db.exec('PRAGMA busy_timeout = 5000')\n this.db.exec(`\n CREATE TABLE IF NOT EXISTS positions (\n context TEXT NOT NULL,\n timestamp INTEGER NOT NULL,\n lat REAL NOT NULL,\n lon REAL NOT NULL,\n s2cell INTEGER NOT NULL\n );\n CREATE INDEX IF NOT EXISTS idx_s2cell ON positions(s2cell);\n CREATE INDEX IF NOT EXISTS idx_context_timestamp ON positions(context, timestamp);\n -- A separate table rather than a column on positions: this store has no\n -- migration mechanism, so a new table appears harmlessly on a database\n -- written by an older version, where an ALTER TABLE would not.\n CREATE TABLE IF NOT EXISTS names (\n context TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n timestamp INTEGER NOT NULL\n );\n `)\n this.insert = this.db.prepare('INSERT INTO positions (context, timestamp, lat, lon, s2cell) VALUES (?, ?, ?, ?, ?)')\n // Newer wins: a corrected or changed name replaces what is stored, while\n // an older observation arriving late leaves it alone.\n this.insertName = this.db.prepare(\n `INSERT INTO names (context, name, timestamp) VALUES (?, ?, ?)\n ON CONFLICT(context) DO UPDATE SET name = excluded.name, timestamp = excluded.timestamp\n WHERE excluded.timestamp >= names.timestamp`,\n )\n this.selectName = this.db.prepare('SELECT name FROM names WHERE context = ?')\n }\n\n newPosition(context: Context, position: LatLngTuple, timestamp: number = Date.now()): void {\n // Leading-edge throttle per context, matching the in-memory accumulator's\n // throttleTime: the first position in a resolution window is stored and the\n // rest are dropped, not averaged. A vessel emitting at 8 Hz would otherwise\n // write hundreds of thousands of rows a day at the default 60s resolution.\n if (this.resolution > 0) {\n const previous = this.lastStored.get(context)\n // `<` not `<=`: two positions sharing a timestamp are the same instant,\n // and a stored point must not block one that is genuinely later.\n if (previous !== undefined && timestamp - previous < this.resolution) {\n return\n }\n this.lastStored.set(context, timestamp)\n }\n this.store(context, position, timestamp)\n }\n\n private store(context: Context, position: LatLngTuple, timestamp: number): void {\n this.insert.run(context, timestamp, position[0], position[1], toSigned(cellIdFor(position)))\n }\n\n initialTrack(context: Context, track: LatLngTuple[], timestamps?: number[]): void {\n // Replaces the context's history, matching the in-memory store: a caller\n // installing a known track is authoritative for the window it covers.\n this.db.prepare('DELETE FROM positions WHERE context = ?').run(context)\n // Bypasses the throttle: these points are already at whatever resolution\n // the history provider returned, and they are back-dated, so throttling\n // against the newest-seen timestamp would drop most of them.\n for (const [i, position] of track.entries()) {\n this.store(context, position, timestamps?.[i] ?? 0)\n }\n this.lastStored.delete(context)\n }\n\n private rowsFor(context: Context, window?: TimeWindow): PositionRow[] {\n const clauses = ['context = ?']\n const params: (string | number)[] = [context]\n if (window) {\n clauses.push('timestamp >= ?', window.inclusiveEnd ? 'timestamp <= ?' : 'timestamp < ?')\n params.push(window.from, window.to)\n }\n return this.db\n .prepare(`SELECT context, timestamp, lat, lon FROM positions WHERE ${clauses.join(' AND ')} ORDER BY timestamp`)\n .all(...params) as unknown as PositionRow[]\n }\n\n private knows(context: Context): boolean {\n const row = this.db.prepare('SELECT 1 AS found FROM positions WHERE context = ? LIMIT 1').get(context)\n return row !== undefined\n }\n\n get(context: Context, window?: TimeWindow): Promise<LatLngTuple[]> {\n return this.getTimed(context, window).then((points) => points.map(({ position }) => position))\n }\n\n getTimed(context: Context, window?: TimeWindow): Promise<TimedPosition[]> {\n // An unknown context rejects; a known but stationary one resolves with\n // points. Resolving [] for both would make the two indistinguishable and\n // the route could not answer 404.\n if (!this.knows(context)) {\n return Promise.reject(new Error(`No track for ${context}`))\n }\n return Promise.resolve(\n this.rowsFor(context, window).map(({ lat, lon, timestamp }) => ({\n position: [lat, lon] as LatLngTuple,\n timestamp,\n })),\n )\n }\n\n private contexts(): Context[] {\n const rows = this.db.prepare('SELECT DISTINCT context FROM positions').all() as unknown as { context: Context }[]\n return rows.map(({ context }) => context)\n }\n\n getAllTracks(query?: TrackQuery): Promise<{ context: string; track: LatLngTuple[] }[]> {\n return Promise.all(\n this.contexts().map((context) =>\n this.getTimed(context, query?.window).then((points) => ({\n context,\n track: thin(points, query?.resolution).map(({ position }) => position),\n })),\n ),\n )\n }\n\n /**\n * Tracks matching the spatial predicate, which depends on who is asking.\n *\n * `intersects: false` — the v1 routes — matches a track's *last* position:\n * \"which vessels are near me now\". `intersects: true` — the v2 Track API —\n * matches a track that passed through the box at any point in the window,\n * including one that has since left.\n *\n * Two filters run, and they are not redundant despite both testing bounds:\n *\n * - `contextsInBounds` asks the cell index which contexts have *any* position\n * near the box. It is a cheap prefilter that keeps the query off every row\n * in the table, and it decides nothing on its own.\n * - `matcher` — the same predicate the in-memory store uses — then applies\n * whichever rule the caller asked for. That test is authoritative.\n *\n * Because `matcher` has the final say, dropping the exact-bounds check inside\n * `contextsInBounds` does not change any result; it only widens the candidate\n * set. It is kept because a prefilter that returns half the table is not\n * worth running, not because correctness depends on it.\n */\n async getFilteredTracks(\n params: TrackParams,\n selfPosition?: LatLngTuple,\n debug?: Debug,\n query?: TrackQuery,\n ): Promise<TrackCollection> {\n const timed = await this.getFilteredTimedTracks(params, selfPosition, debug, query)\n return Object.fromEntries(\n Object.entries(timed).map(([context, points]) => [context, points.map(({ position }) => position)]),\n )\n }\n\n /**\n * The same filtering as `getFilteredTracks`, keeping each point's timestamp.\n *\n * The untimed form is derived from this one so the two cannot disagree about\n * which tracks match — both the cell prefilter and the authoritative\n * last-position test run once, here.\n */\n async getFilteredTimedTracks(\n params: TrackParams,\n selfPosition?: LatLngTuple,\n debug?: Debug,\n query?: TrackQuery,\n ): Promise<TimedTrackCollection> {\n const candidates = params.bbox ? this.contextsInBounds(params.bbox) : undefined\n const matcher = createMatcher(params, selfPosition, debug)\n\n const tracks = await Promise.all(\n this.contexts().map((context) =>\n this.getTimed(context, query?.window).then((points) => ({\n context,\n points: thin(points, query?.resolution),\n })),\n ),\n )\n return tracks.reduce<TimedTrackCollection>((acc, { context, points }) => {\n if ((!candidates || candidates.has(context)) && matcher(points.map(({ position }) => position))) {\n acc[context] = points\n }\n return acc\n }, {})\n }\n\n /** Contexts with at least one position inside `bounds`, via the cell index. */\n private contextsInBounds(bounds: GeoBounds): Set<string> {\n const covering = coveringFor(bounds, this.maxCells)\n const found = new Set<string>()\n if (covering.length === 0) {\n return found\n }\n\n // Bound parameters, never interpolation: `BETWEEN ${start} <= s2cell AND\n // ${end}` parses as `s2cell BETWEEN (start <= s2cell) AND end`, collapsing\n // the lower bound to 0 or 1 so the range starts at zero and out-of-range\n // rows leak in.\n const ranges = covering.map(cellRange)\n const where = ranges.map(() => '(s2cell BETWEEN ? AND ?)').join(' OR ')\n const params = ranges.flatMap(({ start, end }) => [toSigned(start), toSigned(end)])\n\n const stmt = this.db.prepare(`SELECT DISTINCT context, lat, lon FROM positions WHERE ${where}`)\n const rows = stmt.all(...params) as unknown as { context: string; lat: number; lon: number }[]\n\n const inBounds = createInBounds(bounds)\n for (const { context, lat, lon } of rows) {\n if (inBounds([lat, lon])) {\n found.add(context)\n }\n }\n if (this.debug.enabled) {\n this.debug(`bbox covering ${covering.length} cells -> ${rows.length} rows -> ${found.size} contexts`)\n }\n return found\n }\n\n /**\n * Split a context's positions into segments, breaking where the recording\n * stopped for longer than `segmentGap` — an overnight stop should not draw a\n * straight line across the anchorage.\n */\n segments(context: Context, window?: TimeWindow): LatLngTuple[][] {\n const rows = this.rowsFor(context, window)\n const result: LatLngTuple[][] = []\n let current: LatLngTuple[] = []\n let previous: number | undefined\n for (const { lat, lon, timestamp } of rows) {\n if (previous !== undefined && timestamp - previous > this.segmentGap) {\n result.push(current)\n current = []\n }\n current.push([lat, lon])\n previous = timestamp\n }\n if (current.length > 0) {\n result.push(current)\n }\n return result\n }\n\n recordName(context: Context, name: string, timestamp: number = Date.now()): void {\n const trimmed = name.trim()\n if (trimmed === '') {\n return\n }\n const seen = this.lastName.get(context)\n if (seen && seen.timestamp > timestamp) {\n return\n }\n if (seen?.name === trimmed) {\n seen.timestamp = timestamp\n return\n }\n if (Number(this.insertName.run(context, trimmed, timestamp).changes) > 0) {\n this.lastName.set(context, { name: trimmed, timestamp })\n }\n }\n\n nameFor(context: Context): string | undefined {\n const row = this.selectName.get(context) as { name?: string } | undefined\n return row?.name\n }\n\n prune(maxAge: number, keep?: Context, now = Date.now()): void {\n const cutoff = now - maxAge\n // Drop whole contexts that have gone quiet, then apply the row-level\n // retention if one is configured. `keep` — the own vessel — is excluded:\n // its track has to survive a winter on a mooring.\n const dropped = this.db\n .prepare('SELECT context FROM positions GROUP BY context HAVING MAX(timestamp) < ? AND context IS NOT ?')\n .all(cutoff, keep ?? null) as { context: string }[]\n this.db\n .prepare(\n 'DELETE FROM positions WHERE context IN (SELECT context FROM positions GROUP BY context HAVING MAX(timestamp) < ?) AND context IS NOT ?',\n )\n .run(cutoff, keep ?? null)\n // A vessel that has aged out takes its name with it, or this table grows\n // for every target a harbour ever put past the receiver. The remembered\n // copy goes too, or a vessel returning under the same name would be taken\n // as already stored and never written again.\n for (const { context } of dropped) {\n this.db.prepare('DELETE FROM names WHERE context = ?').run(context)\n this.lastName.delete(context)\n }\n // The write-throttle map is keyed by context and nothing else clears it, so\n // without this every vessel that ever passed leaves an entry behind — an\n // unbounded map on a server watching a busy harbour.\n for (const { context } of dropped) {\n this.lastStored.delete(context)\n }\n // Scoped to `keep` when there is one: this retention is configured as \"days\n // of the own vessel's track to keep\", and applying it to every context\n // would truncate an AIS vessel's track on a setting that does not name it.\n // Unscoped without a `keep`, which is how a standalone store behaves.\n if (this.retention > 0) {\n const oldest = now - this.retention\n if (keep === undefined) {\n this.db.prepare('DELETE FROM positions WHERE timestamp < ?').run(oldest)\n } else {\n this.db.prepare('DELETE FROM positions WHERE timestamp < ? AND context IS ?').run(oldest, keep)\n }\n }\n }\n\n /** Worker startup snapshot; queries and name lookups must not open a second database. */\n storedNames(): { context: string; name: string; timestamp: number }[] {\n return this.db.prepare('SELECT context, name, timestamp FROM names').all() as unknown as {\n context: string\n name: string\n timestamp: number\n }[]\n }\n\n /** A failed batch stops writes in its worker; reads remain available. */\n transaction(write: () => void): void {\n this.db.exec('BEGIN IMMEDIATE')\n try {\n write()\n this.db.exec('COMMIT')\n } catch (error) {\n try {\n this.db.exec('ROLLBACK')\n } catch (rollbackError) {\n // SQLITE_FULL/IOERR may already have rolled back automatically.\n if (!(rollbackError instanceof Error) || !rollbackError.message.includes('no transaction is active')) {\n // Only the message crosses the worker boundary, so it carries both.\n const text = (e: unknown) => (e instanceof Error ? e.message : String(e))\n throw new TransactionStateError(\n `Track transaction rollback failed (${text(rollbackError)}) after: ${text(error)}`,\n { cause: error },\n )\n }\n }\n throw error\n }\n }\n\n close(): void {\n // Repeats of a stored name are dated in memory only. Writing the newest\n // dates back here, in one transaction, lets a reopened store rank a late\n // report against the newest one rather than against the first.\n try {\n const redate = this.db.prepare('UPDATE names SET timestamp = ? WHERE context = ? AND name = ? AND timestamp < ?')\n this.db.exec('BEGIN')\n for (const [context, { name, timestamp }] of this.lastName) {\n redate.run(timestamp, context, name, timestamp)\n }\n this.db.exec('COMMIT')\n } finally {\n this.db.close()\n }\n }\n\n /** Unsigned round-trip check, used by the tests. */\n cellIdsFor(context: Context): bigint[] {\n const stmt = this.db.prepare('SELECT s2cell FROM positions WHERE context = ? ORDER BY timestamp')\n stmt.setReadBigInts(true)\n const rows = stmt.all(context) as unknown as { s2cell: bigint }[]\n return rows.map(({ s2cell }) => toUnsigned(s2cell))\n }\n}\n","import { parentPort, workerData } from 'node:worker_threads'\nimport { SelfPositionUnavailableError } from './utils.js'\nimport { SqliteTrackStore, TransactionStateError } from './sqliteStore.js'\nimport type { SqliteStoreConfig } from './sqliteStore.js'\nimport type { Debug } from './types.js'\nimport type { Operation, WorkerMessage } from './trackStoreProtocol.js'\n\nif (!parentPort) throw new Error('Track store must run in a worker')\nconst port = parentPort\nconst config = workerData as { config: SqliteStoreConfig; debugEnabled: boolean }\nconst send = (message: WorkerMessage): void => port.postMessage(message)\nconst debug: Debug = Object.assign(\n (...args: unknown[]) => {\n if (config.debugEnabled) send({ kind: 'debug', text: args.map(String).join(' ') })\n },\n { enabled: config.debugEnabled },\n)\nconst errorText = (error: unknown): string => (error instanceof Error ? error.message : String(error))\nlet store: SqliteTrackStore | undefined\nlet processing = false\nlet writeFailure: string | undefined\nfunction fatal(error: unknown): void {\n try {\n store?.close()\n } catch {\n /* Preserve the failure that stopped recording. */\n }\n send({ kind: 'fatal', error: errorText(error) })\n port.close()\n}\nfunction mutate(operation: Operation, target: SqliteTrackStore): boolean {\n switch (operation.method) {\n case 'newPosition':\n target.newPosition(...operation.args)\n return true\n case 'recordName':\n target.recordName(...operation.args)\n return true\n case 'initialTrack':\n target.initialTrack(...operation.args)\n return true\n case 'prune':\n target.prune(...operation.args)\n return true\n default:\n return false\n }\n}\nconst isWrite = (operation: Operation): boolean =>\n ['newPosition', 'recordName', 'initialTrack', 'prune'].includes(operation.method)\ntry {\n store = new SqliteTrackStore(config.config, debug)\n send({ kind: 'ready', names: store.storedNames() })\n} catch (error) {\n fatal(error)\n}\nif (store) {\n const target = store\n const process = async ({ operations }: { operations: Operation[] }): Promise<void> => {\n if (processing) {\n fatal(new Error('Overlapping track worker batch'))\n return\n }\n processing = true\n const results: Extract<WorkerMessage, { kind: 'result' }>['results'] = []\n try {\n for (let i = 0; i < operations.length;) {\n const operation = operations[i]!\n if (isWrite(operation)) {\n const first = i\n while (i < operations.length && isWrite(operations[i]!)) i++\n const writes = operations.slice(first, i)\n const acknowledgements: typeof results = []\n try {\n if (writeFailure) throw new Error(writeFailure)\n target.transaction(() => {\n for (const next of writes) {\n mutate(next, target)\n acknowledgements.push({\n id: next.id,\n ...(next.method === 'recordName'\n ? { name: { context: next.args[0], value: target.nameFor(next.args[0]) } }\n : {}),\n ...(next.method === 'prune' ? { names: target.storedNames().map((row) => row.context) } : {}),\n })\n }\n })\n results.push(...acknowledgements)\n } catch (error) {\n if (error instanceof TransactionStateError) throw error\n // Never retry uncertain writes. Keep the database open for reads,\n // which can still succeed on e.g. a full filesystem.\n writeFailure = errorText(error)\n for (const next of writes) results.push({ id: next.id, error: writeFailure, writeFailed: true })\n }\n } else {\n i++\n if (operation.method === 'close') {\n target.close()\n results.push({ id: operation.id })\n send({ kind: 'result', results })\n port.close()\n return\n }\n try {\n let value: unknown\n switch (operation.method) {\n case 'get':\n value = await target.get(...operation.args)\n break\n case 'getTimed':\n value = await target.getTimed(...operation.args)\n break\n case 'getAllTracks':\n value = await target.getAllTracks(...operation.args)\n break\n case 'getFilteredTracks':\n value = await target.getFilteredTracks(operation.args[0], operation.args[1], debug, operation.args[3])\n break\n case 'getFilteredTimedTracks':\n value = await target.getFilteredTimedTracks(\n operation.args[0],\n operation.args[1],\n debug,\n operation.args[3],\n )\n break\n default:\n throw new Error('Unknown track operation')\n }\n results.push({ id: operation.id, value })\n } catch (error) {\n results.push({\n id: operation.id,\n error: errorText(error),\n selfPositionUnavailable: error instanceof SelfPositionUnavailableError,\n })\n }\n }\n }\n send({ kind: 'result', results })\n } catch (error) {\n fatal(error)\n } finally {\n processing = false\n }\n }\n port.on('message', (message: { operations: Operation[] }) => {\n void process(message).catch(fatal)\n })\n}\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;CAAA,CAAC,SAAU,QAAQ,SAAS;EACxB,OAAO,YAAY,YAAY,OAAO,WAAW,cAAc,QAAQ,OAAO,IAC9E,OAAO,WAAW,cAAc,OAAO,MAAM,OAAO,CAAC,SAAS,GAAG,OAAO,IACvE,QAAS,OAAO,WAAW,CAAC,CAAE;CACnC,EAAA,CAAC,UAAQ,SAAU,WAAS;EAAE;;EAK1B,IAAI,aAAa,KAAK,IAAI,GAAG,EAAE;EAC/B,IAAI,YAAY,KAAK,IAAI,GAAG,GAAG;EAC/B,IAAI,kBAAkB,KAAK,IAAI,EAAE,KAAK,KAAK,KAAK,IAAI,CAAC;;EAErD,SAAS,OAAO,OAAO;GACnB,OAAQ,IAAI,MAAM,QAAQ,CAAC,CAAC,CAAC,KAAK,GAAG;EACzC;EACA,IAAI,aAA4B,WAAY;GACxC,SAAS,WAAW,MAAM;IACtB,KAAK,OAAO;;IAEZ,KAAK,kBAAkB,KAAK,IAAI,UAAU,IAAI,KAAK,IAAI,KAAK,IAAI;;IAEhE,KAAK,aAAa,CAAC,CAAC,KAAK;;IAEzB,KAAK,WAAW,KAAK,IAAI,KAAK,MAAM,KAAK,UAAU;;IAEnD,KAAK,MAAM,OAAO,KAAK,UAAU;GACrC;GACA,WAAW,OAAO,SAAU,MAAM;IAC9B,OAAQ,WAAW,QAAQ,UAAU,WAAW,QAAQ,QAAQ,IAAI,WAAW,IAAI;GACvF;GACA,WAAW,UAAU,CAAC;GACtB,OAAO;EACX,EAAE;;EAIF,S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,MAAM,KAAK;CACnC,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"trackStoreWorker.js","names":["exports","BigFloat32","s2","geojson"],"sources":["../node_modules/bigfloat/dist/umd/index.js","../node_modules/s2js/dist/s2js.esm.js","../src/sqliteStore.ts","../src/trackStoreWorker.ts"],"sourcesContent":["(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :\n typeof define === 'function' && define.amd ? define(['exports'], factory) :\n (factory((global.bigfloat = {})));\n}(this, (function (exports) { 'use strict';\n\n // This file is part of bigfloat, copyright (c) 2015- BusFaster Ltd.\n // Released under the MIT license, see LICENSE.\n /** Base for calculations, the bigger the better but must fit in 32 bits. */\n var limbSize32 = Math.pow(2, 32);\n var limbInv32 = Math.pow(2, -32);\n var limbsPerDigit32 = Math.log(10) / (32 * Math.log(2));\n /** Create a string with the given number of zero digits. */\n function zeroes(count) {\n return (new Array(count + 1).join('0'));\n }\n var BaseInfo32 = /** @class */ (function () {\n function BaseInfo32(base) {\n this.base = base;\n /** Average number of digits per limb. */\n this.limbDigitsExact = Math.log(limbSize32) / Math.log(this.base);\n /** Number of entire digits per limb. */\n this.limbDigits = ~~this.limbDigitsExact;\n /** Maximum power of base that fits in a limb. */\n this.limbBase = Math.pow(this.base, this.limbDigits);\n /** String of zeroes for padding an empty limb. */\n this.pad = zeroes(this.limbDigits);\n }\n BaseInfo32.init = function (base) {\n return (BaseInfo32.baseTbl[base] || (BaseInfo32.baseTbl[base] = new BaseInfo32(base)));\n };\n BaseInfo32.baseTbl = {};\n return BaseInfo32;\n }());\n\n // This file is part of bigfloat, copyright (c) 2015- BusFaster Ltd.\n /** Remove leading and trailing insignificant zero digits. */\n function trimNumber(str) {\n return (str\n .replace(/^(-?)0+([1-9a-z]|0(\\.|$))/, '$1$2')\n .replace(/(\\.|(\\.[0-9a-z]*[1-9a-z]))0+$/, '$2'));\n }\n /** Output EXACT value of an IEEE 754 double in any base supported by Number.toString.\n * Exponent must be between -2 and 61, and last 3 bits of mantissa must be 0.\n * Useful for debugging. */\n function numberToString(dbl, base) {\n if (base === void 0) { base = 10; }\n var _a = BaseInfo32.init(base), pad = _a.pad, limbBase = _a.limbBase;\n var sign = '';\n var out = '';\n var limb;\n var limbStr;\n if (isNaN(dbl))\n return ('NaN');\n // For negative numbers, output sign and get absolute value.\n if (dbl < 0) {\n sign = '-';\n dbl = -dbl;\n }\n if (!isFinite(dbl))\n return (sign + 'Inf');\n if (dbl < 1) {\n out += '0';\n }\n else {\n var iPart = Math.floor(dbl);\n dbl -= iPart;\n while (iPart) {\n // Extract groups of digits starting from the least significant.\n limb = iPart % limbBase;\n iPart = (iPart - limb) / limbBase;\n limbStr = limb.toString(base);\n // Prepend digits to result.\n out = limbStr + out;\n // If more limbs remain, pad with zeroes to group length.\n if (iPart)\n out = pad.substr(limbStr.length) + out;\n }\n }\n // Is there a fractional part remaining?\n if (dbl > 0) {\n out += '.';\n if (limbBase != limbSize32) {\n limbBase = base;\n pad = '';\n }\n while (dbl) {\n // Extract groups of digits starting from the most significant.\n dbl *= limbBase;\n limb = dbl >>> 0;\n dbl -= limb;\n limbStr = limb.toString(base);\n // Append digits to result and pad with zeroes to group length.\n out += pad.substr(limbStr.length) + limbStr;\n }\n }\n // Remove trailing zeroes.\n return (sign + out.replace(/(\\.[0-9a-z]*[1-9a-z])0+$/, '$1'));\n }\n\n // This file is part of bigfloat, copyright (c) 2015- BusFaster Ltd.\n var BigFloat32 = /** @class */ (function () {\n function BigFloat32(value, base) {\n /** List of digits in base 2^32, least significant first. */\n this.limbList = [];\n value ? this.setValue(value, base) : this.setZero();\n }\n BigFloat32.prototype.clone = function () {\n return (new BigFloat32().setBig(this));\n };\n BigFloat32.prototype.setZero = function () {\n this.sign = 1;\n this.fractionLen = 0;\n this.len = 0;\n return (this);\n };\n BigFloat32.prototype.setValue = function (other, base) {\n if (typeof (other) == 'number') {\n return (this.setNumber(other));\n }\n if (other instanceof BigFloat32) {\n return (this.setBig(other));\n }\n return (this.setString(other.toString(), base || 10));\n };\n BigFloat32.prototype.setBig = function (other) {\n var len = other.len;\n this.sign = other.sign;\n this.fractionLen = other.fractionLen;\n this.len = len;\n for (var pos = 0; pos < len; ++pos) {\n this.limbList[pos] = other.limbList[pos];\n }\n return (this);\n };\n /** Set value from a floating point number (probably IEEE 754 double). */\n BigFloat32.prototype.setNumber = function (value) {\n if (value < 0) {\n value = -value;\n this.sign = -1;\n }\n else {\n this.sign = 1;\n }\n var iPart = Math.floor(value);\n var fPart = value - iPart;\n var fractionLen = 0;\n var limbList = this.limbList;\n var limb;\n var len = 0;\n // Handle fractional part.\n while (fPart) {\n // Extract limbs starting from the most significant.\n fPart *= limbSize32;\n limb = fPart >>> 0;\n fPart -= limb;\n // Append limb to value (limbs are reversed later).\n limbList[len++] = limb;\n ++fractionLen;\n }\n // Reverse array from 0 to len.\n var pos = 0;\n while (--len > pos) {\n limb = limbList[pos];\n limbList[pos++] = limbList[len];\n limbList[len] = limb;\n }\n len += pos + 1;\n // Handle integer part.\n while (iPart) {\n // Extract limbs starting from the least significant.\n limb = iPart % limbSize32; // Could also be iPart >>> 0\n iPart = (iPart - limb) / limbSize32;\n // Append limb to value.\n limbList[len++] = limb;\n }\n this.limbList = limbList;\n this.fractionLen = fractionLen;\n this.len = len;\n return (this);\n };\n BigFloat32.prototype.parseFraction = function (value, base, start, offset, limbBase, limbDigits) {\n var limbList = this.limbList;\n var pos = value.length;\n // Set limbs to zero, because divInt uses them as input.\n var limbNum = offset - 1;\n while (limbNum) {\n limbList[--limbNum] = 0;\n }\n // Read initial digits so their count becomes divisible by limbDigits.\n var posNext = pos - ((pos - start + limbDigits - 1) % limbDigits + 1);\n limbList[offset - 1] = parseInt(value.substr(posNext, pos - posNext), base);\n this.divInt(Math.pow(base, pos - posNext), offset);\n pos = posNext;\n // Read rest of the digits in limbDigits sized chunks.\n while (pos > start) {\n pos -= limbDigits;\n limbList[offset - 1] = parseInt(value.substr(pos, limbDigits), base);\n // Divide by maximum power of base that fits in a limb.\n this.divInt(limbBase, offset);\n }\n };\n BigFloat32.prototype.setString = function (value, base) {\n var _a = BaseInfo32.init(base), limbBase = _a.limbBase, limbDigits = _a.limbDigits, limbDigitsExact = _a.limbDigitsExact;\n var limbList = this.limbList;\n var pos = -1;\n var c;\n this.sign = 1;\n // Handle leading signs and zeroes.\n while (1) {\n c = value.charAt(++pos);\n switch (c) {\n case '-':\n this.sign = -1;\n case '+':\n case '0':\n continue;\n }\n break;\n }\n var posDot = (value.indexOf('.', pos) + 1 || value.length + 1) - 1;\n // Handle fractional part.\n if (posDot < value.length - 1) {\n // Reserve enough limbs to contain digits in fractional part.\n var len = ~~((value.length - posDot - 1) / limbDigitsExact) + 1;\n this.parseFraction(value, base, posDot + 1, len + 1, limbBase, limbDigits);\n this.fractionLen = len;\n this.len = len;\n // Remove trailing zeroes.\n this.trimLeast();\n }\n else {\n this.fractionLen = 0;\n this.len = 0;\n }\n var offset = this.fractionLen;\n // Handle integer part.\n if (posDot > pos) {\n // Read initial digits so their count becomes divisible by limbDigits.\n var posNext = pos + (posDot - pos + limbDigits - 1) % limbDigits + 1;\n ++this.len;\n limbList[offset] = parseInt(value.substr(pos, posNext - pos), base);\n pos = posNext;\n // Read rest of the digits in limbDigits sized chunks.\n while (pos < posDot) {\n // Multiply by maximum power of base that fits in a limb.\n if (this.mulInt(limbBase, limbList, offset, offset, 0))\n ++this.len;\n // Add latest limb.\n limbList[offset] += parseInt(value.substr(pos, limbDigits), base);\n pos += limbDigits;\n }\n }\n return (this);\n };\n /** Trim zero limbs from most significant end. */\n BigFloat32.prototype.trimMost = function () {\n var limbList = this.limbList;\n var fractionLen = this.fractionLen;\n var len = this.len;\n while (len > fractionLen && !limbList[len - 1])\n --len;\n this.len = len;\n };\n /** Trim zero limbs from least significant end. */\n BigFloat32.prototype.trimLeast = function () {\n var limbList = this.limbList;\n var len = this.fractionLen;\n var pos = 0;\n while (pos < len && !limbList[pos])\n ++pos;\n if (pos)\n this.truncate(len - pos);\n };\n /** Multiply by an integer and write output limbs to another list. */\n BigFloat32.prototype.mulInt = function (factor, dstLimbList, srcPos, dstPos, overwriteMask) {\n if (!factor)\n return (0);\n var limbList = this.limbList;\n var limbCount = this.len;\n var limb;\n var lo;\n var carry = 0;\n // limbList is an array of 32-bit ints but split here into 16-bit low\n // and high words for multiplying by a 32-bit term, so the intermediate\n // 48-bit multiplication results fit into 53 bits of IEEE 754 mantissa.\n while (srcPos < limbCount) {\n limb = limbList[srcPos++];\n // Multiply lower half of limb with factor, making carry temporarily take 48 bits.\n carry += factor * (limb & 0xffff);\n // Get lowest 16 bits of full product.\n lo = carry & 0xffff;\n // Right shift by dividing because >> and >>> truncate to 32 bits before shifting.\n carry = (carry - lo) / 65536;\n // Multiply higher half of limb and combine with lowest 16 bits of full product.\n carry += factor * (limb >>> 16);\n lo |= carry << 16;\n // Lowest 32 bits of full product are added to output limb.\n limb = ((dstLimbList[dstPos] & overwriteMask) + lo) >>> 0;\n dstLimbList[dstPos++] = limb;\n // Highest 32 bits of full product stay in carry, also increment by 1 if previous sum overflowed.\n carry = (carry / 65536) >>> 0;\n // Bit twiddle equivalent to: if(limb < (lo >>> 0)) ++carry;\n carry += (lo ^ (((limb - lo) ^ lo) & ~(limb ^ lo))) >>> 31;\n }\n // Extend result by one more limb if it overflows.\n if (carry)\n dstLimbList[dstPos] = carry;\n return (carry);\n };\n BigFloat32.prototype.mulBig = function (multiplier, product) {\n if (this.isZero() || multiplier.isZero())\n return (product.setZero());\n var multiplierLimbs = multiplier.limbList;\n var lenMultiplier = multiplier.len;\n var productLimbs = product.limbList;\n var posProduct = this.len + lenMultiplier;\n product.len = posProduct;\n // TODO: Only clear from len to len + lenMultiplier\n while (posProduct--) {\n productLimbs[posProduct] = 0;\n }\n this.mulInt(multiplierLimbs[0], productLimbs, 0, 0, 0);\n for (var posMultiplier = 1; posMultiplier < lenMultiplier; ++posMultiplier) {\n this.mulInt(multiplierLimbs[posMultiplier], productLimbs, 0, posMultiplier, 0xffffffff);\n }\n product.sign = this.sign * multiplier.sign;\n product.fractionLen = this.fractionLen + multiplier.fractionLen;\n product.trimMost();\n product.trimLeast();\n return (product);\n };\n /** Multiply and return product in a new BigFloat32. */\n BigFloat32.prototype.mul = function (multiplier, product) {\n product = product || new BigFloat32();\n if (typeof (multiplier) == 'number') {\n multiplier = temp32.setNumber(multiplier);\n }\n if (product == this)\n throw (new Error('Multiplication in place is unsupported'));\n return (this.mulBig(multiplier, product));\n };\n BigFloat32.prototype.absDeltaFrom = function (other) {\n if (typeof (other) == 'number') {\n other = temp32.setNumber(other);\n }\n var limbList = this.limbList;\n var otherList = other.limbList;\n var limbCount = this.len;\n var otherCount = other.len;\n // Compare lengths.\n // Note: leading zeroes in integer part must be trimmed for this to work!\n var d = (limbCount - this.fractionLen) - (otherCount - other.fractionLen);\n // If lengths are equal, compare each limb from most to least significant.\n while (!d && limbCount && otherCount)\n d = limbList[--limbCount] - otherList[--otherCount];\n if (d)\n return (d);\n if (limbCount) {\n do\n d = limbList[--limbCount];\n while (!d && limbCount);\n }\n else if (otherCount) {\n do\n d = -otherList[--otherCount];\n while (!d && otherCount);\n }\n return (d);\n };\n BigFloat32.prototype.isZero = function () {\n return (this.len == 0);\n };\n BigFloat32.prototype.getSign = function () {\n return (this.len && this.sign);\n };\n /** Return an arbitrary number with sign matching the result of this - other. */\n BigFloat32.prototype.deltaFrom = function (other) {\n if (typeof (other) == 'number') {\n other = temp32.setNumber(other);\n }\n return (\n // Make positive and negative zero equal.\n this.len + other.len && (\n // Compare signs.\n this.sign - other.sign ||\n // Finally compare full values.\n this.absDeltaFrom(other) * this.sign));\n };\n BigFloat32.prototype.addBig = function (addend, sum) {\n var augend = this;\n var fractionLen = augend.fractionLen;\n var len = fractionLen - addend.fractionLen;\n if (len < 0) {\n len = -len;\n fractionLen += len;\n augend = addend;\n addend = this;\n }\n sum.sign = this.sign;\n sum.fractionLen = fractionLen;\n var sumLimbs = sum.limbList;\n var augendLimbs = augend.limbList;\n var addendLimbs = addend.limbList;\n var posAugend = 0;\n var posAddend = 0;\n var carry = 0;\n var limbSum;\n // If one input has more fractional limbs, just copy the leftovers to output.\n while (posAugend < len) {\n sumLimbs[posAugend] = augendLimbs[posAugend];\n ++posAugend;\n }\n var lenAddend = addend.len;\n len = augend.len - posAugend;\n if (len > lenAddend)\n len = lenAddend;\n // Calculate sum where input numbers overlap.\n while (posAddend < len) {\n carry += augendLimbs[posAugend] + addendLimbs[posAddend++];\n limbSum = carry >>> 0;\n carry = carry - limbSum && 1;\n sumLimbs[posAugend++] = limbSum;\n }\n var posSum = posAugend;\n if (len < lenAddend) {\n len = lenAddend;\n augend = addend;\n posAugend = posAddend;\n augendLimbs = addendLimbs;\n }\n else\n len = augend.len;\n // Copy leftover most significant limbs to output, propagating carry.\n while (posAugend < len) {\n carry += augendLimbs[posAugend++];\n limbSum = carry >>> 0;\n carry = carry - limbSum && 1;\n sumLimbs[posSum++] = limbSum;\n }\n if (carry)\n sumLimbs[posSum++] = carry;\n sum.len = posSum;\n sum.trimLeast();\n return (sum);\n };\n BigFloat32.prototype.subBig = function (subtrahend, difference) {\n var minuend = this;\n difference.sign = this.sign;\n // Make sure the subtrahend is the smaller number.\n if (minuend.absDeltaFrom(subtrahend) < 0) {\n minuend = subtrahend;\n subtrahend = this;\n difference.sign = -this.sign;\n }\n var fractionLen = minuend.fractionLen;\n var len = fractionLen - subtrahend.fractionLen;\n var differenceLimbs = difference.limbList;\n var minuendLimbs = minuend.limbList;\n var subtrahendLimbs = subtrahend.limbList;\n var lenMinuend = minuend.len;\n var lenSubtrahend = subtrahend.len;\n var lenFinal = lenMinuend;\n var posMinuend = 0;\n var posSubtrahend = 0;\n var posDifference = 0;\n var carry = 0;\n var limbDiff;\n if (len >= 0) {\n while (posMinuend < len) {\n differenceLimbs[posMinuend] = minuendLimbs[posMinuend];\n ++posMinuend;\n }\n len += lenSubtrahend;\n if (len > lenMinuend)\n len = lenMinuend;\n posDifference = posMinuend;\n }\n else {\n len = -len;\n fractionLen += len;\n lenFinal += len;\n while (posSubtrahend < len) {\n carry -= subtrahendLimbs[posSubtrahend];\n limbDiff = carry >>> 0;\n carry = -(carry < 0);\n differenceLimbs[posSubtrahend++] = limbDiff;\n }\n len += lenMinuend;\n if (len > lenSubtrahend)\n len = lenSubtrahend;\n posDifference = posSubtrahend;\n }\n difference.fractionLen = fractionLen;\n // Calculate difference where input numbers overlap.\n while (posDifference < len) {\n carry += minuendLimbs[posMinuend++] - subtrahendLimbs[posSubtrahend++];\n limbDiff = carry >>> 0;\n carry = -(carry < 0);\n differenceLimbs[posDifference++] = limbDiff;\n }\n // Copy leftover most significant limbs to output, propagating carry.\n while (posDifference < lenFinal) {\n carry += minuendLimbs[posMinuend++];\n limbDiff = carry >>> 0;\n carry = -(carry < 0);\n differenceLimbs[posDifference++] = limbDiff;\n }\n difference.len = posDifference;\n difference.trimMost();\n difference.trimLeast();\n return (difference);\n };\n BigFloat32.prototype.addSub = function (addend, sign, result) {\n result = result || new BigFloat32();\n if (result == this)\n throw (new Error('Addition and subtraction in place is unsupported'));\n if (typeof (addend) == 'number') {\n addend = temp32.setNumber(addend);\n }\n if (this.sign * addend.sign * sign < 0) {\n return (this.subBig(addend, result));\n }\n else {\n return (this.addBig(addend, result));\n }\n };\n /** Add and return sum in a new BigFloat32. */\n BigFloat32.prototype.add = function (addend, sum) {\n return (this.addSub(addend, 1, sum));\n };\n /** Subtract and return difference in a new BigFloat32. */\n BigFloat32.prototype.sub = function (subtrahend, difference) {\n return (this.addSub(subtrahend, -1, difference));\n };\n /** Round towards zero, to given number of base 2^32 fractional digits. */\n BigFloat32.prototype.truncate = function (fractionLimbCount) {\n var diff = this.fractionLen - fractionLimbCount;\n if (diff > 0) {\n this.fractionLen = fractionLimbCount;\n this.len -= diff;\n var len = this.len;\n var limbList = this.limbList;\n for (var pos = 0; pos < len; ++pos) {\n limbList[pos] = limbList[pos + diff];\n }\n }\n return (this);\n };\n BigFloat32.prototype.round = function (decimalCount) {\n return (this.truncate(1 + ~~(decimalCount * limbsPerDigit32)));\n };\n /** Divide by integer, replacing current value by quotient. Return integer remainder. */\n BigFloat32.prototype.divInt = function (divisor, pos) {\n var limbList = this.limbList;\n var limb;\n var hi, lo;\n var carry = 0;\n // If most significant limb is zero after dividing, decrement number of limbs remaining.\n if (limbList[pos - 1] < divisor) {\n carry = limbList[--pos];\n this.len = pos;\n }\n while (pos--) {\n limb = limbList[pos];\n carry = carry * 0x10000 + (limb >>> 16);\n hi = (carry / divisor) >>> 0;\n carry = carry - hi * divisor;\n carry = carry * 0x10000 + (limb & 0xffff);\n lo = (carry / divisor) >>> 0;\n carry = carry - lo * divisor;\n limbList[pos] = ((hi << 16) | lo) >>> 0;\n }\n return (carry);\n };\n BigFloat32.prototype.fractionToString = function (base, digitList) {\n var _a = BaseInfo32.init(base), pad = _a.pad, limbBase = _a.limbBase;\n var limbList = this.limbList;\n var limbCount = this.fractionLen;\n var limbNum = 0;\n var limbStr;\n if (base & 1) {\n throw (new Error('Conversion of floating point values to odd bases is unsupported'));\n }\n // Skip least significant limbs that equal zero.\n while (limbNum < limbCount && !limbList[limbNum])\n ++limbNum;\n if (limbNum >= limbCount)\n return;\n digitList.push('.');\n var fPart = temp32;\n fPart.limbList = limbList.slice(limbNum, limbCount);\n fPart.len = limbCount - limbNum;\n limbNum = 0;\n while (limbNum < fPart.len) {\n if (fPart.limbList[limbNum]) {\n var carry = fPart.mulInt(limbBase, fPart.limbList, limbNum, limbNum, 0);\n limbStr = carry.toString(base);\n digitList.push(pad.substr(limbStr.length) + limbStr);\n }\n else\n ++limbNum;\n }\n };\n BigFloat32.prototype.getExpansion = function (output) {\n var limbList = this.limbList;\n var len = this.len;\n var exp = this.sign;\n var pos = this.fractionLen;\n while (pos--) {\n exp *= limbInv32;\n }\n while (++pos < len) {\n output[pos] = limbList[pos] * exp;\n exp *= limbSize32;\n }\n return (len);\n };\n BigFloat32.prototype.valueOf = function () {\n var limbList = this.limbList;\n var result = 0;\n var exp = limbInv32 * this.sign;\n var len = this.fractionLen;\n var pos = 0;\n while (pos < len) {\n result = result * limbInv32 + limbList[pos++];\n }\n len = this.len;\n while (pos < len) {\n result = result * limbInv32 + limbList[pos++];\n exp *= limbSize32;\n }\n return (result * exp);\n };\n /** Convert to string in any even base supported by Number.toString.\n * @return String in lower case. */\n BigFloat32.prototype.toString = function (base) {\n if (base === void 0) { base = 10; }\n var _a = BaseInfo32.init(base), pad = _a.pad, limbBase = _a.limbBase;\n var digitList = [];\n var limbList = this.limbList;\n var limbStr;\n if (limbBase != limbSize32) {\n var iPart = temp32;\n iPart.limbList = limbList.slice(this.fractionLen, this.len);\n iPart.len = this.len - this.fractionLen;\n // Loop while 2 or more limbs remain, requiring arbitrary precision division to extract digits.\n while (iPart.len > 1) {\n limbStr = iPart.divInt(limbBase, iPart.len).toString(base);\n // Prepend digits into final result, padded with zeroes to 9 digits.\n // Since more limbs still remain, whole result will not have extra padding.\n digitList.push(pad.substr(limbStr.length) + limbStr);\n }\n // Prepend last remaining limb and sign to result.\n digitList.push('' + (iPart.limbList[0] || 0));\n if (this.sign < 0)\n digitList.push('-');\n digitList.reverse();\n // Handle fractional part.\n this.fractionToString(base, digitList);\n }\n else {\n var limbNum = this.len;\n var fractionPos = this.fractionLen;\n if (this.sign < 0)\n digitList.push('-');\n if (limbNum == fractionPos)\n digitList.push('0');\n while (limbNum--) {\n limbStr = limbList[limbNum].toString(base);\n if (limbNum == fractionPos - 1)\n digitList.push('.');\n digitList.push(pad.substr(limbStr.length) + limbStr);\n }\n }\n // Remove leading and trailing zeroes.\n return (trimNumber(digitList.join('')));\n };\n return BigFloat32;\n }());\n BigFloat32.prototype.cmp = BigFloat32.prototype.deltaFrom;\n var temp32 = new BigFloat32();\n\n // This file is part of bigfloat, copyright (c) 2018- BusFaster Ltd.\n var dekkerSplitter = (1 << 27) + 1;\n var limbsPerDigit53 = Math.log(10) / (53 * Math.log(2));\n /** See Shewchuk page 7. */\n /*\n function fastTwoSum(a: number, b: number, sum: number[]) {\n const estimate = a + b;\n\n sum[0] = b - (estimate - a);\n sum[1] = estimate;\n\n return(sum);\n }\n */\n /** Error-free addition of two floating point numbers.\n * See Shewchuk page 8. Note that output order is swapped! */\n function twoSum(a, b, sum) {\n var estimate = a + b;\n var b2 = estimate - a;\n var a2 = estimate - b2;\n sum[0] = (a - a2) + (b - b2);\n sum[1] = estimate;\n return (sum);\n }\n /** Error-free product of two floating point numbers.\n * Store approximate result in global variable tempProduct.\n * See Shewchuk page 20.\n *\n * @return Rounding error. */\n function twoProduct(a, b) {\n tempProduct = a * b;\n var a2 = a * dekkerSplitter;\n var aHi = a2 - (a2 - a);\n var aLo = a - aHi;\n var b2 = b * dekkerSplitter;\n var bHi = b2 - (b2 - b);\n var bLo = b - bHi;\n return (aLo * bLo - (tempProduct - aHi * bHi - aLo * bHi - aHi * bLo));\n }\n /** Arbitrary precision floating point number. Based on a multiple-component\n * expansion format and error free transformations.\n *\n * Maximum exponent is the same as for plain JavaScript numbers,\n * least significant representable binary digit is 2^-1074. */\n var BigFloat53 = /** @class */ (function () {\n /** @param value Initial value, a plain JavaScript floating point number\n * (IEEE 754 double precision). */\n function BigFloat53(value, base) {\n /** List of components ordered by increasing exponent. */\n this.limbList = [];\n if (value)\n this.setValue(value, base);\n }\n BigFloat53.prototype.clone = function () {\n return (new BigFloat53().setBig(this));\n };\n /** Set value to zero.\n *\n * @return This object, for chaining. */\n BigFloat53.prototype.setZero = function () {\n this.len = 0;\n return (this);\n };\n BigFloat53.prototype.setValue = function (other, base) {\n if (typeof (other) == 'number') {\n return (this.setNumber(other));\n }\n if (other instanceof BigFloat53) {\n return (this.setBig(other));\n }\n return (this.setString(other.toString(), base || 10));\n };\n BigFloat53.prototype.setBig = function (other) {\n var len = other.len;\n this.len = len;\n for (var pos = 0; pos < len; ++pos) {\n this.limbList[pos] = other.limbList[pos];\n }\n return (this);\n };\n /** Set value to a plain JavaScript floating point number\n * (IEEE 754 double precision).\n *\n * @param value New value.\n * @return This object, for chaining. */\n BigFloat53.prototype.setNumber = function (value) {\n this.limbList[0] = value;\n this.len = value && 1;\n return (this);\n };\n BigFloat53.prototype.setString = function (value, base) {\n temp32$1[0].setValue(value, base);\n this.len = temp32$1[0].getExpansion(this.limbList);\n this.normalize();\n return (this);\n };\n /** Set value to the sum of two JavaScript numbers.\n *\n * @param a Augend.\n * @param b Addend.\n * @return This object, for chaining. */\n BigFloat53.prototype.setSum = function (a, b) {\n this.len = 2;\n twoSum(a, b, this.limbList);\n return (this);\n };\n /** Set value to the product of two JavaScript numbers.\n * @param a Multiplicand.\n * @param b Multiplier.\n * @return This object, for chaining. */\n BigFloat53.prototype.setProduct = function (a, b) {\n this.len = 2;\n this.limbList[0] = twoProduct(a, b);\n this.limbList[1] = tempProduct;\n return (this);\n };\n /** See Compress from Shewchuk page 25. */\n // TODO: Test.\n BigFloat53.prototype.normalize = function () {\n var limbList = this.limbList;\n var len = this.len;\n var limb;\n if (len) {\n var a = len - 1;\n var b = len - 1;\n var q = limbList[a];\n var err = void 0;\n while (a) {\n limb = limbList[--a];\n err = q;\n q += limb;\n err = limb - (q - err);\n limbList[b] = q;\n b -= err && 1;\n q = err || q;\n }\n limbList[b] = q;\n while (++b < len) {\n limb = limbList[b];\n err = q;\n q += limb;\n err -= q - limb;\n limbList[a] = err;\n a += err && 1;\n }\n limbList[a] = q;\n this.len = a + (q && 1);\n }\n return (this);\n };\n /** Multiply this arbitrary precision float by a number.\n * See Scale-Expansion from Shewchuk page 21.\n *\n * @param b Multiplier, a JavaScript floating point number.\n * @param product Arbitrary precision float to overwrite with result.\n * @return Modified product object. */\n BigFloat53.prototype.mulSmall = function (b, product) {\n var limbList = this.limbList;\n var productLimbs = product.limbList;\n var count = this.len;\n var t1, t2, t3;\n var srcPos = 0, dstPos = 0;\n /** Write output limb and move to next, unless a zero was written. */\n function writeLimb(limb) {\n productLimbs[dstPos] = limb;\n dstPos += limb && 1;\n }\n writeLimb(twoProduct(limbList[srcPos++], b));\n var q = tempProduct;\n while (srcPos < count) {\n t1 = twoProduct(limbList[srcPos++], b);\n t2 = q + t1;\n t3 = t2 - q;\n writeLimb(q - (t2 - t3) + (t1 - t3));\n q = tempProduct + t2;\n writeLimb(t2 - (q - tempProduct));\n }\n productLimbs[dstPos] = q;\n product.len = dstPos + (q && 1);\n return (product);\n };\n /** Multiply this by an arbitrary precision multiplier.\n * Pass all components of the multiplier to mulSmall and sum the products.\n *\n * @param multiplier Number or arbitrary precision float.\n * @param product Arbitrary precision float to overwrite with result.\n * @return Modified product object. */\n BigFloat53.prototype.mulBig = function (multiplier, product) {\n var limbList = multiplier.limbList;\n var pos = multiplier.len;\n if (!pos)\n return (product.setZero());\n --pos;\n this.mulSmall(limbList[pos], pos ? temp53[pos & 1] : product);\n while (pos) {\n --pos;\n this.mulSmall(limbList[pos], product).addBig(temp53[~pos & 1], 1, pos ? temp53[pos & 1] : product);\n }\n return (product);\n };\n /** Multiply number or arbitrary precision float with this one\n * and store result in another BigFloat53.\n *\n * @param multiplier Number or arbitrary precision float.\n * @param product Arbitrary precision float to overwrite with result.\n * If omitted, a new one is allocated.\n * @return Modified product object. */\n BigFloat53.prototype.mul = function (multiplier, product) {\n product = product || new BigFloat53();\n if (typeof (multiplier) == 'number') {\n return (this.mulSmall(multiplier, product));\n }\n if (product == this)\n throw (new Error('Cannot multiply in place'));\n return (this.mulBig(multiplier, product));\n };\n BigFloat53.prototype.isZero = function () {\n var limbList = this.limbList;\n var pos = this.len;\n while (pos--) {\n if (limbList[pos])\n return (false);\n }\n return (true);\n };\n BigFloat53.prototype.getSign = function () {\n var t = this.len;\n return (t && (t = this.limbList[t - 1]) && (t > 0 ? 1 : -1));\n };\n /** Return an arbitrary number with sign matching the result of this - other. */\n // TODO: Test.\n BigFloat53.prototype.deltaFrom = function (other) {\n var t = this.len;\n var sign = this.getSign();\n var diff = sign;\n if (typeof (other) != 'number') {\n t = other.len;\n diff -= t && (t = other.limbList[t - 1]) && (t > 0 ? 1 : -1);\n if (diff || !sign)\n return (diff);\n this.addBig(other, -1, temp53[0]);\n }\n else {\n diff -= other && (other > 0 ? 1 : -1);\n if (diff || !sign)\n return (diff);\n this.addSmall(-other, temp53[0]);\n }\n t = temp53[0].len;\n return (t && temp53[0].limbList[t - 1]);\n };\n /** Add a number to this arbitrary precision float.\n * See Grow-Expansion from Shewchuk page 10.\n *\n * @param b JavaScript floating point number to add.\n * @param sum Arbitrary precision float to overwrite with result.\n * @return Modified sum object. */\n BigFloat53.prototype.addSmall = function (b, sum) {\n var limbList = this.limbList;\n var sumLimbs = sum.limbList;\n var count = this.len;\n var estimate;\n var a, b2, err;\n var srcPos = 0, dstPos = 0;\n while (srcPos < count) {\n a = limbList[srcPos++];\n estimate = a + b;\n b2 = estimate - a;\n a -= estimate - b2;\n err = a + (b - b2);\n sumLimbs[dstPos] = err;\n dstPos += err && 1;\n b = estimate;\n }\n sumLimbs[dstPos] = b;\n sum.len = dstPos + (b && 1);\n return (sum);\n };\n /** Add another arbitrary precision float (multiplied by sign) to this one.\n * See Fast-Expansion-Sum from Shewchuk page 13.\n *\n * @param sign Multiplier for negating addend to implement subtraction.\n * @param sum Arbitrary precision float to overwrite with result.\n * @return Modified sum object. */\n BigFloat53.prototype.addBig = function (addend, sign, sum) {\n var augendLimbs = this.limbList;\n var addendLimbs = addend.limbList;\n var sumLimbs = sum.limbList;\n var count = this.len + addend.len;\n var nextAugendPos = 0;\n var nextAddendPos = 0;\n var nextSumPos = 0;\n /** Latest limb of augend. */\n var a = augendLimbs[nextAugendPos++];\n /** Latest limb of addend. */\n var b = addendLimbs[nextAddendPos++] * sign;\n /** Magnitude of latest augend limb. */\n var a2 = a < 0 ? -a : a;\n /** Magnitude of latest addend limb. */\n var b2 = b < 0 ? -b : b;\n var nextLimb, nextLimb2, prevLimb;\n var err;\n if (!count)\n return (sum.setZero());\n // Append sentinel limbs to avoid testing for end of array.\n augendLimbs[this.len] = Infinity;\n addendLimbs[addend.len] = Infinity;\n /** Get next smallest limb from either augend or addend.\n * This avoids merging the two limb lists. */\n function getNextLimb() {\n var result;\n if (a2 < b2) {\n result = a;\n a = augendLimbs[nextAugendPos++];\n a2 = a < 0 ? -a : a;\n }\n else {\n result = b;\n b = addendLimbs[nextAddendPos++] * sign;\n b2 = b < 0 ? -b : b;\n }\n return (result);\n }\n var limb = getNextLimb();\n while (--count) {\n nextLimb = getNextLimb();\n prevLimb = limb;\n limb += nextLimb;\n nextLimb2 = limb - prevLimb;\n err = (prevLimb - (limb - nextLimb2)) + (nextLimb - nextLimb2);\n sumLimbs[nextSumPos] = err;\n nextSumPos += err && 1;\n }\n sumLimbs[nextSumPos] = limb;\n sum.len = nextSumPos + (limb && 1);\n return (sum);\n };\n BigFloat53.prototype.addSub = function (addend, sign, result) {\n result = result || new BigFloat53();\n if (typeof (addend) == 'number')\n return (this.addSmall(sign * addend, result));\n return (this.addBig(addend, sign, result));\n };\n /** Add number or arbitrary precision float to this one\n * and store result in another BigFloat53.\n *\n * @param addend Number or arbitrary precision float.\n * @param sum Arbitrary precision float to overwrite with result.\n * If omitted, a new one is allocated.\n * @return Modified sum object. */\n BigFloat53.prototype.add = function (addend, sum) {\n return (this.addSub(addend, 1, sum));\n };\n /** Subtract number or arbitrary precision float from this one\n * and store result in another BigFloat53.\n *\n * @param subtrahend Number or arbitrary precision float.\n * @param difference Arbitrary precision float to overwrite with result.\n * If omitted, a new one is allocated.\n * @return Modified difference object. */\n BigFloat53.prototype.sub = function (subtrahend, difference) {\n return (this.addSub(subtrahend, -1, difference));\n };\n /** Round towards zero, to (at least) given number of base 2^53 fractional digits. */\n BigFloat53.prototype.truncate = function (fractionLimbCount) {\n this.normalize();\n var limbList = this.limbList;\n var len = this.len;\n // Use binary search to find last |limb| < 1.\n var lo = 0;\n var hi = len;\n var mid = 0;\n var limb = 0;\n while (lo < hi) {\n mid = (lo + hi) >> 1;\n limb = limbList[mid];\n if (limb > -1 && limb < 1) {\n lo = mid + 1;\n }\n else {\n hi = mid;\n }\n }\n if (mid && (limb <= -1 || limb >= 1)) {\n limb = limbList[--mid];\n }\n // Slice off limbs before and including it,\n // except the fractionLimbCount last ones.\n mid -= fractionLimbCount - 1;\n if (mid > 0) {\n this.len -= mid;\n len = this.len;\n for (var pos = 0; pos < len; ++pos) {\n limbList[pos] = limbList[pos + mid];\n }\n }\n return (this);\n };\n BigFloat53.prototype.round = function (decimalCount) {\n return (this.truncate(1 + ~~(decimalCount * limbsPerDigit53)));\n };\n BigFloat53.prototype.valueOf = function () {\n var limbList = this.limbList;\n var len = this.len;\n var result = 0;\n for (var pos = 0; pos < len; ++pos) {\n result += limbList[pos];\n }\n return (result);\n };\n /** Convert to string in any even base supported by Number.toString.\n * @return String in lower case. */\n BigFloat53.prototype.toString = function (base) {\n var limbList = this.limbList;\n var pos = this.len;\n temp32$1[pos & 1].setZero();\n while (pos--) {\n temp32$1[~pos & 1].add(limbList[pos], temp32$1[pos & 1]);\n }\n return (temp32$1[~pos & 1].toString(base));\n };\n return BigFloat53;\n }());\n BigFloat53.prototype.cmp = BigFloat53.prototype.deltaFrom;\n /** Latest approximate product from twoProduct. */\n var tempProduct = 0;\n /** Temporary values for internal calculations. */\n var temp32$1 = [new BigFloat32(), new BigFloat32()];\n /** Temporary values for internal calculations. */\n var temp53 = [new BigFloat53(), new BigFloat53()];\n\n // This file is part of bigfloat, copyright (c) 2018- BusFaster Ltd.\n /** Simpler replacement for the default TypeScript helper.\n * Ignores static members and avoids rollup warnings. */\n function __extends(child, parent) {\n function helper() { this.constructor = child; }\n helper.prototype = parent.prototype;\n child.prototype = new helper();\n }\n var BigComplex = /** @class */ (function () {\n function BigComplex(real, imag, base) {\n this.real = typeof (real) == 'object' ? real : new this.Base(real, base);\n this.imag = typeof (imag) == 'object' ? imag : new this.Base(imag, base);\n }\n BigComplex.prototype.clone = function () {\n var other = new this.constructor(this.real.clone(), this.imag.clone());\n return (other);\n };\n BigComplex.prototype.setZero = function () {\n this.real.setZero();\n this.imag.setZero();\n return (this);\n };\n BigComplex.prototype.setValue = function (other) {\n this.real.setValue(other.real);\n this.imag.setValue(other.imag);\n return (this);\n };\n BigComplex.prototype.mul = function (multiplier, product) {\n product = product || new this.constructor();\n if (multiplier instanceof BigComplex) {\n this.real.mul(multiplier.real, this.temp1);\n this.imag.mul(multiplier.imag, this.temp2);\n this.temp1.sub(this.temp2, product.real);\n this.real.mul(multiplier.imag, this.temp1);\n this.imag.mul(multiplier.real, this.temp2);\n this.temp1.add(this.temp2, product.imag);\n }\n else {\n this.real.mul(multiplier, product.real);\n this.imag.mul(multiplier, product.imag);\n }\n return (product);\n };\n BigComplex.prototype.sqr = function (product) {\n product = product || new this.constructor();\n this.real.mul(this.real, this.temp1);\n this.imag.mul(this.imag, this.temp2);\n this.temp1.sub(this.temp2, product.real);\n this.real.mul(this.imag, this.temp1);\n this.temp1.add(this.temp1, product.imag);\n return (product);\n };\n BigComplex.prototype.add = function (addend, sum) {\n sum = sum || new this.constructor();\n if (addend instanceof BigComplex) {\n this.real.add(addend.real, sum.real);\n this.imag.add(addend.imag, sum.imag);\n }\n else {\n this.real.add(addend, sum.real);\n }\n return (sum);\n };\n BigComplex.prototype.sub = function (subtrahend, difference) {\n difference = difference || new this.constructor();\n if (subtrahend instanceof BigComplex) {\n this.real.sub(subtrahend.real, difference.real);\n this.imag.sub(subtrahend.imag, difference.imag);\n }\n else {\n this.real.sub(subtrahend, difference.real);\n }\n return (difference);\n };\n BigComplex.prototype.truncate = function (fractionLimbCount) {\n this.real.truncate(fractionLimbCount);\n this.imag.truncate(fractionLimbCount);\n return (this);\n };\n return BigComplex;\n }());\n var BigComplex32 = /** @class */ (function (_super) {\n __extends(BigComplex32, _super);\n function BigComplex32() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return BigComplex32;\n }(BigComplex));\n var BigComplex53 = /** @class */ (function (_super) {\n __extends(BigComplex53, _super);\n function BigComplex53() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return BigComplex53;\n }(BigComplex));\n BigComplex32.prototype.Base = BigFloat32;\n BigComplex32.prototype.temp1 = new BigFloat32();\n BigComplex32.prototype.temp2 = new BigFloat32();\n BigComplex53.prototype.Base = BigFloat53;\n BigComplex53.prototype.temp1 = new BigFloat53();\n BigComplex53.prototype.temp2 = new BigFloat53();\n\n // This file is part of bigfloat, copyright (c) 2015- BusFaster Ltd.\n\n exports.BigFloat32 = BigFloat32;\n exports.BigFloat53 = BigFloat53;\n exports.BigComplex32 = BigComplex32;\n exports.BigComplex53 = BigComplex53;\n exports.trimNumber = trimNumber;\n exports.numberToString = numberToString;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n","import { BigFloat32 } from 'bigfloat';\n\nfunction _arrayLikeToArray(r, a) {\n (null == a || a > r.length) && (a = r.length);\n for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];\n return n;\n}\nfunction _construct(t, e, r) {\n if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);\n var o = [null];\n o.push.apply(o, e);\n var p = new (t.bind.apply(t, o))();\n return r && _setPrototypeOf(p, r.prototype), p;\n}\nfunction _defineProperties(e, r) {\n for (var t = 0; t < r.length; t++) {\n var o = r[t];\n o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);\n }\n}\nfunction _createClass(e, r, t) {\n return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", {\n writable: !1\n }), e;\n}\nfunction _createForOfIteratorHelperLoose(r, e) {\n var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"];\n if (t) return (t = t.call(r)).next.bind(t);\n if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) {\n t && (r = t);\n var o = 0;\n return function () {\n return o >= r.length ? {\n done: !0\n } : {\n done: !1,\n value: r[o++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nfunction _getPrototypeOf(t) {\n return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) {\n return t.__proto__ || Object.getPrototypeOf(t);\n }, _getPrototypeOf(t);\n}\nfunction _inheritsLoose(t, o) {\n t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);\n}\nfunction _isNativeFunction(t) {\n try {\n return -1 !== Function.toString.call(t).indexOf(\"[native code]\");\n } catch (n) {\n return \"function\" == typeof t;\n }\n}\nfunction _isNativeReflectConstruct() {\n try {\n var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n } catch (t) {}\n return (_isNativeReflectConstruct = function () {\n return !!t;\n })();\n}\nfunction _setPrototypeOf(t, e) {\n return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {\n return t.__proto__ = e, t;\n }, _setPrototypeOf(t, e);\n}\nfunction _toPrimitive(t, r) {\n if (\"object\" != typeof t || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != typeof i) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nfunction _toPropertyKey(t) {\n var i = _toPrimitive(t, \"string\");\n return \"symbol\" == typeof i ? i : i + \"\";\n}\nfunction _unsupportedIterableToArray(r, a) {\n if (r) {\n if (\"string\" == typeof r) return _arrayLikeToArray(r, a);\n var t = {}.toString.call(r).slice(8, -1);\n return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;\n }\n}\nfunction _wrapNativeSuper(t) {\n var r = \"function\" == typeof Map ? new Map() : void 0;\n return _wrapNativeSuper = function (t) {\n if (null === t || !_isNativeFunction(t)) return t;\n if (\"function\" != typeof t) throw new TypeError(\"Super expression must either be null or a function\");\n if (void 0 !== r) {\n if (r.has(t)) return r.get(t);\n r.set(t, Wrapper);\n }\n function Wrapper() {\n return _construct(t, arguments, _getPrototypeOf(this).constructor);\n }\n return Wrapper.prototype = Object.create(t.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: !1,\n writable: !0,\n configurable: !0\n }\n }), _setPrototypeOf(Wrapper, t);\n }, _wrapNativeSuper(t);\n}\n\n/**\r\n * Interval represents a closed interval on ℝ.\r\n * Zero-length intervals (where lo == hi) represent single points.\r\n * If lo > hi then the interval is empty.\r\n */\nvar Interval = /*#__PURE__*/function () {\n /**\r\n * Returns a new Interval.\r\n * @category Constructors\r\n */\n function Interval(lo, hi) {\n this.lo = 0.0;\n this.hi = 0.0;\n this.lo = lo;\n this.hi = hi;\n }\n /**\r\n * Reports whether the interval is empty.\r\n */\n var _proto = Interval.prototype;\n _proto.isEmpty = function isEmpty() {\n return this.lo > this.hi;\n }\n /**\r\n * Returns true iff the interval contains the same points as oi.\r\n */;\n _proto.equals = function equals(oi) {\n return this.lo == oi.lo && this.hi == oi.hi || this.isEmpty() && oi.isEmpty();\n }\n /**\r\n * Returns the midpoint of the interval.\r\n * Behaviour is undefined for empty intervals.\r\n */;\n _proto.center = function center() {\n return 0.5 * (this.lo + this.hi);\n }\n /**\r\n * Returns the length of the interval.\r\n * The length of an empty interval is negative.\r\n */;\n _proto.length = function length() {\n return this.hi - this.lo;\n }\n /**\r\n * Returns true iff the interval contains p.\r\n */;\n _proto.contains = function contains(p) {\n return this.lo <= p && p <= this.hi;\n }\n /**\r\n * Returns true iff the interval contains oi.\r\n */;\n _proto.containsInterval = function containsInterval(oi) {\n if (oi.isEmpty()) return true;\n return this.lo <= oi.lo && oi.hi <= this.hi;\n }\n /**\r\n * Returns true iff the interval strictly contains p.\r\n */;\n _proto.interiorContains = function interiorContains(p) {\n return this.lo < p && p < this.hi;\n }\n /**\r\n * Returns true iff the interval strictly contains oi.\r\n */;\n _proto.interiorContainsInterval = function interiorContainsInterval(oi) {\n if (oi.isEmpty()) return true;\n return this.lo < oi.lo && oi.hi < this.hi;\n }\n /**\r\n * Returns true iff the interval contains any points in common with oi.\r\n */;\n _proto.intersects = function intersects(oi) {\n if (this.lo <= oi.lo) return oi.lo <= this.hi && oi.lo <= oi.hi; // oi.lo ∈ i and oi is not empty\n return this.lo <= oi.hi && this.lo <= this.hi; // i.lo ∈ oi and i is not empty\n }\n /**\r\n * Returns true iff the interior of the interval contains any points in common with oi, including the latter's boundary.\r\n */;\n _proto.interiorIntersects = function interiorIntersects(oi) {\n return oi.lo < this.hi && this.lo < oi.hi && this.lo < this.hi && oi.lo <= oi.hi;\n }\n /**\r\n * Returns the interval containing all points common to i and j.\r\n * Empty intervals do not need to be special-cased.\r\n */;\n _proto.intersection = function intersection(j) {\n return new Interval(Math.max(this.lo, j.lo), Math.min(this.hi, j.hi));\n }\n /**\r\n * Returns the smallest interval that contains this interval and the given interval.\r\n */;\n _proto.union = function union(oi) {\n if (this.isEmpty()) return oi;\n if (oi.isEmpty()) return this;\n return new Interval(Math.min(this.lo, oi.lo), Math.max(this.hi, oi.hi));\n }\n /**\r\n * Returns the interval expanded so that it contains the given point.\r\n */;\n _proto.addPoint = function addPoint(p) {\n if (this.isEmpty()) return new Interval(p, p);\n if (p < this.lo) return new Interval(p, this.hi);\n if (p > this.hi) return new Interval(this.lo, p);\n return this;\n }\n /**\r\n * Returns the closest point in the interval to the given point p.\r\n * The interval must be non-empty.\r\n */;\n _proto.clampPoint = function clampPoint(p) {\n return Math.max(this.lo, Math.min(this.hi, p));\n }\n /**\r\n * Returns an interval that has been expanded on each side by margin.\r\n * If margin is negative, then the function shrinks the interval on each side by margin instead.\r\n * The resulting interval may be empty.\r\n * Any expansion of an empty interval remains empty.\r\n */;\n _proto.expanded = function expanded(margin) {\n if (this.isEmpty()) return this;\n return new Interval(this.lo - margin, this.hi + margin);\n }\n /**\r\n * Reports whether the interval can be transformed into the given interval by moving each endpoint a small distance.\r\n * The empty interval is considered to be positioned arbitrarily on the real line, so any interval with a small enough length will match the empty interval.\r\n */;\n _proto.approxEqual = function approxEqual(oi, epsilon) {\n if (epsilon === void 0) {\n epsilon = 1e-15;\n }\n if (this.isEmpty()) return oi.length() <= 2 * epsilon;\n if (oi.isEmpty()) return this.length() <= 2 * epsilon;\n return Math.abs(oi.lo - this.lo) <= epsilon && Math.abs(oi.hi - this.hi) <= epsilon;\n }\n /**\r\n * Returns the Hausdorff distance to the given interval. For two intervals x and y, this distance is defined as:\r\n * h(x, y) = max_{p in x} min_{q in y} d(p, q).\r\n */;\n _proto.directedHausdorffDistance = function directedHausdorffDistance(oi) {\n if (this.isEmpty()) return 0;\n if (oi.isEmpty()) return Infinity;\n return Math.max(0, Math.max(this.hi - oi.hi, oi.lo - this.lo));\n }\n /**\r\n * Truncates {lo, hi} floats to n digits of precision.\r\n */;\n _proto.trunc = function trunc(n) {\n if (n === void 0) {\n n = 15;\n }\n var p = Number(\"1e\" + n);\n var trunc = function trunc(dim) {\n return Math.round(dim * p) / p;\n };\n return new Interval(trunc(this.lo), trunc(this.hi));\n }\n /**\r\n * Generates a human readable string.\r\n */;\n _proto.toString = function toString() {\n var t = this.trunc(7);\n return \"[\" + t.lo.toFixed(7) + \", \" + t.hi.toFixed(7) + \"]\";\n }\n /**\r\n * Returns an empty interval.\r\n * @category Constructors\r\n */;\n Interval.empty = function empty() {\n return new Interval(1, 0);\n }\n /**\r\n * Returns an interval representing a single point.\r\n * @category Constructors\r\n */;\n Interval.fromPoint = function fromPoint(p) {\n return new Interval(p, p);\n };\n return Interval;\n}();\n\n/**\r\n * Module r1 implements types and functions for working with geometry in ℝ¹.\r\n * @module r1\r\n */\n\nvar _index = {\n __proto__: null,\n Interval: Interval\n};\n\n/**\r\n * Point represents a point in ℝ².\r\n */\nvar Point = /*#__PURE__*/function () {\n /**\r\n * Returns a new Point.\r\n * @category Constructors\r\n */\n function Point(x, y) {\n if (x === void 0) {\n x = 0.0;\n }\n if (y === void 0) {\n y = 0.0;\n }\n this.x = 0.0;\n this.y = 0.0;\n this.x = x;\n this.y = y;\n }\n /** Returns the sum of p and op. */\n var _proto = Point.prototype;\n _proto.add = function add(op) {\n return new Point(this.x + op.x, this.y + op.y);\n }\n /** Returns the difference of p and op. */;\n _proto.sub = function sub(op) {\n return new Point(this.x - op.x, this.y - op.y);\n }\n /** Returns the scalar product of p and m. */;\n _proto.mul = function mul(m) {\n return new Point(this.x * m, this.y * m);\n }\n /** Returns a counterclockwise orthogonal point with the same norm. */;\n _proto.ortho = function ortho() {\n return new Point(-this.y, this.x);\n }\n /** Returns the dot product between p and op. */;\n _proto.dot = function dot(op) {\n return this.x * op.x + this.y * op.y;\n }\n /** Returns the cross product of p and op. */;\n _proto.cross = function cross(op) {\n return this.x * op.y - this.y * op.x;\n }\n /** Returns the vector's norm. */;\n _proto.norm = function norm() {\n return Math.hypot(this.x, this.y);\n }\n /** Returns a unit point in the same direction as p. */;\n _proto.normalize = function normalize() {\n if (this.x == 0.0 && this.y == 0.0) return this;\n return this.mul(1 / this.norm());\n }\n /** Truncates {x, y} floats to n digits of precision. */;\n _proto.trunc = function trunc(n) {\n if (n === void 0) {\n n = 15;\n }\n var p = Number(\"1e\" + n);\n var trunc = function trunc(dim) {\n return Math.round(dim * p) / p;\n };\n return new Point(trunc(this.x), trunc(this.y));\n }\n /**\r\n * Reports whether this point equals another point.\r\n */;\n _proto.equals = function equals(op) {\n return this.x === op.x && this.y === op.y;\n }\n /** Generates a human readable string. */;\n _proto.toString = function toString() {\n var t = this.trunc(12);\n return \"(\" + t.x.toFixed(12) + \", \" + t.y.toFixed(12) + \")\";\n };\n return Point;\n}();\n\n/**\r\n * Rect represents a closed axis-aligned rectangle in the (x,y) plane.\r\n */\nvar Rect = /*#__PURE__*/function () {\n /**\r\n * Returns a new Rect.\r\n * @category Constructors\r\n */\n function Rect(x, y) {\n if (x === void 0) {\n x = new Interval(0, 0);\n }\n if (y === void 0) {\n y = new Interval(0, 0);\n }\n this.x = x;\n this.y = y;\n }\n /**\r\n * Reports whether the rectangle is valid.\r\n * This requires the width to be empty iff the height is empty.\r\n */\n var _proto = Rect.prototype;\n _proto.isValid = function isValid() {\n return this.x.isEmpty() == this.y.isEmpty();\n }\n /**\r\n * Reports whether the rectangle is empty.\r\n */;\n _proto.isEmpty = function isEmpty() {\n return this.x.isEmpty();\n }\n /**\r\n * Vertices returns all four vertices of the rectangle.\r\n * Vertices are returned in CCW direction starting with the lower left corner.\r\n */;\n _proto.vertices = function vertices() {\n return [new Point(this.x.lo, this.y.lo), new Point(this.x.hi, this.y.lo), new Point(this.x.hi, this.y.hi), new Point(this.x.lo, this.y.hi)];\n }\n /**\r\n * VertexIJ returns the vertex in direction i along the X-axis (0=left, 1=right) and direction j along the Y-axis (0=down, 1=up).\r\n */;\n _proto.vertexIJ = function vertexIJ(i, j) {\n var x = this.x.lo;\n if (i == 1) x = this.x.hi;\n var y = this.y.lo;\n if (j == 1) y = this.y.hi;\n return new Point(x, y);\n }\n /**\r\n * Returns the low corner of the rect.\r\n */;\n _proto.lo = function lo() {\n return new Point(this.x.lo, this.y.lo);\n }\n /**\r\n * Returns the high corner of the rect.\r\n */;\n _proto.hi = function hi() {\n return new Point(this.x.hi, this.y.hi);\n }\n /**\r\n * Returns the center of the rectangle in (x,y)-space.\r\n */;\n _proto.center = function center() {\n return new Point(this.x.center(), this.y.center());\n }\n /**\r\n * Returns the width and height of this rectangle in (x,y)-space.\r\n * Empty rectangles have a negative width and height.\r\n */;\n _proto.size = function size() {\n return new Point(this.x.length(), this.y.length());\n }\n /**\r\n * Reports whether the rectangle contains the given point.\r\n * Rectangles are closed regions, i.e. they contain their boundary.\r\n */;\n _proto.containsPoint = function containsPoint(p) {\n return this.x.contains(p.x) && this.y.contains(p.y);\n }\n /**\r\n * Returns true iff the given point is contained in the interior of the region (i.e. the region excluding its boundary).\r\n */;\n _proto.interiorContainsPoint = function interiorContainsPoint(p) {\n return this.x.interiorContains(p.x) && this.y.interiorContains(p.y);\n }\n /**\r\n * Reports whether the rectangle contains the given rectangle.\r\n */;\n _proto.contains = function contains(or) {\n return this.x.containsInterval(or.x) && this.y.containsInterval(or.y);\n }\n /**\r\n * Reports whether the interior of this rectangle contains all of the points of the given or: Rectangle (including its boundary).\r\n */;\n _proto.interiorContains = function interiorContains(or) {\n return this.x.interiorContainsInterval(or.x) && this.y.interiorContainsInterval(or.y);\n }\n /**\r\n * Reports whether this rectangle and the or: Rectangle have any points in common.\r\n */;\n _proto.intersects = function intersects(or) {\n return this.x.intersects(or.x) && this.y.intersects(or.y);\n }\n /**\r\n * Reports whether the interior of this rectangle intersects any point (including the boundary) of the given or: Rectangle.\r\n */;\n _proto.interiorIntersects = function interiorIntersects(or) {\n return this.x.interiorIntersects(or.x) && this.y.interiorIntersects(or.y);\n }\n /**\r\n * Expands the rectangle to include the given point.\r\n * The rectangle is expanded by the minimum amount possible.\r\n */;\n _proto.addPoint = function addPoint(p) {\n return new Rect(this.x.addPoint(p.x), this.y.addPoint(p.y));\n }\n /**\r\n * Expands the rectangle to include the given rectangle.\r\n * This is the same as replacing the rectangle by the union of the two rectangles, but is more efficient.\r\n */;\n _proto.addRect = function addRect(or) {\n return new Rect(this.x.union(or.x), this.y.union(or.y));\n }\n /**\r\n * Returns the closest point in the rectangle to the given point.\r\n * The rectangle must be non-empty.\r\n */;\n _proto.clampPoint = function clampPoint(p) {\n return new Point(this.x.clampPoint(p.x), this.y.clampPoint(p.y));\n }\n /**\r\n * Returns a rectangle that has been expanded in the x-direction by margin.X, and in y-direction by margin.Y.\r\n * If either margin is empty, then shrink the interval on the corresponding sides instead.\r\n * The resulting rectangle may be empty.\r\n * Any expansion of an empty rectangle remains empty.\r\n */;\n _proto.expanded = function expanded(margin) {\n var xx = this.x.expanded(margin.x);\n var yy = this.y.expanded(margin.y);\n if (xx.isEmpty() || yy.isEmpty()) {\n return Rect.empty();\n }\n return new Rect(xx, yy);\n }\n /**\r\n * Returns a Rect that has been expanded by the amount on all sides.\r\n */;\n _proto.expandedByMargin = function expandedByMargin(margin) {\n return this.expanded(new Point(margin, margin));\n }\n /**\r\n * Returns the smallest rectangle containing the union of this rectangle and the given rectangle.\r\n */;\n _proto.union = function union(or) {\n return new Rect(this.x.union(or.x), this.y.union(or.y));\n }\n /**\r\n * Returns the smallest rectangle containing the intersection of this rectangle and the given rectangle.\r\n */;\n _proto.intersection = function intersection(or) {\n var xx = this.x.intersection(or.x);\n var yy = this.y.intersection(or.y);\n if (xx.isEmpty() || yy.isEmpty()) {\n return Rect.empty();\n }\n return new Rect(xx, yy);\n }\n /**\r\n * Returns true if the x- and y-intervals of the two rectangles are the same up to the given tolerance.\r\n */;\n _proto.approxEqual = function approxEqual(or) {\n return this.x.approxEqual(or.x) && this.y.approxEqual(or.y);\n }\n /** Generates a human readable string. */;\n _proto.string = function string() {\n return \"[\" + this.lo().toString() + \", \" + this.hi.toString() + \"]\";\n }\n /**\r\n * Constructs a Rect that contains the given points.\r\n * @category Constructors\r\n */;\n Rect.fromPoints = function fromPoints() {\n for (var _len = arguments.length, pts = new Array(_len), _key = 0; _key < _len; _key++) {\n pts[_key] = arguments[_key];\n }\n // Because the default value on interval is 0,0, we need to manually\n // define the interval from the first point passed in as our starting\n // interval, otherwise we end up with the case of passing in\n // Point{0.2, 0.3} and getting the starting Rect of {0, 0.2}, {0, 0.3}\n // instead of the Rect {0.2, 0.2}, {0.3, 0.3} which is not correct.\n if (pts.length == 0) return new Rect();\n var r = new Rect(new Interval(pts[0].x, pts[0].x), new Interval(pts[0].y, pts[0].y));\n for (var i = 1; i < pts.length; i++) r = r.addPoint(pts[i]);\n return r;\n }\n /**\r\n * Constructs a rectangle with the given center and size.\r\n * Both dimensions of size must be non-negative.\r\n * @category Constructors\r\n */;\n Rect.fromCenterSize = function fromCenterSize(center, size) {\n return new Rect(new Interval(center.x - size.x / 2, center.x + size.x / 2), new Interval(center.y - size.y / 2, center.y + size.y / 2));\n }\n /**\r\n * Constructs a rectangle from another rectangle (ie. make a copy)\r\n * @category Constructors\r\n */;\n Rect.fromRect = function fromRect(or) {\n return new Rect(new Interval(or.x.lo, or.x.hi), new Interval(or.y.lo, or.y.hi));\n }\n /**\r\n * Constructs the canonical empty rectangle.\r\n * Use isEmpty() to test for empty rectangles, since they have more than one representation.\r\n * new Interval(0, 0) is not the same as the empty Rect.\r\n * @category Constructors\r\n */;\n Rect.empty = function empty() {\n return new Rect(Interval.empty(), Interval.empty());\n };\n return Rect;\n}();\n\n/**\r\n * Module r2 implements types and functions for working with geometry in ℝ².\r\n * @module r2\r\n */\n\nvar _index$1 = {\n __proto__: null,\n Point: Point,\n Rect: Rect\n};\n\n/**\r\n * Vector represents a point in ℝ³\r\n */\nvar Vector = /*#__PURE__*/function () {\n /**\r\n * Returns a new Vector.\r\n * @category Constructors\r\n */\n function Vector(x, y, z) {\n this.x = 0.0;\n this.y = 0.0;\n this.z = 0.0;\n this.x = x;\n this.y = y;\n this.z = z;\n }\n /** Reports whether v and ov are equal within a small epsilon. */\n var _proto = Vector.prototype;\n _proto.approxEqual = function approxEqual(ov) {\n var epsilon = 1e-16;\n return Math.abs(this.x - ov.x) < epsilon && Math.abs(this.y - ov.y) < epsilon && Math.abs(this.z - ov.z) < epsilon;\n }\n /**\r\n * Generates a human readable string.\r\n */;\n _proto.toString = function toString() {\n return \"(\" + this.x.toFixed(24) + \", \" + this.y.toFixed(24) + \", \" + this.z.toFixed(24) + \")\";\n }\n // Returns the vector's norm.\n ;\n _proto.norm = function norm() {\n return Math.sqrt(this.dot(this));\n }\n /** Returns the square of the norm. */;\n _proto.norm2 = function norm2() {\n return this.dot(this);\n }\n /** Returns a unit vector in the same direction as v. */;\n _proto.normalize = function normalize() {\n var n2 = this.norm2();\n if (n2 == 0) return new Vector(0, 0, 0);\n return this.mul(1 / Math.sqrt(n2));\n }\n /** Returns whether this vector is of approximately unit length. */;\n _proto.isUnit = function isUnit() {\n var epsilon = 5e-14;\n return Math.abs(this.norm2() - 1) <= epsilon;\n }\n /** Returns the vector with nonnegative components. */;\n _proto.abs = function abs() {\n return new Vector(Math.abs(this.x), Math.abs(this.y), Math.abs(this.z));\n }\n /** Returns the standard vector sum of v and ov. */;\n _proto.add = function add(ov) {\n return new Vector(this.x + ov.x, this.y + ov.y, this.z + ov.z);\n }\n /** Returns the standard vector difference of v and ov. */;\n _proto.sub = function sub(ov) {\n return new Vector(this.x - ov.x, this.y - ov.y, this.z - ov.z);\n }\n /** Returns the standard scalar product of v and m. */;\n _proto.mul = function mul(m) {\n return new Vector(m * this.x, m * this.y, m * this.z);\n }\n /** Returns the standard dot product of v and ov. */;\n _proto.dot = function dot(ov) {\n return this.x * ov.x + this.y * ov.y + this.z * ov.z || 0;\n }\n /** Returns the standard cross product of v and ov. */;\n _proto.cross = function cross(ov) {\n return new Vector(this.y * ov.z - this.z * ov.y, this.z * ov.x - this.x * ov.z, this.x * ov.y - this.y * ov.x);\n }\n /** Returns the Euclidean distance between v and ov. */;\n _proto.distance = function distance(ov) {\n return this.sub(ov).norm();\n }\n /** Returns the angle between v and ov. */;\n _proto.angle = function angle(ov) {\n return Math.atan2(this.cross(ov).norm(), this.dot(ov));\n }\n /**\r\n * Returns a unit vector that is orthogonal to v.\r\n * ortho(-v) = -ortho(v) for all v.\r\n */;\n _proto.ortho = function ortho() {\n var ov = new Vector(0, 0, 0);\n var lc = this.largestComponent();\n if (lc === Vector.X_AXIS) ov.z = 1;else if (lc === Vector.Y_AXIS) ov.x = 1;else ov.y = 1;\n return this.cross(ov).normalize();\n }\n /** Returns the Axis that represents the largest component in this vector. */;\n _proto.largestComponent = function largestComponent() {\n var t = this.abs();\n if (t.x > t.y) {\n if (t.x > t.z) return Vector.X_AXIS;\n return Vector.Z_AXIS;\n }\n if (t.y > t.z) return Vector.Y_AXIS;\n return Vector.Z_AXIS;\n }\n /** Returns the Axis that represents the smallest component in this vector. */;\n _proto.smallestComponent = function smallestComponent() {\n var t = this.abs();\n if (t.x < t.y) {\n if (t.x < t.z) return Vector.X_AXIS;\n return Vector.Z_AXIS;\n }\n if (t.y < t.z) return Vector.Y_AXIS;\n return Vector.Z_AXIS;\n }\n /**\r\n * Reports whether this Vector equals another Vector.\r\n */;\n _proto.equals = function equals(ov) {\n return this.x == ov.x && this.y == ov.y && this.z == ov.z;\n }\n /**\r\n * Compares v and ov lexicographically and returns:\r\n *\r\n * \t-1 if v < ov\r\n * \t 0 if v == ov\r\n * \t+1 if v > ov\r\n *\r\n * This method is based on C++'s std::lexicographical_compare. Two entities\r\n * are compared element by element with the given operator. The first mismatch\r\n * defines which is less (or greater) than the other. If both have equivalent\r\n * values they are lexicographically equal.\r\n */;\n _proto.cmp = function cmp(ov) {\n if (this.x < ov.x) return -1;\n if (this.x > ov.x) return 1;\n // First elements were the same, try the next.\n if (this.y < ov.y) return -1;\n if (this.y > ov.y) return 1;\n // Second elements were the same return the final compare.\n if (this.z < ov.z) return -1;\n if (this.z > ov.z) return 1;\n // Both are equal\n return 0;\n };\n return Vector;\n}();\n/**\r\n * @categoryDescription Axis\r\n * The three axes of ℝ³.\r\n */\n/**\r\n * X Axis\r\n * @category Axis\r\n */\nVector.X_AXIS = 0;\n/**\r\n * Y Axis\r\n * @category Axis\r\n */\nVector.Y_AXIS = 1;\n/**\r\n * Z Axis\r\n * @category Axis\r\n */\nVector.Z_AXIS = 2;\n\n/**\r\n * Represents a point in ℝ³ using high-precision values.\r\n * Note that this is NOT a complete implementation because there are some operations that Vector supports that are not feasible with arbitrary precision math.\r\n */\nvar PreciseVector = /*#__PURE__*/function () {\n /**\r\n * Returns a new PreciseVector.\r\n * @category Constructors\r\n */\n function PreciseVector(x, y, z) {\n this.x = x;\n this.y = y;\n this.z = z;\n }\n /**\r\n * Creates a high precision vector from the given Vector.\r\n * @category Constructors\r\n */\n PreciseVector.fromVector = function fromVector(v) {\n return new PreciseVector(new BigFloat32(v.x), new BigFloat32(v.y), new BigFloat32(v.z));\n }\n /**\r\n * Converts this precise vector to a Vector.\r\n */;\n var _proto = PreciseVector.prototype;\n _proto.vector = function vector() {\n return new Vector(this.x.valueOf(), this.y.valueOf(), this.z.valueOf()).normalize();\n }\n /**\r\n * Reports whether this vector and another precise vector are equal.\r\n */;\n _proto.equals = function equals(ov) {\n return this.x.cmp(ov.x) === 0 && this.y.cmp(ov.y) === 0 && this.z.cmp(ov.z) === 0;\n }\n /**\r\n * Returns a string representation of the vector.\r\n */;\n _proto.toString = function toString() {\n return \"(\" + this.x.toString() + \", \" + this.y.toString() + \", \" + this.z.toString() + \")\";\n }\n /**\r\n * Returns the square of the norm.\r\n */;\n _proto.norm2 = function norm2() {\n return this.dot(this);\n }\n /**\r\n * Reports whether this vector is of unit length.\r\n */;\n _proto.isUnit = function isUnit() {\n return this.norm2().cmp(new BigFloat32(1)) === 0;\n }\n /**\r\n * Returns the vector with nonnegative components.\r\n */;\n _proto.abs = function abs() {\n var x = this.x.mul(this.x.getSign());\n var y = this.y.mul(this.y.getSign());\n var z = this.z.mul(this.z.getSign());\n return new PreciseVector(x, y, z);\n }\n /**\r\n * Returns the standard vector sum of this vector and another.\r\n */;\n _proto.add = function add(ov) {\n return new PreciseVector(this.x.add(ov.x), this.y.add(ov.y), this.z.add(ov.z));\n }\n /**\r\n * Returns the standard vector difference of this vector and another.\r\n */;\n _proto.sub = function sub(ov) {\n return new PreciseVector(this.x.sub(ov.x), this.y.sub(ov.y), this.z.sub(ov.z));\n }\n /**\r\n * Returns the standard scalar product of this vector and a BigFloat.\r\n */;\n _proto.mul = function mul(f) {\n return new PreciseVector(this.x.mul(f), this.y.mul(f), this.z.mul(f));\n }\n /**\r\n * Returns the standard scalar product of this vector and a float.\r\n */;\n _proto.mulByFloat64 = function mulByFloat64(f) {\n return this.mul(new BigFloat32(f));\n }\n /**\r\n * Returns the standard dot product of this vector and another.\r\n */;\n _proto.dot = function dot(ov) {\n return this.x.mul(ov.x).add(this.y.mul(ov.y).add(this.z.mul(ov.z)));\n }\n /**\r\n * Returns the standard cross product of this vector and another.\r\n */;\n _proto.cross = function cross(ov) {\n return new PreciseVector(this.y.mul(ov.z).sub(this.z.mul(ov.y)), this.z.mul(ov.x).sub(this.x.mul(ov.z)), this.x.mul(ov.y).sub(this.y.mul(ov.x)));\n }\n /**\r\n * Returns the axis that represents the largest component in this vector.\r\n */;\n _proto.largestComponent = function largestComponent() {\n var t = this.abs();\n if (t.x.cmp(t.y) > 0) {\n if (t.x.cmp(t.z) > 0) return Vector.X_AXIS;\n return Vector.Z_AXIS;\n }\n if (t.y.cmp(t.z) > 0) return Vector.Y_AXIS;\n return Vector.Z_AXIS;\n }\n /**\r\n * Returns the axis that represents the smallest component in this vector.\r\n */;\n _proto.smallestComponent = function smallestComponent() {\n var t = this.abs();\n if (t.x.cmp(t.y) < 0) {\n if (t.x.cmp(t.z) < 0) return Vector.X_AXIS;\n return Vector.Z_AXIS;\n }\n if (t.y.cmp(t.z) < 0) return Vector.Y_AXIS;\n return Vector.Z_AXIS;\n }\n /**\r\n * Reports if this vector is exactly 0 efficiently.\r\n */;\n _proto.isZero = function isZero() {\n return this.x.isZero() && this.y.isZero() && this.z.isZero();\n };\n return PreciseVector;\n}();\n\n/**\r\n * Module r3 implements types and functions for working with geometry in ℝ³\r\n * @module r3\r\n */\n\nvar _index$2 = {\n __proto__: null,\n Vector: Vector,\n PreciseVector: PreciseVector\n};\n\n// angle units.\nvar DEGREE = Math.PI / 180;\n\n/** Computes the IEEE 754 floating-point remainder of x / y. */\nvar remainder = function remainder(x, y) {\n if (isNaN(x) || isNaN(y) || !isFinite(x) || y === 0) return NaN;\n var quotient = x / y;\n var n = Math.round(quotient);\n // When quotient is exactly halfway between two integers, round to the nearest even integer\n if (Math.abs(quotient - n) === 0.5) n = 2 * Math.round(quotient / 2);\n var rem = x - n * y;\n return !rem ? Math.sign(x) * 0 : rem;\n};\n/** Returns the next representable floating-point value after x towards y. */\nvar nextAfter = function nextAfter(x, y) {\n if (isNaN(x) || isNaN(y)) return NaN;\n if (x === y) return y;\n if (x === 0) return y > 0 ? Number.MIN_VALUE : -Number.MIN_VALUE;\n var buffer = new ArrayBuffer(8);\n var view = new DataView(buffer);\n view.setFloat64(0, x, true);\n var bits = view.getBigUint64(0, true);\n if (x > 0 === y > x) bits += 1n;else bits -= 1n;\n view.setBigUint64(0, bits, true);\n return view.getFloat64(0, true);\n};\n/**\r\n * Returns the offset of the lest significant bit set.\r\n * Offset 0 corresponds to the rightmost bit, 63 is the leftmost bit.\r\n * If none of the rightmost 64 bits are set then 64 is returned.\r\n */\nvar findLSBSetNonZero64 = function findLSBSetNonZero64(i) {\n var lsb = i & -i & 0xffffffffffffffffn;\n if (lsb === 0n) return 64;\n var lo = Math.clz32(Number(lsb & 0xffffffffn));\n if (lo < 32) return 31 - lo;\n var hi = Math.clz32(Number(lsb >> 32n & 0xffffffffn));\n return 63 - hi;\n};\n/**\r\n * Returns the offset of the most significant bit set.\r\n * Offset 0 corresponds to the rightmost bit, 63 is the leftmost bit.\r\n * If none of the rightmost 64 bits are set then 64 is returned.\r\n */\nvar findMSBSetNonZero64 = function findMSBSetNonZero64(i) {\n var msb = i & 0xffffffffffffffffn;\n if (msb === 0n) return 64;\n var hi = Math.clz32(Number(msb >> 32n & 0xffffffffn));\n if (hi < 32) return 63 - hi;\n var lo = Math.clz32(Number(msb & 0xffffffffn));\n return 31 - lo;\n};\n/**\r\n * Returns the result of multiplying `frac` by 2 raised to the power of `exp`.\r\n */\nvar ldexp = function ldexp(frac, exp) {\n return frac * Math.pow(2, exp);\n};\n/**\r\n * Returns the binary exponent of the absolute value of x.\r\n * This is the exponent of the value when expressed as a normalized\r\n * floating-point number.\r\n *\r\n * - For a normal positive floating-point number x, Ilogb returns floor(log2(x)).\r\n * - For zero, it returns -Infinity.\r\n * - For infinity, it returns Infinity.\r\n * - For NaN, it returns NaN.\r\n */\nvar ilogb = function ilogb(x) {\n if (isNaN(x)) return NaN;\n if (x === 0) return -Infinity;\n if (!isFinite(x)) return Infinity;\n x = Math.abs(x);\n if (x < Number.MIN_VALUE) return -1074; // Special case for denormalized numbers\n return Math.floor(Math.log2(x));\n};\n\n/**\r\n * Angle represents a 1D angle. The internal representation is a double precision value in radians, so conversion to and from radians is exact.\r\n * Conversions between E5, E6, E7, and Degrees are not always exact.\r\n *\r\n * For example, Degrees(3.1) is different from E6(3100000) or E7(31000000).\r\n *\r\n * The following conversions between degrees and radians are exact:\r\n *\r\n * \t Degree*180 == Radian*Math.PI\r\n * \tDegree*(180/n) == Radian*(Math.PI/n) for n == 0..8\r\n *\r\n * These identities hold when the arguments are scaled up or down by any power of 2. Some similar identities are also true, for example,\r\n *\r\n * \tDegree*60 == Radian*(Math.PI/3)\r\n *\r\n * But be aware that this type of identity does not hold in general.\r\n * For example:\r\n *\r\n * \tDegree*3 != Radian*(Math.PI/60)\r\n *\r\n * Similarly, the conversion to radians means that (Angle(x)*Degree).Degrees() does not always equal x.\r\n * For example:\r\n *\r\n * \t(Angle(45*n)*Degree).Degrees() == 45*n for n == 0..8\r\n *\r\n * but\r\n *\r\n * \t(60*Degree).Degrees() != 60\r\n *\r\n * When testing for equality, you should allow for numerical errors (ApproxEqual)\r\n * or convert to discrete E5/E6/E7 values first.\r\n *\r\n * @module angle\r\n */\n/**\r\n * Returns the angle in radians.\r\n */\nvar radians = function radians(a) {\n return a;\n};\n/**\r\n * Returns the angle in degrees.\r\n */\nvar degrees = function degrees(a) {\n return a / DEGREE || 0;\n};\n/**\r\n * Returns the value rounded to nearest as an int32.\r\n * This does not match C++ exactly for the case of x.5.\r\n */\nvar round = function round(a) {\n return Math.round(a) || 0;\n};\n/** Returns an angle larger than any finite angle. */\nvar infAngle = function infAngle() {\n return Infinity;\n};\n/** Reports whether this Angle is infinite. */\nvar isInf = function isInf(a) {\n return a == Infinity;\n};\n/** Returns the angle in hundred thousandths of degrees. */\nvar e5 = function e5(a) {\n return round(degrees(a) * 1e5);\n};\n/** Returns the angle in millionths of degrees. */\nvar e6 = function e6(a) {\n return round(degrees(a) * 1e6);\n};\n/** Returns the angle in ten millionths of degrees. */\nvar e7 = function e7(a) {\n return round(degrees(a) * 1e7);\n};\n/** Returns the absolute value of the angle. */\nvar abs = function abs(a) {\n return Math.abs(a);\n};\n/** Returns an equivalent angle in (-π, π]. */\nvar normalized = function normalized(a) {\n var rad = remainder(a, 2 * Math.PI);\n if (rad <= -Math.PI) rad = Math.PI;\n return rad || 0;\n};\n/**\r\n * Generates a human readable string.\r\n */\nvar toString = function toString(a) {\n return degrees(a).toFixed(7);\n};\n/** Reports whether the two angles are the same up to a small tolerance. */\nvar approxEqual = function approxEqual(a, oa, epsilon) {\n if (epsilon === void 0) {\n epsilon = 1e-15;\n }\n return Math.abs(a - oa) <= epsilon;\n};\n\nvar angle = {\n __proto__: null,\n radians: radians,\n degrees: degrees,\n round: round,\n infAngle: infAngle,\n isInf: isInf,\n e5: e5,\n e6: e6,\n e7: e7,\n abs: abs,\n normalized: normalized,\n toString: toString,\n approxEqual: approxEqual\n};\n\n/**\r\n * Represents a zero angle.\r\n */\n/**\r\n * Represents a chord angle smaller than the zero angle.\r\n * The only valid operations on a NEGATIVE_CHORDANGLE are comparisons,\r\n * Angle conversions, and Successor/Predecessor.\r\n */\nvar NEGATIVE_CHORDANGLE = -1;\n/** Represents a chord angle of 90 degrees (a \"right angle\"). */\nvar RIGHT_CHORDANGLE = 2;\n/**\r\n * Represents a chord angle of 180 degrees (a \"straight angle\").\r\n * This is the maximum finite chord angle.\r\n */\nvar STRAIGHT_CHORDANGLE = 4;\n/** The square of the maximum length allowed in a ChordAngle. */\nvar MAX_LENGTH2 = 4.0;\n\nvar EPSILON = 1e-15;\nvar DBL_EPSILON = 2.220446049e-16;\n\n/**\r\n * ChordAngle represents the angle subtended by a chord (i.e., the straight line segment connecting two points on the sphere).\r\n * Its representation makes it very efficient for computing and comparing distances, but unlike Angle it is only capable of representing angles between 0 and π radians.\r\n * Generally, ChordAngle should only be used in loops where many angles need to be calculated and compared.\r\n * Otherwise it is simpler to use Angle.\r\n *\r\n * ChordAngle loses some accuracy as the angle approaches π radians.\r\n * There are several different ways to measure this error, including the representational error (i.e., how accurately ChordAngle can represent angles near π radians), the conversion error (i.e., how much precision is lost when an Angle is converted to an ChordAngle), and the measurement error (i.e., how accurate the ChordAngle(a, b) constructor is when the points A and B are separated by angles close to π radians).\r\n * All of these errors differ by a small constant factor.\r\n *\r\n * For the measurement error (which is the largest of these errors and also the most important in practice), let the angle between A and B be (π - x) radians, i.e. A and B are within \"x\" radians of being antipodal.\r\n * The corresponding chord length is:\r\n *\r\n * \tr = 2 * sin((π - x) / 2) = 2 * cos(x / 2)\r\n *\r\n * For values of x not close to π the relative error in the squared chord length is at most 4.5 * dblEpsilon (see MaxPointError below).\r\n * The relative error in \"r\" is thus at most 2.25 * dblEpsilon ~= 5e-16.\r\n * To convert this error into an equivalent angle, we have:\r\n *\r\n * \t|dr / dx| = sin(x / 2)\r\n *\r\n * and therefore:\r\n *\r\n * \t|dx| = dr / sin(x / 2)\r\n * \t = 5e-16 * (2 * cos(x / 2)) / sin(x / 2)\r\n * \t = 1e-15 / tan(x / 2)\r\n *\r\n * The maximum error is attained when:\r\n *\r\n * \tx = |dx|\r\n * \t = 1e-15 / tan(x / 2)\r\n * \t ~= 1e-15 / (x / 2)\r\n * \t ~= sqrt(2e-15)\r\n *\r\n * In summary, the measurement error for an angle (π - x) is at most:\r\n *\r\n * \tdx = min(1e-15 / tan(x / 2), sqrt(2e-15))\r\n * \t (~= min(2e-15 / x, sqrt(2e-15)) when x is small)\r\n *\r\n * On the Earth's surface (assuming a radius of 6371km), this corresponds to the following worst-case measurement errors:\r\n *\r\n * \tAccuracy: Unless antipodal to within:\r\n * \t--------- ---------------------------\r\n * \t6.4 nanometers 10,000 km (90 degrees)\r\n * \t1 micrometer 81.2 kilometers\r\n * \t1 millimeter 81.2 meters\r\n * \t1 centimeter 8.12 meters\r\n * \t28.5 centimeters 28.5 centimeters\r\n *\r\n * The representational and conversion errors referred to earlier are somewhat smaller than this.\r\n * For example, maximum distance between adjacent representable ChordAngle values is only 13.5 cm rather than 28.5 cm.\r\n * To see this, observe that the closest representable value to r^2 = 4 is r^2 = 4 * (1 - dblEpsilon / 2).\r\n * Thus r = 2 * (1 - dblEpsilon / 4) and the angle between these two representable values is:\r\n *\r\n * \tx = 2 * acos(r / 2)\r\n * \t = 2 * acos(1 - dblEpsilon / 4)\r\n * \t ~= 2 * asin(sqrt(dblEpsilon / 2)\r\n * \t ~= sqrt(2 * dblEpsilon)\r\n * \t ~= 2.1e-8\r\n *\r\n * which is 13.5 cm on the Earth's surface.\r\n *\r\n * The worst case rounding error occurs when the value halfway between these two representable values is rounded up to 4.\r\n * This halfway value is r^2 = (4 * (1 - dblEpsilon / 4)), thus r = 2 * (1 - dblEpsilon / 8) and the worst case rounding error is:\r\n *\r\n * \tx = 2 * acos(r / 2)\r\n * \t = 2 * acos(1 - dblEpsilon / 8)\r\n * \t ~= 2 * asin(sqrt(dblEpsilon / 4)\r\n * \t ~= sqrt(dblEpsilon)\r\n * \t ~= 1.5e-8\r\n *\r\n * which is 9.5 cm on the Earth's surface.\r\n *\r\n * @module chordangle\r\n */\n/**\r\n * Returns a ChordAngle from the given Angle.\r\n * @category Constructors\r\n * */\nvar fromAngle = function fromAngle(a) {\n if (a < 0) return NEGATIVE_CHORDANGLE;\n if (isInf(a)) return infChordAngle();\n var l = 2 * Math.sin(0.5 * Math.min(Math.PI, radians(a)));\n return l * l;\n};\n/**\r\n * Returns a ChordAngle from the squared chord length.\r\n * Note that the argument is automatically clamped to a maximum of 4 to handle possible roundoff errors.\r\n * The argument must be non-negative.\r\n * @category Constructors\r\n */\nvar fromSquaredLength = function fromSquaredLength(l) {\n return l > MAX_LENGTH2 ? STRAIGHT_CHORDANGLE : l;\n};\n/**\r\n * Returns a new ChordAngle that has been adjusted by the given error bound (which can be positive or negative).\r\n * Error should be the value returned by either MaxPointError or MaxAngleError. For example:\r\n *\r\n * let a = fromPoints(x, y)\r\n * let a1 = a.expanded(a.maxPointError())\r\n */\nvar expanded = function expanded(c, e) {\n // If the angle is special, don't change it.\n // Otherwise clamp it to the valid range.\n if (isSpecial(c)) return c;\n return Math.max(0.0, Math.min(MAX_LENGTH2, c + e));\n};\n/** Converts this chordangle to an angle. */\nvar angle$1 = function angle$1(c) {\n if (c < 0) return -1;\n if (isInfinity(c)) return infAngle();\n return 2 * Math.asin(0.5 * Math.sqrt(c));\n};\n/**\r\n * Returns a chord angle larger than any finite chord angle.\r\n * The only valid operations on an InfChordAngle are comparisons, Angle conversions, and Successor/Predecessor.\r\n */\nvar infChordAngle = function infChordAngle() {\n return Infinity;\n};\n/** Reports whether this chordangle is infinite. */\nvar isInfinity = function isInfinity(c) {\n return c == Infinity;\n};\n/** Reports whether this chordangle is one of the special cases. */\nvar isSpecial = function isSpecial(c) {\n return c < 0 || isInfinity(c);\n};\n/** Reports whether this chordangle is valid or not. */\nvar isValid = function isValid(c) {\n return c >= 0 && c <= MAX_LENGTH2 || isSpecial(c);\n};\n/**\r\n * Returns the smallest representable ChordAngle larger than this one.\r\n * This can be used to convert a \"<\" comparison to a \"<=\" comparison.\r\n *\r\n * Note the following special cases:\r\n *\r\n * \tNegativeChordAngle.Successor == 0\r\n * \tStraightChordAngle.Successor == InfChordAngle\r\n * \tInfChordAngle.Successor == InfChordAngle\r\n */\nvar successor = function successor(c) {\n if (c >= MAX_LENGTH2) return infChordAngle();\n if (c < 0) return 0;\n return nextAfter(c, 10.0);\n};\n/**\r\n * Returns the largest representable ChordAngle less than this one.\r\n *\r\n * Note the following special cases:\r\n *\r\n * \tInfChordAngle.Predecessor == StraightChordAngle\r\n * \tChordAngle(0).Predecessor == NegativeChordAngle\r\n * \tNegativeChordAngle.Predecessor == NegativeChordAngle\r\n */\nvar predecessor = function predecessor(c) {\n if (c <= 0) return NEGATIVE_CHORDANGLE;\n if (c > MAX_LENGTH2) return STRAIGHT_CHORDANGLE;\n return nextAfter(c, -10.0);\n};\n/**\r\n * Returns the maximum error size for a ChordAngle constructed from 2 Points x and y, assuming that x and y are normalized to within the bounds guaranteed by s2.Point.Normalize.\r\n * The error is defined with respect to the true distance after the points are projected to lie exactly on the sphere.\r\n */\nvar maxPointError = function maxPointError(c) {\n /**\r\n * There is a relative error of (2.5*dblEpsilon) when computing the squared\r\n * distance, plus a relative error of 2 * dblEpsilon, plus an absolute error\r\n * of (16 * dblEpsilon**2) because the lengths of the input points may differ\r\n * from 1 by up to (2*dblEpsilon) each. (This is the maximum error in Normalize).\r\n */\n return 4.5 * DBL_EPSILON * c + 16 * DBL_EPSILON * DBL_EPSILON;\n};\n/**\r\n * Returns the maximum error for a ChordAngle constructed as an Angle distance.\r\n */\nvar maxAngleError = function maxAngleError(c) {\n return DBL_EPSILON * c;\n};\n/**\r\n * Adds the other ChordAngle to this one and returns the resulting value.\r\n * This method assumes the ChordAngles are not special.\r\n */\nvar add = function add(c, oc) {\n // missinglink: use slower method which doesn't produce errors for input\n // such as (0.05641360112609339, 0.08434543246929838).\n // @todo: performance\n return fromAngle(angle$1(c) + angle$1(oc));\n};\n/**\r\n * Subtracts the other ChordAngle from this one and returns the resulting value.\r\n * This method assumes the ChordAngles are not special.\r\n */\nvar sub = function sub(c, oc) {\n if (oc == 0) return c;\n if (c <= oc) return 0;\n var x = c * (1 - 0.25 * oc);\n var y = oc * (1 - 0.25 * c);\n return Math.max(0.0, x + y - 2 * Math.sqrt(x * y));\n};\n/**\r\n * Returns the sine of this chord angle.\r\n * This method is more efficient than converting to Angle and performing the computation.\r\n */\nvar sin = function sin(c) {\n return Math.sqrt(sin2(c)) || 0;\n};\n/**\r\n * Returns the square of the sine of this chord angle.\r\n * It is more efficient than Sin.\r\n *\r\n * Let a be the (non-squared) chord length, and let A be the corresponding\r\n * half-angle (a = 2*sin(A)). The formula below can be derived from:\r\n * sin(2*A) = 2 * sin(A) * cos(A)\r\n * cos^2(A) = 1 - sin^2(A)\r\n * This is much faster than converting to an angle and computing its sine.\r\n */\nvar sin2 = function sin2(c) {\n return c * (1 - 0.25 * c) || 0;\n};\n/**\r\n * Returns the cosine of this chord angle.\r\n * This method is more efficient than converting to Angle and performing the computation.\r\n *\r\n * cos(2*A) = cos^2(A) - sin^2(A) = 1 - 2*sin^2(A)\r\n */\nvar cos = function cos(c) {\n return 1 - 0.5 * c || 0;\n};\n/** Returns the tangent of this chord angle. */\nvar tan = function tan(c) {\n return sin(c) / cos(c) || 0;\n};\n\nvar chordangle = {\n __proto__: null,\n fromAngle: fromAngle,\n fromSquaredLength: fromSquaredLength,\n expanded: expanded,\n angle: angle$1,\n infChordAngle: infChordAngle,\n isInfinity: isInfinity,\n isSpecial: isSpecial,\n isValid: isValid,\n successor: successor,\n predecessor: predecessor,\n maxPointError: maxPointError,\n maxAngleError: maxAngleError,\n add: add,\n sub: sub,\n sin: sin,\n sin2: sin2,\n cos: cos,\n tan: tan\n};\n\n/**\r\n * An Interval represents a closed interval on a unit circle (also known as a 1-dimensional sphere).\r\n * It is capable of representing the empty interval (containing no points), the full interval (containing all points), and zero-length intervals (containing a single point).\r\n *\r\n * Points are represented by the angle they make with the positive x-axis in the range [-π, π].\r\n * An interval is represented by its lower and upper bounds (both inclusive, since the interval is closed).\r\n * The lower bound may be greater than the upper bound, in which case the interval is \"inverted\" (i.e. it passes through the point (-1, 0)).\r\n *\r\n * The point (-1, 0) has two valid representations, π and -π.\r\n * The normalized representation of this point is π, so that endpoints of normal intervals are in the range (-π, π].\r\n * We normalize the latter to the former in intervalFromEndpoints.\r\n * However, we take advantage of the point -π to construct two special intervals:\r\n *\r\n * The full interval is [-π, π]\r\n * The empty interval is [π, -π].\r\n *\r\n * Treat the exported fields as read-only.\r\n */\nvar Interval$1 = /*#__PURE__*/function () {\n function Interval(lo, hi) {\n this.lo = lo;\n this.hi = hi;\n }\n /**\r\n * Constructs a new interval from endpoints.\r\n * Both arguments must be in the range [-π,π].\r\n * This function allows inverted intervals to be created.\r\n * @category Constructors\r\n */\n Interval.fromEndpoints = function fromEndpoints(lo, hi) {\n var i = new Interval(lo, hi);\n if (lo === -Math.PI && hi !== Math.PI) i.lo = Math.PI;\n if (hi === -Math.PI && lo !== Math.PI) i.hi = Math.PI;\n return i;\n }\n /**\r\n * Returns the minimal interval containing the two given points.\r\n * Both arguments must be in [-π,π].\r\n * @category Constructors\r\n */;\n Interval.fromPointPair = function fromPointPair(a, b) {\n if (a === -Math.PI) a = Math.PI;\n if (b === -Math.PI) b = Math.PI;\n if (Interval.positiveDistance(a, b) <= Math.PI) return new Interval(a, b);\n return new Interval(b, a);\n }\n /**\r\n * Returns an empty interval.\r\n * @category Constructors\r\n */;\n Interval.emptyInterval = function emptyInterval() {\n return new Interval(Math.PI, -Math.PI);\n }\n /**\r\n * Returns a full interval.\r\n * @category Constructors\r\n */;\n Interval.fullInterval = function fullInterval() {\n return new Interval(-Math.PI, Math.PI);\n }\n /**\r\n * Reports whether the interval is valid.\r\n */;\n var _proto = Interval.prototype;\n _proto.isValid = function isValid() {\n return Math.abs(this.lo) <= Math.PI && Math.abs(this.hi) <= Math.PI && !(this.lo === -Math.PI && this.hi !== Math.PI) && !(this.hi === -Math.PI && this.lo !== Math.PI);\n }\n /**\r\n * Reports whether the interval is full.\r\n */;\n _proto.isFull = function isFull() {\n return this.lo === -Math.PI && this.hi === Math.PI;\n }\n /**\r\n * Reports whether the interval is empty.\r\n */;\n _proto.isEmpty = function isEmpty() {\n return this.lo === Math.PI && this.hi === -Math.PI;\n }\n /**\r\n * Reports whether the interval is inverted; that is, whether lo > hi.\r\n */;\n _proto.isInverted = function isInverted() {\n return this.lo > this.hi;\n }\n /**\r\n * Returns true iff the interval equals oi.\r\n */;\n _proto.equals = function equals(oi) {\n return this.lo == oi.lo && this.hi == oi.hi || this.isEmpty() && oi.isEmpty();\n }\n /**\r\n * Returns the interval with endpoints swapped.\r\n */;\n _proto.invert = function invert() {\n return new Interval(this.hi, this.lo);\n }\n /**\r\n * Returns the midpoint of the interval.\r\n * It is undefined for full and empty intervals.\r\n */;\n _proto.center = function center() {\n var c = 0.5 * (this.lo + this.hi);\n if (!this.isInverted()) return c;\n if (c <= 0) return c + Math.PI;\n return c - Math.PI;\n }\n /**\r\n * Returns the length of the interval.\r\n * The length of an empty interval is negative.\r\n */;\n _proto.length = function length() {\n var l = this.hi - this.lo;\n if (l >= 0) return l;\n l += 2 * Math.PI;\n if (l > 0) return l;\n return -1;\n }\n /**\r\n * Assumes p ∈ (-π,π].\r\n */;\n _proto.fastContains = function fastContains(p) {\n if (this.isInverted()) return (p >= this.lo || p <= this.hi) && !this.isEmpty();\n return p >= this.lo && p <= this.hi;\n }\n /**\r\n * Returns true iff the interval contains p.\r\n * Assumes p ∈ [-π,π].\r\n */;\n _proto.contains = function contains(p) {\n if (p === -Math.PI) p = Math.PI;\n return this.fastContains(p);\n }\n /**\r\n * Returns true iff the interval contains oi.\r\n */;\n _proto.containsInterval = function containsInterval(oi) {\n if (this.isInverted()) {\n if (oi.isInverted()) return oi.lo >= this.lo && oi.hi <= this.hi;\n return (oi.lo >= this.lo || oi.hi <= this.hi) && !this.isEmpty();\n }\n if (oi.isInverted()) return this.isFull() || oi.isEmpty();\n return oi.lo >= this.lo && oi.hi <= this.hi;\n }\n /**\r\n * Returns true iff the interior of the interval contains p.\r\n * Assumes p ∈ [-π,π].\r\n */;\n _proto.interiorContains = function interiorContains(p) {\n if (p === -Math.PI) p = Math.PI;\n if (this.isInverted()) return p > this.lo || p < this.hi;\n return p > this.lo && p < this.hi || this.isFull();\n }\n /**\r\n * Returns true iff the interior of the interval contains oi.\r\n */;\n _proto.interiorContainsInterval = function interiorContainsInterval(oi) {\n if (this.isInverted()) {\n if (oi.isInverted()) return oi.lo > this.lo && oi.hi < this.hi || oi.isEmpty();\n return oi.lo > this.lo || oi.hi < this.hi;\n }\n if (oi.isInverted()) return this.isFull() || oi.isEmpty();\n return oi.lo > this.lo && oi.hi < this.hi || this.isFull();\n }\n /**\r\n * Returns true iff the interval contains any points in common with oi.\r\n */;\n _proto.intersects = function intersects(oi) {\n if (this.isEmpty() || oi.isEmpty()) return false;\n if (this.isInverted()) return oi.isInverted() || oi.lo <= this.hi || oi.hi >= this.lo;\n if (oi.isInverted()) return oi.lo <= this.hi || oi.hi >= this.lo;\n return oi.lo <= this.hi && oi.hi >= this.lo;\n }\n /**\r\n * Returns true iff the interior of the interval contains any points in common with oi, including the latter's boundary.\r\n */;\n _proto.interiorIntersects = function interiorIntersects(oi) {\n if (this.isEmpty() || oi.isEmpty() || this.lo === this.hi) return false;\n if (this.isInverted()) return oi.isInverted() || oi.lo < this.hi || oi.hi > this.lo;\n if (oi.isInverted()) return oi.lo < this.hi || oi.hi > this.lo;\n return oi.lo < this.hi && oi.hi > this.lo || this.isFull();\n }\n /**\r\n * Compute distance from a to b in [0,2π], in a numerically stable way.\r\n */;\n Interval.positiveDistance = function positiveDistance(a, b) {\n var d = b - a;\n if (d >= 0) return d;\n return b + Math.PI - (a - Math.PI);\n }\n /**\r\n * Returns the smallest interval that contains both the interval and oi.\r\n */;\n _proto.union = function union(oi) {\n if (oi.isEmpty()) return this;\n if (this.fastContains(oi.lo)) {\n if (this.fastContains(oi.hi)) {\n if (this.containsInterval(oi)) return this;\n return Interval.fullInterval();\n }\n return new Interval(this.lo, oi.hi);\n }\n if (this.fastContains(oi.hi)) return new Interval(oi.lo, this.hi);\n if (this.isEmpty() || oi.fastContains(this.lo)) return oi;\n if (Interval.positiveDistance(oi.hi, this.lo) < Interval.positiveDistance(this.hi, oi.lo)) return new Interval(oi.lo, this.hi);\n return new Interval(this.lo, oi.hi);\n }\n /**\r\n * Returns the smallest interval that contains the intersection of the interval and oi.\r\n */;\n _proto.intersection = function intersection(oi) {\n if (oi.isEmpty()) return Interval.emptyInterval();\n if (this.fastContains(oi.lo)) {\n if (this.fastContains(oi.hi)) {\n if (oi.length() < this.length()) return oi;\n return this;\n }\n return new Interval(oi.lo, this.hi);\n }\n if (this.fastContains(oi.hi)) return new Interval(this.lo, oi.hi);\n if (oi.fastContains(this.lo)) return this;\n return Interval.emptyInterval();\n }\n /**\r\n * Returns the interval expanded by the minimum amount necessary such\r\n * that it contains the given point \"p\" (an angle in the range [-π, π]).\r\n */;\n _proto.addPoint = function addPoint(p) {\n if (Math.abs(p) > Math.PI) return this;\n if (p === -Math.PI) p = Math.PI;\n if (this.fastContains(p)) return this;\n if (this.isEmpty()) return new Interval(p, p);\n if (Interval.positiveDistance(p, this.lo) < Interval.positiveDistance(this.hi, p)) return new Interval(p, this.hi);\n return new Interval(this.lo, p);\n }\n /**\r\n * Expanded returns an interval that has been expanded on each side by margin.\r\n * If margin is negative, then the function shrinks the interval on\r\n * each side by margin instead. The resulting interval may be empty or\r\n * full. Any expansion (positive or negative) of a full interval remains\r\n * full, and any expansion of an empty interval remains empty.\r\n */;\n _proto.expanded = function expanded(margin) {\n if (margin >= 0) {\n if (this.isEmpty()) return this;\n if (this.length() + 2 * margin + 2 * DBL_EPSILON >= 2 * Math.PI) return Interval.fullInterval();\n } else {\n if (this.isFull()) return this;\n if (this.length() + 2 * margin - 2 * DBL_EPSILON <= 0) return Interval.emptyInterval();\n }\n var result = Interval.fromEndpoints(remainder(this.lo - margin, 2 * Math.PI), remainder(this.hi + margin, 2 * Math.PI));\n if (result.lo <= -Math.PI) result.lo = Math.PI;\n return result;\n }\n /**\r\n * ApproxEqual reports whether this interval can be transformed into the given\r\n * interval by moving each endpoint by at most ε, without the\r\n * endpoints crossing (which would invert the interval). Empty and full\r\n * intervals are considered to start at an arbitrary point on the unit circle,\r\n * so any interval with (length <= 2*ε) matches the empty interval, and\r\n * any interval with (length >= 2*π - 2*ε) matches the full interval.\r\n */;\n _proto.approxEqual = function approxEqual(other) {\n if (this.isEmpty()) return other.length() <= 2 * EPSILON;\n if (other.isEmpty()) return this.length() <= 2 * EPSILON;\n if (this.isFull()) return other.length() >= 2 * (Math.PI - EPSILON);\n if (other.isFull()) return this.length() >= 2 * (Math.PI - EPSILON);\n return Math.abs(remainder(other.lo - this.lo, 2 * Math.PI)) <= EPSILON && Math.abs(remainder(other.hi - this.hi, 2 * Math.PI)) <= EPSILON && Math.abs(this.length() - other.length()) <= 2 * EPSILON;\n };\n _proto.toString = function toString() {\n return \"[\" + this.lo.toFixed(7) + \", \" + this.hi.toFixed(7) + \"]\";\n }\n /**\r\n * Complement returns the complement of the interior of the interval. An interval and\r\n * its complement have the same boundary but do not share any interior\r\n * values. The complement operator is not a bijection, since the complement\r\n * of a singleton interval (containing a single value) is the same as the\r\n * complement of an empty interval.\r\n */;\n _proto.complement = function complement() {\n if (this.lo === this.hi) return Interval.fullInterval();\n return new Interval(this.hi, this.lo);\n }\n /**\r\n * ComplementCenter returns the midpoint of the complement of the interval. For full and empty\r\n * intervals, the result is arbitrary. For a singleton interval (containing a\r\n * single point), the result is its antipodal point on S1.\r\n */;\n _proto.complementCenter = function complementCenter() {\n if (this.lo !== this.hi) return this.complement().center();\n if (this.hi <= 0) return this.hi + Math.PI;\n return this.hi - Math.PI;\n }\n /**\r\n * DirectedHausdorffDistance returns the Hausdorff distance to the given interval.\r\n * For two intervals i and y, this distance is defined by\r\n *\r\n * h(i, y) = max_{p in i} min_{q in y} d(p, q),\r\n *\r\n * where d(.,.) is measured along S1.\r\n */;\n _proto.directedHausdorffDistance = function directedHausdorffDistance(y) {\n if (y.containsInterval(this)) return 0;\n if (y.isEmpty()) return Math.PI;\n var yComplementCenter = y.complementCenter();\n if (this.contains(yComplementCenter)) return Interval.positiveDistance(y.hi, yComplementCenter);\n var hiHi = 0.0;\n if (Interval.fromEndpoints(y.hi, yComplementCenter).contains(this.hi)) {\n hiHi = Interval.positiveDistance(y.hi, this.hi);\n }\n var loLo = 0.0;\n if (Interval.fromEndpoints(yComplementCenter, y.lo).contains(this.lo)) {\n loLo = Interval.positiveDistance(this.lo, y.lo);\n }\n return Math.max(hiHi, loLo);\n }\n /**\r\n * Project returns the closest point in the interval to the given point p.\r\n * The interval must be non-empty.\r\n */;\n _proto.project = function project(p) {\n if (p === -Math.PI) p = Math.PI;\n if (this.fastContains(p)) return p;\n var dlo = Interval.positiveDistance(p, this.lo);\n var dhi = Interval.positiveDistance(this.hi, p);\n if (dlo < dhi) return this.lo;\n return this.hi;\n };\n return Interval;\n}();\n\n/**\r\n * Module s1 implements types and functions for working with geometry in S¹ (circular geometry).\r\n * @module s1\r\n */\n\nvar _index$3 = {\n __proto__: null,\n angle: angle,\n chordangle: chordangle,\n Interval: Interval$1\n};\n\nvar LOOKUP_BITS = 4;\nvar SWAP_MASK = 0x01;\nvar INVERT_MASK = 0x02;\nvar ijToPos = [[0, 1, 3, 2], [0, 3, 1, 2], [2, 3, 1, 0], [2, 1, 3, 0] // swapped & inverted\n];\nvar posToIJ = [[0, 1, 3, 2], [0, 2, 3, 1], [3, 2, 0, 1], [3, 1, 0, 2] // swapped & inverted: (1,1), (0,1), (0,0), (1,0)\n];\nvar posToOrientation = [SWAP_MASK, 0, 0, INVERT_MASK | SWAP_MASK];\nvar lookupIJ = [];\nvar lookupPos = [];\ninitLookupCell(0, 0, 0, 0, 0, 0);\ninitLookupCell(0, 0, 0, SWAP_MASK, 0, SWAP_MASK);\ninitLookupCell(0, 0, 0, INVERT_MASK, 0, INVERT_MASK);\ninitLookupCell(0, 0, 0, SWAP_MASK | INVERT_MASK, 0, SWAP_MASK | INVERT_MASK);\n// initLookupCell initializes the lookupIJ lookupIJ at init time.\nfunction initLookupCell(level, i, j, origOrientation, pos, orientation) {\n if (level == LOOKUP_BITS) {\n var ij = (i << LOOKUP_BITS) + j;\n lookupPos[(ij << 2) + origOrientation] = (pos << 2) + orientation;\n lookupIJ[(pos << 2) + origOrientation] = (ij << 2) + orientation;\n return;\n }\n level++;\n i <<= 1;\n j <<= 1;\n pos <<= 2;\n var r = posToIJ[orientation];\n initLookupCell(level, i + (r[0] >> 1), j + (r[0] & 1), origOrientation, pos, orientation ^ posToOrientation[0]);\n initLookupCell(level, i + (r[1] >> 1), j + (r[1] & 1), origOrientation, pos + 1, orientation ^ posToOrientation[1]);\n initLookupCell(level, i + (r[2] >> 1), j + (r[2] & 1), origOrientation, pos + 2, orientation ^ posToOrientation[2]);\n initLookupCell(level, i + (r[3] >> 1), j + (r[3] & 1), origOrientation, pos + 3, orientation ^ posToOrientation[3]);\n}\n\n/**\r\n * Number of bits used to encode the face number\r\n **/\nvar FACE_BITS = 3;\n/**\r\n * Number of faces\r\n */\nvar NUM_FACES = 6;\n/**\r\n * Number of levels needed to specify a leaf cell\r\n */\nvar MAX_LEVEL = 30;\n/**\r\n * Total number of position bits.\r\n * The extra bit (61 rather than 60) lets us encode each cell as its Hilbert curve position at the cell center (which is halfway along the portion of the Hilbert curve that fills that cell).\r\n */\nvar POS_BITS = 2 * MAX_LEVEL + 1;\n/**\r\n * MaxSize is the maximum index of a valid leaf cell plus one. The range of\r\n * valid leaf cell indices is [0..MaxSize-1].\r\n */\nvar MAX_SIZE = /*#__PURE__*/Number(1n << /*#__PURE__*/BigInt(MAX_LEVEL));\n//\nvar WRAP_OFFSET = /*#__PURE__*/BigInt(NUM_FACES) << /*#__PURE__*/BigInt(POS_BITS);\n\n/**\r\n * This file contains documentation of the various coordinate systems used throughout the library.\r\n * Most importantly, S2 defines a framework for decomposing the unit sphere into a hierarchy of \"cells\".\r\n * Each cell is a quadrilateral bounded by four geodesics.\r\n * The top level of the hierarchy is obtained by projecting the six faces of a cube onto the unit sphere, and lower levels are obtained by subdividing each cell into four children recursively.\r\n * Cells are numbered such that sequentially increasing cells follow a continuous space-filling curve over the entire sphere.\r\n * The transformation is designed to make the cells at each level fairly uniform in size.\r\n */\n/**\r\n * S2 Cell Decomposition\r\n *\r\n * The following methods define the cube-to-sphere projection used by\r\n * the Cell decomposition.\r\n *\r\n * In the process of converting a latitude-longitude pair to a 64-bit cell\r\n * id, the following coordinate systems are used:\r\n *\r\n * (id)\r\n * An CellID is a 64-bit encoding of a face and a Hilbert curve position\r\n * on that face. The Hilbert curve position implicitly encodes both the\r\n * position of a cell and its subdivision level (see s2cellid.go).\r\n *\r\n * (face, i, j)\r\n * Leaf-cell coordinates. \"i\" and \"j\" are integers in the range\r\n * [0,(2**30)-1] that identify a particular leaf cell on the given face.\r\n * The (i, j) coordinate system is right-handed on each face, and the\r\n * faces are oriented such that Hilbert curves connect continuously from\r\n * one face to the next.\r\n *\r\n * (face, s, t)\r\n * Cell-space coordinates. \"s\" and \"t\" are real numbers in the range\r\n * [0,1] that identify a point on the given face. For example, the point\r\n * (s, t) = (0.5, 0.5) corresponds to the center of the top-level face\r\n * cell. This point is also a vertex of exactly four cells at each\r\n * subdivision level greater than zero.\r\n *\r\n * (face, si, ti)\r\n * Discrete cell-space coordinates. These are obtained by multiplying\r\n * \"s\" and \"t\" by 2**31 and rounding to the nearest unsigned integer.\r\n * Discrete coordinates lie in the range [0,2**31]. This coordinate\r\n * system can represent the edge and center positions of all cells with\r\n * no loss of precision (including non-leaf cells). In binary, each\r\n * coordinate of a level-k cell center ends with a 1 followed by\r\n * (30 - k) 0s. The coordinates of its edges end with (at least)\r\n * (31 - k) 0s.\r\n *\r\n * (face, u, v)\r\n * Cube-space coordinates in the range [-1,1]. To make the cells at each\r\n * level more uniform in size after they are projected onto the sphere,\r\n * we apply a nonlinear transformation of the form u=f(s), v=f(t).\r\n * The (u, v) coordinates after this transformation give the actual\r\n * coordinates on the cube face (modulo some 90 degree rotations) before\r\n * it is projected onto the unit sphere.\r\n *\r\n * (face, u, v, w)\r\n * Per-face coordinate frame. This is an extension of the (face, u, v)\r\n * cube-space coordinates that adds a third axis \"w\" in the direction of\r\n * the face normal. It is always a right-handed 3D coordinate system.\r\n * Cube-space coordinates can be converted to this frame by setting w=1,\r\n * while (u,v,w) coordinates can be projected onto the cube face by\r\n * dividing by w, i.e. (face, u/w, v/w).\r\n *\r\n * (x, y, z)\r\n * Direction vector (Point). Direction vectors are not necessarily unit\r\n * length, and are often chosen to be points on the biunit cube\r\n * [-1,+1]x[-1,+1]x[-1,+1]. They can be be normalized to obtain the\r\n * corresponding point on the unit sphere.\r\n *\r\n * (lat, lng)\r\n * Latitude and longitude (LatLng). Latitudes must be between -90 and\r\n * 90 degrees inclusive, and longitudes must be between -180 and 180\r\n * degrees inclusive.\r\n *\r\n * Note that the (i, j), (s, t), (si, ti), and (u, v) coordinate systems are\r\n * right-handed on all six faces.\r\n *\r\n *\r\n * There are a number of different projections from cell-space (s,t) to\r\n * cube-space (u,v): linear, quadratic, and tangent. They have the following\r\n * tradeoffs:\r\n *\r\n * Linear - This is the fastest transformation, but also produces the least\r\n * uniform cell sizes. Cell areas vary by a factor of about 5.2, with the\r\n * largest cells at the center of each face and the smallest cells in\r\n * the corners.\r\n *\r\n * Tangent - Transforming the coordinates via Atan makes the cell sizes\r\n * more uniform. The areas vary by a maximum ratio of 1.4 as opposed to a\r\n * maximum ratio of 5.2. However, each call to Atan is about as expensive\r\n * as all of the other calculations combined when converting from points to\r\n * cell ids, i.e. it reduces performance by a factor of 3.\r\n *\r\n * Quadratic - This is an approximation of the tangent projection that\r\n * is much faster and produces cells that are almost as uniform in size.\r\n * It is about 3 times faster than the tangent projection for converting\r\n * cell ids to points or vice versa. Cell areas vary by a maximum ratio of\r\n * about 2.1.\r\n *\r\n * Here is a table comparing the cell uniformity using each projection. Area\r\n * Ratio is the maximum ratio over all subdivision levels of the largest cell\r\n * area to the smallest cell area at that level, Edge Ratio is the maximum\r\n * ratio of the longest edge of any cell to the shortest edge of any cell at\r\n * the same level, and Diag Ratio is the ratio of the longest diagonal of\r\n * any cell to the shortest diagonal of any cell at the same level.\r\n *\r\n * Area Edge Diag\r\n * Ratio Ratio Ratio\r\n * -----------------------------------\r\n * Linear: 5.200 2.117 2.959\r\n * Tangent: 1.414 1.414 1.704\r\n * Quadratic: 2.082 1.802 1.932\r\n *\r\n * The worst-case cell aspect ratios are about the same with all three\r\n * projections. The maximum ratio of the longest edge to the shortest edge\r\n * within the same cell is about 1.4 and the maximum ratio of the diagonals\r\n * within the same cell is about 1.7.\r\n *\r\n * For Go we have chosen to use only the Quadratic approach. Other language\r\n * implementations may offer other choices.\r\n */\n/**\r\n * The maximum value of an si- or ti-coordinate.\r\n * It is one shift more than MaxSize.\r\n * The range of valid (si,ti) values is [0..maxSiTi].\r\n */\nvar MAX_SiTi = /*#__PURE__*/Number(/*#__PURE__*/BigInt(MAX_SIZE) << 1n);\n/**\r\n * Converts an si- or ti-value to the corresponding s- or t-value.\r\n * Value is capped at 1.0 because there is no DCHECK in JavaScript.\r\n */\nvar siTiToST = function siTiToST(si) {\n if (si > MAX_SiTi) return 1.0;\n return si / MAX_SiTi;\n};\n/**\r\n * Converts an s or t value to the corresponding u or v value.\r\n * This is a non-linear transformation from [-1,1] to [-1,1] that\r\n * attempts to make the cell sizes more uniform.\r\n * This uses what the C++ version calls 'the quadratic transform'.\r\n */\nvar stToUV = function stToUV(s) {\n if (s >= 0.5) return 1 / 3 * (4 * s * s - 1);\n return 1 / 3 * (1 - 4 * (1 - s) * (1 - s));\n};\n/**\r\n * Inverse of the stToUV transformation. Note that it\r\n * is not always true that uvToST(stToUV(x)) == x due to numerical errors.\r\n */\nvar uvToST = function uvToST(u) {\n if (u >= 0) return 0.5 * Math.sqrt(1 + 3 * u);\n return 1 - 0.5 * Math.sqrt(1 - 3 * u);\n};\n/**\r\n * Returns face ID from 0 to 5 containing the r. For points on the\r\n * boundary between faces, the result is arbitrary but deterministic.\r\n */\nvar face = function face(v) {\n var f = v.largestComponent();\n switch (f) {\n case Vector.X_AXIS:\n if (v.x < 0) f += 3;\n break;\n case Vector.Y_AXIS:\n if (v.y < 0) f += 3;\n break;\n case Vector.Z_AXIS:\n if (v.z < 0) f += 3;\n break;\n }\n return f;\n};\n/**\r\n * Given a valid face for the given point r (meaning that dot product of r with the face normal is positive),\r\n * returns the corresponding u and v values, which may lie outside the range [-1,1].\r\n */\nvar validFaceXYZToUV = function validFaceXYZToUV(face, r) {\n switch (face) {\n case 0:\n return [r.y / r.x, r.z / r.x];\n case 1:\n return [-r.x / r.y, r.z / r.y];\n case 2:\n return [-r.x / r.z, -r.y / r.z];\n case 3:\n return [r.z / r.x, r.y / r.x];\n case 4:\n return [r.z / r.y, -r.x / r.y];\n default:\n return [-r.y / r.z, -r.x / r.z];\n }\n};\n/**\r\n * Converts a direction vector (not necessarily unit length) to (face, u, v) coordinates.\r\n */\nvar xyzToFaceUV = function xyzToFaceUV(r) {\n var f = face(r);\n var _validFaceXYZToUV = validFaceXYZToUV(f, r),\n u = _validFaceXYZToUV[0],\n v = _validFaceXYZToUV[1];\n return [f, u, v];\n};\n/**\r\n * Turns face and UV coordinates into an unnormalized 3 vector.\r\n */\nvar faceUVToXYZ = function faceUVToXYZ(face, u, v) {\n switch (face) {\n case 0:\n return new Vector(1, u, v);\n case 1:\n return new Vector(-u, 1, v);\n case 2:\n return new Vector(-u, -v, 1);\n case 3:\n return new Vector(-1, -v, -u);\n case 4:\n return new Vector(v, -1, -u);\n default:\n return new Vector(v, u, -1);\n }\n};\n/**\r\n * Returns the u and v values (which may lie outside the range [-1, 1]).\r\n * If the dot product of the point p with the given face normal is positive.\r\n */\nvar faceXYZToUV = function faceXYZToUV(face, vect) {\n switch (face) {\n case 0:\n if (vect.x <= 0) return [0, 0, false];\n break;\n case 1:\n if (vect.y <= 0) return [0, 0, false];\n break;\n case 2:\n if (vect.z <= 0) return [0, 0, false];\n break;\n case 3:\n if (vect.x >= 0) return [0, 0, false];\n break;\n case 4:\n if (vect.y >= 0) return [0, 0, false];\n break;\n default:\n if (vect.z >= 0) return [0, 0, false];\n break;\n }\n var _validFaceXYZToUV2 = validFaceXYZToUV(face, vect),\n u = _validFaceXYZToUV2[0],\n v = _validFaceXYZToUV2[1];\n return [u, v, true];\n};\n/**\r\n * Transforms the given point P to the (u,v,w) coordinate frame of the given face where the w-axis represents the face normal.\r\n */\nvar faceXYZtoUVW = function faceXYZtoUVW(face, v) {\n // The result coordinates are simply the dot products of P with the (u,v,w)\n // axes for the given face (see faceUVWAxes).\n switch (face) {\n case 0:\n return new Vector(v.y, v.z, v.x);\n case 1:\n return new Vector(-v.x, v.z, v.y);\n case 2:\n return new Vector(-v.x, -v.y, v.z);\n case 3:\n return new Vector(-v.z, -v.y, -v.x);\n case 4:\n return new Vector(-v.z, v.x, -v.y);\n default:\n return new Vector(v.y, v.x, -v.z);\n }\n};\n/**\r\n * Transforms the (si, ti) coordinates to a (not necessarily unit length) Point on the given face.\r\n */\nvar faceSiTiToXYZ = function faceSiTiToXYZ(face, si, ti) {\n return faceUVToXYZ(face, stToUV(siTiToST(si)), stToUV(siTiToST(ti)));\n};\n/**\r\n * Returns the right-handed normal (not necessarily unit length) for an\r\n * edge in the direction of the positive v-axis at the given u-value on\r\n * the given face. (This vector is perpendicular to the plane through\r\n * the sphere origin that contains the given edge.)\r\n */\nvar uNorm = function uNorm(face, u) {\n switch (face) {\n case 0:\n return new Vector(u, -1, 0);\n case 1:\n return new Vector(1, u, 0);\n case 2:\n return new Vector(1, 0, u);\n case 3:\n return new Vector(-u, 0, 1);\n case 4:\n return new Vector(0, -u, 1);\n default:\n return new Vector(0, -1, -u);\n }\n};\n/**\r\n * Returns the right-handed normal (not necessarily unit length) for an\r\n * edge in the direction of the positive u-axis at the given v-value on\r\n * the given face.\r\n */\nvar vNorm = function vNorm(face, v) {\n switch (face) {\n case 0:\n return new Vector(-v, 0, 1);\n case 1:\n return new Vector(0, -v, 1);\n case 2:\n return new Vector(0, -1, -v);\n case 3:\n return new Vector(v, -1, 0);\n case 4:\n return new Vector(1, v, 0);\n default:\n return new Vector(1, 0, v);\n }\n};\n/** The U, V, and W axes for each face. */\nvar faceUVWAxes = [[/*#__PURE__*/new Vector(0, 1, 0), /*#__PURE__*/new Vector(0, 0, 1), /*#__PURE__*/new Vector(1, 0, 0)], [/*#__PURE__*/new Vector(-1, 0, 0), /*#__PURE__*/new Vector(0, 0, 1), /*#__PURE__*/new Vector(0, 1, 0)], [/*#__PURE__*/new Vector(-1, 0, 0), /*#__PURE__*/new Vector(0, -1, 0), /*#__PURE__*/new Vector(0, 0, 1)], [/*#__PURE__*/new Vector(0, 0, -1), /*#__PURE__*/new Vector(0, -1, 0), /*#__PURE__*/new Vector(-1, 0, 0)], [/*#__PURE__*/new Vector(0, 0, -1), /*#__PURE__*/new Vector(1, 0, 0), /*#__PURE__*/new Vector(0, -1, 0)], [/*#__PURE__*/new Vector(0, 1, 0), /*#__PURE__*/new Vector(1, 0, 0), /*#__PURE__*/new Vector(0, 0, -1)]];\n/** The precomputed neighbors of each face. */\nvar faceUVWFaces = [[[4, 1], [5, 2], [3, 0]], [[0, 3], [5, 2], [4, 1]], [[0, 3], [1, 4], [5, 2]], [[2, 5], [1, 4], [0, 3]], [[2, 5], [3, 0], [1, 4]], [[4, 1], [3, 0], [2, 5]]];\n/**\r\n * Returns the given axis of the given face.\r\n */\nvar uvwAxis = function uvwAxis(face, axis) {\n return faceUVWAxes[face][axis];\n};\n/**\r\n * Returns the face in the (u,v,w) coordinate system on the given axis in the given direction.\r\n */\nvar uvwFace = function uvwFace(face, axis, direction) {\n return faceUVWFaces[face][axis][direction];\n};\n/**\r\n * Returns the u-axis for the given face.\r\n */\nvar uAxis = function uAxis(face) {\n return uvwAxis(face, 0);\n};\n/**\r\n * Returns the v-axis for the given face.\r\n */\nvar vAxis = function vAxis(face) {\n return uvwAxis(face, 1);\n};\n\nvar NORTH_POLE_LAT = Math.PI / 2;\nvar SOUTH_POLE_LAT = -NORTH_POLE_LAT;\n/**\r\n * Represents a point on the unit sphere as a pair of angles.\r\n */\nvar LatLng = /*#__PURE__*/function () {\n /**\r\n * Returns a new LatLng.\r\n * @category Constructors\r\n */\n function LatLng(lat, lng) {\n this.lat = lat;\n this.lng = lng;\n }\n /**\r\n * Returns a LatLng for the coordinates given in degrees.\r\n * @category Constructors\r\n */\n LatLng.fromDegrees = function fromDegrees(lat, lng) {\n return new LatLng(lat * DEGREE, lng * DEGREE);\n }\n /**\r\n * Returns the latitude of the given point.\r\n */;\n LatLng.latitude = function latitude(p) {\n var v = p.vector;\n return Math.atan2(v.z, Math.sqrt(v.x * v.x + v.y * v.y));\n }\n /**\r\n * Returns the longitude of the given point.\r\n */;\n LatLng.longitude = function longitude(p) {\n return Math.atan2(p.vector.y, p.vector.x);\n }\n /**\r\n * Returns a LatLng for a given Point.\r\n * @category Constructors\r\n */;\n LatLng.fromPoint = function fromPoint(p) {\n return new LatLng(this.latitude(p), this.longitude(p));\n }\n /**\r\n * Returns true if and only if the LatLng is normalized,\r\n * with lat ∈ [-π/2,π/2] and lng ∈ [-π,π].\r\n */;\n var _proto = LatLng.prototype;\n _proto.isValid = function isValid() {\n return Math.abs(this.lat) <= Math.PI / 2 && Math.abs(this.lng) <= Math.PI;\n }\n /**\r\n * Returns the normalized version of the LatLng,\r\n * with lat clamped to [-π/2,π/2] and lng wrapped in [-π,π].\r\n */;\n _proto.normalized = function normalized() {\n var lat = this.lat;\n if (lat > NORTH_POLE_LAT) lat = NORTH_POLE_LAT;else if (lat < SOUTH_POLE_LAT) lat = SOUTH_POLE_LAT;\n var lng = remainder(this.lng, 2 * Math.PI);\n return new LatLng(lat, lng);\n }\n /**\r\n * Returns the string representation of the LatLng.\r\n */;\n _proto.toString = function toString$1() {\n return \"[\" + toString(this.lat) + \", \" + toString(this.lng) + \"]\";\n }\n /**\r\n * Returns the angle between two LatLngs.\r\n */;\n _proto.distance = function distance(oll) {\n var dlat = Math.sin(0.5 * (oll.lat - this.lat));\n var dlng = Math.sin(0.5 * (oll.lng - this.lng));\n var x = dlat * dlat + dlng * dlng * Math.cos(this.lat) * Math.cos(oll.lat);\n return 2 * Math.atan2(Math.sqrt(x), Math.sqrt(Math.max(0, 1 - x)));\n }\n /**\r\n * Reports whether the latitude and longitude of the two LatLngs\r\n * are the same up to a small tolerance.\r\n */;\n _proto.approxEqual = function approxEqual$1(oll) {\n return approxEqual(this.lat, oll.lat) && approxEqual(this.lng, oll.lng);\n };\n return LatLng;\n}();\n\n/**\r\n * Returns the given column as a Point.\r\n */\nvar col = function col(m, _col) {\n return new Point$1(m[0][_col], m[1][_col], m[2][_col]);\n};\n/**\r\n * Sets the specified column to the value in the given Point.\r\n */\nvar setCol = function setCol(m, col, p) {\n m[0][col] = p.x;\n m[1][col] = p.y;\n m[2][col] = p.z;\n return m;\n};\n/**\r\n * Returns the multiplication of m by the Point p and converts the\r\n * resulting 1x3 matrix into a Point.\r\n */\nvar mul = function mul(m, p) {\n return new Point$1(m[0][0] * p.x + m[0][1] * p.y + m[0][2] * p.z, m[1][0] * p.x + m[1][1] * p.y + m[1][2] * p.z, m[2][0] * p.x + m[2][1] * p.y + m[2][2] * p.z);\n};\n/**\r\n * Reflects the matrix along its diagonal and returns the result.\r\n */\nvar transpose = function transpose(m) {\n return [[m[0][0], m[1][0], m[2][0]], [m[0][1], m[1][1], m[2][1]], [m[0][2], m[1][2], m[2][2]]];\n};\n/**\r\n * Returns the orthonormal frame for the given point on the unit sphere.\r\n */\nvar getFrame = function getFrame(p) {\n // Given the point p on the unit sphere, extend this into a right-handed\n // coordinate frame of unit-length column vectors m = (x,y,z). Note that\n // the vectors (x,y) are an orthonormal frame for the tangent space at point p,\n // while p itself is an orthonormal frame for the normal space at p.\n var m = [[0, 0, 0], [0, 0, 0], [0, 0, 0]];\n setCol(m, 2, p);\n setCol(m, 1, Point$1.ortho(p));\n setCol(m, 0, Point$1.fromVector(col(m, 1).vector.cross(p.vector)));\n return m;\n};\n/**\r\n * Returns the coordinates of the given point with respect to its orthonormal basis m.\r\n * The resulting point q satisfies the identity (m * q == p).\r\n *\r\n * The inverse of an orthonormal matrix is its transpose.\r\n */\nvar toFrame = function toFrame(m, p) {\n return mul(transpose(m), p);\n};\n/**\r\n * Returns the coordinates of the given point in standard axis-aligned basis\r\n * from its orthonormal basis m.\r\n * The resulting point p satisfies the identity (p == m * q).\r\n */\nvar fromFrame = function fromFrame(m, q) {\n return mul(m, q);\n};\n\nvar CLOCKWISE = -1;\nvar INDETERMINATE = 0;\nvar COUNTERCLOCKWISE = 1;\n/**\r\n * Small number representing a reasonable level of noise between two\r\n * values that can be considered equal.\r\n */\nvar EPSILON$1 = 1e-15;\n/**\r\n * A smaller number for values that require more precision,\r\n * equivalent to C++ DBL_EPSILON.\r\n */\nvar DBL_EPSILON$1 = 2.220446049250313e-16;\n/**\r\n * Maximum error in computing (AxB).C where all vectors are unit length.\r\n * Using standard inequalities, it can be shown that\r\n *\r\n * fl(AxB) = AxB + D where |D| <= (|AxB| + (2/sqrt(3))*|A|*|B|) * e\r\n *\r\n * where \"fl()\" denotes a calculation done in floating-point arithmetic,\r\n * |x| denotes either absolute value or the L2-norm as appropriate, and\r\n * e is a reasonably small value near the noise level of floating point\r\n * number accuracy. Similarly,\r\n *\r\n * fl(B.C) = B.C + d where |d| <= (|B.C| + 2*|B|*|C|) * e .\r\n *\r\n * Applying these bounds to the unit-length vectors A,B,C and neglecting\r\n * relative error (which does not affect the sign of the result), we get\r\n *\r\n * fl((AxB).C) = (AxB).C + d where |d| <= (3 + 2/sqrt(3)) * e\r\n */\nvar MAX_DETERMINANT_ERROR = 1.8274 * DBL_EPSILON$1;\n/**\r\n * The factor to scale the magnitudes by when checking for the sign of set of\r\n * points with certainty. Using a similar technique to the one used for\r\n * maxDeterminantError, the error is at most:\r\n *\r\n * |d| <= (3 + 6/sqrt(3)) * |A-C| * |B-C| * e\r\n *\r\n * If the determinant magnitude is larger than this value then we know\r\n * its sign with certainty.\r\n */\nvar DET_ERROR_MULTIPLIER = 3.2321 * DBL_EPSILON$1;\n/**\r\n * Returns true if the points A, B, C are strictly counterclockwise,\r\n * and returns false if the points are clockwise or collinear (i.e. if they are all\r\n * contained on some great circle).\r\n *\r\n * Due to numerical errors, situations may arise that are mathematically\r\n * impossible, e.g. ABC may be considered strictly CCW while BCA is not.\r\n * However, the implementation guarantees the following:\r\n *\r\n * If sign(a,b,c), then !sign(c,b,a) for all a,b,c.\r\n */\nvar sign = function sign(a, b, c) {\n // We compute the signed volume of the parallelepiped ABC. The usual\n // formula for this is (A ⨯ B) · C, but we compute it here using (C ⨯ A) · B\n // in order to ensure that ABC and CBA are not both CCW. This follows\n // from the following identities (which are true numerically, not just\n // mathematically):\n //\n // (1) x ⨯ y == -(y ⨯ x)\n // (2) -x · y == -(x · y)\n return c.vector.cross(a.vector).dot(b.vector) > 0;\n};\n/**\r\n * Returns a Direction representing the ordering of the points.\r\n * CounterClockwise is returned if the points are in counter-clockwise order,\r\n * Clockwise for clockwise, and Indeterminate if any two points are the same (collinear),\r\n * or the sign could not completely be determined.\r\n *\r\n * This function has additional logic to make sure that the above properties hold even\r\n * when the three points are coplanar, and to deal with the limitations of\r\n * floating-point arithmetic.\r\n *\r\n * robustSign satisfies the following conditions:\r\n *\r\n * (1) robustSign(a,b,c) == Indeterminate if and only if a == b, b == c, or c == a\r\n * (2) robustSign(b,c,a) == robustSign(a,b,c) for all a,b,c\r\n * (3) robustSign(c,b,a) == -robustSign(a,b,c) for all a,b,c\r\n *\r\n * In other words:\r\n *\r\n * (1) The result is Indeterminate if and only if two points are the same.\r\n * (2) Rotating the order of the arguments does not affect the result.\r\n * (3) Exchanging any two arguments inverts the result.\r\n *\r\n * On the other hand, note that it is not true in general that\r\n * robustSign(-a,b,c) == -robustSign(a,b,c), or any similar identities\r\n * involving antipodal points.\r\n */\nvar robustSign = function robustSign(a, b, c) {\n var sign = triageSign(a, b, c);\n if (sign === INDETERMINATE) {\n sign = expensiveSign(a, b, c);\n }\n return sign;\n};\n/**\r\n * Reports the direction sign of the points in a numerically stable way.\r\n * Unlike triageSign, this method can usually compute the correct determinant sign\r\n * even when all three points are as collinear as possible. For example if three\r\n * points are spaced 1km apart along a random line on the Earth's surface using\r\n * the nearest representable points, there is only a 0.4% chance that this method\r\n * will not be able to find the determinant sign. The probability of failure\r\n * decreases as the points get closer together; if the collinear points are 1 meter\r\n * apart, the failure rate drops to 0.0004%.\r\n *\r\n * This method could be extended to also handle nearly-antipodal points, but antipodal\r\n * points are rare in practice so it seems better to simply fall back to\r\n * exact arithmetic in that case.\r\n */\nvar stableSign = function stableSign(a, b, c) {\n var ab = b.vector.sub(a.vector);\n var ab2 = ab.norm2();\n var bc = c.vector.sub(b.vector);\n var bc2 = bc.norm2();\n var ca = a.vector.sub(c.vector);\n var ca2 = ca.norm2();\n // Now compute the determinant ((A-C)x(B-C)).C, where the vertices have been\n // cyclically permuted if necessary so that AB is the longest edge. (This\n // minimizes the magnitude of cross product.) At the same time we also\n // compute the maximum error in the determinant.\n // The two shortest edges, pointing away from their common point.\n var e1;\n var e2;\n var ov;\n if (ab2 >= bc2 && ab2 >= ca2) {\n // AB is the longest edge.\n e1 = ca;\n e2 = bc;\n ov = c.vector;\n } else if (bc2 >= ca2) {\n // BC is the longest edge.\n e1 = ab;\n e2 = ca;\n ov = a.vector;\n } else {\n // CA is the longest edge.\n e1 = bc;\n e2 = ab;\n ov = b.vector;\n }\n var det = -e1.cross(e2).dot(ov);\n var maxErr = DET_ERROR_MULTIPLIER * Math.sqrt(e1.norm2() * e2.norm2());\n // If the determinant isn't zero, within maxErr, we know definitively the point ordering.\n if (det > maxErr) return COUNTERCLOCKWISE;\n if (det < -maxErr) return CLOCKWISE;\n return INDETERMINATE;\n};\n/**\r\n * Returns the direction sign of the points. It returns Indeterminate if two\r\n * points are identical or the result is uncertain. Uncertain cases can be resolved, if\r\n * desired, by calling expensiveSign.\r\n *\r\n * The purpose of this method is to allow additional cheap tests to be done without\r\n * calling expensiveSign.\r\n */\nvar triageSign = function triageSign(a, b, c) {\n var det = a.vector.cross(b.vector).dot(c.vector);\n if (det > MAX_DETERMINANT_ERROR) return COUNTERCLOCKWISE;\n if (det < -MAX_DETERMINANT_ERROR) return CLOCKWISE;\n return INDETERMINATE;\n};\n/**\r\n * Reports the direction sign of the points. It returns Indeterminate\r\n * if two of the input points are the same. It uses multiple-precision arithmetic\r\n * to ensure that its results are always self-consistent.\r\n */\nvar expensiveSign = function expensiveSign(a, b, c) {\n // Return Indeterminate if and only if two points are the same.\n // This ensures robustSign(a,b,c) == Indeterminate if and only if a == b, b == c, or c == a.\n // ie. Property 1 of robustSign.\n if (a.equals(b) || b.equals(c) || c.equals(a)) return INDETERMINATE;\n // Next we try recomputing the determinant still using floating-point\n // arithmetic but in a more precise way. This is more expensive than the\n // simple calculation done by triageSign, but it is still *much* cheaper\n // than using arbitrary-precision arithmetic. This optimization is able to\n // compute the correct determinant sign in virtually all cases except when\n // the three points are truly collinear (e.g., three points on the equator).\n var detSign = stableSign(a, b, c);\n if (detSign !== INDETERMINATE) return detSign;\n // Otherwise fall back to exact arithmetic and symbolic permutations.\n return exactSign(a, b, c, true);\n};\n/**\r\n * Reports the direction sign of the points computed using high-precision\r\n * arithmetic and/or symbolic perturbations.\r\n */\nvar exactSign = function exactSign(a, b, c, perturb) {\n // Sort the three points in lexicographic order, keeping track of the sign\n // of the permutation. (Each exchange inverts the sign of the determinant.)\n var permSign = COUNTERCLOCKWISE;\n var pa = a;\n var pb = b;\n var pc = c;\n if (pa.vector.cmp(pb.vector) > 0) {\n var _ref = [pb, pa];\n pa = _ref[0];\n pb = _ref[1];\n permSign = -permSign;\n }\n if (pb.vector.cmp(pc.vector) > 0) {\n var _ref2 = [pc, pb];\n pb = _ref2[0];\n pc = _ref2[1];\n permSign = -permSign;\n }\n if (pa.vector.cmp(pb.vector) > 0) {\n var _ref3 = [pb, pa];\n pa = _ref3[0];\n pb = _ref3[1];\n permSign = -permSign;\n }\n // Construct multiple-precision versions of the sorted points and compute\n // their precise 3x3 determinant.\n var xa = PreciseVector.fromVector(pa.vector);\n var xb = PreciseVector.fromVector(pb.vector);\n var xc = PreciseVector.fromVector(pc.vector);\n var xbCrossXc = xb.cross(xc);\n var det = xa.dot(xbCrossXc);\n // The precision of big.Float is high enough that the result should always\n // be exact enough (no rounding was performed).\n // If the exact determinant is non-zero, we're done.\n var detSign = det.getSign();\n if (detSign === INDETERMINATE && perturb) {\n // Otherwise, we need to resort to symbolic perturbations to resolve the\n // sign of the determinant.\n detSign = symbolicallyPerturbedSign(xa, xb, xc, xbCrossXc);\n }\n return permSign * detSign;\n};\n/**\r\n * Reports the sign of the determinant of three points A, B, C under a model where\r\n * every possible Point is slightly perturbed by a unique infinitesmal amount such that\r\n * no three perturbed points are collinear and no four points are coplanar. The perturbations\r\n * are so small that they do not change the sign of any determinant that was non-zero\r\n * before the perturbations, and therefore can be safely ignored unless the\r\n * determinant of three points is exactly zero (using multiple-precision arithmetic).\r\n * This returns CounterClockwise or Clockwise according to the sign of the determinant\r\n * after the symbolic perturbations are taken into account.\r\n *\r\n * Since the symbolic perturbation of a given point is fixed (i.e., the\r\n * perturbation is the same for all calls to this method and does not depend\r\n * on the other two arguments), the results of this method are always\r\n * self-consistent. It will never return results that would correspond to an\r\n * impossible configuration of non-degenerate points.\r\n *\r\n * This requires that the 3x3 determinant of A, B, C must be exactly zero.\r\n * And the points must be distinct, with A < B < C in lexicographic order.\r\n *\r\n * Reference:\r\n *\r\n * \"Simulation of Simplicity\" (Edelsbrunner and Muecke, ACM Transactions on\r\n * Graphics, 1990).\r\n */\nvar symbolicallyPerturbedSign = function symbolicallyPerturbedSign(a, b, c, bCrossC) {\n // This method requires that the points are sorted in lexicographically\n // increasing order. This is because every possible Point has its own\n // symbolic perturbation such that if A < B then the symbolic perturbation\n // for A is much larger than the perturbation for B.\n //\n // Alternatively, we could sort the points in this method and keep track of\n // the sign of the permutation, but it is more efficient to do this before\n // converting the inputs to the multi-precision representation, and this\n // also lets us re-use the result of the cross product B x C.\n //\n // Every input coordinate x[i] is assigned a symbolic perturbation dx[i].\n // We then compute the sign of the determinant of the perturbed points,\n // i.e.\n // | a.X+da.X a.Y+da.Y a.Z+da.Z |\n // | b.X+db.X b.Y+db.Y b.Z+db.Z |\n // | c.X+dc.X c.Y+dc.Y c.Z+dc.Z |\n //\n // The perturbations are chosen such that\n //\n // da.Z > da.Y > da.X > db.Z > db.Y > db.X > dc.Z > dc.Y > dc.X\n //\n // where each perturbation is so much smaller than the previous one that we\n // don't even need to consider it unless the coefficients of all previous\n // perturbations are zero. In fact, it is so small that we don't need to\n // consider it unless the coefficient of all products of the previous\n // perturbations are zero. For example, we don't need to consider the\n // coefficient of db.Y unless the coefficient of db.Z *da.X is zero.\n //\n // The follow code simply enumerates the coefficients of the perturbations\n // (and products of perturbations) that appear in the determinant above, in\n // order of decreasing perturbation magnitude. The first non-zero\n // coefficient determines the sign of the result. The easiest way to\n // enumerate the coefficients in the correct order is to pretend that each\n // perturbation is some tiny value \"eps\" raised to a power of two:\n //\n // eps** 1 2 4 8 16 32 64 128 256\n // da.Z da.Y da.X db.Z db.Y db.X dc.Z dc.Y dc.X\n //\n // Essentially we can then just count in binary and test the corresponding\n // subset of perturbations at each step. So for example, we must test the\n // coefficient of db.Z*da.X before db.Y because eps**12 > eps**16.\n //\n // Of course, not all products of these perturbations appear in the\n // determinant above, since the determinant only contains the products of\n // elements in distinct rows and columns. Thus we don't need to consider\n // da.Z*da.Y, db.Y *da.Y, etc. Furthermore, sometimes different pairs of\n // perturbations have the same coefficient in the determinant; for example,\n // da.Y*db.X and db.Y*da.X have the same coefficient (c.Z). Therefore\n // we only need to test this coefficient the first time we encounter it in\n // the binary order above (which will be db.Y*da.X).\n //\n // The sequence of tests below also appears in Table 4-ii of the paper\n // referenced above, if you just want to look it up, with the following\n // translations: [a,b,c] -> [i,j,k] and [0,1,2] -> [1,2,3]. Also note that\n // some of the signs are different because the opposite cross product is\n // used (e.g., B x C rather than C x B).\n var detSign = bCrossC.z.getSign(); // da.Z\n if (detSign !== 0) return detSign;\n detSign = bCrossC.y.getSign(); // da.Y\n if (detSign !== 0) return detSign;\n detSign = bCrossC.x.getSign(); // da.X\n if (detSign !== 0) return detSign;\n detSign = c.x.mul(a.y).sub(c.y.mul(a.x)).getSign(); // db.Z\n if (detSign !== 0) return detSign;\n detSign = c.x.getSign(); // db.Z * da.Y\n if (detSign !== 0) return detSign;\n // @ts-ignore Typescript doesn't understand this negation is valid\n detSign = -c.y.getSign(); // db.Z * da.X\n if (detSign !== 0) return detSign;\n detSign = c.z.mul(a.x).sub(c.x.mul(a.z)).getSign(); // db.Y\n if (detSign !== 0) return detSign;\n detSign = c.z.getSign(); // db.Y * da.X\n if (detSign !== 0) return detSign;\n // The following test is listed in the paper, but it is redundant because\n // the previous tests guarantee that C == (0, 0, 0).\n // (c.y*a.z - c.z*a.y).getSign() // db.X\n detSign = a.x.mul(b.y).sub(a.y.mul(b.x)).getSign(); // dc.Z\n if (detSign !== 0) return detSign;\n // @ts-ignore Typescript doesn't understand this negation is valid\n detSign = -b.x.getSign(); // dc.Z * da.Y\n if (detSign !== 0) return detSign;\n detSign = b.y.getSign(); // dc.Z * da.X\n if (detSign !== 0) return detSign;\n detSign = a.x.getSign(); // dc.Z * db.Y\n if (detSign !== 0) return detSign;\n return COUNTERCLOCKWISE; // dc.Z * db.Y * da.X\n};\n\n/**\r\n * Point represents a point on the unit sphere as a normalized 3D vector.\r\n * Fields should be treated as read-only. Use one of the factory methods for creation.\r\n *\r\n * @beta incomplete\r\n */\nvar Point$1 = /*#__PURE__*/function () {\n /**\r\n * Returns a new Point.\r\n * @category Constructors\r\n */\n function Point(x, y, z) {\n this.vector = new Vector(x, y, z);\n }\n /**\r\n * Returns the x dimension value.\r\n */\n /**\r\n * Point represents a point on the unit sphere as a normalized 3D vector.\r\n * Fields should be treated as read-only. Use one of the factory methods for creation.\r\n * @category Constructors\r\n */\n Point.fromVector = function fromVector(vector) {\n return new Point(vector.x, vector.y, vector.z);\n }\n /**\r\n * Returns a Point for the given LatLng.\r\n * @category Constructors\r\n */;\n Point.fromLatLng = function fromLatLng(ll) {\n var phi = ll.lat;\n var theta = ll.lng;\n var cosphi = Math.cos(phi);\n return new Point(Math.cos(theta) * cosphi, Math.sin(theta) * cosphi, Math.sin(phi));\n }\n /**\r\n * Creates a new normalized point from coordinates.\r\n *\r\n * This always returns a valid point. If the given coordinates can not be normalized\r\n * the origin point will be returned.\r\n *\r\n * This behavior is different from the C++ construction of a S2Point from coordinates\r\n * (i.e. S2Point(x, y, z)) in that in C++ they do not Normalize.\r\n * @category Constructors\r\n */;\n Point.fromCoords = function fromCoords(x, y, z) {\n if (x === 0 && y === 0 && z === 0) return this.originPoint();\n return Point.fromVector(new Vector(x, y, z).normalize());\n }\n /**\r\n * Returns a unique \"origin\" on the sphere for operations that need a fixed\r\n * reference point. In particular, this is the \"point at infinity\" used for\r\n * point-in-polygon testing (by counting the number of edge crossings).\r\n *\r\n * It should *not* be a point that is commonly used in edge tests in order\r\n * to avoid triggering code to handle degenerate cases (this rules out the\r\n * north and south poles). It should also not be on the boundary of any\r\n * low-level S2Cell for the same reason.\r\n * @category Constructors\r\n */;\n Point.originPoint = function originPoint() {\n return new Point(-0.0099994664350250197, 0.0025924542609324121, 0.99994664350250195);\n }\n /**\r\n * Returns a Point that is orthogonal to both p and op. This is similar to\r\n * p.Cross(op) (the true cross product) except that it does a better job of\r\n * ensuring orthogonality when the Point is nearly parallel to op, it returns\r\n * a non-zero result even when p == op or p == -op and the result is a Point.\r\n *\r\n * It satisfies the following properties (f == PointCross):\r\n *\r\n * \t(1) f(p, op) != 0 for all p, op\r\n * \t(2) f(op,p) == -f(p,op) unless p == op or p == -op\r\n * \t(3) f(-p,op) == -f(p,op) unless p == op or p == -op\r\n * \t(4) f(p,-op) == -f(p,op) unless p == op or p == -op\r\n */;\n var _proto = Point.prototype;\n _proto.pointCross = function pointCross(op) {\n var v = this.vector.add(op.vector).cross(op.vector.sub(this.vector));\n if (v.x === 0 && v.y === 0 && v.z === 0) v = this.vector.ortho();\n return Point.fromVector(v);\n }\n /**\r\n * Returns true if the edges OA, OB, and OC are encountered in that\r\n * order while sweeping CCW around the point O.\r\n *\r\n * You can think of this as testing whether A <= B <= C with respect to the\r\n * CCW ordering around O that starts at A, or equivalently, whether B is\r\n * contained in the range of angles (inclusive) that starts at A and extends\r\n * CCW to C. Properties:\r\n *\r\n * \t(1) If OrderedCCW(a,b,c,o) && OrderedCCW(b,a,c,o), then a == b\r\n * \t(2) If OrderedCCW(a,b,c,o) && OrderedCCW(a,c,b,o), then b == c\r\n * \t(3) If OrderedCCW(a,b,c,o) && OrderedCCW(c,b,a,o), then a == b == c\r\n * \t(4) If a == b or b == c, then OrderedCCW(a,b,c,o) is true\r\n * \t(5) Otherwise if a == c, then OrderedCCW(a,b,c,o) is false\r\n */;\n Point.orderedCCW = function orderedCCW(a, b, c, o) {\n var sum = 0;\n if (robustSign(b, o, a) !== CLOCKWISE) sum++;\n if (robustSign(c, o, b) !== CLOCKWISE) sum++;\n if (robustSign(a, o, c) === COUNTERCLOCKWISE) sum++;\n return sum >= 2;\n }\n /**\r\n * Returns the angle between this point and another point.\r\n */;\n _proto.distance = function distance(b) {\n return this.vector.angle(b.vector);\n }\n /**\r\n * Reports whether this point equals another point.\r\n */;\n _proto.equals = function equals(op) {\n return this.vector.equals(op.vector);\n }\n /**\r\n * Reports whether this point is similar enough to be equal to another point.\r\n */;\n _proto.approxEqual = function approxEqual(op, eps) {\n if (eps === void 0) {\n eps = EPSILON$1;\n }\n return this.vector.angle(op.vector) <= eps;\n }\n /**\r\n * Reports the angle between two vectors with better precision when\r\n * the two are nearly parallel.\r\n *\r\n * The .Angle() member function uses atan(|AxB|, A.B) to compute the angle\r\n * between A and B, which can lose about half its precision when A and B are\r\n * nearly (anti-)parallel.\r\n *\r\n * Kahan provides a much more stable form:\r\n *\r\n * \t2*atan2(| A*|B| - |A|*B |, | A*|B| + |A|*B |)\r\n *\r\n * Since Points are unit magnitude by construction we can simplify further:\r\n *\r\n * \t2*atan2(|A-B|,|A+B|)\r\n *\r\n * This likely can't replace Vectors Angle since it requires four magnitude\r\n * calculations, each of which takes 5 operations + a square root, plus 6\r\n * operations to find the sum and difference of the vectors, for a total of 26 +\r\n * 4 square roots. Vectors Angle requires 19 + 1 square root.\r\n *\r\n * Since we always have unit vectors, we can elide two of those magnitude\r\n * calculations for a total of 16 + 2 square roots which is competitive with\r\n * Vectors Angle performance.\r\n *\r\n * Reference: Kahan, W. (2006, Jan 11). \"How Futile are Mindless Assessments of\r\n * Roundoff in Floating-Point Computation?\" (p. 47).\r\n * https://people.eecs.berkeley.edu/~wkahan/Mindless.pdf\r\n *\r\n * The 2 points must be normalized.\r\n */;\n _proto.stableAngle = function stableAngle(op) {\n return 2 * Math.atan2(this.vector.sub(op.vector).norm(), this.vector.add(op.vector).norm());\n }\n /**\r\n * Constructs a ChordAngle corresponding to the distance between the two given points.\r\n */;\n Point.chordAngleBetweenPoints = function chordAngleBetweenPoints(x, y) {\n return Math.min(4.0, x.vector.sub(y.vector).norm2());\n }\n /**\r\n * Generates a slice of points shaped as a regular polygon with the specified number of vertices,\r\n * all located on a circle of the specified angular radius around the center.\r\n */;\n Point.regularPoints = function regularPoints(center, radius, numVertices) {\n return this.regularPointsForFrame(getFrame(center), radius, numVertices);\n }\n /**\r\n * Generates a slice of points shaped as a regular polygon with the specified number of vertices,\r\n * all on a circle of the specified angular radius around the center.\r\n */;\n Point.regularPointsForFrame = function regularPointsForFrame(frame, radius, numVertices) {\n var z = Math.cos(radius);\n var r = Math.sin(radius);\n var radianStep = 2 * Math.PI / numVertices;\n var vertices = [];\n for (var i = 0; i < numVertices; i++) {\n var angle = i * radianStep;\n var p = new Point(r * Math.cos(angle), r * Math.sin(angle), z);\n vertices.push(Point.fromVector(fromFrame(frame, p).vector.normalize()));\n }\n return vertices;\n }\n // /** Returns a bounding cap for this point. */\n // capBound(): Cap {\n // return Cap.fromPoint(this)\n // }\n // /** Returns a bounding latitude-longitude rectangle from this point. */\n // rectBound(): Rect {\n // return Rect.fromLatLng(LatLng.fromPoint(this))\n // }\n /** Returns false as Points do not contain any other S2 types. */;\n _proto.containsCell = function containsCell(_c) {\n return false;\n }\n /** Reports whether this Point intersects the given cell. */;\n _proto.intersectsCell = function intersectsCell(c) {\n return c.containsPoint(this);\n }\n /**\r\n * Reports if this Point contains the other Point.\r\n * (This method is named to satisfy the Region interface.)\r\n */;\n _proto.containsPoint = function containsPoint(other) {\n return this.contains(other);\n }\n /** Computes a covering of the Point. */;\n _proto.cellUnionBound = function cellUnionBound() {\n return [fromPoint(this)];\n }\n /**\r\n * Reports if this Point contains the other Point.\r\n * (This method matches all other S2 types where the reflexive Contains\r\n * method does not contain the type's name.)\r\n */;\n _proto.contains = function contains(other) {\n return this.equals(other);\n }\n /**\r\n * Returns a unit-length vector to use as the reference direction for\r\n * deciding whether a polygon with semi-open boundaries contains the given vertex \"a\"\r\n * (see ContainsVertexQuery). The result is unit length and is guaranteed\r\n * to be different from the given point \"a\".\r\n */;\n _proto.referenceDir = function referenceDir() {\n return Point.ortho(this);\n };\n _proto.toString = function toString() {\n return this.vector.toString();\n }\n /**\r\n * Returns a unit-length vector that is orthogonal to this point.\r\n * Satisfies Ortho(-a) = -Ortho(a) for all a.\r\n *\r\n * Note that Vector3 also defines an \"Ortho\" method, but this one is\r\n * preferred for use in S2 code because it explicitly tries to avoid result\r\n * coordinates that are zero. (This is a performance optimization that\r\n * reduces the amount of time spent in functions that handle degeneracies.)\r\n */;\n Point.ortho = function ortho(a) {\n var lc = a.vector.largestComponent();\n var op = new Vector(0.012, 0.0053, 0.00457);\n if (lc === Vector.X_AXIS) op.z = 1;else if (lc === Vector.Y_AXIS) op.x = 1;else op.y = 1;\n return Point.fromVector(a.vector.cross(op).normalize());\n }\n /**\r\n * Sorts the array of Points in place.\r\n */;\n Point.sortPoints = function sortPoints(points) {\n points.sort(function (a, b) {\n return a.vector.cmp(b.vector);\n });\n };\n return _createClass(Point, [{\n key: \"x\",\n get: function get() {\n return this.vector.x;\n }\n /**\r\n * Returns the y dimension value.\r\n */\n }, {\n key: \"y\",\n get: function get() {\n return this.vector.y;\n }\n /**\r\n * Returns the z dimension value.\r\n */\n }, {\n key: \"z\",\n get: function get() {\n return this.vector.z;\n }\n }]);\n}();\n\n/** Returns the number closest to x within the range min..max. */\nvar clampInt = function clampInt(x, min, max) {\n if (x < min) return min;\n if (x > max) return max;\n return x;\n};\n/** Returns the largest of the given numbers. */\nvar max = function max(first) {\n var max = first;\n for (var _len = arguments.length, others = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n others[_key - 1] = arguments[_key];\n }\n for (var _i = 0, _others = others; _i < _others.length; _i++) {\n var y = _others[_i];\n if (y > max) max = y;\n }\n return max;\n};\n/** Returns the smallest of the given numbers. */\nvar min = function min(first) {\n var min = first;\n for (var _len2 = arguments.length, others = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n others[_key2 - 1] = arguments[_key2];\n }\n for (var _i2 = 0, _others2 = others; _i2 < _others2.length; _i2++) {\n var y = _others2[_i2];\n if (y < min) min = y;\n }\n return min;\n};\n/** Returns the absolute value of a bigint. */\nvar abs$1 = function abs(n) {\n return n < 0n ? -n : n;\n};\n/** Returns the largest of the given ChordAngle values. */\nvar maxChordAngle = function maxChordAngle(first) {\n for (var _len5 = arguments.length, others = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {\n others[_key5 - 1] = arguments[_key5];\n }\n return max.apply(void 0, [first].concat(others));\n};\n/** Returns the smallest of the given ChordAngle values. */\nvar minChordAngle = function minChordAngle(first) {\n for (var _len6 = arguments.length, others = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {\n others[_key6 - 1] = arguments[_key6];\n }\n return min.apply(void 0, [first].concat(others));\n};\n/**\r\n * Performs a binary search to find the smallest index `i` in the range [0, n) where the function `f` is true.\r\n *\r\n * missinglink: port of Go `sort.Search`\r\n */\nvar binarySearch = function binarySearch(n, f) {\n var i = 0;\n var j = n;\n while (i < j) {\n var h = Math.floor((i + j) / 2); // calculate mid-point\n if (!f(h)) {\n i = h + 1; // move to the right half\n } else {\n j = h; // move to the left half\n }\n }\n return i;\n};\n\n/**\r\n * An invalid cell ID guaranteed to be larger than any valid cell ID.\r\n * It is used primarily by ShapeIndex.\r\n * The value is also used by some S2 types when encoding data.\r\n * Note that the sentinel's RangeMin == RangeMax == itself.\r\n */\nvar SentinelCellID = (1n << 64n) - 1n;\n/**\r\n * Returns the cube face for this cell id, in the range [0,5].\r\n */\nvar face$1 = function face(ci) {\n return Number(ci >> BigInt(POS_BITS));\n};\n/**\r\n * Returns the position along the Hilbert curve of this cell id, in the range [0,2^POS_BITS-1].\r\n */\nvar pos = function pos(ci) {\n return ci & SentinelCellID >> BigInt(FACE_BITS);\n};\n/**\r\n * Returns the subdivision level of this cell id, in the range [0, MAX_LEVEL].\r\n */\nvar level = function level(ci) {\n return MAX_LEVEL - (findLSBSetNonZero64(ci) >>> 1);\n};\n/**\r\n * Returns the cell id at the given level, which must be no greater than the current level.\r\n */\nvar parent = function parent(ci, level) {\n var lsb = lsbForLevel(level);\n return ci & -lsb | lsb;\n};\n/**\r\n * Returns the immediate parent of the cell.\r\n * This method is cheaper than `parent`, but assumes the cell is not a face cell.\r\n */\nvar immediateParent = function immediateParent(ci) {\n var nlsb = lsb(ci) << 2n;\n return ci & -nlsb | nlsb;\n};\n/** Returns whether this is a top-level (face) cell. */\nvar isFace = function isFace(ci) {\n return (ci & lsbForLevel(0) - 1n) === 0n;\n};\n/**\r\n * Returns true is cell id is valid.\r\n */\nvar valid = function valid(ci) {\n if (typeof ci !== 'bigint' || BigInt.asUintN(64, ci) != ci) return false;\n return face$1(ci) <= NUM_FACES && (lsb(ci) & 0x1555555555555555n) != 0n;\n};\n/**\r\n * Returns whether this cell ID is at the deepest level; that is, the level at which the cells are smallest.\r\n */\nvar isLeaf = function isLeaf(ci) {\n return (ci & 1n) != 0n;\n};\n/**\r\n * Returns the child position (0..3) of this cell's ancestor at the given level, relative to its parent.\r\n * The argument should be in the range 1..MaxLevel.\r\n * For example, childPosition(1) returns the position of this cell's level-1 ancestor within its top-level face cell.\r\n */\nvar childPosition = function childPosition(ci, level) {\n return Number(ci >> 2n * BigInt(MAX_LEVEL - level) + 1n) & 3;\n};\n// Bitwise\n/**\r\n * Returns the least significant bit that is set\r\n */\nvar lsb = function lsb(ci) {\n return ci & -ci;\n};\n/**\r\n * Returns the lowest-numbered bit that is on for cells at the given level.\r\n */\nvar lsbForLevel = function lsbForLevel(level) {\n return 1n << BigInt(2 * (MAX_LEVEL - level));\n};\n/**\r\n * Returns the four immediate children of this cell.\r\n * If the cell is a leaf cell, it returns four identical cells that are not the children.\r\n */\nvar children = function children(ci) {\n var ch = [ci, ci, ci, ci];\n var _lsb = lsb(ci);\n ch[0] = ci - _lsb + (_lsb >> 2n);\n _lsb >>= 1n;\n ch[1] = ch[0] + _lsb;\n ch[2] = ch[1] + _lsb;\n ch[3] = ch[2] + _lsb;\n return ch;\n};\n/**\r\n * Returns all neighbors of this cell at the given level. Two cells X and Y are neighbors\r\n * if their boundaries intersect but their interiors do not. In particular, two cells that\r\n * intersect at a single point are neighbors. Note that for cells adjacent to a face vertex,\r\n * the same neighbor may be returned more than once. There could be up to eight neighbors\r\n * including the diagonal ones that share the vertex.\r\n *\r\n * This requires level >= ci.level().\r\n */\nvar allNeighbors = function allNeighbors(ci, lvl) {\n var neighbors = [];\n var _faceIJOrientation = faceIJOrientation(ci),\n f = _faceIJOrientation.f,\n i = _faceIJOrientation.i,\n j = _faceIJOrientation.j;\n // Find the coordinates of the lower left-hand leaf cell. We need to\n // normalize (i,j) to a known position within the cell because level\n // may be larger than this cell's level.\n var size = sizeIJ(level(ci));\n i &= -size;\n j &= -size;\n var nbrSize = sizeIJ(lvl);\n // Compute the top-bottom, left-right, and diagonal neighbors in one pass.\n for (var k = -nbrSize;; k += nbrSize) {\n var sameFace = void 0;\n if (k < 0) {\n sameFace = j + k >= 0;\n } else if (k >= size) {\n sameFace = j + k < MAX_SIZE;\n } else {\n sameFace = true;\n // Top and bottom neighbors.\n neighbors.push(parent(fromFaceIJSame(f, i + k, j - nbrSize, j - size >= 0), lvl));\n neighbors.push(parent(fromFaceIJSame(f, i + k, j + size, j + size < MAX_SIZE), lvl));\n }\n // Left, right, and diagonal neighbors.\n neighbors.push(parent(fromFaceIJSame(f, i - nbrSize, j + k, sameFace && i - size >= 0), lvl));\n neighbors.push(parent(fromFaceIJSame(f, i + size, j + k, sameFace && i + size < MAX_SIZE), lvl));\n if (k >= size) break;\n }\n return neighbors;\n};\n// Ranges\n/**\r\n * Returns the minimum CellID that is contained within this cell.\r\n */\nvar rangeMin = function rangeMin(ci) {\n return ci - (lsb(ci) - 1n);\n};\n/**\r\n * Returns the maximum CellID that is contained within this cell.\r\n */\nvar rangeMax = function rangeMax(ci) {\n return ci + (lsb(ci) - 1n);\n};\n/**\r\n * Returns true iff ci contains oci.\r\n */\nvar contains = function contains(ci, oci) {\n return rangeMin(ci) <= oci && oci <= rangeMax(ci);\n};\n/**\r\n * Returns true iff ci intersects oci.\r\n */\nvar intersects = function intersects(ci, oci) {\n return rangeMin(oci) <= rangeMax(ci) && rangeMax(oci) >= rangeMin(ci);\n};\n// Token\n/**\r\n * Returns a hex-encoded string of the uint64 cell id, with leading zeros included but trailing zeros stripped\r\n */\nvar toToken = function toToken(ci) {\n var s = ci.toString(16).padStart(16, '0').replace(/0+$/, '');\n if (s.length === 0) return 'X';\n return s;\n};\n/**\r\n * Returns a cell id given a hex-encoded string.\r\n * @category Constructors\r\n */\nvar fromToken = function fromToken(t) {\n if (t.length > 16) return 0n;\n if (!/^[A-F0-9]+$/i.test(t)) return 0n;\n var ci = BigInt('0x' + t);\n if (t.length < 16) ci = ci << BigInt(4 * (16 - t.length));\n return ci;\n};\n/**\r\n * Returns the string representation of the cell ID in the form \"1/3210\".\r\n */\nvar toString$1 = function toString(ci) {\n if (!valid(ci)) return \"Invalid: \" + ci.toString(16);\n var result = face$1(ci) + \"/\";\n for (var l = 1; l <= level(ci); l++) result += childPosition(ci, l);\n return result;\n};\n/**\r\n * Converts a string in the form \"1/3210\" to a CellID.\r\n * @category Constructors\r\n */\nvar fromString = function fromString(s) {\n var level = s.length - 2;\n if (level < 0 || level > MAX_LEVEL) return 0n;\n var face = parseInt(s[0], 10);\n if (isNaN(face) || face < 0 || face > 5 || s[1] !== '/') return 0n;\n var cid = fromFace(face);\n for (var i = 2; i < s.length; i++) {\n var childPos = parseInt(s[i], 10);\n if (isNaN(childPos) || childPos < 0 || childPos > 3) return 0n;\n cid = children(cid)[childPos];\n }\n return cid;\n};\n// Constructors\n/**\r\n * Returns a cell id given its face in the range [0,5], the 61-bit Hilbert curve position pos within that face, and the level in the range [0,MAX_LEVEL].\r\n * The position in the cell id will be truncated to correspond to the Hilbert curve position at the center of the returned cell.\r\n * @category Constructors\r\n */\nvar fromFacePosLevel = function fromFacePosLevel(face, pos, level) {\n return parent((BigInt(face) << BigInt(POS_BITS)) + (pos || 1n), level);\n};\n/**\r\n * Returns the cell corresponding to a given S2 cube face.\r\n * @category Constructors\r\n */\nvar fromFace = function fromFace(face) {\n return (BigInt(face) << BigInt(POS_BITS)) + lsbForLevel(0);\n};\n/**\r\n * Returns a leaf cell containing point p.\r\n * Usually there is exactly one such cell, but for points along the edge of a cell, any adjacent cell may be (deterministically) chosen.\r\n * This is because CellIDs are considered to be closed sets.\r\n * The returned cell will always contain the given point, i.e.\r\n *\r\n * \tCellFromPoint(p).ContainsPoint(p)\r\n *\r\n * is always true.\r\n * @category Constructors\r\n */\nvar fromPoint = function fromPoint(p) {\n var _xyzToFaceUV = xyzToFaceUV(p.vector),\n f = _xyzToFaceUV[0],\n u = _xyzToFaceUV[1],\n v = _xyzToFaceUV[2];\n var i = stToIJ(uvToST(u));\n var j = stToIJ(uvToST(v));\n return fromFaceIJ(f, i, j);\n};\n/**\r\n * Returns the leaf cell containing ll.\r\n * @category Constructors\r\n */\nvar fromLatLng = function fromLatLng(ll) {\n return fromPoint(Point$1.fromLatLng(ll));\n};\n// stuv\n/** Converts a value in ST coordinates to a value in IJ coordinates. */\nvar stToIJ = function stToIJ(s) {\n return clampInt(Math.floor(MAX_SIZE * s), 0, MAX_SIZE - 1);\n};\nvar sizeIJ = function sizeIJ(level) {\n return 1 << clampInt(MAX_LEVEL - level, 0, MAX_LEVEL);\n};\n/** Returns the edge length of this CellID in (s,t)-space at the given level. */\nvar sizeST = function sizeST(level) {\n return ijToSTMin(sizeIJ(level));\n};\n/**\r\n * Converts the i- or j-index of a leaf cell to the minimum corresponding s- or t-value contained by that cell.\r\n * The argument must be in the range [0..2**30].\r\n * i.e. up to one position beyond the normal range of valid leaf cell indices.\r\n */\nvar ijToSTMin = function ijToSTMin(i) {\n return i / MAX_SIZE;\n};\n/**\r\n * Returns the center of this CellID in (u,v)-space.\r\n * Note that the center of the cell is defined as the point at which it is recursively subdivided into four children; in general, it is not at the midpoint of the (u,v) rectangle covered by the cell.\r\n */\nvar centerUV = function centerUV(ci) {\n var _faceSiTi = faceSiTi(ci),\n si = _faceSiTi.si,\n ti = _faceSiTi.ti;\n return new Point(stToUV(siTiToST(si)), stToUV(siTiToST(ti)));\n};\n// boundUV returns the bound of this CellID in (u,v)-space.\nvar boundUV = function boundUV(ci) {\n var _faceIJOrientation2 = faceIJOrientation(ci),\n i = _faceIJOrientation2.i,\n j = _faceIJOrientation2.j;\n return ijLevelToBoundUV(i, j, level(ci));\n};\n/**\r\n * Returns a leaf cell given its cube face (range 0..5) and IJ coordinates.\r\n * @category Constructors\r\n */\nvar fromFaceIJ = function fromFaceIJ(f, i, j) {\n /** Note that this value gets shifted one bit to the left at the end of the function. */\n var n = BigInt(f) << BigInt(POS_BITS - 1);\n /**\r\n * Alternating faces have opposite Hilbert curve orientations; this\r\n * is necessary in order for all faces to have a right-handed\r\n * coordinate system.\r\n */\n var bits = f & SWAP_MASK;\n /**\r\n * Each iteration maps 4 bits of \"i\" and \"j\" into 8 bits of the Hilbert curve position.\r\n * The lookup table transforms a 10-bit key of the form \"iiiijjjjoo\" to a 10-bit value of the form \"ppppppppoo\", where the\r\n * letters [ijpo] denote bits of \"i\", \"j\", Hilbert curve position, and Hilbert curve orientation respectively.\r\n */\n for (var k = 7; k >= 0; k--) {\n var mask = (1 << LOOKUP_BITS) - 1;\n bits += (i >> k * LOOKUP_BITS & mask) << LOOKUP_BITS + 2;\n bits += (j >> k * LOOKUP_BITS & mask) << 2;\n bits = lookupPos[bits];\n n |= BigInt(bits >> 2) << BigInt(k * 2 * LOOKUP_BITS);\n bits &= SWAP_MASK | INVERT_MASK;\n }\n return n * 2n + 1n;\n};\nvar fromFaceIJWrap = function fromFaceIJWrap(f, i, j) {\n // Convert i and j to the coordinates of a leaf cell just beyond the\n // boundary of this face. This prevents 32-bit overflow in the case\n // of finding the neighbors of a face cell.\n i = clampInt(i, -1, MAX_SIZE);\n j = clampInt(j, -1, MAX_SIZE);\n // We want to wrap these coordinates onto the appropriate adjacent face.\n // The easiest way to do this is to convert the (i,j) coordinates to (x,y,z)\n // (which yields a point outside the normal face boundary), and then call\n // xyzToFaceUV to project back onto the correct face.\n //\n // The code below converts (i,j) to (si,ti), and then (si,ti) to (u,v) using\n // the linear projection (u=2*s-1 and v=2*t-1). (The code further below\n // converts back using the inverse projection, s=0.5*(u+1) and t=0.5*(v+1).\n // Any projection would work here, so we use the simplest.) We also clamp\n // the (u,v) coordinates so that the point is barely outside the\n // [-1,1]x[-1,1] face rectangle, since otherwise the reprojection step\n // (which divides by the new z coordinate) might change the other\n // coordinates enough so that we end up in the wrong leaf cell.\n var scale = 1.0 / MAX_SIZE;\n var limit = nextAfter(1, 2);\n var u = Math.max(-limit, Math.min(limit, scale * (Number(BigInt(i) << 1n) + 1 - MAX_SIZE)));\n var v = Math.max(-limit, Math.min(limit, scale * (Number(BigInt(j) << 1n) + 1 - MAX_SIZE)));\n var _xyzToFaceUV2 = xyzToFaceUV(faceUVToXYZ(f, u, v));\n f = _xyzToFaceUV2[0];\n u = _xyzToFaceUV2[1];\n v = _xyzToFaceUV2[2];\n return fromFaceIJ(f, stToIJ(0.5 * (u + 1)), stToIJ(0.5 * (v + 1)));\n};\n/**\r\n * @category Constructors\r\n */\nvar fromFaceIJSame = function fromFaceIJSame(f, i, j, sameFace) {\n if (sameFace) return fromFaceIJ(f, i, j);\n return fromFaceIJWrap(f, i, j);\n};\n/**\r\n * Uses the global lookupIJ table to unfiddle the bits of ci.\r\n */\nvar faceIJOrientation = function faceIJOrientation(ci) {\n var f = face$1(ci);\n var orientation = f & SWAP_MASK;\n var nbits = MAX_LEVEL - 7 * LOOKUP_BITS; // first iteration\n var i = 0;\n var j = 0;\n // Each iteration maps 8 bits of the Hilbert curve position into\n // 4 bits of \"i\" and \"j\". The lookup table transforms a key of the\n // form \"ppppppppoo\" to a value of the form \"iiiijjjjoo\", where the\n // letters [ijpo] represents bits of \"i\", \"j\", the Hilbert curve\n // position, and the Hilbert curve orientation respectively.\n //\n // On the first iteration we need to be careful to clear out the bits\n // representing the cube face.\n for (var k = 7; k >= 0; k--) {\n orientation += Number((ci >> BigInt(k * 2 * LOOKUP_BITS + 1) & (1n << BigInt(2 * nbits)) - 1n) << 2n);\n orientation = lookupIJ[orientation];\n i += orientation >> LOOKUP_BITS + 2 << k * LOOKUP_BITS;\n j += (orientation >> 2 & (1 << LOOKUP_BITS) - 1) << k * LOOKUP_BITS;\n orientation &= SWAP_MASK | INVERT_MASK;\n nbits = LOOKUP_BITS; // following iterations\n }\n // The position of a non-leaf cell at level \"n\" consists of a prefix of\n // 2*n bits that identifies the cell, followed by a suffix of\n // 2*(MAX_LEVEL-n)+1 bits of the form 10*. If n==MAX_LEVEL, the suffix is\n // just \"1\" and has no effect. Otherwise, it consists of \"10\", followed\n // by (MAX_LEVEL-n-1) repetitions of \"00\", followed by \"0\". The \"10\" has\n // no effect, while each occurrence of \"00\" has the effect of reversing\n // the SWAP_MASK bit.\n if ((lsb(ci) & BigInt('0x1111111111111110')) != 0n) orientation ^= SWAP_MASK;\n return {\n f: f,\n i: i,\n j: j,\n orientation: orientation\n };\n};\n/**\r\n * Returns the Face/Si/Ti coordinates of the center of the cell.\r\n */\nvar faceSiTi = function faceSiTi(ci) {\n var _faceIJOrientation3 = faceIJOrientation(ci),\n face = _faceIJOrientation3.f,\n i = _faceIJOrientation3.i,\n j = _faceIJOrientation3.j;\n var delta = 0;\n if (isLeaf(ci)) delta = 1;else if (((BigInt(i) ^ ci >> 2n) & 1n) != 0n) delta = 2;\n return {\n face: face,\n si: 2 * i + delta,\n ti: 2 * j + delta\n };\n};\n/**\r\n * Returns the bounds in (u,v)-space for the cell at the given\r\n * level containing the leaf cell with the given (i,j)-coordinates.\r\n */\nvar ijLevelToBoundUV = function ijLevelToBoundUV(i, j, level) {\n var cellSize = sizeIJ(level);\n var xLo = i & -cellSize;\n var yLo = j & -cellSize;\n return new Rect(new Interval(stToUV(ijToSTMin(xLo)), stToUV(ijToSTMin(xLo + cellSize))), new Interval(stToUV(ijToSTMin(yLo)), stToUV(ijToSTMin(yLo + cellSize))));\n};\n/**\r\n * Returns the number of steps along the Hilbert curve that this cell is from the first node\r\n * in the S2 hierarchy at our level. (i.e., FromFace(0).ChildBeginAtLevel(ci.Level())).\r\n * This is analogous to Pos(), but for this cell's level.\r\n * The return value is always non-negative.\r\n */\nvar distanceFromBegin = function distanceFromBegin(ci) {\n return ci >> 2n * BigInt(MAX_LEVEL - level(ci)) + 1n;\n};\n/**\r\n * Returns an unnormalized r3 vector from the origin through the center\r\n * of the s2 cell on the sphere.\r\n */\nvar rawPoint = function rawPoint(ci) {\n var _faceSiTi2 = faceSiTi(ci),\n face = _faceSiTi2.face,\n si = _faceSiTi2.si,\n ti = _faceSiTi2.ti;\n return faceSiTiToXYZ(face, si, ti);\n};\n/**\r\n * Returns the center of the s2 cell on the sphere as a Point.\r\n * The maximum directional error in Point (compared to the exact\r\n * mathematical result) is 1.5 * dblEpsilon radians, and the maximum length\r\n * error is 2 * dblEpsilon (the same as Normalize).\r\n */\nvar point = function point(ci) {\n return Point$1.fromVector(rawPoint(ci).normalize());\n};\n/**\r\n * Returns the center of the s2 cell on the sphere as a LatLng.\r\n */\nvar latLng = function latLng(ci) {\n return LatLng.fromPoint(Point$1.fromVector(rawPoint(ci)));\n};\n/**\r\n * Returns the four cells that are adjacent across the cell's four edges.\r\n * Edges 0, 1, 2, 3 are in the down, right, up, left directions in the face space.\r\n * All neighbors are guaranteed to be distinct.\r\n */\nvar edgeNeighbors = function edgeNeighbors(ci) {\n var lvl = level(ci);\n var size = sizeIJ(lvl);\n var _faceIJOrientation4 = faceIJOrientation(ci),\n f = _faceIJOrientation4.f,\n i = _faceIJOrientation4.i,\n j = _faceIJOrientation4.j;\n return [parent(fromFaceIJWrap(f, i, j - size), lvl), parent(fromFaceIJWrap(f, i + size, j), lvl), parent(fromFaceIJWrap(f, i, j + size), lvl), parent(fromFaceIJWrap(f, i - size, j), lvl)];\n};\n/**\r\n * Returns the neighboring cellIDs with vertex closest to this cell at the given level.\r\n * (Normally there are four neighbors, but the closest vertex may only have three neighbors if it is one of\r\n * the 8 cube vertices.)\r\n */\nvar vertexNeighbors = function vertexNeighbors(ci, level) {\n var halfSize = sizeIJ(level + 1);\n var size = halfSize << 1;\n var _faceIJOrientation5 = faceIJOrientation(ci),\n f = _faceIJOrientation5.f,\n i = _faceIJOrientation5.i,\n j = _faceIJOrientation5.j;\n var isame = false;\n var jsame = false;\n var ioffset = 0;\n var joffset = 0;\n if ((i & halfSize) != 0) {\n ioffset = size;\n isame = i + size < MAX_SIZE;\n } else {\n ioffset = -size;\n isame = i - size >= 0;\n }\n if ((j & halfSize) != 0) {\n joffset = size;\n jsame = j + size < MAX_SIZE;\n } else {\n joffset = -size;\n jsame = j - size >= 0;\n }\n var results = [parent(ci, level), parent(fromFaceIJSame(f, i + ioffset, j, isame), level), parent(fromFaceIJSame(f, i, j + joffset, jsame), level)];\n if (isame || jsame) {\n results.push(parent(fromFaceIJSame(f, i + ioffset, j + joffset, isame && jsame), level));\n }\n return results;\n};\n/**\r\n * Returns the first child in a traversal of the children of this cell, in Hilbert curve order.\r\n *\r\n * \tfor (let ci = c.childBegin(); ci != c.childEnd(); ci = ci.next()) {\r\n * \t ...\r\n * \t}\r\n */\nvar childBegin = function childBegin(ci) {\n var ol = lsb(ci);\n return ci - ol + (ol >> 2n);\n};\n/**\r\n * Returns the first cell in a traversal of children a given level deeper than this cell, in\r\n * Hilbert curve order. The given level must be no smaller than the cell's level.\r\n * See ChildBegin for example use.\r\n */\nvar childBeginAtLevel = function childBeginAtLevel(ci, level) {\n return ci - lsb(ci) + lsbForLevel(level);\n};\n/**\r\n * Returns the first cell after a traversal of the children of this cell in Hilbert curve order.\r\n * The returned cell may be invalid.\r\n */\nvar childEnd = function childEnd(ci) {\n var ol = lsb(ci);\n return ci + ol + (ol >> 2n);\n};\n/**\r\n * Returns the first cell after the last child in a traversal of children a given level deeper\r\n * than this cell, in Hilbert curve order.\r\n * The given level must be no smaller than the cell's level.\r\n * The returned cell may be invalid.\r\n */\nvar childEndAtLevel = function childEndAtLevel(ci, level) {\n return ci + lsb(ci) + lsbForLevel(level);\n};\n/**\r\n * Returns the next cell along the Hilbert curve.\r\n * This is expected to be used with ChildBegin and ChildEnd,\r\n * or ChildBeginAtLevel and ChildEndAtLevel.\r\n */\nvar next = function next(ci) {\n return ci + (lsb(ci) << 1n) & SentinelCellID;\n};\n/** Returns the previous cell along the Hilbert curve. */\nvar prev = function prev(ci) {\n return ci - (lsb(ci) << 1n) & SentinelCellID;\n};\n/**\r\n * Returns the next cell along the Hilbert curve, wrapping from last to\r\n * first as necessary. This should not be used with ChildBegin and ChildEnd.\r\n */\nvar nextWrap = function nextWrap(ci) {\n var n = next(ci);\n if (n < WRAP_OFFSET) return n;\n return n - WRAP_OFFSET & SentinelCellID;\n};\n/**\r\n * Returns the previous cell along the Hilbert curve, wrapping around from\r\n * first to last as necessary. This should not be used with ChildBegin and ChildEnd.\r\n */\nvar prevWrap = function prevWrap(ci) {\n var p = prev(ci);\n if (p < WRAP_OFFSET) return p;\n return p + WRAP_OFFSET & SentinelCellID;\n};\n/**\r\n * Advances or retreats the indicated number of steps along the\r\n * Hilbert curve at the current level and returns the new position. The\r\n * position wraps between the first and last faces as necessary.\r\n */\nvar advanceWrap = function advanceWrap(ci, steps) {\n if (steps === 0n) return ci;\n // We clamp the number of steps if necessary to ensure that we do not\n // advance past the End() or before the Begin() of this level.\n var shift = BigInt(2 * (MAX_LEVEL - level(ci)) + 1);\n if (steps < 0n) {\n var min = -(ci >> shift);\n if (steps < min) {\n var wrap = WRAP_OFFSET >> shift;\n steps %= wrap;\n if (steps < min) {\n steps += wrap;\n }\n }\n } else {\n // Unlike Advance(), we don't want to return End(level).\n var max = WRAP_OFFSET - ci >> shift;\n if (steps > max) {\n var _wrap = WRAP_OFFSET >> shift;\n steps %= _wrap;\n if (steps > max) {\n steps -= _wrap;\n }\n }\n }\n // If steps is negative, then shifting it left has undefined behavior.\n // Cast to uint64 for a 2's complement answer.\n return ci + (steps << abs$1(shift));\n};\n/**\r\n * Returns the level of the common ancestor of the two S2 CellIDs.\r\n */\nvar commonAncestorLevel = function commonAncestorLevel(ci, other) {\n var bits = ci ^ other;\n if (bits < lsb(ci)) bits = lsb(ci);\n if (bits < lsb(other)) bits = lsb(other);\n var msbPos = findMSBSetNonZero64(bits);\n if (msbPos > 60) return [0, false];\n return [60 - msbPos >> 1, true];\n};\n/**\r\n * Returns the largest cell with the same RangeMin such that\r\n * RangeMax < limit.RangeMin. It returns limit if no such cell exists.\r\n * This method can be used to generate a small set of CellIDs that covers\r\n * a given range (a tiling). This example shows how to generate a tiling\r\n * for a semi-open range of leaf cells [start, limit):\r\n *\r\n * for id = start.maxTile(limit); id !== limit; id = id.next().maxTile(limit)) { ... }\r\n *\r\n * Note that in general the cells in the tiling will be of different sizes;\r\n * they gradually get larger (near the middle of the range) and then\r\n * gradually get smaller as limit is approached.\r\n */\nvar maxTile = function maxTile(ci, limit) {\n var start = rangeMin(ci);\n if (start >= rangeMin(limit)) return limit;\n if (rangeMax(ci) >= limit) {\n // The cell is too large, shrink it. Note that when generating coverings\n // of CellID ranges, this loop usually executes only once. Also because\n // ci.RangeMin() < limit.RangeMin(), we will always exit the loop by the\n // time we reach a leaf cell.\n while (true) {\n ci = children(ci)[0];\n if (rangeMax(ci) < limit) break;\n }\n return ci;\n }\n // The cell may be too small. Grow it if necessary.\n while (!isFace(ci)) {\n var _parent = immediateParent(ci);\n if (rangeMin(_parent) !== start || rangeMax(_parent) >= limit) break;\n ci = _parent;\n }\n return ci;\n};\n/**\r\n * Advances or retreats the indicated number of steps along the\r\n * Hilbert curve at the current level, and returns the new position. The\r\n * position is never advanced past End() or before Begin().\r\n */\nvar advance = function advance(ci, steps) {\n if (steps === 0n) return ci;\n // We clamp the number of steps if necessary to ensure that we do not\n // advance past the End() or before the Begin() of this level.\n var stepShift = BigInt(2 * (MAX_LEVEL - level(ci)) + 1);\n if (steps < 0n) {\n var minSteps = -(ci >> stepShift);\n if (steps < minSteps) {\n steps = minSteps;\n }\n } else {\n var maxSteps = WRAP_OFFSET + lsb(ci) - ci >> stepShift;\n if (steps > maxSteps) {\n steps = maxSteps;\n }\n }\n return ci + (steps << stepShift);\n};\n/**\r\n * Sorts CellIDs ascending\r\n */\nvar ascending = function ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : 0;\n};\n/**\r\n * Sorts CellIDs descending\r\n */\nvar descending = function descending(a, b) {\n return a > b ? -1 : a < b ? 1 : 0;\n};\n\nvar cellid = {\n __proto__: null,\n SentinelCellID: SentinelCellID,\n face: face$1,\n pos: pos,\n level: level,\n parent: parent,\n immediateParent: immediateParent,\n isFace: isFace,\n valid: valid,\n isLeaf: isLeaf,\n childPosition: childPosition,\n lsb: lsb,\n lsbForLevel: lsbForLevel,\n children: children,\n allNeighbors: allNeighbors,\n rangeMin: rangeMin,\n rangeMax: rangeMax,\n contains: contains,\n intersects: intersects,\n toToken: toToken,\n fromToken: fromToken,\n toString: toString$1,\n fromString: fromString,\n fromFacePosLevel: fromFacePosLevel,\n fromFace: fromFace,\n fromPoint: fromPoint,\n fromLatLng: fromLatLng,\n stToIJ: stToIJ,\n sizeIJ: sizeIJ,\n sizeST: sizeST,\n ijToSTMin: ijToSTMin,\n centerUV: centerUV,\n boundUV: boundUV,\n fromFaceIJ: fromFaceIJ,\n fromFaceIJWrap: fromFaceIJWrap,\n fromFaceIJSame: fromFaceIJSame,\n faceIJOrientation: faceIJOrientation,\n faceSiTi: faceSiTi,\n ijLevelToBoundUV: ijLevelToBoundUV,\n distanceFromBegin: distanceFromBegin,\n rawPoint: rawPoint,\n point: point,\n latLng: latLng,\n edgeNeighbors: edgeNeighbors,\n vertexNeighbors: vertexNeighbors,\n childBegin: childBegin,\n childBeginAtLevel: childBeginAtLevel,\n childEnd: childEnd,\n childEndAtLevel: childEndAtLevel,\n next: next,\n prev: prev,\n nextWrap: nextWrap,\n prevWrap: prevWrap,\n advanceWrap: advanceWrap,\n commonAncestorLevel: commonAncestorLevel,\n maxTile: maxTile,\n advance: advance,\n ascending: ascending,\n descending: descending\n};\n\n/**\r\n * EdgeCrosser allows edges to be efficiently tested for intersection with a\r\n * given fixed edge AB. It is especially efficient when testing for\r\n * intersection with an edge chain connecting vertices v0, v1, v2, ...\r\n *\r\n * Example usage:\r\n *\r\n * ```\r\n * function countIntersections(a: Point, b: Point, edges: Edge[]): number {\r\n * let count = 0;\r\n * const crosser = newEdgeCrosser(a, b);\r\n * for (const edge of edges) {\r\n * if (crosser.crossingSign(edge.first, edge.second) !== DO_NOT_CROSS) {\r\n * count++;\r\n * }\r\n * }\r\n * return count;\r\n * }\r\n * ```\r\n */\nvar EdgeCrosser = /*#__PURE__*/function () {\n /**\r\n * Returns an EdgeCrosser with the fixed edge AB.\r\n *\r\n * @category Constructors\r\n */\n function EdgeCrosser(a, b) {\n var norm = a.pointCross(b);\n this.a = a;\n this.b = b;\n this.aXb = Point$1.fromVector(a.vector.cross(b.vector));\n this.aTangent = Point$1.fromVector(a.vector.cross(norm.vector));\n this.bTangent = Point$1.fromVector(norm.vector.cross(b.vector));\n this.c = new Point$1(0, 0, 0);\n this.acb = CROSS;\n }\n /**\r\n * A convenience constructor that uses AB as the fixed edge,\r\n * and C as the first vertex of the vertex chain (equivalent to calling restartAt(c)).\r\n *\r\n * You don't need to use this or any of the chain functions unless you're trying to\r\n * squeeze out every last drop of performance. Essentially all you are saving is a test\r\n * whether the first vertex of the current edge is the same as the second vertex of the\r\n * previous edge.\r\n *\r\n * @category Constructors\r\n */\n EdgeCrosser.newChainEdgeCrosser = function newChainEdgeCrosser(a, b, c) {\n var e = new EdgeCrosser(a, b);\n e.restartAt(c);\n return e;\n }\n /**\r\n * Reports whether the edge AB intersects the edge CD. If any two\r\n * vertices from different edges are the same, returns MAYBE_CROSS. If either edge\r\n * is degenerate (A == B or C == D), returns either DO_NOT_CROSS or MAYBE_CROSS.\r\n *\r\n * Properties of crossingSign:\r\n * (1) crossingSign(b,a,c,d) == crossingSign(a,b,c,d)\r\n * (2) crossingSign(c,d,a,b) == crossingSign(a,b,c,d)\r\n * (3) crossingSign(a,b,c,d) == MAYBE_CROSS if a==c, a==d, b==c, b==d\r\n * (3) crossingSign(a,b,c,d) == DO_NOT_CROSS or MAYBE_CROSS if a==b or c==d\r\n *\r\n * Note that if you want to check an edge against a chain of other edges,\r\n * it is slightly more efficient to use the single-argument version\r\n * chainCrossingSign below.\r\n */;\n var _proto = EdgeCrosser.prototype;\n _proto.crossingSign = function crossingSign(c, d) {\n if (!c.equals(this.c)) this.restartAt(c);\n return this.chainCrossingSign(d);\n }\n /**\r\n * Reports whether if CrossingSign(c, d) > 0, or AB and CD share a vertex and VertexCrossing(a, b, c, d) is true.\r\n *\r\n * This method extends the concept of a \"crossing\" to the case where AB\r\n * and CD have a vertex in common. The two edges may or may not cross,\r\n * according to the rules defined in VertexCrossing above. The rules\r\n * are designed so that point containment tests can be implemented simply\r\n * by counting edge crossings. Similarly, determining whether one edge\r\n * chain crosses another edge chain can be implemented by counting.\r\n */;\n _proto.edgeOrVertexCrossing = function edgeOrVertexCrossing(c, d) {\n if (!c.equals(this.c)) this.restartAt(c);\n return this.edgeOrVertexChainCrossing(d);\n }\n /**\r\n * Sets the current point of the edge crosser to be c.\r\n * Call this method when your chain 'jumps' to a new place.\r\n * The argument must point to a value that persists until the next call.\r\n */;\n _proto.restartAt = function restartAt(c) {\n this.c = c;\n this.acb = -triageSign(this.a, this.b, this.c);\n }\n /**\r\n * Like crossingSign, but uses the last vertex passed to one of\r\n * the crossing methods (or restartAt) as the first vertex of the current edge.\r\n */;\n _proto.chainCrossingSign = function chainCrossingSign(d) {\n // For there to be an edge crossing, the triangles ACB, CBD, BDA, DAC must\n // all be oriented the same way (CW or CCW). We keep the orientation of ACB\n // as part of our state. When each new point D arrives, we compute the\n // orientation of BDA and check whether it matches ACB. This checks whether\n // the points C and D are on opposite sides of the great circle through AB.\n // Recall that triageSign is invariant with respect to rotating its\n // arguments, i.e. ABD has the same orientation as BDA.\n var bda = triageSign(this.a, this.b, d);\n if (this.acb === -bda && bda !== INDETERMINATE) {\n this.c = d;\n this.acb = -bda;\n return DO_NOT_CROSS;\n }\n return this._crossingSign(d, bda);\n }\n /**\r\n * Like EdgeOrVertexCrossing, but uses the last vertex\r\n * passed to one of the crossing methods (or RestartAt) as the first vertex of the current edge.\r\n */;\n _proto.edgeOrVertexChainCrossing = function edgeOrVertexChainCrossing(d) {\n // We need to copy this.c since it is clobbered by ChainCrossingSign.\n var c = Point$1.fromVector(this.c.vector);\n switch (this.chainCrossingSign(d)) {\n case DO_NOT_CROSS:\n return false;\n case CROSS:\n return true;\n }\n return vertexCrossing(this.a, this.b, c, d);\n }\n /**\r\n * Handle the slow path of crossingSign.\r\n */;\n _proto._crossingSign = function _crossingSign(d, bda) {\n var maxError = (1.5 + 1 / Math.sqrt(3)) * DBL_EPSILON$1;\n // At this point, a very common situation is that A,B,C,D are four points on\n // a line such that AB does not overlap CD. (For example, this happens when\n // a line or curve is sampled finely, or when geometry is constructed by\n // computing the union of S2CellIds.) Most of the time, we can determine\n // that AB and CD do not intersect using the two outward-facing\n // tangents at A and B (parallel to AB) and testing whether AB and CD are on\n // opposite sides of the plane perpendicular to one of these tangents. This\n // is moderately expensive but still much cheaper than expensiveSign.\n // The error in RobustCrossProd is insignificant. The maximum error in\n // the call to CrossProd (i.e., the maximum norm of the error vector) is\n // (0.5 + 1/sqrt(3)) * dblEpsilon. The maximum error in each call to\n // DotProd below is dblEpsilon. (There is also a small relative error\n // term that is insignificant because we are comparing the result against a\n // constant that is very close to zero.)\n if (this.c.vector.dot(this.aTangent.vector) > maxError && d.vector.dot(this.aTangent.vector) > maxError || this.c.vector.dot(this.bTangent.vector) > maxError && d.vector.dot(this.bTangent.vector) > maxError) {\n this.c = d;\n this.acb = -bda;\n return DO_NOT_CROSS;\n }\n // Otherwise, eliminate the cases where two vertices from different edges are\n // equal. (These cases could be handled in the code below, but we would rather\n // avoid calling ExpensiveSign if possible.)\n if (this.a.equals(this.c) || this.a.equals(d) || this.b.equals(this.c) || this.b.equals(d)) {\n this.c = d;\n this.acb = -bda;\n return MAYBE_CROSS;\n }\n // Eliminate the cases where an input edge is degenerate. (Note that in\n // most cases, if CD is degenerate then this method is not even called\n // because acb and bda have different signs.)\n if (this.a.equals(this.b) || this.c.equals(d)) {\n this.c = d;\n this.acb = -bda;\n return DO_NOT_CROSS;\n }\n // Otherwise it's time to break out the big guns.\n if (this.acb === INDETERMINATE) this.acb = -expensiveSign(this.a, this.b, this.c);\n if (bda === INDETERMINATE) bda = expensiveSign(this.a, this.b, d);\n if (bda !== this.acb) {\n this.c = d;\n this.acb = -bda;\n return DO_NOT_CROSS;\n }\n var cbd = -robustSign(this.c, d, this.b);\n if (cbd !== this.acb) {\n this.c = d;\n this.acb = -bda;\n return DO_NOT_CROSS;\n }\n var dac = robustSign(this.c, d, this.a);\n if (dac !== this.acb) {\n this.c = d;\n this.acb = -bda;\n return DO_NOT_CROSS;\n }\n this.c = d;\n this.acb = -bda;\n return CROSS;\n };\n return EdgeCrosser;\n}();\n\nvar CROSS = 0;\nvar MAYBE_CROSS = 1;\nvar DO_NOT_CROSS = 2;\n/**\r\n * Reports whether the edge AB intersects the edge CD.\r\n * If AB crosses CD at a point that is interior to both edges, Cross is returned.\r\n * If any two vertices from different edges are the same it returns MAYBE_CROSS.\r\n * Otherwise it returns DO_NOT_CROSS.\r\n * If either edge is degenerate (A == B or C == D), the return value is MAYBE_CROSS\r\n * if two vertices from different edges are the same and DO_NOT_CROSS otherwise.\r\n *\r\n * Properties of crossingSign:\r\n * (1) crossingSign(b,a,c,d) == crossingSign(a,b,c,d)\r\n * (2) crossingSign(c,d,a,b) == crossingSign(a,b,c,d)\r\n * (3) crossingSign(a,b,c,d) == MAYBE_CROSS if a==c, a==d, b==c, b==d\r\n * (3) crossingSign(a,b,c,d) == DO_NOT_CROSS or MAYBE_CROSS if a==b or c==d\r\n *\r\n * This method implements an exact, consistent perturbation model such\r\n * that no three points are ever considered to be collinear. This means\r\n * that even if you have 4 points A, B, C, D that lie exactly in a line\r\n * (say, around the equator), C and D will be treated as being slightly to\r\n * one side or the other of AB. This is done in a way such that the\r\n * results are always consistent (see RobustSign).\r\n */\nvar crossingSign = function crossingSign(a, b, c, d) {\n var crosser = EdgeCrosser.newChainEdgeCrosser(a, b, c);\n return crosser.chainCrossingSign(d);\n};\n/**\r\n * Reports whether two edges \"cross\" in such a way that point-in-polygon\r\n * containment tests can be implemented by counting the number of edge crossings.\r\n *\r\n * Given two edges AB and CD where at least two vertices are identical\r\n * (i.e. CrossingSign(a,b,c,d) == 0), the basic rule is that a \"crossing\"\r\n * occurs if AB is encountered after CD during a CCW sweep around the shared\r\n * vertex starting from a fixed reference point.\r\n *\r\n * Note that according to this rule, if AB crosses CD then in general CD\r\n * does not cross AB. However, this leads to the correct result when\r\n * counting polygon edge crossings. For example, suppose that A,B,C are\r\n * three consecutive vertices of a CCW polygon. If we now consider the edge\r\n * crossings of a segment BP as P sweeps around B, the crossing number\r\n * changes parity exactly when BP crosses BA or BC.\r\n *\r\n * Useful properties of VertexCrossing (VC):\r\n * (1) VC(a,a,c,d) == VC(a,b,c,c) == false\r\n * (2) VC(a,b,a,b) == VC(a,b,b,a) == true\r\n * (3) VC(a,b,c,d) == VC(a,b,d,c) == VC(b,a,c,d) == VC(b,a,d,c)\r\n * (3) If exactly one of a,b equals one of c,d, then exactly one of\r\n * VC(a,b,c,d) and VC(c,d,a,b) is true\r\n *\r\n * It is an error to call this method with 4 distinct vertices.\r\n */\nvar vertexCrossing = function vertexCrossing(a, b, c, d) {\n if (a.equals(b) || c.equals(d)) return false;\n switch (true) {\n case a.equals(c):\n return b.equals(d) || Point$1.orderedCCW(a.referenceDir(), d, b, a);\n case b.equals(d):\n return Point$1.orderedCCW(b.referenceDir(), c, a, b);\n case a.equals(d):\n return b.equals(c) || Point$1.orderedCCW(a.referenceDir(), c, b, a);\n case b.equals(c):\n return Point$1.orderedCCW(b.referenceDir(), d, a, b);\n }\n return false;\n};\n/**\r\n * Reports if the angle ABC contains its vertex B.\r\n * Containment is defined such that if several polygons tile the region around\r\n * a vertex, then exactly one of those polygons contains that vertex.\r\n * Returns false for degenerate angles of the form ABA.\r\n *\r\n * Note that this method is not sufficient to determine vertex containment in\r\n * polygons with duplicate vertices (such as the polygon ABCADE). Use\r\n * ContainsVertexQuery for such polygons. AngleContainsVertex(a, b, c)\r\n * is equivalent to using ContainsVertexQuery as follows:\r\n *\r\n * ```\r\n * ContainsVertexQuery query(b);\r\n * query.AddEdge(a, -1); // incoming\r\n * query.AddEdge(c, 1); // outgoing\r\n * return query.ContainsVertex() > 0;\r\n * ```\r\n *\r\n * Useful properties of AngleContainsVertex:\r\n * (1) AngleContainsVertex(a,b,a) == false\r\n * (2) AngleContainsVertex(a,b,c) == !AngleContainsVertex(c,b,a) unless a == c\r\n * (3) Given vertices v_1 ... v_k ordered cyclically CCW around vertex b,\r\n * AngleContainsVertex(v_{i+1}, b, v_i) is true for exactly one value of i.\r\n *\r\n * REQUIRES: a != b && b != c\r\n */\nvar angleContainsVertex = function angleContainsVertex(a, b, c) {\n return !Point$1.orderedCCW(b.referenceDir(), c, a, b);\n};\n\n/**\r\n * Represents a closed latitude-longitude rectangle.\r\n *\r\n * @beta incomplete\r\n */\nvar Rect$1 = /*#__PURE__*/function () {\n /**\r\n * Returns a new Rect.\r\n * @category Constructors\r\n */\n function Rect(lat, lng) {\n this.lat = lat;\n this.lng = lng;\n }\n /**\r\n * Returns the empty rectangle.\r\n * @category Constructors\r\n */\n Rect.emptyRect = function emptyRect() {\n return new Rect(Interval.empty(), Interval$1.emptyInterval());\n }\n /**\r\n * Returns the full rectangle.\r\n * @category Constructors\r\n */;\n Rect.fullRect = function fullRect() {\n return new Rect(Rect.validRectLatRange, Rect.validRectLngRange);\n }\n /**\r\n * Constructs a rectangle containing a single point p.\r\n * @category Constructors\r\n */;\n Rect.fromLatLng = function fromLatLng(p) {\n return new Rect(new Interval(radians(p.lat), radians(p.lat)), new Interval$1(radians(p.lng), radians(p.lng)));\n }\n /**\r\n * Constructs a rectangle with the given size and center.\r\n * @category Constructors\r\n */;\n Rect.fromCenterSize = function fromCenterSize(center, size) {\n var half = new LatLng(size.lat / 2, size.lng / 2);\n return Rect.fromLatLng(center).expanded(half);\n }\n /**\r\n * Reports whether this rect equals another rect.\r\n */;\n var _proto = Rect.prototype;\n _proto.equals = function equals(or) {\n return this.lat.equals(or.lat) && this.lng.equals(or.lng);\n }\n /**\r\n * Returns true if the rectangle is valid.\r\n */;\n _proto.isValid = function isValid() {\n return Math.abs(this.lat.lo) <= Math.PI / 2 && Math.abs(this.lat.hi) <= Math.PI / 2 && this.lng.isValid() && this.lat.isEmpty() === this.lng.isEmpty();\n }\n /**\r\n * Reports whether the rectangle is empty.\r\n */;\n _proto.isEmpty = function isEmpty() {\n return this.lat.isEmpty();\n }\n /**\r\n * Reports whether the rectangle is full.\r\n */;\n _proto.isFull = function isFull() {\n return this.lat.equals(Rect.validRectLatRange) && this.lng.isFull();\n }\n /**\r\n * Reports whether the rectangle is a single point.\r\n */;\n _proto.isPoint = function isPoint() {\n return this.lat.lo === this.lat.hi && this.lng.lo === this.lng.hi;\n }\n /**\r\n * Returns the i-th vertex of the rectangle (i = 0,1,2,3) in CCW order.\r\n */;\n _proto.vertex = function vertex(i) {\n var lat, lng;\n switch (i) {\n case 0:\n lat = this.lat.lo;\n lng = this.lng.lo;\n break;\n case 1:\n lat = this.lat.lo;\n lng = this.lng.hi;\n break;\n case 2:\n lat = this.lat.hi;\n lng = this.lng.hi;\n break;\n default:\n // case 4\n lat = this.lat.hi;\n lng = this.lng.lo;\n break;\n }\n return new LatLng(lat, lng);\n }\n /**\r\n * Returns one corner of the rectangle.\r\n */;\n _proto.lo = function lo() {\n return new LatLng(this.lat.lo, this.lng.lo);\n }\n /**\r\n * Returns the other corner of the rectangle.\r\n */;\n _proto.hi = function hi() {\n return new LatLng(this.lat.hi, this.lng.hi);\n }\n /**\r\n * Returns the center of the rectangle.\r\n */;\n _proto.center = function center() {\n return new LatLng(this.lat.center(), this.lng.center());\n }\n /**\r\n * Returns the size of the Rect.\r\n */;\n _proto.size = function size() {\n return new LatLng(this.lat.length(), this.lng.length());\n }\n /**\r\n * Returns the surface area of the Rect.\r\n */;\n _proto.area = function area() {\n if (this.isEmpty()) return 0;\n var capDiff = Math.abs(Math.sin(this.lat.hi) - Math.sin(this.lat.lo));\n return this.lng.length() * capDiff;\n }\n /**\r\n * Increases the size of the rectangle to include the given point.\r\n */;\n _proto.addPoint = function addPoint(ll) {\n if (!ll.isValid()) return this;\n return new Rect(this.lat.addPoint(radians(ll.lat)), this.lng.addPoint(radians(ll.lng)));\n }\n /**\r\n * Returns a rectangle that has been expanded by margin.lat on each side in the latitude direction,\r\n * and by margin.lng on each side in the longitude direction.\r\n */;\n _proto.expanded = function expanded(margin) {\n var lat = this.lat.expanded(radians(margin.lat));\n var lng = this.lng.expanded(radians(margin.lng));\n if (lat.isEmpty() || lng.isEmpty()) return Rect.emptyRect();\n return new Rect(lat.intersection(Rect.validRectLatRange), lng);\n };\n _proto.toString = function toString() {\n return \"[Lo\" + this.lo() + \", Hi\" + this.hi() + \"]\";\n }\n /**\r\n * Returns the rectangle unmodified if it does not include either pole.\r\n * If it includes either pole, returns an expansion of the rectangle along the longitudinal range.\r\n */;\n _proto.polarClosure = function polarClosure() {\n if (this.lat.lo === -Math.PI / 2 || this.lat.hi === Math.PI / 2) {\n return new Rect(this.lat, Interval$1.fullInterval());\n }\n return this;\n }\n /**\r\n * Returns the smallest Rect containing the union of this rectangle and the given rectangle.\r\n */;\n _proto.union = function union(other) {\n return new Rect(this.lat.union(other.lat), this.lng.union(other.lng));\n }\n /**\r\n * Returns the smallest rectangle containing the intersection of this rectangle and the given rectangle.\r\n */;\n _proto.intersection = function intersection(other) {\n var lat = this.lat.intersection(other.lat);\n var lng = this.lng.intersection(other.lng);\n if (lat.isEmpty() || lng.isEmpty()) return Rect.emptyRect();\n return new Rect(lat, lng);\n }\n /**\r\n * Reports whether this rectangle and the other have any points in common.\r\n */;\n _proto.intersects = function intersects(other) {\n return this.lat.intersects(other.lat) && this.lng.intersects(other.lng);\n }\n /**\r\n * Returns a cap that contains the Rect.\r\n */;\n _proto.capBound = function capBound() {\n if (this.isEmpty()) return Cap.emptyCap();\n var poleZ, poleAngle;\n if (this.lat.hi + this.lat.lo < 0) {\n poleZ = -1;\n poleAngle = Math.PI / 2 + this.lat.hi;\n } else {\n poleZ = 1;\n poleAngle = Math.PI / 2 - this.lat.lo;\n }\n var poleCap = Cap.fromCenterAngle(new Point$1(0, 0, poleZ), poleAngle);\n if (remainder(this.lng.hi - this.lng.lo, 2 * Math.PI) >= 0 && this.lng.hi - this.lng.lo < 2 * Math.PI) {\n var midCap = Cap.fromPoint(Point$1.fromLatLng(this.center())).addPoint(Point$1.fromLatLng(this.lo())).addPoint(Point$1.fromLatLng(this.hi()));\n if (midCap.height() < poleCap.height()) return midCap;\n }\n return poleCap;\n }\n /**\r\n * Returns itself.\r\n */;\n _proto.rectBound = function rectBound() {\n return this;\n }\n /**\r\n * Reports whether this Rect contains the other Rect.\r\n */;\n _proto.contains = function contains(other) {\n return this.lat.containsInterval(other.lat) && this.lng.containsInterval(other.lng);\n }\n /**\r\n * Reports whether the given Cell is contained by this Rect.\r\n */;\n _proto.containsCell = function containsCell(c) {\n return this.contains(c.rectBound());\n }\n /**\r\n * Reports whether the given LatLng is within the Rect.\r\n */;\n _proto.containsLatLng = function containsLatLng(ll) {\n if (!ll.isValid()) return false;\n return this.lat.contains(radians(ll.lat)) && this.lng.contains(radians(ll.lng));\n }\n /**\r\n * Reports whether the given Point is within the Rect.\r\n */;\n _proto.containsPoint = function containsPoint(p) {\n return this.containsLatLng(LatLng.fromPoint(p));\n }\n /**\r\n * Computes a covering of the Rect.\r\n */;\n _proto.cellUnionBound = function cellUnionBound() {\n return this.capBound().cellUnionBound();\n }\n /**\r\n * Reports whether the latitude and longitude intervals of the two rectangles are the same up to a small tolerance.\r\n */;\n _proto.approxEqual = function approxEqual(other) {\n return this.lat.approxEqual(other.lat) && this.lng.approxEqual(other.lng);\n }\n /**\r\n * Returns the intersection of longitude 0 with the bisector of an edge on longitude 'lng' and spanning latitude range 'lat'.\r\n */;\n Rect.bisectorIntersection = function bisectorIntersection(lat, lng) {\n lng = Math.abs(lng);\n var latCenter = lat.center();\n var orthoBisector = new LatLng(latCenter - Math.PI / 2, lng);\n if (latCenter < 0) orthoBisector = new LatLng(-latCenter - Math.PI / 2, lng - Math.PI);\n var orthoLng = new Point$1(0, -1, 0);\n return orthoLng.pointCross(Point$1.fromLatLng(orthoBisector));\n }\n /**\r\n * Centroid returns the true centroid of the given Rect multiplied by its\r\n * surface area. The result is not unit length, so you may want to normalize it.\r\n * Note that in general the centroid is *not* at the center of the rectangle, and\r\n * in fact it may not even be contained by the rectangle. (It is the \"center of\r\n * mass\" of the rectangle viewed as subset of the unit sphere, i.e. it is the\r\n * point in space about which this curved shape would rotate.)\r\n *\r\n * The reason for multiplying the result by the rectangle area is to make it\r\n * easier to compute the centroid of more complicated shapes. The centroid\r\n * of a union of disjoint regions can be computed simply by adding their\r\n * Centroid results.\r\n */;\n _proto.centroid = function centroid() {\n // When a sphere is divided into slices of constant thickness by a set\n // of parallel planes, all slices have the same surface area. This\n // implies that the z-component of the centroid is simply the midpoint\n // of the z-interval spanned by the Rect.\n //\n // Similarly, it is easy to see that the (x,y) of the centroid lies in\n // the plane through the midpoint of the rectangle's longitude interval.\n // We only need to determine the distance \"d\" of this point from the\n // z-axis.\n //\n // Let's restrict our attention to a particular z-value. In this\n // z-plane, the Rect is a circular arc. The centroid of this arc\n // lies on a radial line through the midpoint of the arc, and at a\n // distance from the z-axis of\n //\n // r * (sin(alpha) / alpha)\n //\n // where r = sqrt(1-z^2) is the radius of the arc, and \"alpha\" is half\n // of the arc length (i.e., the arc covers longitudes [-alpha, alpha]).\n //\n // To find the centroid distance from the z-axis for the entire\n // rectangle, we just need to integrate over the z-interval. This gives\n //\n // d = Integrate[sqrt(1-z^2)*sin(alpha)/alpha, z1..z2] / (z2 - z1)\n //\n // where [z1, z2] is the range of z-values covered by the rectangle.\n // This simplifies to\n //\n // d = sin(alpha)/(2*alpha*(z2-z1))*(z2*r2 - z1*r1 + theta2 - theta1)\n //\n // where [theta1, theta2] is the latitude interval, z1=sin(theta1),\n // z2=sin(theta2), r1=cos(theta1), and r2=cos(theta2).\n //\n // Finally, we want to return not the centroid itself, but the centroid\n // scaled by the area of the rectangle. The area of the rectangle is\n //\n // A = 2 * alpha * (z2 - z1)\n //\n // which fortunately appears in the denominator of \"d\".\n if (this.isEmpty()) return new Point$1(0, 0, 0);\n var z1 = Math.sin(this.lat.lo);\n var z2 = Math.sin(this.lat.hi);\n var r1 = Math.cos(this.lat.lo);\n var r2 = Math.cos(this.lat.hi);\n var alpha = 0.5 * this.lng.length();\n var r0 = Math.sin(alpha) * (r2 * z2 - r1 * z1 + this.lat.length());\n var lng = this.lng.center();\n var z = alpha * (z2 + z1) * (z2 - z1); // scaled by the area\n return new Point$1(r0 * Math.cos(lng), r0 * Math.sin(lng), z);\n }\n /**\r\n * Reports whether this rectangle intersects the given cell. This is an exact test and may be fairly expensive.\r\n */;\n _proto.intersectsCell = function intersectsCell(c) {\n // First we eliminate the cases where one region completely contains the other.\n // Once these are disposed of, then the regions will intersect if and only if their boundaries intersect.\n if (this.isEmpty()) return false;\n if (this.containsPoint(Point$1.fromVector(rawPoint(c.id)))) return true;\n if (c.containsPoint(Point$1.fromLatLng(this.center()))) return true;\n // Quick rejection test (not required for correctness).\n if (!this.intersects(c.rectBound())) return false;\n // Precompute the cell vertices as points and latitude-longitudes.\n // We also check whether the Cell contains any corner of the rectangle, or vice-versa,\n // since the edge-crossing tests only check the edge interiors.\n var vertices = [];\n var latlngs = [];\n for (var i = 0; i < 4; i++) {\n var vertex = c.vertex(i);\n vertices.push(vertex);\n var latlng = LatLng.fromPoint(vertex);\n latlngs.push(latlng);\n if (this.containsLatLng(latlng)) return true;\n if (c.containsPoint(Point$1.fromLatLng(this.vertex(i)))) return true;\n }\n // Now check whether the boundaries intersect.\n // Unfortunately, a latitude-longitude rectangle does not have straight edges:\n // two edges are curved, and at least one of them is concave.\n for (var _i = 0; _i < 4; _i++) {\n var edgeLng = Interval$1.fromEndpoints(latlngs[_i].lng, latlngs[_i + 1 & 3].lng);\n if (!this.lng.intersects(edgeLng)) continue;\n var a = vertices[_i];\n var b = vertices[_i + 1 & 3];\n if (edgeLng.contains(this.lng.lo) && intersectsLngEdge(a, b, this.lat, this.lng.lo)) {\n return true;\n }\n if (edgeLng.contains(this.lng.hi) && intersectsLngEdge(a, b, this.lat, this.lng.hi)) {\n return true;\n }\n if (intersectsLatEdge(a, b, this.lat.lo, this.lng)) {\n return true;\n }\n if (intersectsLatEdge(a, b, this.lat.hi, this.lng)) {\n return true;\n }\n }\n return false;\n };\n return Rect;\n}();\nRect$1.validRectLatRange = /*#__PURE__*/new Interval(-Math.PI / 2, Math.PI / 2);\nRect$1.validRectLngRange = /*#__PURE__*/Interval$1.fullInterval();\n/**\r\n * Reports whether the edge AB intersects the given edge of constant latitude.\r\n * Requires the points to have unit length.\r\n */\nvar intersectsLatEdge = function intersectsLatEdge(a, b, lat, lng) {\n // Unfortunately, lines of constant latitude are curves on the sphere.\n // They can intersect a straight edge in 0, 1, or 2 points.\n // First, compute the normal to the plane AB that points vaguely north.\n var z = a.vector.cross(b.vector).normalize();\n if (z.z < 0) z = z.mul(-1);\n // Extend this to an orthonormal frame (x,y,z) where x is the direction\n // where the great circle through AB achieves its maximum latitude.\n var y = z.cross(Point$1.fromCoords(0, 0, 1).vector).normalize();\n var x = y.cross(z);\n // Compute the angle \"theta\" from the x-axis (in the x-y plane defined\n // above) where the great circle intersects the given line of latitude.\n var sinLat = Math.sin(radians(lat));\n if (Math.abs(sinLat) >= x.z) {\n // The great circle does not reach the given latitude.\n return false;\n }\n var cosTheta = sinLat / x.z;\n var sinTheta = Math.sqrt(1 - cosTheta * cosTheta);\n var theta = Math.atan2(sinTheta, cosTheta);\n // The candidate intersection points are located +/- theta in the x-y plane.\n // For an intersection to be valid, we need to check that the intersection\n // point is contained in the interior of the edge AB and also that it is\n // contained within the given longitude interval \"lng\".\n // Compute the range of theta values spanned by the edge AB.\n var abTheta = Interval$1.fromPointPair(Math.atan2(a.vector.dot(y), a.vector.dot(x)), Math.atan2(b.vector.dot(y), b.vector.dot(x)));\n if (abTheta.contains(theta)) {\n // Check if the intersection point is also in the given lng interval.\n var isect = x.mul(cosTheta).add(y.mul(sinTheta));\n if (lng.contains(Math.atan2(isect.y, isect.x))) {\n return true;\n }\n }\n if (abTheta.contains(-theta)) {\n // Check if the other intersection point is also in the given lng interval.\n var _isect = x.mul(cosTheta).sub(y.mul(sinTheta));\n if (lng.contains(Math.atan2(_isect.y, _isect.x))) {\n return true;\n }\n }\n return false;\n};\n/**\r\n * Reports whether the edge AB intersects the given edge of constant longitude.\r\n * Requires the points to have unit length.\r\n */\nvar intersectsLngEdge = function intersectsLngEdge(a, b, lat, lng) {\n // The nice thing about edges of constant longitude is that they are straight lines on the sphere (geodesics).\n return crossingSign(a, b, Point$1.fromLatLng(new LatLng(lat.lo, lng)), Point$1.fromLatLng(new LatLng(lat.hi, lng))) === CROSS;\n};\n\n/**\r\n * This file implements functions for various S2 measurements.\r\n */\n/**\r\n * A Metric is a measure for cells. It is used to describe the shape and size\r\n * of cells. They are useful for deciding which cell level to use in order to\r\n * satisfy a given condition (e.g. that cell vertices must be no further than\r\n * \"x\" apart). You can use the Value(level) method to compute the corresponding\r\n * length or area on the unit sphere for cells at a given level. The minimum\r\n * and maximum bounds are valid for cells at all levels, but they may be\r\n * somewhat conservative for very large cells (e.g. face cells).\r\n */\nvar Metric = /*#__PURE__*/function () {\n /**\r\n * Returns a new Metric.\r\n * @category Constructors\r\n */\n function Metric(dim, deriv) {\n this.dim = dim;\n this.deriv = deriv;\n }\n /**\r\n * Returns the value of the metric at the given level.\r\n */\n var _proto = Metric.prototype;\n _proto.value = function value(level) {\n return ldexp(this.deriv, -this.dim * level);\n }\n /**\r\n * Returns the minimum level such that the metric is at most the given value, or MaxLevel (30) if there is no such level.\r\n *\r\n * For example, MinLevel(0.1) returns the minimum level such that all cell diagonal lengths are 0.1 or smaller.\r\n * The returned value is always a valid level.\r\n */;\n _proto.minLevel = function minLevel(val) {\n if (val <= 0) return MAX_LEVEL; // missinglink <0 to <=0\n var level = -(ilogb(val / this.deriv) >> this.dim - 1);\n if (level > MAX_LEVEL) level = MAX_LEVEL;\n if (level < 0) level = 0;\n return level || 0;\n }\n /**\r\n * Returns the maximum level such that the metric is at least the given value, or zero if there is no such level.\r\n *\r\n * For example, MaxLevel(0.1) returns the maximum level such that all cells have a minimum width of 0.1 or larger.\r\n * The returned value is always a valid level.\r\n */;\n _proto.maxLevel = function maxLevel(val) {\n if (val <= 0) return MAX_LEVEL;\n var level = ilogb(this.deriv / val) >> this.dim - 1;\n if (level > MAX_LEVEL) level = MAX_LEVEL;\n if (level < 0) level = 0;\n return level || 0;\n }\n /**\r\n * Returns the level at which the metric has approximately the given value.\r\n * The return value is always a valid level.\r\n * For example, AvgEdgeMetric.ClosestLevel(0.1) returns the level at which the average cell edge length is approximately 0.1.\r\n */;\n _proto.closestLevel = function closestLevel(val) {\n var x = Math.SQRT2;\n if (this.dim === 2) x = 2;\n return this.minLevel(x * val);\n };\n return Metric;\n}();\n\n/**\r\n * The width of geometric figure is defined as the distance between two\r\n * parallel bounding lines in a given direction. For cells, the minimum\r\n * width is always attained between two opposite edges, and the maximum\r\n * width is attained between two opposite vertices. However, for our\r\n * purposes we redefine the width of a cell as the perpendicular distance\r\n * between a pair of opposite edges. A cell therefore has two widths, one\r\n * in each direction. The minimum width according to this definition agrees\r\n * with the classic geometric one, but the maximum width is different. (The\r\n * maximum geometric width corresponds to MaxDiag defined below.)\r\n *\r\n * The average width in both directions for all cells at level k is approximately\r\n * AvgWidthMetric.Value(k).\r\n *\r\n * The width is useful for bounding the minimum or maximum distance from a\r\n * point on one edge of a cell to the closest point on the opposite edge.\r\n * For example, this is useful when growing regions by a fixed distance.\r\n */\nvar MinWidthMetric = /*#__PURE__*/new Metric(1, 2 * Math.SQRT2 / 3);\nvar AvgEdgeMetric = /*#__PURE__*/new Metric(1, 1.459213746386106062);\nvar AvgAreaMetric = /*#__PURE__*/new Metric(2, 4 * Math.PI / 6);\n\n/**\r\n * Returns the distance of point X from line segment AB.\r\n * The points are expected to be normalized. The result is very accurate for small\r\n * distances but may have some numerical error if the distance is large\r\n * (approximately pi/2 or greater). The case A == B is handled correctly.\r\n */\nvar distanceFromSegment = function distanceFromSegment(x, a, b) {\n return angle$1(_updateMinDistance(x, a, b, 0, true).dist);\n};\n/**\r\n * Checks if the distance from X to the edge AB is less\r\n * than minDist, and if so, returns the updated value and true.\r\n * The case A == B is handled correctly.\r\n *\r\n * Use this method when you want to compute many distances and keep track of\r\n * the minimum. It is significantly faster than using distanceFromSegment\r\n * because (1) using ChordAngle is much faster than Angle, and (2) it\r\n * can save a lot of work by not actually computing the distance when it is\r\n * obviously larger than the current minimum.\r\n */\nvar updateMinDistance = function updateMinDistance(x, a, b, minDist) {\n return _updateMinDistance(x, a, b, minDist, false);\n};\n/**\r\n * Checks if the distance from X to the edge AB is greater\r\n * than maxDist, and if so, returns the updated value and true.\r\n * Otherwise it returns false. The case A == B is handled correctly.\r\n */\nvar updateMaxDistance = function updateMaxDistance(x, a, b, maxDist) {\n var dist = maxChordAngle(Point$1.chordAngleBetweenPoints(x, a), Point$1.chordAngleBetweenPoints(x, b));\n if (dist > RIGHT_CHORDANGLE) {\n var _updateMinDistance2 = _updateMinDistance(Point$1.fromVector(x.vector.mul(-1)), a, b, dist, true);\n dist = _updateMinDistance2.dist;\n dist = STRAIGHT_CHORDANGLE - dist;\n }\n if (maxDist < dist) return {\n dist: dist,\n less: true\n };\n return {\n dist: maxDist,\n less: false\n };\n};\n/**\r\n * Returns the point along the edge AB that is closest to the point X.\r\n * The fractional distance of this point along the edge AB can be obtained\r\n * using distanceFraction.\r\n *\r\n * This requires that all points are unit length.\r\n */\nvar project = function project(x, a, b) {\n var aXb = a.pointCross(b);\n // Find the closest point to X along the great circle through AB.\n var v = x.vector.sub(aXb.vector.mul(x.vector.dot(aXb.vector) / aXb.vector.norm2()));\n // If this point is on the edge AB, then it's the closest point.\n if (sign(aXb, a, Point$1.fromVector(v)) && sign(Point$1.fromVector(v), b, aXb)) return Point$1.fromVector(v.normalize());\n // Otherwise, the closest point is either A or B.\n if (x.vector.sub(a.vector).norm2() <= x.vector.sub(b.vector).norm2()) return a;\n return b;\n};\n/**\r\n * Returns the point X along the line segment AB whose\r\n * distance from A is the angle ax.\r\n */\nvar interpolateAtDistance = function interpolateAtDistance(ax, a, b) {\n var aRad = ax;\n // Use PointCross to compute the tangent vector at A towards B. The\n // result is always perpendicular to A, even if A=B or A=-B, but it is not\n // necessarily unit length. (We effectively normalize it below.)\n var normal = a.pointCross(b);\n var tangent = normal.vector.cross(a.vector);\n // Now compute the appropriate linear combination of A and \"tangent\". With\n // infinite precision the result would always be unit length, but we\n // normalize it anyway to ensure that the error is within acceptable bounds.\n // (Otherwise errors can build up when the result of one interpolation is\n // fed into another interpolation.)\n return Point$1.fromVector(a.vector.mul(Math.cos(aRad)).add(tangent.mul(Math.sin(aRad) / tangent.norm())).normalize());\n};\n/**\r\n * Returns the maximum error in the result of\r\n * updateMinDistance (and the associated functions such as\r\n * updateMinInteriorDistance, isDistanceLess, etc), assuming that all\r\n * input points are normalized to within the bounds guaranteed by r3.Vector's\r\n * normalize. The error can be added or subtracted from an ChordAngle\r\n * using its expanded method.\r\n */\nvar minUpdateDistanceMaxError = function minUpdateDistanceMaxError(dist) {\n // There are two cases for the maximum error in updateMinDistance(),\n // depending on whether the closest point is interior to the edge.\n return Math.max(minUpdateInteriorDistanceMaxError(dist), maxPointError(dist));\n};\n/**\r\n * Returns the maximum error in the result of\r\n * updateMinInteriorDistance, assuming that all input points are normalized\r\n * to within the bounds guaranteed by Point's normalize. The error can be added\r\n * or subtracted from an ChordAngle using its expanded method.\r\n *\r\n * Note that accuracy goes down as the distance approaches 0 degrees or 180\r\n * degrees (for different reasons). Near 0 degrees the error is acceptable\r\n * for all practical purposes (about 1.2e-15 radians ~= 8 nanometers). For\r\n * exactly antipodal points the maximum error is quite high (0.5 meters),\r\n * but this error drops rapidly as the points move away from antipodality\r\n * (approximately 1 millimeter for points that are 50 meters from antipodal,\r\n * and 1 micrometer for points that are 50km from antipodal).\r\n *\r\n\n * TODO: Currently the error bound does not hold for edges whose endpoints\r\n * are antipodal to within about 1e-15 radians (less than 1 micron). This could\r\n * be fixed by extending PointCross to use higher precision when necessary.\r\n */\nvar minUpdateInteriorDistanceMaxError = function minUpdateInteriorDistanceMaxError(dist) {\n // If a point is more than 90 degrees from an edge, then the minimum\n // distance is always to one of the endpoints, not to the edge interior.\n if (dist >= RIGHT_CHORDANGLE) return 0.0;\n // This bound includes all sources of error, assuming that the input points\n // are normalized. a and b are components of chord length that are\n // perpendicular and parallel to a plane containing the edge respectively.\n var b = Math.min(1.0, 0.5 * dist);\n var a = Math.sqrt(b * (2 - b));\n return ((2.5 + 2 * Math.sqrt(3) + 8.5 * a) * a + (2 + 2 * Math.sqrt(3) / 3 + 6.5 * (1 - b)) * b + (23 + 16 / Math.sqrt(3)) * DBL_EPSILON$1) * DBL_EPSILON$1;\n};\n/**\r\n * Computes the distance from a point X to a line segment AB,\r\n * and if either the distance was less than the given minDist, or alwaysUpdate is\r\n * true, the value and whether it was updated are returned.\r\n */\nvar _updateMinDistance = function _updateMinDistance(x, a, b, minDist, alwaysUpdate) {\n var _interiorDist = interiorDist(x, a, b, minDist, alwaysUpdate),\n d = _interiorDist.dist,\n ok = _interiorDist.less;\n if (ok) {\n // Minimum distance is attained along the edge interior.\n return {\n dist: d,\n less: true\n };\n }\n // Otherwise the minimum distance is to one of the endpoints.\n var xa2 = x.vector.sub(a.vector).norm2();\n var xb2 = x.vector.sub(b.vector).norm2();\n var dist = Math.min(xa2, xb2);\n if (!alwaysUpdate && dist >= minDist) return {\n dist: minDist,\n less: false\n };\n return {\n dist: dist,\n less: true\n };\n};\n/**\r\n * Returns the shortest distance from point x to edge ab, assuming\r\n * that the closest point to X is interior to AB. If the closest point is not\r\n * interior to AB, interiorDist returns (minDist, false). If alwaysUpdate is set to\r\n * false, the distance is only updated when the value exceeds certain the given minDist.\r\n */\nvar interiorDist = function interiorDist(x, a, b, minDist, alwaysUpdate) {\n // Chord distance of x to both end points a and b.\n var xa2 = x.vector.sub(a.vector).norm2();\n var xb2 = x.vector.sub(b.vector).norm2();\n // The closest point on AB could either be one of the two vertices (the\n // vertex case) or in the interior (the interior case). Let C = A x B.\n // If X is in the spherical wedge extending from A to B around the axis\n // through C, then we are in the interior case. Otherwise we are in the\n // vertex case.\n //\n // Check whether we might be in the interior case. For this to be true, XAB\n // and XBA must both be acute angles. Checking this condition exactly is\n // expensive, so instead we consider the planar triangle ABX (which passes\n // through the sphere's interior). The planar angles XAB and XBA are always\n // less than the corresponding spherical angles, so if we are in the\n // interior case then both of these angles must be acute.\n //\n // We check this by computing the squared edge lengths of the planar\n // triangle ABX, and testing whether angles XAB and XBA are both acute using\n // the law of cosines:\n //\n // | XA^2 - XB^2 | < AB^2 (*)\n //\n // This test must be done conservatively (taking numerical errors into\n // account) since otherwise we might miss a situation where the true minimum\n // distance is achieved by a point on the edge interior.\n //\n // There are two sources of error in the expression above (*). The first is\n // that points are not normalized exactly; they are only guaranteed to be\n // within 2 * dblEpsilon of unit length. Under the assumption that the two\n // sides of (*) are nearly equal, the total error due to normalization errors\n // can be shown to be at most\n //\n // 2 * dblEpsilon * (XA^2 + XB^2 + AB^2) + 8 * dblEpsilon ^ 2 .\n //\n // The other source of error is rounding of results in the calculation of (*).\n // Each of XA^2, XB^2, AB^2 has a maximum relative error of 2.5 * dblEpsilon,\n // plus an additional relative error of 0.5 * dblEpsilon in the final\n // subtraction which we further bound as 0.25 * dblEpsilon * (XA^2 + XB^2 +\n // AB^2) for convenience. This yields a final error bound of\n //\n // 4.75 * dblEpsilon * (XA^2 + XB^2 + AB^2) + 8 * dblEpsilon ^ 2 .\n var ab2 = a.vector.sub(b.vector).norm2();\n var maxError = 4.75 * DBL_EPSILON$1 * (xa2 + xb2 + ab2) + 8 * DBL_EPSILON$1 * DBL_EPSILON$1;\n if (Math.abs(xa2 - xb2) >= ab2 + maxError) return {\n dist: minDist,\n less: false\n };\n // The minimum distance might be to a point on the edge interior. Let R\n // be closest point to X that lies on the great circle through AB. Rather\n // than computing the geodesic distance along the surface of the sphere,\n // instead we compute the \"chord length\" through the sphere's interior.\n //\n // The squared chord length XR^2 can be expressed as XQ^2 + QR^2, where Q\n // is the point X projected onto the plane through the great circle AB.\n // The distance XQ^2 can be written as (X.C)^2 / |C|^2 where C = A x B.\n // We ignore the QR^2 term and instead use XQ^2 as a lower bound, since it\n // is faster and the corresponding distance on the Earth's surface is\n // accurate to within 1% for distances up to about 1800km.\n var c = a.pointCross(b);\n var c2 = c.vector.norm2();\n var xDotC = x.vector.dot(c.vector);\n var xDotC2 = xDotC * xDotC;\n if (!alwaysUpdate && xDotC2 > c2 * minDist) {\n // The closest point on the great circle AB is too far away. We need to\n // test this using \">\" rather than \">=\" because the actual minimum bound\n // on the distance is (xDotC2 / c2), which can be rounded differently\n // than the (more efficient) multiplicative test above.\n return {\n dist: minDist,\n less: false\n };\n }\n // Otherwise we do the exact, more expensive test for the interior case.\n // This test is very likely to succeed because of the conservative planar\n // test we did initially.\n //\n // TODO: Ensure that the errors in test are accurately reflected in the\n // minUpdateInteriorDistanceMaxError.\n var cx = c.vector.cross(x.vector);\n if (a.vector.sub(x.vector).dot(cx) >= 0 || b.vector.sub(x.vector).dot(cx) <= 0) {\n return {\n dist: minDist,\n less: false\n };\n }\n // Compute the squared chord length XR^2 = XQ^2 + QR^2 (see above).\n // This calculation has good accuracy for all chord lengths since it\n // is based on both the dot product and cross product (rather than\n // deriving one from the other). However, note that the chord length\n // representation itself loses accuracy as the angle approaches π.\n var qr = 1 - Math.sqrt(cx.norm2() / c2);\n var dist = xDotC2 / c2 + qr * qr;\n if (!alwaysUpdate && dist >= minDist) {\n return {\n dist: minDist,\n less: false\n };\n }\n return {\n dist: dist,\n less: true\n };\n};\n\nvar CENTER_POINT = /*#__PURE__*/Point$1.fromCoords(1.0, 0, 0);\n/**\r\n * Cap represents a disc-shaped region defined by a center and radius.\r\n * Technically this shape is called a \"spherical cap\" (rather than disc)\r\n * because it is not planar; the cap represents a portion of the sphere that\r\n * has been cut off by a plane. The boundary of the cap is the circle defined\r\n * by the intersection of the sphere and the plane. For containment purposes,\r\n * the cap is a closed set, i.e. it contains its boundary.\r\n *\r\n * For the most part, you can use a spherical cap wherever you would use a\r\n * disc in planar geometry. The radius of the cap is measured along the\r\n * surface of the sphere (rather than the straight-line distance through the\r\n * interior). Thus a cap of radius π/2 is a hemisphere, and a cap of radius\r\n * π covers the entire sphere.\r\n *\r\n * The center is a point on the surface of the unit sphere. (Hence the need for\r\n * it to be of unit length.)\r\n *\r\n * A cap can also be defined by its center point and height. The height is the\r\n * distance from the center point to the cutoff plane. There is also support for\r\n * \"empty\" and \"full\" caps, which contain no points and all points respectively.\r\n *\r\n * Here are some useful relationships between the cap height (h), the cap\r\n * radius (r), the maximum chord length from the cap's center (d), and the\r\n * radius of cap's base (a).\r\n *\r\n * h = 1 - Math.cos(r)\r\n * = 2 * Math.sin^2(r/2)\r\n * d^2 = 2 * h\r\n * = a^2 + h^2\r\n *\r\n * The zero value of Cap is an invalid cap. Use emptyCap to get a valid empty cap.\r\n *\r\n * @beta incomplete\r\n */\nvar Cap = /*#__PURE__*/function () {\n /**\r\n * Returns a new Cap.\r\n * @category Constructors\r\n */\n function Cap(center, radius) {\n this.center = center;\n this.rad = radius;\n }\n /**\r\n * Constructs a cap containing a single point.\r\n * @category Constructors\r\n */\n Cap.fromPoint = function fromPoint(p) {\n return Cap.fromCenterChordAngle(p, 0);\n }\n /**\r\n * Constructs a cap with the given center and angle.\r\n * @category Constructors\r\n */;\n Cap.fromCenterAngle = function fromCenterAngle(center, angle) {\n return Cap.fromCenterChordAngle(center, fromAngle(angle));\n }\n /**\r\n * Constructs a cap where the angle is expressed as an ChordAngle.\r\n * This constructor is more efficient than using an Angle.\r\n * @category Constructors\r\n */;\n Cap.fromCenterChordAngle = function fromCenterChordAngle(center, radius) {\n return new Cap(center, radius);\n }\n /**\r\n * Constructs a cap with the given center and height.\r\n * A negative height yields an empty cap; a height of 2 or more yields a full cap.\r\n * The center should be unit length.\r\n * @category Constructors\r\n */;\n Cap.fromCenterHeight = function fromCenterHeight(center, height) {\n return Cap.fromCenterChordAngle(center, fromSquaredLength(2 * height));\n }\n /**\r\n * Constructs a cap with the given center and surface area.\r\n * Note that the area can also be interpreted as the solid angle subtended by the cap (because the sphere has unit radius).\r\n * A negative area yields an empty cap; an area of 4*π or more yields a full cap.\r\n * @category Constructors\r\n */;\n Cap.fromCenterArea = function fromCenterArea(center, area) {\n return Cap.fromCenterChordAngle(center, fromSquaredLength(area / Math.PI));\n }\n /**\r\n * Constructs a copy of cap.\r\n * @category Constructors\r\n */;\n Cap.fromCap = function fromCap(c) {\n return new Cap(Point$1.fromVector(c.center.vector), c.rad);\n }\n /**\r\n * Returns a cap that contains no points.\r\n */;\n Cap.emptyCap = function emptyCap() {\n return Cap.fromCenterChordAngle(CENTER_POINT, NEGATIVE_CHORDANGLE);\n }\n /**\r\n * Returns a cap that contains all points.\r\n */;\n Cap.fullCap = function fullCap() {\n return Cap.fromCenterChordAngle(CENTER_POINT, STRAIGHT_CHORDANGLE);\n }\n /**\r\n * Reports whether the Cap is considered valid.\r\n */;\n var _proto = Cap.prototype;\n _proto.isValid = function isValid() {\n return this.center.vector.isUnit() && this.rad <= STRAIGHT_CHORDANGLE;\n }\n /**\r\n * Reports whether the cap is empty, i.e. it contains no points.\r\n */;\n _proto.isEmpty = function isEmpty() {\n return this.rad < 0;\n }\n /**\r\n * Reports whether the cap is full, i.e. it contains all points.\r\n */;\n _proto.isFull = function isFull() {\n return this.rad == STRAIGHT_CHORDANGLE;\n }\n /**\r\n * Returns the cap's center point.\r\n */;\n _proto.centerPoint = function centerPoint() {\n return this.center;\n }\n /**\r\n * Returns the height of the cap.\r\n * This is the distance from the center point to the cutoff plane.\r\n */;\n _proto.height = function height() {\n return 0.5 * this.rad;\n }\n /**\r\n * Returns the cap radius as an Angle.\r\n * Note that the cap angle is stored internally as a ChordAngle, so this method requires a trigonometric operation and may yield a slightly different result than the value passed to Cap.fromCenterAngle.\r\n */;\n _proto.radius = function radius() {\n return angle$1(this.rad);\n }\n /**\r\n * Returns the surface area of the Cap on the unit sphere.\r\n */;\n _proto.area = function area() {\n return 2.0 * Math.PI * Math.max(0, this.height());\n }\n /**\r\n * Reports whether this cap contains the other.\r\n */;\n _proto.contains = function contains(other) {\n if (this.isFull() || other.isEmpty()) return true;\n return this.rad >= add(Point$1.chordAngleBetweenPoints(this.center, other.center), other.rad);\n }\n /**\r\n * Reports whether this cap intersects the other cap.\r\n */;\n _proto.intersects = function intersects(other) {\n if (this.isEmpty() || other.isEmpty()) return false;\n return add(this.rad, other.rad) >= Point$1.chordAngleBetweenPoints(this.center, other.center);\n }\n /**\r\n * Reports whether this cap's interior intersects the other cap.\r\n */;\n _proto.interiorIntersects = function interiorIntersects(other) {\n if (this.rad <= 0 || other.isEmpty()) return false;\n return add(this.rad, other.rad) > Point$1.chordAngleBetweenPoints(this.center, other.center);\n }\n /**\r\n * Reports whether the cap intersects the cell.\r\n */;\n _proto.intersectsCell = function intersectsCell(cell) {\n // If the cap contains any cell vertex, return true.\n var vertices = [];\n for (var k = 0; k < 4; k++) {\n vertices[k] = cell.vertex(k);\n if (this.containsPoint(vertices[k])) return true;\n }\n return this._intersects(cell, vertices);\n }\n /**\r\n * Reports whether the cap intersects any point of the cell excluding\r\n * its vertices (which are assumed to already have been checked).\r\n */;\n _proto._intersects = function _intersects(cell, vertices) {\n // If the cap is a hemisphere or larger, the cell and the complement of the cap\n // are both convex. Therefore since no vertex of the cell is contained, no other\n // interior point of the cell is contained either.\n if (this.rad >= RIGHT_CHORDANGLE) return false;\n // We need to check for empty caps due to the center check just below.\n if (this.isEmpty()) return false;\n // Optimization: return true if the cell contains the cap center. This allows half\n // of the edge checks below to be skipped.\n if (cell.containsPoint(this.center)) return true;\n // At this point we know that the cell does not contain the cap center, and the cap\n // does not contain any cell vertex. The only way that they can intersect is if the\n // cap intersects the interior of some edge.\n var sin2Angle = sin2(this.rad);\n for (var k = 0; k < 4; k++) {\n var edge = cell.edge(k).vector;\n var dot = this.center.vector.dot(edge);\n if (dot > 0) {\n // The center is in the interior half-space defined by the edge. We do not need\n // to consider these edges, since if the cap intersects this edge then it also\n // intersects the edge on the opposite side of the cell, because the center is\n // not contained with the cell.\n continue;\n }\n // The Norm2() factor is necessary because \"edge\" is not normalized.\n if (dot * dot > sin2Angle * edge.norm2()) return false;\n // Otherwise, the great circle containing this edge intersects the interior of the cap. We just\n // need to check whether the point of closest approach occurs between the two edge endpoints.\n var dir = edge.cross(this.center.vector);\n if (dir.dot(vertices[k].vector) < 0 && dir.dot(vertices[k + 1 & 3].vector) > 0) {\n return true;\n }\n }\n return false;\n }\n /**\r\n * Reports whether this cap contains the point.\r\n */;\n _proto.containsPoint = function containsPoint(p) {\n return Point$1.chordAngleBetweenPoints(this.center, p) <= this.rad;\n }\n /** Reports whether the cap contains the given cell. */;\n _proto.containsCell = function containsCell(cell) {\n // If the cap does not contain all cell vertices, return false.\n var vertices = [];\n for (var k = 0; k < 4; k++) {\n vertices[k] = cell.vertex(k);\n if (!this.containsPoint(vertices[k])) return false;\n }\n // Otherwise, return true if the complement of the cap does not intersect the cell.\n return !this.complement()._intersects(cell, vertices);\n }\n /**\r\n * Reports whether the point is within the interior of this cap.\r\n */;\n _proto.interiorContainsPoint = function interiorContainsPoint(p) {\n return this.isFull() || Point$1.chordAngleBetweenPoints(this.center, p) < this.rad;\n }\n /**\r\n * Returns the complement of the interior of the cap. A cap and its complement have the same boundary but do not share any interior points. The complement operator is not a bijection because the complement of a singleton cap (containing a single point) is the same as the complement of an empty cap.\r\n * @returns {Cap}\r\n */;\n _proto.complement = function complement() {\n if (this.isFull()) return Cap.emptyCap();\n if (this.isEmpty()) return Cap.fullCap();\n return Cap.fromCenterChordAngle(Point$1.fromVector(this.center.vector.mul(-1)), sub(STRAIGHT_CHORDANGLE, this.rad));\n }\n /**\r\n * Returns a bounding spherical cap. This is not guaranteed to be exact.\r\n */;\n _proto.capBound = function capBound() {\n return this;\n }\n /**\r\n * Returns a bounding latitude-longitude rectangle. The bounds are not guaranteed to be tight.\r\n */;\n _proto.rectBound = function rectBound() {\n if (this.isEmpty()) return Rect$1.emptyRect();\n var capAngle = this.radius();\n var allLongitudes = false;\n var lat = new Interval(LatLng.latitude(this.center) - capAngle, LatLng.latitude(this.center) + capAngle);\n var lng = Interval$1.fullInterval();\n // Check whether cap includes the south pole.\n if (lat.lo <= -Math.PI / 2) {\n lat.lo = -Math.PI / 2;\n allLongitudes = true;\n }\n // Check whether cap includes the north pole.\n if (lat.hi >= Math.PI / 2) {\n lat.hi = Math.PI / 2;\n allLongitudes = true;\n }\n if (!allLongitudes) {\n // Compute the range of longitudes covered by the cap. We use the law\n // of sines for spherical triangles. Consider the triangle ABC where\n // A is the north pole, B is the center of the cap, and C is the point\n // of tangency between the cap boundary and a line of longitude. Then\n // C is a right angle, and letting a,b,c denote the sides opposite A,B,C,\n // we have sin(a)/sin(A) = sin(c)/sin(C), or sin(A) = sin(a)/sin(c).\n // Here \"a\" is the cap angle, and \"c\" is the colatitude (90 degrees\n // minus the latitude). This formula also works for negative latitudes.\n //\n // The formula for sin(a) follows from the relationship h = 1 - cos(a).\n var sinA = sin(this.rad);\n var sinC = Math.cos(LatLng.latitude(this.center));\n if (sinA <= sinC) {\n var angleA = Math.asin(sinA / sinC);\n lng.lo = remainder(LatLng.longitude(this.center) - angleA, Math.PI * 2);\n lng.hi = remainder(LatLng.longitude(this.center) + angleA, Math.PI * 2);\n }\n }\n return new Rect$1(lat, lng);\n }\n /**\r\n * Reports whether this cap is equal to the other cap.\r\n */;\n _proto.equals = function equals(other) {\n return this.rad === other.rad && this.center.equals(other.center) || this.isEmpty() && other.isEmpty() || this.isFull() && other.isFull();\n }\n /**\r\n * Reports whether this cap is equal to the other cap within the given tolerance.\r\n */;\n _proto.approxEqual = function approxEqual(other) {\n var epsilon = 1e-14;\n var r2 = this.rad;\n var otherR2 = other.rad;\n return this.center.approxEqual(other.center) && Math.abs(r2 - otherR2) <= epsilon || this.isEmpty() && otherR2 <= epsilon || other.isEmpty() && r2 <= epsilon || this.isFull() && otherR2 >= 2 - epsilon || other.isFull() && r2 >= 2 - epsilon;\n }\n /**\r\n * Increases the cap if necessary to include the given point.\r\n * If this cap is empty, then the center is set to the point with a zero height\r\n * p must be unit-length.\r\n */;\n _proto.addPoint = function addPoint(p) {\n if (this.isEmpty()) return new Cap(p, 0);\n // After calling cap.AddPoint(p), cap.Contains(p) must be true. However\n // we don't need to do anything special to achieve this because Contains()\n // does exactly the same distance calculation that we do here.\n var newRad = Point$1.chordAngleBetweenPoints(this.center, p);\n if (newRad > this.rad) this.rad = newRad;\n return this;\n }\n /**\r\n * Increases the cap height if necessary to include the other cap. If this cap is empty, it is set to the other cap.\r\n */;\n _proto.addCap = function addCap(other) {\n if (this.isEmpty()) return other;\n if (other.isEmpty()) return this;\n // We round up the distance to ensure that the cap is actually contained.\n var dist = add(Point$1.chordAngleBetweenPoints(this.center, other.center), other.rad);\n var newRad = expanded(dist, DBL_EPSILON$1 * dist);\n if (newRad > this.rad) this.rad = newRad;\n return this;\n }\n /**\r\n * Returns a new cap expanded by the given angle. If the cap is empty, it returns an empty cap.\r\n */;\n _proto.expanded = function expanded(distance) {\n if (this.isEmpty()) return Cap.emptyCap();\n return Cap.fromCenterChordAngle(this.center, add(this.rad, fromAngle(distance)));\n };\n _proto.toString = function toString() {\n return \"[Center=\" + this.center.vector + \", Radius=\" + degrees(this.radius()) + \"]\";\n }\n /**\r\n * Converts an Angle into the height of the cap.\r\n */;\n Cap.radiusToHeight = function radiusToHeight(r) {\n if (r < 0) return NEGATIVE_CHORDANGLE;\n if (r >= Math.PI) return RIGHT_CHORDANGLE;\n return 0.5 * fromAngle(r);\n }\n /**\r\n * Computes a covering of the Cap.\r\n * In general the covering consists of at most 4 cells except for very large caps, which may need up to 6 cells.\r\n * The output is not sorted.\r\n */;\n _proto.cellUnionBound = function cellUnionBound() {\n // TODO(roberts): The covering could be made quite a bit tighter by mapping\n // the cap to a rectangle in (i,j)-space and finding a covering for that.\n // Find the maximum level such that the cap contains at most one cell vertex\n // and such that CellID.AppendVertexNeighbors() can be called.\n var level = MinWidthMetric.maxLevel(this.radius()) - 1;\n // If level < 0, more than three face cells are required.\n if (level < 0) {\n var cellIDs = [];\n for (var face = 0; face < 6; face++) {\n cellIDs[face] = fromFace(face);\n }\n return cellIDs;\n }\n // The covering consists of the 4 cells at the given level that share the\n // cell vertex that is closest to the cap center.\n return vertexNeighbors(fromPoint(this.center), level);\n }\n /**\r\n * Returns the true centroid of the cap multiplied by its surface area.\r\n * The result lies on the ray from the origin through the cap's center, but it is not unit length.\r\n * Note that if you just want the \"surface centroid\", i.e. the normalized result, then it is simpler to call CENTER_POINT.\r\n *\r\n * The reason for multiplying the result by the cap area is to make it easier to compute the centroid of more complicated shapes.\r\n * The centroid of a union of disjoint regions can be computed simply by adding their centroid results.\r\n * Caveat: for caps that contain a single point (i.e., zero radius), this method always returns the origin (0, 0, 0).\r\n * This is because shapes with no area don't affect the centroid of a union whose total area is positive.\r\n */;\n _proto.centroid = function centroid() {\n if (this.isEmpty()) return new Point$1(0, 0, 0);\n var r = 1 - 0.5 * this.height();\n return Point$1.fromVector(this.center.vector.mul(r * this.area()));\n }\n /**\r\n * Returns the smallest cap which encloses this cap and another cap.\r\n */;\n _proto.union = function union(oc) {\n var c = this;\n // If the other cap is larger, swap c and other for the rest of the computations.\n if (c.rad < oc.rad) {\n var _ref = [oc, c];\n c = _ref[0];\n oc = _ref[1];\n }\n if (c.isFull() || oc.isEmpty()) return c;\n var cRadius = c.radius();\n var otherRadius = oc.radius();\n var distance = c.center.distance(oc.center);\n if (cRadius >= distance + otherRadius) return c;\n var resRadius = 0.5 * (distance + cRadius + otherRadius);\n var resCenter = interpolateAtDistance(0.5 * (distance - cRadius + otherRadius), c.center, oc.center);\n return Cap.fromCenterAngle(resCenter, resRadius);\n };\n return Cap;\n}();\n\n/**\r\n * Returns the area of triangle ABC. This method combines two different\r\n * algorithms to get accurate results for both large and small triangles.\r\n * The maximum error is about 5e-15 (about 0.25 square meters on the Earth's\r\n * surface), the same as GirardArea below, but unlike that method it is\r\n * also accurate for small triangles. Example: when the true area is 100\r\n * square meters, PointArea yields an error about 1 trillion times smaller than\r\n * GirardArea.\r\n *\r\n * All points should be unit length, and no two points should be antipodal.\r\n * The area is always positive.\r\n */\nvar pointArea = function pointArea(a, b, c) {\n var sa = b.stableAngle(c);\n var sb = c.stableAngle(a);\n var sc = a.stableAngle(b);\n var s = 0.5 * (sa + sb + sc);\n if (s >= 3e-4) {\n var dmin = s - Math.max(sa, sb, sc);\n if (dmin < 1e-2 * s * s * s * s * s) {\n var area = girardArea(a, b, c);\n if (dmin < s * 0.1 * (area + 5e-15)) return area;\n }\n }\n return 4 * Math.atan(Math.sqrt(Math.max(0.0, Math.tan(0.5 * s) * Math.tan(0.5 * (s - sa)) * Math.tan(0.5 * (s - sb)) * Math.tan(0.5 * (s - sc)))));\n};\n/**\r\n * Returns the area of the triangle computed using Girard's formula.\r\n * All points should be unit length, and no two points should be antipodal.\r\n *\r\n * This method is about twice as fast as PointArea() but has poor relative\r\n * accuracy for small triangles. The maximum error is about 5e-15 (about\r\n * 0.25 square meters on the Earth's surface) and the average error is about\r\n * 1e-15. These bounds apply to triangles of any size, even as the maximum\r\n * edge length of the triangle approaches 180 degrees. But note that for\r\n * such triangles, tiny perturbations of the input points can change the\r\n * true mathematical area dramatically.\r\n */\nvar girardArea = function girardArea(a, b, c) {\n var ab = a.pointCross(b);\n var bc = b.pointCross(c);\n var ac = a.pointCross(c);\n var area = ab.vector.angle(ac.vector) - ab.vector.angle(bc.vector) + bc.vector.angle(ac.vector);\n if (area < 0) area = 0;\n return area;\n};\n/**\r\n * Returns a positive value for counterclockwise triangles and a negative\r\n * value otherwise (similar to PointArea).\r\n */\nvar signedArea = function signedArea(a, b, c) {\n return robustSign(a, b, c) * pointArea(a, b, c);\n};\n/**\r\n * Returns the exterior angle at vertex B in the triangle ABC. The\r\n * return value is positive if ABC is counterclockwise and negative otherwise.\r\n * If you imagine an ant walking from A to B to C, this is the angle that the\r\n * ant turns at vertex B (positive = left = CCW, negative = right = CW).\r\n * This quantity is also known as the \"geodesic curvature\" at B.\r\n *\r\n * Ensures that TurnAngle(a,b,c) == -TurnAngle(c,b,a) for all distinct\r\n * a,b,c. The result is undefined if (a == b || b == c), but is either\r\n * -Pi or Pi if (a == c). All points should be normalized.\r\n */\nvar turnAngle = function turnAngle(a, b, c) {\n var angle = a.pointCross(b).vector.angle(b.pointCross(c).vector);\n return robustSign(a, b, c) === COUNTERCLOCKWISE ? angle : -angle;\n};\n\nvar POLE_MIN_LAT = /*#__PURE__*/Math.asin(/*#__PURE__*/Math.sqrt(1.0 / 3)) - 0.5 * DBL_EPSILON$1;\n/**\r\n * Cell is an S2 region object that represents a cell.\r\n * Unlike CellIDs, it supports efficient containment and intersection tests.\r\n * However, it is also a more expensive representation.\r\n */\nvar Cell = /*#__PURE__*/function () {\n /**\r\n * Returns a new Cell.\r\n * @category Constructors\r\n */\n function Cell(face, level, orientation, id, uv) {\n this.face = face;\n this.level = level;\n this.orientation = orientation;\n this.id = id;\n this.uv = uv;\n }\n /**\r\n * Constructs a Cell corresponding to the given CellID.\r\n * @category Constructors\r\n */\n Cell.fromCellID = function fromCellID(id) {\n var _cellid$faceIJOrienta = faceIJOrientation(id),\n f = _cellid$faceIJOrienta.f,\n i = _cellid$faceIJOrienta.i,\n j = _cellid$faceIJOrienta.j,\n orientation = _cellid$faceIJOrienta.orientation;\n var level$1 = level(id);\n return new Cell(f, level$1, orientation, id, ijLevelToBoundUV(i, j, level$1));\n }\n /**\r\n * Constructs a cell for the given Point.\r\n * @category Constructors\r\n */;\n Cell.fromPoint = function fromPoint$1(p) {\n return Cell.fromCellID(fromPoint(p));\n }\n /**\r\n * Constructs a cell for the given LatLng.\r\n * @category Constructors\r\n */;\n Cell.fromLatLng = function fromLatLng$1(ll) {\n return Cell.fromCellID(fromLatLng(ll));\n }\n /**\r\n * Returns the face opposite the given face.\r\n */;\n Cell.oppositeFace = function oppositeFace(face) {\n return (face + 3) % 6;\n }\n /**\r\n * Returns whether this Cell is a leaf or not.\r\n */;\n var _proto = Cell.prototype;\n _proto.isLeaf = function isLeaf() {\n return this.level === MAX_LEVEL;\n }\n /**\r\n * Returns the edge length of this cell in (i,j)-space.\r\n */;\n _proto.sizeIJ = function sizeIJ$1() {\n return sizeIJ(this.level);\n }\n /**\r\n * Returns the edge length of this cell in (s,t)-space.\r\n */;\n _proto.sizeST = function sizeST$1() {\n return sizeST(this.level);\n }\n /**\r\n * Returns the k-th vertex of the cell (k = 0,1,2,3) in CCW order\r\n * (lower left, lower right, upper right, upper left in the UV plane).\r\n */;\n _proto.vertex = function vertex(k) {\n var vertex = this.uv.vertices()[k];\n return Point$1.fromVector(faceUVToXYZ(this.face, vertex.x, vertex.y).normalize());\n }\n /**\r\n * Returns the inward-facing normal of the great circle passing through\r\n * the CCW ordered edge from vertex k to vertex k+1 (mod 4) (for k = 0,1,2,3).\r\n */;\n _proto.edge = function edge(k) {\n switch (k) {\n case 0:\n return Point$1.fromVector(vNorm(this.face, this.uv.y.lo).normalize());\n // Bottom\n case 1:\n return Point$1.fromVector(uNorm(this.face, this.uv.x.hi).normalize());\n // Right\n case 2:\n return Point$1.fromVector(vNorm(this.face, this.uv.y.hi).mul(-1.0).normalize());\n // Top\n default:\n return Point$1.fromVector(uNorm(this.face, this.uv.x.lo).mul(-1.0).normalize());\n // Left\n }\n }\n /**\r\n * Returns the bounds of this cell in (u,v)-space.\r\n */;\n _proto.boundUV = function boundUV() {\n return this.uv;\n }\n /**\r\n * Returns the direction vector corresponding to the center in\r\n * (s,t)-space of the given cell. This is the point at which the cell is\r\n * divided into four subcells; it is not necessarily the centroid of the\r\n * cell in (u,v)-space or (x,y,z)-space\r\n */;\n _proto.center = function center() {\n return Point$1.fromVector(rawPoint(this.id).normalize());\n }\n /**\r\n * Returns the four direct children of this cell in traversal order\r\n * and returns true. If this is a leaf cell, or the children could not be created,\r\n * false is returned.\r\n * The C++ method is called Subdivide.\r\n */;\n _proto.children = function children() {\n var children = [];\n if (isLeaf(this.id)) return children;\n // Compute the cell midpoint in uv-space.\n var uvMid = centerUV(this.id);\n // Create four children with the appropriate bounds.\n var cid = childBegin(this.id);\n for (var pos = 0; pos < 4; pos++) {\n var child = new Cell(this.face, this.level + 1, this.orientation ^ posToOrientation[pos], cid, Rect.empty());\n // We want to split the cell in half in u and v. To decide which\n // side to set equal to the midpoint value, we look at cell's (i,j)\n // position within its parent. The index for i is in bit 1 of ij.\n var ij = posToIJ[this.orientation][pos];\n var i = ij >> 1;\n var j = ij & 1;\n if (i === 1) {\n child.uv.x.hi = this.uv.x.hi;\n child.uv.x.lo = uvMid.x;\n } else {\n child.uv.x.lo = this.uv.x.lo;\n child.uv.x.hi = uvMid.x;\n }\n if (j === 1) {\n child.uv.y.hi = this.uv.y.hi;\n child.uv.y.lo = uvMid.y;\n } else {\n child.uv.y.lo = this.uv.y.lo;\n child.uv.y.hi = uvMid.y;\n }\n cid = next(cid);\n children.push(child);\n }\n return children;\n }\n /**\r\n * Returns the area of this cell as accurately as possible.\r\n */;\n _proto.exactArea = function exactArea() {\n var v0 = this.vertex(0);\n var v1 = this.vertex(1);\n var v2 = this.vertex(2);\n var v3 = this.vertex(3);\n return pointArea(v0, v1, v2) + pointArea(v0, v2, v3);\n }\n /**\r\n * Returns the approximate area of this cell. This method is accurate\r\n * to within 3% percent for all cell sizes and accurate to within 0.1% for cells\r\n * at level 5 or higher (i.e. squares 350km to a side or smaller on the Earth's\r\n * surface). It is moderately cheap to compute.\r\n */;\n _proto.approxArea = function approxArea() {\n if (this.level < 2) return this.averageArea();\n // Compute the approximate area of the cell when projected perpendicular to its normal.\n var flatArea = 0.5 * this.vertex(2).vector.sub(this.vertex(0).vector).cross(this.vertex(3).vector.sub(this.vertex(1).vector)).norm();\n // Compensate for the curvature of the cell surface by pretending\n // that the cell is shaped like a spherical cap.\n return flatArea * 2 / (1 + Math.sqrt(1 - Math.min(1 / Math.PI * flatArea, 1)));\n }\n /**\r\n * Returns the average area of cells at the level of this cell.\r\n * This is accurate to within a factor of 1.7.\r\n */;\n _proto.averageArea = function averageArea() {\n return AvgAreaMetric.value(this.level);\n }\n /**\r\n * Reports whether the intersection of this cell and the other cell is not nil.\r\n */;\n _proto.intersectsCell = function intersectsCell(oc) {\n return intersects(this.id, oc.id);\n }\n /**\r\n * Reports whether this cell contains the other cell.\r\n */;\n _proto.containsCell = function containsCell(oc) {\n return contains(this.id, oc.id);\n }\n /**\r\n * Computes a covering of the Cell.\r\n */;\n _proto.cellUnionBound = function cellUnionBound() {\n return this.capBound().cellUnionBound();\n }\n /**\r\n * Returns the latitude of the cell vertex in radians given by (i,j),\r\n * where i and j indicate the Hi (1) or Lo (0) corner.\r\n */;\n _proto.latitude = function latitude(i, j) {\n var u, v;\n switch (true) {\n case i === 0 && j === 0:\n u = this.uv.x.lo;\n v = this.uv.y.lo;\n break;\n case i === 0 && j === 1:\n u = this.uv.x.lo;\n v = this.uv.y.hi;\n break;\n case i === 1 && j === 0:\n u = this.uv.x.hi;\n v = this.uv.y.lo;\n break;\n case i === 1 && j === 1:\n u = this.uv.x.hi;\n v = this.uv.y.hi;\n break;\n default:\n throw new Error('i and/or j is out of bounds');\n }\n return LatLng.latitude(Point$1.fromVector(faceUVToXYZ(this.face, u, v)));\n }\n /**\r\n * Returns the longitude of the cell vertex in radians given by (i,j),\r\n * where i and j indicate the Hi (1) or Lo (0) corner.\r\n */;\n _proto.longitude = function longitude(i, j) {\n var u, v;\n switch (true) {\n case i === 0 && j === 0:\n u = this.uv.x.lo;\n v = this.uv.y.lo;\n break;\n case i === 0 && j === 1:\n u = this.uv.x.lo;\n v = this.uv.y.hi;\n break;\n case i === 1 && j === 0:\n u = this.uv.x.hi;\n v = this.uv.y.lo;\n break;\n case i === 1 && j === 1:\n u = this.uv.x.hi;\n v = this.uv.y.hi;\n break;\n default:\n throw new Error('i and/or j is out of bounds');\n }\n return LatLng.longitude(Point$1.fromVector(faceUVToXYZ(this.face, u, v)));\n }\n /**\r\n * Returns the bounding rectangle of this cell.\r\n */;\n _proto.rectBound = function rectBound() {\n if (this.level > 0) {\n var u = this.uv.x.lo + this.uv.x.hi;\n var v = this.uv.y.lo + this.uv.y.hi;\n var i, j;\n if (uAxis(this.face).z === 0) {\n i = u < 0 ? 1 : 0;\n } else {\n i = u > 0 ? 1 : 0;\n }\n if (vAxis(this.face).z === 0) {\n j = v < 0 ? 1 : 0;\n } else {\n j = v > 0 ? 1 : 0;\n }\n var lat = Interval.fromPoint(this.latitude(i, j)).addPoint(this.latitude(1 - i, 1 - j));\n var lng = Interval$1.emptyInterval().addPoint(this.longitude(i, 1 - j)).addPoint(this.longitude(1 - i, j));\n return new Rect$1(lat, lng).expanded(new LatLng(2 * DBL_EPSILON$1, 2 * DBL_EPSILON$1)).polarClosure();\n }\n var bound;\n switch (this.face) {\n case 0:\n bound = new Rect$1(new Interval(-Math.PI / 4, Math.PI / 4), new Interval$1(-Math.PI / 4, Math.PI / 4));\n break;\n case 1:\n bound = new Rect$1(new Interval(-Math.PI / 4, Math.PI / 4), new Interval$1(Math.PI / 4, 3 * Math.PI / 4));\n break;\n case 2:\n bound = new Rect$1(new Interval(POLE_MIN_LAT, Math.PI / 2), Interval$1.fullInterval());\n break;\n case 3:\n bound = new Rect$1(new Interval(-Math.PI / 4, Math.PI / 4), new Interval$1(3 * Math.PI / 4, -3 * Math.PI / 4));\n break;\n case 4:\n bound = new Rect$1(new Interval(-Math.PI / 4, Math.PI / 4), new Interval$1(-3 * Math.PI / 4, -Math.PI / 4));\n break;\n default:\n bound = new Rect$1(new Interval(-Math.PI / 2, -POLE_MIN_LAT), Interval$1.fullInterval());\n }\n return bound.expanded(new LatLng(DBL_EPSILON$1, 0));\n }\n /**\r\n * Returns the bounding cap of this cell.\r\n */;\n _proto.capBound = function capBound() {\n var cap = Cap.fromPoint(Point$1.fromVector(faceUVToXYZ(this.face, this.uv.center().x, this.uv.center().y).normalize()));\n for (var k = 0; k < 4; k++) {\n cap = cap.addPoint(this.vertex(k));\n }\n return cap;\n }\n /**\r\n * Reports whether this cell contains the given point.\r\n * Note that unlike Loop/Polygon, a Cell is considered to be a closed set.\r\n * This means that a point on a Cell's edge or vertex belongs to the Cell and the relevant adjacent Cells too.\r\n *\r\n * If you want every point to be contained by exactly one Cell, you will need to convert the Cell to a Loop.\r\n */;\n _proto.containsPoint = function containsPoint(p) {\n // We can't just call XYZtoFaceUV, because for points that lie on the\n // boundary between two faces (i.e. u or v is +1/-1) we need to return\n // true for both adjacent cells.\n //\n // We can get away with not checking the face if the point matches the face of\n // the cell here because, for the 4 faces adjacent to c.face, p will be\n // projected outside the range of ([-1,1]x[-1,1]) and thus can't intersect the\n // cell bounds (except on the face boundary which we want).\n //\n // For the face opposite c.face, the sign of the UV coordinates of P will be\n // flipped so it will automatically fall outside the cell boundary as no cells\n // cross the origin.\n var _faceXYZToUV = faceXYZToUV(this.face, p.vector),\n x = _faceXYZToUV[0],\n y = _faceXYZToUV[1],\n ok = _faceXYZToUV[2];\n if (!ok) return false;\n // Expand the (u,v) bound to ensure that\n //\n // CellFromPoint(p).ContainsPoint(p)\n //\n // is always true. To do this, we need to account for the error when\n // converting from (u,v) coordinates to (s,t) coordinates. In the\n // normal case the total error is at most dblEpsilon.\n return this.uv.expandedByMargin(DBL_EPSILON$1).containsPoint(new Point(x, y));\n }\n /**\r\n * Returns the squared chord distance from point P to the\r\n * given corner vertex specified by the Hi or Lo values of each.\r\n */;\n _proto.vertexChordDist2 = function vertexChordDist2(p, xHi, yHi) {\n var x = this.uv.x.lo;\n var y = this.uv.y.lo;\n if (xHi) x = this.uv.x.hi;\n if (yHi) y = this.uv.y.hi;\n return Point$1.chordAngleBetweenPoints(p, Point$1.fromCoords(x, y, 1));\n }\n /**\r\n * Reports whether a point P is closer to the interior of the specified\r\n * Cell edge (either the lower or upper edge of the Cell) or to the endpoints.\r\n */;\n _proto.uEdgeIsClosest = function uEdgeIsClosest(p, vHi) {\n var u0 = this.uv.x.lo;\n var u1 = this.uv.x.hi;\n var v = this.uv.y.lo;\n if (vHi) v = this.uv.y.hi;\n var dir0 = new Vector(v * v + 1, -u0 * v, -u0);\n var dir1 = new Vector(v * v + 1, -u1 * v, -u1);\n return p.vector.dot(dir0) > 0 && p.vector.dot(dir1) < 0;\n }\n /**\r\n * Reports whether a point P is closer to the interior of the specified\r\n * Cell edge (either the right or left edge of the Cell) or to the endpoints.\r\n */;\n _proto.vEdgeIsClosest = function vEdgeIsClosest(p, uHi) {\n var v0 = this.uv.y.lo;\n var v1 = this.uv.y.hi;\n var u = this.uv.x.lo;\n if (uHi) u = this.uv.x.hi;\n var dir0 = new Vector(-u * v0, u * u + 1, -v0);\n var dir1 = new Vector(-u * v1, u * u + 1, -v1);\n return p.vector.dot(dir0) > 0 && p.vector.dot(dir1) < 0;\n }\n /**\r\n * Reports the distance from a Point P to a given Cell edge. The point\r\n * P is given by its dot product, and the uv edge by its normal in the\r\n * given coordinate value.\r\n */;\n Cell.edgeDistance = function edgeDistance(ij, uv) {\n var pq2 = ij * ij / (1 + uv * uv);\n var qr = 1 - Math.sqrt(1 - pq2);\n return fromSquaredLength(pq2 + qr * qr);\n }\n /**\r\n * Reports the distance from the given point to the interior of\r\n * the cell if toInterior is true or to the boundary of the cell otherwise.\r\n */;\n _proto.distanceInternal = function distanceInternal(targetXYZ, toInterior) {\n var target = Point$1.fromVector(faceXYZtoUVW(this.face, targetXYZ.vector));\n var dir00 = target.x - target.z * this.uv.x.lo;\n var dir01 = target.x - target.z * this.uv.x.hi;\n var dir10 = target.y - target.z * this.uv.y.lo;\n var dir11 = target.y - target.z * this.uv.y.hi;\n var inside = true;\n if (dir00 < 0) {\n inside = false;\n if (this.vEdgeIsClosest(target, false)) return Cell.edgeDistance(-dir00, this.uv.x.lo);\n }\n if (dir01 > 0) {\n inside = false;\n if (this.vEdgeIsClosest(target, true)) return Cell.edgeDistance(dir01, this.uv.x.hi);\n }\n if (dir10 < 0) {\n inside = false;\n if (this.uEdgeIsClosest(target, false)) return Cell.edgeDistance(-dir10, this.uv.y.lo);\n }\n if (dir11 > 0) {\n inside = false;\n if (this.uEdgeIsClosest(target, true)) return Cell.edgeDistance(dir11, this.uv.y.hi);\n }\n if (inside) return toInterior ? 0 : minChordAngle(Cell.edgeDistance(-dir00, this.uv.x.lo), Cell.edgeDistance(dir01, this.uv.x.hi), Cell.edgeDistance(-dir10, this.uv.y.lo), Cell.edgeDistance(dir11, this.uv.y.hi));\n return minChordAngle(this.vertexChordDist2(target, false, false), this.vertexChordDist2(target, true, false), this.vertexChordDist2(target, false, true), this.vertexChordDist2(target, true, true));\n }\n /**\r\n * Reports the distance from the cell to the given point. Returns zero if\r\n * the point is inside the cell.\r\n */;\n _proto.distance = function distance(target) {\n return this.distanceInternal(target, true);\n }\n /**\r\n * Reports the maximum distance from the cell (including its interior) to the\r\n * given point.\r\n */;\n _proto.maxDistance = function maxDistance(target) {\n var targetUVW = Point$1.fromVector(faceXYZtoUVW(this.face, target.vector));\n var maxDist = maxChordAngle(this.vertexChordDist2(targetUVW, false, false), this.vertexChordDist2(targetUVW, true, false), this.vertexChordDist2(targetUVW, false, true), this.vertexChordDist2(targetUVW, true, true));\n if (maxDist <= RIGHT_CHORDANGLE) return maxDist;\n return STRAIGHT_CHORDANGLE - this.distance(Point$1.fromVector(target.vector.mul(-1)));\n }\n /**\r\n * Reports the distance from the cell boundary to the given point.\r\n */;\n _proto.boundaryDistance = function boundaryDistance(target) {\n return this.distanceInternal(target, false);\n }\n /**\r\n * Returns the minimum distance from the cell to the given edge AB. Returns\r\n * zero if the edge intersects the cell interior.\r\n */;\n _proto.distanceToEdge = function distanceToEdge(a, b) {\n var minDist = minChordAngle(this.distance(a), this.distance(b));\n if (minDist === 0) return minDist;\n var crosser = EdgeCrosser.newChainEdgeCrosser(a, b, this.vertex(3));\n for (var i = 0; i < 4; i++) {\n if (crosser.chainCrossingSign(this.vertex(i)) !== DO_NOT_CROSS) return 0;\n }\n for (var _i = 0; _i < 4; _i++) {\n minDist = updateMinDistance(this.vertex(_i), a, b, minDist).dist;\n }\n return minDist;\n }\n /**\r\n * Returns the maximum distance from the cell (including its interior)\r\n * to the given edge AB.\r\n */;\n _proto.maxDistanceToEdge = function maxDistanceToEdge(a, b) {\n var maxDist = maxChordAngle(this.maxDistance(a), this.maxDistance(b));\n if (maxDist <= RIGHT_CHORDANGLE) return maxDist;\n return STRAIGHT_CHORDANGLE - this.distanceToEdge(Point$1.fromVector(a.vector.mul(-1)), Point$1.fromVector(b.vector.mul(-1)));\n }\n /**\r\n * Returns the minimum distance from this cell to the given cell.\r\n * It returns zero if one cell contains the other.\r\n */;\n _proto.distanceToCell = function distanceToCell(target) {\n if (this.face === target.face && this.uv.intersects(target.uv)) return 0;\n var va = [];\n var vb = [];\n for (var i = 0; i < 4; i++) {\n va.push(this.vertex(i));\n vb.push(target.vertex(i));\n }\n var minDist = infChordAngle();\n for (var _i2 = 0; _i2 < 4; _i2++) {\n for (var j = 0; j < 4; j++) {\n minDist = updateMinDistance(va[_i2], vb[j], vb[j + 1 & 3], minDist).dist;\n minDist = updateMinDistance(vb[_i2], va[j], va[j + 1 & 3], minDist).dist;\n }\n }\n return minDist;\n }\n /**\r\n * Returns the maximum distance from the cell (including its\r\n * interior) to the given target cell.\r\n */;\n _proto.maxDistanceToCell = function maxDistanceToCell(target) {\n var antipodalUV = new Rect(target.uv.y, target.uv.x);\n if (this.face === Cell.oppositeFace(target.face) && this.uv.intersects(antipodalUV)) {\n return STRAIGHT_CHORDANGLE;\n }\n var va = [];\n var vb = [];\n for (var i = 0; i < 4; i++) {\n va.push(this.vertex(i));\n vb.push(target.vertex(i));\n }\n var maxDist = NEGATIVE_CHORDANGLE;\n for (var _i3 = 0; _i3 < 4; _i3++) {\n for (var j = 0; j < 4; j++) {\n maxDist = updateMaxDistance(va[_i3], vb[j], vb[j + 1 & 3], maxDist).dist;\n maxDist = updateMaxDistance(vb[_i3], va[j], va[j + 1 & 3], maxDist).dist;\n }\n }\n return maxDist;\n };\n return Cell;\n}();\n\n/**\r\n * A special label indicating that the ContentsIterator done is true.\r\n */\nvar CELL_INDEX_DONE_CONTENTS = -1;\n/**\r\n * An iterator that seeks and iterates over a set of non-overlapping leaf cell\r\n * ranges that cover the entire sphere. The indexed (CellID, label) pairs that\r\n * intersect the current leaf cell range can be visited using\r\n * CellIndexContentsIterator (see below).\r\n */\nvar CellIndexRangeIterator = /*#__PURE__*/function () {\n /**\r\n * Creates an iterator for the given CellIndex.\r\n * The iterator is initially *unpositioned*; you must call a positioning\r\n * method such as begin() or seek() before accessing its contents.\r\n */\n function CellIndexRangeIterator(index, nonEmpty) {\n if (nonEmpty === void 0) {\n nonEmpty = false;\n }\n this.nonEmpty = nonEmpty;\n this.rangeNodes = index.rangeNodes;\n this.pos = 0;\n }\n /**\r\n * Reports the CellID of the start of the current range of leaf CellIDs.\r\n * If done is true, this returns the last possible CellID. This property means\r\n * that most loops do not need to test done explicitly.\r\n */\n var _proto = CellIndexRangeIterator.prototype;\n _proto.startID = function startID() {\n return this.rangeNodes[this.pos].startID;\n }\n /**\r\n * Reports the non-inclusive end of the current range of leaf CellIDs.\r\n * This assumes the iterator is not done.\r\n */;\n _proto.limitID = function limitID() {\n return this.rangeNodes[this.pos + 1].startID;\n }\n /**\r\n * Reports if no (CellID, label) pairs intersect this range.\r\n * Also returns true if done() is true.\r\n */;\n _proto.isEmpty = function isEmpty() {\n return this.rangeNodes[this.pos].contents === CELL_INDEX_DONE_CONTENTS;\n }\n /**\r\n * Positions the iterator at the first range of leaf cells (if any).\r\n */;\n _proto.begin = function begin() {\n this.pos = 0;\n while (this.nonEmpty && this.isEmpty() && !this.done()) {\n this.pos++;\n }\n }\n /**\r\n * Internal prev that doesn't check nonEmpty to prevent unwanted recursion.\r\n */;\n _proto.internalPrev = function internalPrev() {\n if (this.pos === 0) {\n return false;\n }\n this.pos--;\n return true;\n }\n /**\r\n * Internal prev for non-empty iterator.\r\n */;\n _proto.nonEmptyPrev = function nonEmptyPrev() {\n while (this.internalPrev()) {\n if (!this.isEmpty()) {\n return true;\n }\n }\n // Return the iterator to its original position.\n if (this.isEmpty() && !this.done()) {\n this.next();\n }\n return false;\n }\n /**\r\n * Positions the iterator at the previous entry and reports whether it was\r\n * not already positioned at the beginning.\r\n */;\n _proto.prev = function prev() {\n if (this.nonEmpty) {\n return this.nonEmptyPrev();\n }\n return this.internalPrev();\n }\n /**\r\n * Advances the iterator to the next range of leaf cells.\r\n * This assumes the iterator is not done.\r\n */;\n _proto.next = function next() {\n this.pos++;\n while (this.nonEmpty && this.isEmpty() && !this.done()) {\n this.pos++;\n }\n }\n /**\r\n * Reports if advancing would leave it positioned on a valid range. If the\r\n * value would not be valid, the positioning is not changed.\r\n */;\n _proto.advance = function advance(n) {\n // Note that the last element of rangeNodes is a sentinel value.\n if (n >= this.rangeNodes.length - 1 - this.pos) {\n return false;\n }\n this.pos += n;\n return true;\n }\n /**\r\n * Positions the iterator so that done is true.\r\n */;\n _proto.finish = function finish() {\n // Note that the last element of rangeNodes is a sentinel value.\n this.pos = this.rangeNodes.length - 1;\n }\n /**\r\n * Reports if the iterator is positioned beyond the last valid range.\r\n */;\n _proto.done = function done() {\n return this.pos >= this.rangeNodes.length - 1;\n }\n /**\r\n * Positions the iterator at the first range with startID >= target.\r\n * Such an entry always exists as long as \"target\" is a valid leaf cell.\r\n * Note that it is valid to access startID even when done is true.\r\n */;\n _proto.seek = function seek(target) {\n // Binary search to find the first range with startID > target.\n var lo = 0;\n var hi = this.rangeNodes.length;\n while (lo < hi) {\n var mid = lo + hi >>> 1;\n if (this.rangeNodes[mid].startID > target) {\n hi = mid;\n } else {\n lo = mid + 1;\n }\n }\n // Position at the previous range (which contains target), but ensure we don't go below 0.\n this.pos = Math.max(lo - 1, 0);\n // Non-empty iterator needs to find the next non-empty entry.\n while (this.nonEmpty && this.isEmpty() && !this.done()) {\n this.pos++;\n }\n };\n return CellIndexRangeIterator;\n}();\n/**\r\n * An iterator that visits the (CellID, label) pairs that cover a set of leaf\r\n * cell ranges (see CellIndexRangeIterator). Note that when multiple leaf cell\r\n * ranges are visited, this iterator only guarantees that each result will be\r\n * reported at least once, i.e. duplicate values may be suppressed. If you want\r\n * duplicate values to be reported again, be sure to call clear() first.\r\n *\r\n * In particular, the implementation guarantees that when multiple leaf cell\r\n * ranges are visited in monotonically increasing order, then each (CellID, label)\r\n * pair is reported exactly once.\r\n */\nvar CellIndexContentsIterator = /*#__PURE__*/function () {\n /**\r\n * Creates a new contents iterator.\r\n * Note that the iterator needs to be positioned using startUnion before\r\n * it can be safely used.\r\n */\n function CellIndexContentsIterator(index) {\n this.cellTree = index.cellTree;\n this.prevStartID = 0n;\n this.nodeCutoff = -1;\n this.nextNodeCutoff = -1;\n this.node = {\n cellID: 0n,\n label: CELL_INDEX_DONE_CONTENTS,\n parent: -1\n };\n }\n /**\r\n * Clears all state with respect to which range(s) have been visited.\r\n */\n var _proto2 = CellIndexContentsIterator.prototype;\n _proto2.clear = function clear() {\n this.prevStartID = 0n;\n this.nodeCutoff = -1;\n this.nextNodeCutoff = -1;\n this.node.label = CELL_INDEX_DONE_CONTENTS;\n }\n /**\r\n * Returns the current CellID.\r\n */;\n _proto2.cellID = function cellID() {\n return this.node.cellID;\n }\n /**\r\n * Returns the current Label.\r\n */;\n _proto2.label = function label() {\n return this.node.label;\n }\n /**\r\n * Advances the iterator to the next (CellID, label) pair covered by the\r\n * current leaf cell range. This requires the iterator to not be done.\r\n */;\n _proto2.next = function next() {\n if (this.node.parent <= this.nodeCutoff) {\n // We have already processed this node and its ancestors.\n this.nodeCutoff = this.nextNodeCutoff;\n this.node.label = CELL_INDEX_DONE_CONTENTS;\n } else {\n this.node = _extends({}, this.cellTree[this.node.parent]);\n }\n }\n /**\r\n * Reports if all (CellID, label) pairs have been visited.\r\n */;\n _proto2.done = function done() {\n return this.node.label === CELL_INDEX_DONE_CONTENTS;\n }\n /**\r\n * Positions the ContentsIterator at the first (cellID, label) pair that\r\n * covers the given leaf cell range. Note that when multiple leaf cell ranges\r\n * are visited using the same ContentsIterator, duplicate values may be\r\n * suppressed. If you don't want this behavior, call clear() first.\r\n */;\n _proto2.startUnion = function startUnion(r) {\n if (r.startID() < this.prevStartID) {\n this.nodeCutoff = -1; // Can't automatically eliminate duplicates.\n }\n this.prevStartID = r.startID();\n var contents = r.rangeNodes[r.pos].contents;\n if (contents <= this.nodeCutoff) {\n this.node.label = CELL_INDEX_DONE_CONTENTS;\n } else {\n this.node = _extends({}, this.cellTree[contents]);\n }\n // When visiting ancestors, we can stop as soon as the node index is smaller\n // than any previously visited node index. Because indexes are assigned\n // using a preorder traversal, such nodes are guaranteed to have already\n // been reported.\n this.nextNodeCutoff = contents;\n };\n return CellIndexContentsIterator;\n}();\n/**\r\n * Stores a collection of (CellID, label) pairs.\r\n *\r\n * The CellIDs may be overlapping or contain duplicate values. For example, a\r\n * CellIndex could store a collection of CellUnions, where each CellUnion\r\n * gets its own non-negative int32 label.\r\n *\r\n * Similar to ShapeIndex and PointIndex which map each stored element to an\r\n * identifier, CellIndex stores a label that is typically used to map the\r\n * results of queries back to client's specific data.\r\n *\r\n * To build a CellIndex where each Cell has a distinct label, call add() for each\r\n * (CellID, label) pair, and then build() the index. For example:\r\n *\r\n * ```typescript\r\n * // contents is a mapping of an identifier in my system (restaurantID,\r\n * // vehicleID, etc) to a CellID\r\n * const contents = new Map<number, CellID>([...])\r\n *\r\n * for (const [key, val] of contents) {\r\n * index.add(val, key)\r\n * }\r\n *\r\n * index.build()\r\n * ```\r\n *\r\n * There is also a helper method that adds all elements of CellUnion with the\r\n * same label:\r\n *\r\n * ```typescript\r\n * index.addCellUnion(cellUnion, label)\r\n * ```\r\n *\r\n * Note that the index is not dynamic; the contents of the index cannot be\r\n * changed once it has been built. Adding more after calling build() results in\r\n * undefined behavior of the index.\r\n *\r\n * There are several options for retrieving data from the index. The simplest\r\n * is to use a built-in method such as intersectingLabels (which returns\r\n * the labels of all cells that intersect a given target CellUnion):\r\n *\r\n * ```typescript\r\n * const labels = index.intersectingLabels(targetUnion)\r\n * ```\r\n *\r\n * Alternatively, you can use a ClosestCellQuery which computes the cell(s)\r\n * that are closest to a given target geometry.\r\n *\r\n * Internally, the index consists of a set of non-overlapping leaf cell ranges\r\n * that subdivide the sphere and such that each range intersects a particular\r\n * set of (cellID, label) pairs.\r\n *\r\n * Most clients should use either the methods such as visitIntersectingCells\r\n * and intersectingLabels, or a helper such as ClosestCellQuery.\r\n */\nvar CellIndex = /*#__PURE__*/function () {\n function CellIndex() {\n this.cellTree = [];\n this.rangeNodes = [];\n }\n /**\r\n * Adds the given CellID and Label to the index.\r\n */\n var _proto3 = CellIndex.prototype;\n _proto3.add = function add(id, label) {\n if (label < 0) {\n throw new Error('labels must be non-negative');\n }\n this.cellTree.push({\n cellID: id,\n label: label,\n parent: -1\n });\n }\n /**\r\n * Adds all of the elements of the given CellUnion to the index with the same label.\r\n */;\n _proto3.addCellUnion = function addCellUnion(cu, label) {\n if (label < 0) {\n throw new Error('labels must be non-negative');\n }\n for (var _iterator = _createForOfIteratorHelperLoose(cu), _step; !(_step = _iterator()).done;) {\n var cell = _step.value;\n this.add(cell, label);\n }\n }\n /**\r\n * Builds the index for use. This method should only be called once.\r\n */;\n _proto3.build = function build() {\n // To build the cell tree and leaf cell ranges, we maintain a stack of\n // (CellID, label) pairs that contain the current leaf cell. This struct\n // represents an instruction to push or pop a (cellID, label) pair.\n //\n // If label >= 0, the (cellID, label) pair is pushed on the stack.\n // If CellID == SentinelCellID, a pair is popped from the stack.\n // Otherwise the stack is unchanged but a rangeNode is still emitted.\n var deltas = [];\n // Create two deltas for each (cellID, label) pair: one to add the pair to\n // the stack (at the start of its leaf cell range), and one to remove it from\n // the stack (at the end of its leaf cell range).\n for (var _iterator2 = _createForOfIteratorHelperLoose(this.cellTree), _step2; !(_step2 = _iterator2()).done;) {\n var node = _step2.value;\n deltas.push({\n startID: rangeMin(node.cellID),\n cellID: node.cellID,\n label: node.label\n });\n deltas.push({\n startID: next(rangeMax(node.cellID)),\n cellID: SentinelCellID,\n label: -1\n });\n }\n // We also create two special deltas to ensure that a RangeNode is emitted at\n // the beginning and end of the CellID range.\n deltas.push({\n startID: childBeginAtLevel(fromFace(0), MAX_LEVEL),\n cellID: 0n,\n label: -1\n });\n deltas.push({\n startID: childEndAtLevel(fromFace(5), MAX_LEVEL),\n cellID: 0n,\n label: -1\n });\n // Sort deltas: first by startID, then in reverse order by cellID, then by label.\n // This is necessary to ensure that (1) larger cells are pushed on the stack\n // before smaller cells, and (2) cells are popped off the stack before any\n // new cells are added.\n deltas.sort(function (a, b) {\n if (a.startID !== b.startID) {\n return a.startID < b.startID ? -1 : 1;\n }\n if (a.cellID !== b.cellID) {\n // Reverse order by cellID.\n return a.cellID > b.cellID ? -1 : 1;\n }\n return a.label < b.label ? -1 : a.label > b.label ? 1 : 0;\n });\n // Now walk through the deltas to build the leaf cell ranges and cell tree\n // (which is essentially a permanent form of the \"stack\" described above).\n this.cellTree = [];\n this.rangeNodes = [];\n var contents = -1;\n for (var i = 0; i < deltas.length;) {\n var startID = deltas[i].startID;\n // Process all the deltas associated with the current startID.\n while (i < deltas.length && deltas[i].startID === startID) {\n if (deltas[i].label >= 0) {\n this.cellTree.push({\n cellID: deltas[i].cellID,\n label: deltas[i].label,\n parent: contents\n });\n contents = this.cellTree.length - 1;\n } else if (deltas[i].cellID === SentinelCellID) {\n contents = this.cellTree[contents].parent;\n }\n i++;\n }\n this.rangeNodes.push({\n startID: startID,\n contents: contents\n });\n }\n };\n return CellIndex;\n}();\n\n/**\r\n * A CellUnion is a collection of CellIDs.\r\n *\r\n * It is normalized if it is sorted and does not contain redundancy.\r\n * Specifically, it may not contain the same CellID twice, nor a CellID that\r\n * is contained by another, nor the four sibling CellIDs that are children of\r\n * a single higher-level CellID.\r\n *\r\n * CellUnions are not required to be normalized, but certain operations will\r\n * return different results if they are not (e.g. Contains).\r\n */\nvar CellUnion = /*#__PURE__*/function (_Array) {\n function CellUnion() {\n return _Array.apply(this, arguments) || this;\n }\n _inheritsLoose(CellUnion, _Array);\n /**\r\n * Creates a CellUnion that covers the half-open range of leaf cells [begin, end).\r\n * If begin == end, the resulting union is empty.\r\n * This requires that begin and end are both leaves, and begin <= end.\r\n * To create a closed-ended range, pass in end.next().\r\n * @category Constructors\r\n */\n CellUnion.fromRange = function fromRange(begin, end) {\n // We repeatedly add the largest cell we can.\n var cu = new CellUnion();\n for (var id = maxTile(begin, end); id !== end; id = maxTile(next(id), end)) {\n cu.push(id);\n }\n // The output is normalized because the cells are added in order by the iteration.\n return cu;\n }\n /**\r\n * Creates a CellUnion from the union of the given CellUnions.\r\n * @category Constructors\r\n */;\n CellUnion.fromUnion = function fromUnion() {\n for (var _len = arguments.length, cellUnions = new Array(_len), _key = 0; _key < _len; _key++) {\n cellUnions[_key] = arguments[_key];\n }\n var cu = _construct(CellUnion, cellUnions.flat(1));\n cu.normalize();\n return cu;\n }\n /**\r\n * Creates a CellUnion from the intersection of the given CellUnions.\r\n * @category Constructors\r\n */;\n CellUnion.fromIntersection = function fromIntersection(x, y) {\n var cu = new CellUnion();\n var i = 0,\n j = 0;\n while (i < x.length && j < y.length) {\n var iMin = rangeMin(x[i]);\n var jMin = rangeMin(y[j]);\n if (iMin > jMin) {\n if (x[i] <= rangeMax(y[j])) {\n cu.push(x[i]);\n i++;\n } else {\n j = y.lowerBound(j + 1, y.length, iMin);\n if (x[i] <= rangeMax(y[j - 1])) j--;\n }\n } else if (jMin > iMin) {\n if (y[j] <= rangeMax(x[i])) {\n cu.push(y[j]);\n j++;\n } else {\n i = x.lowerBound(i + 1, x.length, jMin);\n if (y[j] <= rangeMax(x[i - 1])) i--;\n }\n } else {\n if (x[i] < y[j]) {\n cu.push(x[i]);\n i++;\n } else {\n cu.push(y[j]);\n j++;\n }\n }\n }\n cu.normalize();\n return cu;\n }\n /**\r\n * Creates a CellUnion from the intersection of a CellUnion with the given CellID.\r\n * This can be useful for splitting a CellUnion into chunks.\r\n * @category Constructors\r\n */;\n CellUnion.fromIntersectionWithCellID = function fromIntersectionWithCellID(x, id) {\n var cu = new CellUnion();\n if (x.containsCellID(id)) {\n cu.push(id);\n cu.normalize();\n return cu;\n }\n var idMax = rangeMax(id);\n for (var i = x.lowerBound(0, x.length, rangeMin(id)); i < x.length && x[i] <= idMax; i++) cu.push(x[i]);\n cu.normalize();\n return cu;\n }\n /**\r\n * Creates a CellUnion from the difference (x - y) of the given CellUnions.\r\n * @category Constructors\r\n */;\n CellUnion.fromDifference = function fromDifference(x, y) {\n var cu = new CellUnion();\n for (var _iterator = _createForOfIteratorHelperLoose(x), _step; !(_step = _iterator()).done;) {\n var xid = _step.value;\n cu.cellUnionDifferenceInternal(xid, y);\n }\n return cu;\n }\n /**\r\n * Reports whether the CellUnion is valid, meaning that the CellIDs are valid, non-overlapping,\r\n * and sorted in increasing order.\r\n */;\n var _proto = CellUnion.prototype;\n _proto.isValid = function isValid() {\n for (var i = 0; i < this.length; i++) {\n var cid = this[i];\n if (!valid(cid)) return false;\n if (i > 0 && rangeMax(this[i - 1]) >= rangeMin(cid)) return false;\n }\n return true;\n }\n /**\r\n * Reports whether the CellUnion is normalized, meaning that it satisfies isValid\r\n * and that no four cells have a common parent.\r\n */;\n _proto.isNormalized = function isNormalized() {\n for (var i = 0; i < this.length; i++) {\n var cid = this[i];\n if (!valid(cid)) return false;\n if (i > 0 && rangeMax(this[i - 1]) >= rangeMin(cid)) return false;\n if (i >= 3 && CellUnion.areSiblings(this[i - 3], this[i - 2], this[i - 1], cid)) return false;\n }\n return true;\n }\n /**\r\n * Normalizes the CellUnion.\r\n */;\n _proto.normalize = function normalize() {\n this.sort(ascending);\n var output = [];\n // Loop invariant: output is a sorted list of cells with no redundancy.\n for (var _iterator2 = _createForOfIteratorHelperLoose(this), _step2; !(_step2 = _iterator2()).done;) {\n var ci = _step2.value;\n // The first two passes here either ignore this new candidate,\n // or remove previously accepted cells that are covered by this candidate.\n // Ignore this cell if it is contained by the previous one.\n // We only need to check the last accepted cell. The ordering of the\n // cells implies containment (but not the converse), and output has no redundancy,\n // so if this candidate is not contained by the last accepted cell\n // then it cannot be contained by any previously accepted cell.\n if (output.length > 0 && contains(output[output.length - 1], ci)) continue;\n // Discard any previously accepted cells contained by this one.\n // This could be any contiguous trailing subsequence, but it can't be\n // a discontiguous subsequence because of the containment property of\n // sorted S2 cells mentioned above.\n var j = output.length - 1; // last index to keep\n while (j >= 0) {\n if (!contains(ci, output[j])) break;\n j--;\n }\n output.length = j + 1;\n // See if the last three cells plus this one can be collapsed.\n // We loop because collapsing three accepted cells and adding a higher level cell\n // could cascade into previously accepted cells.\n while (output.length >= 3 && CellUnion.areSiblings(output[output.length - 3], output[output.length - 2], output[output.length - 1], ci)) {\n output.length -= 3;\n ci = immediateParent(ci); // checked !ci.isFace above\n }\n output.push(ci);\n }\n this.length = 0;\n this.push.apply(this, output);\n }\n /**\r\n * Reports whether this CellUnion intersects the given CellID.\r\n */;\n _proto.intersectsCellID = function intersectsCellID(id) {\n var i = this.lowerBound(0, this.length, id);\n if (i !== this.length && rangeMin(this[i]) <= rangeMax(id)) return true;\n return i !== 0 && rangeMax(this[i - 1]) >= rangeMin(id);\n }\n /**\r\n * Reports whether the CellUnion contains the given CellID.\r\n * Containment is defined with respect to regions, e.g., a cell contains its 4 children.\r\n *\r\n * CAVEAT: If you have constructed a non-normalized CellUnion, note that groups\r\n * of 4 child cells are *not* considered to contain their parent cell. To get\r\n * this behavior you must use one of the call normalize() explicitly.\r\n */;\n _proto.containsCellID = function containsCellID(id) {\n var i = this.lowerBound(0, this.length, id);\n if (i !== this.length && rangeMin(this[i]) <= id) return true;\n return i !== 0 && rangeMax(this[i - 1]) >= id;\n }\n /**\r\n * Denormalizes this CellUnion, expanding it by replacing any cell whose level is less than\r\n * minLevel or where (level - minLevel) is not a multiple of levelMod with its children,\r\n * until both conditions are satisfied or the maximum level is reached.\r\n */;\n _proto.denormalize = function denormalize(minLevel, levelMod) {\n var denorm = new CellUnion();\n for (var _iterator3 = _createForOfIteratorHelperLoose(this), _step3; !(_step3 = _iterator3()).done;) {\n var id = _step3.value;\n var level$1 = level(id);\n var newLevel = level$1;\n if (newLevel < minLevel) newLevel = minLevel;\n if (levelMod > 1) {\n newLevel += (MAX_LEVEL - (newLevel - minLevel)) % levelMod;\n if (newLevel > MAX_LEVEL) newLevel = MAX_LEVEL;\n }\n if (newLevel === level$1) denorm.push(id);else {\n var end = childEndAtLevel(id, newLevel);\n for (var ci = childBeginAtLevel(id, newLevel); ci !== end; ci = next(ci)) denorm.push(ci);\n }\n }\n this.length = 0;\n this.push.apply(this, denorm);\n }\n /**\r\n * Returns a Rect that bounds this entity.\r\n */;\n _proto.rectBound = function rectBound() {\n var bound = Rect$1.emptyRect();\n for (var _iterator4 = _createForOfIteratorHelperLoose(this), _step4; !(_step4 = _iterator4()).done;) {\n var c = _step4.value;\n bound = bound.union(Cell.fromCellID(c).rectBound());\n }\n return bound;\n }\n /**\r\n * Returns a Cap that bounds this entity.\r\n */;\n _proto.capBound = function capBound() {\n if (this.length === 0) return Cap.emptyCap();\n // Compute the approximate centroid of the region. This won't produce the\n // bounding cap of minimal area, but it should be close enough.\n var centroid = new Point$1(0, 0, 0);\n for (var _iterator5 = _createForOfIteratorHelperLoose(this), _step5; !(_step5 = _iterator5()).done;) {\n var ci = _step5.value;\n var area = AvgAreaMetric.value(level(ci));\n centroid = Point$1.fromVector(centroid.vector.add(point(ci).vector.mul(area)));\n }\n if (centroid.equals(new Point$1(0, 0, 0))) centroid = Point$1.fromCoords(1, 0, 0);else centroid = Point$1.fromVector(centroid.vector.normalize());\n // Use the centroid as the cap axis, and expand the cap angle so that it\n // contains the bounding caps of all the individual cells. Note that it is\n // *not* sufficient to just bound all the cell vertices because the bounding\n // cap may be concave (i.e. cover more than one hemisphere).\n var c = Cap.fromPoint(centroid);\n for (var _iterator6 = _createForOfIteratorHelperLoose(this), _step6; !(_step6 = _iterator6()).done;) {\n var _ci = _step6.value;\n c = c.addCap(Cell.fromCellID(_ci).capBound());\n }\n return c;\n }\n /**\r\n * Reports whether this CellUnion contains the given cell.\r\n */;\n _proto.containsCell = function containsCell(c) {\n return this.containsCellID(c.id);\n }\n /**\r\n * Reports whether this CellUnion intersects the given cell.\r\n */;\n _proto.intersectsCell = function intersectsCell(c) {\n return this.intersectsCellID(c.id);\n }\n /**\r\n * Reports whether this CellUnion contains the given point.\r\n */;\n _proto.containsPoint = function containsPoint(p) {\n return this.containsCell(Cell.fromPoint(p));\n }\n /**\r\n * Computes a covering of the CellUnion.\r\n */;\n _proto.cellUnionBound = function cellUnionBound() {\n return this.capBound().cellUnionBound();\n }\n /**\r\n * Reports the number of leaf cells covered by this CellUnion.\r\n * This will be no more than 6*2^60 for the whole sphere.\r\n */;\n _proto.leafCellsCovered = function leafCellsCovered() {\n var numLeaves = 0n;\n for (var _iterator7 = _createForOfIteratorHelperLoose(this), _step7; !(_step7 = _iterator7()).done;) {\n var c = _step7.value;\n numLeaves += 1n << BigInt(MAX_LEVEL - level(c) << 1);\n }\n return numLeaves;\n }\n /**\r\n * Returns true if the given four cells have a common parent.\r\n * This requires that the four CellIDs are distinct.\r\n */;\n CellUnion.areSiblings = function areSiblings(a, b, c, d) {\n // A necessary (but not sufficient) condition is that the XOR of the\n // four cell IDs must be zero. This is also very fast to test.\n if ((a ^ b ^ c) !== d) return false;\n // Now we do a slightly more expensive but exact test. First, compute a\n // mask that blocks out the two bits that encode the child position of\n // \"id\" with respect to its parent, then check that the other three\n // children all agree with \"mask\".\n var mask = lsb(d) << 1n;\n mask = ~(mask + (mask << 1n));\n var idMasked = d & mask;\n return (a & mask) === idMasked && (b & mask) === idMasked && (c & mask) === idMasked && !isFace(d);\n }\n /**\r\n * Reports whether this CellUnion contains all of the CellIDs of the given CellUnion.\r\n */;\n _proto.contains = function contains(o) {\n for (var _iterator8 = _createForOfIteratorHelperLoose(o), _step8; !(_step8 = _iterator8()).done;) {\n var id = _step8.value;\n if (!this.containsCellID(id)) return false;\n }\n return true;\n }\n /**\r\n * Reports whether this CellUnion intersects any of the CellIDs of the given CellUnion.\r\n */;\n _proto.intersects = function intersects(o) {\n for (var _iterator9 = _createForOfIteratorHelperLoose(this), _step9; !(_step9 = _iterator9()).done;) {\n var c = _step9.value;\n if (o.intersectsCellID(c)) return true;\n }\n return false;\n }\n /**\r\n * Returns the index in this CellUnion to the first element whose value is not considered\r\n * to go before the given cell id. If there is no match, then end is returned.\r\n */;\n _proto.lowerBound = function lowerBound(begin, end, id) {\n for (var i = begin; i < end; i++) if (this[i] >= id) return i;\n return end;\n }\n /**\r\n * Adds the difference between the CellID and the union to the result CellUnion.\r\n * If they intersect but the difference is non-empty, it divides and conquers.\r\n */;\n _proto.cellUnionDifferenceInternal = function cellUnionDifferenceInternal(id, other) {\n if (!other.intersectsCellID(id)) {\n this.push(id);\n return;\n }\n if (!other.containsCellID(id)) {\n for (var _iterator0 = _createForOfIteratorHelperLoose(children(id)), _step0; !(_step0 = _iterator0()).done;) {\n var child = _step0.value;\n this.cellUnionDifferenceInternal(child, other);\n }\n }\n }\n /**\r\n * Expands this CellUnion by adding a rim of cells at expandLevel around the union's boundary.\r\n *\r\n * For each cell c in the union, we add all cells at level\r\n * expandLevel that abut c. There are typically eight of those\r\n * (four edge-abutting and four sharing a vertex). However, if c is\r\n * finer than expandLevel, we add all cells abutting\r\n * c.Parent(expandLevel) as well as c.Parent(expandLevel) itself,\r\n * as an expandLevel cell rarely abuts a smaller cell.\r\n *\r\n * Note that the size of the output is exponential in\r\n * expandLevel. For example, if expandLevel == 20 and the input\r\n * has a cell at level 10, there will be on the order of 4000\r\n * adjacent cells in the output. For most applications the\r\n * ExpandByRadius method below is easier to use.\r\n */;\n _proto.expandAtLevel = function expandAtLevel(lvl) {\n var output = new CellUnion();\n var levelLsb = lsbForLevel(lvl);\n for (var i = this.length - 1; i >= 0; i--) {\n var id = this[i];\n if (lsb(id) < levelLsb) {\n id = parent(id, lvl);\n // Optimization: skip over any cells contained by this one. This is\n // especially important when very small regions are being expanded.\n while (i > 0 && contains(id, this[i - 1])) i--;\n }\n output.push(id);\n output.push.apply(output, allNeighbors(id, lvl));\n }\n output.sort(ascending);\n this.length = 0;\n this.push.apply(this, output);\n this.normalize();\n }\n /**\r\n * Expands this CellUnion such that it contains all points whose distance to the CellUnion\r\n * is at most minRadius, but does not use cells that are more than maxLevelDiff levels higher\r\n * than the largest cell in the input.\r\n */;\n _proto.expandByRadius = function expandByRadius(minRadius, maxLevelDiff) {\n var minLevel = MAX_LEVEL;\n for (var _iterator1 = _createForOfIteratorHelperLoose(this), _step1; !(_step1 = _iterator1()).done;) {\n var cid = _step1.value;\n minLevel = Math.min(minLevel, level(cid));\n }\n var radiusLevel = MinWidthMetric.maxLevel(minRadius);\n if (radiusLevel === 0 && minRadius > MinWidthMetric.value(0)) this.expandAtLevel(0);\n this.expandAtLevel(Math.min(minLevel + maxLevelDiff, radiusLevel));\n }\n /**\r\n * Reports whether the two CellUnions are equal.\r\n */;\n _proto.equals = function equals(o) {\n if (this.length !== o.length) return false;\n for (var i = 0; i < this.length; i++) if (this[i] !== o[i]) return false;\n return true;\n }\n /**\r\n * Returns the average area of this CellUnion.\r\n * This is accurate to within a factor of 1.7.\r\n */;\n _proto.averageArea = function averageArea() {\n return AvgAreaMetric.value(MAX_LEVEL) * Number(this.leafCellsCovered());\n }\n /**\r\n * Returns the approximate area of this CellUnion.\r\n * This method is accurate to within 3% for all cell sizes and accurate to within 0.1%\r\n * for cells at level 5 or higher within the union.\r\n */;\n _proto.approxArea = function approxArea() {\n var area = 0;\n for (var _iterator10 = _createForOfIteratorHelperLoose(this), _step10; !(_step10 = _iterator10()).done;) {\n var id = _step10.value;\n area += Cell.fromCellID(id).approxArea();\n }\n return area;\n }\n /**\r\n * Returns the area of this CellUnion as accurately as possible.\r\n */;\n _proto.exactArea = function exactArea() {\n var area = 0;\n for (var _iterator11 = _createForOfIteratorHelperLoose(this), _step11; !(_step11 = _iterator11()).done;) {\n var id = _step11.value;\n area += Cell.fromCellID(id).exactArea();\n }\n return area;\n };\n return CellUnion;\n}(/*#__PURE__*/_wrapNativeSuper(Array));\n\n/**\r\n * Represents a geodesic edge consisting of two vertices.\r\n * Zero-length edges are allowed, and can be used to represent points.\r\n */\nvar Edge = /*#__PURE__*/function () {\n /**\r\n * Returns a new Edge.\r\n * @category Constructors\r\n */\n function Edge(v0, v1) {\n this.v0 = v0;\n this.v1 = v1;\n }\n /**\r\n * Compares the two edges using the underlying Points' cmp method and returns:\r\n * -1 if e < other\r\n * 0 if e == other\r\n * +1 if e > other\r\n *\r\n * The two edges are compared by the first vertex, and then by the second vertex.\r\n */\n var _proto = Edge.prototype;\n _proto.cmp = function cmp(other) {\n var v0cmp = this.v0.vector.cmp(other.v0.vector);\n if (v0cmp !== 0) return v0cmp;\n return this.v1.vector.cmp(other.v1.vector);\n }\n /**\r\n * Reports whether this edge equals another edge.\r\n */;\n _proto.equals = function equals(other) {\n return this.v0.equals(other.v0) && this.v1.equals(other.v1);\n };\n return Edge;\n}();\n/**\r\n * Represents a range of edge IDs corresponding to a chain of connected\r\n * edges, specified as a (start, length) pair. The chain is defined to consist of\r\n * edge IDs {start, start + 1, ..., start + length - 1}.\r\n */\nvar Chain =\n/**\r\n * Returns a new Chain.\r\n * @category Constructors\r\n */\nfunction Chain(start, length) {\n this.start = start;\n this.length = length;\n};\n/**\r\n * Represents the position of an edge within a given edge chain,\r\n * specified as a (chainID, offset) pair. Chains are numbered sequentially\r\n * starting from zero, and offsets are measured from the start of each chain.\r\n */\nvar ChainPosition =\n/**\r\n * Returns a new ChainPosition.\r\n * @category Constructors\r\n */\nfunction ChainPosition(chainID, offset) {\n this.chainID = chainID;\n this.offset = offset;\n};\n/**\r\n * Consists of a point and a boolean indicating whether the point\r\n * is contained by a particular shape.\r\n */\nvar ReferencePoint =\n/**\r\n * Returns a new ReferencePoint.\r\n * @category Constructors\r\n */\nfunction ReferencePoint(point, contained) {\n this.point = point;\n this.contained = contained;\n};\n/**\r\n * Returns a ReferencePoint with the given value for contained and the origin point.\r\n * It should be used when all points or no points are contained.\r\n */\nvar originReferencePoint = function originReferencePoint(contained) {\n return new ReferencePoint(Point$1.originPoint(), contained);\n};\nvar TypeTagNone = 0;\nvar TypeTagPolygon = 1;\nvar TypeTagPolyline = 2;\n/**\r\n * Reports whether this shape contains no points.\r\n */\nvar defaultShapeIsEmpty = function defaultShapeIsEmpty(s) {\n return s.numEdges() === 0 && (s.dimension() !== 2 || s.numChains() === 0);\n};\n/**\r\n * Reports whether this shape contains all points on the sphere.\r\n */\nvar defaultShapeIsFull = function defaultShapeIsFull(s) {\n return s.numEdges() === 0 && s.dimension() === 2 && s.numChains() > 0;\n};\n// NilShape represents a Nil value\nvar NilShape = /*#__PURE__*/function () {\n function NilShape() {}\n var _proto3 = NilShape.prototype;\n _proto3.numEdges = function numEdges() {\n return 0;\n };\n _proto3.edge = function edge(_i) {\n return new Edge(Point$1.originPoint(), Point$1.originPoint());\n };\n _proto3.referencePoint = function referencePoint() {\n return originReferencePoint(false);\n };\n _proto3.numChains = function numChains() {\n return 0;\n };\n _proto3.chain = function chain(_chainID) {\n return new Chain(0, 0);\n };\n _proto3.chainEdge = function chainEdge(_chainID, _offset) {\n return new Edge(Point$1.originPoint(), Point$1.originPoint());\n };\n _proto3.chainPosition = function chainPosition(_edgeID) {\n return new ChainPosition(0, 0);\n };\n _proto3.dimension = function dimension() {\n return -1;\n };\n _proto3.isEmpty = function isEmpty() {\n return true;\n };\n _proto3.isFull = function isFull() {\n return false;\n };\n _proto3.typeTag = function typeTag() {\n return TypeTagNone;\n };\n _proto3.privateInterface = function privateInterface() {};\n return NilShape;\n}();\n\n/**\r\n * Represents the part of a shape that intersects a Cell.\r\n * It consists of the set of edge IDs that intersect that cell and a boolean\r\n * indicating whether the center of the cell is inside the shape (for shapes\r\n * that have an interior).\r\n *\r\n * Note that the edges themselves are not clipped; we always use the original\r\n * edges for intersection tests so that the results will be the same as the\r\n * original shape.\r\n */\nvar ShapeIndexClippedShape = /*#__PURE__*/function () {\n /**\r\n * Constructs a new clipped shape for the given shapeID and number of expected edges.\r\n *\r\n * @category Constructors\r\n */\n function ShapeIndexClippedShape(id, numEdges) {\n // indicates if the center of the CellID this shape has been\n // clipped to falls inside this shape. This is false for shapes that do not\n // have an interior.\n this.containsCenter = false;\n this.shapeID = id;\n this.containsCenter = false; // Default to false, can be set later\n this.edges = new Array(numEdges);\n }\n /**\r\n * Returns the number of edges that intersect the CellID of the Cell this was clipped to.\r\n */\n var _proto = ShapeIndexClippedShape.prototype;\n _proto.numEdges = function numEdges() {\n return this.edges.length;\n }\n /**\r\n * Reports if this clipped shape contains the given edge ID.\r\n */;\n _proto.containsEdge = function containsEdge(id) {\n // Linear search is fast because the number of edges per shape is typically\n // very small (less than 10).\n for (var _iterator = _createForOfIteratorHelperLoose(this.edges), _step; !(_step = _iterator()).done;) {\n var e = _step.value;\n if (e === id) return true;\n }\n return false;\n };\n return ShapeIndexClippedShape;\n}();\n// NilShapeIndexClippedShape represents a Nil value\nvar NilShapeIndexClippedShape = /*#__PURE__*/function () {\n function NilShapeIndexClippedShape() {\n this.shapeID = 0;\n this.containsCenter = false;\n this.edges = [];\n }\n var _proto2 = NilShapeIndexClippedShape.prototype;\n _proto2.numEdges = function numEdges() {\n return 0;\n };\n _proto2.containsEdge = function containsEdge(_id) {\n return false;\n };\n return NilShapeIndexClippedShape;\n}();\n\nvar ShapeIndexCell = /*#__PURE__*/function () {\n /**\r\n * Creates a new cell that is sized to hold the given number of shapes.\r\n *\r\n * @category Constructors\r\n */\n function ShapeIndexCell(numShapes) {\n this.shapes = new Array(numShapes);\n }\n /**\r\n * Reports the total number of edges in all clipped shapes in this cell.\r\n */\n var _proto = ShapeIndexCell.prototype;\n _proto.numEdges = function numEdges() {\n var e = 0;\n for (var _iterator = _createForOfIteratorHelperLoose(this.shapes), _step; !(_step = _iterator()).done;) {\n var cs = _step.value;\n e += cs.numEdges();\n }\n return e;\n }\n /**\r\n * Adds the given clipped shape to this index cell.\r\n */;\n _proto.add = function add(c) {\n // Note: Unlike the original C++ code, this does not check for duplicates.\n this.shapes.push(c);\n }\n /**\r\n * Returns the clipped shape that contains the given shapeID,\r\n * or null if none of the clipped shapes contain it.\r\n */;\n _proto.findByShapeID = function findByShapeID(shapeID) {\n // Linear search is used because the number of shapes per cell is typically\n // very small (most often 1), and is large only for pathological inputs\n // (e.g., very deeply nested loops).\n for (var _iterator2 = _createForOfIteratorHelperLoose(this.shapes), _step2; !(_step2 = _iterator2()).done;) {\n var clipped = _step2.value;\n if (clipped.shapeID === shapeID) {\n return clipped;\n }\n }\n return new NilShapeIndexClippedShape();\n };\n return ShapeIndexCell;\n}();\n// NilShapeIndexCell represents a Nil value\nvar NilShapeIndexCell = /*#__PURE__*/function () {\n function NilShapeIndexCell() {\n this.shapes = [];\n }\n var _proto2 = NilShapeIndexCell.prototype;\n _proto2.numEdges = function numEdges() {\n return 0;\n };\n _proto2.add = function add(_c) {};\n _proto2.findByShapeID = function findByShapeID(_shapeID) {\n return new NilShapeIndexClippedShape();\n };\n return NilShapeIndexCell;\n}();\n\n/** specifies the iterator should be positioned at the beginning of the index. */\nvar ITERATOR_BEGIN = 0;\n/** specifies the iterator should be positioned at the end of the index. */\nvar ITERATOR_END = 0;\n/**\r\n * An iterator that provides low-level access to the cells of the index.\r\n * Cells are returned in increasing order of CellID.\r\n *\r\n * \tfor it := index.Iterator(); !it.Done(); it.Next() {\r\n * \t fmt.Print(it.CellID())\r\n * \t}\r\n */\nvar ShapeIndexIterator = /*#__PURE__*/function () {\n /**\r\n * Creates a new iterator for the given index.\r\n * If a starting position is specified, the iterator is positioned at the given spot.\r\n * @category Constructors\r\n */\n function ShapeIndexIterator(index, pos) {\n this.index = index;\n this.position = 0;\n this.id = SentinelCellID;\n this.cell = new NilShapeIndexCell();\n if (pos !== undefined) {\n switch (pos) {\n case ITERATOR_BEGIN:\n this.begin();\n break;\n case ITERATOR_END:\n this.end();\n break;\n default:\n throw new Error('unknown ShapeIndexIteratorPos value');\n }\n }\n }\n /**\r\n * clone creates a copy of the current iterator.\r\n */\n var _proto = ShapeIndexIterator.prototype;\n _proto.clone = function clone() {\n var cloned = new ShapeIndexIterator(this.index);\n cloned.position = this.position;\n cloned.id = this.id;\n cloned.cell = this.cell;\n return cloned;\n }\n /**\r\n * cellID returns the CellID of the current index cell.\r\n * If done() is true, a value larger than any valid CellID is returned.\r\n */;\n _proto.cellID = function cellID() {\n return this.id;\n }\n /**\r\n * indexCell returns the current index cell.\r\n */;\n _proto.indexCell = function indexCell() {\n // TODO: C++ has this call a virtual method to allow subclasses\n // of ShapeIndexIterator to do other work before returning the cell. Do\n // we need such a thing?\n return this.cell;\n }\n /**\r\n * center returns the Point at the center of the current position of the iterator.\r\n */;\n _proto.center = function center() {\n return point(this.cellID());\n }\n /**\r\n * begin positions the iterator at the beginning of the index.\r\n */;\n _proto.begin = function begin() {\n if (!this.index.isFresh()) {\n this.index.maybeApplyUpdates();\n }\n this.position = 0;\n this.refresh();\n }\n /**\r\n * next positions the iterator at the next index cell.\r\n */;\n _proto.next = function next() {\n this.position++;\n this.refresh();\n }\n /**\r\n * prev advances the iterator to the previous cell in the index and returns true to\r\n * indicate it was not yet at the beginning of the index. If the iterator is at the\r\n * first cell the call does nothing and returns false.\r\n */;\n _proto.prev = function prev() {\n if (this.position <= 0) {\n return false;\n }\n this.position--;\n this.refresh();\n return true;\n }\n /**\r\n * end positions the iterator at the end of the index.\r\n */;\n _proto.end = function end() {\n this.position = this.index.cells.length;\n this.refresh();\n }\n /**\r\n * done reports if the iterator is positioned at or after the last index cell.\r\n */;\n _proto.done = function done() {\n return this.id === SentinelCellID;\n }\n /**\r\n * refresh updates the stored internal iterator values.\r\n */;\n _proto.refresh = function refresh() {\n if (this.position < this.index.cells.length) {\n this.id = this.index.cells[this.position];\n this.cell = this.index.cellMap.get(this.cellID()) || new NilShapeIndexCell();\n } else {\n this.id = SentinelCellID;\n this.cell = new NilShapeIndexCell();\n }\n }\n /**\r\n * seek positions the iterator at the first cell whose ID >= target, or at the\r\n * end of the index if no such cell exists.\r\n */;\n _proto.seek = function seek(target) {\n var _this = this;\n this.position = binarySearch(this.index.cells.length, function (i) {\n return _this.index.cells[i] >= target;\n });\n this.refresh();\n }\n /**\r\n * LocatePoint positions the iterator at the cell that contains the given Point.\r\n * If no such cell exists, the iterator position is unspecified, and false is returned.\r\n * The cell at the matched position is guaranteed to contain all edges that might\r\n * intersect the line segment between target and the cell's center.\r\n */;\n _proto.locatePoint = function locatePoint(p) {\n var target = fromPoint(p);\n this.seek(target);\n if (!this.done() && rangeMin(this.cellID()) <= target) return true;\n if (this.prev() && rangeMax(this.cellID()) >= target) return true;\n return false;\n }\n /**\r\n * LocateCellID attempts to position the iterator at the first matching index cell\r\n * in the index that has some relation to the given CellID. Let T be the target CellID.\r\n * If T is contained by (or equal to) some index cell I, then the iterator is positioned\r\n * at I and returns INDEXED. Otherwise if T contains one or more (smaller) index cells,\r\n * then the iterator is positioned at the first such cell I and return SUBDIVIDED.\r\n * Otherwise DISJOINT is returned and the iterator position is undefined.\r\n */;\n _proto.locateCellID = function locateCellID(target) {\n this.seek(rangeMin(target));\n if (!this.done()) {\n if (this.cellID() >= target && rangeMin(this.cellID()) <= target) return INDEXED;\n if (this.cellID() <= rangeMax(target)) return SUBDIVIDED;\n }\n if (this.prev() && rangeMax(this.cellID()) >= target) return INDEXED;\n return DISJOINT;\n };\n return ShapeIndexIterator;\n}();\n\nvar ShapeIndexTracker = /*#__PURE__*/function () {\n /**\r\n * Returns a new ShapeIndexTracker instance with the appropriate defaults.\r\n * @category Constructors\r\n */\n function ShapeIndexTracker() {\n this.isActive = false;\n this.a = this.b = ShapeIndexTracker.trackerOrigin();\n this.nextCellID = childBeginAtLevel(fromFace(0), MAX_LEVEL);\n this.crosser = null;\n this.shapeIDs = [];\n this.savedIDs = [];\n this.drawTo(Point$1.fromVector(faceUVToXYZ(0, -1, -1).normalize()));\n }\n /**\r\n * Returns the initial focus point when the tracker is created (corresponding to the start of the CellID space-filling curve).\r\n */\n ShapeIndexTracker.trackerOrigin = function trackerOrigin() {\n return Point$1.fromVector(faceUVToXYZ(0, -1, -1).normalize());\n }\n /**\r\n * Returns the current focus point of the tracker.\r\n */;\n var _proto = ShapeIndexTracker.prototype;\n _proto.focus = function focus() {\n return this.b;\n }\n /**\r\n * Adds a shape whose interior should be tracked.\r\n * If the focus point is inside the shape, it toggles the shape's state.\r\n */;\n _proto.addShape = function addShape(shapeID, containsFocus) {\n this.isActive = true;\n if (containsFocus) this.toggleShape(shapeID);\n }\n /**\r\n * Moves the focus of the tracker to the given point.\r\n */;\n _proto.moveTo = function moveTo(b) {\n this.b = b;\n }\n /**\r\n * Moves the focus of the tracker to the given point and updates the edge crosser.\r\n */;\n _proto.drawTo = function drawTo(b) {\n this.a = this.b;\n this.b = b;\n this.crosser = new EdgeCrosser(this.a, this.b);\n }\n /**\r\n * Checks if the given edge crosses the current edge, and if so, toggles the state of the given shapeID.\r\n */;\n _proto.testEdge = function testEdge(shapeID, edge) {\n var _this$crosser;\n if ((_this$crosser = this.crosser) != null && _this$crosser.edgeOrVertexCrossing(edge.v0, edge.v1)) this.toggleShape(shapeID);\n }\n /**\r\n * Indicates that the last argument to moveTo or drawTo was the entry vertex of the given CellID.\r\n */;\n _proto.setNextCellID = function setNextCellID(ci) {\n this.nextCellID = rangeMin(ci);\n }\n /**\r\n * Reports if the focus is already at the entry vertex of the given CellID.\r\n */;\n _proto.atCellID = function atCellID(ci) {\n return rangeMin(ci) === this.nextCellID;\n }\n /**\r\n * Adds or removes the given shapeID from the set of IDs it is tracking.\r\n */;\n _proto.toggleShape = function toggleShape(shapeID) {\n if (this.shapeIDs.length === 0) {\n this.shapeIDs.push(shapeID);\n return;\n }\n if (this.shapeIDs[0] === shapeID) {\n this.shapeIDs.shift();\n return;\n }\n for (var i = 0; i < this.shapeIDs.length; i++) {\n var s = this.shapeIDs[i];\n if (s < shapeID) continue;\n if (s === shapeID) {\n this.shapeIDs.splice(i, 1);\n return;\n }\n this.shapeIDs.splice(i, 0, shapeID);\n return;\n }\n this.shapeIDs.push(shapeID);\n }\n /**\r\n * Makes an internal copy of the state for shape IDs below the given limit, and then clears the state for those shapes.\r\n */;\n _proto.saveAndClearStateBefore = function saveAndClearStateBefore(limitShapeID) {\n var limit = this.lowerBound(limitShapeID);\n this.savedIDs = this.shapeIDs.slice(0, limit);\n this.shapeIDs = this.shapeIDs.slice(limit);\n }\n /**\r\n * Restores the state previously saved by saveAndClearStateBefore.\r\n */;\n _proto.restoreStateBefore = function restoreStateBefore(limitShapeID) {\n var limit = this.lowerBound(limitShapeID);\n this.shapeIDs = this.savedIDs.concat(this.shapeIDs.slice(limit));\n this.savedIDs = [];\n }\n /**\r\n * Returns the shapeID of the first entry where the value is greater than or equal to shapeID.\r\n */;\n _proto.lowerBound = function lowerBound(shapeID) {\n for (var i = 0; i < this.shapeIDs.length; i++) {\n if (this.shapeIDs[i] >= shapeID) return i;\n }\n return this.shapeIDs.length;\n };\n return ShapeIndexTracker;\n}();\n\n/**\r\n * VERTEX_MODEL_SEMI_OPEN means that polygon point containment is defined\r\n * such that if several polygons tile the region around a vertex, then\r\n * exactly one of those polygons contains that vertex.\r\n */\nvar VERTEX_MODEL_SEMI_OPEN = 1;\n/**\r\n * VERTEX_MODEL_CLOSED means all shapes contain their vertices (including\r\n * points and polylines).\r\n */\nvar VERTEX_MODEL_CLOSED = 2;\n/**\r\n * ContainsPointQuery determines whether one or more shapes in a ShapeIndex\r\n * contain a given Point. The ShapeIndex may contain any number of points,\r\n * polylines, and/or polygons (possibly overlapping). Shape boundaries may be\r\n * modeled as Open, SemiOpen, or Closed (this affects whether or not shapes are\r\n * considered to contain their vertices).\r\n *\r\n * This type is not safe for concurrent use.\r\n *\r\n * However, note that if you need to do a large number of point containment\r\n * tests, it is more efficient to re-use the query rather than creating a new\r\n * one each time.\r\n */\nvar ContainsPointQuery = /*#__PURE__*/function () {\n /**\r\n * Returns a new ContainsPointQuery.\r\n * @category Constructors\r\n */\n function ContainsPointQuery(index, model) {\n this.index = index;\n this.model = model;\n this.iter = index.iterator();\n }\n /** Reports whether any shape in the queries index contains the point p under the queries vertex model (Open, SemiOpen, or Closed). */\n var _proto = ContainsPointQuery.prototype;\n _proto.contains = function contains(p) {\n if (!this.iter.locatePoint(p)) return false;\n var cell = this.iter.indexCell();\n for (var _iterator = _createForOfIteratorHelperLoose(cell.shapes), _step; !(_step = _iterator()).done;) {\n var clipped = _step.value;\n if (this._shapeContains(clipped, this.iter.center(), p)) return true;\n }\n return false;\n }\n /** Reports whether the clippedShape from the iterator's center position contains the given point. */;\n _proto._shapeContains = function _shapeContains(clipped, center, p) {\n var inside = clipped.containsCenter;\n var numEdges = clipped.numEdges();\n if (numEdges <= 0) return inside;\n var shape = this.index.shape(clipped.shapeID);\n if (shape.dimension() !== 2) {\n // Points and polylines can be ignored unless the vertex model is Closed.\n if (this.model !== VERTEX_MODEL_CLOSED) return false;\n // Otherwise, the point is contained if and only if it matches a vertex.\n for (var _iterator2 = _createForOfIteratorHelperLoose(clipped.edges), _step2; !(_step2 = _iterator2()).done;) {\n var edgeID = _step2.value;\n var edge = shape.edge(edgeID);\n if (edge.v0.equals(p) || edge.v1.equals(p)) return true;\n }\n return false;\n }\n // Test containment by drawing a line segment from the cell center to the given point\n // and counting edge crossings.\n var crosser = new EdgeCrosser(center, p);\n for (var _iterator3 = _createForOfIteratorHelperLoose(clipped.edges), _step3; !(_step3 = _iterator3()).done;) {\n var _edgeID = _step3.value;\n var _edge = shape.edge(_edgeID);\n var sign = crosser.crossingSign(_edge.v0, _edge.v1);\n if (sign === DO_NOT_CROSS) continue;\n if (sign === MAYBE_CROSS) {\n // For the Open and Closed models, check whether p is a vertex.\n if (this.model !== VERTEX_MODEL_SEMI_OPEN && (_edge.v0.equals(p) || _edge.v1.equals(p))) {\n return this.model === VERTEX_MODEL_CLOSED;\n }\n if (vertexCrossing(crosser.a, crosser.b, _edge.v0, _edge.v1)) sign = CROSS;else sign = DO_NOT_CROSS;\n }\n inside = inside !== (sign === CROSS);\n }\n return inside;\n }\n /** Reports whether the given shape contains the point under this queries vertex model (Open, SemiOpen, or Closed). This requires the shape belongs to this queries index. */;\n _proto.shapeContains = function shapeContains(shape, p) {\n if (!shape || shape instanceof NilShape) return false;\n if (!this.iter.locatePoint(p)) return false;\n var iCell = this.iter.indexCell();\n var clipped = iCell.findByShapeID(this.index.idForShape(shape));\n if (!clipped) return false;\n return this._shapeContains(clipped, this.iter.center(), p);\n }\n /**\r\n * A type of function that can be called against shapes in an index.\r\n */;\n _proto.shapeVisitorFunc = function shapeVisitorFunc(_shape) {\n return true;\n }\n /**\r\n * Visits all shapes in the given index that contain the\r\n * given point p, terminating early if the given visitor function returns false,\r\n * in which case visitContainingShapes returns false. Each shape is\r\n * visited at most once.\r\n */;\n _proto.visitContainingShapes = function visitContainingShapes(p, f) {\n if (!this.iter.locatePoint(p)) return true;\n var cell = this.iter.indexCell();\n for (var _iterator4 = _createForOfIteratorHelperLoose(cell.shapes), _step4; !(_step4 = _iterator4()).done;) {\n var clipped = _step4.value;\n if (this._shapeContains(clipped, this.iter.center(), p) && !f(this.index.shape(clipped.shapeID))) return false;\n }\n return true;\n }\n /** Returns a slice of all shapes that contain the given point. */;\n _proto.containingShapes = function containingShapes(p) {\n var shapes = [];\n this.visitContainingShapes(p, function (shape) {\n shapes.push(shape);\n return true;\n });\n return shapes;\n };\n return ContainsPointQuery;\n}();\n\n/**\r\n * ShapeIndexRegion wraps a ShapeIndex and implements the Region interface.\r\n * This allows RegionCoverer to work with ShapeIndexes as well as being\r\n * able to be used by some of the Query types.\r\n */\nvar ShapeIndexRegion = /*#__PURE__*/function () {\n function ShapeIndexRegion(index, query) {\n if (query === void 0) {\n query = new ContainsPointQuery(index, VERTEX_MODEL_SEMI_OPEN);\n }\n this.index = index;\n this.containsQuery = query;\n this.iter = index.iterator();\n }\n /**\r\n * CapBound returns a bounding spherical cap for this collection of geometry.\r\n * This is not guaranteed to be exact.\r\n */\n var _proto = ShapeIndexRegion.prototype;\n _proto.capBound = function capBound() {\n var cu = _construct(CellUnion, this.cellUnionBound());\n return cu.capBound();\n }\n /**\r\n * RectBound returns a bounding rectangle for this collection of geometry.\r\n * The bounds are not guaranteed to be tight.\r\n */;\n _proto.rectBound = function rectBound() {\n var cu = _construct(CellUnion, this.cellUnionBound());\n return cu.rectBound();\n }\n /**\r\n * CellUnionBound returns the bounding CellUnion for this collection of geometry.\r\n * This method currently returns at most 4 cells, unless the index spans\r\n * multiple faces in which case it may return up to 6 cells.\r\n */;\n _proto.cellUnionBound = function cellUnionBound() {\n var cellIDs = [];\n // Find the last CellID in the index.\n this.iter.end();\n if (!this.iter.prev()) return cellIDs; // Empty index.\n var lastIndexID = this.iter.cellID();\n this.iter.begin();\n if (this.iter.cellID() !== lastIndexID) {\n // The index has at least two cells. Choose a CellID level such that\n // the entire index can be spanned with at most 6 cells (if the index\n // spans multiple faces) or 4 cells (if the index spans a single face).\n var _cellid$commonAncesto = commonAncestorLevel(this.iter.cellID(), lastIndexID),\n level = _cellid$commonAncesto[0];\n if (level === undefined) level = -1;\n level++;\n // For each cell C at the chosen level, compute the smallest Cell\n // that covers the ShapeIndex cells within C.\n var lastID = parent(lastIndexID, level);\n for (var id = parent(this.iter.cellID(), level); id != lastID; id = next(id)) {\n // If the cell C does not contain any index cells, then skip it.\n if (rangeMax(id) < this.iter.cellID()) continue;\n // Find the range of index cells contained by C and then shrink C so\n // that it just covers those cells.\n var first = this.iter.cellID();\n this.iter.seek(next(rangeMax(id)));\n this.iter.prev();\n cellIDs.push.apply(cellIDs, this.coverRange(first, this.iter.cellID(), []));\n this.iter.next();\n }\n }\n return this.coverRange(this.iter.cellID(), lastIndexID, cellIDs);\n }\n /**\r\n * coverRange computes the smallest CellID that covers the Cell range (first, last)\r\n * and returns the updated slice.\r\n *\r\n * This requires first and last have a common ancestor.\r\n */;\n _proto.coverRange = function coverRange(first, last, cellIDs) {\n if (first == last) return cellIDs.concat([first]);\n var _cellid$commonAncesto2 = commonAncestorLevel(first, last),\n level = _cellid$commonAncesto2[0],\n ok = _cellid$commonAncesto2[1];\n if (!ok) cellIDs.concat([0n]);\n return cellIDs.concat([parent(first, level)]);\n };\n return ShapeIndexRegion;\n}();\n// TODO: remaining methods\n/*\r\nContainsCell(target Cell): boolean {\r\nIntersectsCell(target Cell): boolean {\r\nContainsPoint(p Point): boolean {\r\ncontains(id CellID, clipped clippedShape, p Point): boolean {\r\nanyEdgeIntersects(clipped clippedShape, target Cell): boolean {\r\n*/\n\n/**\r\n * Constants related to clipping geodesic edges and 2D edges to rectangles.\r\n */\nvar EDGE_CLIP_ERROR_UV_COORD = 2.25 * DBL_EPSILON$1;\nvar FACE_CLIP_ERROR_RADIANS = 3 * DBL_EPSILON$1;\nvar FACE_CLIP_ERROR_UV_COORD = 9.0 * (1.0 / Math.SQRT2) * DBL_EPSILON$1;\nvar INTERSECTS_RECT_ERROR_UV_DIST = 3 * Math.SQRT2 * DBL_EPSILON$1;\n/**\r\n * Returns the (u,v) coordinates for the portion of the edge AB that intersects the given face,\r\n * or false if the edge AB does not intersect.\r\n * This method guarantees that the clipped vertices lie within the [-1,1]x[-1,1]\r\n * cube face rectangle and are within faceClipErrorUVDist of the line AB.\r\n */\nvar clipToFace = function clipToFace(a, b, face) {\n return clipToPaddedFace(a, b, face, 0.0);\n};\n/**\r\n * Returns the (u,v) coordinates for the portion of the edge AB that intersects the given face,\r\n * but clips to [-R,R]x[-R,R] where R=(1+padding).\r\n * Padding must be non-negative.\r\n */\nvar clipToPaddedFace = function clipToPaddedFace(a, b, f, padding) {\n // Fast path: both endpoints are on the given face.\n if (face(a.vector) === f && face(b.vector) === f) {\n var _validFaceXYZToUV = validFaceXYZToUV(f, a.vector),\n au = _validFaceXYZToUV[0],\n av = _validFaceXYZToUV[1];\n var _validFaceXYZToUV2 = validFaceXYZToUV(f, b.vector),\n bu = _validFaceXYZToUV2[0],\n bv = _validFaceXYZToUV2[1];\n return [new Point(au, av), new Point(bu, bv), true];\n }\n // Convert everything into the (u,v,w) coordinates of the given face. Note\n // that the cross product *must* be computed in the original (x,y,z)\n // coordinate system because PointCross (unlike the mathematical cross\n // product) can produce different results in different coordinate systems\n // when one argument is a linear multiple of the other, due to the use of\n // symbolic perturbations.\n var normUVW = new PointUVW(faceXYZtoUVW(f, a.pointCross(b).vector));\n var aUVW = new PointUVW(faceXYZtoUVW(f, a.vector));\n var bUVW = new PointUVW(faceXYZtoUVW(f, b.vector));\n // Padding is handled by scaling the u- and v-components of the normal.\n // Letting R=1+padding, this means that when we compute the dot product of\n // the normal with a cube face vertex (such as (-1,-1,1)), we will actually\n // compute the dot product with the scaled vertex (-R,-R,1). This allows\n // methods such as intersectsFace, exitAxis, etc, to handle padding\n // with no further modifications.\n var scaleUV = 1 + padding;\n var scaledN = new PointUVW(new Point$1(scaleUV * normUVW.x, scaleUV * normUVW.y, normUVW.z));\n if (!scaledN.intersectsFace()) return [null, null, false];\n // TODO(roberts): This is a workaround for extremely small vectors where some\n // loss of precision can occur in Normalize causing underflow. When PointCross\n // is updated to work around this, this can be removed.\n if (Math.max(Math.abs(normUVW.x), Math.max(Math.abs(normUVW.y), Math.abs(normUVW.z))) < ldexp(1, -511)) {\n normUVW = new PointUVW(Point$1.fromVector(normUVW.vector.mul(ldexp(1, 563))));\n }\n var normUVWNormalized = new PointUVW(Point$1.fromVector(normUVW.vector.normalize()));\n var aTan = new PointUVW(Point$1.fromVector(normUVWNormalized.vector.cross(aUVW.vector)));\n var bTan = new PointUVW(Point$1.fromVector(bUVW.vector.cross(normUVWNormalized.vector)));\n // As described in clipDestination, if the sum of the scores from clipping the two\n // endpoints is 3 or more, then the segment does not intersect this face.\n var _clipDestination = clipDestination(bUVW, aUVW, new PointUVW(Point$1.fromVector(scaledN.vector.mul(-1))), bTan, aTan, scaleUV),\n aUV = _clipDestination[0],\n aScore = _clipDestination[1];\n var _clipDestination2 = clipDestination(aUVW, bUVW, scaledN, aTan, bTan, scaleUV),\n bUV = _clipDestination2[0],\n bScore = _clipDestination2[1];\n return [aUV, bUV, aScore + bScore < 3];\n};\n/**\r\n * Reports whether u + v == w exactly.\r\n */\nvar sumEqual = function sumEqual(u, v, w) {\n return u + v === w && u === w - v && v === w - u;\n};\nvar AXIS_U = 0;\nvar AXIS_V = 1;\n/**\r\n * Represents a Point in (u,v,w) coordinate space of a cube face.\r\n */\nvar PointUVW = /*#__PURE__*/function (_Point) {\n function PointUVW(point) {\n return _Point.call(this, point.x, point.y, point.z) || this;\n }\n _inheritsLoose(PointUVW, _Point);\n var _proto = PointUVW.prototype;\n _proto.intersectsFace = function intersectsFace() {\n var u = Math.abs(this.x);\n var v = Math.abs(this.y);\n var w = Math.abs(this.z);\n return v >= w - u && u >= w - v;\n };\n _proto.intersectsOppositeEdges = function intersectsOppositeEdges() {\n var u = Math.abs(this.x);\n var v = Math.abs(this.y);\n var w = Math.abs(this.z);\n if (Math.abs(u - v) !== w) return Math.abs(u - v) >= w;\n return u >= v ? u - w >= v : v - w >= u;\n };\n _proto.exitAxis = function exitAxis() {\n if (this.intersectsOppositeEdges()) {\n return Math.abs(this.x) >= Math.abs(this.y) ? AXIS_V : AXIS_U;\n }\n var x = 0;\n var y = 0;\n var z = 0;\n if (Math.sign(this.x) < 0) x = 1;\n if (Math.sign(this.y) < 0) y = 1;\n if (Math.sign(this.z) < 0) z = 1;\n return (x ^ y ^ z) === 0 ? AXIS_V : AXIS_U;\n };\n _proto.exitPoint = function exitPoint(axis) {\n if (axis === AXIS_U) {\n var u = this.y > 0 ? 1.0 : -1.0;\n return new Point(u, (-u * this.x - this.z) / this.y);\n }\n var v = this.x < 0 ? 1.0 : -1.0;\n return new Point((-v * this.y - this.z) / this.x, v);\n };\n return PointUVW;\n}(Point$1);\n/**\r\n * Returns the score for the given endpoint to indicate if the clipped edge AB\r\n * on the given face intersects the face at all. If the sum of the scores from\r\n * both endpoints is 3 or more, then edge AB does not intersect this face.\r\n */\nvar clipDestination = function clipDestination(a, b, scaledN, aTan, bTan, scaleUV) {\n var maxSafeUVCoord = 1 - FACE_CLIP_ERROR_UV_COORD;\n if (b.z > 0) {\n var _uv = new Point(b.x / b.z, b.y / b.z);\n if (Math.max(Math.abs(_uv.x), Math.abs(_uv.y)) <= maxSafeUVCoord) return [_uv, 0];\n }\n var uv = scaledN.exitPoint(scaledN.exitAxis()).mul(scaleUV);\n var p = new PointUVW(new Point$1(uv.x, uv.y, 1.0));\n var score = 0;\n if (p.vector.sub(a.vector).dot(aTan.vector) < 0) {\n score = 2;\n } else if (p.vector.sub(b.vector).dot(bTan.vector) < 0) {\n score = 1;\n }\n if (score > 0) {\n if (b.z <= 0) score = 3;else uv = new Point(b.x / b.z, b.y / b.z);\n }\n return [uv, score];\n};\n/**\r\n * Updates the endpoint of the interval with the specified value.\r\n * If the value lies beyond the opposite endpoint, nothing is changed and false is returned.\r\n */\nvar updateEndpoint = function updateEndpoint(bound, highEndpoint, value) {\n if (!highEndpoint) {\n if (bound.hi < value) return [bound, false];\n if (bound.lo < value) bound.lo = value;\n return [bound, true];\n }\n if (bound.lo > value) return [bound, false];\n if (bound.hi > value) bound.hi = value;\n return [bound, true];\n};\n/**\r\n * Clips the bounding intervals for the given axes for the line segment\r\n * from (a0,a1) to (b0,b1) so that neither extends beyond the given clip interval.\r\n * Returns false if the clipping interval doesn't overlap the bounds.\r\n */\nvar clipBoundAxis = function clipBoundAxis(a0, b0, bound0, a1, b1, bound1, negSlope, clip) {\n var updated = false;\n if (bound0.lo < clip.lo) {\n if (bound0.hi < clip.lo) return [bound0, bound1, false];\n bound0.lo = clip.lo;\n var _updateEndpoint = updateEndpoint(bound1, negSlope, interpolateFloat64(clip.lo, a0, b0, a1, b1));\n bound1 = _updateEndpoint[0];\n updated = _updateEndpoint[1];\n if (!updated) return [bound0, bound1, false];\n }\n if (bound0.hi > clip.hi) {\n if (bound0.lo > clip.hi) return [bound0, bound1, false];\n bound0.hi = clip.hi;\n var _updateEndpoint2 = updateEndpoint(bound1, !negSlope, interpolateFloat64(clip.hi, a0, b0, a1, b1));\n bound1 = _updateEndpoint2[0];\n updated = _updateEndpoint2[1];\n if (!updated) return [bound0, bound1, false];\n }\n return [bound0, bound1, true];\n};\n/**\r\n * Reports whether the edge defined by AB intersects the given closed rectangle within the error bound.\r\n */\nvar edgeIntersectsRect = function edgeIntersectsRect(a, b, r) {\n if (!r.intersects(Rect.fromPoints(a, b))) return false;\n var n = b.sub(a).ortho();\n var i = n.x >= 0 ? 1 : 0;\n var j = n.y >= 0 ? 1 : 0;\n var max = n.dot(r.vertexIJ(i, j).sub(a));\n var min = n.dot(r.vertexIJ(1 - i, 1 - j).sub(a));\n return max >= 0 && min <= 0;\n};\n/**\r\n * Returns the bounding rectangle of the portion of the edge defined by AB intersected by clip.\r\n */\nvar clippedEdgeBound = function clippedEdgeBound(a, b, clip) {\n var bound = Rect.fromPoints(a, b);\n var _clipEdgeBound2 = clipEdgeBound(a, b, clip, bound),\n b1 = _clipEdgeBound2[0],\n intersects = _clipEdgeBound2[1];\n if (intersects) return b1;\n return Rect.empty();\n};\n/**\r\n * Clips an edge AB to a sequence of rectangles efficiently.\r\n * Represents the clipped edges by their bounding boxes rather than as a pair of endpoints.\r\n */\nvar clipEdgeBound = function clipEdgeBound(a, b, clip, bound) {\n var negSlope = a.x > b.x !== a.y > b.y;\n var _clipBoundAxis = clipBoundAxis(a.x, b.x, bound.x, a.y, b.y, bound.y, negSlope, clip.x),\n b0x = _clipBoundAxis[0],\n b0y = _clipBoundAxis[1],\n up1 = _clipBoundAxis[2];\n if (!up1) return [bound, false];\n var _clipBoundAxis2 = clipBoundAxis(a.y, b.y, b0y, a.x, b.x, b0x, negSlope, clip.y),\n b1y = _clipBoundAxis2[0],\n b1x = _clipBoundAxis2[1],\n up2 = _clipBoundAxis2[2];\n if (!up2) return [new Rect(b0x, b0y), false];\n return [new Rect(b1x, b1y), true];\n};\n/**\r\n * Interpolates a value with the same combination of a1 and b1 as the given value x is of a and b.\r\n */\nvar interpolateFloat64 = function interpolateFloat64(x, a, b, a1, b1) {\n return Math.abs(a - x) <= Math.abs(b - x) ? a1 + (b1 - a1) * (x - a) / (b - a) : b1 + (a1 - b1) * (x - b) / (a - b);\n};\n/**\r\n * Represents an edge AB clipped to an S2 cube face.\r\n */\nvar FaceSegment = /*#__PURE__*/function () {\n /**\r\n * Returns a new FaceSegment.\r\n * @category Constructors\r\n */\n function FaceSegment(face, a, b) {\n this.face = face;\n this.a = a;\n this.b = b;\n }\n /**\r\n * Returns a copy\r\n */\n var _proto2 = FaceSegment.prototype;\n _proto2.clone = function clone() {\n return new FaceSegment(this.face, new Point(this.a.x, this.a.y), new Point(this.b.x, this.b.y));\n };\n return FaceSegment;\n}();\n/**\r\n * FaceSegments subdivides the given edge AB at every point where it crosses the\r\n * boundary between two S2 cube faces and returns the corresponding FaceSegments.\r\n * The segments are returned in order from A toward B. The input points must be\r\n * unit length.\r\n *\r\n * This function guarantees that the returned segments form a continuous path\r\n * from A to B, and that all vertices are within faceClipErrorUVDist of the\r\n * line AB. All vertices lie within the [-1,1]x[-1,1] cube face rectangles.\r\n * The results are consistent with Sign, i.e. the edge is well-defined even its\r\n * endpoints are antipodal.\r\n */\nvar faceSegments = function faceSegments(a, b) {\n var segment = new FaceSegment(0, new Point(0, 0), new Point(0, 0));\n // Fast path: both endpoints are on the same face.\n var _xyzToFaceUV = xyzToFaceUV(a.vector),\n aFace = _xyzToFaceUV[0],\n aX = _xyzToFaceUV[1],\n aY = _xyzToFaceUV[2];\n var _xyzToFaceUV2 = xyzToFaceUV(b.vector),\n bFace = _xyzToFaceUV2[0],\n bX = _xyzToFaceUV2[1],\n bY = _xyzToFaceUV2[2];\n segment.a.x = aX;\n segment.a.y = aY;\n segment.b.x = bX;\n segment.b.y = bY;\n if (aFace === bFace) {\n segment.face = aFace;\n return [segment];\n }\n // Starting at A, we follow AB from face to face until we reach the face\n // containing B. The following code is designed to ensure that we always\n // reach B, even in the presence of numerical errors.\n //\n // First we compute the normal to the plane containing A and B. This normal\n // becomes the ultimate definition of the line AB; it is used to resolve all\n // questions regarding where exactly the line goes. Unfortunately due to\n // numerical errors, the line may not quite intersect the faces containing\n // the original endpoints. We handle this by moving A and/or B slightly if\n // necessary so that they are on faces intersected by the line AB.\n var ab = a.pointCross(b);\n var _moveOriginToValidFac = moveOriginToValidFace(aFace, a, ab, segment.a),\n newAFace = _moveOriginToValidFac[0],\n newA = _moveOriginToValidFac[1];\n var _moveOriginToValidFac2 = moveOriginToValidFace(bFace, b, Point$1.fromVector(ab.vector.mul(-1)), segment.b),\n newBFace = _moveOriginToValidFac2[0],\n newB = _moveOriginToValidFac2[1];\n segment.a = newA;\n segment.b = newB;\n // Now we simply follow AB from face to face until we reach B.\n var segments = [];\n segment.face = newAFace;\n var bSaved = segment.b;\n for (var _face = newAFace; _face !== newBFace;) {\n // Complete the current segment by finding the point where AB exits the current face.\n var z = faceXYZtoUVW(_face, ab.vector);\n var n = new PointUVW(z);\n var exitAxis = n.exitAxis();\n segment.b = n.exitPoint(exitAxis);\n segments.push(segment.clone());\n // Compute the next face intersected by AB, and translate the exit\n // point of the current segment into the (u,v) coordinates of the\n // next face. This becomes the first point of the next segment.\n var exitXyz = faceUVToXYZ(_face, segment.b.x, segment.b.y);\n _face = nextFace(_face, segment.b, exitAxis, n, newBFace);\n var exitUvw = faceXYZtoUVW(_face, exitXyz);\n segment.face = _face;\n segment.a = new Point(exitUvw.x, exitUvw.y);\n }\n // Finish the last segment.\n segment.b = bSaved;\n segments.push(segment);\n return segments;\n};\n/**\r\n * Updates the origin point to a valid face if necessary.\r\n * Given a line segment AB whose origin A has been projected onto a given cube\r\n * face, determine whether it is necessary to project A onto a different face\r\n * instead. This can happen because the normal of the line AB is not computed\r\n * exactly, so that the line AB (defined as the set of points perpendicular to\r\n * the normal) may not intersect the cube face containing A. Even if it does\r\n * intersect the face, the exit point of the line from that face may be on\r\n * the wrong side of A (i.e., in the direction away from B). If this happens,\r\n * we reproject A onto the adjacent face where the line AB approaches A most\r\n * closely. This moves the origin by a small amount, but never more than the\r\n * error tolerances.\r\n */\nvar moveOriginToValidFace = function moveOriginToValidFace(face, a, ab, aUV) {\n // Fast path: if the origin is sufficiently far inside the face, it is\n // always safe to use it.\n var maxSafeUVCoord = 1 - FACE_CLIP_ERROR_UV_COORD;\n if (Math.max(Math.abs(aUV.x), Math.abs(aUV.y)) <= maxSafeUVCoord) return [face, aUV];\n // Otherwise check whether the normal AB even intersects this face.\n var z = faceXYZtoUVW(face, ab.vector);\n var n = new PointUVW(z);\n if (n.intersectsFace()) {\n // Check whether the point where the line AB exits this face is on the\n // wrong side of A (by more than the acceptable error tolerance).\n var uv = n.exitPoint(n.exitAxis());\n var exit = faceUVToXYZ(face, uv.x, uv.y);\n var aTangent = ab.vector.normalize().cross(a.vector);\n // We can use the given face.\n if (exit.sub(a.vector).dot(aTangent) >= -FACE_CLIP_ERROR_RADIANS) return [face, aUV];\n }\n // Otherwise we reproject A to the nearest adjacent face. (If line AB does\n // not pass through a given face, it must pass through all adjacent faces.)\n var dir = 0;\n if (Math.abs(aUV.x) >= Math.abs(aUV.y)) {\n // U-axis\n if (aUV.x > 0) dir = 1;\n face = uvwFace(face, 0, dir);\n } else {\n // V-axis\n if (aUV.y > 0) dir = 1;\n face = uvwFace(face, 1, dir);\n }\n var _validFaceXYZToUV3 = validFaceXYZToUV(face, a.vector);\n aUV.x = _validFaceXYZToUV3[0];\n aUV.y = _validFaceXYZToUV3[1];\n aUV.x = Math.max(-1.0, Math.min(1.0, aUV.x));\n aUV.y = Math.max(-1.0, Math.min(1.0, aUV.y));\n return [face, aUV];\n};\n/**\r\n * Returns the next face that should be visited by FaceSegments, given that\r\n * we have just visited face and we are following the line AB (represented\r\n * by its normal N in the (u,v,w) coordinates of that face). The other\r\n * arguments include the point where AB exits face, the corresponding\r\n * exit axis, and the target face containing the destination point B.\r\n */\nvar nextFace = function nextFace(face, exit, axis, n, targetFace) {\n // const [exitA, exit1MinusA] = axis === AXIS_V ? [exit.x, exit.y] : [exit.y, exit.x]\n // const exitAPos = exitA > 0 ? 1 : 0\n // const exit1MinusAPos = exit1MinusA > 0 ? 1 : 0\n var exitA = exit.x;\n var exit1MinusA = exit.y;\n if (axis == AXIS_V) {\n exitA = exit.y;\n exit1MinusA = exit.x;\n }\n var exitAPos = 0;\n if (exitA > 0) {\n exitAPos = 1;\n }\n var exit1MinusAPos = 0;\n if (exit1MinusA > 0) {\n exit1MinusAPos = 1;\n }\n // We return the face that is adjacent to the exit point along the given\n // axis. If line AB exits *exactly* through a corner of the face, there are\n // two possible next faces. If one is the target face containing B, then\n // we guarantee that we advance to that face directly.\n //\n // The three conditions below check that (1) AB exits approximately through\n // a corner, (2) the adjacent face along the non-exit axis is the target\n // face, and (3) AB exits *exactly* through the corner. (The sumEqual\n // code checks whether the dot product of (u,v,1) and n is exactly zero.)\n if (Math.abs(exit1MinusA) === 1 && uvwFace(face, 1 - axis, exit1MinusAPos) === targetFace && sumEqual(exit.x * n.x, exit.y * n.y, -n.z)) {\n return targetFace;\n }\n // Otherwise return the face that is adjacent to the exit point in the\n // direction of the exit axis.\n return uvwFace(face, axis, exitAPos);\n};\n\n/**\r\n * Reports all intersections, even those where two edges\r\n * intersect only because they share a common vertex.\r\n */\nvar CROSSING_TYPE_ALL = 1;\n/**\r\n * RangeIterator is a wrapper over ShapeIndexIterator with extra methods\r\n * that are useful for merging the contents of two or more ShapeIndexes.\r\n */\nvar RangeIterator = /*#__PURE__*/function () {\n function RangeIterator(index) {\n this.rangeMin = SentinelCellID;\n this.rangeMax = SentinelCellID;\n this.it = index.iterator();\n this.refresh();\n }\n var _proto = RangeIterator.prototype;\n _proto.cellID = function cellID() {\n return this.it.cellID();\n };\n _proto.indexCell = function indexCell() {\n return this.it.indexCell();\n };\n _proto.next = function next() {\n this.it.next();\n this.refresh();\n };\n _proto.done = function done() {\n return this.it.done();\n }\n /**\r\n * Positions the iterator at the first cell that overlaps or follows\r\n * the current range minimum of the target iterator, i.e. such that its\r\n * rangeMax >= target.rangeMin.\r\n */;\n _proto.seekTo = function seekTo(target) {\n this.it.seek(target.rangeMin);\n // If the current cell does not overlap target, it is possible that the\n // previous cell is the one we are looking for. This can only happen when\n // the previous cell contains target but has a smaller CellID.\n if (this.it.done() || rangeMin(this.it.cellID()) > target.rangeMax) {\n if (this.it.prev() && rangeMax(this.it.cellID()) < target.cellID()) {\n this.it.next();\n }\n }\n this.refresh();\n }\n /**\r\n * Positions the iterator at the first cell that follows the current\r\n * range minimum of the target iterator. i.e. the first cell such that its\r\n * rangeMin > target.rangeMax.\r\n */;\n _proto.seekBeyond = function seekBeyond(target) {\n this.it.seek(next(target.rangeMax));\n if (!this.it.done() && rangeMin(this.it.cellID()) <= target.rangeMax) {\n this.it.next();\n }\n this.refresh();\n }\n /**\r\n * Updates the iterator's min and max values.\r\n */;\n _proto.refresh = function refresh() {\n this.rangeMin = rangeMin(this.cellID());\n this.rangeMax = rangeMax(this.cellID());\n };\n return RangeIterator;\n}();\n/**\r\n * containsBruteForce reports whether the given shape contains the given point.\r\n * Most clients should not use this method, since its running time is linear in\r\n * the number of shape edges. Instead clients should create a ShapeIndex and use\r\n * ContainsPointQuery, since this strategy is much more efficient when many\r\n * points need to be tested.\r\n *\r\n * Polygon boundaries are treated as being semi-open (see ContainsPointQuery\r\n * and VertexModel for other options).\r\n */\nvar containsBruteForce = function containsBruteForce(shape, point) {\n if (shape.dimension() !== 2) return false;\n var refPoint = shape.referencePoint();\n if (refPoint.point === point) return refPoint.contained;\n var crosser = new EdgeCrosser(refPoint.point, point);\n var inside = refPoint.contained;\n for (var e = 0; e < shape.numEdges(); e++) {\n var edge = shape.edge(e);\n inside = inside !== crosser.edgeOrVertexCrossing(edge.v0, edge.v1);\n }\n return inside;\n};\n\n/**\r\n * PaddedCell represents a Cell whose (u,v)-range has been expanded on\r\n * all sides by a given amount of \"padding\". Unlike Cell, its methods and\r\n * representation are optimized for clipping edges against Cell boundaries\r\n * to determine which cells are intersected by a given set of edges.\r\n */\nvar PaddedCell = /*#__PURE__*/function () {\n function PaddedCell() {\n this.id = 0n;\n this.padding = 0;\n this.boundRect = Rect.empty();\n this.middleRect = Rect.empty(); // A rect in (u, v)-space that belongs to all four children.\n this.iLo = 0; // Minimum (i,j)-coordinates of this cell before padding\n this.jLo = 0;\n this.orientation = 0; // Hilbert curve orientation of this cell.\n this.level = 0;\n }\n /**\r\n * Returns a new PaddedCell with the given padding.\r\n * @category Constructors\r\n */\n PaddedCell.fromCellID = function fromCellID(id, padding) {\n var p = new PaddedCell();\n p.id = id;\n p.padding = padding;\n p.middleRect = Rect.empty();\n // Fast path for constructing a top-level face (the most common case).\n if (isFace(id)) {\n var limit = padding + 1;\n p.boundRect = new Rect(new Interval(-limit, limit), new Interval(-limit, limit));\n p.middleRect = new Rect(new Interval(-padding, padding), new Interval(-padding, padding));\n p.orientation = face$1(id) & 1;\n return p;\n }\n var _cellid$faceIJOrienta = faceIJOrientation(id),\n i = _cellid$faceIJOrienta.i,\n j = _cellid$faceIJOrienta.j,\n orientation = _cellid$faceIJOrienta.orientation;\n p.iLo = i;\n p.jLo = j;\n p.orientation = orientation;\n p.level = level(id);\n p.boundRect = ijLevelToBoundUV(i, j, p.level).expandedByMargin(padding);\n var ijSize = sizeIJ(p.level);\n p.iLo &= -ijSize;\n p.jLo &= -ijSize;\n return p;\n }\n /**\r\n * Constructs the child of parent with the given (i,j) index.\r\n * The four child cells have indices of (0,0), (0,1), (1,0), (1,1), where the i and j\r\n * indices correspond to increasing u- and v-values respectively.\r\n * @category Constructors\r\n */;\n PaddedCell.fromParentIJ = function fromParentIJ(parent, i, j) {\n var pos = ijToPos[parent.orientation][2 * i + j];\n var p = new PaddedCell();\n p.id = children(parent.id)[pos];\n p.padding = parent.padding;\n p.boundRect = Rect.fromRect(parent.boundRect);\n p.orientation = parent.orientation ^ posToOrientation[pos];\n p.level = parent.level + 1;\n p.middleRect = Rect.empty();\n var ijSize = sizeIJ(p.level);\n p.iLo = parent.iLo + i * ijSize;\n p.jLo = parent.jLo + j * ijSize;\n var middle = parent.middle();\n if (i === 1) {\n p.boundRect.x.lo = middle.x.lo;\n } else {\n p.boundRect.x.hi = middle.x.hi;\n }\n if (j === 1) {\n p.boundRect.y.lo = middle.y.lo;\n } else {\n p.boundRect.y.hi = middle.y.hi;\n }\n return p;\n }\n /** Returns the CellID this padded cell represents. */;\n var _proto = PaddedCell.prototype;\n _proto.cellID = function cellID() {\n return this.id;\n }\n /** Returns the amount of padding on this cell. */;\n _proto.paddingValue = function paddingValue() {\n return this.padding;\n }\n /** Returns the level this cell is at. */;\n _proto.levelValue = function levelValue() {\n return this.level;\n }\n /** Returns the center of this cell. */;\n _proto.center = function center() {\n var ijSize = sizeIJ(this.level);\n var si = 2 * this.iLo + ijSize;\n var ti = 2 * this.jLo + ijSize;\n return Point$1.fromVector(faceSiTiToXYZ(face$1(this.id), si, ti).normalize());\n }\n /** Returns the rectangle in the middle of this cell that belongs to all four of its children in (u,v)-space. */;\n _proto.middle = function middle() {\n if (this.middleRect.isEmpty()) {\n var ijSize = sizeIJ(this.level);\n var u = stToUV(siTiToST(2 * this.iLo + ijSize));\n var v = stToUV(siTiToST(2 * this.jLo + ijSize));\n this.middleRect = new Rect(new Interval(u - this.padding, u + this.padding), new Interval(v - this.padding, v + this.padding));\n }\n return this.middleRect;\n }\n /** Returns the bounds for this cell in (u,v)-space including padding. */;\n _proto.bound = function bound() {\n return this.boundRect;\n }\n /** Returns the (i,j) coordinates for the child cell at the given traversal position. */;\n _proto.childIJ = function childIJ(pos) {\n var ij = posToIJ[this.orientation][pos];\n return [ij >> 1, ij & 1];\n }\n /** Returns the vertex where the space-filling curve enters this cell. */;\n _proto.entryVertex = function entryVertex() {\n var i = this.iLo;\n var j = this.jLo;\n if (this.orientation & INVERT_MASK) {\n var ijSize = sizeIJ(this.level);\n i += ijSize;\n j += ijSize;\n }\n return Point$1.fromVector(faceSiTiToXYZ(face$1(this.id), 2 * i, 2 * j).normalize());\n }\n /** Returns the vertex where the space-filling curve exits this cell. */;\n _proto.exitVertex = function exitVertex() {\n var i = this.iLo;\n var j = this.jLo;\n var ijSize = sizeIJ(this.level);\n if (this.orientation === 0 || this.orientation === SWAP_MASK + INVERT_MASK) {\n i += ijSize;\n } else {\n j += ijSize;\n }\n return Point$1.fromVector(faceSiTiToXYZ(face$1(this.id), 2 * i, 2 * j).normalize());\n }\n /** Returns the smallest CellID that contains all descendants of this padded cell whose bounds intersect the given rect. */;\n _proto.shrinkToFit = function shrinkToFit(rect) {\n if (this.level === 0) {\n if (rect.x.contains(0) || rect.y.contains(0)) return this.id;\n }\n var ijSize = sizeIJ(this.level);\n if (rect.x.contains(stToUV(siTiToST(2 * this.iLo + ijSize))) || rect.y.contains(stToUV(siTiToST(2 * this.jLo + ijSize)))) {\n return this.id;\n }\n var padded = rect.expandedByMargin(this.padding + 1.5 * DBL_EPSILON$1);\n var iMin = this.iLo;\n var jMin = this.jLo;\n var iXor = 0;\n var jXor = 0;\n if (iMin < stToIJ(uvToST(padded.x.lo))) {\n iMin = stToIJ(uvToST(padded.x.lo));\n }\n if (this.iLo + ijSize - 1 <= stToIJ(uvToST(padded.x.hi))) {\n iXor = iMin ^ this.iLo + ijSize - 1;\n } else {\n iXor = iMin ^ stToIJ(uvToST(padded.x.hi));\n }\n if (jMin < stToIJ(uvToST(padded.y.lo))) {\n jMin = stToIJ(uvToST(padded.y.lo));\n }\n if (this.jLo + ijSize - 1 <= stToIJ(uvToST(padded.y.hi))) {\n jXor = jMin ^ this.jLo + ijSize - 1;\n } else {\n jXor = jMin ^ stToIJ(uvToST(padded.y.hi));\n }\n var levelMSB = BigInt((iXor | jXor) << 1) + 1n;\n var level = MAX_LEVEL - findMSBSetNonZero64(levelMSB);\n if (level <= this.level) return this.id;\n return parent(fromFaceIJ(face$1(this.id), iMin, jMin), level);\n };\n return PaddedCell;\n}();\n\n/** The possible CellRelations for a ShapeIndex. */\nvar INDEXED = 0;\nvar SUBDIVIDED = 1;\nvar DISJOINT = 2;\nvar STALE = 0; // There are pending updates.\nvar FRESH = 2; // There are no pending updates.\n// CELL_PADDING defines the total error when clipping an edge which comes\n// from two sources:\n// (1) Clipping the original spherical edge to a cube face (the face edge).\n// The maximum error in this step is faceClipErrorUVCoord.\n// (2) Clipping the face edge to the u- or v-coordinate of a cell boundary.\n// The maximum error in this step is edgeClipErrorUVCoord.\n// Finally, since we encounter the same errors when clipping query edges, we\n// double the total error so that we only need to pad edges during indexing\n// and not at query time.\nvar CELL_PADDING = 2.0 * (FACE_CLIP_ERROR_UV_COORD + EDGE_CLIP_ERROR_UV_COORD);\n// CELL_SIZE_TO_LONG_EDGE_RATIO defines the cell size relative to the length of an\n// edge at which it is first considered to be long. Long edges do not\n// contribute toward the decision to subdivide a cell further. For example,\n// a value of 2.0 means that the cell must be at least twice the size of the\n// edge in order for that edge to be counted. There are two reasons for not\n// counting long edges: (1) such edges typically need to be propagated to\n// several children, which increases time and memory costs without much benefit,\n// and (2) in pathological cases, many long edges close together could force\n// subdivision to continue all the way to the leaf cell level.\nvar CELL_SIZE_TO_LONG_EDGE_RATIO = 1.0;\n/**\r\n * faceEdge represents an edge that has been projected onto a given face.\r\n */\nvar FaceEdge = /*#__PURE__*/function () {\n /**\r\n * Returns a new FaceEdge.\r\n * @category Constructors\r\n */\n function FaceEdge(shapeID, edgeID, maxLevel, hasInterior, a, b, edge) {\n if (shapeID === void 0) {\n shapeID = 0;\n }\n if (edgeID === void 0) {\n edgeID = 0;\n }\n if (maxLevel === void 0) {\n maxLevel = 0;\n }\n if (hasInterior === void 0) {\n hasInterior = false;\n }\n if (a === void 0) {\n a = new Point(0, 0);\n }\n if (b === void 0) {\n b = new Point(0, 0);\n }\n if (edge === void 0) {\n edge = new Edge(new Point$1(0, 0, 0), new Point$1(0, 0, 0));\n }\n this.shapeID = shapeID;\n this.edgeID = edgeID;\n this.maxLevel = maxLevel;\n this.hasInterior = hasInterior;\n this.a = a;\n this.b = b;\n this.edge = edge;\n }\n var _proto = FaceEdge.prototype;\n _proto.copy = function copy() {\n return new FaceEdge(this.shapeID, this.edgeID, this.maxLevel, this.hasInterior, new Point(this.a.x, this.a.y), new Point(this.b.x, this.b.y), new Edge(Point$1.fromVector(this.edge.v0.vector), Point$1.fromVector(this.edge.v1.vector)));\n };\n return FaceEdge;\n}();\n/**\r\n * ClippedEdge represents the portion of that edge that has been clipped to a given Cell.\r\n */\nvar ClippedEdge =\n/**\r\n * Returns a new ClippedEdge.\r\n * @category Constructors\r\n */\nfunction ClippedEdge(faceEdge, bound) {\n this.faceEdge = faceEdge;\n this.bound = bound;\n};\nvar ShapeIndex = /*#__PURE__*/function () {\n /**\r\n * Creates a new ShapeIndex.\r\n * @category Constructors\r\n */\n function ShapeIndex() {\n var _this = this;\n /**\r\n * Returns an iterator for this index.\r\n */\n this.iterator = function () {\n _this.maybeApplyUpdates();\n return new ShapeIndexIterator(_this, ITERATOR_BEGIN);\n };\n /**\r\n * Positions the iterator at the first cell in the index.\r\n */\n this.begin = function () {\n _this.maybeApplyUpdates();\n return new ShapeIndexIterator(_this, ITERATOR_BEGIN);\n };\n /**\r\n * Positions the iterator at the last cell in the index.\r\n */\n this.end = function () {\n _this.maybeApplyUpdates();\n return new ShapeIndexIterator(_this, ITERATOR_END);\n };\n /**\r\n * Returns a new ShapeIndexRegion for this ShapeIndex.\r\n */\n this.region = function () {\n return new ShapeIndexRegion(_this, new ContainsPointQuery(_this, VERTEX_MODEL_SEMI_OPEN));\n };\n /**\r\n * Reports the number of Shapes in this index.\r\n */\n this.len = function () {\n return _this.shapes.size;\n };\n /**\r\n * Resets the index to its original state.\r\n */\n this.reset = function () {\n _this.shapes.clear();\n _this.nextID = 0;\n _this.cellMap.clear();\n _this.cells = [];\n _this.status = FRESH;\n };\n /**\r\n * Returns the number of edges in this index.\r\n */\n this.numEdges = function () {\n var numEdges = 0;\n _this.shapes.forEach(function (shape) {\n numEdges += shape.numEdges();\n });\n return numEdges;\n };\n /**\r\n * Returns the number of edges in the given index, up to the given\r\n * limit. If the limit is encountered, the current running total is returned,\r\n * which may be more than the limit.\r\n */\n this.numEdgesUpTo = function (limit) {\n var numEdges = 0;\n for (var i = 0; i <= _this.nextID; i++) {\n var s = _this.shape(i);\n if (s instanceof NilShape) continue;\n numEdges += s.numEdges();\n if (numEdges >= limit) break;\n }\n return numEdges;\n };\n /**\r\n * Returns the shape with the given ID, or undefined if the shape has been removed from the index.\r\n */\n this.shape = function (id) {\n return _this.shapes.get(id) || new NilShape();\n };\n /**\r\n * Returns the id of the given shape in this index, or -1 if it is\r\n * not in the index.\r\n */\n this.idForShape = function (shape) {\n for (var _iterator = _createForOfIteratorHelperLoose(_this.shapes.entries()), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n k = _step$value[0],\n v = _step$value[1];\n if (v === shape) return k;\n }\n return -1;\n };\n /**\r\n * Adds the given shape to the index and returns the assigned ID.\r\n */\n this.add = function (shape) {\n _this.shapes.set(_this.nextID, shape);\n _this.nextID++;\n _this.status = STALE;\n return _this.nextID - 1;\n };\n /**\r\n * Removes the given shape from the index.\r\n */\n this.remove = function (shape) {\n var id = _this.idForShape(shape);\n if (!_this.shapes.has(id)) return;\n _this.shapes[\"delete\"](id);\n if (id >= _this.pendingAdditionsPos) return;\n var numEdges = shape.numEdges();\n var removed = new RemovedShape(id, shape.dimension() === 2, shape.referencePoint().contained, new Array(numEdges));\n for (var e = 0; e < numEdges; e++) {\n removed.edges[e] = shape.edge(e);\n }\n _this.pendingRemovals.push(removed);\n _this.status = STALE;\n };\n /**\r\n * Triggers the update of the index. Calls to Add and Release are normally\r\n * queued and processed on the first subsequent query. This has many advantages,\r\n * the most important of which is that sometimes there *is* no subsequent\r\n * query, which lets us avoid building the index completely.\r\n *\r\n * This method forces any pending updates to be applied immediately.\r\n */\n this.build = function () {\n return _this.maybeApplyUpdates();\n };\n /**\r\n * Reports if there are no pending updates that need to be applied.\r\n * This can be useful to avoid building the index unnecessarily, or for\r\n * choosing between two different algorithms depending on whether the index\r\n * is available.\r\n *\r\n * The returned index status may be slightly out of date if the index was\r\n * built in a different thread. This is fine for the intended use (as an\r\n * efficiency hint), but it should not be used by internal methods.\r\n */\n this.isFresh = function () {\n return _this.status === FRESH;\n };\n /**\r\n * Reports if this is the first update to the index.\r\n */\n this.isFirstUpdate = function () {\n return _this.pendingAdditionsPos === 0;\n };\n /**\r\n * Reports if the shape with the given ID is currently slated for removal.\r\n */\n this.isShapeBeingRemoved = function (shapeID) {\n return shapeID < _this.pendingAdditionsPos;\n };\n /**\r\n * Checks if the index pieces have changed, and if so, applies pending updates.\r\n */\n this.maybeApplyUpdates = function () {\n if (_this.status !== FRESH) {\n _this.applyUpdatesInternal();\n _this.status = FRESH;\n }\n };\n /**\r\n * Does the actual work of updating the index by applying all\r\n * pending additions and removals. It does *not* update the indexes status.\r\n */\n this.applyUpdatesInternal = function () {\n var t = new ShapeIndexTracker();\n var allEdges = Array.from({\n length: 6\n }, function () {\n return [];\n });\n for (var _iterator2 = _createForOfIteratorHelperLoose(_this.pendingRemovals), _step2; !(_step2 = _iterator2()).done;) {\n var p = _step2.value;\n _this.removeShapeInternal(p, allEdges, t);\n }\n for (var id = _this.pendingAdditionsPos; id < _this.shapes.size; id++) {\n _this.addShapeInternal(id, allEdges, t);\n }\n for (var _face = 0; _face < 6; _face++) {\n _this.updateFaceEdges(_face, allEdges[_face], t);\n }\n _this.pendingRemovals.length = 0;\n _this.pendingAdditionsPos = _this.shapes.size;\n // It is the caller's responsibility to update the index status.\n };\n /**\r\n * Clips all edges of the given shape to the six cube faces,\r\n * adds the clipped edges to the set of allEdges, and starts tracking its\r\n * interior if necessary.\r\n */\n this.addShapeInternal = function (shapeID, allEdges, t) {\n var shape = _this.shapes.get(shapeID) || new NilShape();\n if (shape instanceof NilShape) return;\n var faceEdge = new FaceEdge(shapeID, undefined, undefined, shape.dimension() === 2);\n if (faceEdge.hasInterior) {\n t.addShape(shapeID, containsBruteForce(shape, t.focus()));\n }\n var numEdges = shape.numEdges();\n for (var e = 0; e < numEdges; e++) {\n var edge = shape.edge(e);\n faceEdge.edgeID = e;\n faceEdge.edge = edge;\n faceEdge.maxLevel = maxLevelForEdge(edge);\n _this.addFaceEdge(faceEdge, allEdges);\n }\n };\n /**\r\n * Adds the given faceEdge into the collection of all edges.\r\n */\n this.addFaceEdge = function (_fe, allEdges) {\n var fe = _fe.copy();\n var aFace = face(fe.edge.v0.vector);\n if (aFace === face(fe.edge.v1.vector)) {\n var _validFaceXYZToUV = validFaceXYZToUV(aFace, fe.edge.v0.vector),\n x = _validFaceXYZToUV[0],\n y = _validFaceXYZToUV[1];\n fe.a = new Point(x, y);\n var _validFaceXYZToUV2 = validFaceXYZToUV(aFace, fe.edge.v1.vector);\n x = _validFaceXYZToUV2[0];\n y = _validFaceXYZToUV2[1];\n fe.b = new Point(x, y);\n var maxUV = 1 - CELL_PADDING;\n if (Math.abs(fe.a.x) <= maxUV && Math.abs(fe.a.y) <= maxUV && Math.abs(fe.b.x) <= maxUV && Math.abs(fe.b.y) <= maxUV) {\n allEdges[aFace].push(fe);\n return;\n }\n }\n for (var _face2 = 0; _face2 < 6; _face2++) {\n var _clipToPaddedFace = clipToPaddedFace(fe.edge.v0, fe.edge.v1, _face2, CELL_PADDING),\n aClip = _clipToPaddedFace[0],\n bClip = _clipToPaddedFace[1],\n intersects = _clipToPaddedFace[2];\n if (intersects) {\n var fe2 = _fe.copy();\n fe2.a = aClip;\n fe2.b = bClip;\n allEdges[_face2].push(fe2);\n }\n }\n };\n /**\r\n * Adds or removes the various edges from the index.\r\n * An edge is added if shapes[id] is not null, and removed otherwise.\r\n */\n this.updateFaceEdges = function (face, faceEdges, t) {\n var numEdges = faceEdges.length;\n if (numEdges === 0 && t.shapeIDs.length === 0) return;\n var clippedEdges = Array(numEdges);\n var bound = Rect.empty();\n for (var e = 0; e < numEdges; e++) {\n var clipped = new ClippedEdge(faceEdges[e], Rect.fromPoints(faceEdges[e].a, faceEdges[e].b));\n clippedEdges[e] = clipped;\n bound = bound.addRect(clipped.bound);\n }\n var faceID = fromFace(face);\n var pcell = PaddedCell.fromCellID(faceID, CELL_PADDING);\n var disjointFromIndex = _this.isFirstUpdate();\n if (numEdges > 0) {\n var shrunkID = _this.shrinkToFit(pcell, bound);\n if (shrunkID !== pcell.id) {\n // All the edges are contained by some descendant of the face cell. We\n // can save a lot of work by starting directly with that cell, but if we\n // are in the interior of at least one shape then we need to create\n // index entries for the cells we are skipping over.\n _this.skipCellRange(rangeMin(faceID), rangeMin(shrunkID), t, disjointFromIndex);\n pcell = PaddedCell.fromCellID(shrunkID, CELL_PADDING);\n _this.updateEdges(pcell, clippedEdges, t, disjointFromIndex);\n _this.skipCellRange(next(rangeMax(shrunkID)), next(rangeMax(faceID)), t, disjointFromIndex);\n return;\n }\n }\n _this.updateEdges(pcell, clippedEdges, t, disjointFromIndex);\n };\n /**\r\n * Shrinks the PaddedCell to fit within the given bounds.\r\n */\n this.shrinkToFit = function (pcell, bound) {\n var shrunkID = pcell.shrinkToFit(bound);\n if (!_this.isFirstUpdate() && shrunkID !== pcell.id) {\n // Don't shrink any smaller than the existing index cells, since we need\n // to combine the new edges with those cells.\n var iter = _this.iterator();\n if (iter.locateCellID(shrunkID) === INDEXED) {\n shrunkID = iter.cellID();\n }\n }\n return shrunkID;\n };\n /**\r\n * Skips over the cells in the given range, creating index cells if we are\r\n * currently in the interior of at least one shape.\r\n */\n this.skipCellRange = function (begin, end, t, disjointFromIndex) {\n if (t.shapeIDs.length === 0) return;\n var skipped = CellUnion.fromRange(begin, end);\n for (var _iterator3 = _createForOfIteratorHelperLoose(skipped), _step3; !(_step3 = _iterator3()).done;) {\n var cell = _step3.value;\n var ClippedEdges = [];\n _this.updateEdges(PaddedCell.fromCellID(cell, CELL_PADDING), ClippedEdges, t, disjointFromIndex);\n }\n };\n /**\r\n * Adds or removes the given edges whose bounding boxes intersect a\r\n * given cell. disjointFromIndex is an optimization hint indicating that cellMap\r\n * does not contain any entries that overlap the given cell.\r\n */\n this.updateEdges = function (pcell, edges, t, disjointFromIndex) {\n // This function is recursive with a maximum recursion depth of 30 (MaxLevel).\n // Incremental updates are handled as follows. All edges being added or\n // removed are combined together in edges, and all shapes with interiors\n // are tracked using tracker. We subdivide recursively as usual until we\n // encounter an existing index cell. At this point we absorb the index\n // cell as follows:\n //\n // - Edges and shapes that are being removed are deleted from edges and\n // tracker.\n // - All remaining edges and shapes from the index cell are added to\n // edges and tracker.\n // - Continue subdividing recursively, creating new index cells as needed.\n // - When the recursion gets back to the cell that was absorbed, we\n // restore edges and tracker to their previous state.\n //\n // Note that the only reason that we include removed shapes in the recursive\n // subdivision process is so that we can find all of the index cells that\n // contain those shapes efficiently, without maintaining an explicit list of\n // index cells for each shape (which would be expensive in terms of memory).\n var indexCellAbsorbed = false;\n if (!disjointFromIndex) {\n // There may be existing index cells contained inside pcell. If we\n // encounter such a cell, we need to combine the edges being updated with\n // the existing cell contents by absorbing the cell.\n var iter = _this.iterator();\n var r = iter.locateCellID(pcell.id);\n if (r === DISJOINT) disjointFromIndex = true;else if (r === INDEXED) {\n // Absorb the index cell by transferring its contents to edges and\n // deleting it. We also start tracking the interior of any new shapes.\n _this.absorbIndexCell(pcell, iter, edges, t);\n indexCellAbsorbed = true;\n disjointFromIndex = true;\n }\n }\n // If there are existing index cells below us, then we need to keep\n // subdividing so that we can merge with those cells. Otherwise,\n // makeIndexCell checks if the number of edges is small enough, and creates\n // an index cell if possible (returning true when it does so).\n if (!disjointFromIndex || !_this.makeIndexCell(pcell, edges, t)) {\n // TODO(roberts): If it turns out to have memory problems when there\n // are 10M+ edges in the index, look into pre-allocating space so we\n // are not always appending.\n var childEdges = [[[], []], [[], []]];\n // Compute the middle of the padded cell, defined as the rectangle in\n // (u,v)-space that belongs to all four (padded) children. By comparing\n // against the four boundaries of middle we can determine which children\n // each edge needs to be propagated to.\n var middle = pcell.middle();\n // Build up a vector edges to be passed to each child cell. The (i,j)\n // directions are left (i=0), right (i=1), lower (j=0), and upper (j=1).\n // Note that the vast majority of edges are propagated to a single child.\n for (var _iterator4 = _createForOfIteratorHelperLoose(edges), _step4; !(_step4 = _iterator4()).done;) {\n var edge = _step4.value;\n if (edge.bound.x.hi <= middle.x.lo) {\n // Edge is entirely contained in the two left children.\n var _this$clipVAxis = _this.clipVAxis(edge, middle.y),\n a = _this$clipVAxis[0],\n b = _this$clipVAxis[1];\n if (a) childEdges[0][0].push(a);\n if (b) childEdges[0][1].push(b);\n } else if (edge.bound.x.lo >= middle.x.hi) {\n // Edge is entirely contained in the two right children.\n var _this$clipVAxis2 = _this.clipVAxis(edge, middle.y),\n _a = _this$clipVAxis2[0],\n _b = _this$clipVAxis2[1];\n if (_a) childEdges[1][0].push(_a);\n if (_b) childEdges[1][1].push(_b);\n } else if (edge.bound.y.hi <= middle.y.lo) {\n // Edge is entirely contained in the two lower children.\n var _a2 = _this.clipUBound(edge, 1, middle.x.hi);\n if (_a2) childEdges[0][0].push(_a2);\n var _b2 = _this.clipUBound(edge, 0, middle.x.lo);\n if (_b2) childEdges[1][0].push(_b2);\n } else if (edge.bound.y.lo >= middle.y.hi) {\n // Edge is entirely contained in the two upper children.\n var _a3 = _this.clipUBound(edge, 1, middle.x.hi);\n if (_a3) childEdges[0][1].push(_a3);\n var _b3 = _this.clipUBound(edge, 0, middle.x.lo);\n if (_b3) childEdges[1][1].push(_b3);\n } else {\n // The edge bound spans all four children. The edge\n // itself intersects either three or four padded children.\n var left = _this.clipUBound(edge, 1, middle.x.hi);\n var _this$clipVAxis3 = _this.clipVAxis(left, middle.y),\n _a4 = _this$clipVAxis3[0],\n _b4 = _this$clipVAxis3[1];\n if (_a4) childEdges[0][0].push(_a4);\n if (_b4) childEdges[0][1].push(_b4);\n var right = _this.clipUBound(edge, 0, middle.x.lo);\n var _this$clipVAxis4 = _this.clipVAxis(right, middle.y);\n _a4 = _this$clipVAxis4[0];\n _b4 = _this$clipVAxis4[1];\n if (_a4) childEdges[1][0].push(_a4);\n if (_b4) childEdges[1][1].push(_b4);\n }\n }\n // Now recursively update the edges in each child. We call the children in\n // increasing order of CellID so that when the index is first constructed,\n // all insertions into cellMap are at the end (which is much faster).\n for (var pos = 0; pos < 4; pos++) {\n var _pcell$childIJ = pcell.childIJ(pos),\n i = _pcell$childIJ[0],\n j = _pcell$childIJ[1];\n if (childEdges[i][j].length > 0 || t.shapeIDs.length > 0) {\n _this.updateEdges(PaddedCell.fromParentIJ(pcell, i, j), childEdges[i][j], t, disjointFromIndex);\n }\n }\n }\n // Restore the state for any edges being removed that we are tracking.\n if (indexCellAbsorbed) t.restoreStateBefore(_this.pendingAdditionsPos);\n };\n /**\r\n * Builds an indexCell from the given padded cell and set of edges and adds\r\n * it to the index. If the cell or edges are empty, no cell is added.\r\n */\n this.makeIndexCell = function (p, edges, t) {\n if (edges.length === 0 && t.shapeIDs.length === 0) return true;\n var count = 0;\n for (var _iterator5 = _createForOfIteratorHelperLoose(edges), _step5; !(_step5 = _iterator5()).done;) {\n var ce = _step5.value;\n if (p.level < ce.faceEdge.maxLevel) count++;\n if (count > _this.maxEdgesPerCell) return false;\n }\n if (t.isActive && edges.length !== 0) {\n if (!t.atCellID(p.id)) t.moveTo(p.entryVertex());\n t.drawTo(p.center());\n _this.testAllEdges(edges, t);\n }\n var cshapeIDs = t.shapeIDs;\n var numShapes = _this.countShapes(edges, cshapeIDs);\n var cell = new ShapeIndexCell(numShapes);\n var eNext = 0;\n var cNextIdx = 0;\n for (var i = 0; i < numShapes; i++) {\n var clipped = void 0;\n var eshapeID = _this.shapes.size;\n var cshapeID = eshapeID;\n if (eNext !== edges.length) eshapeID = edges[eNext].faceEdge.shapeID;\n if (cNextIdx < cshapeIDs.length) cshapeID = cshapeIDs[cNextIdx];\n var eBegin = eNext;\n if (cshapeID < eshapeID) {\n clipped = new ShapeIndexClippedShape(cshapeID, 0);\n clipped.containsCenter = true;\n cNextIdx++;\n } else {\n while (eNext < edges.length && edges[eNext].faceEdge.shapeID === eshapeID) eNext++;\n clipped = new ShapeIndexClippedShape(eshapeID, eNext - eBegin);\n for (var e = eBegin; e < eNext; e++) clipped.edges[e - eBegin] = edges[e].faceEdge.edgeID;\n if (cshapeID === eshapeID) {\n clipped.containsCenter = true;\n cNextIdx++;\n }\n }\n cell.shapes[i] = clipped;\n }\n _this.cellMap.set(p.id, cell);\n _this.cells.push(p.id);\n if (t.isActive && edges.length !== 0) {\n t.drawTo(p.exitVertex());\n _this.testAllEdges(edges, t);\n t.setNextCellID(next(p.id));\n }\n return true;\n };\n /**\r\n * Updates the specified endpoint of the given clipped edge and returns the\r\n * resulting clipped edge.\r\n */\n this.updateBound = function (edge, uEnd, u, vEnd, v) {\n var c = new ClippedEdge(edge.faceEdge, new Rect());\n if (uEnd === 0) {\n c.bound.x.lo = u;\n c.bound.x.hi = edge.bound.x.hi;\n } else {\n c.bound.x.lo = edge.bound.x.lo;\n c.bound.x.hi = u;\n }\n if (vEnd === 0) {\n c.bound.y.lo = v;\n c.bound.y.hi = edge.bound.y.hi;\n } else {\n c.bound.y.lo = edge.bound.y.lo;\n c.bound.y.hi = v;\n }\n return c;\n };\n /**\r\n * Clips the given endpoint (lo=0, hi=1) of the u-axis so that\r\n * it does not extend past the given value of the given edge.\r\n */\n this.clipUBound = function (edge, uEnd, u) {\n if (uEnd === 0 && edge.bound.x.lo >= u) return edge;\n if (uEnd === 1 && edge.bound.x.hi <= u) return edge;\n var e = edge.faceEdge;\n var v = edge.bound.y.clampPoint(interpolateFloat64(u, e.a.x, e.b.x, e.a.y, e.b.y));\n var positiveSlope = e.a.x > e.b.x === e.a.y > e.b.y;\n var vEnd = uEnd === 1 === positiveSlope ? 1 : 0;\n return _this.updateBound(edge, uEnd, u, vEnd, v);\n };\n /**\r\n * Clips the given endpoint (lo=0, hi=1) of the v-axis so that\r\n * it does not extend past the given value of the given edge.\r\n */\n this.clipVBound = function (edge, vEnd, v) {\n if (vEnd === 0 && edge.bound.y.lo >= v) return edge;\n if (vEnd === 1 && edge.bound.y.hi <= v) return edge;\n var e = edge.faceEdge;\n var u = edge.bound.x.clampPoint(interpolateFloat64(v, e.a.y, e.b.y, e.a.x, e.b.x));\n var positiveSlope = e.a.x > e.b.x === e.a.y > e.b.y;\n var uEnd = vEnd === 1 === positiveSlope ? 1 : 0;\n return _this.updateBound(edge, uEnd, u, vEnd, v);\n };\n /**\r\n * Returns the given edge clipped to within the boundaries of the middle\r\n * interval along the v-axis, and adds the result to its children.\r\n */\n this.clipVAxis = function (edge, middle) {\n if (edge.bound.y.hi <= middle.lo) return [edge, undefined];\n if (edge.bound.y.lo >= middle.hi) return [undefined, edge];\n return [_this.clipVBound(edge, 1, middle.hi), _this.clipVBound(edge, 0, middle.lo)];\n };\n /**\r\n * Absorbs an index cell by transferring its contents to edges\r\n * and/or \"tracker\", and then delete this cell from the index. If edges includes\r\n * any edges that are being removed, this method also updates their\r\n * InteriorTracker state to correspond to the exit vertex of this cell.\r\n */\n this.absorbIndexCell = function (p, iter, edges, t) {\n if (t.isActive && edges.length !== 0 && _this.isShapeBeingRemoved(edges[0].faceEdge.shapeID)) {\n if (!t.atCellID(p.id)) t.moveTo(p.entryVertex());\n t.drawTo(p.exitVertex());\n t.setNextCellID(next(p.id));\n for (var _iterator6 = _createForOfIteratorHelperLoose(edges), _step6; !(_step6 = _iterator6()).done;) {\n var edge = _step6.value;\n var fe = edge.faceEdge;\n if (!_this.isShapeBeingRemoved(fe.shapeID)) break;\n if (fe.hasInterior) t.testEdge(fe.shapeID, fe.edge);\n }\n }\n t.saveAndClearStateBefore(_this.pendingAdditionsPos);\n var faceEdges = [];\n var trackerMoved = false;\n var cell = iter.indexCell();\n if (cell) {\n for (var _iterator7 = _createForOfIteratorHelperLoose(cell.shapes), _step7; !(_step7 = _iterator7()).done;) {\n var clipped = _step7.value;\n var shapeID = clipped.shapeID;\n var shape = _this.shape(shapeID);\n if (!shape) continue;\n var numClipped = clipped.numEdges();\n var _edge = new FaceEdge(shapeID, undefined, undefined, shape.dimension() === 2);\n if (_edge.hasInterior) {\n t.addShape(shapeID, clipped.containsCenter);\n if (!trackerMoved && numClipped > 0) {\n t.moveTo(p.center());\n t.drawTo(p.entryVertex());\n t.setNextCellID(p.id);\n trackerMoved = true;\n }\n }\n for (var i = 0; i < numClipped; i++) {\n var edgeID = clipped.edges[i];\n _edge.edgeID = edgeID;\n _edge.edge = shape.edge(edgeID);\n _edge.maxLevel = maxLevelForEdge(_edge.edge);\n if (_edge.hasInterior) t.testEdge(shapeID, _edge.edge);\n var _clipToPaddedFace2 = clipToPaddedFace(_edge.edge.v0, _edge.edge.v1, face$1(p.id), CELL_PADDING),\n a = _clipToPaddedFace2[0],\n b = _clipToPaddedFace2[1],\n ok = _clipToPaddedFace2[2];\n if (!ok) throw new Error('invariant failure in ShapeIndex');\n _edge.a = a;\n _edge.b = b;\n faceEdges.push(_edge);\n }\n }\n }\n var newEdges = faceEdges.map(function (faceEdge) {\n return new ClippedEdge(faceEdge, clippedEdgeBound(faceEdge.a, faceEdge.b, p.bound()));\n });\n for (var _iterator8 = _createForOfIteratorHelperLoose(edges), _step8; !(_step8 = _iterator8()).done;) {\n var _clipped = _step8.value;\n if (!_this.isShapeBeingRemoved(_clipped.faceEdge.shapeID)) {\n newEdges.push.apply(newEdges, edges.slice(edges.indexOf(_clipped)));\n break;\n }\n }\n edges = newEdges;\n _this.cellMap[\"delete\"](p.id);\n };\n /**\r\n * Calls the trackers testEdge on all edges from shapes that have interiors.\r\n */\n this.testAllEdges = function (edges, t) {\n for (var _iterator9 = _createForOfIteratorHelperLoose(edges), _step9; !(_step9 = _iterator9()).done;) {\n var edge = _step9.value;\n if (edge.faceEdge.hasInterior) t.testEdge(edge.faceEdge.shapeID, edge.faceEdge.edge);\n }\n };\n /**\r\n * Reports the number of distinct shapes that are either associated with the\r\n * given edges, or that are currently stored in the InteriorTracker.\r\n */\n this.countShapes = function (edges, shapeIDs) {\n var count = 0;\n var lastShapeID = -1;\n var clippedNext = 0;\n var shapeIDidx = 0;\n for (var _iterator0 = _createForOfIteratorHelperLoose(edges), _step0; !(_step0 = _iterator0()).done;) {\n var edge = _step0.value;\n if (edge.faceEdge.shapeID === lastShapeID) continue;\n count++;\n lastShapeID = edge.faceEdge.shapeID;\n while (shapeIDidx < shapeIDs.length) {\n clippedNext = shapeIDs[shapeIDidx];\n if (clippedNext > lastShapeID) break;\n if (clippedNext < lastShapeID) count++;\n shapeIDidx++;\n }\n }\n count += shapeIDs.length - shapeIDidx;\n return count;\n };\n this.maxEdgesPerCell = 10;\n this.nextID = 0;\n this.shapes = new Map();\n this.cellMap = new Map();\n this.cells = [];\n this.status = FRESH;\n this.pendingAdditionsPos = 0;\n this.pendingRemovals = [];\n }\n /** Does the actual work for removing a given shape from the index. */\n var _proto2 = ShapeIndex.prototype;\n _proto2.removeShapeInternal = function removeShapeInternal(_removed, _allEdges, _t) {\n // not implemented\n };\n return ShapeIndex;\n}();\n/**\r\n * Reports the maximum level for a given edge.\r\n */\nvar maxLevelForEdge = function maxLevelForEdge(edge) {\n var cellSize = edge.v0.vector.sub(edge.v1.vector).norm() * CELL_SIZE_TO_LONG_EDGE_RATIO;\n return AvgEdgeMetric.minLevel(cellSize);\n};\n/**\r\n * Represents a set of edges from the given shape that is queued for removal.\r\n */\nvar RemovedShape =\n/**\r\n * Returns a new RemovedShape.\r\n * @category Constructors\r\n */\nfunction RemovedShape(shapeID, hasInterior, containsTrackerOrigin, edges) {\n this.shapeID = shapeID;\n this.hasInterior = hasInterior;\n this.containsTrackerOrigin = containsTrackerOrigin;\n this.edges = edges;\n};\n\n/**\r\n * Returns an empty result indicating no edge was found.\r\n */\nfunction emptyClosestEdgeQueryResult() {\n return {\n distance: infChordAngle(),\n shapeID: -1,\n edgeID: -1\n };\n}\n/**\r\n * Compares two results first by distance, then by (shapeID, edgeID).\r\n */\nfunction compareResults(a, b) {\n if (a.distance < b.distance) return -1;\n if (a.distance > b.distance) return 1;\n if (a.shapeID < b.shapeID) return -1;\n if (a.shapeID > b.shapeID) return 1;\n if (a.edgeID < b.edgeID) return -1;\n if (a.edgeID > b.edgeID) return 1;\n return 0;\n}\n/**\r\n * Options that control the set of edges returned. Note that by default\r\n * *all* edges are returned, so you will always want to set either the\r\n * maxResults option or the maxDistance option (or both).\r\n */\nvar ClosestEdgeQueryOptions = /*#__PURE__*/function () {\n function ClosestEdgeQueryOptions() {\n /**\r\n * Specifies that at most \"maxResults\" edges should be returned.\r\n * Default: Infinity (no limit)\r\n */\n this.maxResults = Infinity;\n /**\r\n * Specifies that only edges whose distance to the target is less than\r\n * \"maxDistance\" should be returned.\r\n *\r\n * Note that edges whose distance is exactly equal to \"maxDistance\" are\r\n * not returned. Normally this doesn't matter, because distances are not\r\n * computed exactly in the first place, but if such edges are needed then\r\n * see setInclusiveMaxDistance() below.\r\n *\r\n * Default: Infinity\r\n */\n this.maxDistance = infChordAngle();\n /**\r\n * Specifies that edges up to maxError further away than the true\r\n * closest edges may be substituted in the result set, as long as such\r\n * edges satisfy all the remaining search criteria (such as maxDistance).\r\n * This option only has an effect if maxResults is also specified;\r\n * otherwise all edges closer than maxDistance will always be returned.\r\n *\r\n * Default: 0\r\n */\n this.maxError = 0;\n /**\r\n * Specifies that polygon interiors should be included when measuring\r\n * distances. If true, the distance to a point inside a polygon is zero.\r\n *\r\n * Default: true\r\n */\n this.includeInteriors = true;\n /**\r\n * Specifies that distances should be computed by examining every edge\r\n * rather than using the ShapeIndex. This is useful for testing and\r\n * debugging, and also for very small indexes where the overhead of\r\n * building the index is not worthwhile.\r\n *\r\n * Default: false\r\n */\n this.useBruteForce = false;\n }\n /**\r\n * Sets maxDistance to the given value such that edges whose distance\r\n * is exactly equal to maxDistance are also returned.\r\n * Equivalent to setting maxDistance to maxDistance.successor().\r\n */\n var _proto = ClosestEdgeQueryOptions.prototype;\n _proto.setInclusiveMaxDistance = function setInclusiveMaxDistance(maxDistance) {\n this.maxDistance = successor(maxDistance);\n }\n /**\r\n * Sets maxDistance such that edges whose true distance is less than\r\n * or equal to maxDistance will be returned (along with some edges whose\r\n * true distance is slightly greater).\r\n *\r\n * This ensures that all edges whose true distance is less than or equal\r\n * to maxDistance will be returned. The maxDistance is increased by the\r\n * maximum error in the distance calculation.\r\n */;\n _proto.setConservativeMaxDistance = function setConservativeMaxDistance(maxDistance) {\n this.maxDistance = successor(expanded(maxDistance, minUpdateDistanceMaxError(maxDistance)));\n }\n /**\r\n * Creates a copy of these options.\r\n */;\n _proto.clone = function clone() {\n var copy = new ClosestEdgeQueryOptions();\n copy.maxResults = this.maxResults;\n copy.maxDistance = this.maxDistance;\n copy.maxError = this.maxError;\n copy.includeInteriors = this.includeInteriors;\n copy.useBruteForce = this.useBruteForce;\n return copy;\n };\n return ClosestEdgeQueryOptions;\n}();\n/**\r\n * Target subtype that computes the closest distance to a point.\r\n */\nvar PointTarget = /*#__PURE__*/function () {\n function PointTarget(point) {\n this._includeInteriors = true;\n this.point = point;\n }\n var _proto2 = PointTarget.prototype;\n _proto2.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n // Break-even points are approximately 80, 100, and 250 edges for point\n // cloud, fractal, and regular loop geometry respectively.\n return 120;\n };\n _proto2.updateMinDistanceToEdge = function updateMinDistanceToEdge(v0, v1, minDist) {\n var result = updateMinDistance(this.point, v0, v1, minDist);\n return {\n distance: result.dist,\n updated: result.less\n };\n };\n _proto2.updateMinDistanceToPoint = function updateMinDistanceToPoint(point, minDist) {\n var dist = Point$1.chordAngleBetweenPoints(this.point, point);\n if (dist < minDist) {\n return {\n distance: dist,\n updated: true\n };\n }\n return {\n distance: minDist,\n updated: false\n };\n };\n _proto2.updateMinDistanceToCell = function updateMinDistanceToCell(cell, minDist) {\n var dist = cell.distance(this.point);\n if (dist < minDist) {\n return {\n distance: dist,\n updated: true\n };\n }\n return {\n distance: minDist,\n updated: false\n };\n };\n _proto2.includeInteriors = function includeInteriors() {\n return this._includeInteriors;\n };\n _proto2.setIncludeInteriors = function setIncludeInteriors(includeInteriors) {\n this._includeInteriors = includeInteriors;\n };\n _proto2.setMaxError = function setMaxError(_maxError) {\n return false;\n };\n _proto2.visitContainingShapeIds = function visitContainingShapeIds(index, visitor) {\n var _this = this;\n var query = new ContainsPointQuery(index, VERTEX_MODEL_SEMI_OPEN);\n return query.visitContainingShapes(this.point, function (shape) {\n var shapeID = index.idForShape(shape);\n if (shapeID >= 0) {\n return visitor(shapeID, _this.point);\n }\n return true;\n });\n };\n _proto2.getCapBound = function getCapBound() {\n return {\n center: this.point,\n radius: 0\n };\n };\n return PointTarget;\n}();\n/**\r\n * Target subtype that computes the closest distance to an edge.\r\n */\nvar EdgeTarget = /*#__PURE__*/function () {\n function EdgeTarget(a, b) {\n this._includeInteriors = true;\n this.a = a;\n this.b = b;\n }\n var _proto3 = EdgeTarget.prototype;\n _proto3.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n // Break-even points are approximately 40, 50, and 100 edges.\n return 60;\n };\n _proto3.updateMinDistanceToEdge = function updateMinDistanceToEdge(v0, v1, minDist) {\n // Compute edge-to-edge distance.\n return updateEdgePairMinDistance(this.a, this.b, v0, v1, minDist);\n };\n _proto3.updateMinDistanceToPoint = function updateMinDistanceToPoint(point, minDist) {\n var result = updateMinDistance(point, this.a, this.b, minDist);\n return {\n distance: result.dist,\n updated: result.less\n };\n };\n _proto3.updateMinDistanceToCell = function updateMinDistanceToCell(cell, minDist) {\n var dist = cell.distanceToEdge(this.a, this.b);\n if (dist < minDist) {\n return {\n distance: dist,\n updated: true\n };\n }\n return {\n distance: minDist,\n updated: false\n };\n };\n _proto3.includeInteriors = function includeInteriors() {\n return this._includeInteriors;\n };\n _proto3.setIncludeInteriors = function setIncludeInteriors(includeInteriors) {\n this._includeInteriors = includeInteriors;\n };\n _proto3.setMaxError = function setMaxError(_maxError) {\n return false;\n };\n _proto3.visitContainingShapeIds = function visitContainingShapeIds(index, visitor) {\n // Check if either endpoint is contained.\n var query = new ContainsPointQuery(index, VERTEX_MODEL_SEMI_OPEN);\n var visited = new Set();\n var _loop = function _loop() {\n var point = _arr[_i];\n var result = query.visitContainingShapes(point, function (shape) {\n var shapeID = index.idForShape(shape);\n if (shapeID >= 0 && !visited.has(shapeID)) {\n visited.add(shapeID);\n return visitor(shapeID, point);\n }\n return true;\n });\n if (!result) return {\n v: false\n };\n },\n _ret;\n for (var _i = 0, _arr = [this.a, this.b]; _i < _arr.length; _i++) {\n _ret = _loop();\n if (_ret) return _ret.v;\n }\n return true;\n };\n _proto3.getCapBound = function getCapBound() {\n // Return cap centered at midpoint with radius to cover both endpoints.\n var mid = Point$1.fromVector(this.a.vector.add(this.b.vector).normalize());\n var radius = Math.max(Point$1.chordAngleBetweenPoints(mid, this.a), Point$1.chordAngleBetweenPoints(mid, this.b));\n return {\n center: mid,\n radius: radius\n };\n };\n return EdgeTarget;\n}();\n/**\r\n * Target subtype that computes the closest distance to an S2Cell\r\n * (including the interior of the cell).\r\n */\nvar CellTarget = /*#__PURE__*/function () {\n function CellTarget(cell) {\n this._includeInteriors = true;\n this.cell = cell;\n }\n var _proto4 = CellTarget.prototype;\n _proto4.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n // Break-even points are approximately 20, 25, and 40 edges.\n return 30;\n };\n _proto4.updateMinDistanceToEdge = function updateMinDistanceToEdge(v0, v1, minDist) {\n var dist = this.cell.distanceToEdge(v0, v1);\n if (dist < minDist) {\n return {\n distance: dist,\n updated: true\n };\n }\n return {\n distance: minDist,\n updated: false\n };\n };\n _proto4.updateMinDistanceToPoint = function updateMinDistanceToPoint(point, minDist) {\n var dist = this.cell.distance(point);\n if (dist < minDist) {\n return {\n distance: dist,\n updated: true\n };\n }\n return {\n distance: minDist,\n updated: false\n };\n };\n _proto4.updateMinDistanceToCell = function updateMinDistanceToCell(cell, minDist) {\n var dist = this.cell.distanceToCell(cell);\n if (dist < minDist) {\n return {\n distance: dist,\n updated: true\n };\n }\n return {\n distance: minDist,\n updated: false\n };\n };\n _proto4.includeInteriors = function includeInteriors() {\n return this._includeInteriors;\n };\n _proto4.setIncludeInteriors = function setIncludeInteriors(includeInteriors) {\n this._includeInteriors = includeInteriors;\n };\n _proto4.setMaxError = function setMaxError(_maxError) {\n return false;\n };\n _proto4.visitContainingShapeIds = function visitContainingShapeIds(index, visitor) {\n // Check if the cell center is contained.\n var query = new ContainsPointQuery(index, VERTEX_MODEL_SEMI_OPEN);\n var center = this.cell.center();\n return query.visitContainingShapes(center, function (shape) {\n var shapeID = index.idForShape(shape);\n if (shapeID >= 0) {\n return visitor(shapeID, center);\n }\n return true;\n });\n };\n _proto4.getCapBound = function getCapBound() {\n var center = this.cell.center();\n // Use max distance from center to any vertex as radius.\n var radius = 0;\n for (var i = 0; i < 4; i++) {\n var d = Point$1.chordAngleBetweenPoints(center, this.cell.vertex(i));\n if (d > radius) radius = d;\n }\n return {\n center: center,\n radius: radius\n };\n };\n return CellTarget;\n}();\n/**\r\n * Target subtype that computes the closest distance to an S2ShapeIndex\r\n * (an arbitrary collection of points, polylines, and/or polygons).\r\n *\r\n * By default, distances are measured to the boundary and interior of\r\n * polygons in the S2ShapeIndex rather than to polygon boundaries only.\r\n * If you wish to change this behavior, you may call:\r\n *\r\n * target.setIncludeInteriors(false)\r\n */\nvar ShapeIndexTarget = /*#__PURE__*/function () {\n function ShapeIndexTarget(index) {\n this._includeInteriors = true;\n this.index = index;\n this.query = new ContainsPointQuery(index, VERTEX_MODEL_SEMI_OPEN);\n }\n var _proto5 = ShapeIndexTarget.prototype;\n _proto5.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n // Break-even points are approximately 20, 30, and 40 edges.\n return 25;\n };\n _proto5.updateMinDistanceToEdge = function updateMinDistanceToEdge(v0, v1, minDist) {\n // Check if either endpoint is contained by a polygon.\n if (this._includeInteriors) {\n if (this.query.contains(v0) || this.query.contains(v1)) {\n return {\n distance: 0,\n updated: minDist > 0\n };\n }\n }\n // Compute distance to all edges in the target index.\n var updated = false;\n for (var _iterator = _createForOfIteratorHelperLoose(this.index.shapes), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n shape = _step$value[1];\n if (!shape) continue;\n var numEdges = shape.numEdges();\n for (var i = 0; i < numEdges; i++) {\n var edge = shape.edge(i);\n var result = updateEdgePairMinDistance(v0, v1, edge.v0, edge.v1, minDist);\n if (result.updated) {\n minDist = result.distance;\n updated = true;\n }\n if (minDist === 0) return {\n distance: 0,\n updated: updated\n };\n }\n }\n return {\n distance: minDist,\n updated: updated\n };\n };\n _proto5.updateMinDistanceToPoint = function updateMinDistanceToPoint(point, minDist) {\n // Check if the point is contained by a polygon.\n if (this._includeInteriors && this.query.contains(point)) {\n return {\n distance: 0,\n updated: minDist > 0\n };\n }\n // Compute distance to all edges in the target index.\n var updated = false;\n for (var _iterator2 = _createForOfIteratorHelperLoose(this.index.shapes), _step2; !(_step2 = _iterator2()).done;) {\n var _step2$value = _step2.value,\n shape = _step2$value[1];\n if (!shape) continue;\n var numEdges = shape.numEdges();\n for (var i = 0; i < numEdges; i++) {\n var edge = shape.edge(i);\n var result = updateMinDistance(point, edge.v0, edge.v1, minDist);\n if (result.less) {\n minDist = result.dist;\n updated = true;\n }\n if (minDist === 0) return {\n distance: 0,\n updated: updated\n };\n }\n }\n return {\n distance: minDist,\n updated: updated\n };\n };\n _proto5.updateMinDistanceToCell = function updateMinDistanceToCell(cell, minDist) {\n // Check if the cell center is contained by a polygon.\n if (this._includeInteriors && this.query.contains(cell.center())) {\n return {\n distance: 0,\n updated: minDist > 0\n };\n }\n // Compute distance to all edges in the target index.\n var updated = false;\n for (var _iterator3 = _createForOfIteratorHelperLoose(this.index.shapes), _step3; !(_step3 = _iterator3()).done;) {\n var _step3$value = _step3.value,\n shape = _step3$value[1];\n if (!shape) continue;\n var numEdges = shape.numEdges();\n for (var i = 0; i < numEdges; i++) {\n var edge = shape.edge(i);\n var dist = cell.distanceToEdge(edge.v0, edge.v1);\n if (dist < minDist) {\n minDist = dist;\n updated = true;\n }\n if (minDist === 0) return {\n distance: 0,\n updated: updated\n };\n }\n }\n return {\n distance: minDist,\n updated: updated\n };\n };\n _proto5.includeInteriors = function includeInteriors() {\n return this._includeInteriors;\n };\n _proto5.setIncludeInteriors = function setIncludeInteriors(includeInteriors) {\n this._includeInteriors = includeInteriors;\n };\n _proto5.setMaxError = function setMaxError(_maxError) {\n return false;\n };\n _proto5.visitContainingShapeIds = function visitContainingShapeIds(index, visitor) {\n // For each shape in the query index, check if it contains any point\n // from the target index.\n var queryContains = new ContainsPointQuery(index, VERTEX_MODEL_SEMI_OPEN);\n var visited = new Set();\n // Check if target shapes contain any query shape centers.\n for (var _iterator4 = _createForOfIteratorHelperLoose(this.index.shapes), _step4; !(_step4 = _iterator4()).done;) {\n var _step4$value = _step4.value,\n shape = _step4$value[1];\n if (!shape) continue;\n var numEdges = shape.numEdges();\n for (var i = 0; i < numEdges; i++) {\n var edge = shape.edge(i);\n var _loop2 = function _loop2() {\n var point = _arr2[_i2];\n var result = queryContains.visitContainingShapes(point, function (queryShape) {\n var id = index.idForShape(queryShape);\n if (id >= 0 && !visited.has(id)) {\n visited.add(id);\n return visitor(id, point);\n }\n return true;\n });\n if (!result) return {\n v: false\n };\n },\n _ret2;\n for (var _i2 = 0, _arr2 = [edge.v0, edge.v1]; _i2 < _arr2.length; _i2++) {\n _ret2 = _loop2();\n if (_ret2) return _ret2.v;\n }\n }\n }\n return true;\n };\n _proto5.getCapBound = function getCapBound() {\n // Return null if the index is empty.\n if (this.index.len() === 0) return null;\n // Compute bounding cap over all edges.\n var center = null;\n var radius = 0;\n for (var _iterator5 = _createForOfIteratorHelperLoose(this.index.shapes), _step5; !(_step5 = _iterator5()).done;) {\n var _step5$value = _step5.value,\n shape = _step5$value[1];\n if (!shape) continue;\n var numEdges = shape.numEdges();\n for (var i = 0; i < numEdges; i++) {\n var edge = shape.edge(i);\n if (center === null) {\n center = edge.v0;\n }\n var d0 = Point$1.chordAngleBetweenPoints(center, edge.v0);\n var d1 = Point$1.chordAngleBetweenPoints(center, edge.v1);\n radius = Math.max(radius, d0, d1);\n }\n }\n if (center === null) return null;\n return {\n center: center,\n radius: radius\n };\n };\n return ShapeIndexTarget;\n}();\n/**\r\n * Computes the minimum distance between two edges.\r\n */\nfunction updateEdgePairMinDistance(a0, a1, b0, b1, minDist) {\n if (minDist === 0) return {\n distance: 0,\n updated: false\n };\n if (crossingSign(a0, a1, b0, b1) === CROSS) {\n return {\n distance: 0,\n updated: true\n };\n }\n // Otherwise, the minimum distance is achieved at an endpoint of at least\n // one of the two edges.\n var updated = false;\n var result = updateMinDistance(a0, b0, b1, minDist);\n if (result.less) {\n minDist = result.dist;\n updated = true;\n }\n result = updateMinDistance(a1, b0, b1, minDist);\n if (result.less) {\n minDist = result.dist;\n updated = true;\n }\n result = updateMinDistance(b0, a0, a1, minDist);\n if (result.less) {\n minDist = result.dist;\n updated = true;\n }\n result = updateMinDistance(b1, a0, a1, minDist);\n if (result.less) {\n minDist = result.dist;\n updated = true;\n }\n return {\n distance: minDist,\n updated: updated\n };\n}\n/**\r\n * S2ClosestEdgeQuery is a helper class for searching within an S2ShapeIndex\r\n * to find the closest edge(s) to a given point, edge, S2Cell, or geometry\r\n * collection.\r\n */\nvar ClosestEdgeQuery = /*#__PURE__*/function () {\n /**\r\n * Constructs a new ClosestEdgeQuery for the given ShapeIndex.\r\n * Options may be specified here or changed at any time using the options property.\r\n *\r\n * REQUIRES: \"index\" must persist for the lifetime of this object.\r\n * REQUIRES: reInit() must be called if \"index\" is modified.\r\n */\n function ClosestEdgeQuery(index, options) {\n if (options === void 0) {\n options = new ClosestEdgeQueryOptions();\n }\n this.indexNumEdges = 0;\n this.indexNumEdgesLimit = 0;\n this.index = index;\n this.options = options;\n this.iter = index.iterator();\n }\n /**\r\n * Reinitializes the query. This method must be called whenever the\r\n * underlying S2ShapeIndex is modified.\r\n */\n var _proto6 = ClosestEdgeQuery.prototype;\n _proto6.reInit = function reInit() {\n this.indexNumEdges = 0;\n this.indexNumEdgesLimit = 0;\n this.iter = this.index.iterator();\n }\n /**\r\n * Returns the closest edges to the given target that satisfy the current\r\n * options. This method may be called multiple times.\r\n *\r\n * Note that if options.includeInteriors is true, the result vector may\r\n * include some entries with edgeID == -1. This indicates that the target\r\n * intersects the indexed polygon with the given shapeID. Such results may\r\n * be identified by calling isInteriorResult().\r\n */;\n _proto6.findClosestEdges = function findClosestEdges(target, filter) {\n return this.findClosestEdgesInternal(target, this.options, filter);\n }\n /**\r\n * Calls a callback with the closest edges to the given target that satisfy\r\n * the given options. Edges are reported in order of increasing distance.\r\n *\r\n * Updating the state that the ShapeFilter accesses while visiting is allowed\r\n * and can be used to disable reporting of results on the fly.\r\n */;\n _proto6.visitClosestEdges = function visitClosestEdges(target, options, visitor, filter) {\n var results = this.findClosestEdgesInternal(target, options, filter);\n for (var _iterator6 = _createForOfIteratorHelperLoose(results), _step6; !(_step6 = _iterator6()).done;) {\n var result = _step6.value;\n if (!visitor(result)) break;\n }\n }\n /**\r\n * Calls a callback with the closest edge of each shape to the given target\r\n * that satisfies the given options. Shapes are reported in order of\r\n * increasing distance.\r\n */;\n _proto6.visitClosestShapes = function visitClosestShapes(target, options, visitor, filter) {\n var results = this.findClosestEdgesInternal(target, options, filter);\n var seenShapes = new Set();\n var lastShape = -1;\n for (var _iterator7 = _createForOfIteratorHelperLoose(results), _step7; !(_step7 = _iterator7()).done;) {\n var result = _step7.value;\n var shapeID = result.shapeID;\n if (shapeID !== lastShape && !seenShapes.has(shapeID)) {\n seenShapes.add(shapeID);\n lastShape = shapeID;\n if (!visitor(result)) break;\n }\n }\n }\n /**\r\n * Returns the closest edge to the target. If no edge satisfies the search\r\n * criteria, then the result object's isEmptyResult() will return true.\r\n *\r\n * Note that if options.includeInteriors is true, isInteriorResult()\r\n * should be called to check whether the result represents an interior point\r\n * (in which case edgeID == -1).\r\n */;\n _proto6.findClosestEdge = function findClosestEdge(target, filter) {\n var tmpOptions = this.options.clone();\n tmpOptions.maxResults = 1;\n var results = this.findClosestEdgesInternal(target, tmpOptions, filter);\n if (results.length === 0) {\n return emptyClosestEdgeQueryResult();\n }\n return results[0];\n }\n /**\r\n * Returns the minimum distance to the target. If the index or target is\r\n * empty, returns Infinity.\r\n *\r\n * Use isDistanceLess() if you only want to compare the distance against a\r\n * threshold value, since it is often much faster.\r\n */;\n _proto6.getDistance = function getDistance(target, filter) {\n return this.findClosestEdge(target, filter).distance;\n }\n /**\r\n * Returns true if the distance to \"target\" is less than \"limit\".\r\n *\r\n * This method is usually much faster than getDistance(), since it is much\r\n * less work to determine whether the minimum distance is above or below a\r\n * threshold than it is to calculate the actual minimum distance.\r\n */;\n _proto6.isDistanceLess = function isDistanceLess(target, limit, filter) {\n var tmpOptions = this.options.clone();\n tmpOptions.maxResults = 1;\n tmpOptions.maxDistance = limit;\n tmpOptions.maxError = STRAIGHT_CHORDANGLE;\n var result = this.findClosestEdgesInternal(target, tmpOptions, filter);\n return result.length > 0;\n }\n /**\r\n * Like isDistanceLess(), but also returns true if the distance to \"target\"\r\n * is exactly equal to \"limit\".\r\n */;\n _proto6.isDistanceLessOrEqual = function isDistanceLessOrEqual(target, limit, filter) {\n var tmpOptions = this.options.clone();\n tmpOptions.maxResults = 1;\n tmpOptions.setInclusiveMaxDistance(limit);\n tmpOptions.maxError = STRAIGHT_CHORDANGLE;\n var result = this.findClosestEdgesInternal(target, tmpOptions, filter);\n return result.length > 0;\n }\n /**\r\n * Like isDistanceLessOrEqual(), except that \"limit\" is increased by the\r\n * maximum error in the distance calculation. This ensures that this\r\n * function returns true whenever the true, exact distance is less than\r\n * or equal to \"limit\".\r\n *\r\n * For example, suppose that we want to test whether two geometries might\r\n * intersect each other after they are snapped together using S2Builder\r\n * (using the IdentitySnapFunction with a given \"snap_radius\"). Since\r\n * S2Builder uses exact distance predicates (s2predicates.h), we need to\r\n * measure the distance between the two geometries conservatively. If the\r\n * distance is definitely greater than \"snap_radius\", then the geometries\r\n * are guaranteed to not intersect after snapping.\r\n */;\n _proto6.isConservativeDistanceLessOrEqual = function isConservativeDistanceLessOrEqual(target, limit, filter) {\n var tmpOptions = this.options.clone();\n tmpOptions.maxResults = 1;\n tmpOptions.setConservativeMaxDistance(limit);\n tmpOptions.maxError = STRAIGHT_CHORDANGLE;\n var result = this.findClosestEdgesInternal(target, tmpOptions, filter);\n return result.length > 0;\n }\n /**\r\n * Returns the endpoints of the given result edge.\r\n * REQUIRES: !isInteriorResult(result)\r\n */;\n _proto6.getEdge = function getEdge(result) {\n var shape = this.index.shape(result.shapeID);\n return shape.edge(result.edgeID);\n }\n /**\r\n * Returns the point on given result edge that is closest to \"point\".\r\n */;\n _proto6.project = function project$1(point, result) {\n if (result.edgeID < 0) return point;\n var edge = this.getEdge(result);\n return project(point, edge.v0, edge.v1);\n }\n /**\r\n * Internal method that performs the actual query.\r\n */;\n _proto6.findClosestEdgesInternal = function findClosestEdgesInternal(target, options, filter) {\n var distanceLimit = options.maxDistance;\n var results = [];\n if (distanceLimit === 0) return results;\n // Handle include_interiors case.\n if (options.includeInteriors) {\n var shapeIds = new Set();\n target.visitContainingShapeIds(this.index, function (shapeID, _point) {\n if (!filter || filter(shapeID)) {\n shapeIds.add(shapeID);\n }\n return shapeIds.size < options.maxResults;\n });\n for (var _iterator8 = _createForOfIteratorHelperLoose(shapeIds), _step8; !(_step8 = _iterator8()).done;) {\n var shapeID = _step8.value;\n results.push({\n distance: 0,\n shapeID: shapeID,\n edgeID: -1\n });\n }\n if (distanceLimit === 0) return results;\n }\n // Determine whether to use brute force or optimized algorithm.\n var minOptimizedEdges = target.maxBruteForceIndexSize() + 1;\n if (minOptimizedEdges > this.indexNumEdgesLimit && this.indexNumEdges >= this.indexNumEdgesLimit) {\n this.indexNumEdges = this.countEdgesUpTo(minOptimizedEdges);\n this.indexNumEdgesLimit = minOptimizedEdges;\n }\n if (options.useBruteForce || this.indexNumEdges < minOptimizedEdges) {\n this.findClosestEdgesBruteForce(target, options, filter, distanceLimit, results);\n } else {\n this.findClosestEdgesOptimized(target, options, filter, distanceLimit, results);\n }\n // Sort and limit results.\n results.sort(compareResults);\n // Remove duplicates.\n var uniqueResults = [];\n for (var _i3 = 0, _results = results; _i3 < _results.length; _i3++) {\n var result = _results[_i3];\n if (uniqueResults.length === 0 || uniqueResults[uniqueResults.length - 1].shapeID !== result.shapeID || uniqueResults[uniqueResults.length - 1].edgeID !== result.edgeID) {\n uniqueResults.push(result);\n }\n }\n // Apply maxResults limit.\n if (uniqueResults.length > options.maxResults) {\n uniqueResults.length = options.maxResults;\n }\n return uniqueResults;\n }\n /**\r\n * Brute force algorithm that examines every edge.\r\n */;\n _proto6.findClosestEdgesBruteForce = function findClosestEdgesBruteForce(target, options, filter, distanceLimit, results) {\n for (var _iterator9 = _createForOfIteratorHelperLoose(this.index.shapes), _step9; !(_step9 = _iterator9()).done;) {\n var _step9$value = _step9.value,\n shapeID = _step9$value[0],\n shape = _step9$value[1];\n if (!shape) continue;\n if (filter && !filter(shapeID)) continue;\n var numEdges = shape.numEdges();\n for (var edgeID = 0; edgeID < numEdges; edgeID++) {\n var edge = shape.edge(edgeID);\n var result = target.updateMinDistanceToEdge(edge.v0, edge.v1, distanceLimit);\n if (result.updated) {\n var newResult = {\n distance: result.distance,\n shapeID: shapeID,\n edgeID: edgeID\n };\n if (options.maxResults === 1) {\n // Keep only the single best result.\n if (results.length === 0) {\n results.push(newResult);\n } else {\n results[0] = newResult;\n }\n distanceLimit = result.distance - options.maxError;\n } else if (options.maxResults === Infinity) {\n // Keep all results.\n results.push(newResult);\n } else {\n // Keep up to maxResults results.\n results.push(newResult);\n if (results.length > options.maxResults) {\n results.sort(compareResults);\n results.length = options.maxResults;\n distanceLimit = results[results.length - 1].distance - options.maxError;\n }\n }\n }\n }\n }\n }\n /**\r\n * Optimized algorithm using priority queue and cell hierarchy.\r\n */;\n _proto6.findClosestEdgesOptimized = function findClosestEdgesOptimized(target, options, filter, distanceLimit, results) {\n // Get the target's bounding cap.\n var capBound = target.getCapBound();\n if (!capBound) return; // Empty target.\n // Initialize iterator.\n this.iter = this.index.iterator();\n // Optimization: if looking for just the closest edge and the cap center\n // happens to intersect an index cell, process that cell first.\n if (options.maxResults === 1 && this.iter.locatePoint(capBound.center)) {\n var cell = this.iter.indexCell();\n distanceLimit = this.processIndexCell(target, options, filter, cell, distanceLimit, results);\n if (distanceLimit === 0) return;\n }\n // Build priority queue of cells to process.\n var queue = [];\n // Start by adding all top-level cells that intersect the target.\n this.iter.begin();\n while (!this.iter.done()) {\n var id = this.iter.cellID();\n var _cell = Cell.fromCellID(id);\n var result = target.updateMinDistanceToCell(_cell, distanceLimit);\n if (result.distance < distanceLimit) {\n queue.push({\n distance: result.distance,\n id: id,\n indexCell: this.iter.indexCell()\n });\n }\n this.iter.next();\n }\n // Sort queue by distance (ascending).\n queue.sort(function (a, b) {\n return a.distance - b.distance;\n });\n // Process cells in order of increasing distance.\n while (queue.length > 0) {\n var entry = queue.shift();\n if (entry.distance >= distanceLimit) break;\n if (entry.indexCell !== null) {\n // This is an index cell; process its edges.\n distanceLimit = this.processIndexCell(target, options, filter, entry.indexCell, distanceLimit, results);\n } else {\n // This is a parent cell; add its children to the queue.\n console.log(\"HEYYYY\");\n var childIds = children(entry.id);\n for (var _iterator0 = _createForOfIteratorHelperLoose(childIds), _step0; !(_step0 = _iterator0()).done;) {\n var childId = _step0.value;\n var relation = this.iter.locateCellID(childId);\n if (relation === INDEXED) {\n var _cell2 = Cell.fromCellID(this.iter.cellID());\n var _result = target.updateMinDistanceToCell(_cell2, distanceLimit);\n if (_result.distance < distanceLimit) {\n queue.push({\n distance: _result.distance,\n id: this.iter.cellID(),\n indexCell: this.iter.indexCell()\n });\n }\n } else if (relation === SUBDIVIDED) {\n var _cell3 = Cell.fromCellID(childId);\n var _result2 = target.updateMinDistanceToCell(_cell3, distanceLimit);\n if (_result2.distance < distanceLimit) {\n queue.push({\n distance: _result2.distance,\n id: childId,\n indexCell: null\n });\n }\n }\n }\n // Re-sort queue.\n queue.sort(function (a, b) {\n return a.distance - b.distance;\n });\n }\n }\n }\n /**\r\n * Process all edges in an index cell.\r\n */;\n _proto6.processIndexCell = function processIndexCell(target, options, filter, indexCell, distanceLimit, results) {\n for (var _iterator1 = _createForOfIteratorHelperLoose(indexCell.shapes), _step1; !(_step1 = _iterator1()).done;) {\n var clipped = _step1.value;\n var shapeID = clipped.shapeID;\n if (filter && !filter(shapeID)) continue;\n var shape = this.index.shape(shapeID);\n if (!shape) continue;\n for (var _iterator10 = _createForOfIteratorHelperLoose(clipped.edges), _step10; !(_step10 = _iterator10()).done;) {\n var edgeID = _step10.value;\n var edge = shape.edge(edgeID);\n var result = target.updateMinDistanceToEdge(edge.v0, edge.v1, distanceLimit);\n if (result.updated) {\n var newResult = {\n distance: result.distance,\n shapeID: shapeID,\n edgeID: edgeID\n };\n if (options.maxResults === 1) {\n if (results.length === 0) {\n results.push(newResult);\n } else {\n results[0] = newResult;\n }\n distanceLimit = result.distance - options.maxError;\n } else if (options.maxResults === Infinity) {\n results.push(newResult);\n } else {\n results.push(newResult);\n if (results.length > options.maxResults) {\n results.sort(compareResults);\n results.length = options.maxResults;\n distanceLimit = results[results.length - 1].distance - options.maxError;\n }\n }\n }\n }\n }\n return distanceLimit;\n }\n /**\r\n * Counts edges in the index up to a limit.\r\n */;\n _proto6.countEdgesUpTo = function countEdgesUpTo(limit) {\n var count = 0;\n for (var _iterator11 = _createForOfIteratorHelperLoose(this.index.shapes), _step11; !(_step11 = _iterator11()).done;) {\n var _step11$value = _step11.value,\n shape = _step11$value[1];\n if (!shape) continue;\n count += shape.numEdges();\n if (count >= limit) break;\n }\n return count;\n };\n return ClosestEdgeQuery;\n}();\n\n/**\r\n * Returns an empty result indicating no cell was found.\r\n */\nfunction emptyClosestCellQueryResult() {\n return {\n distance: infChordAngle(),\n cellID: 0n,\n label: -1\n };\n}\n/**\r\n * Reports whether the result is empty (no cell was found).\r\n */\nfunction isEmptyResult(result) {\n return result.label < 0;\n}\n/**\r\n * Options that control the set of cells returned. Note that by default\r\n * *all* cells are returned, so you will always want to set either the\r\n * maxResults option or the maxDistance option (or both).\r\n */\nvar ClosestCellQueryOptions = /*#__PURE__*/function () {\n function ClosestCellQueryOptions() {\n /**\r\n * Specifies that at most \"maxResults\" cells should be returned.\r\n * Default: Infinity (no limit)\r\n */\n this.maxResults = Infinity;\n /**\r\n * Specifies that only cells whose distance to the target is less than\r\n * \"maxDistance\" should be returned.\r\n *\r\n * Note that cells whose distance is exactly equal to \"maxDistance\" are\r\n * not returned. Normally this doesn't matter, because distances are not\r\n * computed exactly in the first place, but if such cells are needed then\r\n * see setInclusiveMaxDistance() below.\r\n *\r\n * Default: Infinity\r\n */\n this.maxDistance = infChordAngle();\n /**\r\n * Specifies that cells up to maxError further away than the true\r\n * closest cells may be substituted in the result set, as long as such\r\n * cells satisfy all the remaining search criteria (such as maxDistance).\r\n * This option only has an effect if maxResults is also specified;\r\n * otherwise all cells closer than maxDistance will always be returned.\r\n *\r\n * Default: 0\r\n */\n this.maxError = 0;\n }\n /**\r\n * Sets maxDistance to the given value such that cells whose distance\r\n * is exactly equal to maxDistance are also returned.\r\n * Equivalent to setting maxDistance to maxDistance.successor().\r\n */\n var _proto = ClosestCellQueryOptions.prototype;\n _proto.setInclusiveMaxDistance = function setInclusiveMaxDistance(maxDistance) {\n this.maxDistance = successor(maxDistance);\n }\n /**\r\n * Sets maxDistance such that cells whose true distance is less than\r\n * or equal to maxDistance will be returned (along with some cells whose\r\n * true distance is slightly greater).\r\n *\r\n * This ensures that all cells whose true distance is less than or equal\r\n * to maxDistance will be returned. The maxDistance is increased by the\r\n * maximum error in the distance calculation.\r\n */;\n _proto.setConservativeMaxDistance = function setConservativeMaxDistance(maxDistance) {\n this.maxDistance = successor(expanded(maxDistance, this.computeMaxDistanceError(maxDistance)));\n }\n /**\r\n * Computes the maximum error for the given distance.\r\n */;\n _proto.computeMaxDistanceError = function computeMaxDistanceError(distance) {\n // The maximum error depends on the distance computation method.\n // For now, return a conservative estimate.\n return maxPointError(distance);\n };\n return ClosestCellQueryOptions;\n}();\n/**\r\n * Target subtype that computes the closest distance to a point.\r\n */\nvar PointTarget$1 = /*#__PURE__*/function () {\n function PointTarget(point) {\n this.point = point;\n }\n var _proto2 = PointTarget.prototype;\n _proto2.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n return 100;\n };\n _proto2.distanceToCell = function distanceToCell(cell) {\n return cell.distance(this.point);\n };\n _proto2.distanceToPoint = function distanceToPoint(point) {\n return Point$1.chordAngleBetweenPoints(this.point, point);\n };\n return PointTarget;\n}();\n/**\r\n * Target subtype that computes the closest distance to an edge.\r\n */\nvar EdgeTarget$1 = /*#__PURE__*/function () {\n function EdgeTarget(a, b) {\n this.a = a;\n this.b = b;\n }\n var _proto3 = EdgeTarget.prototype;\n _proto3.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n return 100;\n };\n _proto3.distanceToCell = function distanceToCell(cell) {\n return cell.distanceToEdge(this.a, this.b);\n };\n _proto3.distanceToPoint = function distanceToPoint(point) {\n return updateMinDistance(point, this.a, this.b, infChordAngle()).dist;\n };\n return EdgeTarget;\n}();\n/**\r\n * Target subtype that computes the closest distance to an S2Cell\r\n * (including the interior of the cell).\r\n */\nvar CellTarget$1 = /*#__PURE__*/function () {\n function CellTarget(cell) {\n this.cell = cell;\n }\n var _proto4 = CellTarget.prototype;\n _proto4.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n return 100;\n };\n _proto4.distanceToCell = function distanceToCell(cell) {\n return this.cell.distanceToCell(cell);\n };\n _proto4.distanceToPoint = function distanceToPoint(point) {\n return this.cell.distance(point);\n };\n return CellTarget;\n}();\n/**\r\n * Target subtype that computes the closest distance to an S2CellUnion.\r\n */\nvar CellUnionTarget = /*#__PURE__*/function () {\n function CellUnionTarget(cellUnion) {\n this.cellUnion = cellUnion;\n }\n var _proto5 = CellUnionTarget.prototype;\n _proto5.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n return 100;\n };\n _proto5.distanceToCell = function distanceToCell(cell) {\n var minDist = infChordAngle();\n for (var _iterator = _createForOfIteratorHelperLoose(this.cellUnion), _step; !(_step = _iterator()).done;) {\n var id = _step.value;\n var unionCell = Cell.fromCellID(id);\n var dist = unionCell.distanceToCell(cell);\n if (dist < minDist) {\n minDist = dist;\n }\n if (minDist === 0) break;\n }\n return minDist;\n };\n _proto5.distanceToPoint = function distanceToPoint(point) {\n var minDist = infChordAngle();\n for (var _iterator2 = _createForOfIteratorHelperLoose(this.cellUnion), _step2; !(_step2 = _iterator2()).done;) {\n var id = _step2.value;\n var cell = Cell.fromCellID(id);\n var dist = cell.distance(point);\n if (dist < minDist) {\n minDist = dist;\n }\n if (minDist === 0) break;\n }\n return minDist;\n };\n return CellUnionTarget;\n}();\n/**\r\n * Target subtype that computes the closest distance to an S2ShapeIndex\r\n * (an arbitrary collection of points, polylines, and/or polygons).\r\n *\r\n * By default, distances are measured to the boundary and interior of\r\n * polygons in the S2ShapeIndex rather than to polygon boundaries only.\r\n * If you wish to change this behavior, you may call:\r\n *\r\n * target.setIncludeInteriors(false)\r\n */\nvar ShapeIndexTarget$1 = /*#__PURE__*/function () {\n function ShapeIndexTarget$1(index) {\n this.index = index;\n this.edgeTarget = new ShapeIndexTarget(index);\n }\n /**\r\n * Specifies whether distances should be measured to the boundary and\r\n * interior of polygons (true) or only to polygon boundaries (false).\r\n * The default is true.\r\n */\n var _proto6 = ShapeIndexTarget$1.prototype;\n _proto6.setIncludeInteriors = function setIncludeInteriors(includeInteriors) {\n this.edgeTarget.setIncludeInteriors(includeInteriors);\n };\n _proto6.maxBruteForceIndexSize = function maxBruteForceIndexSize() {\n return this.edgeTarget.maxBruteForceIndexSize();\n };\n _proto6.distanceToCell = function distanceToCell(cell) {\n var result = this.edgeTarget.updateMinDistanceToCell(cell, infChordAngle());\n return result.distance;\n };\n _proto6.distanceToPoint = function distanceToPoint(point) {\n var result = this.edgeTarget.updateMinDistanceToPoint(point, infChordAngle());\n return result.distance;\n };\n return ShapeIndexTarget$1;\n}();\n/**\r\n * S2ClosestCellQuery is a helper class for finding the closest cell(s) to a\r\n * given point, edge, S2Cell, S2CellUnion, or geometry collection.\r\n */\nvar ClosestCellQuery = /*#__PURE__*/function () {\n /**\r\n * Constructs a new ClosestCellQuery for the given CellIndex.\r\n * Options may be specified here or changed at any time using the options property.\r\n *\r\n */\n function ClosestCellQuery(index, options) {\n if (options === void 0) {\n options = new ClosestCellQueryOptions();\n }\n this.index = index;\n this.options = options;\n }\n /**\r\n * Find the closest cells to the target.\r\n * @param target - The target to find the closest cells to.\r\n * @returns An array of ClosestCellQueryResult objects.\r\n */\n var _proto7 = ClosestCellQuery.prototype;\n _proto7.findClosestCells = function findClosestCells(target) {\n // Iterate through all cells in the index and compute distances.\n var rangeIter = new CellIndexRangeIterator(this.index, true);\n var contentsIter = new CellIndexContentsIterator(this.index);\n // Collect all candidate cells.\n var candidates = [];\n for (rangeIter.begin(); !rangeIter.done(); rangeIter.next()) {\n contentsIter.startUnion(rangeIter);\n while (!contentsIter.done()) {\n var cellID = contentsIter.cellID();\n var label = contentsIter.label();\n var cell = Cell.fromCellID(cellID);\n // Check if this cell passes the region filter.\n if (this.options.region && !this.options.region.intersectsCell(cell)) {\n contentsIter.next();\n continue;\n }\n var distance = target.distanceToCell(cell);\n // Check distance constraint.\n if (distance < this.options.maxDistance) {\n candidates.push({\n cellID: cellID,\n label: label,\n distance: distance\n });\n }\n contentsIter.next();\n }\n }\n // Sort by distance.\n candidates.sort(function (a, b) {\n return a.distance - b.distance;\n });\n // Apply maxResults limit.\n var limit = Math.min(candidates.length, this.options.maxResults);\n return candidates.slice(0, limit);\n }\n /**\r\n * Returns the closest cell to the target. If no cell satisfies the search\r\n * criteria, then the Result object will have distance == Infinity and\r\n * isEmpty() == true.\r\n */;\n _proto7.findClosestCell = function findClosestCell(target) {\n var savedMaxResults = this.options.maxResults;\n this.options.maxResults = 1;\n var results = this.findClosestCells(target);\n this.options.maxResults = savedMaxResults;\n if (results.length === 0) {\n return emptyClosestCellQueryResult();\n }\n return results[0];\n }\n /**\r\n * Returns the minimum distance to the target. If the index or target is\r\n * empty, returns Infinity.\r\n *\r\n * Use isDistanceLess() if you only want to compare the distance against a\r\n * threshold value, since it is often much faster.\r\n */;\n _proto7.getDistance = function getDistance(target) {\n return this.findClosestCell(target).distance;\n }\n /**\r\n * Returns true if the distance to \"target\" is less than \"limit\".\r\n *\r\n * This method is usually much faster than getDistance(), since it is much\r\n * less work to determine whether the minimum distance is above or below a\r\n * threshold than it is to calculate the actual minimum distance.\r\n */;\n _proto7.isDistanceLess = function isDistanceLess(target, limit) {\n var savedMaxResults = this.options.maxResults;\n var savedMaxDistance = this.options.maxDistance;\n this.options.maxResults = 1;\n this.options.maxDistance = limit;\n var result = this.findClosestCell(target);\n this.options.maxResults = savedMaxResults;\n this.options.maxDistance = savedMaxDistance;\n return !isEmptyResult(result);\n }\n /**\r\n * Like isDistanceLess(), but also returns true if the distance to \"target\"\r\n * is exactly equal to \"limit\".\r\n */;\n _proto7.isDistanceLessOrEqual = function isDistanceLessOrEqual(target, limit) {\n return this.isDistanceLess(target, successor(limit));\n }\n /**\r\n * Like isDistanceLessOrEqual(), except that \"limit\" is increased by the\r\n * maximum error in the distance calculation. This ensures that this\r\n * function returns true whenever the true, exact distance is less than\r\n * or equal to \"limit\".\r\n */;\n _proto7.isConservativeDistanceLessOrEqual = function isConservativeDistanceLessOrEqual(target, limit) {\n return this.isDistanceLess(target, successor(expanded(limit, maxPointError(limit))));\n };\n return ClosestCellQuery;\n}();\n\n/**\r\n * Used to compute a bounding rectangle that contains all edges\r\n * defined by a vertex chain (v0, v1, v2, ...). All vertices must be unit length.\r\n * The bounding rectangle of an edge can be larger than the bounding\r\n * rectangle of its endpoints, e.g., consider an edge that passes through the North Pole.\r\n *\r\n * The bounds are calculated conservatively to account for numerical errors\r\n * when points are converted to LatLngs. This guarantees that if a point P is contained by the loop,\r\n * then `RectBound(L).ContainsPoint(LatLngFromPoint(P))` will be true.\r\n */\nvar RectBounder = /*#__PURE__*/function () {\n /**\r\n * Returns a new instance of a RectBounder.\r\n * @category Constructors\r\n */\n function RectBounder() {\n this.a = new Point$1(0, 0, 0);\n this.aLL = new LatLng(0, 0);\n this.bound = Rect$1.emptyRect();\n }\n /**\r\n * Returns the maximum error in RectBound provided that the result does not include either pole.\r\n * It is only used for testing purposes.\r\n */\n RectBounder.maxErrorForTests = function maxErrorForTests() {\n // The maximum error in the latitude calculation is\n // 3.84 * DBL_EPSILON for the PointCross calculation\n // 0.96 * DBL_EPSILON for the Latitude calculation\n // 5 * DBL_EPSILON added by AddPoint/RectBound to compensate for error\n // -----------------\n // 9.80 * DBL_EPSILON maximum error in result\n //\n // The maximum error in the longitude calculation is DBL_EPSILON. RectBound\n // does not do any expansion because this isn't necessary in order to\n // bound the *rounded* longitudes of contained points.\n return new LatLng(10 * DBL_EPSILON$1, 1 * DBL_EPSILON$1);\n }\n /**\r\n * Adds the given point to the chain. The Point must be unit length.\r\n */;\n var _proto = RectBounder.prototype;\n _proto.addPoint = function addPoint(b) {\n var bLL = LatLng.fromPoint(b);\n if (this.bound.isEmpty()) {\n this.a = b;\n this.aLL = bLL;\n this.bound = this.bound.addPoint(bLL);\n return;\n }\n // Compute the cross product N = A x B robustly. This is the normal\n // to the great circle through A and B. We don't use RobustSign\n // since that method returns an arbitrary vector orthogonal to A if the two\n // vectors are proportional, and we want the zero vector in that case.\n var n = this.a.vector.sub(b.vector).cross(this.a.vector.add(b.vector)); // N = 2 * (A x B)\n // Handle cases where the relative error in N gets large.\n var nNorm = n.norm();\n if (nNorm < 1.91346e-15) {\n if (this.a.vector.dot(b.vector) < 0) {\n this.bound = Rect$1.fullRect();\n } else {\n this.bound = this.bound.union(Rect$1.fromLatLng(this.aLL).addPoint(bLL));\n }\n this.a = b;\n this.aLL = bLL;\n return;\n }\n // Compute the longitude range spanned by AB.\n var lngAB = Interval$1.emptyInterval().addPoint(this.aLL.lng).addPoint(bLL.lng);\n if (lngAB.length() >= Math.PI - 2 * DBL_EPSILON$1) {\n lngAB = Interval$1.fullInterval();\n }\n /**\r\n * Next we compute the latitude range spanned by the edge AB. We start\r\n * with the range spanning the two endpoints of the edge:\r\n */\n var latAB = Interval.fromPoint(this.aLL.lat).addPoint(bLL.lat);\n // Check if AB crosses the plane through N and the Z-axis.\n var m = n.cross(new Vector(0, 0, 1));\n var mA = m.dot(this.a.vector);\n var mB = m.dot(b.vector);\n var mError = 6.06638e-16 * nNorm + 6.83174e-31;\n if (mA * mB < 0 || Math.abs(mA) <= mError || Math.abs(mB) <= mError) {\n var maxLat = Math.min(Math.atan2(Math.sqrt(n.x * n.x + n.y * n.y), Math.abs(n.z)) + 3 * DBL_EPSILON$1, Math.PI / 2);\n var latBudget = 2 * Math.asin(0.5 * this.a.vector.sub(b.vector).norm() * Math.sin(maxLat));\n var maxDelta = 0.5 * (latBudget - latAB.length()) + DBL_EPSILON$1;\n if (mA <= mError && mB >= -mError) latAB.hi = Math.min(maxLat, latAB.hi + maxDelta);\n if (mB <= mError && mA >= -mError) latAB.lo = Math.max(-maxLat, latAB.lo - maxDelta);\n }\n this.a = b;\n this.aLL = bLL;\n this.bound = this.bound.union(new Rect$1(latAB, lngAB));\n }\n /**\r\n * Returns the bounding rectangle of the edge chain that connects the vertices defined so far.\r\n */;\n _proto.rectBound = function rectBound() {\n return this.bound.expanded(new LatLng(2 * DBL_EPSILON$1, 0)).polarClosure();\n };\n return RectBounder;\n}();\n/**\r\n * Expands a bounding Rect so that it is guaranteed to contain the bounds of any subregion\r\n * whose bounds are computed using `ComputeRectBound`.\r\n *\r\n * For example, consider a loop L that defines a square.\r\n * This method ensures that if a point P is contained by this square, then LatLngFromPoint(P) is contained by the bound.\r\n * But now consider a diamond-shaped loop S contained by L.\r\n * It is possible that `GetBound` returns a *larger* bound for S than it does for L, due to rounding errors.\r\n * This method expands the bound for L so that it is guaranteed to contain the bounds of any subregion S.\r\n */\nRectBounder.expandForSubregions = function (bound) {\n if (bound.isEmpty()) return bound;\n var lngGap = Math.max(0, Math.PI - bound.lng.length() - 2.5 * DBL_EPSILON$1);\n var minAbsLat = Math.max(bound.lat.lo, -bound.lat.hi);\n var latGapSouth = Math.PI / 2 + bound.lat.lo;\n var latGapNorth = Math.PI / 2 - bound.lat.hi;\n if (minAbsLat >= 0) {\n if (2 * minAbsLat + lngGap < 1.354e-15) return Rect$1.fullRect();\n } else if (lngGap >= Math.PI / 2) {\n if (latGapSouth + latGapNorth < 1.687e-15) return Rect$1.fullRect();\n } else {\n if (Math.max(latGapSouth, latGapNorth) * lngGap < 1.765e-15) return Rect$1.fullRect();\n }\n var latExpansion = 9 * DBL_EPSILON$1;\n var lngExpansion = 0.0;\n if (lngGap <= 0) lngExpansion = Math.PI;\n return bound.expanded(new LatLng(latExpansion, lngExpansion)).polarClosure();\n};\n\n/**\r\n * Reports whether non-empty wedge A=(a0, ab1, a2) contains B=(b0, ab1, b2).\r\n * Equivalent to WedgeRelation == WEDGE_PROPERLY_CONTAINS || WEDGE_EQUALS.\r\n */\nvar wedgeContains = function wedgeContains(a0, ab1, a2, b0, b2) {\n return Point$1.orderedCCW(a2, b2, b0, ab1) && Point$1.orderedCCW(b0, a0, a2, ab1);\n};\n/**\r\n * Reports whether non-empty wedge A=(a0, ab1, a2) intersects B=(b0, ab1, b2).\r\n * Equivalent but faster than WedgeRelation != WEDGE_IS_DISJOINT.\r\n */\nvar wedgeIntersects = function wedgeIntersects(a0, ab1, a2, b0, b2) {\n return !(Point$1.orderedCCW(a0, b2, b0, ab1) && Point$1.orderedCCW(b0, a2, a0, ab1));\n};\n\n// CrossingEdgeQuery is used to find the Edge IDs of Shapes that are crossed by\n// a given edge(s).\n//\n// Note that if you need to query many edges, it is more efficient to declare\n// a single CrossingEdgeQuery instance and reuse it.\n//\n// If you want to find *all* the pairs of crossing edges, it is more efficient to\n// use the not yet implemented VisitCrossings in shapeutil.\nvar CrossingEdgeQuery = /*#__PURE__*/function () {\n /**\r\n * Returns a new CrossingEdgeQuery.\r\n * @category Constructors\r\n */\n function CrossingEdgeQuery(index) {\n this.a = new Point(0, 0);\n this.b = new Point(0, 0);\n this.index = index;\n this.iter = index.iterator();\n this.cells = [];\n }\n /**\r\n * Returns the set of edge IDs of the shape that intersect the given edge AB.\r\n * If the CrossingType is Interior, then only intersections at a point interior to both\r\n * edges are reported, while if it is CROSSING_TYPE_ALL then edges that share a vertex\r\n * are also reported.\r\n */\n var _proto = CrossingEdgeQuery.prototype;\n _proto.crossings = function crossings(a, b, shape, crossType) {\n var edges = this.candidates(a, b, shape);\n if (edges.length === 0) return [];\n var crosser = new EdgeCrosser(a, b);\n var out = 0;\n var n = edges.length;\n for (var inIdx = 0; inIdx < n; inIdx++) {\n var edge = shape.edge(edges[inIdx]);\n var sign = crosser.crossingSign(edge.v0, edge.v1);\n if (crossType === CROSSING_TYPE_ALL && (sign === MAYBE_CROSS || sign === CROSS) || crossType !== CROSSING_TYPE_ALL && sign === CROSS) {\n edges[out] = edges[inIdx];\n out++;\n }\n }\n if (out < n) edges = edges.slice(0, out);\n return edges;\n }\n /**\r\n * Returns the set of all edges in the index that intersect the given\r\n * edge AB. If crossType is CrossingTypeInterior, then only intersections at a\r\n * point interior to both edges are reported, while if it is CROSSING_TYPE_ALL\r\n * then edges that share a vertex are also reported.\r\n *\r\n * The edges are returned as a mapping from shape to the edges of that shape\r\n * that intersect AB. Every returned shape has at least one crossing edge.\r\n */;\n _proto.crossingsEdgeMap = function crossingsEdgeMap(a, b, crossType) {\n var edgeMap = this.candidatesEdgeMap(a, b);\n if (edgeMap.size === 0) return edgeMap;\n var crosser = new EdgeCrosser(a, b);\n edgeMap.forEach(function (edges, shape) {\n var n = edges.length;\n var out = 0;\n for (var inIdx = 0; inIdx < n; inIdx++) {\n var edge = shape.edge(edges[inIdx]);\n var sign = crosser.crossingSign(edge.v0, edge.v1);\n if (crossType === CROSSING_TYPE_ALL && (sign === MAYBE_CROSS || sign === CROSS) || crossType !== CROSSING_TYPE_ALL && sign === CROSS) {\n edges[out] = edges[inIdx];\n edgeMap.set(shape, edges);\n out++;\n }\n }\n if (out === 0) {\n edgeMap[\"delete\"](shape);\n } else if (out < n) {\n edgeMap.set(shape, edgeMap.get(shape).slice(0, out));\n }\n });\n return edgeMap;\n }\n /**\r\n * Returns a superset of the edges of the given shape that intersect the edge AB.\r\n */;\n _proto.candidates = function candidates(a, b, shape) {\n var edges = [];\n var maxBruteForceEdges = 27;\n var maxEdges = shape.numEdges();\n if (maxEdges <= maxBruteForceEdges) {\n edges = Array.from({\n length: maxEdges\n }, function (_, i) {\n return i;\n });\n return edges;\n }\n this.getCellsForEdge(a, b);\n if (this.cells.length === 0) return [];\n var shapeID = -1;\n this.index.shapes.forEach(function (v, k) {\n if (v === shape) shapeID = k;\n });\n for (var _iterator = _createForOfIteratorHelperLoose(this.cells), _step; !(_step = _iterator()).done;) {\n var _edges;\n var cell = _step.value;\n if (!cell) continue;\n var clipped = cell.findByShapeID(shapeID);\n if (clipped) (_edges = edges).push.apply(_edges, clipped.edges);\n }\n if (this.cells.length > 1) edges = CrossingEdgeQuery.uniqueInts(edges);\n return edges;\n }\n /**\r\n * Returns the sorted unique values from the given input.\r\n */;\n CrossingEdgeQuery.uniqueInts = function uniqueInts(ints) {\n var edges = [];\n var m = {};\n for (var _iterator2 = _createForOfIteratorHelperLoose(ints), _step2; !(_step2 = _iterator2()).done;) {\n var i = _step2.value;\n if (m[i]) continue;\n m[i] = true;\n edges.push(i);\n }\n edges.sort(function (a, b) {\n return a - b;\n });\n return edges;\n }\n /**\r\n * Returns a map from shapes to the superset of edges for that\r\n * shape that intersect the edge AB.\r\n *\r\n * CAVEAT: This method may return shapes that have an empty set of candidate edges.\r\n * However, the return value is non-empty only if at least one shape has a candidate edge.\r\n */;\n _proto.candidatesEdgeMap = function candidatesEdgeMap(a, b) {\n var edgeMap = new EdgeMap();\n if (this.index.shapes.size === 1) {\n var shape = this.index.shape(0);\n edgeMap.set(shape, this.candidates(a, b, shape));\n return edgeMap;\n }\n this.getCellsForEdge(a, b);\n if (this.cells.length === 0) return edgeMap;\n for (var _iterator3 = _createForOfIteratorHelperLoose(this.cells), _step3; !(_step3 = _iterator3()).done;) {\n var cell = _step3.value;\n for (var _iterator4 = _createForOfIteratorHelperLoose(cell.shapes), _step4; !(_step4 = _iterator4()).done;) {\n var clipped = _step4.value;\n var s = this.index.shape(clipped.shapeID);\n for (var j = 0; j < clipped.numEdges(); j++) {\n edgeMap.set(s, (edgeMap.get(s) || []).concat([clipped.edges[j]]));\n }\n }\n }\n if (this.cells.length > 1) {\n edgeMap.forEach(function (edges, shape) {\n edgeMap.set(shape, CrossingEdgeQuery.uniqueInts(edges));\n });\n }\n return edgeMap;\n }\n /**\r\n * Returns the set of ShapeIndexCells that might contain edges intersecting\r\n * the edge AB in the given cell root.\r\n */;\n _proto.getCells = function getCells(a, b, root) {\n var _clipToFace = clipToFace(a, b, face$1(root.id)),\n aUV = _clipToFace[0],\n bUV = _clipToFace[1],\n ok = _clipToFace[2];\n if (ok) {\n this.a = aUV;\n this.b = bUV;\n var edgeBound = Rect.fromPoints(this.a, this.b);\n if (root.bound().intersects(edgeBound)) this.computeCellsIntersected(root, edgeBound);\n }\n if (this.cells.length === 0) return [];\n return this.cells;\n }\n /**\r\n * Populates the cells field to the set of index cells intersected by an edge AB.\r\n */;\n _proto.getCellsForEdge = function getCellsForEdge(a, b) {\n this.cells = [];\n var segments = faceSegments(a, b);\n for (var _iterator5 = _createForOfIteratorHelperLoose(segments), _step5; !(_step5 = _iterator5()).done;) {\n var segment = _step5.value;\n this.a = segment.a;\n this.b = segment.b;\n var edgeBound = Rect.fromPoints(this.a, this.b);\n var pcell = PaddedCell.fromCellID(fromFace(segment.face), 0);\n var edgeRoot = pcell.shrinkToFit(edgeBound);\n var relation = this.iter.locateCellID(edgeRoot);\n if (relation === INDEXED) {\n this.cells.push(this.iter.indexCell());\n } else if (relation === SUBDIVIDED) {\n if (!isFace(edgeRoot)) pcell = PaddedCell.fromCellID(edgeRoot, 0);\n this.computeCellsIntersected(pcell, edgeBound);\n }\n }\n }\n /**\r\n * Computes the index cells intersected by the current\r\n * edge that are descendants of pcell and adds them to this queries set of cells.\r\n */;\n _proto.computeCellsIntersected = function computeCellsIntersected(pcell, edgeBound) {\n this.iter.seek(rangeMin(pcell.id));\n if (this.iter.done() || this.iter.cellID() > rangeMax(pcell.id)) return;\n if (this.iter.cellID() === pcell.id) {\n this.cells.push(this.iter.indexCell());\n return;\n }\n var center = pcell.middle().lo();\n if (edgeBound.x.hi < center.x) {\n this.clipVAxis(edgeBound, center.y, 0, pcell);\n return;\n } else if (edgeBound.x.lo >= center.x) {\n this.clipVAxis(edgeBound, center.y, 1, pcell);\n return;\n }\n var childBounds = this.splitUBound(edgeBound, center.x);\n if (edgeBound.y.hi < center.y) {\n this.computeCellsIntersected(PaddedCell.fromParentIJ(pcell, 0, 0), childBounds[0]);\n this.computeCellsIntersected(PaddedCell.fromParentIJ(pcell, 1, 0), childBounds[1]);\n } else if (edgeBound.y.lo >= center.y) {\n this.computeCellsIntersected(PaddedCell.fromParentIJ(pcell, 0, 1), childBounds[0]);\n this.computeCellsIntersected(PaddedCell.fromParentIJ(pcell, 1, 1), childBounds[1]);\n } else {\n this.clipVAxis(childBounds[0], center.y, 0, pcell);\n this.clipVAxis(childBounds[1], center.y, 1, pcell);\n }\n }\n /**\r\n * Computes the intersected cells recursively for a given padded cell.\r\n * Given either the left (i=0) or right (i=1) side of a padded cell pcell,\r\n * determine whether the current edge intersects the lower child, upper child,\r\n * or both children, and call computeCellsIntersected recursively on those children.\r\n * The center is the v-coordinate at the center of pcell.\r\n */;\n _proto.clipVAxis = function clipVAxis(edgeBound, center, i, pcell) {\n if (edgeBound.y.hi < center) {\n this.computeCellsIntersected(PaddedCell.fromParentIJ(pcell, i, 0), edgeBound);\n } else if (edgeBound.y.lo >= center) {\n this.computeCellsIntersected(PaddedCell.fromParentIJ(pcell, i, 1), edgeBound);\n } else {\n var childBounds = this.splitVBound(edgeBound, center);\n this.computeCellsIntersected(PaddedCell.fromParentIJ(pcell, i, 0), childBounds[0]);\n this.computeCellsIntersected(PaddedCell.fromParentIJ(pcell, i, 1), childBounds[1]);\n }\n }\n /**\r\n * Returns the bound for two children as a result of splitting the\r\n * current edge at the given value U.\r\n */;\n _proto.splitUBound = function splitUBound(edgeBound, u) {\n var v = edgeBound.y.clampPoint(interpolateFloat64(u, this.a.x, this.b.x, this.a.y, this.b.y));\n var diag = this.a.x > this.b.x !== this.a.y > this.b.y ? 1 : 0;\n return this.splitBound(edgeBound, 0, diag, u, v);\n }\n /**\r\n * Returns the bound for two children as a result of splitting the\r\n * current edge into two child edges at the given value V.\r\n */;\n _proto.splitVBound = function splitVBound(edgeBound, v) {\n var u = edgeBound.x.clampPoint(interpolateFloat64(v, this.a.y, this.b.y, this.a.x, this.b.x));\n var diag = this.a.x > this.b.x !== this.a.y > this.b.y ? 1 : 0;\n return this.splitBound(edgeBound, diag, 0, u, v);\n }\n /**\r\n * Returns the bounds for the two children as a result of splitting\r\n * the current edge into two child edges at the given point (u, v). uEnd and vEnd\r\n * indicate which bound endpoints of the first child will be updated.\r\n */;\n _proto.splitBound = function splitBound(edgeBound, uEnd, vEnd, u, v) {\n var childBounds = [Rect.fromRect(edgeBound), Rect.fromRect(edgeBound)];\n if (uEnd === 1) {\n childBounds[0].x.lo = u;\n childBounds[1].x.hi = u;\n } else {\n childBounds[0].x.hi = u;\n childBounds[1].x.lo = u;\n }\n if (vEnd === 1) {\n childBounds[0].y.lo = v;\n childBounds[1].y.hi = v;\n } else {\n childBounds[0].y.hi = v;\n childBounds[1].y.lo = v;\n }\n return childBounds;\n };\n return CrossingEdgeQuery;\n}();\n/** EdgeMap stores a sorted set of edge ids for each shape. */\nvar EdgeMap = /*#__PURE__*/function (_Map) {\n function EdgeMap() {\n return _Map.apply(this, arguments) || this;\n }\n _inheritsLoose(EdgeMap, _Map);\n return EdgeMap;\n}(/*#__PURE__*/_wrapNativeSuper(Map));\n\n/**\r\n * There are several notions of the \"centroid\" of a triangle. First, there\r\n * is the planar centroid, which is simply the centroid of the ordinary\r\n * (non-spherical) triangle defined by the three vertices. Second, there is\r\n * the surface centroid, which is defined as the intersection of the three\r\n * medians of the spherical triangle. It is possible to show that this\r\n * point is simply the planar centroid projected to the surface of the\r\n * sphere. Finally, there is the true centroid (mass centroid), which is\r\n * defined as the surface integral over the spherical triangle of (x,y,z)\r\n * divided by the triangle area. This is the point that the triangle would\r\n * rotate around if it was spinning in empty space.\r\n *\r\n * The best centroid for most purposes is the true centroid. Unlike the\r\n * planar and surface centroids, the true centroid behaves linearly as\r\n * regions are added or subtracted. That is, if you split a triangle into\r\n * pieces and compute the average of their centroids (weighted by triangle\r\n * area), the result equals the centroid of the original triangle. This is\r\n * not true of the other centroids.\r\n *\r\n * Also note that the surface centroid may be nowhere near the intuitive\r\n * \"center\" of a spherical triangle. For example, consider the triangle\r\n * with vertices A=(1,eps,0), B=(0,0,1), C=(-1,eps,0) (a quarter-sphere).\r\n * The surface centroid of this triangle is at S=(0, 2*eps, 1), which is\r\n * within a distance of 2*eps of the vertex B. Note that the median from A\r\n * (the segment connecting A to the midpoint of BC) passes through S, since\r\n * this is the shortest path connecting the two endpoints. On the other\r\n * hand, the true centroid is at M=(0, 0.5, 0.5), which when projected onto\r\n * the surface is a much more reasonable interpretation of the \"center\" of\r\n * this triangle.\r\n */\n/**\r\n * Returns the true centroid of the spherical triangle ABC\r\n * multiplied by the signed area of spherical triangle ABC. The reasons for\r\n * multiplying by the signed area are (1) this is the quantity that needs to be\r\n * summed to compute the centroid of a union or difference of triangles, and\r\n * (2) it's actually easier to calculate this way. All points must have unit length.\r\n *\r\n * Note that the result of this function is defined to be Point(0, 0, 0) if\r\n * the triangle is degenerate.\r\n */\nvar trueCentroid = function trueCentroid(a, b, c) {\n // Use Distance to get accurate results for small triangles.\n var ra = 1;\n var sa = b.distance(c);\n if (sa !== 0) ra = sa / Math.sin(sa);\n var rb = 1;\n var sb = c.distance(a);\n if (sb !== 0) rb = sb / Math.sin(sb);\n var rc = 1;\n var sc = a.distance(b);\n if (sc !== 0) rc = sc / Math.sin(sc);\n // Now compute a point M such that:\n //\n // [Ax Ay Az] [Mx] [ra]\n // [Bx By Bz] [My] = 0.5 * det(A,B,C) * [rb]\n // [Cx Cy Cz] [Mz] [rc]\n //\n // To improve the numerical stability we subtract the first row (A) from the\n // other two rows; this reduces the cancellation error when A, B, and C are\n // very close together. Then we solve it using Cramer's rule.\n //\n // The result is the true centroid of the triangle multiplied by the\n // triangle's area.\n //\n // This code still isn't as numerically stable as it could be.\n // The biggest potential improvement is to compute B-A and C-A more\n // accurately so that (B-A)x(C-A) is always inside triangle ABC.\n var x = new Vector(a.x, b.x - a.x, c.x - a.x);\n var y = new Vector(a.y, b.y - a.y, c.y - a.y);\n var z = new Vector(a.z, b.z - a.z, c.z - a.z);\n var r = new Vector(ra, rb - ra, rc - ra);\n return Point$1.fromVector(new Vector(y.cross(z).dot(r), z.cross(x).dot(r), x.cross(y).dot(r)).mul(0.5));\n};\n\n// These two points are used for the special Empty and Full loops.\nvar emptyLoopPoint = /*#__PURE__*/new Point$1(0, 0, 1);\nvar fullLoopPoint = /*#__PURE__*/new Point$1(0, 0, -1);\n/**\r\n * Loop represents a simple spherical polygon. It consists of a sequence\r\n * of vertices where the first vertex is implicitly connected to the\r\n * last. All loops are defined to have a CCW orientation, i.e. the interior of\r\n * the loop is on the left side of the edges. This implies that a clockwise\r\n * loop enclosing a small area is interpreted to be a CCW loop enclosing a\r\n * very large area.\r\n *\r\n * Loops are not allowed to have any duplicate vertices (whether adjacent or\r\n * not). Non-adjacent edges are not allowed to intersect, and furthermore edges\r\n * of length 180 degrees are not allowed (i.e., adjacent vertices cannot be\r\n * antipodal). Loops must have at least 3 vertices (except for the \"empty\" and\r\n * \"full\" loops discussed below).\r\n *\r\n * There are two special loops: the \"empty\" loop contains no points and the\r\n * \"full\" loop contains all points. These loops do not have any edges, but to\r\n * preserve the invariant that every loop can be represented as a vertex\r\n * chain, they are defined as having exactly one vertex each (see EmptyLoop\r\n * and FullLoop).\r\n *\r\n * @beta incomplete\r\n */\nvar Loop = /*#__PURE__*/function () {\n /**\r\n * Returns a new Loop.\r\n * @category Constructors\r\n */\n function Loop(pts) {\n this.originInside = false;\n this.depth = 0;\n this.bound = Rect$1.emptyRect();\n this.subregionBound = Rect$1.emptyRect();\n this.vertices = pts;\n this.index = new ShapeIndex();\n this.initOriginAndBound();\n }\n /**\r\n * Creates a new Loop from the given cell.\r\n * @category Constructors\r\n */\n Loop.fromCell = function fromCell(c) {\n var vertices = [c.vertex(0), c.vertex(1), c.vertex(2), c.vertex(3)];\n return new Loop(vertices);\n }\n /**\r\n * Constructs a loop from another loop (ie. make a copy)\r\n * @category Constructors\r\n */;\n Loop.fromLoop = function fromLoop(l) {\n return new Loop(l.vertices.map(function (p) {\n return Point$1.fromVector(p.vector);\n }));\n }\n /**\r\n * Returns the empty Loop.\r\n * @category Constructors\r\n */;\n Loop.emptyLoop = function emptyLoop() {\n return new Loop([emptyLoopPoint]);\n }\n /**\r\n * Returns the full Loop.\r\n * @category Constructors\r\n */;\n Loop.fullLoop = function fullLoop() {\n return new Loop([fullLoopPoint]);\n };\n var _proto = Loop.prototype;\n _proto.initOriginAndBound = function initOriginAndBound() {\n if (this.vertices.length < 3) {\n if (!this.isEmptyOrFull()) {\n this.originInside = false;\n return;\n }\n this.originInside = this.vertices[0].z < 0;\n } else {\n var v1Inside = this.vertices[0] !== this.vertices[1] && this.vertices[2] !== this.vertices[1] && angleContainsVertex(this.vertices[0], this.vertices[1], this.vertices[2]);\n this.originInside = false;\n if (v1Inside !== this.containsPoint(this.vertices[1])) {\n this.originInside = true;\n }\n }\n this.initBound();\n this.index.add(this);\n }\n // missinglink: replaces pointer assignment\n ;\n _proto.copyFrom = function copyFrom(ol) {\n this.vertices = ol.vertices;\n this.originInside = ol.originInside;\n this.depth = ol.depth;\n this.bound = ol.bound;\n this.subregionBound = ol.subregionBound;\n this.index = ol.index;\n };\n _proto.initBound = function initBound() {\n if (this.vertices.length === 0) {\n this.copyFrom(Loop.emptyLoop());\n return;\n }\n if (this.isEmptyOrFull()) {\n if (this.isEmpty()) {\n this.bound = Rect$1.emptyRect();\n } else {\n this.bound = Rect$1.fullRect();\n }\n this.subregionBound = this.bound;\n return;\n }\n var bounder = new RectBounder();\n for (var i = 0; i <= this.vertices.length; i++) {\n bounder.addPoint(this.vertex(i));\n }\n var b = bounder.rectBound();\n if (this.containsPoint(new Point$1(0, 0, 1))) {\n b = new Rect$1(new Interval(b.lat.lo, Math.PI / 2), Interval$1.fullInterval());\n }\n if (b.lng.isFull() && this.containsPoint(new Point$1(0, 0, -1))) {\n b.lat.lo = -Math.PI / 2;\n }\n this.bound = b;\n this.subregionBound = RectBounder.expandForSubregions(this.bound);\n };\n _proto.validate = function validate() {\n var err = this.findValidationErrorNoIndex();\n if (err) return err;\n return null;\n };\n _proto.findValidationErrorNoIndex = function findValidationErrorNoIndex() {\n for (var i = 0; i < this.vertices.length; i++) {\n var v = this.vertices[i];\n if (!v.vector.isUnit()) {\n return new Error(\"vertex \" + i + \" is not unit length\");\n }\n }\n if (this.vertices.length < 3) {\n if (this.isEmptyOrFull()) return null;\n return new Error('non-empty, non-full loops must have at least 3 vertices');\n }\n for (var _i = 0; _i < this.vertices.length; _i++) {\n if (this.vertices[_i].equals(this.vertex(_i + 1))) {\n return new Error(\"edge \" + _i + \" is degenerate (duplicate vertex)\");\n }\n var other = Point$1.fromVector(this.vertex(_i + 1).vector.mul(-1));\n if (this.vertices[_i].equals(other)) {\n return new Error(\"vertices \" + _i + \" and \" + (_i + 1) % this.vertices.length + \" are antipodal\");\n }\n }\n return null;\n };\n _proto.contains = function contains(o) {\n if (!this.subregionBound.contains(o.bound)) return false;\n if (this.isEmptyOrFull() || o.isEmptyOrFull()) {\n return this.isFull() || o.isEmpty();\n }\n var relation = new ContainsRelation();\n if (hasCrossingRelation(this, o, relation)) return false;\n if (relation.foundSharedVertex) return true;\n if (!this.containsPoint(o.vertex(0))) return false;\n if ((o.subregionBound.contains(this.bound) || o.bound.union(this.bound).isFull()) && o.containsPoint(this.vertex(0))) {\n return false;\n }\n return true;\n };\n _proto.intersects = function intersects(o) {\n if (!this.bound.intersects(o.bound)) return false;\n var relation = new IntersectsRelation();\n if (hasCrossingRelation(this, o, relation)) return true;\n if (relation.foundSharedVertex) return false;\n if (this.subregionBound.contains(o.bound) || this.bound.union(o.bound).isFull()) {\n if (this.containsPoint(o.vertex(0))) return true;\n }\n if (o.subregionBound.contains(this.bound)) {\n if (o.containsPoint(this.vertex(0))) return true;\n }\n return false;\n };\n _proto.equal = function equal(other) {\n if (this.vertices.length !== other.vertices.length) return false;\n for (var i = 0; i < this.vertices.length; i++) {\n if (this.vertices[i] !== other.vertex(i)) return false;\n }\n return true;\n };\n _proto.boundaryEqual = function boundaryEqual(o) {\n if (this.vertices.length !== o.vertices.length) return false;\n if (this.isEmptyOrFull()) return this.isEmpty() === o.isEmpty();\n for (var offset = 0; offset < this.vertices.length; offset++) {\n if (this.vertices[offset].equals(o.vertex(0))) {\n for (var i = 0; i < this.vertices.length; i++) {\n if (this.vertex(i + offset) !== o.vertex(i)) {\n return false;\n }\n }\n return true;\n }\n }\n return false;\n };\n _proto.compareBoundary = function compareBoundary(o) {\n if (!this.bound.intersects(o.bound)) return -1;\n if (this.isFull()) return 1;\n if (o.isFull()) return -1;\n var relation = new CompareBoundaryRelation(o.isHole());\n if (hasCrossingRelation(this, o, relation)) return 0;\n if (relation.foundSharedVertex) return relation.containsEdge ? 1 : -1;\n if (this.containsPoint(o.vertex(0))) return 1;\n return -1;\n };\n _proto.containsOrigin = function containsOrigin() {\n return this.originInside;\n };\n _proto.referencePoint = function referencePoint() {\n return originReferencePoint(this.originInside);\n };\n _proto.numEdges = function numEdges() {\n return this.isEmptyOrFull() ? 0 : this.vertices.length;\n };\n _proto.edge = function edge(i) {\n return new Edge(this.vertex(i), this.vertex(i + 1));\n };\n _proto.numChains = function numChains() {\n return this.isEmpty() ? 0 : 1;\n };\n _proto.chain = function chain(_chainID) {\n return new Chain(0, this.numEdges());\n };\n _proto.chainEdge = function chainEdge(_chainID, offset) {\n return new Edge(this.vertex(offset), this.vertex(offset + 1));\n };\n _proto.chainPosition = function chainPosition(edgeID) {\n return new ChainPosition(0, edgeID);\n };\n _proto.dimension = function dimension() {\n return 2;\n };\n _proto.typeTag = function typeTag() {\n return TypeTagNone;\n };\n _proto.privateInterface = function privateInterface() {};\n _proto.isEmpty = function isEmpty() {\n return this.isEmptyOrFull() && !this.containsOrigin();\n };\n _proto.isFull = function isFull() {\n return this.isEmptyOrFull() && this.containsOrigin();\n };\n _proto.isEmptyOrFull = function isEmptyOrFull() {\n return this.vertices.length === 1;\n };\n _proto.rectBound = function rectBound() {\n return this.bound;\n };\n _proto.capBound = function capBound() {\n return this.bound.capBound();\n };\n _proto.vertex = function vertex(i) {\n return this.vertices[i % this.vertices.length];\n };\n _proto.orientedVertex = function orientedVertex(i) {\n var j = i - this.vertices.length;\n if (j < 0) j = i;\n if (this.isHole()) j = this.vertices.length - 1 - j;\n return this.vertex(j);\n };\n _proto.numVertices = function numVertices() {\n return this.vertices.length;\n };\n _proto.bruteForceContainsPoint = function bruteForceContainsPoint(p) {\n var origin = Point$1.originPoint();\n var inside = this.originInside;\n var crosser = EdgeCrosser.newChainEdgeCrosser(origin, p, this.vertex(0));\n for (var i = 1; i <= this.vertices.length; i++) {\n inside = inside !== crosser.edgeOrVertexChainCrossing(this.vertex(i));\n }\n return inside;\n };\n _proto.containsPoint = function containsPoint(p) {\n if (!this.index.isFresh() && !this.bound.containsPoint(p)) return false;\n var maxBruteForceVertices = 32;\n if (this.index.shapes.size === 0 || this.vertices.length <= maxBruteForceVertices) {\n return this.bruteForceContainsPoint(p);\n }\n var it = this.index.iterator();\n if (!it.locatePoint(p)) return false;\n return this.iteratorContainsPoint(it, p);\n };\n _proto.containsCell = function containsCell(target) {\n var it = this.index.iterator();\n var relation = it.locateCellID(target.id);\n if (relation !== INDEXED) return false;\n if (this.boundaryApproxIntersects(it, target)) return false;\n return this.iteratorContainsPoint(it, target.center());\n };\n _proto.intersectsCell = function intersectsCell(target) {\n var it = this.index.iterator();\n var relation = it.locateCellID(target.id);\n if (relation === DISJOINT) return false;\n if (relation === SUBDIVIDED) return true;\n if (it.cellID() === target.id) return true;\n if (this.boundaryApproxIntersects(it, target)) return true;\n return this.iteratorContainsPoint(it, target.center());\n };\n _proto.cellUnionBound = function cellUnionBound() {\n return this.capBound().cellUnionBound();\n };\n _proto.boundaryApproxIntersects = function boundaryApproxIntersects(it, target) {\n var aClipped = it.indexCell().findByShapeID(0);\n if (aClipped.edges.length === 0) return false;\n if (it.cellID() === target.id) return true;\n var maxError = FACE_CLIP_ERROR_UV_COORD + INTERSECTS_RECT_ERROR_UV_DIST;\n var bound = target.boundUV().expandedByMargin(maxError);\n for (var _iterator = _createForOfIteratorHelperLoose(aClipped.edges), _step; !(_step = _iterator()).done;) {\n var ai = _step.value;\n var _clipToPaddedFace = clipToPaddedFace(this.vertex(ai), this.vertex(ai + 1), target.face, maxError),\n v0 = _clipToPaddedFace[0],\n v1 = _clipToPaddedFace[1],\n ok = _clipToPaddedFace[2];\n if (ok && edgeIntersectsRect(v0, v1, bound)) {\n return true;\n }\n }\n return false;\n };\n _proto.iteratorContainsPoint = function iteratorContainsPoint(it, p) {\n var _it$indexCell;\n var aClipped = (_it$indexCell = it.indexCell()) == null ? void 0 : _it$indexCell.findByShapeID(0);\n var inside = (aClipped == null ? void 0 : aClipped.containsCenter) || false;\n if (aClipped && aClipped.edges.length > 0) {\n var center = it.center();\n var crosser = new EdgeCrosser(center, p);\n var aiPrev = -2;\n for (var _iterator2 = _createForOfIteratorHelperLoose(aClipped.edges), _step2; !(_step2 = _iterator2()).done;) {\n var ai = _step2.value;\n if (ai !== aiPrev + 1) {\n crosser.restartAt(this.vertex(ai));\n }\n aiPrev = ai;\n inside = inside !== crosser.edgeOrVertexChainCrossing(this.vertex(ai + 1));\n }\n }\n return inside;\n };\n Loop.regularLoop = function regularLoop(center, radius, numVertices) {\n return Loop.regularLoopForFrame(getFrame(center), radius, numVertices);\n };\n Loop.regularLoopForFrame = function regularLoopForFrame(frame, radius, numVertices) {\n return new Loop(Point$1.regularPointsForFrame(frame, radius, numVertices));\n };\n _proto.canonicalFirstVertex = function canonicalFirstVertex() {\n var firstIdx = 0;\n var n = this.vertices.length;\n for (var i = 1; i < n; i++) {\n if (this.vertex(i).vector.cmp(this.vertex(firstIdx).vector) === -1) {\n firstIdx = i;\n }\n }\n if (this.vertex(firstIdx + 1).vector.cmp(this.vertex(firstIdx + n - 1).vector) === -1) {\n return [firstIdx, 1];\n }\n firstIdx += n;\n return [firstIdx, -1];\n };\n _proto.turningAngle = function turningAngle() {\n if (this.isEmptyOrFull()) {\n return this.containsOrigin() ? -2 * Math.PI : 2 * Math.PI;\n }\n if (this.vertices.length < 3) return 0;\n var _this$canonicalFirstV = this.canonicalFirstVertex(),\n i = _this$canonicalFirstV[0],\n dir = _this$canonicalFirstV[1];\n var sum = turnAngle(this.vertex((i + this.vertices.length - dir) % this.vertices.length), this.vertex(i), this.vertex((i + dir) % this.vertices.length));\n var compensation = 0;\n for (var n = this.vertices.length - 1; n > 0; n--) {\n i += dir;\n var angle = turnAngle(this.vertex(i - dir), this.vertex(i), this.vertex(i + dir));\n var oldSum = sum;\n sum += angle + compensation;\n compensation = oldSum - sum + angle;\n }\n var maxCurvature = 2 * Math.PI - 4 * DBL_EPSILON$1;\n return Math.max(-maxCurvature, Math.min(maxCurvature, dir * (sum + compensation)));\n };\n _proto.turningAngleMaxError = function turningAngleMaxError() {\n var maxErrorPerVertex = 11.25 * DBL_EPSILON$1;\n return maxErrorPerVertex * this.vertices.length;\n };\n _proto.isHole = function isHole() {\n return (this.depth & 1) !== 0;\n };\n _proto.sign = function sign() {\n return this.isHole() ? -1 : 1;\n };\n _proto.isNormalized = function isNormalized() {\n if (this.bound.lng.length() < Math.PI) return true;\n return this.turningAngle() >= -this.turningAngleMaxError();\n };\n _proto.normalize = function normalize() {\n if (!this.isNormalized()) this.invert();\n };\n _proto.invert = function invert() {\n this.index.reset();\n if (this.isEmptyOrFull()) {\n this.vertices[0] = this.isFull() ? emptyLoopPoint : fullLoopPoint;\n } else {\n for (var i = Math.floor(this.vertices.length / 2) - 1; i >= 0; i--) {\n var opp = this.vertices.length - 1 - i;\n var _ref = [this.vertices[opp], this.vertices[i]];\n this.vertices[i] = _ref[0];\n this.vertices[opp] = _ref[1];\n }\n }\n this.originInside = !this.originInside;\n if (this.bound.lat.lo > -Math.PI / 2 && this.bound.lat.hi < Math.PI / 2) {\n this.bound = Rect$1.fullRect();\n this.subregionBound = this.bound;\n } else {\n this.initBound();\n }\n this.index.add(this);\n };\n _proto.findVertex = function findVertex(p) {\n var notFound = 0;\n if (this.vertices.length < 10) {\n for (var i = 1; i <= this.vertices.length; i++) {\n if (this.vertex(i).equals(p)) return [i, true];\n }\n return [notFound, false];\n }\n var it = this.index.iterator();\n if (!it.locatePoint(p)) return [notFound, false];\n var aClipped = it.indexCell().findByShapeID(0);\n for (var _i2 = aClipped.numEdges() - 1; _i2 >= 0; _i2--) {\n var ai = aClipped.edges[_i2];\n if (this.vertex(ai).equals(p)) {\n return ai === 0 ? [this.vertices.length, true] : [ai, true];\n }\n if (this.vertex(ai + 1).equals(p)) {\n return [ai + 1, true];\n }\n }\n return [notFound, false];\n };\n _proto.containsNested = function containsNested(other) {\n if (!this.subregionBound.contains(other.bound)) return false;\n if (this.isEmptyOrFull() || other.numVertices() < 2) {\n return this.isFull() || other.isEmpty();\n }\n var _this$findVertex = this.findVertex(other.vertex(1)),\n m = _this$findVertex[0],\n ok = _this$findVertex[1];\n if (!ok) return this.containsPoint(other.vertex(1));\n return wedgeContains(this.vertex(m - 1), this.vertex(m), this.vertex(m + 1), other.vertex(0), other.vertex(2));\n };\n _proto.surfaceIntegralFloat64 = function surfaceIntegralFloat64(f) {\n var maxLength = Math.PI - 1e-5;\n var sum = 0;\n var origin = this.vertex(0);\n for (var i = 1; i + 1 < this.vertices.length; i++) {\n if (this.vertex(i + 1).vector.angle(origin.vector) > maxLength) {\n var oldOrigin = origin;\n if (origin.equals(this.vertex(0))) {\n origin = Point$1.fromVector(this.vertex(0).pointCross(this.vertex(i)).vector.normalize());\n } else if (this.vertex(i).vector.angle(this.vertex(0).vector) < maxLength) {\n origin = this.vertex(0);\n } else {\n origin = Point$1.fromVector(this.vertex(0).vector.cross(oldOrigin.vector));\n sum += f(this.vertex(0), oldOrigin, origin);\n }\n sum += f(oldOrigin, this.vertex(i), origin);\n }\n sum += f(origin, this.vertex(i), this.vertex(i + 1));\n }\n if (origin !== this.vertex(0)) {\n sum += f(origin, this.vertex(this.vertices.length - 1), this.vertex(0));\n }\n return sum;\n };\n _proto.surfaceIntegralPoint = function surfaceIntegralPoint(f) {\n var maxLength = Math.PI - 1e-5;\n var sum = new Point$1(0, 0, 0).vector;\n var origin = this.vertex(0);\n for (var i = 1; i + 1 < this.vertices.length; i++) {\n if (this.vertex(i + 1).vector.angle(origin.vector) > maxLength) {\n var oldOrigin = origin;\n if (origin.equals(this.vertex(0))) {\n origin = Point$1.fromVector(this.vertex(0).pointCross(this.vertex(i)).vector.normalize());\n } else if (this.vertex(i).vector.angle(this.vertex(0).vector) < maxLength) {\n origin = this.vertex(0);\n } else {\n origin = Point$1.fromVector(this.vertex(0).vector.cross(oldOrigin.vector));\n sum = sum.add(f(this.vertex(0), oldOrigin, origin).vector);\n }\n sum = sum.add(f(oldOrigin, this.vertex(i), origin).vector);\n }\n sum = sum.add(f(origin, this.vertex(i), this.vertex(i + 1)).vector);\n }\n if (origin !== this.vertex(0)) {\n sum = sum.add(f(origin, this.vertex(this.vertices.length - 1), this.vertex(0)).vector);\n }\n return Point$1.fromVector(sum);\n };\n _proto.area = function area() {\n if (this.isEmptyOrFull()) return this.containsOrigin() ? 4 * Math.PI : 0;\n var area = this.surfaceIntegralFloat64(signedArea);\n var maxError = this.turningAngleMaxError();\n if (area < 0) area += 4 * Math.PI;\n if (area > 4 * Math.PI) area = 4 * Math.PI;\n if (area < 0) area = 0;\n if (area < maxError && !this.isNormalized()) {\n return 4 * Math.PI;\n } else if (area > 4 * Math.PI - maxError && this.isNormalized()) {\n return 0;\n }\n return area;\n };\n _proto.centroid = function centroid() {\n return this.surfaceIntegralPoint(trueCentroid);\n }\n // xyzFaceSiTiVertices(): XyzFaceSiTi[] {\n // return this.vertices.map((v) => {\n // const [face, si, ti, level] = xyzToFaceSiTi(v)\n // return new XyzFaceSiTi(v, face, si, ti, level)\n // })\n // }\n /**\r\n * Reports whether given two loops whose boundaries\r\n * do not cross (see compareBoundary), if this loop contains the boundary of the\r\n * other loop. If reverse is true, the boundary of the other loop is reversed\r\n * first (which only affects the result when there are shared edges). This method\r\n * is cheaper than compareBoundary because it does not test for edge intersections.\r\n *\r\n * This function requires that neither loop is empty, and that if the other is full,\r\n * then reverse == false.\r\n */;\n _proto.containsNonCrossingBoundary = function containsNonCrossingBoundary(other, reverseOther) {\n // The bounds must intersect for containment.\n if (!this.bound.intersects(other.bound)) return false;\n // Full loops are handled as though the loop surrounded the entire sphere.\n if (this.isFull()) return true;\n if (other.isFull()) return false;\n var _this$findVertex2 = this.findVertex(other.vertex(0)),\n m = _this$findVertex2[0],\n ok = _this$findVertex2[1];\n if (!ok) {\n return this.containsPoint(other.vertex(0)); // Since the other loops vertex 0 is not shared, we can check if this contains it.\n }\n // Otherwise check whether the edge (b0, b1) is contained by this loop.\n return wedgeContainsSemiwedge(this.vertex(m - 1), this.vertex(m), this.vertex(m + 1), other.vertex(1), reverseOther);\n };\n return Loop;\n}();\nvar containsCenterMatches = function containsCenterMatches(a, target) {\n return !a.containsCenter && target === CROSSING_TARGET_DONT_CROSS || a.containsCenter && target === CROSSING_TARGET_CROSS;\n};\nvar hasCrossingRelation = function hasCrossingRelation(a, b, relation) {\n var ai = new RangeIterator(a.index);\n var bi = new RangeIterator(b.index);\n var ab = new LoopCrosser(a, b, relation, false);\n var ba = new LoopCrosser(b, a, relation, true);\n while (!ai.done() || !bi.done()) {\n if (ai.rangeMax < bi.rangeMin) {\n ai.seekTo(bi);\n } else if (bi.rangeMax < ai.rangeMin) {\n bi.seekTo(ai);\n } else {\n var abRelation = lsb(ai.it.cellID()) - lsb(bi.it.cellID());\n if (abRelation > 0) {\n if (ab.hasCrossingRelation(ai, bi)) {\n return true;\n }\n } else if (abRelation < 0) {\n if (ba.hasCrossingRelation(bi, ai)) {\n return true;\n }\n } else {\n var aClipped = ai.it.indexCell().shapes[0];\n var bClipped = bi.it.indexCell().shapes[0];\n if (containsCenterMatches(aClipped, ab.aCrossingTarget) && containsCenterMatches(bClipped, ab.bCrossingTarget)) {\n return true;\n }\n if (aClipped.numEdges() > 0 && bClipped.numEdges() > 0 && ab.cellCrossesCell(aClipped, bClipped)) {\n return true;\n }\n ai.next();\n bi.next();\n }\n }\n }\n return false;\n};\nvar CROSSING_TARGET_DONT_CARE = 0;\nvar CROSSING_TARGET_DONT_CROSS = 1;\nvar CROSSING_TARGET_CROSS = 2;\nvar ContainsRelation = /*#__PURE__*/function () {\n function ContainsRelation() {\n this.foundSharedVertex = false;\n }\n var _proto2 = ContainsRelation.prototype;\n _proto2.aCrossingTarget = function aCrossingTarget() {\n return CROSSING_TARGET_DONT_CROSS;\n };\n _proto2.bCrossingTarget = function bCrossingTarget() {\n return CROSSING_TARGET_CROSS;\n };\n _proto2.wedgesCross = function wedgesCross(a0, ab1, a2, b0, b2) {\n this.foundSharedVertex = true;\n return !wedgeContains(a0, ab1, a2, b0, b2);\n };\n return ContainsRelation;\n}();\nvar IntersectsRelation = /*#__PURE__*/function () {\n function IntersectsRelation() {\n this.foundSharedVertex = false;\n }\n var _proto3 = IntersectsRelation.prototype;\n _proto3.aCrossingTarget = function aCrossingTarget() {\n return CROSSING_TARGET_CROSS;\n };\n _proto3.bCrossingTarget = function bCrossingTarget() {\n return CROSSING_TARGET_CROSS;\n };\n _proto3.wedgesCross = function wedgesCross(a0, ab1, a2, b0, b2) {\n this.foundSharedVertex = true;\n return wedgeIntersects(a0, ab1, a2, b0, b2);\n };\n return IntersectsRelation;\n}();\nvar CompareBoundaryRelation = /*#__PURE__*/function () {\n function CompareBoundaryRelation(reverse) {\n this.foundSharedVertex = false;\n this.containsEdge = false;\n this.excludesEdge = false;\n this.reverse = reverse;\n }\n var _proto4 = CompareBoundaryRelation.prototype;\n _proto4.aCrossingTarget = function aCrossingTarget() {\n return CROSSING_TARGET_DONT_CARE;\n };\n _proto4.bCrossingTarget = function bCrossingTarget() {\n return CROSSING_TARGET_DONT_CARE;\n };\n _proto4.wedgesCross = function wedgesCross(a0, ab1, a2, _b0, b2) {\n this.foundSharedVertex = true;\n if (wedgeContainsSemiwedge(a0, ab1, a2, b2, this.reverse)) {\n this.containsEdge = true;\n } else {\n this.excludesEdge = true;\n }\n return this.containsEdge && this.excludesEdge;\n };\n return CompareBoundaryRelation;\n}();\nvar wedgeContainsSemiwedge = function wedgeContainsSemiwedge(a0, ab1, a2, b2, reverse) {\n if (b2.equals(a0) || b2.equals(a2)) return b2.equals(a0) === reverse;\n return Point$1.orderedCCW(a0, a2, b2, ab1);\n};\n// ----\n/**\r\n * LoopCrosser is a helper class for determining whether two loops cross.\r\n * It is instantiated twice for each pair of loops to be tested, once for the\r\n * pair (A,B) and once for the pair (B,A), in order to be able to process\r\n * edges in either loop nesting order.\r\n */\nvar LoopCrosser = /*#__PURE__*/function () {\n /**\r\n * Creates a LoopCrosser from the given values. If swapped is true,\r\n * the loops A and B have been swapped. This affects how arguments are passed to\r\n * the given loop relation, since for example A.Contains(B) is not the same as B.Contains(A).\r\n * @category Constructors\r\n */\n function LoopCrosser(a, b, relation, swapped) {\n this.crosser = null;\n this.aj = 0;\n this.bjPrev = -2;\n this.bCells = [];\n this.a = a;\n this.b = b;\n this.relation = relation;\n this.swapped = swapped;\n this.aCrossingTarget = relation.aCrossingTarget();\n this.bCrossingTarget = relation.bCrossingTarget();\n this.bQuery = new CrossingEdgeQuery(b.index);\n if (swapped) {\n var _ref2 = [this.bCrossingTarget, this.aCrossingTarget];\n this.aCrossingTarget = _ref2[0];\n this.bCrossingTarget = _ref2[1];\n }\n }\n /**\r\n * Sets the crosser's state for checking the given edge of loop A.\r\n */\n var _proto5 = LoopCrosser.prototype;\n _proto5.startEdge = function startEdge(aj) {\n this.crosser = new EdgeCrosser(this.a.vertex(aj), this.a.vertex(aj + 1));\n this.aj = aj;\n this.bjPrev = -2;\n }\n /**\r\n * Reports whether the current edge of loop A has any crossings with\r\n * edges of the index cell of loop B.\r\n */;\n _proto5.edgeCrossesCell = function edgeCrossesCell(bClipped) {\n var bNumEdges = bClipped.numEdges();\n for (var j = 0; j < bNumEdges; j++) {\n var _this$crosser2;\n var bj = bClipped.edges[j];\n if (bj !== this.bjPrev + 1) {\n var _this$crosser;\n (_this$crosser = this.crosser) == null || _this$crosser.restartAt(this.b.vertex(bj));\n }\n this.bjPrev = bj;\n var crossing = (_this$crosser2 = this.crosser) == null ? void 0 : _this$crosser2.chainCrossingSign(this.b.vertex(bj + 1));\n if (crossing === DO_NOT_CROSS) continue;\n if (crossing === CROSS) return true;\n if (this.a.vertex(this.aj + 1).equals(this.b.vertex(bj + 1))) {\n if (this.swapped) {\n if (this.relation.wedgesCross(this.b.vertex(bj), this.b.vertex(bj + 1), this.b.vertex(bj + 2), this.a.vertex(this.aj), this.a.vertex(this.aj + 2))) {\n return true;\n }\n } else {\n if (this.relation.wedgesCross(this.a.vertex(this.aj), this.a.vertex(this.aj + 1), this.a.vertex(this.aj + 2), this.b.vertex(bj), this.b.vertex(bj + 2))) {\n return true;\n }\n }\n }\n }\n return false;\n }\n /**\r\n * Reports whether there are any edge crossings or wedge crossings\r\n * within the two given cells.\r\n */;\n _proto5.cellCrossesCell = function cellCrossesCell(aClipped, bClipped) {\n for (var _iterator3 = _createForOfIteratorHelperLoose(aClipped.edges), _step3; !(_step3 = _iterator3()).done;) {\n var edge = _step3.value;\n this.startEdge(edge);\n if (this.edgeCrossesCell(bClipped)) return true;\n }\n return false;\n }\n /**\r\n * Reports whether given an index cell of A, there are any edge or wedge crossings\r\n * with any index cell of B contained within bID.\r\n */;\n _proto5.cellCrossesAnySubcell = function cellCrossesAnySubcell(aClipped, bID) {\n var bRoot = PaddedCell.fromCellID(bID, 0);\n for (var _iterator4 = _createForOfIteratorHelperLoose(aClipped.edges), _step4; !(_step4 = _iterator4()).done;) {\n var aj = _step4.value;\n this.bCells = this.bQuery.getCells(this.a.vertex(aj), this.a.vertex(aj + 1), bRoot);\n if (this.bCells.length === 0) continue;\n this.startEdge(aj);\n for (var _iterator5 = _createForOfIteratorHelperLoose(this.bCells), _step5; !(_step5 = _iterator5()).done;) {\n var cell = _step5.value;\n if (this.edgeCrossesCell(cell.shapes[0])) return true;\n }\n }\n return false;\n }\n /**\r\n * Reports whether given two iterators positioned such that\r\n * ai.cellID().ContainsCellID(bi.cellID()), there is an edge or wedge crossing\r\n * anywhere within ai.cellID().\r\n * This function advances bi only past ai.cellID().\r\n */;\n _proto5.hasCrossing = function hasCrossing(ai, bi) {\n var edgeQueryMinEdges = 20;\n var totalEdges = 0;\n this.bCells = [];\n while (true) {\n var n = bi.it.indexCell().shapes[0].numEdges();\n if (n > 0) {\n totalEdges += n;\n if (totalEdges >= edgeQueryMinEdges) {\n if (this.cellCrossesAnySubcell(ai.it.indexCell().shapes[0], ai.cellID())) return true;\n bi.seekBeyond(ai);\n return false;\n }\n this.bCells.push(bi.indexCell());\n }\n bi.next();\n if (bi.cellID() > ai.rangeMax) break;\n }\n for (var _iterator6 = _createForOfIteratorHelperLoose(this.bCells), _step6; !(_step6 = _iterator6()).done;) {\n var c = _step6.value;\n if (this.cellCrossesCell(ai.it.indexCell().shapes[0], c.shapes[0])) return true;\n }\n return false;\n }\n /**\r\n * Reports whether given two iterators positioned such that\r\n * ai.cellID().ContainsCellID(bi.cellID()), there is a crossing relationship\r\n * anywhere within ai.cellID().\r\n */;\n _proto5.hasCrossingRelation = function hasCrossingRelation(ai, bi) {\n var aClipped = ai.it.indexCell().shapes[0];\n if (aClipped.numEdges() !== 0) {\n if (this.hasCrossing(ai, bi)) return true;\n ai.next();\n return false;\n }\n if (containsCenterMatches(aClipped, this.aCrossingTarget)) {\n bi.seekBeyond(ai);\n ai.next();\n return false;\n }\n while (bi.cellID() <= ai.rangeMax) {\n var bClipped = bi.it.indexCell().shapes[0];\n if (containsCenterMatches(bClipped, this.bCrossingTarget)) return true;\n bi.next();\n }\n ai.next();\n return false;\n };\n return LoopCrosser;\n}();\n\n/**\r\n * Polygon represents a sequence of zero or more loops; recall that the\r\n * interior of a loop is defined to be its left-hand side (see Loop).\r\n *\r\n * When the polygon is initialized, the given loops are automatically converted\r\n * into a canonical form consisting of \"shells\" and \"holes\". Shells and holes\r\n * are both oriented CCW, and are nested hierarchically. The loops are\r\n * reordered to correspond to a pre-order traversal of the nesting hierarchy.\r\n *\r\n * Polygons may represent any region of the sphere with a polygonal boundary,\r\n * including the entire sphere (known as the \"full\" polygon). The full polygon\r\n * consists of a single full loop (see Loop), whereas the empty polygon has no\r\n * loops at all.\r\n *\r\n * Use FullPolygon() to construct a full polygon. The zero value of Polygon is\r\n * treated as the empty polygon.\r\n *\r\n * Polygons have the following restrictions:\r\n *\r\n * - Loops may not cross, i.e. the boundary of a loop may not intersect\r\n * both the interior and exterior of any other loop.\r\n *\r\n * - Loops may not share edges, i.e. if a loop contains an edge AB, then\r\n * no other loop may contain AB or BA.\r\n *\r\n * - Loops may share vertices, however no vertex may appear twice in a\r\n * single loop (see Loop).\r\n *\r\n * - No loop may be empty. The full loop may appear only in the full polygon.\r\n */\nvar Polygon = /*#__PURE__*/function () {\n /**\r\n * Constructs a polygon from the given set of loops. The polygon\r\n * interior consists of the points contained by an odd number of loops. (Recall\r\n * that a loop contains the set of points on its left-hand side.)\r\n *\r\n * This method determines the loop nesting hierarchy and assigns every loop a\r\n * depth. Shells have even depths, and holes have odd depths.\r\n *\r\n * Note: The given set of loops are reordered by this method so that the hierarchy\r\n * can be traversed using Parent, LastDescendant and the loops depths.\r\n * @category Constructors\r\n */\n function Polygon(loops) {\n var _this = this;\n if (loops === void 0) {\n loops = [];\n }\n this.loops = [];\n /** index is a spatial index of all the polygon loops. */\n this.index = new ShapeIndex();\n /** hasHoles tracks if this polygon has at least one hole. */\n this.hasHoles = false;\n /** numVertices keeps the running total of all of the vertices of the contained loops. */\n this.numVertices = 0;\n /** numEdges tracks the total number of edges in all the loops in this polygon. */\n this.nEdges = 0;\n /**\r\n * bound is a conservative bound on all points contained by this loop.\r\n * If l.ContainsPoint(P), then l.bound.ContainsPoint(P).\r\n */\n this.bound = Rect$1.emptyRect();\n /**\r\n * Since bound is not exact, it is possible that a loop A contains\r\n * another loop B whose bounds are slightly larger. subregionBound\r\n * has been expanded sufficiently to account for this error, i.e.\r\n * if A.Contains(B), then A.subregionBound.Contains(B.bound).\r\n */\n this.subregionBound = Rect$1.emptyRect();\n /**\r\n * A slice where element i is the cumulative number of edges in the\r\n * preceding loops in the polygon. This field is used for polygons that\r\n * have a large number of loops, and may be empty for polygons with few loops.\r\n */\n this.cumulativeEdges = [];\n /**\r\n * Walks the mapping of loops to all of their children, and adds them in\r\n * order into to the polygons set of loops.\r\n */\n this.initLoops = function (lm) {\n var stack = new Array();\n stack.push(null);\n var depth = -1;\n while (stack.length > 0) {\n var loop = stack.pop();\n if (loop != null) {\n depth = loop.depth;\n _this.loops.push(loop);\n }\n var children = lm.get(loop) || [];\n for (var i = children.length - 1; i >= 0; i--) {\n var child = children[i];\n child.depth = depth + 1;\n stack.push(child);\n }\n }\n };\n if (loops.length === 1 && loops[0].isEmpty()) {\n this.initLoopProperties();\n return;\n }\n this.loops = loops;\n this.initNested();\n }\n /**\r\n * PolygonFromOrientedLoops returns a Polygon from the given set of loops,\r\n * like PolygonFromLoops. It expects loops to be oriented such that the polygon\r\n * interior is on the left-hand side of all loops. This implies that shells\r\n * and holes should have opposite orientations in the input to this method.\r\n * (During initialization, loops representing holes will automatically be\r\n * inverted.)\r\n * @category Constructors\r\n */\n Polygon.fromOrientedLoops = function fromOrientedLoops(loops) {\n // Here is the algorithm:\n //\n // 1. Remember which of the given loops contain OriginPoint.\n //\n // 2. Invert loops as necessary to ensure that they are nestable (i.e., no\n // loop contains the complement of any other loop). This may result in a\n // set of loops corresponding to the complement of the given polygon, but\n // we will fix that problem later.\n //\n // We make the loops nestable by first normalizing all the loops (i.e.,\n // inverting any loops whose turning angle is negative). This handles\n // all loops except those whose turning angle is very close to zero\n // (within the maximum error tolerance). Any such loops are inverted if\n // and only if they contain OriginPoint(). (In theory this step is only\n // necessary if there are at least two such loops.) The resulting set of\n // loops is guaranteed to be nestable.\n //\n // 3. Build the polygon. This yields either the desired polygon or its\n // complement.\n //\n // 4. If there is at least one loop, we find a loop L that is adjacent to\n // OriginPoint() (where \"adjacent\" means that there exists a path\n // connecting OriginPoint() to some vertex of L such that the path does\n // not cross any loop). There may be a single such adjacent loop, or\n // there may be several (in which case they should all have the same\n // contains_origin() value). We choose L to be the loop containing the\n // origin whose depth is greatest, or loop(0) (a top-level shell) if no\n // such loop exists.\n //\n // 5. If (L originally contained origin) != (polygon contains origin), we\n // invert the polygon. This is done by inverting a top-level shell whose\n // turning angle is minimal and then fixing the nesting hierarchy. Note\n // that because we normalized all the loops initially, this step is only\n // necessary if the polygon requires at least one non-normalized loop to\n // represent it.\n var containedOrigin = new Map();\n for (var _iterator = _createForOfIteratorHelperLoose(loops), _step; !(_step = _iterator()).done;) {\n var _l = _step.value;\n containedOrigin.set(_l, _l.containsOrigin());\n }\n for (var _iterator2 = _createForOfIteratorHelperLoose(loops), _step2; !(_step2 = _iterator2()).done;) {\n var _l2 = _step2.value;\n var angle = _l2.turningAngle();\n if (Math.abs(angle) > _l2.turningAngleMaxError()) {\n if (angle < 0) _l2.invert(); // Normalize the loop.\n } else {\n if (_l2.containsOrigin()) _l2.invert(); // Ensure that the loop does not contain the origin.\n }\n }\n var p = new Polygon(loops);\n if (p.numLoops() > 0) {\n var originLoop = p.loop(0);\n var polygonContainsOrigin = false;\n for (var _iterator3 = _createForOfIteratorHelperLoose(p.loops), _step3; !(_step3 = _iterator3()).done;) {\n var l = _step3.value;\n if (l.containsOrigin()) {\n polygonContainsOrigin = !polygonContainsOrigin;\n originLoop = l;\n }\n }\n if (containedOrigin.get(originLoop) !== polygonContainsOrigin) {\n p.invert();\n }\n }\n return p;\n }\n /**\r\n * Invert inverts the polygon (replaces it by its complement).\r\n */;\n var _proto = Polygon.prototype;\n _proto.invert = function invert() {\n // Inverting any one loop will invert the polygon. The best loop to invert\n // is the one whose area is largest, since this yields the smallest area\n // after inversion. The loop with the largest area is always at depth 0.\n // The descendants of this loop all have their depth reduced by 1, while the\n // former siblings of this loop all have their depth increased by 1.\n // The empty and full polygons are handled specially.\n if (this.isEmpty()) {\n Object.assign(this, Polygon.fullPolygon());\n this.initLoopProperties();\n return;\n }\n if (this.isFull()) {\n Object.assign(this, new Polygon());\n this.initLoopProperties();\n return;\n }\n // Find the loop whose area is largest (i.e., whose turning angle is\n // smallest), minimizing calls to TurningAngle(). In particular, for\n // polygons with a single shell at level 0 there is no need to call\n // TurningAngle() at all. (This method is relatively expensive.)\n var best = 0;\n var none = 10.0;\n var bestAngle = none;\n for (var i = 1; i < this.numLoops(); i++) {\n if (this.loop(i).depth !== 0) continue;\n // We defer computing the turning angle of loop 0 until we discover\n // that the polygon has another top-level shell.\n if (bestAngle === none) bestAngle = this.loop(best).turningAngle();\n var angle = this.loop(i).turningAngle();\n // We break ties deterministically in order to avoid having the output\n // depend on the input order of the loops.\n if (angle < bestAngle || angle === bestAngle && this.compareLoops(this.loop(i), this.loop(best)) < 0) {\n best = i;\n bestAngle = angle;\n }\n }\n // Build the new loops vector, starting with the inverted loop.\n this.loop(best).invert();\n var newLoops = [];\n var lastBest = this.lastDescendant(best);\n newLoops.push(this.loop(best));\n // Add the former siblings of this loop as descendants.\n for (var _i = 0; _i < this.loops.length; _i++) {\n if (_i < best || _i > lastBest) {\n this.loop(_i).depth++;\n newLoops.push(this.loop(_i));\n }\n }\n // Add the former children of this loop as siblings.\n for (var _i2 = 0; _i2 < this.loops.length; _i2++) {\n if (_i2 > best && _i2 <= lastBest) {\n this.loop(_i2).depth--;\n newLoops.push(this.loop(_i2));\n }\n }\n this.loops = newLoops;\n this.initLoopProperties();\n }\n /**\r\n * Defines a total ordering on Loops that does not depend on the cyclic\r\n * order of loop vertices. This function is used to choose which loop to\r\n * invert in the case where several loops have exactly the same area.\r\n */;\n _proto.compareLoops = function compareLoops(a, b) {\n if (a.numVertices() !== b.numVertices()) return a.numVertices() - b.numVertices();\n var _a$canonicalFirstVert = a.canonicalFirstVertex(),\n ai = _a$canonicalFirstVert[0],\n aDir = _a$canonicalFirstVert[1];\n var _b$canonicalFirstVert = b.canonicalFirstVertex(),\n bi = _b$canonicalFirstVert[0],\n bDir = _b$canonicalFirstVert[1];\n if (aDir !== bDir) return aDir - bDir;\n for (var n = a.numVertices() - 1; n >= 0; n--, ai += aDir, bi += bDir) {\n var cmp = a.vertex(ai).vector.cmp(b.vertex(bi).vector);\n if (cmp !== 0) return cmp;\n }\n return 0;\n }\n /**\r\n * Returns a Polygon from a single loop created from the given Cell.\r\n * @category Constructors\r\n */;\n Polygon.fromCell = function fromCell(cell) {\n return new Polygon([Loop.fromCell(cell)]);\n }\n /**\r\n * Takes the set of loops in this polygon and performs the nesting\r\n * computations to set the proper nesting and parent/child relationships.\r\n */;\n _proto.initNested = function initNested() {\n if (this.loops.length === 1) {\n this.initOneLoop();\n return;\n }\n var lm = new LoopMap();\n this.loops.forEach(function (l) {\n lm.insertLoop(l, null);\n });\n // The loops have all been added to the loopMap for ordering. Clear the\n // loops slice because we add all the loops in-order in initLoops.\n this.loops = [];\n // Reorder the loops in depth-first traversal order.\n this.initLoops(lm);\n this.initLoopProperties();\n }\n /**\r\n * Set the properties for a polygon made of a single loop.\r\n */\n // TODO(roberts): Can this be merged with initLoopProperties\n ;\n _proto.initOneLoop = function initOneLoop() {\n this.hasHoles = false;\n this.numVertices = this.loops[0].vertices.length;\n this.bound = this.loops[0].rectBound();\n this.subregionBound = RectBounder.expandForSubregions(this.bound);\n // Ensure the loops depth is set correctly.\n this.loops[0].depth = 0;\n this.initEdgesAndIndex();\n }\n /**\r\n * Sets the properties for polygons with multiple loops.\r\n */;\n _proto.initLoopProperties = function initLoopProperties() {\n this.numVertices = 0;\n // the loops depths are set by initNested/initOriented prior to this.\n this.bound = Rect$1.emptyRect();\n this.hasHoles = false;\n for (var _iterator4 = _createForOfIteratorHelperLoose(this.loops), _step4; !(_step4 = _iterator4()).done;) {\n var l = _step4.value;\n if (l.isHole()) {\n this.hasHoles = true;\n } else {\n this.bound = this.bound.union(l.rectBound());\n }\n this.numVertices += l.numVertices();\n }\n this.subregionBound = RectBounder.expandForSubregions(this.bound);\n this.initEdgesAndIndex();\n }\n /**\r\n * Performs the shape related initializations and adds the final polygon to the index.\r\n */;\n _proto.initEdgesAndIndex = function initEdgesAndIndex() {\n this.nEdges = 0;\n this.cumulativeEdges = [];\n if (this.isFull()) return;\n var maxLinearSearchLoops = 12; // Based on benchmarks.\n if (this.loops.length > maxLinearSearchLoops) this.cumulativeEdges = [];\n for (var _iterator5 = _createForOfIteratorHelperLoose(this.loops), _step5; !(_step5 = _iterator5()).done;) {\n var l = _step5.value;\n if (this.cumulativeEdges.length > 0) {\n this.cumulativeEdges.push(this.nEdges);\n }\n this.nEdges += l.vertices.length;\n }\n this.index = new ShapeIndex();\n this.index.add(this);\n }\n /**\r\n * Returns a special \"full\" polygon.\r\n * @category Constructors\r\n */;\n Polygon.fullPolygon = function fullPolygon() {\n var fullLoop = Loop.fullLoop();\n var ret = new Polygon();\n ret.loops = [fullLoop];\n ret.numVertices = fullLoop.vertices.length;\n ret.bound = Rect$1.fullRect();\n ret.subregionBound = Rect$1.fullRect();\n ret.initEdgesAndIndex();\n return ret;\n }\n /**\r\n * Checks whether this is a valid polygon, including checking whether all the loops are themselves valid.\r\n */;\n _proto.validate = function validate() {\n for (var i = 0; i < this.loops.length; i++) {\n var l = this.loops[i];\n // Check for loop errors that don't require building a ShapeIndex.\n var err = l.findValidationErrorNoIndex();\n if (err) return new Error(\"loop \" + i + \": \" + err.message);\n // Check that no loop is empty, and that the full loop only appears in the full polygon.\n if (l.isEmpty()) return new Error(\"loop \" + i + \": empty loops are not allowed\");\n if (l.isFull() && this.loops.length > 1) return new Error(\"loop \" + i + \": full loop appears in non-full polygon\");\n }\n // Finally, verify the loop nesting hierarchy.\n return this.findLoopNestingError();\n }\n /**\r\n * Reports if there is an error in the loop nesting hierarchy.\r\n */;\n _proto.findLoopNestingError = function findLoopNestingError() {\n // First check that the loop depths make sense.\n var lastDepth = -1;\n for (var i = 0; i < this.loops.length; i++) {\n var depth = this.loops[i].depth;\n if (depth < 0 || depth > lastDepth + 1) return new Error(\"loop \" + i + \": invalid loop depth (\" + depth + \")\");\n lastDepth = depth;\n }\n // Then check that they correspond to the actual loop nesting. This test\n // is quadratic in the number of loops but the cost per iteration is small.\n for (var _i3 = 0; _i3 < this.loops.length; _i3++) {\n var l = this.loops[_i3];\n var last = this.lastDescendant(_i3);\n for (var j = 0; j < this.loops.length; j++) {\n if (_i3 === j) continue;\n var nested = j >= _i3 + 1 && j <= last;\n var reverseB = false;\n if (l.containsNonCrossingBoundary(this.loops[j], reverseB) !== nested) {\n var nestedStr = nested ? '' : 'not ';\n return new Error(\"invalid nesting: loop \" + _i3 + \" should \" + nestedStr + \"contain loop \" + j);\n }\n }\n }\n return null;\n }\n /** Reports whether this is the special \"empty\" polygon (consisting of no loops). */;\n _proto.isEmpty = function isEmpty() {\n return this.loops.length === 0;\n }\n /** Reports whether this is the special \"full\" polygon (consisting of a single loop that encompasses the entire sphere). */;\n _proto.isFull = function isFull() {\n return this.loops.length === 1 && this.loops[0].isFull();\n }\n /** Returns the number of loops in this polygon. */;\n _proto.numLoops = function numLoops() {\n return this.loops.length;\n }\n /**\r\n * Returns the loop at the given index. Note that during initialization,\r\n * the given loops are reordered according to a pre-order traversal of the loop\r\n * nesting hierarchy. This implies that every loop is immediately followed by\r\n * its descendants. This hierarchy can be traversed using the methods Parent,\r\n * LastDescendant, and Loop.depth.\r\n */;\n _proto.loop = function loop(k) {\n return this.loops[k];\n }\n /**\r\n * Returns the index of the parent of loop k.\r\n * If the loop does not have a parent, ok=false is returned.\r\n */;\n _proto.parent = function parent(k) {\n var _this$loops$k;\n // See where we are on the depth hierarchy.\n var depth = ((_this$loops$k = this.loops[k]) == null ? void 0 : _this$loops$k.depth) || 0;\n if (depth === 0) return [-1, false];\n // There may be several loops at the same nesting level as us that share a\n // parent loop with us. (Imagine a slice of swiss cheese, of which we are one loop.\n // we don't know how many may be next to us before we get back to our parent loop.)\n // Move up one position from us, and then begin traversing back through the set of loops\n // until we find the one that is our parent or we get to the top of the polygon.\n for (k--; k >= 0 && this.loops[k].depth <= depth; k--) {}\n return [k, true];\n }\n /**\r\n * Returns the index of the last loop that is contained within loop k.\r\n * If k is negative, it returns the last loop in the polygon.\r\n * Note that loops are indexed according to a pre-order traversal of the nesting\r\n * hierarchy, so the immediate children of loop k can be found by iterating over\r\n * the loops (k+1)..LastDescendant(k) and selecting those whose depth is equal\r\n * to Loop(k).depth+1.\r\n */;\n _proto.lastDescendant = function lastDescendant(k) {\n var _this$loops$k2;\n if (k < 0) return this.loops.length - 1;\n var depth = ((_this$loops$k2 = this.loops[k]) == null ? void 0 : _this$loops$k2.depth) || 0;\n // Find the next loop immediately past us in the set of loops, and then start\n // moving down the list until we either get to the end or find the next loop\n // that is higher up the hierarchy than we are.\n for (k++; k < this.loops.length && this.loops[k].depth > depth; k++) {}\n return k - 1;\n }\n /** Returns a bounding spherical cap. */;\n _proto.capBound = function capBound() {\n return this.bound.capBound();\n }\n /** Returns a bounding latitude-longitude rectangle. */;\n _proto.rectBound = function rectBound() {\n return this.bound;\n }\n /** Reports whether the polygon contains the point. */;\n _proto.containsPoint = function containsPoint(point) {\n // NOTE: A bounds check slows down this function by about 50%. It is\n // worthwhile only when it might allow us to delay building the index.\n if (!this.index.isFresh() && !this.bound.containsPoint(point)) return false;\n // For small polygons, and during initial construction, it is faster to just\n // check all the crossing.\n var maxBruteForceVertices = 32;\n if (this.numVertices < maxBruteForceVertices || this.index == null) {\n var inside = false;\n for (var _iterator6 = _createForOfIteratorHelperLoose(this.loops), _step6; !(_step6 = _iterator6()).done;) {\n var l = _step6.value;\n // use loops bruteforce to avoid building the index on each loop.\n inside = inside !== l.bruteForceContainsPoint(point);\n }\n return inside;\n }\n // Otherwise we look up the ShapeIndex cell containing this point.\n return new ContainsPointQuery(this.index, VERTEX_MODEL_SEMI_OPEN).contains(point);\n }\n /** Reports whether the polygon contains the given cell. */;\n _proto.containsCell = function containsCell(cell) {\n var it = this.index.iterator();\n var relation = it.locateCellID(cell.id);\n // If \"cell\" is disjoint from all index cells, it is not contained.\n // Similarly, if \"cell\" is subdivided into one or more index cells then it\n // is not contained, since index cells are subdivided only if they (nearly)\n // intersect a sufficient number of edges. (But note that if \"cell\" itself\n // is an index cell then it may be contained, since it could be a cell with\n // no edges in the loop interior.)\n if (relation !== INDEXED) return false;\n // Otherwise check if any edges intersect \"cell\".\n if (this.boundaryApproxIntersects(it, cell)) return false;\n // Otherwise check if the loop contains the center of \"cell\".\n return this.iteratorContainsPoint(it, cell.center());\n }\n /** Reports whether the polygon intersects the given cell. */;\n _proto.intersectsCell = function intersectsCell(cell) {\n var it = this.index.iterator();\n var relation = it.locateCellID(cell.id);\n // If cell does not overlap any index cell, there is no intersection.\n if (relation === DISJOINT) return false;\n // If cell is subdivided into one or more index cells, there is an\n // intersection to within the S2ShapeIndex error bound (see Contains).\n if (relation === SUBDIVIDED) return true;\n // If cell is an index cell, there is an intersection because index cells\n // are created only if they have at least one edge or they are entirely\n // contained by the loop.\n if (it.cellID() === cell.id) return true;\n // Otherwise check if any edges intersect cell.\n if (this.boundaryApproxIntersects(it, cell)) return true;\n // Otherwise check if the loop contains the center of cell.\n return this.iteratorContainsPoint(it, cell.center());\n }\n /** Computes a covering of the Polygon. */;\n _proto.cellUnionBound = function cellUnionBound() {\n return this.capBound().cellUnionBound();\n }\n /**\r\n * Reports whether the loop's boundary intersects cell.\r\n * It may also return true when the loop boundary does not intersect cell but\r\n * some edge comes within the worst-case error tolerance.\r\n *\r\n * This requires that it.Locate(cell) returned Indexed.\r\n */;\n _proto.boundaryApproxIntersects = function boundaryApproxIntersects(it, cell) {\n var aClipped = it.indexCell().findByShapeID(0);\n // If there are no edges, there is no intersection.\n if (aClipped.edges.length === 0) return false;\n // We can save some work if cell is the index cell itself.\n if (it.cellID() === cell.id) return true;\n // Otherwise check whether any of the edges intersect cell.\n var maxError = FACE_CLIP_ERROR_UV_COORD + INTERSECTS_RECT_ERROR_UV_DIST;\n var bound = cell.boundUV().expandedByMargin(maxError);\n for (var _iterator7 = _createForOfIteratorHelperLoose(aClipped.edges), _step7; !(_step7 = _iterator7()).done;) {\n var e = _step7.value;\n var edge = this.index.shape(0).edge(e);\n var _clipToPaddedFace = clipToPaddedFace(edge.v0, edge.v1, cell.face, maxError),\n v0 = _clipToPaddedFace[0],\n v1 = _clipToPaddedFace[1],\n ok = _clipToPaddedFace[2];\n if (ok && edgeIntersectsRect(v0, v1, bound)) return true;\n }\n return false;\n }\n /** Reports whether the iterator that is positioned at the ShapeIndexCell that may contain p, contains the point p. */;\n _proto.iteratorContainsPoint = function iteratorContainsPoint(it, point) {\n // Test containment by drawing a line segment from the cell center to the\n // given point and counting edge crossings.\n var aClipped = it.indexCell().findByShapeID(0);\n var inside = aClipped.containsCenter;\n if (aClipped.edges.length === 0) return inside;\n // This block requires ShapeIndex.\n var crosser = new EdgeCrosser(it.center(), point);\n var shape = this.index.shape(0);\n for (var _iterator8 = _createForOfIteratorHelperLoose(aClipped.edges), _step8; !(_step8 = _iterator8()).done;) {\n var e = _step8.value;\n var edge = shape.edge(e);\n inside = inside !== crosser.edgeOrVertexCrossing(edge.v0, edge.v1);\n }\n return inside;\n }\n // Shape Interface\n /** Returns the number of edges in this shape. */;\n _proto.numEdges = function numEdges() {\n return this.nEdges;\n }\n /** Returns endpoints for the given edge index. */;\n _proto.edge = function edge(e) {\n var i = 0;\n if (this.cumulativeEdges.length > 0) {\n for (i = 0; i < this.cumulativeEdges.length; i++) {\n if (i + 1 >= this.cumulativeEdges.length || e < this.cumulativeEdges[i + 1]) {\n e -= this.cumulativeEdges[i];\n break;\n }\n }\n } else {\n // When the number of loops is small, use linear search. Most often\n // there is exactly one loop and the code below executes zero times.\n for (i = 0; e >= this.loop(i).vertices.length; i++) {\n e -= this.loop(i).vertices.length;\n }\n }\n return new Edge(this.loop(i).orientedVertex(e), this.loop(i).orientedVertex(e + 1));\n }\n /** Returns the reference point for this polygon. */;\n _proto.referencePoint = function referencePoint() {\n var containsOrigin = false;\n for (var _iterator9 = _createForOfIteratorHelperLoose(this.loops), _step9; !(_step9 = _iterator9()).done;) {\n var l = _step9.value;\n containsOrigin = containsOrigin !== l.containsOrigin();\n }\n return originReferencePoint(containsOrigin);\n }\n /** Reports the number of contiguous edge chains in the Polygon. */;\n _proto.numChains = function numChains() {\n return this.numLoops();\n }\n /** Returns the i-th edge Chain (loop) in the Shape. */;\n _proto.chain = function chain(chainID) {\n if (this.cumulativeEdges.length > 0) {\n return new Chain(this.cumulativeEdges[chainID], this.loop(chainID).vertices.length);\n }\n var e = 0;\n for (var j = 0; j < chainID; j++) {\n e += this.loop(j).vertices.length;\n }\n // Polygon represents a full loop as a loop with one vertex, while\n // Shape represents a full loop as a chain with no vertices.\n var numVertices = this.loop(chainID).numVertices();\n if (numVertices !== 1) return new Chain(e, numVertices);\n return new Chain(e, 0);\n }\n /** Returns the j-th edge of the i-th edge Chain (loop). */;\n _proto.chainEdge = function chainEdge(i, j) {\n return new Edge(this.loop(i).orientedVertex(j), this.loop(i).orientedVertex(j + 1));\n }\n /** Returns a pair (i, j) such that edgeID is the j-th edge of the i-th edge Chain. */;\n _proto.chainPosition = function chainPosition(edgeID) {\n var i = 0;\n if (this.cumulativeEdges.length > 0) {\n for (i = 0; i < this.cumulativeEdges.length; i++) {\n if (i + 1 >= this.cumulativeEdges.length || edgeID < this.cumulativeEdges[i + 1]) {\n edgeID -= this.cumulativeEdges[i];\n break;\n }\n }\n } else {\n // When the number of loops is small, use linear search. Most often\n // there is exactly one loop and the code below executes zero times.\n for (i = 0; edgeID >= this.loop(i).vertices.length; i++) {\n edgeID -= this.loop(i).vertices.length;\n }\n }\n return new ChainPosition(i, edgeID);\n }\n /** Returns the dimension of the geometry represented by this Polygon. */;\n _proto.dimension = function dimension() {\n return 2;\n };\n _proto.typeTag = function typeTag() {\n return TypeTagPolygon;\n };\n _proto.privateInterface = function privateInterface() {}\n /**\r\n * Reports whether this polygon contains the other polygon.\r\n * Specifically, it reports whether all the points in the other polygon\r\n * are also in this polygon.\r\n */;\n _proto.contains = function contains(o) {\n // If both polygons have one loop, use the more efficient Loop method.\n // Note that Loop's Contains does its own bounding rectangle check.\n if (this.loops.length === 1 && o.loops.length === 1) {\n return this.loops[0].contains(o.loops[0]);\n }\n // Otherwise if neither polygon has holes, we can still use the more\n // efficient Loop's Contains method (rather than compareBoundary),\n // but it's worthwhile to do our own bounds check first.\n if (!this.subregionBound.contains(o.bound)) {\n // Even though Bound(A) does not contain Bound(B), it is still possible\n // that A contains B. This can only happen when union of the two bounds\n // spans all longitudes. For example, suppose that B consists of two\n // shells with a longitude gap between them, while A consists of one shell\n // that surrounds both shells of B but goes the other way around the\n // sphere (so that it does not intersect the longitude gap).\n if (!this.bound.lng.union(o.bound.lng).isFull()) return false;\n }\n if (!this.hasHoles && !o.hasHoles) {\n for (var _iterator0 = _createForOfIteratorHelperLoose(o.loops), _step0; !(_step0 = _iterator0()).done;) {\n var l = _step0.value;\n if (!this.anyLoopContains(l)) return false;\n }\n return true;\n }\n // Polygon A contains B iff B does not intersect the complement of A. From\n // the intersection algorithm below, this means that the complement of A\n // must exclude the entire boundary of B, and B must exclude all shell\n // boundaries of the complement of A. (It can be shown that B must then\n // exclude the entire boundary of the complement of A.) The first call\n // below returns false if the boundaries cross, therefore the second call\n // does not need to check for any crossing edges (which makes it cheaper).\n return this.containsBoundary(o) && o.excludesNonCrossingComplementShells(this);\n }\n /**\r\n * Reports whether this polygon intersects the other polygon, i.e.\r\n * if there is a point that is contained by both polygons.\r\n */;\n _proto.intersects = function intersects(o) {\n // If both polygons have one loop, use the more efficient Loop method.\n // Note that Loop Intersects does its own bounding rectangle check.\n if (this.loops.length === 1 && o.loops.length === 1) {\n return this.loops[0].intersects(o.loops[0]);\n }\n // Otherwise if neither polygon has holes, we can still use the more\n // efficient Loop.Intersects method. The polygons intersect if and\n // only if some pair of loop regions intersect.\n if (!this.bound.intersects(o.bound)) {\n return false;\n }\n if (!this.hasHoles && !o.hasHoles) {\n for (var _iterator1 = _createForOfIteratorHelperLoose(o.loops), _step1; !(_step1 = _iterator1()).done;) {\n var l = _step1.value;\n if (this.anyLoopIntersects(l)) {\n return true;\n }\n }\n return false;\n }\n // Polygon A is disjoint from B if A excludes the entire boundary of B and B\n // excludes all shell boundaries of A. (It can be shown that B must then\n // exclude the entire boundary of A.) The first call below returns false if\n // the boundaries cross, therefore the second call does not need to check\n // for crossing edges.\n return !this.excludesBoundary(o) || !o.excludesNonCrossingShells(this);\n }\n /**\r\n * Returns +1 if this polygon contains the boundary of B, -1 if A\r\n * excludes the boundary of B, and 0 if the boundaries of A and B cross.\r\n */;\n _proto.compareBoundary = function compareBoundary(o) {\n var result = -1;\n for (var i = 0; i < this.loops.length && result !== 0; i++) {\n // If B crosses any loop of A, the result is 0. Otherwise the result\n // changes sign each time B is contained by a loop of A.\n result *= -this.loops[i].compareBoundary(o);\n }\n return result;\n }\n /** Reports whether this polygon contains the entire boundary of B. */;\n _proto.containsBoundary = function containsBoundary(o) {\n for (var _iterator10 = _createForOfIteratorHelperLoose(o.loops), _step10; !(_step10 = _iterator10()).done;) {\n var l = _step10.value;\n if (this.compareBoundary(l) <= 0) {\n return false;\n }\n }\n return true;\n }\n /** Reports whether this polygon excludes the entire boundary of B. */;\n _proto.excludesBoundary = function excludesBoundary(o) {\n for (var _iterator11 = _createForOfIteratorHelperLoose(o.loops), _step11; !(_step11 = _iterator11()).done;) {\n var l = _step11.value;\n if (this.compareBoundary(l) >= 0) {\n return false;\n }\n }\n return true;\n }\n /**\r\n * Reports whether polygon A contains the boundary of loop B.\r\n * Shared edges are handled according to the rule described in loops containsNonCrossingBoundary.\r\n */;\n _proto.containsNonCrossingBoundary = function containsNonCrossingBoundary(o, reverse) {\n var inside = false;\n for (var _iterator12 = _createForOfIteratorHelperLoose(this.loops), _step12; !(_step12 = _iterator12()).done;) {\n var l = _step12.value;\n var x = l.containsNonCrossingBoundary(o, reverse);\n inside = inside != x;\n }\n return inside;\n }\n /**\r\n * Reports wheterh given two polygons A and B such that the\r\n * boundary of A does not cross any loop of B, if A excludes all shell boundaries of B.\r\n */;\n _proto.excludesNonCrossingShells = function excludesNonCrossingShells(o) {\n for (var _iterator13 = _createForOfIteratorHelperLoose(o.loops), _step13; !(_step13 = _iterator13()).done;) {\n var l = _step13.value;\n if (l.isHole()) continue;\n if (this.containsNonCrossingBoundary(l, false)) return false;\n }\n return true;\n }\n /**\r\n * Reports whether given two polygons A and B such that the boundary of A does not cross\r\n * any loop of B, if A excludes all shell boundaries of the complement of B.\r\n */;\n _proto.excludesNonCrossingComplementShells = function excludesNonCrossingComplementShells(o) {\n // Special case to handle the complement of the empty or full polygons.\n if (o.isEmpty()) return !this.isFull();\n if (o.isFull()) return true;\n // Otherwise the complement of B may be obtained by inverting loop(0) and\n // then swapping the shell/hole status of all other loops. This implies\n // that the shells of the complement consist of loop 0 plus all the holes of\n // the original polygon.\n for (var j = 0; j < o.loops.length; j++) {\n var l = o.loops[j];\n if (j > 0 && !l.isHole()) continue;\n // The interior of the complement is to the right of loop 0, and to the\n // left of the loops that were originally holes.\n if (this.containsNonCrossingBoundary(l, j === 0)) {\n return false;\n }\n }\n return true;\n }\n /** Reports whether any loop in this polygon contains the given loop. */;\n _proto.anyLoopContains = function anyLoopContains(o) {\n for (var _iterator14 = _createForOfIteratorHelperLoose(this.loops), _step14; !(_step14 = _iterator14()).done;) {\n var l = _step14.value;\n if (l.contains(o)) return true;\n }\n return false;\n }\n /** Reports whether any loop in this polygon intersects the given loop. */;\n _proto.anyLoopIntersects = function anyLoopIntersects(o) {\n for (var _iterator15 = _createForOfIteratorHelperLoose(this.loops), _step15; !(_step15 = _iterator15()).done;) {\n var l = _step15.value;\n if (l.intersects(o)) return true;\n }\n return false;\n }\n /**\r\n * Returns the area of the polygon interior, i.e. the region on the left side\r\n * of an odd number of loops. The return value is between 0 and 4*Pi.\r\n */;\n _proto.area = function area() {\n var area = 0;\n for (var _iterator16 = _createForOfIteratorHelperLoose(this.loops), _step16; !(_step16 = _iterator16()).done;) {\n var loop = _step16.value;\n area += loop.sign() * loop.area();\n }\n return area;\n }\n /**\r\n * Returns the true centroid of the polygon multiplied by the area of\r\n * the polygon. The result is not unit length, so you may want to normalize it.\r\n * Also note that in general, the centroid may not be contained by the polygon.\r\n *\r\n * We prescale by the polygon area for two reasons: (1) it is cheaper to\r\n * compute this way, and (2) it makes it easier to compute the centroid of\r\n * more complicated shapes (by splitting them into disjoint regions and\r\n * adding their centroids).\r\n */;\n _proto.centroid = function centroid() {\n var u = new Point$1(0, 0, 0).vector;\n for (var _iterator17 = _createForOfIteratorHelperLoose(this.loops), _step17; !(_step17 = _iterator17()).done;) {\n var loop = _step17.value;\n var v = loop.centroid().vector;\n if (loop.sign() < 0) {\n u = u.sub(v);\n } else {\n u = u.add(v);\n }\n }\n return Point$1.fromVector(u);\n };\n return Polygon;\n}();\n/**\r\n * LoopMap is a map of a loop to its immediate children with respect to nesting.\r\n * It is used to determine which loops are shells and which are holes.\r\n */\nvar LoopMap = /*#__PURE__*/function (_Map) {\n function LoopMap() {\n return _Map.apply(this, arguments) || this;\n }\n _inheritsLoose(LoopMap, _Map);\n var _proto2 = LoopMap.prototype;\n /**\r\n * insertLoop adds the given loop to the loop map under the specified parent.\r\n * All children of the new entry are checked to see if they need to move up to\r\n * a different level.\r\n */\n _proto2.insertLoop = function insertLoop(newLoop, parent) {\n var children = [];\n var done = false;\n while (!done) {\n children = _Map.prototype.get.call(this, parent) || [];\n done = true;\n for (var _iterator18 = _createForOfIteratorHelperLoose(children), _step18; !(_step18 = _iterator18()).done;) {\n var child = _step18.value;\n if (child.containsNested(newLoop)) {\n parent = child;\n done = false;\n break;\n }\n }\n }\n // Now, we have found a parent for this loop, it may be that some of the\n // children of the parent of this loop may now be children of the new loop.\n var newChildren = _Map.prototype.get.call(this, newLoop) || [];\n for (var i = 0; i < children.length;) {\n var _child = children[i];\n if (newLoop.containsNested(_child)) {\n newChildren.push(_child);\n children.splice(i, 1);\n } else {\n i++;\n }\n }\n _Map.prototype.set.call(this, newLoop, newChildren);\n _Map.prototype.set.call(this, parent, [].concat(children, [newLoop]));\n };\n return LoopMap;\n}(/*#__PURE__*/_wrapNativeSuper(Map));\n\n/**\r\n * Represents a sequence of zero or more vertices connected by\r\n * straight edges (geodesics). Edges of length 0 and 180 degrees are not\r\n * allowed, i.e. adjacent vertices should not be identical or antipodal.\r\n */\nvar Polyline = /*#__PURE__*/function () {\n /**\r\n * Returns a new Polyline.\r\n * @category Constructors\r\n */\n function Polyline(points) {\n if (points === void 0) {\n points = [];\n }\n this.points = points;\n }\n /**\r\n * Creates a new Polyline from the given LatLngs.\r\n * @category Constructors\r\n */\n Polyline.fromLatLngs = function fromLatLngs(points) {\n return new Polyline(points.map(Point$1.fromLatLng));\n }\n /**\r\n * Reverses the order of the Polyline vertices.\r\n */;\n var _proto = Polyline.prototype;\n _proto.reverse = function reverse() {\n var len = this.points.length;\n for (var i = 0; i < len / 2; i++) {\n var oppositeIndex = len - i - 1;\n var _ref = [this.points[oppositeIndex], this.points[i]];\n this.points[i] = _ref[0];\n this.points[oppositeIndex] = _ref[1];\n }\n }\n /**\r\n * Returns the length of this Polyline.\r\n */;\n _proto.length = function length() {\n var length = 0;\n for (var i = 1; i < this.points.length; i++) {\n length += this.points[i - 1].distance(this.points[i]);\n }\n return length;\n }\n /**\r\n * Returns the true centroid of the polyline multiplied by the length of the\r\n * polyline. The result is not unit length, so you may wish to normalize it.\r\n *\r\n * Scaling by the Polyline length makes it easy to compute the centroid\r\n * of several Polylines (by simply adding up their centroids).\r\n */;\n _proto.centroid = function centroid() {\n var centroid = new Point$1(0, 0, 0);\n for (var i = 1; i < this.points.length; i++) {\n var vSum = this.points[i - 1].vector.add(this.points[i].vector); // Length == 2*cos(theta)\n var vDiff = this.points[i - 1].vector.sub(this.points[i].vector); // Length == 2*sin(theta)\n centroid = Point$1.fromVector(centroid.vector.add(vSum.mul(Math.sqrt(vDiff.norm2() / vSum.norm2()))));\n }\n return centroid;\n }\n /**\r\n * Reports whether the given Polyline is exactly the same as this one.\r\n */;\n _proto.equal = function equal(b) {\n if (this.points.length !== b.points.length) return false;\n for (var i = 0; i < this.points.length; i++) {\n if (!this.points[i].equals(b.points[i])) return false;\n }\n return true;\n }\n /**\r\n * Reports whether two polylines have the same number of vertices,\r\n * and corresponding vertex pairs are separated by no more the provided margin.\r\n */;\n _proto.approxEqual = function approxEqual(o, maxError) {\n if (maxError === void 0) {\n maxError = EPSILON$1;\n }\n if (this.points.length !== o.points.length) return false;\n for (var i = 0; i < this.points.length; i++) {\n if (!this.points[i].approxEqual(o.points[i], maxError)) return false;\n }\n return true;\n }\n /**\r\n * Returns the bounding Cap for this Polyline.\r\n */;\n _proto.capBound = function capBound() {\n return this.rectBound().capBound();\n }\n /**\r\n * Returns the bounding Rect for this Polyline.\r\n */;\n _proto.rectBound = function rectBound() {\n var rb = new RectBounder();\n for (var _iterator = _createForOfIteratorHelperLoose(this.points), _step; !(_step = _iterator()).done;) {\n var v = _step.value;\n rb.addPoint(v);\n }\n return rb.rectBound();\n }\n /**\r\n * Reports whether this Polyline contains the given Cell. Always returns false\r\n * because \"containment\" is not numerically well-defined except at the Polyline vertices.\r\n */;\n _proto.containsCell = function containsCell(_cell) {\n return false;\n }\n /**\r\n * Reports whether this Polyline intersects the given Cell.\r\n */;\n _proto.intersectsCell = function intersectsCell(cell) {\n if (this.points.length === 0) return false;\n for (var _iterator2 = _createForOfIteratorHelperLoose(this.points), _step2; !(_step2 = _iterator2()).done;) {\n var v = _step2.value;\n if (cell.containsPoint(v)) return true;\n }\n var cellVertices = [cell.vertex(0), cell.vertex(1), cell.vertex(2), cell.vertex(3)];\n for (var j = 0; j < 4; j++) {\n var crosser = EdgeCrosser.newChainEdgeCrosser(cellVertices[j], cellVertices[j + 1 & 3], this.points[0]);\n for (var i = 1; i < this.points.length; i++) {\n if (crosser.chainCrossingSign(this.points[i]) !== DO_NOT_CROSS) return true;\n }\n }\n return false;\n }\n /**\r\n * Returns false since Polylines are not closed.\r\n */;\n _proto.containsPoint = function containsPoint(_point) {\n return false;\n }\n /**\r\n * Computes a covering of the Polyline.\r\n */;\n _proto.cellUnionBound = function cellUnionBound() {\n return this.capBound().cellUnionBound();\n }\n /**\r\n * Returns the number of edges in this shape.\r\n */;\n _proto.numEdges = function numEdges() {\n if (this.points.length === 0) return 0;\n return this.points.length - 1;\n }\n /**\r\n * Returns endpoints for the given edge index.\r\n */;\n _proto.edge = function edge(i) {\n return new Edge(this.points[i], this.points[i + 1]);\n }\n /**\r\n * Returns the default reference point with negative containment because Polylines are not closed.\r\n */;\n _proto.referencePoint = function referencePoint() {\n return originReferencePoint(false);\n }\n /**\r\n * Reports the number of contiguous edge chains in this Polyline.\r\n */;\n _proto.numChains = function numChains() {\n return Math.min(1, this.numEdges());\n }\n /**\r\n * Returns the i-th edge Chain in the Shape.\r\n */;\n _proto.chain = function chain(_chainID) {\n return new Chain(0, this.numEdges());\n }\n /**\r\n * Returns the j-th edge of the i-th edge Chain.\r\n */;\n _proto.chainEdge = function chainEdge(_chainID, offset) {\n return new Edge(this.points[offset], this.points[offset + 1]);\n }\n /**\r\n * Returns a pair (i, j) such that edgeID is the j-th edge\r\n */;\n _proto.chainPosition = function chainPosition(edgeID) {\n return new ChainPosition(0, edgeID);\n }\n /**\r\n * Returns the dimension of the geometry represented by this Polyline.\r\n */;\n _proto.dimension = function dimension() {\n return 1;\n }\n /**\r\n * Reports whether this shape contains no points.\r\n */;\n _proto.isEmpty = function isEmpty() {\n return defaultShapeIsEmpty(this);\n }\n /**\r\n * Reports whether this shape contains all points on the sphere.\r\n */;\n _proto.isFull = function isFull() {\n return defaultShapeIsFull(this);\n };\n _proto.typeTag = function typeTag() {\n return TypeTagPolyline;\n };\n _proto.privateInterface = function privateInterface() {\n // no-op function\n }\n /**\r\n * Reports the maximal end index such that the line segment between\r\n * the start index and this one such that the line segment between these two\r\n * vertices passes within the given tolerance of all interior vertices, in order.\r\n */;\n Polyline.findEndVertex = function findEndVertex(p, tolerance, index) {\n var origin = p.points[index];\n var frame = getFrame(origin);\n var currentWedge = Interval$1.fullInterval();\n var lastDistance = 0;\n for (index++; index < p.points.length; index++) {\n var candidate = p.points[index];\n var distance = origin.distance(candidate);\n if (distance > Math.PI / 2 && lastDistance > 0) break;\n if (distance < lastDistance && lastDistance > tolerance) break;\n lastDistance = distance;\n if (distance <= tolerance) continue;\n var direction = toFrame(frame, candidate);\n var center = Math.atan2(direction.y, direction.x);\n if (!currentWedge.contains(center)) break;\n var halfAngle = Math.asin(Math.sin(tolerance) / Math.sin(distance));\n var target = Interval$1.fromPointPair(center, center).expanded(halfAngle);\n currentWedge = currentWedge.intersection(target);\n }\n return index - 1;\n }\n /**\r\n * Returns a subsequence of vertex indices such that the\r\n * polyline connecting these vertices is never further than the given tolerance from\r\n * the original polyline.\r\n */;\n _proto.subsampleVertices = function subsampleVertices(tolerance) {\n var result = [];\n if (this.points.length < 1) return result;\n result.push(0);\n var clampedTolerance = Math.max(tolerance, 0);\n for (var index = 0; index + 1 < this.points.length;) {\n var nextIndex = Polyline.findEndVertex(this, clampedTolerance, index);\n if (!this.points[nextIndex].equals(this.points[index])) result.push(nextIndex);\n index = nextIndex;\n }\n return result;\n }\n /**\r\n * Returns a point on the polyline that is closest to the given point,\r\n * and the index of the next vertex after the projected point.\r\n */;\n _proto.project = function project$1(point) {\n if (this.points.length === 1) return [this.points[0], 1];\n var minDist = 10;\n var minIndex = -1;\n for (var i = 1; i < this.points.length; i++) {\n var dist = distanceFromSegment(point, this.points[i - 1], this.points[i]);\n if (dist < minDist) {\n minDist = dist;\n minIndex = i;\n }\n }\n var closest = project(point, this.points[minIndex - 1], this.points[minIndex]);\n if (closest.equals(this.points[minIndex])) minIndex++;\n return [closest, minIndex];\n }\n /**\r\n * Reports whether the point given is on the right hand side of the\r\n * polyline, using a naive definition of \"right-hand-sideness\".\r\n */;\n _proto.isOnRight = function isOnRight(point) {\n var _this$project = this.project(point),\n closest = _this$project[0],\n next = _this$project[1];\n if (closest.equals(this.points[next - 1]) && next > 1 && next < this.points.length) {\n if (point.equals(this.points[next - 1])) return false;\n return Point$1.orderedCCW(this.points[next - 2], point, this.points[next], this.points[next - 1]);\n }\n if (next === this.points.length) next--;\n return sign(point, this.points[next], this.points[next - 1]);\n }\n /**\r\n * Checks whether this is a valid polyline or not.\r\n */;\n _proto.validate = function validate() {\n for (var i = 0; i < this.points.length; i++) {\n if (!this.points[i].vector.isUnit()) return new Error(\"vertex \" + i + \" is not unit length\");\n }\n for (var _i = 1; _i < this.points.length; _i++) {\n var prev = this.points[_i - 1];\n var cur = this.points[_i];\n if (prev.equals(cur)) return new Error(\"vertices \" + (_i - 1) + \" and \" + _i + \" are identical\");\n if (prev.equals(Point$1.fromVector(cur.vector.mul(-1)))) return new Error(\"vertices \" + (_i - 1) + \" and \" + _i + \" are antipodal\");\n }\n return null;\n }\n /**\r\n * Reports whether this polyline intersects the given polyline.\r\n */;\n _proto.intersects = function intersects(o) {\n if (this.points.length === 0 || o.points.length === 0) return false;\n if (!this.rectBound().intersects(o.rectBound())) return false;\n for (var i = 1; i < this.points.length; i++) {\n var crosser = EdgeCrosser.newChainEdgeCrosser(this.points[i - 1], this.points[i], o.points[0]);\n for (var j = 1; j < o.points.length; j++) {\n if (crosser.chainCrossingSign(o.points[j]) !== DO_NOT_CROSS) return true;\n }\n }\n return false;\n }\n /**\r\n * Returns the point whose distance from vertex 0 along the polyline is\r\n * the given fraction of the polyline's total length, and the index of\r\n * the next vertex after the interpolated point P. Fractions less than zero\r\n * or greater than one are clamped. The return value is unit length. The cost of\r\n * this function is currently linear in the number of vertices.\r\n *\r\n * This method allows the caller to easily construct a given suffix of the\r\n * polyline by concatenating P with the polyline vertices starting at that next\r\n * vertex. Note that P is guaranteed to be different than the point at the next\r\n * vertex, so this will never result in a duplicate vertex.\r\n *\r\n * The polyline must not be empty. Note that if fraction >= 1.0, then the next\r\n * vertex will be set to len(p) (indicating that no vertices from the polyline\r\n * need to be appended). The value of the next vertex is always between 1 and\r\n * len(p).\r\n *\r\n * This method can also be used to construct a prefix of the polyline, by\r\n * taking the polyline vertices up to next vertex-1 and appending the\r\n * returned point P if it is different from the last vertex (since in this\r\n * case there is no guarantee of distinctness).\r\n */;\n _proto.interpolate = function interpolate(fraction) {\n if (fraction <= 0) return [this.points[0], 1];\n var target = fraction * this.length();\n for (var i = 1; i < this.points.length; i++) {\n var length = this.points[i - 1].distance(this.points[i]);\n if (target < length) {\n var result = interpolateAtDistance(target, this.points[i - 1], this.points[i]);\n if (result.equals(this.points[i])) return [result, i + 1];\n return [result, i];\n }\n target -= length;\n }\n return [this.points[this.points.length - 1], this.points.length];\n }\n /**\r\n * The inverse operation of interpolate. Given a point on the\r\n * polyline, it returns the ratio of the distance to the point from the\r\n * beginning of the polyline over the length of the polyline. The return\r\n * value is always between 0 and 1 inclusive.\r\n *\r\n * The polyline should not be empty. If it has fewer than 2 vertices, the\r\n * return value is zero.\r\n */;\n _proto.uninterpolate = function uninterpolate(point, nextVertex) {\n if (this.points.length < 2) return 0;\n var sum = 0;\n for (var i = 1; i < nextVertex; i++) {\n sum += this.points[i - 1].distance(this.points[i]);\n }\n var lengthToPoint = sum + this.points[nextVertex - 1].distance(point);\n for (var _i2 = nextVertex; _i2 < this.points.length; _i2++) {\n sum += this.points[_i2 - 1].distance(this.points[_i2]);\n }\n return Math.min(1.0, lengthToPoint / sum);\n };\n return Polyline;\n}();\n\n// NilRegion represents a Nil value\nvar NilRegion = /*#__PURE__*/function () {\n function NilRegion() {}\n var _proto = NilRegion.prototype;\n _proto.capBound = function capBound() {\n return Cap.emptyCap();\n };\n _proto.rectBound = function rectBound() {\n return Rect$1.emptyRect();\n };\n _proto.containsCell = function containsCell(_c) {\n return false;\n };\n _proto.intersectsCell = function intersectsCell(_c) {\n return false;\n };\n _proto.containsPoint = function containsPoint(_p) {\n return false;\n };\n _proto.cellUnionBound = function cellUnionBound() {\n return [];\n };\n return NilRegion;\n}();\n\n/**\r\n * RegionCoverer allows arbitrary regions to be approximated as unions of cells (CellUnion).\r\n * This is useful for implementing various sorts of search and precomputation operations.\r\n *\r\n * Typical usage:\r\n *\r\n * \trc = new RegionCoverer({ maxLevel: 30, maxCells: 5 })\r\n * \tr = Cap.fromCenterArea(center, area)\r\n * \tcovering = rc.covering(r)\r\n *\r\n * This yields a CellUnion of at most 5 cells that is guaranteed to cover the\r\n * given region (a disc-shaped region on the sphere).\r\n *\r\n * For covering, only cells where (level - MinLevel) is a multiple of LevelMod will be used.\r\n * This effectively allows the branching factor of the S2 CellID hierarchy to be increased.\r\n * Currently the only parameter values allowed are 1, 2, or 3, corresponding to\r\n * branching factors of 4, 16, and 64 respectively.\r\n *\r\n * Note the following:\r\n *\r\n * - MinLevel takes priority over MaxCells, i.e. cells below the given level will\r\n * never be used even if this causes a large number of cells to be returned.\r\n *\r\n * - For any setting of MaxCells, up to 6 cells may be returned if that\r\n * is the minimum number of cells required (e.g. if the region intersects\r\n * all six face cells). Up to 3 cells may be returned even for very tiny\r\n * convex regions if they happen to be located at the intersection of\r\n * three cube faces.\r\n *\r\n * - For any setting of MaxCells, an arbitrary number of cells may be\r\n * returned if MinLevel is too high for the region being approximated.\r\n *\r\n * - If MaxCells is less than 4, the area of the covering may be\r\n * arbitrarily large compared to the area of the original region even if\r\n * the region is convex (e.g. a Cap or Rect).\r\n *\r\n * The approximation algorithm is not optimal but does a pretty good job in\r\n * practice. The output does not always use the maximum number of cells\r\n * allowed, both because this would not always yield a better approximation,\r\n * and because MaxCells is a limit on how much work is done exploring the\r\n * possible covering as well as a limit on the final output size.\r\n *\r\n * Because it is an approximation algorithm, one should not rely on the\r\n * stability of the output. In particular, the output of the covering algorithm\r\n * may change across different versions of the library.\r\n *\r\n * One can also generate interior coverings, which are sets of cells which\r\n * are entirely contained within a region. Interior coverings can be\r\n * empty, even for non-empty regions, if there are no cells that satisfy\r\n * the provided constraints and are contained by the region. Note that for\r\n * performance reasons, it is wise to specify a MaxLevel when computing\r\n * interior coverings - otherwise for regions with small or zero area, the\r\n * algorithm may spend a lot of time subdividing cells all the way to leaf\r\n * level to try to find contained cells.\r\n *\r\n * @beta\r\n */\nvar RegionCoverer = /*#__PURE__*/function () {\n /**\r\n * Returns a new RegionCoverer with the appropriate defaults.\r\n *\r\n * @param options - RegionCoverer options\r\n *\r\n * @category Constructors\r\n */\n function RegionCoverer(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$minLevel = _ref.minLevel,\n minLevel = _ref$minLevel === void 0 ? 0 : _ref$minLevel,\n _ref$maxLevel = _ref.maxLevel,\n maxLevel = _ref$maxLevel === void 0 ? MAX_LEVEL : _ref$maxLevel,\n _ref$levelMod = _ref.levelMod,\n levelMod = _ref$levelMod === void 0 ? 1 : _ref$levelMod,\n _ref$maxCells = _ref.maxCells,\n maxCells = _ref$maxCells === void 0 ? 8 : _ref$maxCells;\n this.minLevel = minLevel;\n this.maxLevel = maxLevel;\n this.levelMod = levelMod;\n this.maxCells = maxCells;\n }\n /** Returns an instance of coverer with the same settings. */\n var _proto = RegionCoverer.prototype;\n _proto.coverer = function coverer() {\n return new Coverer(Math.max(0, Math.min(MAX_LEVEL, this.minLevel)), Math.max(0, Math.min(MAX_LEVEL, this.maxLevel)), Math.max(1, Math.min(3, this.levelMod)), this.maxCells);\n }\n /** Returns a CellUnion that covers the given region and satisfies the various restrictions. */;\n _proto.covering = function covering(region) {\n var covering = this.cellUnion(region);\n covering.denormalize(Math.max(0, Math.min(MAX_LEVEL, this.minLevel)), Math.max(1, Math.min(3, this.levelMod)));\n return covering;\n }\n /** Returns a CellUnion that is contained within the given region and satisfies the various restrictions. */;\n _proto.interiorCovering = function interiorCovering(region) {\n var intCovering = this.interiorCellUnion(region);\n intCovering.denormalize(Math.max(0, Math.min(MAX_LEVEL, this.minLevel)), Math.max(1, Math.min(3, this.levelMod)));\n return intCovering;\n }\n /**\r\n * Returns a normalized CellUnion that covers the given region and\r\n * satisfies the restrictions except for minLevel and levelMod. These criteria\r\n * cannot be satisfied using a cell union because cell unions are\r\n * automatically normalized by replacing four child cells with their parent\r\n * whenever possible. (Note that the list of cell ids passed to the CellUnion\r\n * constructor does in fact satisfy all the given restrictions.)\r\n */;\n _proto.cellUnion = function cellUnion(region) {\n var c = this.coverer();\n c.coveringInternal(region);\n var cu = c.result;\n cu.normalize();\n return cu;\n }\n /**\r\n * Returns a normalized CellUnion that is contained within the given region and\r\n * satisfies the restrictions except for minLevel and levelMod. These criteria\r\n * cannot be satisfied using a cell union because cell unions are\r\n * automatically normalized by replacing four child cells with their parent\r\n * whenever possible. (Note that the list of cell ids passed to the CellUnion\r\n * constructor does in fact satisfy all the given restrictions.)\r\n */;\n _proto.interiorCellUnion = function interiorCellUnion(region) {\n var c = this.coverer();\n c.interiorCovering = true;\n c.coveringInternal(region);\n var cu = c.result;\n cu.normalize();\n return cu;\n }\n /**\r\n * Returns a CellUnion that covers the given region similar to Covering,\r\n * except that this method is much faster and the coverings are not as tight.\r\n * All of the usual parameters are respected (MaxCells, MinLevel, MaxLevel, and LevelMod),\r\n * except that the implementation makes no attempt to take advantage of large values of\r\n * MaxCells. (A small number of cells will always be returned.)\r\n *\r\n * This function is useful as a starting point for algorithms that\r\n * recursively subdivide cells.\r\n */;\n _proto.fastCovering = function fastCovering(region) {\n var c = this.coverer();\n var cu = _construct(CellUnion, region.cellUnionBound());\n c.normalizeCovering(cu);\n return cu;\n }\n /**\r\n * Reports whether the given CellUnion represents a valid covering\r\n * that conforms to the current covering parameters. In particular:\r\n *\r\n * - All CellIDs must be valid.\r\n *\r\n * - CellIDs must be sorted and non-overlapping.\r\n *\r\n * - CellID levels must satisfy MinLevel, MaxLevel, and LevelMod.\r\n *\r\n * - If the covering has more than MaxCells, there must be no two cells with\r\n * a common ancestor at MinLevel or higher.\r\n *\r\n * - There must be no sequence of cells that could be replaced by an\r\n * ancestor (i.e. with LevelMod == 1, the 4 child cells of a parent).\r\n */;\n _proto.isCanonical = function isCanonical(covering) {\n return this.coverer().isCanonical(covering);\n };\n return RegionCoverer;\n}();\nvar Coverer = /*#__PURE__*/function () {\n /**\r\n * Returns a new Coverer.\r\n * @category Constructors\r\n */\n function Coverer(minLevel, maxLevel, levelMod, maxCells) {\n this.region = new NilRegion();\n this.result = new CellUnion();\n this.pq = new PriorityQueue();\n this.interiorCovering = false;\n this.minLevel = minLevel;\n this.maxLevel = maxLevel;\n this.levelMod = levelMod;\n this.maxCells = maxCells;\n }\n /**\r\n * Returns a new candidate with no children if the cell intersects the given region.\r\n * The candidate is marked as terminal if it should not be expanded further.\r\n */\n var _proto2 = Coverer.prototype;\n _proto2.newCandidate = function newCandidate(cell) {\n if (!this.region.intersectsCell(cell)) return new NilCandidate();\n var cand = new Candidate(cell);\n var level = cell.level;\n if (level >= this.minLevel) {\n if (this.interiorCovering) {\n if (this.region.containsCell(cell)) cand.terminal = true;else if (level + this.levelMod > this.maxLevel) return new NilCandidate();\n } else if (level + this.levelMod > this.maxLevel || this.region.containsCell(cell)) cand.terminal = true;\n }\n return cand;\n }\n /**\r\n * Populates the children of the candidate by expanding the given number of\r\n * levels from the given cell. Returns the number of children that were marked \"terminal\".\r\n */;\n _proto2.expandChildren = function expandChildren(cand, cell, numLevels) {\n numLevels--;\n var numTerminals = 0;\n var last = childEnd(cell.id);\n for (var ci = childBegin(cell.id); ci !== last; ci = next(ci)) {\n var childCell = Cell.fromCellID(ci);\n if (numLevels > 0) {\n if (this.region.intersectsCell(childCell)) {\n numTerminals += this.expandChildren(cand, childCell, numLevels);\n }\n continue;\n }\n var child = this.newCandidate(childCell);\n if (!(child instanceof NilCandidate)) {\n cand.children.push(child);\n cand.numChildren++;\n if (child.terminal) numTerminals++;\n }\n }\n return numTerminals;\n }\n /**\r\n * Adds the given candidate to the result if it is marked as \"terminal\",\r\n * otherwise expands its children and inserts it into the priority queue.\r\n * Passing an argument of nil does nothing.\r\n */;\n _proto2.addCandidate = function addCandidate(cand) {\n if (cand instanceof NilCandidate) return;\n if (cand.terminal) {\n this.result.push(cand.cell.id);\n return;\n }\n // Expand one level at a time until we hit minLevel to ensure that we don't skip over it.\n var numLevels = this.levelMod;\n var level = cand.cell.level;\n if (level < this.minLevel) numLevels = 1;\n var numTerminals = this.expandChildren(cand, cand.cell, numLevels);\n var maxChildrenShift = 2 * this.levelMod;\n if (cand.numChildren === 0) return;\n if (!this.interiorCovering && numTerminals === 1 << maxChildrenShift && level >= this.minLevel) {\n // Optimization: add the parent cell rather than all of its children.\n // We can't do this for interior coverings, since the children just\n // intersect the region, but may not be contained by it - we need to\n // subdivide them further.\n cand.terminal = true;\n this.addCandidate(cand);\n } else {\n // We negate the priority so that smaller absolute priorities are returned\n // first. The heuristic is designed to refine the largest cells first,\n // since those are where we have the largest potential gain. Among cells\n // of the same size, we prefer the cells with the fewest children.\n // Finally, among cells with equal numbers of children we prefer those\n // with the smallest number of children that cannot be refined further.\n cand.priority = -((level << maxChildrenShift) + cand.numChildren << maxChildrenShift + numTerminals);\n this.pq.push(cand);\n }\n }\n /**\r\n * Returns the reduced \"level\" so that it satisfies levelMod. Levels smaller than minLevel\r\n * are not affected (since cells at these levels are eventually expanded).\r\n */;\n _proto2.adjustLevel = function adjustLevel(level) {\n if (this.levelMod > 1 && level > this.minLevel) level -= (level - this.minLevel) % this.levelMod;\n return level;\n }\n /**\r\n * Ensures that all cells with level > minLevel also satisfy levelMod,\r\n * by replacing them with an ancestor if necessary. Cell levels smaller\r\n * than minLevel are not modified (see AdjustLevel). The output is\r\n * then normalized to ensure that no redundant cells are present.\r\n */;\n _proto2.adjustCellLevels = function adjustCellLevels(cells) {\n if (this.levelMod === 1) return;\n var out = 0;\n for (var _iterator = _createForOfIteratorHelperLoose(cells), _step; !(_step = _iterator()).done;) {\n var ci = _step.value;\n var level$1 = level(ci);\n var newLevel = this.adjustLevel(level$1);\n if (newLevel !== level$1) ci = parent(ci, newLevel);\n if (out > 0 && contains(cells[out - 1], ci)) continue;\n while (out > 0 && contains(ci, cells[out - 1])) out--;\n cells[out] = ci;\n out++;\n }\n cells.length = out;\n }\n /** Computes a set of initial candidates that cover the given region. */;\n _proto2.initialCandidates = function initialCandidates(region) {\n var temp = new RegionCoverer();\n temp.maxLevel = this.maxLevel;\n temp.levelMod = 1;\n temp.maxCells = Math.min(4, this.maxCells);\n var cells = temp.fastCovering(region);\n this.adjustCellLevels(cells);\n for (var _iterator2 = _createForOfIteratorHelperLoose(cells), _step2; !(_step2 = _iterator2()).done;) {\n var ci = _step2.value;\n this.addCandidate(this.newCandidate(Cell.fromCellID(ci)));\n }\n }\n /**\r\n * Generates a covering and stores it in result.\r\n * Strategy: Start with the 6 faces of the cube. Discard any\r\n * that do not intersect the shape. Then repeatedly choose the\r\n * largest cell that intersects the shape and subdivide it.\r\n *\r\n * result contains the cells that will be part of the output, while pq\r\n * contains cells that we may still subdivide further. Cells that are\r\n * entirely contained within the region are immediately added to the output,\r\n * while cells that do not intersect the region are immediately discarded.\r\n * Therefore pq only contains cells that partially intersect the region.\r\n * Candidates are prioritized first according to cell size (larger cells\r\n * first), then by the number of intersecting children they have (fewest\r\n * children first), and then by the number of fully contained children\r\n * (fewest children first).\r\n */;\n _proto2.coveringInternal = function coveringInternal(region) {\n this.region = region;\n this.initialCandidates(region);\n while (this.pq.length > 0 && (!this.interiorCovering || this.result.length < this.maxCells)) {\n var cand = this.pq.pop();\n // For interior covering we keep subdividing no matter how many children\n // candidate has. If we reach MaxCells before expanding all children,\n // we will just use some of them.\n // For exterior covering we cannot do this, because result has to cover the\n // whole region, so all children have to be used.\n // candidate.numChildren == 1 case takes care of the situation when we\n // already have more than MaxCells in result (minLevel is too high).\n // Subdividing of the candidate with one child does no harm in this case.\n if (this.interiorCovering || cand.cell.level < this.minLevel || cand.numChildren === 1 || this.result.length + this.pq.length + cand.numChildren <= this.maxCells) {\n for (var _iterator3 = _createForOfIteratorHelperLoose(cand.children), _step3; !(_step3 = _iterator3()).done;) {\n var child = _step3.value;\n if (!this.interiorCovering || this.result.length < this.maxCells) this.addCandidate(child);\n }\n } else {\n cand.terminal = true;\n this.addCandidate(cand);\n }\n }\n this.region = new NilRegion();\n this.pq.reset();\n // Rather than just returning the raw list of cell ids, we construct a cell\n // union and then denormalize it. This has the effect of replacing four\n // child cells with their parent whenever this does not violate the covering\n // parameters specified (min_level, level_mod, etc). This significantly\n // reduces the number of cells returned in many cases, and it is cheap\n // compared to computing the covering in the first place.\n this.result.normalize();\n if (this.minLevel > 0 || this.levelMod > 1) this.result.denormalize(this.minLevel, this.levelMod);\n }\n /**\r\n * Normalizes the \"covering\" so that it conforms to the\r\n * current covering parameters (maxCells, minLevel, MaxLevel, and levelMod).\r\n * This method makes no attempt to be optimal. In particular, if\r\n * minLevel > 0 or levelMod > 1 then it may return more than the\r\n * desired number of cells even when this isn't necessary.\r\n *\r\n * Note that when the covering parameters have their default values, almost\r\n * all of the code in this function is skipped.\r\n */;\n _proto2.normalizeCovering = function normalizeCovering(covering) {\n if (this.maxLevel < MAX_LEVEL || this.levelMod > 1) {\n for (var i = 0; i < covering.length; i++) {\n var level$1 = level(covering[i]);\n var newLevel = this.adjustLevel(Math.min(level$1, this.maxLevel));\n if (newLevel !== level$1) covering[i] = parent(covering[i], newLevel);\n }\n }\n // Sort the cells and simplify them.\n covering.normalize();\n // Make sure that the covering satisfies minLevel and levelMod,\n // possibly at the expense of satisfying MaxCells.\n if (this.minLevel > 0 || this.levelMod > 1) covering.denormalize(this.minLevel, this.levelMod);\n // If there are too many cells and the covering is very large, use the\n // RegionCoverer to compute a new covering. (This avoids possible O(n^2)\n // behavior of the simpler algorithm below.)\n var excess = covering.length - this.maxCells;\n if (excess <= 0 || this.isCanonical(covering)) return;\n if (excess * covering.length > 10000) {\n var rc = new RegionCoverer();\n var cov = rc.covering(covering);\n covering.length = 0;\n covering.push.apply(covering, cov);\n return;\n }\n // If there are still too many cells, then repeatedly replace two adjacent\n // cells in CellID order by their lowest common ancestor.\n while (covering.length > this.maxCells) {\n var bestIndex = -1;\n var bestLevel = -1;\n for (var _i = 0; _i + 1 < covering.length; _i++) {\n var _cellid$commonAncesto = commonAncestorLevel(covering[_i], covering[_i + 1]),\n _level = _cellid$commonAncesto[0],\n ok = _cellid$commonAncesto[1];\n if (!ok) continue;\n var adjustedLevel = this.adjustLevel(_level);\n if (adjustedLevel > bestLevel) {\n bestLevel = adjustedLevel;\n bestIndex = _i;\n }\n }\n if (bestLevel < this.minLevel) break;\n // Replace all cells contained by the new ancestor cell.\n var id = parent(covering[bestIndex], bestLevel);\n var replacements = this.replaceCellsWithAncestor(covering, id);\n covering.length = 0;\n covering.push.apply(covering, replacements);\n // Now repeatedly check whether all children of the parent cell are\n // present, in which case we can replace those cells with their parent.\n while (bestLevel > this.minLevel) {\n bestLevel -= this.levelMod;\n id = parent(id, bestLevel);\n if (!this.containsAllChildren(covering, id)) break;\n var _replacements = this.replaceCellsWithAncestor(covering, id);\n covering.length = 0;\n covering.push.apply(covering, _replacements);\n }\n }\n }\n /** Reports whether the covering is canonical. */;\n _proto2.isCanonical = function isCanonical(covering) {\n var trueMax = this.maxLevel;\n if (this.levelMod !== 1) trueMax = this.maxLevel - (this.maxLevel - this.minLevel) % this.levelMod;\n var tooManyCells = covering.length > this.maxCells;\n var sameParentCount = 1;\n var prevID = 0n;\n for (var _iterator4 = _createForOfIteratorHelperLoose(covering), _step4; !(_step4 = _iterator4()).done;) {\n var id = _step4.value;\n if (!valid(id)) return false;\n // Check that the CellID level is acceptable.\n var level$1 = level(id);\n if (level$1 < this.minLevel || level$1 > trueMax || this.levelMod > 1 && (level$1 - this.minLevel) % this.levelMod !== 0) return false;\n if (prevID !== 0n) {\n // Check that cells are sorted and non-overlapping.\n if (rangeMax(prevID) >= rangeMin(id)) return false;\n var _cellid$commonAncesto2 = commonAncestorLevel(id, prevID),\n lev = _cellid$commonAncesto2[0],\n ok = _cellid$commonAncesto2[1];\n // If there are too many cells, check that no pair of adjacent cells\n // could be replaced by an ancestor.\n if (tooManyCells && ok && lev >= this.minLevel) return false;\n // Check that there are no sequences of (4 ** level_mod) cells that all\n // have the same parent (considering only multiples of \"level_mod\").\n var pLevel = level$1 - this.levelMod;\n if (pLevel < this.minLevel || level$1 !== level(prevID) || parent(id, pLevel) !== parent(prevID, pLevel)) {\n sameParentCount = 1;\n } else {\n sameParentCount++;\n if (sameParentCount === 1 << 2 * this.levelMod) return false;\n }\n }\n prevID = id;\n }\n return true;\n };\n _proto2.containsAllChildren = function containsAllChildren(covering, id) {\n var pos = covering.findIndex(function (c) {\n return c >= rangeMin(id);\n });\n var level$1 = level(id) + this.levelMod;\n for (var child = childBeginAtLevel(id, level$1); child !== childEndAtLevel(id, level$1); child = next(child)) {\n if (pos === -1 || covering[pos] !== child) return false;\n pos++;\n }\n return true;\n }\n /**\r\n * Replaces all descendants of the given id in covering with id.\r\n * This requires the covering contains at least one descendant of id.\r\n */;\n _proto2.replaceCellsWithAncestor = function replaceCellsWithAncestor(covering, id) {\n var begin = binarySearch(covering.length, function (i) {\n return covering[i] > rangeMin(id);\n });\n var end = binarySearch(covering.length, function (i) {\n return covering[i] > rangeMax(id);\n });\n return [].concat(covering.slice(0, begin), [id], covering.slice(end));\n };\n return Coverer;\n}();\nvar Candidate =\n/**\r\n * Returns a new Candidate.\r\n * @category Constructors\r\n */\nfunction Candidate(cell) {\n this.terminal = false; // Cell should not be expanded further.\n this.numChildren = 0; // Number of children that intersect the region.\n this.children = []; // Actual size may be 0, 4, 16, or 64 elements.\n this.priority = 0; // Priority of the candidate.\n this.cell = cell;\n}; // NilCandidate represents a Nil value\nvar NilCandidate = function NilCandidate() {\n this.cell = Cell.fromCellID(SentinelCellID);\n this.terminal = false; // Cell should not be expanded further.\n this.numChildren = 0; // Number of children that intersect the region.\n this.children = []; // Actual size may be 0, 4, 16, or 64 elements.\n this.priority = 0; // Priority of the candidate.\n};\nvar PriorityQueue = /*#__PURE__*/function (_Array) {\n function PriorityQueue() {\n return _Array.apply(this, arguments) || this;\n }\n _inheritsLoose(PriorityQueue, _Array);\n var _proto3 = PriorityQueue.prototype;\n _proto3.len = function len() {\n return this.length;\n }\n // We want pop to give us the highest, not lowest, priority so we use greater than here.\n // less(i: number, j: number): boolean {\n // return this[i].priority > this[j].priority\n // }\n ;\n _proto3.swap = function swap(i, j) {\n var _ref2 = [this[j], this[i]];\n this[i] = _ref2[0];\n this[j] = _ref2[1];\n };\n _proto3.push = function push() {\n var _Array$prototype$push;\n for (var _len = arguments.length, x = new Array(_len), _key = 0; _key < _len; _key++) {\n x[_key] = arguments[_key];\n }\n var n = (_Array$prototype$push = _Array.prototype.push).call.apply(_Array$prototype$push, [this].concat(x));\n this.sort(PriorityQueue.ascending);\n return n;\n };\n _proto3.pop = function pop() {\n var x = _Array.prototype.pop.call(this);\n return x ? x : new NilCandidate();\n };\n _proto3.reset = function reset() {\n this.length = 0;\n };\n PriorityQueue.ascending = function ascending(a, b) {\n return a.priority < b.priority ? -1 : a.priority > b.priority ? 1 : 0;\n };\n return PriorityQueue;\n}(/*#__PURE__*/_wrapNativeSuper(Array));\n\n/**\r\n * Module s2 is a library for working with geometry in S² (spherical geometry).\r\n *\r\n * Its related modules, parallel to this one, are s1 (operates on S¹), r1 (operates on ℝ¹),\r\n * r2 (operates on ℝ²) and r3 (operates on ℝ³).\r\n\n * This package provides types and functions for the S2 cell hierarchy and coordinate systems.\r\n * The S2 cell hierarchy is a hierarchical decomposition of the surface of a unit sphere (S²) into “cells”; it is highly efficient, scales from continental size to under 1 cm² and preserves spatial locality (nearby cells have close IDs).\r\n *\r\n * More information including an in-depth introduction to S2 can be found on the S2 website https://s2geometry.io/\r\n * @module s2\r\n */\n// export { ShapeIndexCell } from './ShapeIndexCell'\n// export { ShapeIndexClippedShape } from './ShapeIndexClippedShape'\n// export { ShapeIndexIterator } from './ShapeIndexIterator'\n// export { ShapeIndexRegion } from './ShapeIndexRegion'\n// export { ShapeIndexTracker } from './ShapeIndexTracker'\n\nvar _index$4 = {\n __proto__: null,\n cellid: cellid,\n Cap: Cap,\n Cell: Cell,\n CellIndex: CellIndex,\n CellIndexRangeIterator: CellIndexRangeIterator,\n CellIndexContentsIterator: CellIndexContentsIterator,\n CellUnion: CellUnion,\n ClosestCellQuery: ClosestCellQuery,\n ClosestCellQueryOptions: ClosestCellQueryOptions,\n PointTarget: PointTarget$1,\n EdgeTarget: EdgeTarget$1,\n CellTarget: CellTarget$1,\n CellUnionTarget: CellUnionTarget,\n ShapeIndexTarget: ShapeIndexTarget$1,\n ClosestEdgeQuery: ClosestEdgeQuery,\n ClosestEdgeQueryOptions: ClosestEdgeQueryOptions,\n EdgeQueryPointTarget: PointTarget,\n EdgeQueryEdgeTarget: EdgeTarget,\n EdgeQueryCellTarget: CellTarget,\n EdgeQueryShapeIndexTarget: ShapeIndexTarget,\n LatLng: LatLng,\n Loop: Loop,\n Point: Point$1,\n Polygon: Polygon,\n Polyline: Polyline,\n Rect: Rect$1,\n RegionCoverer: RegionCoverer,\n Coverer: Coverer,\n ShapeIndex: ShapeIndex\n};\n\n/**\r\n * Returns a geojson Position given an s2 Point.\r\n * @category Constructors\r\n */\nvar marshal = function marshal(point) {\n var ll = LatLng.fromPoint(point);\n return [degrees(ll.lng), degrees(ll.lat)];\n};\n/**\r\n * Constructs an s2 Point given a geojson Position.\r\n * @category Constructors\r\n */\nvar unmarshal = function unmarshal(position) {\n return Point$1.fromLatLng(LatLng.fromDegrees(position[1], position[0]));\n};\n/**\r\n * Returns true IFF the two positions are equal.\r\n */\nvar equal = function equal(a, b, epsilon) {\n if (epsilon === void 0) {\n epsilon = 0;\n }\n if (epsilon == 0) return a[0] === b[0] && a[1] === b[1];\n return Math.abs(a[0] - b[0]) <= epsilon && Math.abs(a[1] - b[1]) <= epsilon;\n};\n\n/**\r\n * Returns a geojson Point geometry given an s2 Point.\r\n * @category Constructors\r\n */\nvar marshal$1 = function marshal$1(point) {\n return {\n type: 'Point',\n coordinates: marshal(point)\n };\n};\n/**\r\n * Constructs an s2 Point given a geojson Point geometry.\r\n * @category Constructors\r\n */\nvar unmarshal$1 = function unmarshal$1(geometry) {\n return unmarshal(geometry.coordinates);\n};\n/**\r\n * Returns a geojson MultiPoint geometry given s2 Points.\r\n * @category Constructors\r\n */\nvar marshalMulti = function marshalMulti(points) {\n return {\n type: 'MultiPoint',\n coordinates: points.map(marshal)\n };\n};\n/**\r\n * Constructs s2 Points given a geojson MultiPoint geometry.\r\n * @category Constructors\r\n */\nvar unmarshalMulti = function unmarshalMulti(geometry) {\n return geometry.coordinates.map(unmarshal);\n};\n\n/**\r\n * Returns a geojson LineString geometry given an s2 Polyline.\r\n * @category Constructors\r\n */\nvar marshal$2 = function marshal$1(polyline) {\n return {\n type: 'LineString',\n coordinates: polyline.points.map(marshal)\n };\n};\n/**\r\n * Constructs an s2 Polyline given a geojson LineString geometry.\r\n * @category Constructors\r\n */\nvar unmarshal$2 = function unmarshal$1(geometry) {\n return new Polyline(geometry.coordinates.map(unmarshal));\n};\n/**\r\n * Returns a geojson MultiLineString geometry given s2 Polylines.\r\n * @category Constructors\r\n */\nvar marshalMulti$1 = function marshalMulti(polylines) {\n return {\n type: 'MultiLineString',\n coordinates: polylines.map(function (polyline) {\n return polyline.points.map(marshal);\n })\n };\n};\n/**\r\n * Constructs s2 Polylines given a geojson MultiLineString geometry.\r\n * @category Constructors\r\n */\nvar unmarshalMulti$1 = function unmarshalMulti(geometry) {\n return geometry.coordinates.map(function (polyline) {\n return new Polyline(polyline.map(unmarshal));\n });\n};\n\n/**\r\n * Returns a geojson Polygon ring given an s2 Loop & ordinal.\r\n * @category Constructors\r\n */\nvar marshal$3 = function marshal$1(loop, ordinal) {\n var ring = loop.vertices.map(marshal);\n if (ordinal > 0) ring.reverse(); // outer ring remains CCW, inner rings become CW\n if (ring.length) ring.push(ring[0]); // add matching start/end points\n return ring;\n};\n/**\r\n * Constructs an s2 Loop given a geojson Polygon ring.\r\n * @category Constructors\r\n *\r\n * Handles differences between GeoJSON and S2:\r\n * - GeoJSON rings are oriented CCW for the exterior and CW for holes, in S2 all loops are oriented CCW.\r\n * - GeoJSON rings duplicate the start/end points, in S2 they do not.\r\n *\r\n * S2 Loops require the following properties be met:\r\n * - Loops are not allowed to have any duplicate vertices (whether adjacent or not).\r\n * - Non-adjacent edges are not allowed to intersect, and furthermore edges of length 180 degrees are not allowed (i.e., adjacent vertices cannot be antipodal).\r\n * - Loops must have at least 3 vertices.\r\n */\nvar unmarshal$3 = function unmarshal$1(ring) {\n if (ring.length < 3) return new Loop([]);\n ring = ring.slice(); // make a copy to avoid mutating input\n if (clockwise(ring)) ring.reverse(); // all rings must be CCW\n if (equal(ring.at(0), ring.at(-1))) ring.length -= 1; // remove matching start/end points\n // Loops are not allowed to have duplicate vertices (whether adjacent or not)\n if (containsDuplicateVertices(ring)) {\n // adjacent duplicates are fixable\n ring = removeAdjacentDuplicateVertices(ring, 0);\n if (ring.length < 3) return new Loop([]);\n // non-adjacent duplicates are not fixable\n if (containsDuplicateVertices(ring)) return new Loop([]);\n }\n return new Loop(ring.map(unmarshal));\n};\n/**\r\n * Removes *adjacent* duplicate (and near-duplicate) vertices from ring.\r\n */\nvar removeAdjacentDuplicateVertices = function removeAdjacentDuplicateVertices(ring, epsilon) {\n if (epsilon === void 0) {\n epsilon = 1e-8;\n }\n return ring.filter(function (p, i) {\n return !i || !equal(ring.at(i - 1), p, epsilon);\n });\n};\n/**\r\n * Returns true IFF ring contains duplicate vertices at any position.\r\n */\nvar containsDuplicateVertices = function containsDuplicateVertices(ring) {\n return new Set(ring.map(function (c) {\n return c[0] + \"|\" + c[1];\n })).size !== ring.length;\n};\n/**\r\n * Returns true IFF ring is oriented Clockwise.\r\n */\nvar clockwise = function clockwise(ring) {\n var sum = 0;\n for (var i = 1; i < ring.length; i++) {\n sum += (ring[i][0] - ring[i - 1][0]) * (ring[i][1] + ring[i - 1][1]);\n }\n return sum > 0;\n};\n\n/**\r\n * Returns a geojson Polygon geometry given an s2 Polygon.\r\n * @category Constructors\r\n */\nvar marshal$4 = function marshal(polygon) {\n return {\n type: 'Polygon',\n coordinates: polygon.loops.map(marshal$3)\n };\n};\n/**\r\n * Constructs an s2 Polygon given a geojson Polygon geometry.\r\n * @category Constructors\r\n */\nvar unmarshal$4 = function unmarshal(geometry) {\n return new Polygon(geometry.coordinates.map(unmarshal$3));\n};\n/**\r\n * Returns a geojson MultiPolygon geometry given s2 Polygons.\r\n * @category Constructors\r\n */\nvar marshalMulti$2 = function marshalMulti(polygons) {\n return {\n type: 'MultiPolygon',\n coordinates: polygons.map(function (polygon) {\n return polygon.loops.map(marshal$3);\n })\n };\n};\n/**\r\n * Constructs s2 Polygons given a geojson MultiPolygon geometry.\r\n * @category Constructors\r\n */\nvar unmarshalMulti$2 = function unmarshalMulti(geometry) {\n return geometry.coordinates.map(function (coords) {\n return new Polygon(coords.map(unmarshal$3));\n });\n};\n\n/**\r\n * Returns a geojson Polygon geometry given an s2 Rect.\r\n * @category Constructors\r\n */\nvar marshal$5 = function marshal(rect) {\n var loop = new Loop(Array.from({\n length: 4\n }, function (_, i) {\n return Point$1.fromLatLng(rect.vertex(i));\n }));\n return marshal$4(Polygon.fromOrientedLoops([loop]));\n};\n/**\r\n * Constructs an s2 Rect given a geojson Polygon geometry.\r\n * @category Constructors\r\n */\nvar unmarshal$5 = function unmarshal(geometry) {\n var ring = geometry.coordinates[0];\n var lngLo = Math.min(ring[0][0], ring[2][0]);\n var lngHi = Math.max(ring[0][0], ring[2][0]);\n var latLo = Math.min(ring[0][1], ring[2][1]);\n var latHi = Math.max(ring[0][1], ring[2][1]);\n return new Rect$1(new Interval(latLo * DEGREE, latHi * DEGREE), Interval$1.fromEndpoints(lngLo * DEGREE, lngHi * DEGREE));\n};\n/**\r\n * Returns true iff the geojson Polygon represents a valid Rect.\r\n * @category Constructors\r\n */\nvar valid$1 = function valid(geometry) {\n if ((geometry == null ? void 0 : geometry.type) !== 'Polygon') return false;\n if ((geometry == null ? void 0 : geometry.coordinates.length) !== 1) return false;\n var ring = geometry.coordinates[0];\n if (ring.length !== 5) return false;\n if (!pointsEqual(ring[0], ring[4])) return false;\n if (!lngEqual(ring[0], ring[3])) return false;\n if (!lngEqual(ring[1], ring[2])) return false;\n if (!latEqual(ring[0], ring[1])) return false;\n if (!latEqual(ring[2], ring[3])) return false;\n return true;\n};\nvar lngEqual = function lngEqual(a, b) {\n return a[0] === b[0];\n};\nvar latEqual = function latEqual(a, b) {\n return a[1] === b[1];\n};\nvar pointsEqual = function pointsEqual(a, b) {\n return lngEqual(a, b) && latEqual(a, b);\n};\n\n/**\r\n * Returns a geojson Geometry given a s2 shape(s).\r\n * @category Constructors\r\n */\nvar toGeoJSON = function toGeoJSON(shape) {\n var _shape;\n if (typeof shape === 'bigint') shape = Cell.fromCellID(shape);\n if (shape instanceof Cell) shape = Polygon.fromCell(shape);\n if (shape instanceof Point$1) return marshal$1(shape);\n if (shape instanceof Polyline) return marshal$2(shape);\n if (shape instanceof Polygon) return marshal$4(shape);\n if (shape instanceof Rect$1) return marshal$5(shape);\n if (Array.isArray(shape) && shape.length) {\n if (shape.every(function (g) {\n return g instanceof Point$1;\n })) return marshalMulti(shape);\n if (shape.every(function (g) {\n return g instanceof Polyline;\n })) return marshalMulti$1(shape);\n if (shape.every(function (g) {\n return g instanceof Polygon;\n })) return marshalMulti$2(shape);\n }\n throw new Error(\"unsupported: \" + (((_shape = shape) == null || (_shape = _shape.constructor) == null ? void 0 : _shape.name) || typeof shape));\n};\n/**\r\n * Constructs s2 shape(s) given a geojson geometry.\r\n * @category Constructors\r\n */\nvar fromGeoJSON = function fromGeoJSON(geometry) {\n var t = geometry == null ? void 0 : geometry.type;\n if (t === 'Point') return unmarshal$1(geometry);\n if (t === 'LineString') return unmarshal$2(geometry);\n if (t === 'Polygon') {\n if (valid$1(geometry)) return unmarshal$5(geometry);\n return unmarshal$4(geometry);\n }\n if (t === 'MultiPoint') return unmarshalMulti(geometry);\n if (t === 'MultiLineString') return unmarshalMulti$1(geometry);\n if (t === 'MultiPolygon') return unmarshalMulti$2(geometry);\n throw new Error(\"unsupported: \" + (t || 'UnknownGeometryType'));\n};\n\n/**\r\n * RegionCoverer allows arbitrary GeoJSON geometries to be approximated as unions of cells (CellUnion).\r\n *\r\n * Typical usage:\r\n *\r\n * \tfeature = loadGeoJSON()\r\n * \trc = new RegionCoverer({ maxCells: 256, memberMaxCells: 64 })\r\n * \tcovering = rc.covering(feature.geometry)\r\n *\r\n * @beta unstable API\r\n */\nvar RegionCoverer$1 = /*#__PURE__*/function () {\n /**\r\n * Returns a new RegionCoverer with the appropriate defaults.\r\n *\r\n * @param options - RegionCoverer options\r\n *\r\n * @category Constructors\r\n */\n function RegionCoverer$1(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$minLevel = _ref.minLevel,\n minLevel = _ref$minLevel === void 0 ? 0 : _ref$minLevel,\n _ref$maxLevel = _ref.maxLevel,\n maxLevel = _ref$maxLevel === void 0 ? MAX_LEVEL : _ref$maxLevel,\n _ref$levelMod = _ref.levelMod,\n levelMod = _ref$levelMod === void 0 ? 1 : _ref$levelMod,\n _ref$maxCells = _ref.maxCells,\n maxCells = _ref$maxCells === void 0 ? 8 : _ref$maxCells,\n _ref$memberMaxCells = _ref.memberMaxCells,\n memberMaxCells = _ref$memberMaxCells === void 0 ? Math.max(Math.floor(maxCells / 10), 8) : _ref$memberMaxCells,\n _ref$compactAt = _ref.compactAt,\n compactAt = _ref$compactAt === void 0 ? 65536 : _ref$compactAt,\n _ref$smallAreaEpsilon = _ref.smallAreaEpsilon,\n smallAreaEpsilon = _ref$smallAreaEpsilon === void 0 ? 1e-6 : _ref$smallAreaEpsilon;\n this.coverer = new RegionCoverer({\n minLevel: minLevel,\n maxLevel: maxLevel,\n levelMod: levelMod,\n maxCells: maxCells\n });\n this.memberCoverer = new RegionCoverer({\n minLevel: minLevel,\n maxLevel: maxLevel,\n levelMod: levelMod,\n maxCells: memberMaxCells\n });\n this.compactAt = compactAt;\n this.smallAreaEpsilon = smallAreaEpsilon;\n }\n /** Computes the covering of a multi-member geometry (ie. MultiPoint, MultiLineString, MultiPolygon). */\n var _proto = RegionCoverer$1.prototype;\n _proto.mutliMemberCovering = function mutliMemberCovering(shapes) {\n var _this = this;\n // sort shapes from largest to smallest\n shapes.sort(function (a, b) {\n return RegionCoverer$1.area(b) - RegionCoverer$1.area(a);\n });\n var union = new CellUnion();\n shapes.forEach(function (shape) {\n var area = RegionCoverer$1.area(shape);\n var isPolygon = shape instanceof Polygon;\n // discard zero-area polygons\n if (isPolygon && area <= 0) return;\n // optionally elect to use a fast covering method for small areas\n var fast = union.length >= _this.memberCoverer.maxCells && area < _this.smallAreaEpsilon;\n var cov = fast ? _this.memberCoverer.fastCovering(shape) : _this.memberCoverer.covering(shape);\n // discard errorneous members which cover the entire planet\n if (!RegionCoverer$1.validCovering(shape, cov)) return;\n // append covering to union\n union = CellUnion.fromUnion(union, cov);\n // force compact large coverings to avoid OOM errors\n if (union.length >= _this.compactAt) union = _this.coverer.covering(union);\n });\n // reduce the global covering to maxCells\n return this.coverer.covering(union);\n }\n /** Returns a CellUnion that covers the given GeoJSON geometry and satisfies the various restrictions. */;\n _proto.covering = function covering(geometry) {\n var shape = fromGeoJSON(geometry);\n if (Array.isArray(shape)) return this.mutliMemberCovering(shape);\n // discard zero-area polygons\n if (shape instanceof Polygon && RegionCoverer$1.area(shape) <= 0) return new CellUnion();\n // discard errorneous shapes which cover the entire planet\n var cov = this.coverer.covering(shape);\n if (!RegionCoverer$1.validCovering(shape, cov)) return new CellUnion();\n return cov;\n }\n /** Computes the area of a shape */;\n RegionCoverer$1.area = function area(shape) {\n if (shape instanceof Polygon) return shape.area();\n if (shape instanceof Polyline) shape.capBound().area();\n if (shape instanceof Rect$1) shape.capBound().area();\n return 0;\n }\n /** Attempts to detect invalid geometries which produce global coverings */;\n RegionCoverer$1.validCovering = function validCovering(shape, covering) {\n if (covering.length !== 6 || !covering.every(isFace)) return true;\n // compare the polygon covering with a covering of the outer ring as a linestring\n if (shape instanceof Polygon) {\n var union = new Polyline(shape.loop(0).vertices).cellUnionBound();\n return union.length === 6 && union.every(isFace);\n }\n // area is too small to have a global covering\n return this.area(shape) < Math.PI * 2;\n };\n return RegionCoverer$1;\n}();\n\n\n\nvar _index$5 = {\n __proto__: null,\n toGeoJSON: toGeoJSON,\n fromGeoJSON: fromGeoJSON,\n RegionCoverer: RegionCoverer$1\n};\n\nexport { _index$5 as geojson, _index as r1, _index$1 as r2, _index$2 as r3, _index$3 as s1, _index$4 as s2 };\n//# sourceMappingURL=s2js.esm.js.map\n","import { DatabaseSync } from 'node:sqlite'\nimport type { StatementSync } from 'node:sqlite'\nimport { s2, geojson } from 's2js'\nimport { thin } from './timeWindow.js'\nimport type { TrackQuery } from './timeWindow.js'\nimport type { TrackStore } from './store.js'\nimport { createInBounds, createMatcher, splitAtAntimeridian } from './utils.js'\nimport type {\n Context,\n Debug,\n GeoBounds,\n LatLngTuple,\n TimedPosition,\n TimedTrackCollection,\n TimeWindow,\n TrackCollection,\n TrackParams,\n} from './types.js'\n\nexport class TransactionStateError extends Error {}\n\nconst toTimed = ({ lat, lon, timestamp }: PositionRow): TimedPosition => ({\n position: [lat, lon],\n timestamp,\n})\n\n/** Sorted times grouped into `[first, last]` stretches, split where two lie more than `gap` apart. */\nconst stretchesOf = (times: number[], gap: number): [number, number][] => {\n const stretches: [number, number][] = []\n for (const time of times) {\n const current = stretches[stretches.length - 1]\n if (current && time - current[1] <= gap) {\n current[1] = time\n } else {\n stretches.push([time, time])\n }\n }\n return stretches\n}\n\n/**\n * S2 cell ids are unsigned 64-bit; SQLite's INTEGER is signed 64-bit, and\n * node:sqlite refuses to bind a bigint above INT64_MAX outright:\n *\n * TypeError: BigInt value is too large to bind\n *\n * Reinterpreting the same bits as signed is lossless in both directions, which\n * casting to Number is not — a real cell id is far above Number's 2^53 exact\n * range and comes back off by one.\n */\nconst toSigned = (id: bigint): bigint => BigInt.asIntN(64, id)\nconst toUnsigned = (id: bigint): bigint => BigInt.asUintN(64, id)\n\n/** Inclusive id range covering every cell contained by `cellId`. */\nconst cellRange = (cellId: bigint): { start: bigint; end: bigint } => {\n if (cellId === 0n) {\n return { start: 0n, end: 2n }\n }\n let lsb = 0n\n let temp = cellId\n while ((temp & 1n) === 0n) {\n temp >>= 1n\n lsb++\n }\n return {\n start: cellId & (cellId - 1n),\n end: cellId | (1n << (lsb + 1n)) | ((1n << lsb) - 1n),\n }\n}\n\nconst cellIdFor = ([lat, lng]: LatLngTuple): bigint => s2.cellid.fromLatLng(s2.LatLng.fromDegrees(lat, lng))\n\n/**\n * Cover a bounds with S2 cells, splitting it at the antimeridian first.\n *\n * maxCells is a deliberate trade: a coarse covering is a superset of the box,\n * so every query post-filters by exact bounds anyway. Asking for more cells\n * buys a tighter prefilter at the cost of a longer WHERE clause.\n */\nconst coveringFor = (bounds: GeoBounds, maxCells: number): bigint[] => {\n const coverer = new geojson.RegionCoverer({ maxLevel: 30, maxCells })\n return splitAtAntimeridian(bounds).flatMap(({ sw, ne }) => {\n const [south, west] = sw\n const [north, east] = ne\n return coverer.covering({\n type: 'Polygon',\n coordinates: [\n [\n [west, south],\n [west, north],\n [east, north],\n [east, south],\n [west, south],\n ],\n ],\n })\n })\n}\n\ninterface PositionRow {\n context: string\n timestamp: number\n lat: number\n lon: number\n}\n\n/** A row with its rowid, which tells apart two fixes sharing a timestamp. */\ninterface NumberedRow extends PositionRow {\n id: number\n}\n\nexport interface SqliteStoreConfig {\n /** Absolute path to the database file, or ':memory:'. */\n file: string\n /**\n * Minimum spacing between stored positions, in ms. 0 stores every one.\n *\n * The same `resolution` the in-memory accumulator applies with\n * `throttleTime`, enforced here on write instead. Without it a boat emitting\n * position at 8 Hz writes ~700k rows a day rather than the ~1.4k a 60s\n * resolution implies — a difference that lands on an SD card.\n */\n resolution?: number\n /** Drop positions older than this many ms. 0 keeps everything. */\n retention?: number\n /** Cells per bounding box covering. */\n maxCells?: number\n /** A gap longer than this ms starts a new track segment. */\n segmentGap?: number\n}\n\nconst DEFAULT_MAX_CELLS = 8\nconst DEFAULT_SEGMENT_GAP = 5 * 60 * 1000\n/**\n * How far apart two fixes inside a clipping box may be and still be read as\n * one stretch. A vessel cannot get far between fixes this close, so reading\n * what lies between them costs less than the two extra queries a separate\n * stretch takes. Any value gives the same clipped track.\n */\nconst CLIP_STRETCH_GAP = 10 * 60 * 1000\n\n/**\n * A position store backed by SQLite, so tracks survive a restart.\n *\n * Uses node:sqlite rather than better-sqlite3: it is built into Node >= 22, so\n * installing the plugin on a Raspberry Pi needs no native compilation.\n *\n * The spatial index is Teppo Kurki's design from SignalK/tracks#11 — an S2 cell\n * id per position, queried as id ranges — as is segmenting a track on a time\n * gap. Both are reimplemented here rather than rebased; see that PR for the\n * original.\n */\nexport class SqliteTrackStore implements TrackStore {\n private readonly db: DatabaseSync\n private readonly insert: StatementSync\n private readonly insertName: StatementSync\n private readonly selectName: StatementSync\n private readonly maxCells: number\n private readonly segmentGap: number\n private readonly retention: number\n private readonly resolution: number\n /** See CLIP_STRETCH_GAP; widened so a coarse write resolution does not split every fix. */\n private readonly stretchGap: number\n private readonly debug: Debug\n /** Timestamp of the last position stored per context, for throttling. */\n private readonly lastStored = new Map<string, number>()\n /**\n * The stored name per context, dated by its newest report. A name arrives\n * with every position, so a repeat is answered here instead of committing a\n * row that has not changed.\n */\n private readonly lastName = new Map<string, { name: string; timestamp: number }>()\n\n constructor(config: SqliteStoreConfig, debug: Debug) {\n this.maxCells = config.maxCells ?? DEFAULT_MAX_CELLS\n this.segmentGap = config.segmentGap ?? DEFAULT_SEGMENT_GAP\n this.retention = config.retention ?? 0\n this.resolution = config.resolution ?? 0\n this.stretchGap = Math.max(CLIP_STRETCH_GAP, 2 * this.resolution)\n this.debug = debug\n\n this.db = new DatabaseSync(config.file)\n // WAL keeps a reader from blocking the writer, which matters because\n // positions arrive continuously while a query is being served.\n this.db.exec('PRAGMA journal_mode = WAL')\n // node:sqlite defaults to FULL, an fsync on every commit, and on an SD\n // card each one can take seconds. NORMAL syncs only at checkpoints. A\n // power cut can then lose the most recent commits but never corrupts the\n // database, and a process crash loses nothing. It is a per-connection\n // setting, so it is set on every open.\n this.db.exec('PRAGMA synchronous = NORMAL')\n // A lock held by another connection, a backup or an sqlite3 shell say, is\n // waited out rather than failing the write at once.\n this.db.exec('PRAGMA busy_timeout = 5000')\n this.db.exec(`\n CREATE TABLE IF NOT EXISTS positions (\n context TEXT NOT NULL,\n timestamp INTEGER NOT NULL,\n lat REAL NOT NULL,\n lon REAL NOT NULL,\n s2cell INTEGER NOT NULL\n );\n CREATE INDEX IF NOT EXISTS idx_s2cell ON positions(s2cell);\n CREATE INDEX IF NOT EXISTS idx_context_timestamp ON positions(context, timestamp);\n -- A separate table rather than a column on positions: this store has no\n -- migration mechanism, so a new table appears harmlessly on a database\n -- written by an older version, where an ALTER TABLE would not.\n CREATE TABLE IF NOT EXISTS names (\n context TEXT PRIMARY KEY,\n name TEXT NOT NULL,\n timestamp INTEGER NOT NULL\n );\n `)\n this.insert = this.db.prepare('INSERT INTO positions (context, timestamp, lat, lon, s2cell) VALUES (?, ?, ?, ?, ?)')\n // Newer wins: a corrected or changed name replaces what is stored, while\n // an older observation arriving late leaves it alone.\n this.insertName = this.db.prepare(\n `INSERT INTO names (context, name, timestamp) VALUES (?, ?, ?)\n ON CONFLICT(context) DO UPDATE SET name = excluded.name, timestamp = excluded.timestamp\n WHERE excluded.timestamp >= names.timestamp`,\n )\n this.selectName = this.db.prepare('SELECT name FROM names WHERE context = ?')\n }\n\n newPosition(context: Context, position: LatLngTuple, timestamp: number = Date.now()): void {\n // Leading-edge throttle per context, matching the in-memory accumulator's\n // throttleTime: the first position in a resolution window is stored and the\n // rest are dropped, not averaged. A vessel emitting at 8 Hz would otherwise\n // write hundreds of thousands of rows a day at the default 60s resolution.\n if (this.resolution > 0) {\n const previous = this.lastStored.get(context)\n // `<` not `<=`: two positions sharing a timestamp are the same instant,\n // and a stored point must not block one that is genuinely later.\n if (previous !== undefined && timestamp - previous < this.resolution) {\n return\n }\n this.lastStored.set(context, timestamp)\n }\n this.store(context, position, timestamp)\n }\n\n private store(context: Context, position: LatLngTuple, timestamp: number): void {\n this.insert.run(context, timestamp, position[0], position[1], toSigned(cellIdFor(position)))\n }\n\n initialTrack(context: Context, track: LatLngTuple[], timestamps?: number[]): void {\n // Replaces the context's history, matching the in-memory store: a caller\n // installing a known track is authoritative for the window it covers.\n this.db.prepare('DELETE FROM positions WHERE context = ?').run(context)\n // Bypasses the throttle: these points are already at whatever resolution\n // the history provider returned, and they are back-dated, so throttling\n // against the newest-seen timestamp would drop most of them.\n for (const [i, position] of track.entries()) {\n this.store(context, position, timestamps?.[i] ?? 0)\n }\n this.lastStored.delete(context)\n }\n\n private rowsFor(context: Context, window?: TimeWindow): PositionRow[] {\n const clauses = ['context = ?']\n const params: (string | number)[] = [context]\n if (window) {\n clauses.push('timestamp >= ?', window.inclusiveEnd ? 'timestamp <= ?' : 'timestamp < ?')\n params.push(window.from, window.to)\n }\n return this.db\n .prepare(`SELECT context, timestamp, lat, lon FROM positions WHERE ${clauses.join(' AND ')} ORDER BY timestamp`)\n .all(...params) as unknown as PositionRow[]\n }\n\n private knows(context: Context): boolean {\n const row = this.db.prepare('SELECT 1 AS found FROM positions WHERE context = ? LIMIT 1').get(context)\n return row !== undefined\n }\n\n get(context: Context, window?: TimeWindow): Promise<LatLngTuple[]> {\n return this.getTimed(context, window).then((points) => points.map(({ position }) => position))\n }\n\n getTimed(context: Context, window?: TimeWindow): Promise<TimedPosition[]> {\n // An unknown context rejects; a known but stationary one resolves with\n // points. Resolving [] for both would make the two indistinguishable and\n // the route could not answer 404.\n if (!this.knows(context)) {\n return Promise.reject(new Error(`No track for ${context}`))\n }\n return Promise.resolve(\n this.rowsFor(context, window).map(({ lat, lon, timestamp }) => ({\n position: [lat, lon] as LatLngTuple,\n timestamp,\n })),\n )\n }\n\n private contexts(): Context[] {\n const rows = this.db.prepare('SELECT DISTINCT context FROM positions').all() as unknown as { context: Context }[]\n return rows.map(({ context }) => context)\n }\n\n getAllTracks(query?: TrackQuery): Promise<{ context: string; track: LatLngTuple[] }[]> {\n return Promise.all(\n this.contexts().map((context) =>\n this.getTimed(context, query?.window).then((points) => ({\n context,\n track: thin(points, query?.resolution).map(({ position }) => position),\n })),\n ),\n )\n }\n\n /**\n * Tracks matching the spatial predicate, which depends on who is asking.\n *\n * `intersects: false` — the v1 routes — matches a track's *last* position:\n * \"which vessels are near me now\". `intersects: true` — the v2 Track API —\n * matches a track that passed through the box at any point in the window,\n * including one that has since left.\n *\n * Two filters run, and they are not redundant despite both testing bounds:\n *\n * - `contextsInBounds` asks the cell index which contexts have *any* position\n * near the box. It is a cheap prefilter that keeps the query off every row\n * in the table, and it decides nothing on its own.\n * - `matcher` — the same predicate the in-memory store uses — then applies\n * whichever rule the caller asked for. That test is authoritative.\n *\n * Because `matcher` has the final say, dropping the exact-bounds check inside\n * `contextsInBounds` does not change any result; it only widens the candidate\n * set. It is kept because a prefilter that returns half the table is not\n * worth running, not because correctness depends on it.\n */\n async getFilteredTracks(\n params: TrackParams,\n selfPosition?: LatLngTuple,\n debug?: Debug,\n query?: TrackQuery,\n ): Promise<TrackCollection> {\n const timed = await this.getFilteredTimedTracks(params, selfPosition, debug, query)\n return Object.fromEntries(\n Object.entries(timed).map(([context, points]) => [context, points.map(({ position }) => position)]),\n )\n }\n\n /**\n * The same filtering as `getFilteredTracks`, keeping each point's timestamp.\n *\n * The untimed form is derived from this one so the two cannot disagree about\n * which tracks match — both the cell prefilter and the authoritative\n * last-position test run once, here.\n */\n async getFilteredTimedTracks(\n params: TrackParams,\n selfPosition?: LatLngTuple,\n debug?: Debug,\n query?: TrackQuery,\n ): Promise<TimedTrackCollection> {\n // A clipped query needs only the stretches near the box, so it reads those\n // instead of every position each candidate has in the window.\n const near = params.bbox && params.clip ? this.rowsNearBounds(params.bbox, query?.window) : undefined\n const candidates = near ? new Set(near.keys()) : params.bbox ? this.contextsInBounds(params.bbox) : undefined\n const matcher = createMatcher(params, selfPosition, debug)\n const requested = params.contexts ? new Set(params.contexts) : undefined\n\n // Narrowed before reading: rows of a context that cannot be returned are\n // not worth fetching.\n const contexts = this.contexts().filter(\n (context) => (!candidates || candidates.has(context)) && (!requested || requested.has(context)),\n )\n const tracks = await Promise.all(\n contexts.map((context) => {\n const rows = near?.get(context)\n const read = rows ? Promise.resolve(rows.map(toTimed)) : this.getTimed(context, query?.window)\n return read.then((points) => ({ context, points: thin(points, query?.resolution) }))\n }),\n )\n return tracks.reduce<TimedTrackCollection>((acc, { context, points }) => {\n if (matcher(points.map(({ position }) => position))) {\n acc[context] = points\n }\n return acc\n }, {})\n }\n\n /** The cell index condition for rows near `bounds`, or none for an empty covering. */\n private coveringClause(bounds: GeoBounds): { where: string; params: bigint[]; cells: number } | undefined {\n const covering = coveringFor(bounds, this.maxCells)\n if (covering.length === 0) {\n return undefined\n }\n // Bound parameters, never interpolation: `BETWEEN ${start} <= s2cell AND\n // ${end}` parses as `s2cell BETWEEN (start <= s2cell) AND end`, collapsing\n // the lower bound to 0 or 1 so the range starts at zero and out-of-range\n // rows leak in.\n const ranges = covering.map(cellRange)\n return {\n where: ranges.map(() => '(s2cell BETWEEN ? AND ?)').join(' OR '),\n params: ranges.flatMap(({ start, end }) => [toSigned(start), toSigned(end)]),\n cells: covering.length,\n }\n }\n\n /** Contexts with at least one position inside `bounds`, via the cell index. */\n private contextsInBounds(bounds: GeoBounds): Set<string> {\n const found = new Set<string>()\n const clause = this.coveringClause(bounds)\n if (!clause) {\n return found\n }\n const { where, params, cells } = clause\n\n const stmt = this.db.prepare(`SELECT DISTINCT context, lat, lon FROM positions WHERE ${where}`)\n const rows = stmt.all(...params) as unknown as { context: string; lat: number; lon: number }[]\n\n const inBounds = createInBounds(bounds)\n for (const { context, lat, lon } of rows) {\n if (inBounds([lat, lon])) {\n found.add(context)\n }\n }\n if (this.debug.enabled) {\n this.debug(`bbox covering ${cells} cells -> ${rows.length} rows -> ${found.size} contexts`)\n }\n return found\n }\n\n /**\n * Per context, the positions a track clipped to `bounds` is made of, and\n * only those: every position inside the box within the window, plus the one\n * either side of each stretch inside, which carries the line to the edge.\n *\n * The cell index finds the times a context was inside the box. Times closer\n * together than `stretchGap` are read as one stretch, including any\n * excursion outside it, since the clip that follows cuts those anyway;\n * further apart they are read separately and the time between is skipped.\n * Nothing between two stretches is inside the box, so skipping it loses\n * nothing the clip would keep: how they are grouped decides only how many\n * rows are read, never the result.\n */\n private rowsNearBounds(bounds: GeoBounds, window?: TimeWindow): Map<Context, PositionRow[]> {\n const near = new Map<Context, PositionRow[]>()\n const clause = this.coveringClause(bounds)\n if (!clause) {\n return near\n }\n const timeClauses = window ? ['timestamp >= ?', window.inclusiveEnd ? 'timestamp <= ?' : 'timestamp < ?'] : []\n const timeParams = window ? [window.from, window.to] : []\n const inWindow = timeClauses.map((c) => ` AND ${c}`).join('')\n\n const inside = this.db\n .prepare(\n `SELECT context, timestamp, lat, lon FROM positions WHERE (${clause.where})${inWindow} ORDER BY context, timestamp`,\n )\n .all(...clause.params, ...timeParams) as unknown as PositionRow[]\n const inBounds = createInBounds(bounds)\n const times = new Map<Context, number[]>()\n for (const { context, timestamp, lat, lon } of inside) {\n if (inBounds([lat, lon])) {\n const list = times.get(context)\n if (list) {\n list.push(timestamp)\n } else {\n times.set(context, [timestamp])\n }\n }\n }\n\n const columns = 'SELECT rowid AS id, context, timestamp, lat, lon FROM positions WHERE context = ?'\n const between = this.db.prepare(`${columns} AND timestamp >= ? AND timestamp <= ? ORDER BY timestamp, rowid`)\n const before = this.db.prepare(\n `${columns} AND timestamp < ?${inWindow} ORDER BY timestamp DESC, rowid DESC LIMIT 1`,\n )\n const after = this.db.prepare(`${columns} AND timestamp > ?${inWindow} ORDER BY timestamp, rowid LIMIT 1`)\n for (const [context, list] of times) {\n const rows = new Map<number, NumberedRow>()\n for (const [start, end] of stretchesOf(list, this.stretchGap)) {\n const read = [\n ...(before.all(context, start, ...timeParams) as unknown as NumberedRow[]),\n ...(between.all(context, start, end) as unknown as NumberedRow[]),\n ...(after.all(context, end, ...timeParams) as unknown as NumberedRow[]),\n ]\n // Keyed by row: where nothing was recorded between two stretches, one's\n // neighbour is the other's first or last row.\n for (const row of read) {\n rows.set(row.id, row)\n }\n }\n near.set(\n context,\n [...rows.values()].sort((a, b) => a.timestamp - b.timestamp || a.id - b.id),\n )\n }\n if (this.debug.enabled) {\n this.debug(`clip covering ${clause.cells} cells -> ${inside.length} rows -> ${near.size} contexts`)\n }\n return near\n }\n\n /**\n * Split a context's positions into segments, breaking where the recording\n * stopped for longer than `segmentGap` — an overnight stop should not draw a\n * straight line across the anchorage.\n */\n segments(context: Context, window?: TimeWindow): LatLngTuple[][] {\n const rows = this.rowsFor(context, window)\n const result: LatLngTuple[][] = []\n let current: LatLngTuple[] = []\n let previous: number | undefined\n for (const { lat, lon, timestamp } of rows) {\n if (previous !== undefined && timestamp - previous > this.segmentGap) {\n result.push(current)\n current = []\n }\n current.push([lat, lon])\n previous = timestamp\n }\n if (current.length > 0) {\n result.push(current)\n }\n return result\n }\n\n recordName(context: Context, name: string, timestamp: number = Date.now()): void {\n const trimmed = name.trim()\n if (trimmed === '') {\n return\n }\n const seen = this.lastName.get(context)\n if (seen && seen.timestamp > timestamp) {\n return\n }\n if (seen?.name === trimmed) {\n seen.timestamp = timestamp\n return\n }\n if (Number(this.insertName.run(context, trimmed, timestamp).changes) > 0) {\n this.lastName.set(context, { name: trimmed, timestamp })\n }\n }\n\n nameFor(context: Context): string | undefined {\n const row = this.selectName.get(context) as { name?: string } | undefined\n return row?.name\n }\n\n prune(maxAge: number, keep?: Context, now = Date.now()): void {\n const cutoff = now - maxAge\n // Drop whole contexts that have gone quiet, then apply the row-level\n // retention if one is configured. `keep` — the own vessel — is excluded:\n // its track has to survive a winter on a mooring.\n const dropped = this.db\n .prepare('SELECT context FROM positions GROUP BY context HAVING MAX(timestamp) < ? AND context IS NOT ?')\n .all(cutoff, keep ?? null) as { context: string }[]\n this.db\n .prepare(\n 'DELETE FROM positions WHERE context IN (SELECT context FROM positions GROUP BY context HAVING MAX(timestamp) < ?) AND context IS NOT ?',\n )\n .run(cutoff, keep ?? null)\n // A vessel that has aged out takes its name with it, or this table grows\n // for every target a harbour ever put past the receiver. The remembered\n // copy goes too, or a vessel returning under the same name would be taken\n // as already stored and never written again.\n for (const { context } of dropped) {\n this.db.prepare('DELETE FROM names WHERE context = ?').run(context)\n this.lastName.delete(context)\n }\n // The write-throttle map is keyed by context and nothing else clears it, so\n // without this every vessel that ever passed leaves an entry behind — an\n // unbounded map on a server watching a busy harbour.\n for (const { context } of dropped) {\n this.lastStored.delete(context)\n }\n // Scoped to `keep` when there is one: this retention is configured as \"days\n // of the own vessel's track to keep\", and applying it to every context\n // would truncate an AIS vessel's track on a setting that does not name it.\n // Unscoped without a `keep`, which is how a standalone store behaves.\n if (this.retention > 0) {\n const oldest = now - this.retention\n if (keep === undefined) {\n this.db.prepare('DELETE FROM positions WHERE timestamp < ?').run(oldest)\n } else {\n this.db.prepare('DELETE FROM positions WHERE timestamp < ? AND context IS ?').run(oldest, keep)\n }\n }\n }\n\n /** Worker startup snapshot; queries and name lookups must not open a second database. */\n storedNames(): { context: string; name: string; timestamp: number }[] {\n return this.db.prepare('SELECT context, name, timestamp FROM names').all() as unknown as {\n context: string\n name: string\n timestamp: number\n }[]\n }\n\n /** A failed batch stops writes in its worker; reads remain available. */\n transaction(write: () => void): void {\n this.db.exec('BEGIN IMMEDIATE')\n try {\n write()\n this.db.exec('COMMIT')\n } catch (error) {\n try {\n this.db.exec('ROLLBACK')\n } catch (rollbackError) {\n // SQLITE_FULL/IOERR may already have rolled back automatically.\n if (!(rollbackError instanceof Error) || !rollbackError.message.includes('no transaction is active')) {\n // Only the message crosses the worker boundary, so it carries both.\n const text = (e: unknown) => (e instanceof Error ? e.message : String(e))\n throw new TransactionStateError(\n `Track transaction rollback failed (${text(rollbackError)}) after: ${text(error)}`,\n { cause: error },\n )\n }\n }\n throw error\n }\n }\n\n close(): void {\n // Repeats of a stored name are dated in memory only. Writing the newest\n // dates back here, in one transaction, lets a reopened store rank a late\n // report against the newest one rather than against the first.\n try {\n const redate = this.db.prepare('UPDATE names SET timestamp = ? WHERE context = ? AND name = ? AND timestamp < ?')\n this.db.exec('BEGIN')\n for (const [context, { name, timestamp }] of this.lastName) {\n redate.run(timestamp, context, name, timestamp)\n }\n this.db.exec('COMMIT')\n } finally {\n this.db.close()\n }\n }\n\n /** Unsigned round-trip check, used by the tests. */\n cellIdsFor(context: Context): bigint[] {\n const stmt = this.db.prepare('SELECT s2cell FROM positions WHERE context = ? ORDER BY timestamp')\n stmt.setReadBigInts(true)\n const rows = stmt.all(context) as unknown as { s2cell: bigint }[]\n return rows.map(({ s2cell }) => toUnsigned(s2cell))\n }\n}\n","import { parentPort, workerData } from 'node:worker_threads'\nimport { SelfPositionUnavailableError } from './utils.js'\nimport { SqliteTrackStore, TransactionStateError } from './sqliteStore.js'\nimport type { SqliteStoreConfig } from './sqliteStore.js'\nimport type { Debug } from './types.js'\nimport type { Operation, WorkerMessage } from './trackStoreProtocol.js'\n\nif (!parentPort) throw new Error('Track store must run in a worker')\nconst port = parentPort\nconst config = workerData as { config: SqliteStoreConfig; debugEnabled: boolean }\nconst send = (message: WorkerMessage): void => port.postMessage(message)\nconst debug: Debug = Object.assign(\n (...args: unknown[]) => {\n if (config.debugEnabled) send({ kind: 'debug', text: args.map(String).join(' ') })\n },\n { enabled: config.debugEnabled },\n)\nconst errorText = (error: unknown): string => (error instanceof Error ? error.message : String(error))\nlet store: SqliteTrackStore | undefined\nlet processing = false\nlet writeFailure: string | undefined\nfunction fatal(error: unknown): void {\n try {\n store?.close()\n } catch {\n /* Preserve the failure that stopped recording. */\n }\n send({ kind: 'fatal', error: errorText(error) })\n port.close()\n}\nfunction mutate(operation: Operation, target: SqliteTrackStore): boolean {\n switch (operation.method) {\n case 'newPosition':\n target.newPosition(...operation.args)\n return true\n case 'recordName':\n target.recordName(...operation.args)\n return true\n case 'initialTrack':\n target.initialTrack(...operation.args)\n return true\n case 'prune':\n target.prune(...operation.args)\n return true\n default:\n return false\n }\n}\nconst isWrite = (operation: Operation): boolean =>\n ['newPosition', 'recordName', 'initialTrack', 'prune'].includes(operation.method)\ntry {\n store = new SqliteTrackStore(config.config, debug)\n send({ kind: 'ready', names: store.storedNames() })\n} catch (error) {\n fatal(error)\n}\nif (store) {\n const target = store\n const process = async ({ operations }: { operations: Operation[] }): Promise<void> => {\n if (processing) {\n fatal(new Error('Overlapping track worker batch'))\n return\n }\n processing = true\n const results: Extract<WorkerMessage, { kind: 'result' }>['results'] = []\n try {\n for (let i = 0; i < operations.length;) {\n const operation = operations[i]!\n if (isWrite(operation)) {\n const first = i\n while (i < operations.length && isWrite(operations[i]!)) i++\n const writes = operations.slice(first, i)\n const acknowledgements: typeof results = []\n try {\n if (writeFailure) throw new Error(writeFailure)\n target.transaction(() => {\n for (const next of writes) {\n mutate(next, target)\n acknowledgements.push({\n id: next.id,\n ...(next.method === 'recordName'\n ? { name: { context: next.args[0], value: target.nameFor(next.args[0]) } }\n : {}),\n ...(next.method === 'prune' ? { names: target.storedNames().map((row) => row.context) } : {}),\n })\n }\n })\n results.push(...acknowledgements)\n } catch (error) {\n if (error instanceof TransactionStateError) throw error\n // Never retry uncertain writes. Keep the database open for reads,\n // which can still succeed on e.g. a full filesystem.\n writeFailure = errorText(error)\n for (const next of writes) results.push({ id: next.id, error: writeFailure, writeFailed: true })\n }\n } else {\n i++\n if (operation.method === 'close') {\n target.close()\n results.push({ id: operation.id })\n send({ kind: 'result', results })\n port.close()\n return\n }\n try {\n let value: unknown\n switch (operation.method) {\n case 'get':\n value = await target.get(...operation.args)\n break\n case 'getTimed':\n value = await target.getTimed(...operation.args)\n break\n case 'getAllTracks':\n value = await target.getAllTracks(...operation.args)\n break\n case 'getFilteredTracks':\n value = await target.getFilteredTracks(operation.args[0], operation.args[1], debug, operation.args[3])\n break\n case 'getFilteredTimedTracks':\n value = await target.getFilteredTimedTracks(\n operation.args[0],\n operation.args[1],\n debug,\n operation.args[3],\n )\n break\n default:\n throw new Error('Unknown track operation')\n }\n results.push({ id: operation.id, value })\n } catch (error) {\n results.push({\n id: operation.id,\n error: errorText(error),\n selfPositionUnavailable: error instanceof SelfPositionUnavailableError,\n })\n }\n }\n }\n send({ kind: 'result', results })\n } catch (error) {\n fatal(error)\n } finally {\n processing = false\n }\n }\n port.on('message', (message: { operations: Operation[] }) => {\n void process(message).catch(fatal)\n })\n}\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;CAAA,CAAC,SAAU,QAAQ,SAAS;EACxB,OAAO,YAA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