UNPKG

tldts

Version:

Library to work against complex domain names, subdomains and URIs.

734 lines (724 loc) 175 kB
'use strict'; /** * Check if `vhost` is a valid suffix of `hostname` (top-domain) * * It means that `vhost` needs to be a suffix of `hostname` and we then need to * make sure that: either they are equal, or the character preceding `vhost` in * `hostname` is a '.' (it should not be a partial label). * * * hostname = 'not.evil.com' and vhost = 'vil.com' => not ok * * hostname = 'not.evil.com' and vhost = 'evil.com' => ok * * hostname = 'not.evil.com' and vhost = 'not.evil.com' => ok */ function shareSameDomainSuffix(hostname, vhost) { if (hostname.endsWith(vhost)) { return (hostname.length === vhost.length || hostname[hostname.length - vhost.length - 1] === '.'); } return false; } /** * Given a hostname and its public suffix, extract the general domain. */ function extractDomainWithSuffix(hostname, publicSuffix) { // Locate the index of the last '.' in the part of the `hostname` preceding // the public suffix. // // examples: // 1. not.evil.co.uk => evil.co.uk // ^ ^ // | | start of public suffix // | index of the last dot // // 2. example.co.uk => example.co.uk // ^ ^ // | | start of public suffix // | // | (-1) no dot found before the public suffix const publicSuffixIndex = hostname.length - publicSuffix.length - 2; const lastDotBeforeSuffixIndex = hostname.lastIndexOf('.', publicSuffixIndex); // No '.' found, then `hostname` is the general domain (no sub-domain) if (lastDotBeforeSuffixIndex === -1) { return hostname; } // Extract the part between the last '.' return hostname.slice(lastDotBeforeSuffixIndex + 1); } /** * Detects the domain based on rules and upon and a host string */ function getDomain$1(suffix, hostname, options) { // Check if `hostname` ends with a member of `validHosts`. if (options.validHosts !== null) { const validHosts = options.validHosts; for (const vhost of validHosts) { if ( /*@__INLINE__*/shareSameDomainSuffix(hostname, vhost)) { return vhost; } } } let numberOfLeadingDots = 0; if (hostname.startsWith('.')) { while (numberOfLeadingDots < hostname.length && hostname[numberOfLeadingDots] === '.') { numberOfLeadingDots += 1; } } // If `hostname` is a valid public suffix, then there is no domain to return. // Since we already know that `getPublicSuffix` returns a suffix of `hostname` // there is no need to perform a string comparison and we only compare the // size. if (suffix.length === hostname.length - numberOfLeadingDots) { return null; } // To extract the general domain, we start by identifying the public suffix // (if any), then consider the domain to be the public suffix with one added // level of depth. (e.g.: if hostname is `not.evil.co.uk` and public suffix: // `co.uk`, then we take one more level: `evil`, giving the final result: // `evil.co.uk`). return /*@__INLINE__*/ extractDomainWithSuffix(hostname, suffix); } /** * Return the part of domain without suffix. * * Example: for domain 'foo.com', the result would be 'foo'. */ function getDomainWithoutSuffix$1(domain, suffix) { // Note: here `domain` and `suffix` cannot have the same length because in // this case we set `domain` to `null` instead. It is thus safe to assume // that `suffix` is shorter than `domain`. return domain.slice(0, -suffix.length - 1); } /** * Matches an ASCII tab (U+0009) or newline (U+000A / U+000D). The WHATWG URL * parser strips these before parsing; we only allocate a cleaned copy (and * re-parse) on the rare input that actually contains one. */ const CONTROL_CHARS = /[\t\n\r]/g; /** * Classify scheme `url.slice(schemeStart, colonIndex)` as a WHATWG special * scheme without allocating a substring (case-insensitive via `| 32`). * Special schemes: ftp, file, http, https, ws, wss * (https://url.spec.whatwg.org/#special-scheme). * * @returns 0 = not special, 1 = special, 2 = file (its host sits only between * "//" and the next slash). */ function getSpecialScheme(url, schemeStart, colonIndex) { const length = colonIndex - schemeStart; const c0 = url.charCodeAt(schemeStart) | 32; if (length === 2) { return c0 === 119 && (url.charCodeAt(schemeStart + 1) | 32) === 115 ? 1 : 0; // ws } else if (length === 3) { const c1 = url.charCodeAt(schemeStart + 1) | 32; const c2 = url.charCodeAt(schemeStart + 2) | 32; if (c0 === 119 && c1 === 115 && c2 === 115) return 1; // wss if (c0 === 102 && c1 === 116 && c2 === 112) return 1; // ftp return 0; } else if (length === 4) { const c1 = url.charCodeAt(schemeStart + 1) | 32; const c2 = url.charCodeAt(schemeStart + 2) | 32; const c3 = url.charCodeAt(schemeStart + 3) | 32; if (c0 === 104 && c1 === 116 && c2 === 116 && c3 === 112) return 1; // http if (c0 === 102 && c1 === 105 && c2 === 108 && c3 === 101) return 2; // file return 0; } else if (length === 5) { return c0 === 104 && (url.charCodeAt(schemeStart + 1) | 32) === 116 && (url.charCodeAt(schemeStart + 2) | 32) === 116 && (url.charCodeAt(schemeStart + 3) | 32) === 112 && (url.charCodeAt(schemeStart + 4) | 32) === 115 ? 1 : 0; // https } return 0; } /** * Extract a hostname from `url`, matching a WHATWG URL parser's host-boundary * behaviour (https://url.spec.whatwg.org/#concept-basic-url-parser) for tldts' * scope. It deliberately does NOT normalise the host (no IDNA/punycode or IPv4 * canonicalisation; IPv6 brackets are stripped, not compressed), strips trailing * dots, and stays lenient where a strict parser rejects (bare host:port, * out-of-range port, user@host) — all documented deviations. * * @param urlIsValidHostname - when true, `url` is already a valid hostname and is * returned by the same reference (factory.ts skips re-validation on that * identity), keeping the common path allocation-free. */ function extractHostname(url, urlIsValidHostname) { let start = 0; let end = url.length; let hasUpper = false; let isSpecial = false; if (!urlIsValidHostname) { // Data URLs never carry a host (and may be huge — short-circuit them). if (url.startsWith('data:')) { return null; } // WHATWG step 1: trim leading/trailing C0 control or space (<= U+0020). // Tab/newline elsewhere are handled lazily below. while (start < url.length && url.charCodeAt(start) <= 32) { start += 1; } while (end > start + 1 && url.charCodeAt(end - 1) <= 32) { end -= 1; } if (url.charCodeAt(start) === 47 /* '/' */ && url.charCodeAt(start + 1) === 47 /* '/' */) { // Scheme-relative reference ("//host/path"). start += 2; } else { const indexOfProtocol = url.indexOf(':/', start); if (indexOfProtocol !== -1) { // "scheme://…". Classify the scheme, then position `start` at the host. const special = getSpecialScheme(url, start, indexOfProtocol); if (special === 1) { // Special scheme: skip the run of '/' and '\' after it // (special-authority-(ignore-)slashes states; '\' acts as '/'). isSpecial = true; start = indexOfProtocol + 2; while (url.charCodeAt(start) === 47 /* '/' */ || url.charCodeAt(start) === 92 /* '\' */) { start += 1; } } else if (special === 2) { // file: the host is only what sits between "//" and the next slash, so // "file://h/x" => "h" but "file:///x" / "file:/x" => no host. isSpecial = true; start = indexOfProtocol + 1; let slashes = 0; while ((url.charCodeAt(start) === 47 || url.charCodeAt(start) === 92) && slashes < 2) { start += 1; slashes += 1; } if (slashes < 2) { return null; } } else { // Unknown scheme: validate the WHATWG scheme grammar [A-Za-z0-9+.-]; // a control char means it was split by a tab/newline (strip + re-parse). for (let i = start; i < indexOfProtocol; i += 1) { const code = url.charCodeAt(i) | 32; if (!(((code >= 97 && code <= 122) || // [a, z] (code >= 48 && code <= 57) || // [0, 9] code === 46 || // '.' code === 45 || // '-' code === 43) // '+' )) { const raw = url.charCodeAt(i); if (raw === 9 || raw === 10 || raw === 13) { return extractHostname(url.replace(CONTROL_CHARS, ''), urlIsValidHostname); } return null; } } // A non-special scheme has an authority only after "//" (else it is an // opaque path with no host). `indexOf(':/')` already gave the first '/'. if (url.charCodeAt(indexOfProtocol + 2) === 47 /* '/' */) { start = indexOfProtocol + 3; } else { return null; } } } else if (url.charCodeAt(start) !== 91 /* '[' */) { // Cold path: no scheme "://", and not a bare IPv6 literal (whose first // ':' would otherwise look like a scheme separator; "[…]" falls through // to the ipv6 handling below). May be a bare host, a host:port, a // user@host, a slash-less special scheme ("https:host"), or an opaque // URI ("mailto:", "tel:", "urn:…"). let indexOfColon = -1; for (let i = start; i < end; i += 1) { const code = url.charCodeAt(i); if (code === 9 || code === 10 || code === 13) { return extractHostname(url.replace(CONTROL_CHARS, ''), urlIsValidHostname); } if (code === 58 /* ':' */) { indexOfColon = i; break; } if (code === 47 || code === 92 || code === 63 || code === 35) { break; } } if (indexOfColon !== -1) { // An '@' before the next delimiter => the ':' is userinfo, not a // scheme ("user:pass@host", "mailto:a@b"): keep the whole authority. let hasIdentifier = false; for (let i = indexOfColon + 1; i < end; i += 1) { const code = url.charCodeAt(i); if (code === 47 || code === 92 || code === 63 || code === 35) { break; } if (code === 64 /* '@' */) { hasIdentifier = true; break; } } if (!hasIdentifier) { // All-digits after ':' => a bare "host:port" (tldts accepts // hostnames too); keep `start` and let the port handling trim it. let allDigits = true; let i = indexOfColon + 1; for (; i < end; i += 1) { const code = url.charCodeAt(i); if (code === 47 || code === 92 || code === 63 || code === 35) { break; } if (code < 48 /* '0' */ || code > 57 /* '9' */) { allDigits = false; break; } } if (i === indexOfColon + 1) { allDigits = false; // nothing after ':' => not a port } if (!allDigits) { const special = getSpecialScheme(url, start, indexOfColon); if (special === 0) { // No "://" anywhere on the cold path, so a non-special scheme has // no authority: opaque path, no host ("mailto:x", "foo:bar"). return null; } isSpecial = true; start = indexOfColon + 1; if (special === 2) { // file (e.g. "file:\\host"): host only between "//" and next slash. let slashes = 0; while ((url.charCodeAt(start) === 47 || url.charCodeAt(start) === 92) && slashes < 2) { start += 1; slashes += 1; } if (slashes < 2) { return null; } } else { while (url.charCodeAt(start) === 47 || url.charCodeAt(start) === 92) { start += 1; } } } } } } } // Find the host's end: first '/', '?' or '#' (and '\' for special URLs, // which WHATWG treats like '/'). Track the last '@', ']' and ':' for // userinfo, ipv6 and port; flag uppercase and a stray tab/newline. The loop // is split on `code < 64` so common host characters take fewer comparisons. let indexOfIdentifier = -1; let indexOfClosingBracket = -1; let indexOfPort = -1; let hasControl = false; for (let i = start; i < end; i += 1) { const code = url.charCodeAt(i); if (code < 64) { if (code === 47 || code === 35 || code === 63) { end = i; break; } else if (code === 58 /* ':' */) { indexOfPort = i; } else if (code === 9 || code === 10 || code === 13) { hasControl = true; } } else if (isSpecial && code === 92 /* '\' */) { end = i; break; } else if (code === 64 /* '@' */) { indexOfIdentifier = i; } else if (code === 93 /* ']' */) { indexOfClosingBracket = i; } else if (code >= 65 && code <= 90) { hasUpper = true; } } // A tab/newline inside the authority: strip everything and re-parse (rare). if (hasControl) { return extractHostname(url.replace(CONTROL_CHARS, ''), urlIsValidHostname); } // Skip userinfo. '>= start' so an empty userinfo ("http://@host") works too. if (indexOfIdentifier !== -1 && indexOfIdentifier >= start && indexOfIdentifier < end) { start = indexOfIdentifier + 1; } if (url.charCodeAt(start) === 91 /* '[' */) { // ipv6 address: return what is between the brackets, or null if unclosed. if (indexOfClosingBracket !== -1) { return url.slice(start + 1, indexOfClosingBracket).toLowerCase(); } return null; } else if (indexOfPort !== -1 && indexOfPort > start && indexOfPort < end) { end = indexOfPort; // trim ':port' } // Empty authority ("http://", "file:///path", "//"); only reachable here via // extraction — a bare valid hostname never lands here. if (start >= end) { return null; } } // Trim trailing dots while (end > start + 1 && url.charCodeAt(end - 1) === 46 /* '.' */) { end -= 1; } const hostname = start !== 0 || end !== url.length ? url.slice(start, end) : url; if (hasUpper) { return hostname.toLowerCase(); } return hostname; } /** * Check if a hostname is an IP. You should be aware that this only works * because `hostname` is already garanteed to be a valid hostname! */ function isProbablyIpv4(hostname) { // Cannot be shorted than 1.1.1.1 if (hostname.length < 7) { return false; } // Cannot be longer than: 255.255.255.255 if (hostname.length > 15) { return false; } let numberOfDots = 0; for (let i = 0; i < hostname.length; i += 1) { const code = hostname.charCodeAt(i); if (code === 46 /* '.' */) { numberOfDots += 1; } else if (code < 48 /* '0' */ || code > 57 /* '9' */) { return false; } } return (numberOfDots === 3 && hostname.charCodeAt(0) !== 46 /* '.' */ && hostname.charCodeAt(hostname.length - 1) !== 46 /* '.' */); } /** * Similar to isProbablyIpv4. */ function isProbablyIpv6(hostname) { if (hostname.length < 3) { return false; } let start = hostname.startsWith('[') ? 1 : 0; let end = hostname.length; if (hostname[end - 1] === ']') { end -= 1; } // We only consider the maximum size of a normal IPV6. Note that this will // fail on so-called "IPv4 mapped IPv6 addresses" but this is a corner-case // and a proper validation library should be used for these. if (end - start > 39) { return false; } let hasColon = false; for (; start < end; start += 1) { const code = hostname.charCodeAt(start); if (code === 58 /* ':' */) { hasColon = true; } else if (!(((code >= 48 && code <= 57) || // 0-9 (code >= 97 && code <= 102) || // a-f (code >= 65 && code <= 90)) // A-F )) { return false; } } return hasColon; } /** * Check if `hostname` is *probably* a valid ip addr (either ipv6 or ipv4). * This *will not* work on any string. We need `hostname` to be a valid * hostname. */ function isIp(hostname) { return isProbablyIpv6(hostname) || isProbablyIpv4(hostname); } /** * Implements fast shallow verification of hostnames. This does not perform a * struct check on the content of labels (classes of Unicode characters, etc.) * but instead check that the structure is valid (number of labels, length of * labels, etc.). * * If you need stricter validation, consider using an external library. */ function isValidAscii(code) { return ((code >= 97 && code <= 122) || (code >= 48 && code <= 57) || code > 127); } /** * Check if a hostname string is valid. It's usually a preliminary check before * trying to use getDomain or anything else. * * Beware: it does not check if the TLD exists. */ function isValidHostname (hostname) { if (hostname.length > 255) { return false; } if (hostname.length === 0) { return false; } if ( /*@__INLINE__*/ !isValidAscii(hostname.charCodeAt(0)) && hostname.charCodeAt(0) !== 46 && // '.' (dot) hostname.charCodeAt(0) !== 95 // '_' (underscore) ) { return false; } // Validate hostname according to RFC let lastDotIndex = -1; let lastCharCode = -1; const len = hostname.length; for (let i = 0; i < len; i += 1) { const code = hostname.charCodeAt(i); if (code === 46 /* '.' */) { if ( // Check that previous label is < 63 bytes long (64 = 63 + '.') i - lastDotIndex > 64 || // Check that previous character was not already a '.' lastCharCode === 46 || // Check that the previous label does not end with '-' (RFC 1035 §2.3.1 LDH). // '_' is intentionally NOT restricted: DNS allows any octet (RFC 2181 §11) and // WHATWG URL does not treat '_' as a forbidden host code point. lastCharCode === 45) { return false; } lastDotIndex = i; } else if (!( /*@__INLINE__*/(isValidAscii(code) || code === 45 || code === 95))) { // Check if there is a forbidden character in the label return false; } lastCharCode = code; } return ( // Check that last label is shorter than 63 chars len - lastDotIndex - 1 <= 63 && // Check that the last character is an allowed trailing label character. // Since we already checked that the char is a valid hostname character, // we only need to check that it's different from '-'. lastCharCode !== 45); } function setDefaultsImpl({ allowIcannDomains = true, allowPrivateDomains = false, detectIp = true, extractHostname = true, mixedInputs = true, validHosts = null, validateHostname = true, }) { return { allowIcannDomains, allowPrivateDomains, detectIp, extractHostname, mixedInputs, validHosts, validateHostname, }; } const DEFAULT_OPTIONS = /*@__INLINE__*/ setDefaultsImpl({}); function setDefaults(options) { if (options === undefined) { return DEFAULT_OPTIONS; } return /*@__INLINE__*/ setDefaultsImpl(options); } /** * Returns the subdomain of a hostname string */ function getSubdomain$1(hostname, domain) { // If `hostname` and `domain` are the same, then there is no sub-domain if (domain.length === hostname.length) { return ''; } return hostname.slice(0, -domain.length - 1); } /** * Implement a factory allowing to plug different implementations of suffix * lookup (e.g.: using a trie or the packed hashes datastructures). This is used * and exposed in `tldts.ts` and `tldts-experimental.ts` bundle entrypoints. */ function getEmptyResult() { return { domain: null, domainWithoutSuffix: null, hostname: null, isIcann: null, isIp: null, isPrivate: null, publicSuffix: null, subdomain: null, }; } function resetResult(result) { result.domain = null; result.domainWithoutSuffix = null; result.hostname = null; result.isIcann = null; result.isIp = null; result.isPrivate = null; result.publicSuffix = null; result.subdomain = null; } function parseImpl(url, step, suffixLookup, partialOptions, result) { const options = /*@__INLINE__*/ setDefaults(partialOptions); // Very fast approximate check to make sure `url` is a string. This is needed // because the library will not necessarily be used in a typed setup and // values of arbitrary types might be given as argument. if (typeof url !== 'string') { return result; } // Extract hostname from `url` only if needed. This can be made optional // using `options.extractHostname`. This option will typically be used // whenever we are sure the inputs to `parse` are already hostnames and not // arbitrary URLs. // // `mixedInput` allows to specify if we expect a mix of URLs and hostnames // as input. If only hostnames are expected then `extractHostname` can be // set to `false` to speed-up parsing. If only URLs are expected then // `mixedInputs` can be set to `false`. The `mixedInputs` is only a hint // and will not change the behavior of the library. // Whether `url` itself was already a valid hostname (only computed on the // mixedInputs path). Lets us skip the post-extraction validation below when // extractHostname returned `url` unchanged (same reference). let urlIsValid = false; if (!options.extractHostname) { result.hostname = url; } else if (options.mixedInputs) { urlIsValid = isValidHostname(url); result.hostname = extractHostname(url, urlIsValid); } else { result.hostname = extractHostname(url, false); } // Check if `hostname` is a valid ip address if (options.detectIp && result.hostname !== null) { result.isIp = isIp(result.hostname); if (result.isIp) { return result; } } // Perform hostname validation if enabled. If hostname is not valid, no need to // go further as there will be no valid domain or sub-domain. This validation // is applied before any early returns to ensure consistent behavior across // all API methods including getHostname(). if (options.validateHostname && options.extractHostname && result.hostname !== null && // Skip the re-scan when `url` was already validated and extractHostname // returned it unchanged (same reference => identical string, still valid). !(urlIsValid && result.hostname === url) && !isValidHostname(result.hostname)) { result.hostname = null; return result; } if (step === 0 /* FLAG.HOSTNAME */ || result.hostname === null) { return result; } // Extract public suffix suffixLookup(result.hostname, options, result); if (step === 2 /* FLAG.PUBLIC_SUFFIX */ || result.publicSuffix === null) { return result; } // Extract domain result.domain = getDomain$1(result.publicSuffix, result.hostname, options); if (step === 3 /* FLAG.DOMAIN */ || result.domain === null) { return result; } // Extract subdomain result.subdomain = getSubdomain$1(result.hostname, result.domain); if (step === 4 /* FLAG.SUB_DOMAIN */) { return result; } // Extract domain without suffix result.domainWithoutSuffix = getDomainWithoutSuffix$1(result.domain, result.publicSuffix); return result; } function fastPathLookup (hostname, options, out) { // Fast path for very popular suffixes; this allows to by-pass lookup // completely as well as any extra allocation or string manipulation. if (!options.allowPrivateDomains && hostname.length > 3) { const last = hostname.length - 1; const c3 = hostname.charCodeAt(last); const c2 = hostname.charCodeAt(last - 1); const c1 = hostname.charCodeAt(last - 2); const c0 = hostname.charCodeAt(last - 3); if (c3 === 109 /* 'm' */ && c2 === 111 /* 'o' */ && c1 === 99 /* 'c' */ && c0 === 46 /* '.' */) { out.isIcann = true; out.isPrivate = false; out.publicSuffix = 'com'; return true; } else if (c3 === 103 /* 'g' */ && c2 === 114 /* 'r' */ && c1 === 111 /* 'o' */ && c0 === 46 /* '.' */) { out.isIcann = true; out.isPrivate = false; out.publicSuffix = 'org'; return true; } else if (c3 === 117 /* 'u' */ && c2 === 100 /* 'd' */ && c1 === 101 /* 'e' */ && c0 === 46 /* '.' */) { out.isIcann = true; out.isPrivate = false; out.publicSuffix = 'edu'; return true; } else if (c3 === 118 /* 'v' */ && c2 === 111 /* 'o' */ && c1 === 103 /* 'g' */ && c0 === 46 /* '.' */) { out.isIcann = true; out.isPrivate = false; out.publicSuffix = 'gov'; return true; } else if (c3 === 116 /* 't' */ && c2 === 101 /* 'e' */ && c1 === 110 /* 'n' */ && c0 === 46 /* '.' */) { out.isIcann = true; out.isPrivate = false; out.publicSuffix = 'net'; return true; } else if (c3 === 101 /* 'e' */ && c2 === 100 /* 'd' */ && c1 === 46 /* '.' */) { out.isIcann = true; out.isPrivate = false; out.publicSuffix = 'de'; return true; } } return false; } // Auto-generated flat public-suffix trie. Do not edit. const nodeFlags = /*#__PURE__*/ new Uint8Array([1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 0, 2, 2, 0, 2, 0, 0, 1, 0, 0, 2, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 2, 2, 0, 0, 0, 2, 0, 1, 1, 0, 2, 0, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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, 9, 10, 17, 105, 110, 116, 123, 129, 135, 144, 145, 146, 147, 148, 149, 150, 152, 153, 154, 156, 158, 225, 238, 240, 241, 242, 257, 264, 265, 268, 269, 270, 273, 275, 295, 296, 298, 307, 312, 313, 331, 332, 335, 337, 338, 340, 374, 375, 377, 380, 381, 385, 387, 391, 394, 426, 429, 442, 443, 451, 453, 463, 477, 478, 479, 488, 525, 530, 546, 566, 572, 613, 614, 641, 668, 669, 817, 823, 826, 827, 828, 833, 838, 847, 869, 870, 871, 872, 873, 874, 875, 893, 895, 896, 899, 901, 902, 904, 906, 921, 936, 941, 942, 944, 945, 946, 947, 948, 950, 953, 958, 959, 960, 962, 963, 966, 969, 970, 971, 984, 986, 998, 1009, 1017, 1019, 1058, 1061, 1065, 1066, 1068, 1071, 1082, 1084, 1094, 1096, 1102, 1104, 1105, 1107, 1110, 1111, 1112, 1163, 1165, 1167, 1187, 1188, 1189, 1190, 1192, 1203, 1234, 1245, 1257, 1266, 1273, 1278, 1291, 1302, 1315, 1316, 1327, 1361, 1362, 1363, 1378, 1393, 1465, 1466, 1468, 1469, 1503, 1504, 1505, 1508, 1512, 1514, 1543, 1544, 1552, 1553, 1554, 1556, 1558, 1559, 1561, 1562, 1563, 1574, 1575, 1576, 1577, 1578, 1579, 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1590, 1591, 1592, 1594, 2050, 2053, 2054, 2056, 2063, 2070, 2078, 2082, 2093, 2094, 2095, 2107, 2108, 2110, 2112, 2113, 2120, 2121, 2123, 2124, 2126, 2127, 2128, 2129, 2130, 2198, 2200, 2221, 2222, 2223, 2225, 2251, 2252, 2303, 2304, 2306, 2313, 2319, 2329, 2339, 2392, 2393, 2394, 2404, 2418, 2419, 2422, 2429, 2430, 2438, 2439, 2440, 2441, 2442, 2452, 2453, 2454, 2456, 2457, 2458, 2460, 2470, 2482, 2488, 2520, 2524, 2526, 2527, 2529, 2530, 2537, 2538, 2540, 2548, 2555, 2561, 2566, 2567, 2573, 2576, 2582, 2589, 2590, 2597, 2605, 2606, 2607, 2645, 2651, 2666, 2667, 2672, 2690, 2721, 2738, 2740, 2743, 2751, 2753, 2760, 2808, 2832, 2833, 2834, 2835, 2836, 2837, 2838, 2839, 2846, 2847, 2848, 2849, 2850, 2851, 2853, 2854, 2858, 2942, 2955, 2956, 3391, 3395, 3409, 3461, 3489, 3511, 3569, 3591, 3606, 3669, 3720, 3758, 3794, 3819, 3961, 4007, 4058, 4077, 4111, 4126, 4146, 4176, 4207, 4230, 4261, 4291, 4323, 4350, 4425, 4447, 4485, 4495, 4529, 4548, 4574, 4616, 4666, 4692, 4761, 4762, 4764, 4787, 4810, 4846, 4877, 4894, 4951, 4964, 4988, 5017, 5019, 5053, 5069, 5097, 5402, 5411, 5420, 5427, 5444, 5448, 5454, 5493, 5495, 5502, 5509, 5518, 5525, 5526, 5536, 5539, 5554, 5555, 5564, 5565, 5574, 5583, 5589, 5591, 5592, 5593, 5628, 5629, 5631, 5639, 5646, 5659, 5663, 5665, 5666, 5672, 5679, 5693, 5703, 5708, 5716, 5724, 5730, 5731, 5735, 5737, 5738, 5750, 5751, 5752, 5753, 5755, 5756, 5759, 5761, 5764, 5768, 5769, 5775, 5776, 5777, 5779, 5781, 5783, 5784, 5785, 5788, 5790, 5793, 5794, 5796, 5993, 6000, 6001, 6011, 6016, 6033, 6047, 6056, 6057, 6058, 6062, 6063, 6065, 6067, 6073, 6074, 6077, 6078, 6080, 6081, 6082, 6973, 6977, 6995, 7004, 7007, 7012, 7013, 7015, 7016, 7017, 7019, 7071, 7072, 7075, 7076, 7194, 7195, 7206, 7217, 7224, 7227, 7236, 7237, 7238, 7253, 7308, 7499, 7501, 7502, 7504, 7509, 7522, 7537, 7544, 7553, 7556, 7559, 7566, 7574, 7578, 7579, 7580, 7594, 7598, 7607, 7608, 7609, 7613, 7648, 7649, 7666, 7673, 7681, 7682, 7686, 7694, 7738, 7739, 7745, 7748, 7759, 7764, 7765, 7768, 7799, 7800, 7806, 7813, 7814, 7822, 7831, 7846, 7850, 7902, 7903, 7908, 7910, 7913, 7915, 7916, 7917, 7926, 7941, 7949, 7963, 7975, 7976, 7978, 7980, 8002, 8013, 8019, 8020, 8032, 8044, 8131, 8143, 8145, 8154, 8157, 8163, 8188, 8191, 8192, 8193, 8195, 8198, 8201, 8212, 8214, 8216, 8244, 8318, 8325, 8329, 8330, 8339, 8361, 8362, 8367, 8368, 8447, 8449, 8450, 8459, 8463, 8469, 8475, 8481, 8491, 8496, 8497, 8515, 8526, 8531, 8536, 8546, 8552, 8556, 8562, 8568, 10176, 10177, 10178, 10185, 10187]); const edgeLength = /*#__PURE__*/ new Uint8Array([3, 3, 3, 3, 3, 3, 3, 5, 8, 8, 2, 2, 3, 3, 3, 3, 3, 8, 5, 5, 5, 5, 5, 3, 3, 5, 5, 9, 12, 19, 8, 19, 8, 11, 9, 9, 8, 7, 7, 6, 8, 9, 16, 10, 7, 7, 11, 8, 6, 6, 9, 7, 11, 7, 14, 4, 4, 4, 4, 4, 4, 10, 7, 6, 6, 6, 6, 10, 10, 6, 10, 10, 22, 11, 9, 10, 10, 10, 9, 10, 8, 7, 7, 7, 8, 21, 13, 11, 11, 9, 10, 9, 13, 10, 8, 8, 9, 12, 9, 7, 10, 7, 7, 13, 7, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 8, 6, 3, 3, 3, 3, 3, 3, 2, 5, 3, 3, 3, 7, 2, 2, 2, 2, 2, 2, 3, 3, 3, 1, 1, 7, 8, 5, 2, 2, 7, 2, 2, 1, 4, 1, 11, 9, 9, 5, 5, 8, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 3, 11, 9, 9, 13, 7, 14, 7, 6, 6, 6, 7, 6, 6, 6, 6, 6, 10, 7, 11, 9, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 8, 7, 10, 9, 9, 9, 8, 9, 8, 10, 10, 6, 9, 9, 8, 10, 10, 7, 8, 1, 9, 10, 12,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 16, 17, 11, 6, 2, 14, 9, 13, 10, 14, 16, 17, 11, 2, 14, 9, 13, 10, 16, 11, 2, 14, 10, 19, 7, 2, 14, 9, 13, 10, 19, 10, 7, 14, 16, 17, 11, 6, 2, 14, 9, 13, 10, 19, 7, 14, 16, 17, 11, 2, 14, 9, 13, 17, 13, 10, 10, 14, 16, 17, 11, 6, 3, 2, 14, 9, 13, 10, 10, 14, 16, 17, 11, 6, 9, 10, 12, 14, 14, 14, 12, 12, 12, 12, 12, 14, 14, 14, 10, 10, 10, 14, 9, 9, 9, 9, 14, 14, 14, 13, 13, 14, 9, 9, 9, 9, 9, 9, 4, 11, 2, 14, 9, 13, 17, 13, 10, 19, 10, 7, 14, 16, 17, 11, 6, 2, 14, 9, 13, 17, 13, 10, 19, 10, 7, 14, 16, 17, 11, 6, 2, 9, 10, 10, 7, 17, 3, 3, 12, 12, 16, 15, 15, 12, 14, 14, 14, 20, 20, 13, 12, 12, 12, 12, 12, 12, 20, 25, 14, 14, 12, 12, 10, 10, 10, 10, 9, 9, 9, 25, 4, 9, 17, 10, 7, 14, 16, 21, 13, 13, 14, 20, 14, 13, 17, 24, 9, 12, 13, 25, 13, 21, 20, 17, 9, 9, 9, 9, 9, 9, 12, 17, 4, 4, 9, 9, 9, 10, 10, 12, 14, 14, 14, 12, 12, 12, 12, 12, 14, 14, 10, 10, 10, 10, 14, 9, 9, 9, 10, 14, 14, 14, 13, 13, 9, 9, 9, 9, 9, 9, 1, 8, 7, 11, 11, 1, 3, 3, 3, 4, 8, 9, 10, 14, 14, 12, 12, 12, 12, 14, 14, 10, 10, 10, 10, 14, 9, 9, 9, 10, 14, 14, 14, 13, 13, 9, 9, 9, 9, 9, 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 9, 12, 6, 14, 4, 12, 7, 2, 2, 1, 2, 7, 6, 4, 4, 4, 6, 8, 8, 7, 4, 5, 6, 3, 3, 3, 3, 4, 16, 8, 3, 5, 4, 3, 3, 3, 5, 2, 2, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 11, 12, 7, 7, 13, 9, 10, 12, 8, 9, 7, 8, 5, 12, 10, 13, 14, 5, 5, 5, 13, 5, 5, 5, 3, 3, 3, 5, 16, 5, 5, 5, 5, 5, 7, 12, 14, 8, 12, 8, 10, 12, 9, 11, 7, 9, 7, 10, 7, 13, 9, 7, 12, 8, 17, 7, 7, 16, 10, 13, 13, 8, 10, 10, 14, 17, 7, 16, 16, 15, 8, 10, 10, 12, 17, 7, 17, 14, 7, 10, 17, 8, 7, 7, 7, 8, 15, 15, 7, 14, 10, 10, 10, 11, 11, 7, 7, 13, 8, 10, 7, 16, 7, 8, 7, 14, 17, 12, 10, 11, 21, 8, 9, 7, 13, 9, 8, 13, 6, 12, 7, 6, 13, 10, 10, 10, 8, 18, 9, 17, 13, 10, 12, 6, 13, 6, 11, 8, 13, 10, 13, 18, 13, 11, 13, 8, 16, 7, 10, 8, 16, 12, 10, 8, 8, 6, 14, 11, 8, 15, 8, 8, 7, 7, 12, 7, 8, 9, 14, 15, 8, 9, 10, 9, 15, 7, 8, 8, 12, 13, 9, 10, 15, 15, 13, 7, 10, 10, 20, 7, 6, 9, 6, 6, 14, 11, 14, 11, 12, 9, 10, 16, 16, 12, 7, 11, 28, 8, 11, 10, 7, 21, 8, 7, 9, 4, 4, 4, 17, 7, 8, 6, 9, 6, 6, 13, 6, 6, 6, 6, 18, 20, 14, 8, 11, 12, 9, 10, 13, 15, 19, 8, 9, 12, 7, 10, 16, 12, 9, 9, 9, 14, 12, 11, 9, 12, 11, 18, 9, 9, 9, 10, 7, 7, 16, 8, 9, 7, 13, 12, 10, 18, 7, 8, 11, 7, 7, 8, 8, 13, 7, 7, 7, 11, 15, 13, 11, 7, 8, 15, 11, 7, 8, 18, 14, 13, 18, 15, 10, 12, 12, 9, 7, 11, 11, 8, 7, 10, 8, 14, 12, 10, 18, 7, 10, 9, 7, 8, 13, 10, 14, 9, 10, 8, 8, 23, 7, 7, 11, 12, 12, 17, 7, 7, 11, 11, 17, 16, 16, 7, 8, 11, 14, 14, 8, 10, 7, 7, 16, 16, 13, 9, 11, 9, 15, 15, 11, 11, 7, 7, 14, 7, 9, 7, 7, 16, 10, 13, 10, 11, 14, 7, 11, 10, 11, 7, 11, 10, 11, 15, 11, 15, 10, 12, 17, 10, 14, 13, 11, 11, 12, 13, 10, 7, 13, 10, 16, 12, 21, 14, 9, 10, 10, 7, 11, 14, 17, 7, 7, 8, 11, 12, 8, 15, 14, 14, 8, 17, 12, 10, 10, 7, 9, 11, 7, 10, 7, 11, 18, 7, 11, 7, 12, 11, 8, 8, 14, 12, 7, 8, 15, 3, 7, 7, 5, 2, 9, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 4, 4, 3, 3, 3, 3, 3, 3, 5, 11, 6, 4, 7, 10, 7, 7, 11, 1, 10, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 5, 7, 3, 5, 6, 3, 3, 5, 2, 2, 5, 3, 4, 13, 11, 3, 3, 6, 3, 5, 14, 2, 2, 3, 8, 2, 2, 12, 18, 5, 3, 3, 3, 16, 5, 5, 5, 10, 7, 13, 12, 13, 9, 12, 14, 19, 9, 21, 9, 9, 10, 6, 9, 6, 15, 10, 6, 12, 8, 6, 10, 15, 4, 4, 6, 9, 9, 12, 16, 14, 23, 7, 7, 14, 9, 7, 7, 11, 14, 10, 10, 10, 10, 12, 11, 10, 13, 11, 15, 11, 7, 12, 10, 3, 7, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 3, 7, 2, 5, 5, 3, 3, 5, 5, 5, 5, 7, 6, 6, 6, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 7, 10, 2, 2, 2, 5, 5, 5, 5, 3, 3, 3, 3, 3, 5, 5, 10, 9, 11, 8, 7, 12, 8, 9, 7, 6, 13, 11,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