jbrowse-plugin-graphgenomeviewer 3.0.4 → 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/README.md +29 -2
- package/dist/chunks/GbzBaseSyntenyAdapter-MIOUYHOF.js +8 -0
- package/dist/chunks/GbzBaseSyntenyAdapter-MIOUYHOF.js.map +7 -0
- package/dist/chunks/GraphGenomeView-TM7WYDLH.js +14 -0
- package/dist/chunks/GraphGenomeView-TM7WYDLH.js.map +7 -0
- package/dist/chunks/MinigraphBubbleAdapter-A7SBF2XY.js +2 -0
- package/dist/chunks/MinigraphBubbleAdapter-A7SBF2XY.js.map +7 -0
- package/dist/chunks/RgfaTabixAdapter-7ZGKJJYW.js +3 -0
- package/dist/chunks/RgfaTabixAdapter-7ZGKJJYW.js.map +7 -0
- package/dist/chunks/{chunk-X3X74OGB.js → chunk-7T2HTRP3.js} +2 -2
- package/dist/chunks/{chunk-X3X74OGB.js.map → chunk-7T2HTRP3.js.map} +3 -3
- package/dist/chunks/{chunk-JCG7RLMB.js → chunk-HOM2Y6XS.js} +2 -2
- package/dist/chunks/chunk-HOM2Y6XS.js.map +7 -0
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js +2 -2
- package/dist/jbrowse-plugin-graphgenomeviewer.esm.js.map +4 -4
- package/package.json +21 -22
- package/src/GbzBaseSyntenyAdapter/GbzBaseSyntenyAdapter.test.ts +69 -0
- package/src/GbzBaseSyntenyAdapter/GbzBaseSyntenyAdapter.ts +13 -10
- package/src/GetSubgraph.ts +5 -1
- package/src/GraphGenomeView/components/FollowControl.test.tsx +69 -0
- package/src/GraphGenomeView/components/FollowControl.tsx +42 -0
- package/src/GraphGenomeView/components/GraphStats.tsx +1 -0
- package/src/GraphGenomeView/components/GraphToolbar.tsx +2 -0
- package/src/GraphGenomeView/follow.test.ts +624 -0
- package/src/GraphGenomeView/follow.ts +129 -0
- package/src/GraphGenomeView/layout/sampleRowLayout.test.ts +16 -0
- package/src/GraphGenomeView/layout/sampleRowLayout.ts +13 -4
- package/src/GraphGenomeView/layoutModes.ts +3 -1
- package/src/GraphGenomeView/model.ts +361 -55
- package/src/GraphGenomeView/types.ts +4 -0
- package/src/MinigraphBubbleAdapter/MinigraphBubbleAdapter.ts +1 -1
- package/src/RgfaTabixAdapter/RgfaTabixAdapter.test.ts +73 -0
- package/src/RgfaTabixAdapter/RgfaTabixAdapter.ts +48 -16
- package/src/RgfaTabixAdapter/configSchema.ts +70 -3
- package/src/RgfaTabixAdapter/test_data/rgfa_ecoli.tier1000.links.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/rgfa_ecoli.tier1000.links.bed.gz.tbi +0 -0
- package/src/RgfaTabixAdapter/test_data/rgfa_ecoli.tier1000.segs.bed.gz +0 -0
- package/src/RgfaTabixAdapter/test_data/rgfa_ecoli.tier1000.segs.bed.gz.tbi +0 -0
- package/src/launchSubgraph/index.ts +12 -6
- package/src/launchSubgraph/launchSubgraph.test.ts +89 -3
- package/src/launchSubgraph/launchSubgraphView.ts +14 -6
- package/src/launchSubgraph/linearViewMenuItems.ts +3 -0
- package/src/launchSubgraph/subgraphMenuItems.ts +7 -0
- package/src/launchSubgraph/testEnv.ts +2 -0
- package/src/panSNTabix.ts +6 -5
- package/src/synteny/ComparativeAdapterBase.ts +13 -10
- package/src/synteny/clipFeatureToRegion.test.ts +41 -1
- package/src/synteny/clipFeatureToRegion.ts +22 -5
- package/src/version.ts +1 -1
- package/dist/chunks/GbzBaseSyntenyAdapter-6UTRY4CV.js +0 -8
- package/dist/chunks/GbzBaseSyntenyAdapter-6UTRY4CV.js.map +0 -7
- package/dist/chunks/GraphGenomeView-UD5WCV3Q.js +0 -14
- package/dist/chunks/GraphGenomeView-UD5WCV3Q.js.map +0 -7
- package/dist/chunks/MinigraphBubbleAdapter-B75VQK7T.js +0 -2
- package/dist/chunks/MinigraphBubbleAdapter-B75VQK7T.js.map +0 -7
- package/dist/chunks/RgfaTabixAdapter-IT7I5RR3.js +0 -3
- package/dist/chunks/RgfaTabixAdapter-IT7I5RR3.js.map +0 -7
- package/dist/chunks/chunk-JCG7RLMB.js.map +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../node_modules/.pnpm/pako-esm2@2.0.2/node_modules/pako-esm2/src/zlib/constants.js", "../../node_modules/.pnpm/pako-esm2@2.0.2/node_modules/pako-esm2/src/utils/common.js", "../../node_modules/.pnpm/pako-esm2@2.0.2/node_modules/pako-esm2/src/utils/strings.js", "../../node_modules/.pnpm/pako-esm2@2.0.2/node_modules/pako-esm2/src/zlib/gzheader.js", "../../node_modules/.pnpm/pako-esm2@2.0.2/node_modules/pako-esm2/src/zlib/adler32.js", "../../node_modules/.pnpm/pako-esm2@2.0.2/node_modules/pako-esm2/src/zlib/crc32.js", "../../node_modules/.pnpm/pako-esm2@2.0.2/node_modules/pako-esm2/src/zlib/inffast.js", "../../node_modules/.pnpm/pako-esm2@2.0.2/node_modules/pako-esm2/src/zlib/inftrees.js", "../../node_modules/.pnpm/pako-esm2@2.0.2/node_modules/pako-esm2/src/zlib/inflate.js", "../../node_modules/.pnpm/pako-esm2@2.0.2/node_modules/pako-esm2/src/zlib/messages.js", "../../node_modules/.pnpm/pako-esm2@2.0.2/node_modules/pako-esm2/src/zlib/zstream.js", "../../node_modules/.pnpm/pako-esm2@2.0.2/node_modules/pako-esm2/src/inflate.js", "../../node_modules/.pnpm/@gmod+bgzf-filehandle@6.7.0/node_modules/@gmod/bgzf-filehandle/src/bgzfBlockScan.ts", "../../node_modules/.pnpm/@gmod+bgzf-filehandle@6.7.0/node_modules/@gmod/bgzf-filehandle/src/util.ts", "../../node_modules/.pnpm/@gmod+bgzf-filehandle@6.7.0/node_modules/@gmod/bgzf-filehandle/src/wasm/bgzf-wasm-inlined.js", "../../node_modules/.pnpm/@gmod+bgzf-filehandle@6.7.0/node_modules/@gmod/bgzf-filehandle/src/unzip.ts", "../../node_modules/.pnpm/@gmod+shared-read-cache@1.7.2/node_modules/@gmod/shared-read-cache/src/throwIfAborted.ts", "../../node_modules/.pnpm/@gmod+shared-read-cache@1.7.2/node_modules/@gmod/shared-read-cache/src/SharedReadCache.ts", "../../node_modules/.pnpm/generic-filehandle2@2.4.0/node_modules/generic-filehandle2/src/util.ts", "../../node_modules/.pnpm/generic-filehandle2@2.4.0/node_modules/generic-filehandle2/src/remoteFile.ts", "../../node_modules/.pnpm/generic-filehandle2@2.4.0/node_modules/generic-filehandle2/src/browser.ts", "../../node_modules/.pnpm/@gmod+tabix@3.8.3/node_modules/@gmod/tabix/src/chunk.ts", "../../node_modules/.pnpm/@jbrowse+quick-lru@7.3.5/node_modules/@jbrowse/quick-lru/src/index.js", "../../node_modules/.pnpm/@gmod+tabix@3.8.3/node_modules/@gmod/tabix/src/long.ts", "../../node_modules/.pnpm/@gmod+tabix@3.8.3/node_modules/@gmod/tabix/src/virtualOffset.ts", "../../node_modules/.pnpm/@gmod+tabix@3.8.3/node_modules/@gmod/tabix/src/util.ts", "../../node_modules/.pnpm/@gmod+tabix@3.8.3/node_modules/@gmod/tabix/src/indexFile.ts", "../../node_modules/.pnpm/@gmod+tabix@3.8.3/node_modules/@gmod/tabix/src/csi.ts", "../../node_modules/.pnpm/@gmod+tabix@3.8.3/node_modules/@gmod/tabix/src/tbi.ts", "../../node_modules/.pnpm/@gmod+tabix@3.8.3/node_modules/@gmod/tabix/src/tabixIndexedFile.ts", "../../src/panSNTabix.ts"],
|
|
4
|
+
"sourcesContent": ["// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n/* Allowed flush values; see deflate() and inflate() below for details */\nexport var Z_NO_FLUSH = 0\nexport var Z_PARTIAL_FLUSH = 1\nexport var Z_SYNC_FLUSH = 2\nexport var Z_FULL_FLUSH = 3\nexport var Z_FINISH = 4\nexport var Z_BLOCK = 5\nexport var Z_TREES = 6\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nexport var Z_OK = 0\nexport var Z_STREAM_END = 1\nexport var Z_NEED_DICT = 2\nexport var Z_ERRNO = -1\nexport var Z_STREAM_ERROR = -2\nexport var Z_DATA_ERROR = -3\n//export var Z_MEM_ERROR = -4;\nexport var Z_BUF_ERROR = -5\n//export var Z_VERSION_ERROR = -6;\n\n/* compression levels */\nexport var Z_NO_COMPRESSION = 0\nexport var Z_BEST_SPEED = 1\nexport var Z_BEST_COMPRESSION = 9\nexport var Z_DEFAULT_COMPRESSION = -1\n\nexport var Z_FILTERED = 1\nexport var Z_HUFFMAN_ONLY = 2\nexport var Z_RLE = 3\nexport var Z_FIXED = 4\nexport var Z_DEFAULT_STRATEGY = 0\n\n/* Possible values of the data_type field (though see inflate()) */\nexport var Z_BINARY = 0\nexport var Z_TEXT = 1\n//export var Z_ASCII = 1; // = Z_TEXT (deprecated)\nexport var Z_UNKNOWN = 2\n\n/* The deflate compression method */\nexport var Z_DEFLATED = 8\n//export var Z_NULL = null // Use -1 or null inline; depending on var type\n", "function _has(obj, key) {\n return Object.prototype.hasOwnProperty.call(obj, key)\n}\n\nexport function assign(obj /*from1, from2, from3, ...*/) {\n var sources = Array.prototype.slice.call(arguments, 1)\n while (sources.length) {\n var source = sources.shift()\n if (!source) {\n continue\n }\n\n if (typeof source !== 'object') {\n throw new TypeError(source + 'must be non-object')\n }\n\n for (var p in source) {\n if (_has(source, p)) {\n obj[p] = source[p]\n }\n }\n }\n\n return obj\n}\n\n// reduce buffer size, avoiding mem copy\nexport function shrinkBuf(buf, size) {\n if (buf.length === size) {\n return buf\n }\n if (buf.subarray) {\n return buf.subarray(0, size)\n }\n buf.length = size\n return buf\n}\n\nvar fnTyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n if (src.subarray && dest.subarray) {\n dest.set(src.subarray(src_offs, src_offs + len), dest_offs)\n return\n }\n // Fallback to ordinary array\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i]\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n var i, l, len, pos, chunk, result\n\n // calculate data length\n len = 0\n for (i = 0, l = chunks.length; i < l; i++) {\n len += chunks[i].length\n }\n\n // join chunks\n result = new Uint8Array(len)\n pos = 0\n for (i = 0, l = chunks.length; i < l; i++) {\n chunk = chunks[i]\n result.set(chunk, pos)\n pos += chunk.length\n }\n\n return result\n },\n Buf8: function (size) {\n return new Uint8Array(size)\n },\n Buf16: function (size) {\n return new Uint16Array(size)\n },\n Buf32: function (size) {\n return new Int32Array(size)\n },\n}\n\nvar fnUntyped = {\n arraySet: function (dest, src, src_offs, len, dest_offs) {\n for (var i = 0; i < len; i++) {\n dest[dest_offs + i] = src[src_offs + i]\n }\n },\n // Join array of chunks to single array.\n flattenChunks: function (chunks) {\n return [].concat.apply([], chunks)\n },\n Buf8: function (size) {\n return new Array(size)\n },\n Buf16: function (size) {\n return new Array(size)\n },\n Buf32: function (size) {\n return new Array(size)\n },\n}\n\nlet typedOK = () => {\n const supported =\n typeof Uint8Array !== 'undefined' &&\n typeof Uint16Array !== 'undefined' &&\n typeof Int32Array !== 'undefined'\n\n typedOK = () => supported\n return supported\n}\n\nexport let arraySet = (dest, src, src_offs, len, dest_offs) => {\n arraySet = typedOK() ? fnTyped.arraySet : fnUntyped.arraySet\n\n return arraySet(dest, src, src_offs, len, dest_offs)\n}\n\nexport let flattenChunks = chunks => {\n flattenChunks = typedOK() ? fnTyped.flattenChunks : fnUntyped.flattenChunks\n\n return flattenChunks(chunks)\n}\n\nexport let Buf8 = size => {\n Buf8 = typedOK() ? fnTyped.Buf8 : fnUntyped.Buf8\n return Buf8(size)\n}\n\nexport let Buf16 = size => {\n Buf16 = typedOK() ? fnTyped.Buf16 : fnUntyped.Buf16\n return Buf16(size)\n}\n\nexport let Buf32 = size => {\n Buf32 = typedOK() ? fnTyped.Buf32 : fnUntyped.Buf32\n return Buf32(size)\n}\n\nexport function setTyped(on) {\n arraySet = on ? fnTyped.arraySet : fnUntyped.arraySet\n flattenChunks = on ? fnTyped.flattenChunks : fnUntyped.flattenChunks\n Buf8 = on ? fnTyped.Buf8 : fnUntyped.Buf8\n Buf16 = on ? fnTyped.Buf16 : fnUntyped.Buf16\n Buf32 = on ? fnTyped.Buf32 : fnUntyped.Buf32\n}\n", "// String encode/decode helpers\n\nimport { Buf8, shrinkBuf } from './common.js'\n\n// Quick check if we can use fast array to bin string conversion\n//\n// - apply(Array) can fail on Android 2.2\n// - apply(Uint8Array) can fail on iOS 5.1 Safari\nlet strApplyOK = function () {\n let result = true\n try {\n String.fromCharCode.apply(null, [0])\n } catch (_) {\n result = false\n }\n\n strApplyOK = () => result\n return result\n}\n\nlet strApplyUintOK = function () {\n let result = true\n try {\n String.fromCharCode.apply(null, new Uint8Array(1))\n } catch (_) {\n result = false\n }\n\n strApplyUintOK = () => result\n return result\n}\n\nlet utf8len = function (c) {\n // Table with utf8 lengths (calculated by first byte of sequence)\n // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,\n // because max possible codepoint is 0x10ffff\n var table = Buf8(256)\n for (var q = 0; q < 256; q++) {\n table[q] =\n q >= 252\n ? 6\n : q >= 248\n ? 5\n : q >= 240\n ? 4\n : q >= 224\n ? 3\n : q >= 192\n ? 2\n : 1\n }\n table[254] = table[254] = 1 // Invalid sequence start\n\n utf8len = arg => table[arg]\n return table[c]\n}\n\n// convert string to array (typed, when possible)\nexport function string2buf(str) {\n var buf,\n c,\n c2,\n m_pos,\n i,\n str_len = str.length,\n buf_len = 0\n\n // count binary size\n for (m_pos = 0; m_pos < str_len; m_pos++) {\n c = str.charCodeAt(m_pos)\n if ((c & 0xfc00) === 0xd800 && m_pos + 1 < str_len) {\n c2 = str.charCodeAt(m_pos + 1)\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00)\n m_pos++\n }\n }\n buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4\n }\n\n // allocate buffer\n buf = new Uint8Array(buf_len)\n\n // convert\n for (i = 0, m_pos = 0; i < buf_len; m_pos++) {\n c = str.charCodeAt(m_pos)\n if ((c & 0xfc00) === 0xd800 && m_pos + 1 < str_len) {\n c2 = str.charCodeAt(m_pos + 1)\n if ((c2 & 0xfc00) === 0xdc00) {\n c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00)\n m_pos++\n }\n }\n if (c < 0x80) {\n /* one byte */\n buf[i++] = c\n } else if (c < 0x800) {\n /* two bytes */\n buf[i++] = 0xc0 | (c >>> 6)\n buf[i++] = 0x80 | (c & 0x3f)\n } else if (c < 0x10000) {\n /* three bytes */\n buf[i++] = 0xe0 | (c >>> 12)\n buf[i++] = 0x80 | ((c >>> 6) & 0x3f)\n buf[i++] = 0x80 | (c & 0x3f)\n } else {\n /* four bytes */\n buf[i++] = 0xf0 | (c >>> 18)\n buf[i++] = 0x80 | ((c >>> 12) & 0x3f)\n buf[i++] = 0x80 | ((c >>> 6) & 0x3f)\n buf[i++] = 0x80 | (c & 0x3f)\n }\n }\n\n return buf\n}\n\n// Helper (used in 2 places)\nfunction _buf2binstring(buf, len) {\n // On Chrome, the arguments in a function call that are allowed is `65534`.\n // If the length of the buffer is smaller than that, we can use this optimization,\n // otherwise we will take a slower path.\n if (len < 65534) {\n if ((buf.subarray && strApplyUintOK()) || (!buf.subarray && strApplyOK())) {\n return String.fromCharCode.apply(null, shrinkBuf(buf, len))\n }\n }\n\n var result = ''\n for (var i = 0; i < len; i++) {\n result += String.fromCharCode(buf[i])\n }\n return result\n}\n\n// Convert byte array to binary string\nexport function buf2binstring(buf) {\n return _buf2binstring(buf, buf.length)\n}\n\n// Convert binary string (typed, when possible)\nexport function binstring2buf(str) {\n var buf = new Uint8Array(str.length)\n for (var i = 0, len = buf.length; i < len; i++) {\n buf[i] = str.charCodeAt(i)\n }\n return buf\n}\n\n// convert array to string\nexport function buf2string(buf, max) {\n var i, out, c, c_len\n var len = max || buf.length\n\n // Reserve max possible length (2 words per char)\n // NB: by unknown reasons, Array is significantly faster for\n // String.fromCharCode.apply than Uint16Array.\n var utf16buf = new Array(len * 2)\n\n for (out = 0, i = 0; i < len; ) {\n c = buf[i++]\n // quick process ascii\n if (c < 0x80) {\n utf16buf[out++] = c\n continue\n }\n\n c_len = utf8len(c)\n // skip 5 & 6 byte codes\n if (c_len > 4) {\n utf16buf[out++] = 0xfffd\n i += c_len - 1\n continue\n }\n\n // apply mask on first byte\n c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07\n // join the rest\n while (c_len > 1 && i < len) {\n c = (c << 6) | (buf[i++] & 0x3f)\n c_len--\n }\n\n // terminated by end of string?\n if (c_len > 1) {\n utf16buf[out++] = 0xfffd\n continue\n }\n\n if (c < 0x10000) {\n utf16buf[out++] = c\n } else {\n c -= 0x10000\n utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff)\n utf16buf[out++] = 0xdc00 | (c & 0x3ff)\n }\n }\n\n return _buf2binstring(utf16buf, out)\n}\n\n// Calculate max possible position in utf8 buffer,\n// that will not break sequence. If that's not possible\n// - (very small limits) return max size as is.\n//\n// buf[] - utf8 bytes array\n// max - length limit (mandatory);\nexport function utf8border(buf, max) {\n var pos\n\n max = max || buf.length\n if (max > buf.length) {\n max = buf.length\n }\n\n // go back from last position, until start of sequence found\n pos = max - 1\n while (pos >= 0 && (buf[pos] & 0xc0) === 0x80) {\n pos--\n }\n\n // Very small and broken sequence,\n // return max, because we should return something anyway.\n if (pos < 0) {\n return max\n }\n\n // If we came to start of buffer - that means buffer is too small,\n // return max too.\n if (pos === 0) {\n return max\n }\n\n return pos + utf8len(buf[pos]) > max ? pos : max\n}\n", "// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nexport default function GZheader() {\n /* true if compressed data believed to be text */\n this.text = 0\n /* modification time */\n this.time = 0\n /* extra flags (not used when writing a gzip file) */\n this.xflags = 0\n /* operating system */\n this.os = 0\n /* pointer to extra field or Z_NULL if none */\n this.extra = null\n /* extra field length (valid if extra != Z_NULL) */\n this.extra_len = 0 // Actually, we don't need it in JS,\n // but leave for few code modifications\n\n //\n // Setup limits is not necessary because in js we should not preallocate memory\n // for inflate use constant limit in 65536 bytes\n //\n\n /* space at extra (only when reading header) */\n // this.extra_max = 0;\n /* pointer to zero-terminated file name or Z_NULL */\n this.name = ''\n /* space at name (only when reading header) */\n // this.name_max = 0;\n /* pointer to zero-terminated comment or Z_NULL */\n this.comment = ''\n /* space at comment (only when reading header) */\n // this.comm_max = 0;\n /* true if there was or will be a header crc */\n this.hcrc = 0\n /* true when done reading gzip header (not used when writing a gzip file) */\n this.done = false\n}\n", "// Note: adler32 takes 12% for level 0 and 2% for level 6.\n// It isn't worth it to make additional optimizations as in original.\n// Small size is preferable.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nexport default function adler32(adler, buf, len, pos) {\n var s1 = (adler & 0xffff) | 0,\n s2 = ((adler >>> 16) & 0xffff) | 0,\n n = 0\n\n while (len !== 0) {\n // Set limit ~ twice less than 5552, to keep\n // s2 in 31-bits, because we force signed ints.\n // in other case %= will fail.\n n = len > 2000 ? 2000 : len\n len -= n\n\n do {\n s1 = (s1 + buf[pos++]) | 0\n s2 = (s2 + s1) | 0\n } while (--n)\n\n s1 %= 65521\n s2 %= 65521\n }\n\n return s1 | (s2 << 16) | 0\n}\n", "// Note: we can't get significant speed boost here.\n// So write code to minimize size - no pregenerated tables\n// and array tools dependencies.\n\n// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// Use ordinary array, since untyped makes no boost here\nfunction makeTable() {\n var c,\n table = []\n\n for (var n = 0; n < 256; n++) {\n c = n\n for (var k = 0; k < 8; k++) {\n c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1\n }\n table[n] = c\n }\n\n return table\n}\n\nlet crcTable = function () {\n const table = makeTable()\n crcTable = () => table\n return table\n}\n\nexport default function crc32(crc, buf, len, pos) {\n var t = crcTable(),\n end = pos + len\n\n crc ^= -1\n\n for (var i = pos; i < end; i++) {\n crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xff]\n }\n\n return crc ^ -1 // >>> 0;\n}\n", "// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\n// See state defs from inflate.js\nvar BAD = 30 /* got a data error -- remain here until reset */\nvar TYPE = 12 /* i: waiting for type bits, including last-flag bit */\n\n/*\n Decode literal, length, and distance codes and write out the resulting\n literal and match bytes until either not enough input or output is\n available, an end-of-block is encountered, or a data error is encountered.\n When large enough input and output buffers are supplied to inflate(), for\n example, a 16K input buffer and a 64K output buffer, more than 95% of the\n inflate execution time is spent in this routine.\n\n Entry assumptions:\n\n state.mode === LEN\n strm.avail_in >= 6\n strm.avail_out >= 258\n start >= strm.avail_out\n state.bits < 8\n\n On return, state.mode is one of:\n\n LEN -- ran out of enough output space or enough available input\n TYPE -- reached end of block code, inflate() to interpret next block\n BAD -- error in block data\n\n Notes:\n\n - The maximum input bits used by a length/distance pair is 15 bits for the\n length code, 5 bits for the length extra, 15 bits for the distance code,\n and 13 bits for the distance extra. This totals 48 bits, or six bytes.\n Therefore if strm.avail_in >= 6, then there is enough input to avoid\n checking for available input while decoding.\n\n - The maximum bytes that a single length/distance pair can output is 258\n bytes, which is the maximum length that can be coded. inflate_fast()\n requires strm.avail_out >= 258 for each loop to avoid checking for\n output space.\n */\nexport default function inflate_fast(strm, start) {\n var state\n var _in /* local strm.input */\n var last /* have enough input while in < last */\n var _out /* local strm.output */\n var beg /* inflate()'s initial strm.output */\n var end /* while out < end, enough space available */\n //#ifdef INFLATE_STRICT\n var dmax /* maximum distance from zlib header */\n //#endif\n var wsize /* window size or zero if not using window */\n var whave /* valid bytes in the window */\n var wnext /* window write index */\n // Use `s_window` instead `window`, avoid conflict with instrumentation tools\n var s_window /* allocated sliding window, if wsize != 0 */\n var hold /* local strm.hold */\n var bits /* local strm.bits */\n var lcode /* local strm.lencode */\n var dcode /* local strm.distcode */\n var lmask /* mask for first level of length codes */\n var dmask /* mask for first level of distance codes */\n var here /* retrieved table entry */\n var op /* code bits, operation, extra bits, or */\n /* window position, window bytes to copy */\n var len /* match length, unused bytes */\n var dist /* match distance */\n var from /* where to copy match from */\n var from_source\n\n var input, output // JS specific, because we have no pointers\n\n /* copy state to local variables */\n state = strm.state\n //here = state.here;\n _in = strm.next_in\n input = strm.input\n last = _in + (strm.avail_in - 5)\n _out = strm.next_out\n output = strm.output\n beg = _out - (start - strm.avail_out)\n end = _out + (strm.avail_out - 257)\n //#ifdef INFLATE_STRICT\n dmax = state.dmax\n //#endif\n wsize = state.wsize\n whave = state.whave\n wnext = state.wnext\n s_window = state.window\n hold = state.hold\n bits = state.bits\n lcode = state.lencode\n dcode = state.distcode\n lmask = (1 << state.lenbits) - 1\n dmask = (1 << state.distbits) - 1\n\n /* decode literals and length/distances until end-of-block or not enough\n input data or output space */\n\n top: do {\n if (bits < 15) {\n hold += input[_in++] << bits\n bits += 8\n hold += input[_in++] << bits\n bits += 8\n }\n\n here = lcode[hold & lmask]\n\n dolen: for (;;) {\n // Goto emulation\n op = here >>> 24 /*here.bits*/\n hold >>>= op\n bits -= op\n op = (here >>> 16) & 0xff /*here.op*/\n if (op === 0) {\n /* literal */\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n output[_out++] = here & 0xffff /*here.val*/\n } else if (op & 16) {\n /* length base */\n len = here & 0xffff /*here.val*/\n op &= 15 /* number of extra bits */\n if (op) {\n if (bits < op) {\n hold += input[_in++] << bits\n bits += 8\n }\n len += hold & ((1 << op) - 1)\n hold >>>= op\n bits -= op\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", len));\n if (bits < 15) {\n hold += input[_in++] << bits\n bits += 8\n hold += input[_in++] << bits\n bits += 8\n }\n here = dcode[hold & dmask]\n\n dodist: for (;;) {\n // goto emulation\n op = here >>> 24 /*here.bits*/\n hold >>>= op\n bits -= op\n op = (here >>> 16) & 0xff /*here.op*/\n\n if (op & 16) {\n /* distance base */\n dist = here & 0xffff /*here.val*/\n op &= 15 /* number of extra bits */\n if (bits < op) {\n hold += input[_in++] << bits\n bits += 8\n if (bits < op) {\n hold += input[_in++] << bits\n bits += 8\n }\n }\n dist += hold & ((1 << op) - 1)\n //#ifdef INFLATE_STRICT\n if (dist > dmax) {\n strm.msg = 'invalid distance too far back'\n state.mode = BAD\n break top\n }\n //#endif\n hold >>>= op\n bits -= op\n //Tracevv((stderr, \"inflate: distance %u\\n\", dist));\n op = _out - beg /* max distance in output */\n if (dist > op) {\n /* see if copy from window */\n op = dist - op /* distance back in window */\n if (op > whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back'\n state.mode = BAD\n break top\n }\n\n // (!) This block is disabled in zlib defaults,\n // don't enable it for binary compatibility\n //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n // if (len <= op - whave) {\n // do {\n // output[_out++] = 0;\n // } while (--len);\n // continue top;\n // }\n // len -= op - whave;\n // do {\n // output[_out++] = 0;\n // } while (--op > whave);\n // if (op === 0) {\n // from = _out - dist;\n // do {\n // output[_out++] = output[from++];\n // } while (--len);\n // continue top;\n // }\n //#endif\n }\n from = 0 // window index\n from_source = s_window\n if (wnext === 0) {\n /* very common case */\n from += wsize - op\n if (op < len) {\n /* some from window */\n len -= op\n do {\n output[_out++] = s_window[from++]\n } while (--op)\n from = _out - dist /* rest from output */\n from_source = output\n }\n } else if (wnext < op) {\n /* wrap around window */\n from += wsize + wnext - op\n op -= wnext\n if (op < len) {\n /* some from end of window */\n len -= op\n do {\n output[_out++] = s_window[from++]\n } while (--op)\n from = 0\n if (wnext < len) {\n /* some from start of window */\n op = wnext\n len -= op\n do {\n output[_out++] = s_window[from++]\n } while (--op)\n from = _out - dist /* rest from output */\n from_source = output\n }\n }\n } else {\n /* contiguous in window */\n from += wnext - op\n if (op < len) {\n /* some from window */\n len -= op\n do {\n output[_out++] = s_window[from++]\n } while (--op)\n from = _out - dist /* rest from output */\n from_source = output\n }\n }\n while (len > 2) {\n output[_out++] = from_source[from++]\n output[_out++] = from_source[from++]\n output[_out++] = from_source[from++]\n len -= 3\n }\n if (len) {\n output[_out++] = from_source[from++]\n if (len > 1) {\n output[_out++] = from_source[from++]\n }\n }\n } else {\n from = _out - dist /* copy direct from output */\n do {\n /* minimum length is three */\n output[_out++] = output[from++]\n output[_out++] = output[from++]\n output[_out++] = output[from++]\n len -= 3\n } while (len > 2)\n if (len) {\n output[_out++] = output[from++]\n if (len > 1) {\n output[_out++] = output[from++]\n }\n }\n }\n } else if ((op & 64) === 0) {\n /* 2nd level distance code */\n here =\n dcode[(here & 0xffff) /*here.val*/ + (hold & ((1 << op) - 1))]\n continue dodist\n } else {\n strm.msg = 'invalid distance code'\n state.mode = BAD\n break top\n }\n\n break // need to emulate goto via \"continue\"\n }\n } else if ((op & 64) === 0) {\n /* 2nd level length code */\n here = lcode[(here & 0xffff) /*here.val*/ + (hold & ((1 << op) - 1))]\n continue dolen\n } else if (op & 32) {\n /* end-of-block */\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.mode = TYPE\n break top\n } else {\n strm.msg = 'invalid literal/length code'\n state.mode = BAD\n break top\n }\n\n break // need to emulate goto via \"continue\"\n }\n } while (_in < last && _out < end)\n\n /* return unused bytes (on entry, bits < 8, so in won't go too far back) */\n len = bits >> 3\n _in -= len\n bits -= len << 3\n hold &= (1 << bits) - 1\n\n /* update state and return */\n strm.next_in = _in\n strm.next_out = _out\n strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last)\n strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end)\n state.hold = hold\n state.bits = bits\n return\n}\n", "// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nimport { Buf16 } from '../utils/common.js'\n\nvar MAXBITS = 15\nvar ENOUGH_LENS = 852\nvar ENOUGH_DISTS = 592\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar CODES = 0\nvar LENS = 1\nvar DISTS = 2\n\nvar lbase = [\n /* Length codes 257..285 base */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19,\n 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0,\n]\n\nvar lext = [\n /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17,\n 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72,\n 78,\n]\n\nvar dbase = [\n /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65,\n 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193,\n 12289, 16385, 24577, 0, 0,\n]\n\nvar dext = [\n /* Distance codes 0..29 extra */ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20,\n 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29,\n 64, 64,\n]\n\nexport default function inflate_table(\n type,\n lens,\n lens_index,\n codes,\n table,\n table_index,\n work,\n opts,\n) {\n var bits = opts.bits\n //here = opts.here; /* table entry for duplication */\n\n var len = 0 /* a code's length in bits */\n var sym = 0 /* index of code symbols */\n var min = 0,\n max = 0 /* minimum and maximum code lengths */\n var root = 0 /* number of index bits for root table */\n var curr = 0 /* number of index bits for current table */\n var drop = 0 /* code bits to drop for sub-table */\n var left = 0 /* number of prefix codes available */\n var used = 0 /* code entries in table used */\n var huff = 0 /* Huffman code */\n var incr /* for incrementing code, index */\n var fill /* index for replicating entries */\n var low /* low bits for current root entry */\n var mask /* mask for low root bits */\n var next /* next available space in table */\n var base = null /* base value table to use */\n var base_index = 0\n // var shoextra; /* extra bits table to use */\n var end /* use base and extra for symbol > end */\n var count = Buf16(MAXBITS + 1) //[MAXBITS+1]; /* number of codes of each length */\n var offs = Buf16(MAXBITS + 1) //[MAXBITS+1]; /* offsets in table for each length */\n var extra = null\n var extra_index = 0\n\n var here_bits, here_op, here_val\n\n /*\n Process a set of code lengths to create a canonical Huffman code. The\n code lengths are lens[0..codes-1]. Each length corresponds to the\n symbols 0..codes-1. The Huffman code is generated by first sorting the\n symbols by length from short to long, and retaining the symbol order\n for codes with equal lengths. Then the code starts with all zero bits\n for the first code of the shortest length, and the codes are integer\n increments for the same length, and zeros are appended as the length\n increases. For the deflate format, these bits are stored backwards\n from their more natural integer increment ordering, and so when the\n decoding tables are built in the large loop below, the integer codes\n are incremented backwards.\n\n This routine assumes, but does not check, that all of the entries in\n lens[] are in the range 0..MAXBITS. The caller must assure this.\n 1..MAXBITS is interpreted as that code length. zero means that that\n symbol does not occur in this code.\n\n The codes are sorted by computing a count of codes for each length,\n creating from that a table of starting indices for each length in the\n sorted table, and then entering the symbols in order in the sorted\n table. The sorted table is work[], with that space being provided by\n the caller.\n\n The length counts are used for other purposes as well, i.e. finding\n the minimum and maximum length codes, determining if there are any\n codes at all, checking for a valid set of lengths, and looking ahead\n at length counts to determine sub-table sizes when building the\n decoding tables.\n */\n\n /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */\n for (len = 0; len <= MAXBITS; len++) {\n count[len] = 0\n }\n for (sym = 0; sym < codes; sym++) {\n count[lens[lens_index + sym]]++\n }\n\n /* bound code lengths, force root to be within code lengths */\n root = bits\n for (max = MAXBITS; max >= 1; max--) {\n if (count[max] !== 0) {\n break\n }\n }\n if (root > max) {\n root = max\n }\n if (max === 0) {\n /* no symbols to code at all */\n //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */\n //table.bits[opts.table_index] = 1; //here.bits = (var char)1;\n //table.val[opts.table_index++] = 0; //here.val = (var short)0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0\n\n //table.op[opts.table_index] = 64;\n //table.bits[opts.table_index] = 1;\n //table.val[opts.table_index++] = 0;\n table[table_index++] = (1 << 24) | (64 << 16) | 0\n\n opts.bits = 1\n return 0 /* no symbols, but wait for decoding to report error */\n }\n for (min = 1; min < max; min++) {\n if (count[min] !== 0) {\n break\n }\n }\n if (root < min) {\n root = min\n }\n\n /* check for an over-subscribed or incomplete set of lengths */\n left = 1\n for (len = 1; len <= MAXBITS; len++) {\n left <<= 1\n left -= count[len]\n if (left < 0) {\n return -1\n } /* over-subscribed */\n }\n if (left > 0 && (type === CODES || max !== 1)) {\n return -1 /* incomplete set */\n }\n\n /* generate offsets into symbol table for each length for sorting */\n offs[1] = 0\n for (len = 1; len < MAXBITS; len++) {\n offs[len + 1] = offs[len] + count[len]\n }\n\n /* sort symbols by length, by symbol order within each length */\n for (sym = 0; sym < codes; sym++) {\n if (lens[lens_index + sym] !== 0) {\n work[offs[lens[lens_index + sym]]++] = sym\n }\n }\n\n /*\n Create and fill in decoding tables. In this loop, the table being\n filled is at next and has curr index bits. The code being used is huff\n with length len. That code is converted to an index by dropping drop\n bits off of the bottom. For codes where len is less than drop + curr,\n those top drop + curr - len bits are incremented through all values to\n fill the table with replicated entries.\n\n root is the number of index bits for the root table. When len exceeds\n root, sub-tables are created pointed to by the root entry with an index\n of the low root bits of huff. This is saved in low to check for when a\n new sub-table should be started. drop is zero when the root table is\n being filled, and drop is root when sub-tables are being filled.\n\n When a new sub-table is needed, it is necessary to look ahead in the\n code lengths to determine what size sub-table is needed. The length\n counts are used for this, and so count[] is decremented as codes are\n entered in the tables.\n\n used keeps track of how many table entries have been allocated from the\n provided *table space. It is checked for LENS and DIST tables against\n the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in\n the initial root table size constants. See the comments in inftrees.h\n for more information.\n\n sym increments through all symbols, and the loop terminates when\n all codes of length max, i.e. all codes, have been processed. This\n routine permits incomplete codes, so another loop after this one fills\n in the rest of the decoding tables with invalid code markers.\n */\n\n /* set up for code type */\n // poor man optimization - use if-else instead of switch,\n // to avoid deopts in old v8\n if (type === CODES) {\n base = extra = work /* dummy value--not used */\n end = 19\n } else if (type === LENS) {\n base = lbase\n base_index -= 257\n extra = lext\n extra_index -= 257\n end = 256\n } else {\n /* DISTS */\n base = dbase\n extra = dext\n end = -1\n }\n\n /* initialize opts for loop */\n huff = 0 /* starting code */\n sym = 0 /* starting code symbol */\n len = min /* starting code length */\n next = table_index /* current table to fill in */\n curr = root /* current table index bits */\n drop = 0 /* current bits to drop from code for index */\n low = -1 /* trigger new sub-table when len > root */\n used = 1 << root /* use root table entries */\n mask = used - 1 /* mask for comparing low */\n\n /* check available table space */\n if (\n (type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)\n ) {\n return 1\n }\n\n /* process all codes and make table entries */\n for (;;) {\n /* create table entry */\n here_bits = len - drop\n if (work[sym] < end) {\n here_op = 0\n here_val = work[sym]\n } else if (work[sym] > end) {\n here_op = extra[extra_index + work[sym]]\n here_val = base[base_index + work[sym]]\n } else {\n here_op = 32 + 64 /* end of block */\n here_val = 0\n }\n\n /* replicate for those indices with low len bits equal to huff */\n incr = 1 << (len - drop)\n fill = 1 << curr\n min = fill /* save offset to next table */\n do {\n fill -= incr\n table[next + (huff >> drop) + fill] =\n (here_bits << 24) | (here_op << 16) | here_val | 0\n } while (fill !== 0)\n\n /* backwards increment the len-bit code huff */\n incr = 1 << (len - 1)\n while (huff & incr) {\n incr >>= 1\n }\n if (incr !== 0) {\n huff &= incr - 1\n huff += incr\n } else {\n huff = 0\n }\n\n /* go to next symbol, update count, len */\n sym++\n if (--count[len] === 0) {\n if (len === max) {\n break\n }\n len = lens[lens_index + work[sym]]\n }\n\n /* create new sub-table if needed */\n if (len > root && (huff & mask) !== low) {\n /* if first time, transition to sub-tables */\n if (drop === 0) {\n drop = root\n }\n\n /* increment past last table */\n next += min /* here min is 1 << curr */\n\n /* determine length of next table */\n curr = len - drop\n left = 1 << curr\n while (curr + drop < max) {\n left -= count[curr + drop]\n if (left <= 0) {\n break\n }\n curr++\n left <<= 1\n }\n\n /* check for enough space */\n used += 1 << curr\n if (\n (type === LENS && used > ENOUGH_LENS) ||\n (type === DISTS && used > ENOUGH_DISTS)\n ) {\n return 1\n }\n\n /* point entry in root table to sub-table */\n low = huff & mask\n /*table.op[low] = curr;\n table.bits[low] = root;\n table.val[low] = next - opts.table_index;*/\n table[low] = (root << 24) | (curr << 16) | (next - table_index) | 0\n }\n }\n\n /* fill in remaining table entry if code is incomplete (guaranteed to have\n at most one remaining entry, since if the code is incomplete, the\n maximum code length that was allowed to get this far is one bit) */\n if (huff !== 0) {\n //table.op[next + huff] = 64; /* invalid code marker */\n //table.bits[next + huff] = len - drop;\n //table.val[next + huff] = 0;\n table[next + huff] = ((len - drop) << 24) | (64 << 16) | 0\n }\n\n /* set return parameters */\n //opts.table_index += used;\n opts.bits = root\n return 0\n}\n", "// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nimport adler32 from './adler32.js'\nimport crc32 from './crc32.js'\nimport inflate_fast from './inffast.js'\nimport inflate_table from './inftrees.js'\nimport { Buf16, Buf32, Buf8, arraySet } from '../utils/common.js'\n\nvar CODES = 0\nvar LENS = 1\nvar DISTS = 2\n\n/* Public constants ==========================================================*/\n/* ===========================================================================*/\n\n/* Allowed flush values; see deflate() and inflate() below for details */\n//var Z_NO_FLUSH = 0;\n//var Z_PARTIAL_FLUSH = 1;\n//var Z_SYNC_FLUSH = 2;\n//var Z_FULL_FLUSH = 3;\nvar Z_FINISH = 4\nvar Z_BLOCK = 5\nvar Z_TREES = 6\n\n/* Return codes for the compression/decompression functions. Negative values\n * are errors, positive values are used for special but normal events.\n */\nvar Z_OK = 0\nvar Z_STREAM_END = 1\nvar Z_NEED_DICT = 2\n//var Z_ERRNO = -1;\nvar Z_STREAM_ERROR = -2\nvar Z_DATA_ERROR = -3\nvar Z_MEM_ERROR = -4\nvar Z_BUF_ERROR = -5\n//var Z_VERSION_ERROR = -6;\n\n/* The deflate compression method */\nvar Z_DEFLATED = 8\n\n/* STATES ====================================================================*/\n/* ===========================================================================*/\n\nvar HEAD = 1 /* i: waiting for magic header */\nvar FLAGS = 2 /* i: waiting for method and flags (gzip) */\nvar TIME = 3 /* i: waiting for modification time (gzip) */\nvar OS = 4 /* i: waiting for extra flags and operating system (gzip) */\nvar EXLEN = 5 /* i: waiting for extra length (gzip) */\nvar EXTRA = 6 /* i: waiting for extra bytes (gzip) */\nvar NAME = 7 /* i: waiting for end of file name (gzip) */\nvar COMMENT = 8 /* i: waiting for end of comment (gzip) */\nvar HCRC = 9 /* i: waiting for header crc (gzip) */\nvar DICTID = 10 /* i: waiting for dictionary check value */\nvar DICT = 11 /* waiting for inflateSetDictionary() call */\nvar TYPE = 12 /* i: waiting for type bits, including last-flag bit */\nvar TYPEDO = 13 /* i: same, but skip check to exit inflate on new block */\nvar STORED = 14 /* i: waiting for stored size (length and complement) */\nvar COPY_ = 15 /* i/o: same as COPY below, but only first time in */\nvar COPY = 16 /* i/o: waiting for input or output to copy stored block */\nvar TABLE = 17 /* i: waiting for dynamic block table lengths */\nvar LENLENS = 18 /* i: waiting for code length code lengths */\nvar CODELENS = 19 /* i: waiting for length/lit and distance code lengths */\nvar LEN_ = 20 /* i: same as LEN below, but only first time in */\nvar LEN = 21 /* i: waiting for length/lit/eob code */\nvar LENEXT = 22 /* i: waiting for length extra bits */\nvar DIST = 23 /* i: waiting for distance code */\nvar DISTEXT = 24 /* i: waiting for distance extra bits */\nvar MATCH = 25 /* o: waiting for output space to copy string */\nvar LIT = 26 /* o: waiting for output space to write literal */\nvar CHECK = 27 /* i: waiting for 32-bit check value */\nvar LENGTH = 28 /* i: waiting for 32-bit length (gzip) */\nvar DONE = 29 /* finished check, done -- remain here until reset */\nvar BAD = 30 /* got a data error -- remain here until reset */\nvar MEM = 31 /* got an inflate() memory error -- remain here until reset */\nvar SYNC = 32 /* looking for synchronization bytes to restart inflate() */\n\n/* ===========================================================================*/\n\nvar ENOUGH_LENS = 852\nvar ENOUGH_DISTS = 592\n//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS);\n\nvar MAX_WBITS = 15\n/* 32K LZ77 window */\nvar DEF_WBITS = MAX_WBITS\n\nfunction zswap32(q) {\n return (\n ((q >>> 24) & 0xff) +\n ((q >>> 8) & 0xff00) +\n ((q & 0xff00) << 8) +\n ((q & 0xff) << 24)\n )\n}\n\nfunction InflateState() {\n this.mode = 0 /* current inflate mode */\n this.last = false /* true if processing last block */\n this.wrap = 0 /* bit 0 true for zlib, bit 1 true for gzip */\n this.havedict = false /* true if dictionary provided */\n this.flags = 0 /* gzip header method and flags (0 if zlib) */\n this.dmax = 0 /* zlib header max distance (INFLATE_STRICT) */\n this.check = 0 /* protected copy of check value */\n this.total = 0 /* protected copy of output count */\n // TODO: may be {}\n this.head = null /* where to save gzip header information */\n\n /* sliding window */\n this.wbits = 0 /* log base 2 of requested window size */\n this.wsize = 0 /* window size or zero if not using window */\n this.whave = 0 /* valid bytes in the window */\n this.wnext = 0 /* window write index */\n this.window = null /* allocated sliding window, if needed */\n\n /* bit accumulator */\n this.hold = 0 /* input bit accumulator */\n this.bits = 0 /* number of bits in \"in\" */\n\n /* for string and stored block copying */\n this.length = 0 /* literal or length of data to copy */\n this.offset = 0 /* distance back to copy string from */\n\n /* for table and code decoding */\n this.extra = 0 /* extra bits needed */\n\n /* fixed and dynamic code tables */\n this.lencode = null /* starting table for length/literal codes */\n this.distcode = null /* starting table for distance codes */\n this.lenbits = 0 /* index bits for lencode */\n this.distbits = 0 /* index bits for distcode */\n\n /* dynamic table building */\n this.ncode = 0 /* number of code length code lengths */\n this.nlen = 0 /* number of length code lengths */\n this.ndist = 0 /* number of distance code lengths */\n this.have = 0 /* number of code lengths in lens[] */\n this.next = null /* next available space in codes[] */\n\n this.lens = Buf16(320) /* temporary storage for code lengths */\n this.work = Buf16(288) /* work area for code table building */\n\n /*\n because we don't have pointers in js, we use lencode and distcode directly\n as buffers so we don't need codes\n */\n //this.codes = Buf32(ENOUGH); /* space for code tables */\n this.lendyn = null /* dynamic table for length/literal codes (JS specific) */\n this.distdyn = null /* dynamic table for distance codes (JS specific) */\n this.sane = 0 /* if false, allow invalid distance too far */\n this.back = 0 /* bits back of last unprocessed length/lit */\n this.was = 0 /* initial length of match */\n}\n\nexport function inflateResetKeep(strm) {\n var state\n\n if (!strm || !strm.state) {\n return Z_STREAM_ERROR\n }\n state = strm.state\n strm.total_in = strm.total_out = state.total = 0\n strm.msg = '' /*Z_NULL*/\n if (state.wrap) {\n /* to support ill-conceived Java test suite */\n strm.adler = state.wrap & 1\n }\n state.mode = HEAD\n state.last = 0\n state.havedict = 0\n state.dmax = 32768\n state.head = null /*Z_NULL*/\n state.hold = 0\n state.bits = 0\n //state.lencode = state.distcode = state.next = state.codes;\n state.lencode = state.lendyn = Buf32(ENOUGH_LENS)\n state.distcode = state.distdyn = Buf32(ENOUGH_DISTS)\n\n state.sane = 1\n state.back = -1\n //Tracev((stderr, \"inflate: reset\\n\"));\n return Z_OK\n}\n\nexport function inflateReset(strm) {\n var state\n\n if (!strm || !strm.state) {\n return Z_STREAM_ERROR\n }\n state = strm.state\n state.wsize = 0\n state.whave = 0\n state.wnext = 0\n return inflateResetKeep(strm)\n}\n\nexport function inflateReset2(strm, windowBits) {\n var wrap\n var state\n\n /* get the state */\n if (!strm || !strm.state) {\n return Z_STREAM_ERROR\n }\n state = strm.state\n\n /* extract wrap request from windowBits parameter */\n if (windowBits < 0) {\n wrap = 0\n windowBits = -windowBits\n } else {\n wrap = (windowBits >> 4) + 1\n if (windowBits < 48) {\n windowBits &= 15\n }\n }\n\n /* set number of window bits, free window if different */\n if (windowBits && (windowBits < 8 || windowBits > 15)) {\n return Z_STREAM_ERROR\n }\n if (state.window !== null && state.wbits !== windowBits) {\n state.window = null\n }\n\n /* update state and reset the rest of it */\n state.wrap = wrap\n state.wbits = windowBits\n return inflateReset(strm)\n}\n\nexport function inflateInit2(strm, windowBits) {\n var ret\n var state\n\n if (!strm) {\n return Z_STREAM_ERROR\n }\n //strm.msg = Z_NULL; /* in case we return an error */\n\n state = new InflateState()\n\n //if (state === Z_NULL) return Z_MEM_ERROR;\n //Tracev((stderr, \"inflate: allocated\\n\"));\n strm.state = state\n state.window = null /*Z_NULL*/\n ret = inflateReset2(strm, windowBits)\n if (ret !== Z_OK) {\n strm.state = null /*Z_NULL*/\n }\n return ret\n}\n\nexport function inflateInit(strm) {\n return inflateInit2(strm, DEF_WBITS)\n}\n\n/*\n Return state with length and distance decoding tables and index sizes set to\n fixed code decoding. Normally this returns fixed tables from inffixed.h.\n If BUILDFIXED is defined, then instead this routine builds the tables the\n first time it's called, and returns those tables the first time and\n thereafter. This reduces the size of the code by about 2K bytes, in\n exchange for a little execution time. However, BUILDFIXED should not be\n used for threaded applications, since the rewriting of the tables and virgin\n may not be thread-safe.\n */\nvar virgin = true\n\nvar lenfix, distfix // We have no pointers in JS, so keep tables separate\n\nfunction fixedtables(state) {\n /* build fixed huffman tables if first call (may not be thread safe) */\n if (virgin) {\n var sym\n\n lenfix = Buf32(512)\n distfix = Buf32(32)\n\n /* literal/length table */\n sym = 0\n while (sym < 144) {\n state.lens[sym++] = 8\n }\n while (sym < 256) {\n state.lens[sym++] = 9\n }\n while (sym < 280) {\n state.lens[sym++] = 7\n }\n while (sym < 288) {\n state.lens[sym++] = 8\n }\n\n inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 })\n\n /* distance table */\n sym = 0\n while (sym < 32) {\n state.lens[sym++] = 5\n }\n\n inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, {\n bits: 5,\n })\n\n /* do this just once */\n virgin = false\n }\n\n state.lencode = lenfix\n state.lenbits = 9\n state.distcode = distfix\n state.distbits = 5\n}\n\n/*\n Update the window with the last wsize (normally 32K) bytes written before\n returning. If window does not exist yet, create it. This is only called\n when a window is already in use, or when output has been written during this\n inflate call, but the end of the deflate stream has not been reached yet.\n It is also called to create a window for dictionary data when a dictionary\n is loaded.\n\n Providing output buffers larger than 32K to inflate() should provide a speed\n advantage, since only the last 32K of output is copied to the sliding window\n upon return from inflate(), and since all distances after the first 32K of\n output will fall in the output data, making match copies simpler and faster.\n The advantage may be dependent on the size of the processor's data caches.\n */\nfunction updatewindow(strm, src, end, copy) {\n var dist\n var state = strm.state\n\n /* if it hasn't been done already, allocate space for the window */\n if (state.window === null) {\n state.wsize = 1 << state.wbits\n state.wnext = 0\n state.whave = 0\n\n state.window = Buf8(state.wsize)\n }\n\n /* copy state->wsize or less output bytes into the circular window */\n if (copy >= state.wsize) {\n arraySet(state.window, src, end - state.wsize, state.wsize, 0)\n state.wnext = 0\n state.whave = state.wsize\n } else {\n dist = state.wsize - state.wnext\n if (dist > copy) {\n dist = copy\n }\n //zmemcpy(state->window + state->wnext, end - copy, dist);\n arraySet(state.window, src, end - copy, dist, state.wnext)\n copy -= dist\n if (copy) {\n //zmemcpy(state->window, end - copy, copy);\n arraySet(state.window, src, end - copy, copy, 0)\n state.wnext = copy\n state.whave = state.wsize\n } else {\n state.wnext += dist\n if (state.wnext === state.wsize) {\n state.wnext = 0\n }\n if (state.whave < state.wsize) {\n state.whave += dist\n }\n }\n }\n return 0\n}\n\nexport function inflate(strm, flush) {\n var state\n var input, output // input/output buffers\n var next /* next input INDEX */\n var put /* next output INDEX */\n var have, left /* available input and output */\n var hold /* bit buffer */\n var bits /* bits in bit buffer */\n var _in, _out /* save starting available input and output */\n var copy /* number of stored or match bytes to copy */\n var from /* where to copy match bytes from */\n var from_source\n var here = 0 /* current decoding table entry */\n var here_bits, here_op, here_val // paked \"here\" denormalized (JS specific)\n //var last; /* parent table entry */\n var last_bits, last_op, last_val // paked \"last\" denormalized (JS specific)\n var len /* length to copy for repeats, bits to drop */\n var ret /* return code */\n var hbuf = Buf8(4) /* buffer for gzip header crc calculation */\n var opts\n\n var n // temporary var for NEED_BITS\n\n var order =\n /* permutation of code lengths */\n [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]\n\n if (\n !strm ||\n !strm.state ||\n !strm.output ||\n (!strm.input && strm.avail_in !== 0)\n ) {\n return Z_STREAM_ERROR\n }\n\n state = strm.state\n if (state.mode === TYPE) {\n state.mode = TYPEDO\n } /* skip check */\n\n //--- LOAD() ---\n put = strm.next_out\n output = strm.output\n left = strm.avail_out\n next = strm.next_in\n input = strm.input\n have = strm.avail_in\n hold = state.hold\n bits = state.bits\n //---\n\n _in = have\n _out = left\n ret = Z_OK\n\n // goto emulation\n inf_leave: for (;;) {\n switch (state.mode) {\n case HEAD:\n if (state.wrap === 0) {\n state.mode = TYPEDO\n break\n }\n //=== NEEDBITS(16);\n while (bits < 16) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n if (state.wrap & 2 && hold === 0x8b1f) {\n /* gzip header */\n state.check = 0 /*crc32(0L, Z_NULL, 0)*/\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff\n hbuf[1] = (hold >>> 8) & 0xff\n state.check = crc32(state.check, hbuf, 2, 0)\n //===//\n\n //=== INITBITS();\n hold = 0\n bits = 0\n //===//\n state.mode = FLAGS\n break\n }\n state.flags = 0 /* expect zlib header */\n if (state.head) {\n state.head.done = false\n }\n if (\n !(state.wrap & 1) /* check if zlib header allowed */ ||\n (((hold & 0xff) /*BITS(8)*/ << 8) + (hold >> 8)) % 31\n ) {\n strm.msg = 'incorrect header check'\n state.mode = BAD\n break\n }\n if ((hold & 0x0f) /*BITS(4)*/ !== Z_DEFLATED) {\n strm.msg = 'unknown compression method'\n state.mode = BAD\n break\n }\n //--- DROPBITS(4) ---//\n hold >>>= 4\n bits -= 4\n //---//\n len = (hold & 0x0f) /*BITS(4)*/ + 8\n if (state.wbits === 0) {\n state.wbits = len\n } else if (len > state.wbits) {\n strm.msg = 'invalid window size'\n state.mode = BAD\n break\n }\n state.dmax = 1 << len\n //Tracev((stderr, \"inflate: zlib header ok\\n\"));\n strm.adler = state.check = 1 /*adler32(0L, Z_NULL, 0)*/\n state.mode = hold & 0x200 ? DICTID : TYPE\n //=== INITBITS();\n hold = 0\n bits = 0\n //===//\n break\n case FLAGS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n state.flags = hold\n if ((state.flags & 0xff) !== Z_DEFLATED) {\n strm.msg = 'unknown compression method'\n state.mode = BAD\n break\n }\n if (state.flags & 0xe000) {\n strm.msg = 'unknown header flags set'\n state.mode = BAD\n break\n }\n if (state.head) {\n state.head.text = (hold >> 8) & 1\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff\n hbuf[1] = (hold >>> 8) & 0xff\n state.check = crc32(state.check, hbuf, 2, 0)\n //===//\n }\n //=== INITBITS();\n hold = 0\n bits = 0\n //===//\n state.mode = TIME\n /* falls through */\n case TIME:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n if (state.head) {\n state.head.time = hold\n }\n if (state.flags & 0x0200) {\n //=== CRC4(state.check, hold)\n hbuf[0] = hold & 0xff\n hbuf[1] = (hold >>> 8) & 0xff\n hbuf[2] = (hold >>> 16) & 0xff\n hbuf[3] = (hold >>> 24) & 0xff\n state.check = crc32(state.check, hbuf, 4, 0)\n //===\n }\n //=== INITBITS();\n hold = 0\n bits = 0\n //===//\n state.mode = OS\n /* falls through */\n case OS:\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n if (state.head) {\n state.head.xflags = hold & 0xff\n state.head.os = hold >> 8\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff\n hbuf[1] = (hold >>> 8) & 0xff\n state.check = crc32(state.check, hbuf, 2, 0)\n //===//\n }\n //=== INITBITS();\n hold = 0\n bits = 0\n //===//\n state.mode = EXLEN\n /* falls through */\n case EXLEN:\n if (state.flags & 0x0400) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n state.length = hold\n if (state.head) {\n state.head.extra_len = hold\n }\n if (state.flags & 0x0200) {\n //=== CRC2(state.check, hold);\n hbuf[0] = hold & 0xff\n hbuf[1] = (hold >>> 8) & 0xff\n state.check = crc32(state.check, hbuf, 2, 0)\n //===//\n }\n //=== INITBITS();\n hold = 0\n bits = 0\n //===//\n } else if (state.head) {\n state.head.extra = null /*Z_NULL*/\n }\n state.mode = EXTRA\n /* falls through */\n case EXTRA:\n if (state.flags & 0x0400) {\n copy = state.length\n if (copy > have) {\n copy = have\n }\n if (copy) {\n if (state.head) {\n len = state.head.extra_len - state.length\n if (!state.head.extra) {\n // Use untyped array for more convenient processing later\n state.head.extra = new Array(state.head.extra_len)\n }\n arraySet(\n state.head.extra,\n input,\n next,\n // extra field is limited to 65536 bytes\n // - no need for additional size check\n copy,\n /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/\n len,\n )\n //zmemcpy(state.head.extra + len, next,\n // len + copy > state.head.extra_max ?\n // state.head.extra_max - len : copy);\n }\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next)\n }\n have -= copy\n next += copy\n state.length -= copy\n }\n if (state.length) {\n break inf_leave\n }\n }\n state.length = 0\n state.mode = NAME\n /* falls through */\n case NAME:\n if (state.flags & 0x0800) {\n if (have === 0) {\n break inf_leave\n }\n copy = 0\n do {\n // TODO: 2 or 1 bytes?\n len = input[next + copy++]\n /* use constant limit because in js we should not preallocate memory */\n if (\n state.head &&\n len &&\n state.length < 65536 /*state.head.name_max*/\n ) {\n state.head.name += String.fromCharCode(len)\n }\n } while (len && copy < have)\n\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next)\n }\n have -= copy\n next += copy\n if (len) {\n break inf_leave\n }\n } else if (state.head) {\n state.head.name = null\n }\n state.length = 0\n state.mode = COMMENT\n /* falls through */\n case COMMENT:\n if (state.flags & 0x1000) {\n if (have === 0) {\n break inf_leave\n }\n copy = 0\n do {\n len = input[next + copy++]\n /* use constant limit because in js we should not preallocate memory */\n if (\n state.head &&\n len &&\n state.length < 65536 /*state.head.comm_max*/\n ) {\n state.head.comment += String.fromCharCode(len)\n }\n } while (len && copy < have)\n if (state.flags & 0x0200) {\n state.check = crc32(state.check, input, copy, next)\n }\n have -= copy\n next += copy\n if (len) {\n break inf_leave\n }\n } else if (state.head) {\n state.head.comment = null\n }\n state.mode = HCRC\n /* falls through */\n case HCRC:\n if (state.flags & 0x0200) {\n //=== NEEDBITS(16); */\n while (bits < 16) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n if (hold !== (state.check & 0xffff)) {\n strm.msg = 'header crc mismatch'\n state.mode = BAD\n break\n }\n //=== INITBITS();\n hold = 0\n bits = 0\n //===//\n }\n if (state.head) {\n state.head.hcrc = (state.flags >> 9) & 1\n state.head.done = true\n }\n strm.adler = state.check = 0\n state.mode = TYPE\n break\n case DICTID:\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n strm.adler = state.check = zswap32(hold)\n //=== INITBITS();\n hold = 0\n bits = 0\n //===//\n state.mode = DICT\n /* falls through */\n case DICT:\n if (state.havedict === 0) {\n //--- RESTORE() ---\n strm.next_out = put\n strm.avail_out = left\n strm.next_in = next\n strm.avail_in = have\n state.hold = hold\n state.bits = bits\n //---\n return Z_NEED_DICT\n }\n strm.adler = state.check = 1 /*adler32(0L, Z_NULL, 0)*/\n state.mode = TYPE\n /* falls through */\n case TYPE:\n if (flush === Z_BLOCK || flush === Z_TREES) {\n break inf_leave\n }\n /* falls through */\n case TYPEDO:\n if (state.last) {\n //--- BYTEBITS() ---//\n hold >>>= bits & 7\n bits -= bits & 7\n //---//\n state.mode = CHECK\n break\n }\n //=== NEEDBITS(3); */\n while (bits < 3) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n state.last = hold & 0x01 /*BITS(1)*/\n //--- DROPBITS(1) ---//\n hold >>>= 1\n bits -= 1\n //---//\n\n switch (hold & 0x03 /*BITS(2)*/) {\n case 0 /* stored block */:\n //Tracev((stderr, \"inflate: stored block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = STORED\n break\n case 1 /* fixed block */:\n fixedtables(state)\n //Tracev((stderr, \"inflate: fixed codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = LEN_ /* decode codes */\n if (flush === Z_TREES) {\n //--- DROPBITS(2) ---//\n hold >>>= 2\n bits -= 2\n //---//\n break inf_leave\n }\n break\n case 2 /* dynamic block */:\n //Tracev((stderr, \"inflate: dynamic codes block%s\\n\",\n // state.last ? \" (last)\" : \"\"));\n state.mode = TABLE\n break\n case 3:\n strm.msg = 'invalid block type'\n state.mode = BAD\n }\n //--- DROPBITS(2) ---//\n hold >>>= 2\n bits -= 2\n //---//\n break\n case STORED:\n //--- BYTEBITS() ---// /* go to byte boundary */\n hold >>>= bits & 7\n bits -= bits & 7\n //---//\n //=== NEEDBITS(32); */\n while (bits < 32) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) {\n strm.msg = 'invalid stored block lengths'\n state.mode = BAD\n break\n }\n state.length = hold & 0xffff\n //Tracev((stderr, \"inflate: stored length %u\\n\",\n // state.length));\n //=== INITBITS();\n hold = 0\n bits = 0\n //===//\n state.mode = COPY_\n if (flush === Z_TREES) {\n break inf_leave\n }\n /* falls through */\n case COPY_:\n state.mode = COPY\n /* falls through */\n case COPY:\n copy = state.length\n if (copy) {\n if (copy > have) {\n copy = have\n }\n if (copy > left) {\n copy = left\n }\n if (copy === 0) {\n break inf_leave\n }\n //--- zmemcpy(put, next, copy); ---\n arraySet(output, input, next, copy, put)\n //---//\n have -= copy\n next += copy\n left -= copy\n put += copy\n state.length -= copy\n break\n }\n //Tracev((stderr, \"inflate: stored end\\n\"));\n state.mode = TYPE\n break\n case TABLE:\n //=== NEEDBITS(14); */\n while (bits < 14) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n state.nlen = (hold & 0x1f) /*BITS(5)*/ + 257\n //--- DROPBITS(5) ---//\n hold >>>= 5\n bits -= 5\n //---//\n state.ndist = (hold & 0x1f) /*BITS(5)*/ + 1\n //--- DROPBITS(5) ---//\n hold >>>= 5\n bits -= 5\n //---//\n state.ncode = (hold & 0x0f) /*BITS(4)*/ + 4\n //--- DROPBITS(4) ---//\n hold >>>= 4\n bits -= 4\n //---//\n //#ifndef PKZIP_BUG_WORKAROUND\n if (state.nlen > 286 || state.ndist > 30) {\n strm.msg = 'too many length or distance symbols'\n state.mode = BAD\n break\n }\n //#endif\n //Tracev((stderr, \"inflate: table sizes ok\\n\"));\n state.have = 0\n state.mode = LENLENS\n /* falls through */\n case LENLENS:\n while (state.have < state.ncode) {\n //=== NEEDBITS(3);\n while (bits < 3) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n state.lens[order[state.have++]] = hold & 0x07 //BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3\n bits -= 3\n //---//\n }\n while (state.have < 19) {\n state.lens[order[state.have++]] = 0\n }\n // We have separate tables & no pointers. 2 commented lines below not needed.\n //state.next = state.codes;\n //state.lencode = state.next;\n // Switch to use dynamic table\n state.lencode = state.lendyn\n state.lenbits = 7\n\n opts = { bits: state.lenbits }\n ret = inflate_table(\n CODES,\n state.lens,\n 0,\n 19,\n state.lencode,\n 0,\n state.work,\n opts,\n )\n state.lenbits = opts.bits\n\n if (ret) {\n strm.msg = 'invalid code lengths set'\n state.mode = BAD\n break\n }\n //Tracev((stderr, \"inflate: code lengths ok\\n\"));\n state.have = 0\n state.mode = CODELENS\n /* falls through */\n case CODELENS:\n while (state.have < state.nlen + state.ndist) {\n for (;;) {\n here =\n state.lencode[\n hold & ((1 << state.lenbits) - 1)\n ] /*BITS(state.lenbits)*/\n here_bits = here >>> 24\n here_op = (here >>> 16) & 0xff\n here_val = here & 0xffff\n\n if (here_bits <= bits) {\n break\n }\n //--- PULLBYTE() ---//\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n //---//\n }\n if (here_val < 16) {\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits\n bits -= here_bits\n //---//\n state.lens[state.have++] = here_val\n } else {\n if (here_val === 16) {\n //=== NEEDBITS(here.bits + 2);\n n = here_bits + 2\n while (bits < n) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits\n bits -= here_bits\n //---//\n if (state.have === 0) {\n strm.msg = 'invalid bit length repeat'\n state.mode = BAD\n break\n }\n len = state.lens[state.have - 1]\n copy = 3 + (hold & 0x03) //BITS(2);\n //--- DROPBITS(2) ---//\n hold >>>= 2\n bits -= 2\n //---//\n } else if (here_val === 17) {\n //=== NEEDBITS(here.bits + 3);\n n = here_bits + 3\n while (bits < n) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits\n bits -= here_bits\n //---//\n len = 0\n copy = 3 + (hold & 0x07) //BITS(3);\n //--- DROPBITS(3) ---//\n hold >>>= 3\n bits -= 3\n //---//\n } else {\n //=== NEEDBITS(here.bits + 7);\n n = here_bits + 7\n while (bits < n) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits\n bits -= here_bits\n //---//\n len = 0\n copy = 11 + (hold & 0x7f) //BITS(7);\n //--- DROPBITS(7) ---//\n hold >>>= 7\n bits -= 7\n //---//\n }\n if (state.have + copy > state.nlen + state.ndist) {\n strm.msg = 'invalid bit length repeat'\n state.mode = BAD\n break\n }\n while (copy--) {\n state.lens[state.have++] = len\n }\n }\n }\n\n /* handle error breaks in while */\n if (state.mode === BAD) {\n break\n }\n\n /* check for end-of-block code (better have one) */\n if (state.lens[256] === 0) {\n strm.msg = 'invalid code -- missing end-of-block'\n state.mode = BAD\n break\n }\n\n /* build code tables -- note: do not change the lenbits or distbits\n values here (9 and 6) without reading the comments in inftrees.h\n concerning the ENOUGH constants, which depend on those values */\n state.lenbits = 9\n\n opts = { bits: state.lenbits }\n ret = inflate_table(\n LENS,\n state.lens,\n 0,\n state.nlen,\n state.lencode,\n 0,\n state.work,\n opts,\n )\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.lenbits = opts.bits\n // state.lencode = state.next;\n\n if (ret) {\n strm.msg = 'invalid literal/lengths set'\n state.mode = BAD\n break\n }\n\n state.distbits = 6\n //state.distcode.copy(state.codes);\n // Switch to use dynamic table\n state.distcode = state.distdyn\n opts = { bits: state.distbits }\n ret = inflate_table(\n DISTS,\n state.lens,\n state.nlen,\n state.ndist,\n state.distcode,\n 0,\n state.work,\n opts,\n )\n // We have separate tables & no pointers. 2 commented lines below not needed.\n // state.next_index = opts.table_index;\n state.distbits = opts.bits\n // state.distcode = state.next;\n\n if (ret) {\n strm.msg = 'invalid distances set'\n state.mode = BAD\n break\n }\n //Tracev((stderr, 'inflate: codes ok\\n'));\n state.mode = LEN_\n if (flush === Z_TREES) {\n break inf_leave\n }\n /* falls through */\n case LEN_:\n state.mode = LEN\n /* falls through */\n case LEN:\n if (have >= 6 && left >= 258) {\n //--- RESTORE() ---\n strm.next_out = put\n strm.avail_out = left\n strm.next_in = next\n strm.avail_in = have\n state.hold = hold\n state.bits = bits\n //---\n inflate_fast(strm, _out)\n //--- LOAD() ---\n put = strm.next_out\n output = strm.output\n left = strm.avail_out\n next = strm.next_in\n input = strm.input\n have = strm.avail_in\n hold = state.hold\n bits = state.bits\n //---\n\n if (state.mode === TYPE) {\n state.back = -1\n }\n break\n }\n state.back = 0\n for (;;) {\n here =\n state.lencode[\n hold & ((1 << state.lenbits) - 1)\n ] /*BITS(state.lenbits)*/\n here_bits = here >>> 24\n here_op = (here >>> 16) & 0xff\n here_val = here & 0xffff\n\n if (here_bits <= bits) {\n break\n }\n //--- PULLBYTE() ---//\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n //---//\n }\n if (here_op && (here_op & 0xf0) === 0) {\n last_bits = here_bits\n last_op = here_op\n last_val = here_val\n for (;;) {\n here =\n state.lencode[\n last_val +\n ((hold &\n ((1 << (last_bits + last_op)) -\n 1)) /*BITS(last.bits + last.op)*/ >>\n last_bits)\n ]\n here_bits = here >>> 24\n here_op = (here >>> 16) & 0xff\n here_val = here & 0xffff\n\n if (last_bits + here_bits <= bits) {\n break\n }\n //--- PULLBYTE() ---//\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits\n bits -= last_bits\n //---//\n state.back += last_bits\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits\n bits -= here_bits\n //---//\n state.back += here_bits\n state.length = here_val\n if (here_op === 0) {\n //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?\n // \"inflate: literal '%c'\\n\" :\n // \"inflate: literal 0x%02x\\n\", here.val));\n state.mode = LIT\n break\n }\n if (here_op & 32) {\n //Tracevv((stderr, \"inflate: end of block\\n\"));\n state.back = -1\n state.mode = TYPE\n break\n }\n if (here_op & 64) {\n strm.msg = 'invalid literal/length code'\n state.mode = BAD\n break\n }\n state.extra = here_op & 15\n state.mode = LENEXT\n /* falls through */\n case LENEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra\n while (bits < n) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n state.length += hold & ((1 << state.extra) - 1) /*BITS(state.extra)*/\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra\n bits -= state.extra\n //---//\n state.back += state.extra\n }\n //Tracevv((stderr, \"inflate: length %u\\n\", state.length));\n state.was = state.length\n state.mode = DIST\n /* falls through */\n case DIST:\n for (;;) {\n here =\n state.distcode[\n hold & ((1 << state.distbits) - 1)\n ] /*BITS(state.distbits)*/\n here_bits = here >>> 24\n here_op = (here >>> 16) & 0xff\n here_val = here & 0xffff\n\n if (here_bits <= bits) {\n break\n }\n //--- PULLBYTE() ---//\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n //---//\n }\n if ((here_op & 0xf0) === 0) {\n last_bits = here_bits\n last_op = here_op\n last_val = here_val\n for (;;) {\n here =\n state.distcode[\n last_val +\n ((hold &\n ((1 << (last_bits + last_op)) -\n 1)) /*BITS(last.bits + last.op)*/ >>\n last_bits)\n ]\n here_bits = here >>> 24\n here_op = (here >>> 16) & 0xff\n here_val = here & 0xffff\n\n if (last_bits + here_bits <= bits) {\n break\n }\n //--- PULLBYTE() ---//\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n //---//\n }\n //--- DROPBITS(last.bits) ---//\n hold >>>= last_bits\n bits -= last_bits\n //---//\n state.back += last_bits\n }\n //--- DROPBITS(here.bits) ---//\n hold >>>= here_bits\n bits -= here_bits\n //---//\n state.back += here_bits\n if (here_op & 64) {\n strm.msg = 'invalid distance code'\n state.mode = BAD\n break\n }\n state.offset = here_val\n state.extra = here_op & 15\n state.mode = DISTEXT\n /* falls through */\n case DISTEXT:\n if (state.extra) {\n //=== NEEDBITS(state.extra);\n n = state.extra\n while (bits < n) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n state.offset += hold & ((1 << state.extra) - 1) /*BITS(state.extra)*/\n //--- DROPBITS(state.extra) ---//\n hold >>>= state.extra\n bits -= state.extra\n //---//\n state.back += state.extra\n }\n //#ifdef INFLATE_STRICT\n if (state.offset > state.dmax) {\n strm.msg = 'invalid distance too far back'\n state.mode = BAD\n break\n }\n //#endif\n //Tracevv((stderr, \"inflate: distance %u\\n\", state.offset));\n state.mode = MATCH\n /* falls through */\n case MATCH:\n if (left === 0) {\n break inf_leave\n }\n copy = _out - left\n if (state.offset > copy) {\n /* copy from window */\n copy = state.offset - copy\n if (copy > state.whave) {\n if (state.sane) {\n strm.msg = 'invalid distance too far back'\n state.mode = BAD\n break\n }\n // (!) This block is disabled in zlib defaults,\n // don't enable it for binary compatibility\n //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR\n // Trace((stderr, \"inflate.c too far\\n\"));\n // copy -= state.whave;\n // if (copy > state.length) { copy = state.length; }\n // if (copy > left) { copy = left; }\n // left -= copy;\n // state.length -= copy;\n // do {\n // output[put++] = 0;\n // } while (--copy);\n // if (state.length === 0) { state.mode = LEN; }\n // break;\n //#endif\n }\n if (copy > state.wnext) {\n copy -= state.wnext\n from = state.wsize - copy\n } else {\n from = state.wnext - copy\n }\n if (copy > state.length) {\n copy = state.length\n }\n from_source = state.window\n } else {\n /* copy from output */\n from_source = output\n from = put - state.offset\n copy = state.length\n }\n if (copy > left) {\n copy = left\n }\n left -= copy\n state.length -= copy\n do {\n output[put++] = from_source[from++]\n } while (--copy)\n if (state.length === 0) {\n state.mode = LEN\n }\n break\n case LIT:\n if (left === 0) {\n break inf_leave\n }\n output[put++] = state.length\n left--\n state.mode = LEN\n break\n case CHECK:\n if (state.wrap) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) {\n break inf_leave\n }\n have--\n // Use '|' instead of '+' to make sure that result is signed\n hold |= input[next++] << bits\n bits += 8\n }\n //===//\n _out -= left\n strm.total_out += _out\n state.total += _out\n if (_out) {\n strm.adler = state.check =\n /*UPDATE(state.check, put - _out, _out);*/\n state.flags\n ? crc32(state.check, output, _out, put - _out)\n : adler32(state.check, output, _out, put - _out)\n }\n _out = left\n // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too\n if ((state.flags ? hold : zswap32(hold)) !== state.check) {\n strm.msg = 'incorrect data check'\n state.mode = BAD\n break\n }\n //=== INITBITS();\n hold = 0\n bits = 0\n //===//\n //Tracev((stderr, \"inflate: check matches trailer\\n\"));\n }\n state.mode = LENGTH\n /* falls through */\n case LENGTH:\n if (state.wrap && state.flags) {\n //=== NEEDBITS(32);\n while (bits < 32) {\n if (have === 0) {\n break inf_leave\n }\n have--\n hold += input[next++] << bits\n bits += 8\n }\n //===//\n if (hold !== (state.total & 0xffffffff)) {\n strm.msg = 'incorrect length check'\n state.mode = BAD\n break\n }\n //=== INITBITS();\n hold = 0\n bits = 0\n //===//\n //Tracev((stderr, \"inflate: length matches trailer\\n\"));\n }\n state.mode = DONE\n /* falls through */\n case DONE:\n ret = Z_STREAM_END\n break inf_leave\n case BAD:\n ret = Z_DATA_ERROR\n break inf_leave\n case MEM:\n return Z_MEM_ERROR\n case SYNC:\n /* falls through */\n default:\n return Z_STREAM_ERROR\n }\n }\n\n // inf_leave <- here is real place for \"goto inf_leave\", emulated via \"break inf_leave\"\n\n /*\n Return from inflate(), updating the total counts and the check value.\n If there was no progress during the inflate() call, return a buffer\n error. Call updatewindow() to create and/or update the window state.\n Note: a memory error from inflate() is non-recoverable.\n */\n\n //--- RESTORE() ---\n strm.next_out = put\n strm.avail_out = left\n strm.next_in = next\n strm.avail_in = have\n state.hold = hold\n state.bits = bits\n //---\n\n if (\n state.wsize ||\n (_out !== strm.avail_out &&\n state.mode < BAD &&\n (state.mode < CHECK || flush !== Z_FINISH))\n ) {\n if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) {\n state.mode = MEM\n return Z_MEM_ERROR\n }\n }\n _in -= strm.avail_in\n _out -= strm.avail_out\n strm.total_in += _in\n strm.total_out += _out\n state.total += _out\n if (state.wrap && _out) {\n strm.adler = state.check =\n /*UPDATE(state.check, strm.next_out - _out, _out);*/\n state.flags\n ? crc32(state.check, output, _out, strm.next_out - _out)\n : adler32(state.check, output, _out, strm.next_out - _out)\n }\n strm.data_type =\n state.bits +\n (state.last ? 64 : 0) +\n (state.mode === TYPE ? 128 : 0) +\n (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0)\n if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) {\n ret = Z_BUF_ERROR\n }\n return ret\n}\n\nexport function inflateEnd(strm) {\n if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) {\n return Z_STREAM_ERROR\n }\n\n var state = strm.state\n if (state.window) {\n state.window = null\n }\n strm.state = null\n return Z_OK\n}\n\nexport function inflateGetHeader(strm, head) {\n var state\n\n /* check state */\n if (!strm || !strm.state) {\n return Z_STREAM_ERROR\n }\n state = strm.state\n if ((state.wrap & 2) === 0) {\n return Z_STREAM_ERROR\n }\n\n /* save header structure */\n state.head = head\n head.done = false\n return Z_OK\n}\n\nexport function inflateSetDictionary(strm, dictionary) {\n var dictLength = dictionary.length\n\n var state\n var dictid\n var ret\n\n /* check state */\n if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) {\n return Z_STREAM_ERROR\n }\n state = strm.state\n\n if (state.wrap !== 0 && state.mode !== DICT) {\n return Z_STREAM_ERROR\n }\n\n /* check for correct dictionary identifier */\n if (state.mode === DICT) {\n dictid = 1 /* adler32(0, null, 0)*/\n /* dictid = adler32(dictid, dictionary, dictLength); */\n dictid = adler32(dictid, dictionary, dictLength, 0)\n if (dictid !== state.check) {\n return Z_DATA_ERROR\n }\n }\n /* copy dictionary to window using updatewindow(), which will amend the\n existing dictionary if appropriate */\n ret = updatewindow(strm, dictionary, dictLength, dictLength)\n if (ret) {\n state.mode = MEM\n return Z_MEM_ERROR\n }\n state.havedict = 1\n // Tracev((stderr, \"inflate: dictionary set\\n\"));\n return Z_OK\n}\n\nexport var inflateInfo = 'pako inflate (from Nodeca project)'\n\n/* Not implemented\nexports.inflateCopy = inflateCopy;\nexports.inflateGetDictionary = inflateGetDictionary;\nexports.inflateMark = inflateMark;\nexports.inflatePrime = inflatePrime;\nexports.inflateSync = inflateSync;\nexports.inflateSyncPoint = inflateSyncPoint;\nexports.inflateUndermine = inflateUndermine;\n*/\n", "// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nexport default {\n 2: 'need dictionary' /* Z_NEED_DICT 2 */,\n 1: 'stream end' /* Z_STREAM_END 1 */,\n 0: '' /* Z_OK 0 */,\n '-1': 'file error' /* Z_ERRNO (-1) */,\n '-2': 'stream error' /* Z_STREAM_ERROR (-2) */,\n '-3': 'data error' /* Z_DATA_ERROR (-3) */,\n '-4': 'insufficient memory' /* Z_MEM_ERROR (-4) */,\n '-5': 'buffer error' /* Z_BUF_ERROR (-5) */,\n '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */,\n}\n", "// (C) 1995-2013 Jean-loup Gailly and Mark Adler\n// (C) 2014-2017 Vitaly Puzrin and Andrey Tupitsin\n//\n// This software is provided 'as-is', without any express or implied\n// warranty. In no event will the authors be held liable for any damages\n// arising from the use of this software.\n//\n// Permission is granted to anyone to use this software for any purpose,\n// including commercial applications, and to alter it and redistribute it\n// freely, subject to the following restrictions:\n//\n// 1. The origin of this software must not be misrepresented; you must not\n// claim that you wrote the original software. If you use this software\n// in a product, an acknowledgment in the product documentation would be\n// appreciated but is not required.\n// 2. Altered source versions must be plainly marked as such, and must not be\n// misrepresented as being the original software.\n// 3. This notice may not be removed or altered from any source distribution.\n\nexport default function ZStream() {\n /* next input byte */\n this.input = null // JS specific, because we have no pointers\n this.next_in = 0\n /* number of bytes available at input */\n this.avail_in = 0\n /* total number of input bytes read so far */\n this.total_in = 0\n /* next output byte should be put there */\n this.output = null // JS specific, because we have no pointers\n this.next_out = 0\n /* remaining free space at output */\n this.avail_out = 0\n /* total number of bytes output so far */\n this.total_out = 0\n /* last error message, NULL if no error */\n this.msg = '' /*Z_NULL*/\n /* not visible by applications */\n this.state = null\n /* best guess about the data type: binary or text */\n this.data_type = 2 /*Z_UNKNOWN*/\n /* adler32 value of the uncompressed data */\n this.adler = 0\n}\n", "import {\n Buf8,\n arraySet,\n assign,\n flattenChunks,\n shrinkBuf,\n} from './utils/common.js'\nimport {\n binstring2buf,\n buf2string,\n string2buf,\n utf8border,\n} from './utils/strings.js'\nimport {\n Z_BUF_ERROR,\n Z_FINISH,\n Z_NEED_DICT,\n Z_NO_FLUSH,\n Z_OK,\n Z_STREAM_END,\n Z_SYNC_FLUSH,\n} from './zlib/constants.js'\nimport GZheader from './zlib/gzheader.js'\nimport {\n inflate as zlibInflate,\n inflateEnd,\n inflateGetHeader,\n inflateInit2,\n inflateSetDictionary,\n} from './zlib/inflate.js'\nimport msg from './zlib/messages.js'\nimport ZStream from './zlib/zstream.js'\n\nvar toString = Object.prototype.toString\n\n/**\n * class Inflate\n *\n * Generic JS-style wrapper for zlib calls. If you don't need\n * streaming behaviour - use more simple functions: [[inflate]]\n * and [[inflateRaw]].\n **/\n\n/* internal\n * inflate.chunks -> Array\n *\n * Chunks of output data, if [[Inflate#onData]] not overridden.\n **/\n\n/**\n * Inflate.result -> Uint8Array|Array|String\n *\n * Uncompressed result, generated by default [[Inflate#onData]]\n * and [[Inflate#onEnd]] handlers. Filled after you push last chunk\n * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you\n * push a chunk with explicit flush (call [[Inflate#push]] with\n * `Z_SYNC_FLUSH` param).\n **/\n\n/**\n * Inflate.err -> Number\n *\n * Error code after inflate finished. 0 (Z_OK) on success.\n * Should be checked if broken data possible.\n **/\n\n/**\n * Inflate.msg -> String\n *\n * Error message, if [[Inflate.err]] != 0\n **/\n\n/**\n * new Inflate(options)\n * - options (Object): zlib inflate options.\n *\n * Creates new inflator instance with specified params. Throws exception\n * on bad params. Supported options:\n *\n * - `windowBits`\n * - `dictionary`\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information on these.\n *\n * Additional options, for internal needs:\n *\n * - `chunkSize` - size of generated data chunks (16K by default)\n * - `raw` (Boolean) - do raw inflate\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n * By default, when no options set, autodetect deflate/gzip data format via\n * wrapper header.\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9])\n * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]);\n *\n * var inflate = new pako.Inflate({ level: 3});\n *\n * inflate.push(chunk1, false);\n * inflate.push(chunk2, true); // true -> last chunk\n *\n * if (inflate.err) { throw new Error(inflate.err); }\n *\n * console.log(inflate.result);\n * ```\n **/\nexport class Inflate {\n constructor(options) {\n if (!(this instanceof Inflate)) return new Inflate(options)\n\n this.options = assign(\n {\n chunkSize: 16384,\n windowBits: 0,\n to: '',\n },\n options || {},\n )\n\n var opt = this.options\n\n // Force window size for `raw` data, if not set directly,\n // because we have no header for autodetect.\n if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) {\n opt.windowBits = -opt.windowBits\n if (opt.windowBits === 0) {\n opt.windowBits = -15\n }\n }\n\n // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate\n if (\n opt.windowBits >= 0 &&\n opt.windowBits < 16 &&\n !(options && options.windowBits)\n ) {\n opt.windowBits += 32\n }\n\n // Gzip header has no info about windows size, we can do autodetect only\n // for deflate. So, if window size not set, force it to max when gzip possible\n if (opt.windowBits > 15 && opt.windowBits < 48) {\n // bit 3 (16) -> gzipped data\n // bit 4 (32) -> autodetect gzip/deflate\n if ((opt.windowBits & 15) === 0) {\n opt.windowBits |= 15\n }\n }\n\n this.err = 0 // error code, if happens (0 = Z_OK)\n this.msg = '' // error message\n this.ended = false // used to avoid multiple onEnd() calls\n this.chunks = [] // chunks of compressed data\n\n this.strm = new ZStream()\n this.strm.avail_out = 0\n\n var status = inflateInit2(this.strm, opt.windowBits)\n\n if (status !== Z_OK) {\n throw new Error(msg[status])\n }\n\n this.header = new GZheader()\n\n inflateGetHeader(this.strm, this.header)\n\n // Setup dictionary\n if (opt.dictionary) {\n // Convert data if needed\n if (typeof opt.dictionary === 'string') {\n opt.dictionary = string2buf(opt.dictionary)\n } else if (toString.call(opt.dictionary) === '[object ArrayBuffer]') {\n opt.dictionary = new Uint8Array(opt.dictionary)\n }\n if (opt.raw) {\n //In raw mode we need to set the dictionary early\n status = inflateSetDictionary(this.strm, opt.dictionary)\n if (status !== Z_OK) {\n throw new Error(msg[status])\n }\n }\n }\n }\n\n /**\n * Inflate#push(data[, mode]) -> Boolean\n * - data (Uint8Array|Array|ArrayBuffer|String): input data\n * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes.\n * See constants. Skipped or `false` means Z_NO_FLUSH, `true` means Z_FINISH.\n *\n * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with\n * new output chunks. Returns `true` on success. The last data block must have\n * mode Z_FINISH (or `true`). That will flush internal pending buffers and call\n * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you\n * can use mode Z_SYNC_FLUSH, keeping the decompression context.\n *\n * On fail call [[Inflate#onEnd]] with error code and return false.\n *\n * We strongly recommend to use `Uint8Array` on input for best speed (output\n * format is detected automatically). Also, don't skip last param and always\n * use the same type in your code (boolean or number). That will improve JS speed.\n *\n * For regular `Array`-s make sure all elements are [0..255].\n *\n * ##### Example\n *\n * ```javascript\n * push(chunk, false); // push one of data chunks\n * ...\n * push(chunk, true); // push last chunk\n * ```\n **/\n push(data, mode) {\n var strm = this.strm\n var chunkSize = this.options.chunkSize\n var dictionary = this.options.dictionary\n var status, _mode\n var next_out_utf8, tail, utf8str\n var dict\n\n // Flag to properly process Z_BUF_ERROR on testing inflate call\n // when we check that all output data was flushed.\n var allowBufError = false\n\n if (this.ended) {\n return false\n }\n _mode = mode === ~~mode ? mode : mode === true ? Z_FINISH : Z_NO_FLUSH\n\n // Convert data if needed\n if (typeof data === 'string') {\n // Only binary strings can be decompressed on practice\n strm.input = binstring2buf(data)\n } else if (toString.call(data) === '[object ArrayBuffer]') {\n strm.input = new Uint8Array(data)\n } else {\n strm.input = data\n }\n\n strm.next_in = 0\n strm.avail_in = strm.input.length\n\n do {\n if (strm.avail_out === 0) {\n strm.output = Buf8(chunkSize)\n strm.next_out = 0\n strm.avail_out = chunkSize\n }\n\n status = zlibInflate(strm, Z_NO_FLUSH) /* no bad return value */\n\n if (status === Z_NEED_DICT && dictionary) {\n // Convert data if needed\n if (typeof dictionary === 'string') {\n dict = string2buf(dictionary)\n } else if (toString.call(dictionary) === '[object ArrayBuffer]') {\n dict = new Uint8Array(dictionary)\n } else {\n dict = dictionary\n }\n\n status = inflateSetDictionary(this.strm, dict)\n }\n\n if (status === Z_BUF_ERROR && allowBufError === true) {\n status = Z_OK\n allowBufError = false\n }\n\n if (status !== Z_STREAM_END && status !== Z_OK) {\n this.onEnd(status)\n this.ended = true\n return false\n }\n\n if (strm.next_out) {\n if (\n strm.avail_out === 0 ||\n status === Z_STREAM_END ||\n (strm.avail_in === 0 &&\n (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))\n ) {\n if (this.options.to === 'string') {\n next_out_utf8 = utf8border(strm.output, strm.next_out)\n\n tail = strm.next_out - next_out_utf8\n utf8str = buf2string(strm.output, next_out_utf8)\n\n // move tail\n strm.next_out = tail\n strm.avail_out = chunkSize - tail\n if (tail) {\n arraySet(strm.output, strm.output, next_out_utf8, tail, 0)\n }\n\n this.onData(utf8str)\n } else {\n this.onData(shrinkBuf(strm.output, strm.next_out))\n }\n }\n }\n\n // When no more input data, we should check that internal inflate buffers\n // are flushed. The only way to do it when avail_out = 0 - run one more\n // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.\n // Here we set flag to process this error properly.\n //\n // NOTE. Deflate does not return error in this case and does not needs such\n // logic.\n if (strm.avail_in === 0 && strm.avail_out === 0) {\n allowBufError = true\n }\n } while (\n (strm.avail_in > 0 || strm.avail_out === 0) &&\n status !== Z_STREAM_END\n )\n\n if (status === Z_STREAM_END) {\n _mode = Z_FINISH\n }\n\n // Finalize on the last chunk.\n if (_mode === Z_FINISH) {\n status = inflateEnd(this.strm)\n this.onEnd(status)\n this.ended = true\n return status === Z_OK\n }\n\n // callback interim results if Z_SYNC_FLUSH.\n if (_mode === Z_SYNC_FLUSH) {\n this.onEnd(Z_OK)\n strm.avail_out = 0\n return true\n }\n\n return true\n }\n\n /**\n * Inflate#onData(chunk) -> Void\n * - chunk (Uint8Array|Array|String): output data. Type of array depends\n * on js engine support. When string output requested, each chunk\n * will be string.\n *\n * By default, stores data blocks in `chunks[]` property and glue\n * those in `onEnd`. Override this handler, if you need another behaviour.\n **/\n onData(chunk) {\n this.chunks.push(chunk)\n }\n\n /**\n * Inflate#onEnd(status) -> Void\n * - status (Number): inflate status. 0 (Z_OK) on success,\n * other if not.\n *\n * Called either after you tell inflate that the input stream is\n * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)\n * or if an error happened. By default - join collected chunks,\n * free memory and fill `results` / `err` properties.\n **/\n onEnd(status) {\n // On success - join\n if (status === Z_OK) {\n if (this.options.to === 'string') {\n // Glue & convert here, until we teach pako to send\n // utf8 aligned strings to onData\n this.result = this.chunks.join('')\n } else {\n this.result = flattenChunks(this.chunks)\n }\n }\n this.chunks = []\n this.err = status\n this.msg = this.strm.msg\n }\n}\n\n/**\n * inflate(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Decompress `data` with inflate/ungzip and `options`. Autodetect\n * format via wrapper header by default. That's why we don't provide\n * separate `ungzip` method.\n *\n * Supported options are:\n *\n * - windowBits\n *\n * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced)\n * for more information.\n *\n * Sugar (options):\n *\n * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify\n * negative windowBits implicitly.\n * - `to` (String) - if equal to 'string', then result will be converted\n * from utf8 to utf16 (javascript) string. When string output requested,\n * chunk length can differ from `chunkSize`, depending on content.\n *\n *\n * ##### Example:\n *\n * ```javascript\n * var pako = require('pako')\n * , input = pako.deflate([1,2,3,4,5,6,7,8,9])\n * , output;\n *\n * try {\n * output = pako.inflate(input);\n * } catch (err)\n * console.log(err);\n * }\n * ```\n **/\nexport function inflate(input, options) {\n var inflator = new Inflate(options)\n\n inflator.push(input, true)\n\n // That will never happens, if you don't cheat with options :)\n if (inflator.err) {\n throw inflator.msg || msg[inflator.err]\n }\n\n return inflator.result\n}\n\n/**\n * inflateRaw(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * The same as [[inflate]], but creates raw data, without wrapper\n * (header and adler32 crc).\n **/\nexport function inflateRaw(input, options) {\n options = options || {}\n options.raw = true\n return inflate(input, options)\n}\n\n/**\n * ungzip(data[, options]) -> Uint8Array|Array|String\n * - data (Uint8Array|Array|String): input data to decompress.\n * - options (Object): zlib inflate options.\n *\n * Just shortcut to [[inflate]], because it autodetects format\n * by header.content. Done for convenience.\n **/\nexport var ungzip = inflate\n", "/** Where one BGZF block sits, and how big it is on both sides of the inflate. */\nexport interface BgzfBlockInfo {\n /** Offset of the block's first byte within the scanned buffer. */\n inputOffset: number\n /** Length of the block as it appears in the file, header and trailer included. */\n compressedSize: number\n /** Length of the block once inflated, read from its `ISIZE` trailer. */\n decompressedSize: number\n /** Offset of the block's first byte within the file \u2014 a virtual offset's `blockPosition`. */\n filePosition: number\n}\n\nconst BGZF_HEADER_SIZE = 18\nconst BGZF_TRAILER_SIZE = 8\nconst BGZF_MIN_BLOCK_SIZE = BGZF_HEADER_SIZE + BGZF_TRAILER_SIZE\n\n/**\n * Walk a buffer's BGZF block boundaries without decompressing anything, reading\n * each block's `BSIZE` header field and `ISIZE` trailer field.\n *\n * @param input - compressed bytes whose FIRST byte is the block at\n * `minBlockPosition`. Scanning is relative to the buffer, so passing a whole\n * file while claiming it starts mid-file mislabels every `filePosition`.\n * @param minBlockPosition - the file offset `input` starts at, i.e. a chunk's\n * `minv.blockPosition`.\n * @param maxBlockPosition - the last block wanted, i.e. `maxv.blockPosition`.\n * That block is included; scanning also stops early at the end of `input` or\n * at the first bytes that are not a valid BGZF header.\n */\nexport function scanBgzfBlocks(\n input: Uint8Array,\n minBlockPosition: number,\n maxBlockPosition: number,\n) {\n const blocks: BgzfBlockInfo[] = []\n let offset = 0\n let filePosition = minBlockPosition\n\n while (offset + BGZF_MIN_BLOCK_SIZE <= input.length) {\n if (\n input[offset] !== 0x1f ||\n input[offset + 1] !== 0x8b ||\n input[offset + 2] !== 8 ||\n input[offset + 3] !== 4\n ) {\n break\n }\n\n if (\n input[offset + 10] !== 6 ||\n input[offset + 12] !== 0x42 ||\n input[offset + 13] !== 0x43\n ) {\n break\n }\n\n const bsize = (input[offset + 16]! | (input[offset + 17]! << 8)) + 1\n\n if (bsize < BGZF_MIN_BLOCK_SIZE || offset + bsize > input.length) {\n break\n }\n\n const trailerPos = offset + bsize - BGZF_TRAILER_SIZE\n const isize =\n (input[trailerPos + 4]! |\n (input[trailerPos + 5]! << 8) |\n (input[trailerPos + 6]! << 16) |\n (input[trailerPos + 7]! << 24)) >>>\n 0\n\n blocks.push({\n inputOffset: offset,\n compressedSize: bsize,\n decompressedSize: isize,\n filePosition,\n })\n\n if (filePosition >= maxBlockPosition) {\n break\n }\n\n offset += bsize\n filePosition += bsize\n }\n\n return blocks\n}\n", "export function concatUint8Array(args: Uint8Array[]) {\n let total = 0\n for (const entry of args) {\n total += entry.length\n }\n const mergedArray = new Uint8Array(total)\n let offset = 0\n for (const entry of args) {\n mergedArray.set(entry, offset)\n offset += entry.length\n }\n return mergedArray\n}\n", "/******/ // The require scope\n/******/ const __webpack_require__ = {};\n/******/ \n/************************************************************************/\n/******/ /* webpack/runtime/define property getters */\n/******/ (() => {\n/******/ \t// define getter/value functions for harmony exports\n/******/ \t__webpack_require__.d = (exports, definition) => {\n/******/ \t\tif(Array.isArray(definition)) {\n/******/ \t\t\tvar i = 0;\n/******/ \t\t\twhile(i < definition.length) {\n/******/ \t\t\t\tvar key = definition[i++];\n/******/ \t\t\t\tvar binding = definition[i++];\n/******/ \t\t\t\tif(!__webpack_require__.o(exports, key)) {\n/******/ \t\t\t\t\tif(binding === 0) {\n/******/ \t\t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, value: definition[i++] });\n/******/ \t\t\t\t\t} else {\n/******/ \t\t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: binding });\n/******/ \t\t\t\t\t}\n/******/ \t\t\t\t} else if(binding === 0) { i++; }\n/******/ \t\t\t}\n/******/ \t\t} else {\n/******/ \t\t\tfor(var key in definition) {\n/******/ \t\t\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n/******/ \t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n/******/ \t\t\t\t}\n/******/ \t\t\t}\n/******/ \t\t}\n/******/ \t};\n/******/ })();\n/******/ \n/******/ /* webpack/runtime/hasOwnProperty shorthand */\n/******/ (() => {\n/******/ \t__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))\n/******/ })();\n/******/ \n/******/ /* webpack/runtime/make namespace object */\n/******/ (() => {\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = (exports) => {\n/******/ \t\tif(Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/ })();\n/******/ \n/************************************************************************/\n\n// NAMESPACE OBJECT (decoupled): ../src/wasm/bgzf_wasm_bg.js\nvar bgzf_wasm_bg_namespaceObject = {};\n__webpack_require__.r(bgzf_wasm_bg_namespaceObject);\n__webpack_require__.d(bgzf_wasm_bg_namespaceObject, {\n ChunkSliceResult: () => (ChunkSliceResult),\n __wbg_Error_92b29b0548f8b746: () => (__wbg_Error_92b29b0548f8b746),\n __wbg___wbindgen_throw_344f42d3211c4765: () => (__wbg___wbindgen_throw_344f42d3211c4765),\n __wbg_set_wasm: () => (__wbg_set_wasm),\n decompress_all: () => (decompress_all),\n decompress_chunk_slice: () => (decompress_chunk_slice)\n});\n\n;// ../src/wasm/bgzf_wasm_bg.wasm\nconst wasm_bgzf_wasm_bg_namespaceObject = \"data:application/wasm;base64,AGFzbQEAAAABfRFgAABgAAF/YAF/AGABfwF/YAJ/fwBgAn9/AX9gA39/fwBgA39/fwF/YAR/f39/AGAEf39/fwF/YAV/f39/fwBgBX9/f39/AX9gBn9/f39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gCH9/f39/f39/AX9gB39/f3x8fHwAAm4CES4vYmd6Zl93YXNtX2JnLmpzJ19fd2JnX19fd2JpbmRnZW5fdGhyb3dfMzQ0ZjQyZDMyMTFjNDc2NQAEES4vYmd6Zl93YXNtX2JnLmpzHF9fd2JnX0Vycm9yXzkyYjI5YjA1NDhmOGI3NDYABQNsawMODxAFCQINBwYJBAUEBAgFBQQKEAYEBwUEBAcEDAwGCgYEAgICDAIGBwQDBQMEBgYFBQsEAgYCAgQEBQMCAgEEAgUCBAYGDQIEBAcJAgQFBQYEBwADBQUEAAAE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ACyABKAIEIgJFDQAgACACIAEoAggQUwsLKwEBfyMAQRBrIgEkACABQRitQiCGIAFBD2qthDcDAEHUgcAAIAEgABAxAAsqAQF/IwBBEGsiAyQAIAMgAjYCDCADIAE2AgggAyAANgIEIANBBGoQZAALLQEBfyMAQRBrIgEkACABIAApAgA3AgggAUEIakGAlcAAIAAoAghBAUEAEBUACywCAX8BfiMAQRBrIgEkACAAKQIAIQIgASAANgIMIAEgAjcCBCABQQRqEGYACyMBAX8jAEEQayICJAAgAiABNgIMIAIgADYCCCACQQhqEGUACyAAAkAgASgCAEUNACAAQbiXwAA2AgQgACABNgIADwsACx4BAX8CQCAAKAIAIgJFDQAgASACIAAoAgQQTQ8LAAsbAQF/EGogAEEEakEEEFgiASAANgIAIAFBBGoLHgEBfwJAIAAoAgAiAUEBSA0AIAAoAgQgAUEBEFMLCx4AIAAoAgAgACgCBEEAKALomkAiAEEEIAAbEQQAAAsjAQF/AkBBhIrAABAtIgANAEG4icAAQTpB9InAABA4AAsgAAsXAAJAIABBf2pBfk8NACABIABBARBTCwscAQF/AkAgACgCACIBRQ0AIAAoAgQgAUEBEFMLCxcAAkAgAUEJSQ0AIAEgABAODwsgABACCxUAIABBfGoiACAAKAIAQQRqQQQQUwsUAAJAIABFDQAgACABEF8ACxBWAAsRACAAIAFBAXRBAXIgAhAxAAsSAAJAIAFFDQAgACABIAIQUwsLEgAgACABIAIgAyAEQQAgBRADCxUAAkAgAEUNACAAIAAoAqhaEQIACwsaACAAQQApAoSWQDcCCCAAQQApAvyVQDcCAAsaACAAQQApAvSVQDcCCCAAQQApAuyVQDcCAAsWACAAKAIAIAEgAiAAKAIEKAIMEQcACw0AIAAgASACIAMQBw8LFABBACAANgK8mkBBAEEBNgK4mkALEwAgAEG4l8AANgIEIAAgATYCAAsQACABIAAoAgAgACgCBBBNCxAAIAEgACgCACAAKAIEEAoLCwAgACABIAIQKg8LCgAgACABEGkaAAsPACAAQZyVwAAgASACEAwLEQBBkJjAAEEjQaSYwAA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mVlbiBsb2NrZWQgZm9yIHJlYWRpbmcAADUBEABdAAAAPgAAAAkAAABjYXBhY2l0eSBvdmVyZmxvdwAAAPsBEABQAAAAHAAAAAUAAAAwMDAxMDIwMzA0MDUwNjA3MDgwOTEwMTExMjEzMTQxNTE2MTcxODE5MjAyMTIyMjMyNDI1MjYyNzI4MjkzMDMxMzIzMzM0MzUzNjM3MzgzOTQwNDE0MjQzNDQ0NTQ2NDc0ODQ5NTA1MTUyNTM1NDU1NTY1NzU4NTk2MDYxNjI2MzY0NjU2NjY3Njg2OTcwNzE3MjczNzQ3NTc2Nzc3ODc5ODA4MTgyODM4NDg1ODY4Nzg4ODk5MDkxOTI5Mzk0OTU5Njk3OTg5OVJlZkNlbGwgYWxyZWFkeSBib3Jyb3dlZABBlJrAAAsYAAAAAAAAAAABAAAAAAAAAAEAAAAEAAAAACkEbmFtZQEiAVcfX193YmluZGdlbl9hZGRfdG9fc3RhY2tfcG9pbnRlcgBICXByb2R1Y2VycwEMcHJvY2Vzc2VkLWJ5AgZ3YWxydXMGMC4yNi40DHdhc20tYmluZGdlbhMwLjIuMTI2ICgyMWFjODA0YTkp\";\n;// ../src/wasm/bgzf_wasm_bg.js\nclass ChunkSliceResult {\n static __wrap(ptr) {\n const obj = Object.create(ChunkSliceResult.prototype);\n obj.__wbg_ptr = ptr;\n ChunkSliceResultFinalization.register(obj, obj.__wbg_ptr, obj);\n return obj;\n }\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n ChunkSliceResultFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_chunksliceresult_free(ptr, 0);\n }\n /**\n * @returns {Uint8Array}\n */\n take_buffer() {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n wasm.chunksliceresult_take_buffer(retptr, this.__wbg_ptr);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var v1 = getArrayU8FromWasm0(r0, r1).slice();\n wasm.__wbindgen_export(r0, r1 * 1, 1);\n return v1;\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n }\n /**\n * @returns {Float64Array}\n */\n take_cpositions() {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n wasm.chunksliceresult_take_cpositions(retptr, this.__wbg_ptr);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var v1 = getArrayF64FromWasm0(r0, r1).slice();\n wasm.__wbindgen_export(r0, r1 * 8, 8);\n return v1;\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n }\n /**\n * @returns {Float64Array}\n */\n take_dpositions() {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n wasm.chunksliceresult_take_dpositions(retptr, this.__wbg_ptr);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var v1 = getArrayF64FromWasm0(r0, r1).slice();\n wasm.__wbindgen_export(r0, r1 * 8, 8);\n return v1;\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n }\n}\nif (Symbol.dispose) ChunkSliceResult.prototype[Symbol.dispose] = ChunkSliceResult.prototype.free;\n\n/**\n * @param {Uint8Array} input\n * @returns {Uint8Array}\n */\nfunction decompress_all(input) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_export2);\n const len0 = WASM_VECTOR_LEN;\n wasm.decompress_all(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n if (r3) {\n throw takeObject(r2);\n }\n var v2 = getArrayU8FromWasm0(r0, r1).slice();\n wasm.__wbindgen_export(r0, r1 * 1, 1);\n return v2;\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\n/**\n * Decompress a slice of BGZF data between two virtual offsets.\n * Position parameters use f64 to map to JS number, supporting files >4GB.\n * The input buffer should be a slice starting at min_block_position in the original file.\n * Positions are tracked as f64 to preserve precision for large files.\n * @param {Uint8Array} input\n * @param {number} min_block_position\n * @param {number} min_data_position\n * @param {number} max_block_position\n * @param {number} max_data_position\n * @returns {ChunkSliceResult}\n */\nfunction decompress_chunk_slice(input, min_block_position, min_data_position, max_block_position, max_data_position) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_export2);\n const len0 = WASM_VECTOR_LEN;\n wasm.decompress_chunk_slice(retptr, ptr0, len0, min_block_position, min_data_position, max_block_position, max_data_position);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n if (r2) {\n throw takeObject(r1);\n }\n return ChunkSliceResult.__wrap(r0);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\nfunction __wbg_Error_92b29b0548f8b746(arg0, arg1) {\n const ret = Error(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n}\nfunction __wbg___wbindgen_throw_344f42d3211c4765(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n}\nconst ChunkSliceResultFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_chunksliceresult_free(ptr, 1));\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction dropObject(idx) {\n if (idx < 1028) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction getArrayF64FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n\nlet cachedDataViewMemory0 = null;\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nlet cachedFloat64ArrayMemory0 = null;\nfunction getFloat64ArrayMemory0() {\n if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {\n cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);\n }\n return cachedFloat64ArrayMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n return decodeText(ptr >>> 0, len);\n}\n\nlet cachedUint8ArrayMemory0 = null;\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nlet heap = new Array(1024).fill(undefined);\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1, 1) >>> 0;\n getUint8ArrayMemory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nlet cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\ncachedTextDecoder.decode();\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n numBytesDecoded += len;\n if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len).slice());\n}\n\nlet WASM_VECTOR_LEN = 0;\n\n\nlet wasm;\nfunction __wbg_set_wasm(val) {\n wasm = val;\n}\n\n;// ./src/wrapper.js\n// Import the WASM binary as base64 data URL\n\n\n\nlet wrapper_wasm = null\nlet initPromise = null\n\nasync function init() {\n if (wrapper_wasm) return wrapper_wasm\n\n if (!initPromise) {\n initPromise = (async () => {\n // wasmData is a data URL from asset/inline\n const response = await fetch(wasm_bgzf_wasm_bg_namespaceObject)\n const bytes = await response.arrayBuffer()\n const { instance } = await WebAssembly.instantiate(bytes, {\n './bgzf_wasm_bg.js': bgzf_wasm_bg_namespaceObject,\n })\n wrapper_wasm = instance.exports\n __wbg_set_wasm(wrapper_wasm)\n return wrapper_wasm\n })()\n }\n\n return initPromise\n}\n\nasync function decompressAll(input) {\n if (!wrapper_wasm) {\n await init()\n }\n return decompress_all(input)\n}\n\nasync function decompressChunkSlice(\n input,\n minBlockPosition,\n minDataPosition,\n maxBlockPosition,\n maxDataPosition,\n) {\n if (!wrapper_wasm) {\n await init()\n }\n const result = decompress_chunk_slice(\n input,\n minBlockPosition,\n minDataPosition,\n maxBlockPosition,\n maxDataPosition,\n )\n // The take_* accessors already copy out of the wasm heap \u2014 wasm-bindgen\n // emits `getArrayF64FromWasm0(...).slice()` \u2014 so the returned typed arrays\n // own their bytes and stay valid after free() and after the heap grows.\n // Spreading them into plain arrays was therefore a second copy of every\n // block offset, for consumers (tabix-js, bam-js) that only index them.\n const buffer = result.take_buffer()\n const cpositions = result.take_cpositions()\n const dpositions = result.take_dpositions()\n result.free()\n return { buffer, cpositions, dpositions }\n}\n\n\n\n\nexport { decompressAll, decompressChunkSlice };\n", "import { ungzip } from 'pako-esm2'\n\nimport { scanBgzfBlocks } from './bgzfBlockScan.ts'\nimport { concatUint8Array } from './util.ts'\nimport {\n decompressAll,\n decompressChunkSlice,\n} from './wasm/bgzf-wasm-inlined.js'\n\nimport type { BgzfBlockInfo } from './bgzfBlockScan.ts'\nimport type { BgzfWorkerPool } from './workerPool.ts'\n\n/**\n * A position in the uncompressed data: which BGZF block (by its compressed\n * offset in the file), and how far into that block's decompressed bytes.\n */\nexport interface VirtualOffset {\n blockPosition: number\n dataPosition: number\n}\n\n/**\n * A range between two virtual offsets \u2014 what a BAI or TBI resolves a query to.\n * It covers a run of consecutive BGZF blocks and usually starts and ends\n * partway through the first and last of them.\n */\nexport interface Chunk {\n minv: VirtualOffset\n maxv: VirtualOffset\n}\n\nconst BGZF_MIN_BLOCK_SIZE = 26\n\nfunction hasGzipHeader(data: Uint8Array) {\n return data[0] === 0x1f && data[1] === 0x8b\n}\n\n// Mirrors the header check in the wasm `parse_block`: gzip magic, deflate\n// method, FEXTRA flag, XLEN=6 and the 'BC' extra-subfield id. Checked here so\n// non-bgzf input never reaches wasm \u2014 see the comment in unzip().\nfunction hasBgzfHeader(data: Uint8Array) {\n return (\n data.length >= BGZF_MIN_BLOCK_SIZE &&\n hasGzipHeader(data) &&\n data[2] === 8 &&\n data[3] === 4 &&\n data[10] === 6 &&\n data[12] === 0x42 &&\n data[13] === 0x43\n )\n}\n\nfunction errorMessage(error: unknown) {\n return error instanceof Error ? error.message : `${error}`\n}\n\nasync function decompressGzip(inputData: Uint8Array) {\n if (typeof DecompressionStream !== 'undefined') {\n const stream = new Blob([inputData as Uint8Array<ArrayBuffer>])\n .stream()\n .pipeThrough(new DecompressionStream('gzip'))\n return new Uint8Array(await new Response(stream).arrayBuffer())\n } else {\n return ungzip(inputData, undefined)\n }\n}\n\nfunction wrapGzipHeaderError(error: unknown) {\n if (errorMessage(error).includes('invalid gzip header')) {\n return new Error(\n 'problem decompressing block: incorrect gzip header check',\n { cause: error },\n )\n }\n return error\n}\n\n// The return type is annotated rather than inferred. `decompressAll` comes from\n// the inlined wasm bundle, which is untyped JS, so inference makes this\n// `Promise<any>` \u2014 and that `any` is published in the .d.ts and flows straight\n// into consumers (@gmod/bam's csi.ts reads .buffer/.byteOffset/.subarray off it\n// completely unchecked). The Rust returns `Vec<u8>`, i.e. a Uint8Array.\nexport async function unzip(inputData: Uint8Array): Promise<Uint8Array> {\n // Reading past EOF yields an empty buffer; decompressing nothing is nothing\n // rather than an error.\n if (inputData.length === 0) {\n return new Uint8Array(0)\n }\n // Sniff the header in JS before handing off to wasm. Calling into wasm\n // copies the whole input into the wasm heap, and that heap can only grow \u2014\n // so routing a plain (non-bgzf) gzip file through wasm just to have it\n // rejected would permanently reserve the file's full size.\n if (!hasBgzfHeader(inputData)) {\n if (hasGzipHeader(inputData)) {\n return decompressGzip(inputData)\n }\n throw new Error(\n 'problem decompressing block: not a valid bgzf or gzip block',\n )\n }\n try {\n return await decompressAll(inputData)\n } catch (error) {\n // A valid-looking header that wasm still rejects means the first block is\n // truncated; the generic gzip path gives a better error for that.\n if (errorMessage(error).includes('invalid bgzf header')) {\n return decompressGzip(inputData)\n }\n throw wrapGzipHeaderError(error)\n }\n}\n\n/**\n * A decompressed BGZF chunk plus, per block it spans, that block's compressed\n * offset in the file (`cpositions`) and its uncompressed offset within the\n * chunk (`dpositions`). Together they let a caller turn a byte offset in\n * `buffer` back into a virtual file offset \u2014 see @gmod/tabix and @gmod/bam.\n *\n * Annotated rather than inferred, for the same reason as {@link unzip}: it is\n * derived from the untyped inlined-wasm bundle, and whatever tsc makes of that\n * is what gets published in the .d.ts.\n */\nexport interface ChunkSlice {\n buffer: Uint8Array\n cpositions: Float64Array\n dpositions: Float64Array\n}\n\n/**\n * Reassemble a chunk slice from independently decompressed blocks.\n *\n * Mirrors what `decompress_chunk_slice` does in wasm: trim the first block to\n * `minv.dataPosition` and the last to `maxv.dataPosition`, and record each\n * block's compressed offset and its uncompressed offset within the result.\n */\nfunction assembleChunkSliceResult(\n blocks: Uint8Array[],\n infos: BgzfBlockInfo[],\n minv: VirtualOffset,\n maxv: VirtualOffset,\n): ChunkSlice {\n const cpositions: number[] = []\n const dpositions: number[] = []\n const slices: Uint8Array[] = []\n let dpos = minv.dataPosition\n\n for (let i = 0; i < blocks.length; i++) {\n const block = blocks[i]!\n const info = infos[i]!\n const isLast = info.filePosition >= maxv.blockPosition\n\n cpositions.push(info.filePosition)\n dpositions.push(dpos)\n\n const start = i === 0 ? minv.dataPosition : 0\n const end = isLast\n ? Math.min(maxv.dataPosition + 1, block.length)\n : block.length\n if (start < end) {\n slices.push(block.subarray(start, end))\n }\n dpos += block.length - start\n\n if (isLast) {\n cpositions.push(info.filePosition + info.compressedSize)\n dpositions.push(dpos)\n break\n }\n }\n\n return {\n buffer: concatUint8Array(slices),\n // Float64Array to match the wasm path's shape exactly \u2014 a caller must not\n // be able to tell which one produced its result\n cpositions: Float64Array.from(cpositions),\n dpositions: Float64Array.from(dpositions),\n }\n}\n\n/**\n * The smallest chunk, in inflated bytes, that `unzipChunkSlice` hands to a\n * pool. Below it the round trip and the input copy cost more than the\n * parallelism returns: in the chunk-size table in docs/worker-pool.md every BAM\n * fixture turned positive by eight blocks, 0.4-0.5MB out, and at two to four\n * blocks most lost. A reader that only ever asks for smaller chunks never boots\n * a shared pool's workers at all.\n */\nexport const POOL_MIN_DECOMPRESSED_BYTES = 400_000\n\nfunction decompressedBytes(blocks: BgzfBlockInfo[]) {\n let total = 0\n for (const block of blocks) {\n total += block.decompressedSize\n }\n return total\n}\n\nexport async function unzipChunkSlice(\n inputData: Uint8Array,\n chunk: Chunk,\n workerPool?: BgzfWorkerPool,\n): Promise<ChunkSlice> {\n const { minv, maxv } = chunk\n\n if (workerPool) {\n const blocks = scanBgzfBlocks(\n inputData,\n minv.blockPosition,\n maxv.blockPosition,\n )\n if (decompressedBytes(blocks) >= POOL_MIN_DECOMPRESSED_BYTES) {\n const result = await workerPool.decompressBlocks(inputData, blocks)\n return assembleChunkSliceResult(result.blocks, blocks, minv, maxv)\n }\n }\n\n try {\n const result = await decompressChunkSlice(\n inputData,\n minv.blockPosition,\n minv.dataPosition,\n maxv.blockPosition,\n maxv.dataPosition,\n )\n return {\n buffer: result.buffer,\n cpositions: result.cpositions,\n dpositions: result.dpositions,\n }\n } catch (error) {\n throw wrapGzipHeaderError(error)\n }\n}\n", "/**\n * Throws if `signal` has been aborted, matching the semantics of\n * `signal.throwIfAborted()` without requiring either that method or `reason`.\n *\n * Two reasons not to call the built-in directly. It assumes a *real*\n * `AbortSignal`, and callers pass duck-typed ones \u2014 `@gmod/bam`'s\n * `test/csi.test.ts` casts a bare `{ aborted }` through `as AbortSignal`, which\n * is a fair model of what consumers do. Calling a missing method there is a\n * `TypeError` rather than the cancellation the caller asked for, which is a\n * strictly worse failure.\n *\n * And it sets a browser floor. `AbortSignal.prototype.throwIfAborted` and\n * `AbortSignal.reason` are Safari 15.4 / Chrome 100 / Firefox 97 (March 2022),\n * higher than the consumers of this package otherwise need \u2014 they touch only\n * `.aborted`, and `generic-filehandle2` only forwards a signal to `fetch`. A\n * few lines here keep that floor where it was.\n */\nexport function throwIfAborted(signal?: AbortSignal) {\n if (signal?.aborted) {\n throw abortReason(signal)\n }\n}\n\n/**\n * What an aborted `signal` should be reported as.\n *\n * Spec-faithful: `throwIfAborted` throws `reason` verbatim, and `reason` is\n * whatever the caller passed to abort() \u2014 `controller.abort('too slow')` makes\n * it a string. Coercing it to an Error here would hide that from a consumer who\n * set it deliberately.\n *\n * Separate from the throw so a caller that has to *reject* with it rather than\n * throw it reports cancellation identically; see `SharedReadCache.settleFor`.\n *\n * Annotated `unknown` rather than inferred, because the inference narrows to\n * something only-throw-error rejects and this value is thrown.\n */\nexport function abortReason(signal: AbortSignal): unknown {\n const reason: unknown = signal.reason\n return reason === undefined\n ? new DOMException('This operation was aborted', 'AbortError')\n : reason\n}\n", "import { abortReason, throwIfAborted } from './throwIfAborted.ts'\n\nimport type { BudgetMember, SharedBudget } from './SharedBudget.ts'\n\n/**\n * Node holds the process open for a pending interval, and a library's\n * housekeeping timer must never be the reason a script fails to exit.\n *\n * Duck-typed rather than cast, because the return of `setInterval` is a\n * `Timeout` object in Node and a plain number in browsers and workers, and this\n * package is built once for both.\n */\nfunction unrefIfPossible(timer: unknown) {\n if (\n typeof timer === 'object' &&\n timer !== null &&\n 'unref' in timer &&\n typeof timer.unref === 'function'\n ) {\n timer.unref()\n }\n}\n\ninterface Entry<V> {\n promise: Promise<V>\n /**\n * Signals of the callers still waiting on this read. The read is cancelled\n * only once every one of them has given up \u2014 see {@link SharedReadCache.join}.\n */\n signals: Set<AbortSignal>\n /** true once a caller joins without a signal, which pins the read */\n pinned: boolean\n /** aborts when every caller has given up; what the read actually runs under */\n controller: AbortController\n /** aborted to take this read's listeners back off its callers' signals */\n dispose: AbortController\n settled: boolean\n /**\n * true while this read is counted in {@link SharedReadCache.pending}, which\n * is what the batch policy waits on. Cleared when the read settles, and\n * early if the cache drops it or every caller gives up \u2014 see\n * {@link SharedReadCache.detach}.\n */\n counted: boolean\n /** 0 until the read settles and the value can be weighed */\n size: number\n /**\n * The batch this entry was last touched by; only meaningful under the batch\n * policy, which spares everything carrying the batch in flight's number.\n * Compared against a counter rather than cleared entry by entry, so ending a\n * batch is O(1) instead of O(entries).\n */\n batch: number\n /**\n * `Date.now()` at the last {@link SharedReadCache.get} or\n * {@link SharedReadCache.getIfCached} that resolved to this entry.\n * Only meaningful when {@link SharedReadCacheOptions.idleTimeoutMs} is set.\n */\n lastTouched: number\n /**\n * This cache's budget's stamp at the same moment, for the cross-cache LRU\n * order that budget evicts by; 0 when there is no budget, which is when\n * nothing compares entries across caches. See {@link SharedBudget.nextSeq}.\n */\n seq: number\n}\n\nexport interface SharedReadCacheOptions<K, V> {\n /**\n * Performs the read. It is handed the *shared* signal, which fires only once\n * every caller waiting on this key has aborted \u2014 never one caller's own.\n *\n * Optional, because a caller whose read differs per key \u2014 a closure over the\n * thing being read, rather than a function of the key \u2014 can pass it to\n * {@link SharedReadCache.get} instead. One of the two must be present.\n */\n fill?: (key: K, signal: AbortSignal) => Promise<V>\n\n /**\n * Budget, in whatever unit {@link sizeOf} returns. Defaults to `Infinity`:\n * this package does not prescribe a limit, because what a sensible one is\n * depends entirely on what is being cached.\n *\n * Note what a budget does and does not do. It bounds *retained* memory, not\n * request size: a value larger than the whole budget is still kept, reads in\n * flight are never evicted, and eviction only ever discards a value already\n * returned once. So nothing is refused for being too large, and the worst a\n * budget can cost is a re-read.\n *\n * Unbounded is therefore the permissive default, not the safe one. A cache\n * with no budget grows for the life of the object \u2014 @gmod/tabix measured 2GB\n * RSS panning a dense VCF before it bounded this. Pass one if the values are\n * large or the object is long-lived.\n *\n * Settable later: lowering it evicts immediately rather than waiting for the\n * next read, which is what a consumer shedding memory under pressure needs.\n */\n maxSize?: number\n\n /**\n * Weighs a settled value against `maxSize`. Defaults to 1, making the budget\n * an entry count.\n *\n * This is the parameter the whole package exists for. Every hand-rolled copy\n * of this cache across the gmod repos was identical except here: @gmod/bam\n * and @gmod/tabix weigh decompressed bytes, @gmod/bbi weighs entries, and\n * @gmod/cram weighs decoded records. An entry cannot be weighed until its\n * read settles, so a cache that does this has to own its entries \u2014 which is\n * exactly why those four could not share a plain-LRU-backed package and each\n * wrote their own.\n */\n sizeOf?: (value: V) => number\n\n /** Maps a key to its cache key. Defaults to `String(key)`. */\n cacheKey?: (key: K) => string\n\n /**\n * When to evict. Defaults to `'lru'`.\n *\n * `'lru'` evicts as each read settles, so the budget is a hard ceiling.\n *\n * `'batch'` waits until no reads are in flight and then spares everything\n * that batch touched. The case for it: a single request that starts many\n * reads at once and holds all of their values until it returns: evicting one\n * mid-request frees nothing, because the caller is still holding it, but it\n * does guarantee the next identical request re-reads it.\n *\n * **Try a bigger {@link maxSize} first.** @gmod/cram adopted `'batch'` on a\n * 117ms-against-12ms measurement and then dropped it again, and the sequence\n * is the useful part. That measurement was taken with a budget 2.75x *below*\n * the request's working set. Raising the budget above the working set made\n * the two policies measurably identical \u2014 same re-read counts, times inside\n * noise \u2014 because a request that fits has nothing to evict mid-flight\n * whichever policy is in force. @gmod/bam measured the same thing from the\n * other side: on a pan workload over an undersized budget, `'batch'` did not\n * rescue it at all, matching `'lru'` re-read for re-read while retaining 1.7x\n * the memory.\n *\n * So `'batch'` only changes anything when a batch exceeds the budget, and\n * what it does there is exceed the budget: cram measured it holding 420,000\n * records against a stated limit of 20,000. That is the documented trade \u2014 a\n * batch touching more than the whole budget leaves the cache over it until\n * the next batch lands \u2014 and it is worth being clear that it is the whole\n * mechanism, not a side effect. A consumer lowering the budget to constrain\n * memory will not get what it asked for.\n *\n * Reach for it when a too-small budget is genuinely forced on you and the\n * workload is repeated identical requests. Otherwise size the budget above\n * one request and leave this alone.\n */\n evictionPolicy?: 'lru' | 'batch'\n /**\n * A budget shared with other caches, evicted globally least-recently-used\n * across all of them. Defaults to none.\n *\n * Composes with {@link maxSize} rather than replacing it: the per-cache\n * ceiling still applies, and a cache that passes only a budget is unbounded\n * on its own and bounded in aggregate \u2014 usually what you want, since the\n * point of sharing is to let one busy member use most of the total.\n *\n * Reach for it when the number of caches is a property of the workload\n * rather than of the code. A per-cache ceiling sized so that one cache never\n * thrashes is, by construction, not a bound on N of them; see\n * {@link SharedBudget} for what that measured.\n */\n budget?: SharedBudget\n /**\n * Drop an entry once nothing has asked for it for this many milliseconds.\n * Defaults to no idle eviction.\n *\n * This is the only reclamation that happens while a consumer sits still.\n * {@link maxSize} is enforced when a read settles, so an idle cache stays at\n * whatever it reached and never gives it back \u2014 fine for a short-lived\n * object, expensive for one that lives as long as its UI does. A genome\n * browser parked on a region holds its whole last view indefinitely, times\n * every open track.\n *\n * The two compose and answer different questions. `maxSize` is the ceiling\n * under load, and wants to be generous: set below one request's working set\n * it does not cache less, it caches *nothing*, evicting each value before the\n * next request can reuse it while still retaining the ones in flight.\n * `idleTimeoutMs` is what makes a generous ceiling affordable, by making it a\n * peak rather than a resting level.\n *\n * Measured from the last **read** of an entry, or from its fill settling if\n * nothing has read it since: something fetched once and used every second is\n * not idle, and an absolute expiry would throw it away mid-use for no reason.\n * The clock never starts before the value exists, so however long a read\n * takes it still gets the full timeout to be reused in.\n *\n * Reads still in flight are never swept, on the same grounds as eviction \u2014\n * they have no weight to reclaim and dropping one would lose the\n * de-duplication every caller joined to it is relying on.\n */\n idleTimeoutMs?: number\n}\n\n/**\n * One read per key, shared by every caller that asks for it while it is in\n * flight, with a bounded cache of the results.\n *\n * ## Why not a memoized promise\n *\n * Memoizing a bare promise built from the *first* caller's signal makes that\n * caller's abort reject everyone else awaiting it. In a genome browser, panning\n * away from one block then fails its still-wanted siblings. Here the read runs\n * under a controller of its own, and a caller's abort is reported to that\n * caller alone.\n *\n * ## The cancellation rule\n *\n * A read is cancelled only once **every** caller waiting on it has given up. A\n * caller with no signal cannot give up, so it pins the read \u2014 the honest\n * reading of a caller that never asked to be cancellable, and the reason one\n * signal-free consumer makes a read uncancellable for everyone joined to it. A\n * duck-typed signal with no `addEventListener` pins it for the same reason \u2014\n * nothing here can learn when such a caller gives up \u2014 and is still told about\n * its own cancellation once the read settles.\n *\n * A rejection is dropped rather than cached, so one transient failure does not\n * poison the key for the life of the cache.\n *\n * ## On \"LRU\"\n *\n * With no {@link SharedReadCacheOptions.maxSize} nothing is ever evicted, so\n * this is a shared-read memo and not an LRU at all \u2014 least-recently-used is an\n * *eviction order*, and there is no eviction to order. Recency is still tracked\n * while unbounded, cheaply, so that imposing a budget later evicts the right\n * entries rather than the oldest-inserted ones.\n */\nexport class SharedReadCache<K, V> implements BudgetMember {\n private entries = new Map<string, Entry<V>>()\n private total = 0\n /**\n * How many of {@link entries} have settled. Maintained rather than counted,\n * because {@link evict} needs it on every settle and a cache sitting at its\n * ceiling is over the limit on every settle \u2014 so the O(entries) count it\n * replaces was the steady-state cost of having a budget at all. That count\n * measured 8.6us per read over 100 entries and 134us over 20,000; maintaining\n * it instead holds 7.4us and 14us across the same range.\n */\n private settledCount = 0\n private limit: number\n private budget?: SharedBudget\n /** how this cache reports its weight to {@link budget}; see SharedBudget */\n private membership?: ReturnType<SharedBudget['register']>\n private fill?: (key: K, signal: AbortSignal) => Promise<V>\n private sizeOf: (value: V) => number\n private toCacheKey: (key: K) => string\n private evictionPolicy: 'lru' | 'batch'\n /** reads still in flight, so the batch policy knows when the batch is done */\n private pending = 0\n /** the batch in flight; see {@link Entry.batch} */\n private batch = 0\n private idleTimeoutMs?: number\n private sweepTimer?: ReturnType<typeof setInterval>\n\n constructor({\n fill,\n maxSize = Infinity,\n sizeOf = () => 1,\n cacheKey = (key: K) => String(key),\n evictionPolicy = 'lru',\n idleTimeoutMs = 0,\n budget,\n // Defaulted, because a cache with no options at all is a real shape and a\n // common one: the memo, whose fill is a closure passed per get() call. Five\n // of these exist across @gmod/bam, @gmod/tabix and indexedfasta-js, and\n // every one of them was written `new SharedReadCache({})`.\n }: SharedReadCacheOptions<K, V> = {}) {\n this.fill = fill\n this.evictionPolicy = evictionPolicy\n this.limit = maxSize\n this.budget = budget\n this.membership = budget?.register(this)\n this.sizeOf = sizeOf\n this.toCacheKey = cacheKey\n // 0, undefined and a nonsense negative all mean \"no idle eviction\", so the\n // rest of the class has one thing to check rather than three\n this.idleTimeoutMs = idleTimeoutMs > 0 ? idleTimeoutMs : undefined\n }\n\n /** Number of entries held, including reads still in flight. */\n get size() {\n return this.entries.size\n }\n\n /** Sum of {@link SharedReadCacheOptions.sizeOf} over the settled entries. */\n get totalSize() {\n return this.total\n }\n\n get maxSize() {\n return this.limit\n }\n\n /**\n * Accessor rather than a plain field so lowering the budget frees memory now.\n * As a field it did nothing until the next read happened to run the eviction\n * loop, which on an idle consumer is never.\n */\n set maxSize(maxSize: number) {\n this.limit = maxSize\n this.evict()\n }\n\n /**\n * How many caller signals the entry under `key` is still holding. Exposed for\n * tests: an entry that has leaked a thousand stale signals answers every read\n * exactly like one that has not, so nothing else would notice.\n */\n waiterCount(key: K) {\n return this.entries.get(this.toCacheKey(key))?.signals.size ?? 0\n }\n\n async get(\n key: K,\n signal?: AbortSignal,\n fill?: (signal: AbortSignal) => Promise<V>,\n ) {\n // Before anything else, including the cache hit. A caller can reach here\n // with a signal that has already fired \u2014 the abort lands while some earlier\n // await is still in flight and nothing in between looks at it. Such a\n // caller must not start a read it has no interest in, and must not be\n // registered as a waiter on someone else's: see join().\n throwIfAborted(signal)\n\n const cacheKey = this.toCacheKey(key)\n let entry = this.entries.get(cacheKey)\n if (entry) {\n // A read every caller has abandoned is on its way out but may not have\n // noticed yet. Start a fresh one rather than join one already doomed \u2014\n // joining it means inheriting a cancellation nothing to do with us.\n if (this.isDoomed(entry)) {\n this.deleteKey(cacheKey)\n entry = undefined\n } else {\n this.touch(cacheKey, entry)\n }\n }\n entry ??= this.start(cacheKey, key, fill)\n // Only a read still running has anything to cancel. Joining a settled one\n // would add this caller to a set nothing will ever take it out of, since\n // the entry drops its abort listeners when it settles.\n if (!entry.settled) {\n this.join(entry, signal)\n }\n\n try {\n const value = await this.settleFor(entry, signal)\n // the read finished, but this caller gave up while waiting for it\n throwIfAborted(signal)\n return value\n } catch (e) {\n // Prefer this caller's own cancellation to whatever the shared read\n // reported. If we asked to stop, that is the answer we want \u2014 and when\n // the read itself was cancelled it is because we, and everyone else,\n // asked it to.\n throwIfAborted(signal)\n throw e\n }\n }\n\n /**\n * The shared read, but a caller that gives up while it is still running is\n * released now rather than whenever that read lands.\n *\n * Awaiting `entry.promise` alone made abort() a request rather than an\n * answer. The read is shared, so one caller aborting deliberately does not\n * stop it \u2014 which left that caller pending until every *other* waiter was\n * done: two callers on a 30s read, one aborts, and it waits the full 30s to\n * be told about a cancellation it asked for itself. A fill that ignores the\n * signal \u2014 a stalled fetch \u2014 never released it at all. Panning a genome\n * browser is exactly this shape, since the abandoned blocks are the ones\n * whose siblings are still wanted.\n *\n * Only for a read still in flight, and only for a signal that can be\n * subscribed to. A settled entry has nothing left to wait for, and nothing\n * here can learn when a duck-typed signal fires; both fall back to the\n * post-await {@link throwIfAborted} in {@link get}, which is all either ever\n * needed.\n */\n private settleFor(entry: Entry<V>, signal?: AbortSignal) {\n if (\n entry.settled ||\n signal === undefined ||\n typeof signal.addEventListener !== 'function'\n ) {\n return entry.promise\n }\n // Aborted once the race is decided, to take this listener back off the\n // caller's signal. Without it a long-lived signal collects one listener per\n // get() it ever made, which is the leak {@link Entry.dispose} exists to\n // avoid on the other listener.\n const unsubscribe = new AbortController()\n return Promise.race([\n // Losing this race leaves `entry.promise` unobserved here, which is safe\n // only because start() attaches its own handlers to it \u2014 otherwise a read\n // that failed after its last caller walked away would surface as an\n // unhandled rejection.\n entry.promise,\n new Promise<never>((_resolve, reject) => {\n signal.addEventListener(\n 'abort',\n () => {\n // the caller's own reason, verbatim, exactly as throwIfAborted\n // would have thrown it -- see abortReason\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(abortReason(signal))\n },\n { once: true, signal: unsubscribe.signal },\n )\n }),\n ]).finally(() => {\n unsubscribe.abort()\n })\n }\n\n /**\n * The promise cached under `key`, or `undefined` if there is none.\n *\n * Marks the entry most-recently-used, exactly as {@link get} does: this is a\n * lookup that happens not to start a read, not an inspection. Use\n * {@link has} if you need to ask without touching the LRU order.\n *\n * The promise is the shared one, so awaiting it does not register the caller\n * as a waiter and its rejection is not re-reported per caller. Callers that\n * want either should use {@link get}.\n *\n * `undefined` too for a read every caller has already abandoned, which is not\n * a cached value but a rejection that has not landed yet.\n */\n getIfCached(key: K) {\n const cacheKey = this.toCacheKey(key)\n const entry = this.entries.get(cacheKey)\n if (!entry) {\n return undefined\n }\n // A read every caller has abandoned is not a cached value, it is a\n // rejection on its way to happening. Handing it back gives this caller\n // someone else's cancellation, which it has no way to read as anything but\n // a failed read \u2014 so answer as if the entry were not here, which is what\n // get() effectively does by starting a fresh read in its place.\n if (this.isDoomed(entry)) {\n this.deleteKey(cacheKey)\n return undefined\n }\n this.touch(cacheKey, entry)\n return entry.promise\n }\n\n has(key: K) {\n const entry = this.entries.get(this.toCacheKey(key))\n // A read every caller has abandoned is not a cached value, so `has` says so\n // \u2014 {@link get} would start a fresh read for it and {@link getIfCached}\n // would answer `undefined`, and three lookups disagreeing about one key is\n // no use to anyone. Unlike those two this does not drop the entry, because\n // this is the one lookup that leaves the cache alone.\n return entry !== undefined && !this.isDoomed(entry)\n }\n\n delete(key: K) {\n this.deleteKey(this.toCacheKey(key))\n }\n\n clear() {\n for (const entry of this.entries.values()) {\n this.detach(entry)\n }\n this.entries.clear()\n this.charge(-this.total)\n this.total = 0\n this.settledCount = 0\n this.stopSweep()\n }\n\n /**\n * Mark an entry most-recently-used, in both orders that word has here: its\n * position in {@link entries}, which {@link evict} and {@link lruSpare} walk,\n * and its {@link Entry.seq}, which {@link SharedBudget} compares across\n * caches.\n *\n * The two have to move together, and this is the only place either moves\n * after {@link start} places a new entry at the front with a matching seq \u2014\n * which is the point of it being one function. {@link lruSpare} takes an\n * entry from map order and reports *its* seq, so the budget's claim to evict\n * the globally least-recently-used entry holds only while the two orders\n * agree. They did not: settling stamped a fresh seq without moving the entry,\n * so any read that settled out of the order it was started in left its cache\n * offering the budget a seq belonging to some other entry.\n */\n private touch(cacheKey: string, entry: Entry<V>) {\n // re-insert so Map iteration order stays least-recently-used first\n this.entries.delete(cacheKey)\n this.entries.set(cacheKey, entry)\n entry.batch = this.batch\n entry.lastTouched = Date.now()\n entry.seq = this.stamp()\n }\n\n /**\n * This entry's place in the recency order {@link SharedBudget} evicts by.\n * Only a budget compares these, so a cache without one has no order to keep.\n */\n private stamp() {\n return this.budget ? this.budget.nextSeq() : 0\n }\n\n /** In flight, but every caller waiting on it has already given up. */\n private isDoomed(entry: Entry<V>) {\n return !entry.settled && entry.controller.signal.aborted\n }\n\n /**\n * Evict entries nothing has read for {@link SharedReadCacheOptions.idleTimeoutMs}.\n *\n * Exposed so a consumer can reclaim on its own schedule \u2014 a browser tab going\n * hidden, say \u2014 rather than only on the interval. A no-op when no idle\n * timeout is configured.\n */\n sweepIdle() {\n const timeout = this.idleTimeoutMs\n if (timeout === undefined) {\n return\n }\n const cutoff = Date.now() - timeout\n let sweepable = 0\n for (const [cacheKey, entry] of this.entries) {\n // in-flight entries are skipped for the same reason evict() skips them:\n // no weight to reclaim, and dropping one loses the de-duplication its\n // waiters joined for\n if (!entry.settled) {\n continue\n }\n if (entry.lastTouched <= cutoff) {\n this.deleteKey(cacheKey)\n } else {\n sweepable++\n }\n }\n // Stop when nothing SETTLED is left, rather than when the map is empty. A\n // read that never settles \u2014 a stalled fetch on a dead connection, which is\n // exactly when a consumer gives up and drops the cache \u2014 is never swept, so\n // `entries.size` never reached zero and the timer ticked forever. Since the\n // timer roots this cache, and this cache roots whatever its fill closes\n // over, that one hung read pinned the whole graph indefinitely. Should it\n // ever settle, settle() arms the timer again.\n if (sweepable === 0) {\n this.stopSweep()\n }\n }\n\n // The sweep runs on an interval because it is the one form of reclamation\n // that has to happen when nothing is calling in \u2014 a lazy check on get() would\n // never fire on precisely the idle consumer this exists for.\n //\n // It runs exactly when there is something it could reclaim: armed by the\n // first read to SETTLE, stopped by the first sweep that finds no settled\n // entry left. In-flight reads arm nothing, because the sweep would skip them\n // anyway. That is also what makes a dispose() method unnecessary. A consumer\n // that drops the cache without clearing it leaves one timer alive for at most\n // a timeout plus a sweep interval, after which the sweep reclaims what it can\n // and stops itself, and the whole thing becomes garbage.\n private startSweep() {\n const timeout = this.idleTimeoutMs\n if (timeout === undefined || this.sweepTimer !== undefined) {\n return\n }\n // a fraction of the timeout, so the lag between an entry going idle and\n // being reclaimed is bounded by ~1.25x it rather than 2x\n const interval = Math.max(1000, Math.floor(timeout / 4))\n this.sweepTimer = setInterval(() => {\n this.sweepIdle()\n }, interval)\n unrefIfPossible(this.sweepTimer)\n }\n\n private stopSweep() {\n if (this.sweepTimer !== undefined) {\n clearInterval(this.sweepTimer)\n this.sweepTimer = undefined\n }\n }\n\n // The read runs under the entry's own controller rather than any one caller's\n // signal, because the read is shared: it must survive until every caller\n // waiting on it has given up. join() is what registers them.\n private start(\n cacheKey: string,\n key: K,\n fill?: (signal: AbortSignal) => Promise<V>,\n ) {\n const run = fill ?? (this.fill && ((s: AbortSignal) => this.fill!(key, s)))\n if (!run) {\n throw new Error(\n 'SharedReadCache needs a fill, either on the cache or on the get() call',\n )\n }\n const controller = new AbortController()\n const entry: Entry<V> = {\n promise: run(controller.signal),\n signals: new Set(),\n pinned: false,\n controller,\n dispose: new AbortController(),\n settled: false,\n counted: true,\n size: 0,\n batch: this.batch,\n lastTouched: Date.now(),\n seq: this.stamp(),\n }\n this.entries.set(cacheKey, entry)\n this.pending++\n const settle = () => {\n entry.settled = true\n this.detach(entry)\n // nothing reads these once the read has settled, and holding them would\n // pin each caller's AbortController behind this entry\n entry.dispose.abort()\n entry.signals.clear()\n }\n // `.then(f, g)` rather than `.finally(f)` so the handler's own promise never\n // carries an unhandled rejection.\n void entry.promise.then(\n value => {\n settle()\n // a later read may have replaced this key while this one was in\n // flight; charging its weight to that entry would double-count\n if (this.entries.get(cacheKey) === entry) {\n const size = this.weigh(value)\n if (size === undefined) {\n // Not deleteKey: that credits back a settled entry, and this one\n // was never counted as one. Dropped rather than kept at zero, so\n // nothing the budget cannot see is retained.\n this.entries.delete(cacheKey)\n } else {\n // The idle clock starts when the value exists, not when the read\n // for it began. Stamped only at start(), an entry lost its whole\n // fill duration out of its idle budget \u2014 and one whose fill outran\n // idleTimeoutMs arrived already expired, swept on the very next\n // tick, so the query that paid for that read never got a single hit\n // off it.\n //\n // Deliberately not a touch(). \"How long since\" and \"which came\n // first\" are different questions, and only the first is about the\n // value existing: a read's *latency* is a property of the\n // transport, not of how the consumer is using the cache, so\n // ordering evictions by it preferentially keeps whatever was\n // slowest to arrive. In @gmod/tabix that is the largest chunk in\n // the query, which is the last thing a budget should retain.\n entry.lastTouched = Date.now()\n this.settledCount++\n entry.size = size\n this.total += size\n this.charge(size)\n // the first thing the sweep could actually reclaim, so this is\n // where the timer belongs \u2014 see startSweep\n this.startSweep()\n }\n }\n this.maybeEvict()\n },\n () => {\n // a failed read caches nothing, so the next caller starts over rather\n // than inheriting the failure. Dropped before settle() marks it, so it\n // is never one of the settledCount entries deleteKey credits back.\n if (this.entries.get(cacheKey) === entry) {\n this.deleteKey(cacheKey)\n }\n settle()\n this.maybeEvict()\n },\n )\n return entry\n }\n\n /**\n * {@link SharedReadCacheOptions.sizeOf}, checked \u2014 `undefined` when it does\n * not answer with a weight, which drops the entry rather than keeping one the\n * budget cannot see.\n *\n * It has to be checked because it is consumer code over consumer values.\n * `v => v.byteLength` throws on a null value and returns `undefined` on a\n * value without the field, and arithmetic turns the latter into `NaN` rather\n * than an error. `NaN` in `total` is permanent: `total <= limit` is false\n * forever after, so every settle evicts down to the last entry and the cache\n * silently stops caching. Measured at five entries against a `maxSize` of 100\n * collapsing to one.\n *\n * Swallowed rather than rethrown, which is the part worth defending. Thrown\n * from here it would reject a promise nothing holds \u2014 `unhandledRejection`,\n * and so the end of the process. Carried into the entry's own promise it\n * would fail the read for its callers, and that was tried: it made\n * `getIfCached` hand back a chained promise rather than the one the fill\n * returned, and pushed this bookkeeping a microtask later than the fill's own\n * promise, so a consumer awaiting that and reading `totalSize` saw the last\n * read missing. @gmod/cram caught both. Neither is a price worth paying to\n * report a bug in a caller's `sizeOf`, when the read itself succeeded and the\n * caller already has its value \u2014 so the value is served and simply not kept.\n */\n private weigh(value: V) {\n try {\n const size = this.sizeOf(value)\n return Number.isFinite(size) && size >= 0 ? size : undefined\n } catch {\n return undefined\n }\n }\n\n // Register a caller's interest, so the read survives until that caller has\n // given up too.\n private join(entry: Entry<V>, signal?: AbortSignal) {\n if (signal === undefined) {\n entry.pinned = true\n } else if (signal.aborted) {\n // A caller that has already given up is not a waiter, and must not be\n // counted as one: an `abort` listener never fires on a signal that\n // aborted before it was added, so nothing would ever take this signal\n // back out of the set. The count would never reach zero and the read\n // would be uncancellable for everyone joined to it, silently.\n //\n // get() rejects such a caller before it reaches here, with no `await` in\n // between, so this is unreachable today. It is here because this is the\n // bug that shipped in @gmod/abortable-promise-cache, and an invariant\n // that fails this quietly should not rest on a check twenty lines away.\n if (!entry.pinned && entry.signals.size === 0) {\n entry.controller.abort(signal.reason)\n }\n } else if (typeof signal.addEventListener !== 'function') {\n // A duck-typed signal, not yet aborted. `{ aborted: false }` is what\n // consumers hand-roll \u2014 @gmod/bam's test/csi.test.ts is one, and\n // {@link throwIfAborted} exists because they are real \u2014 and subscribing\n // to it was a TypeError rather than a read. It fired on the FIRST call\n // that reached a cache with such a signal, so a consumer passing one got\n // `signal.addEventListener is not a function` instead of its data.\n //\n // Pinned, for the same reason a signal-free caller is: nothing here can\n // ever learn that this caller gave up, so the honest reading is that it\n // cannot, and a read it is waiting on must not be cancelled out from\n // under it. The caller is still told about its own cancellation \u2014 get()\n // re-checks `aborted` after the read settles \u2014 so what it loses is only\n // the ability to stop the read early, which is what an unsubscribable\n // signal cannot ask for anyway.\n entry.pinned = true\n } else if (!entry.signals.has(signal)) {\n // guarded so one signal joining the same key twice does not add two\n // listeners\n entry.signals.add(signal)\n signal.addEventListener(\n 'abort',\n () => {\n entry.signals.delete(signal)\n if (!entry.pinned && entry.signals.size === 0) {\n entry.controller.abort(signal.reason)\n // Nobody is waiting on this read any more, so nobody is holding\n // its value, so it is not what the batch policy defers eviction\n // for. Left counted it was: the policy waits for `pending` to\n // reach zero, and a read cancelled against a transport that\n // ignores its signal never settles to decrement it \u2014 one stalled\n // fetch and the cache never evicted again, however far over the\n // budget it went.\n this.detach(entry)\n }\n },\n // `once` covers the abort firing; `dispose` covers it never firing.\n // Without this a long-lived signal accumulates one listener per key it\n // ever touches, which is what @gmod/abortable-promise-cache did.\n { once: true, signal: entry.dispose.signal },\n )\n }\n }\n\n private deleteKey(cacheKey: string) {\n const entry = this.entries.get(cacheKey)\n if (entry) {\n this.entries.delete(cacheKey)\n // An entry the cache no longer holds is not part of any batch of its\n // reads, whether it has settled or not; see detach.\n this.detach(entry)\n if (entry.settled) {\n this.settledCount--\n }\n this.total -= entry.size\n this.charge(-entry.size)\n }\n }\n\n /**\n * Stop counting a read among the {@link pending} ones the batch policy waits\n * for. Idempotent, because a read can leave that count either by settling or\n * by the cache giving up on it first, and both can happen to the same read.\n *\n * The read itself is untouched: a caller still awaiting one the cache has\n * dropped gets its value as normal. What ends is only its claim on the batch,\n * which it has no business holding open once nothing will use the result.\n */\n private detach(entry: Entry<V>) {\n if (entry.counted) {\n entry.counted = false\n this.pending--\n }\n }\n\n private charge(delta: number) {\n if (this.budget && this.membership) {\n this.budget.charge(this.membership, delta)\n }\n }\n\n /**\n * @internal \u2014 {@link SharedBudget} asks; nothing else should.\n *\n * The least-recently-used settled entry, or `undefined` if this cache holds\n * at most one. Iteration order is least-recently-used first, so this returns\n * on the first settled entry it sees rather than walking the map.\n */\n lruSpare() {\n // Before the scan: the budget asks every member on every eviction, and a\n // member with nothing to spare would otherwise walk past all of its\n // in-flight reads to discover that.\n if (this.settledCount <= 1) {\n return undefined\n }\n for (const [cacheKey, entry] of this.entries) {\n // in flight: no weight to reclaim, and dropping one loses the\n // de-duplication its waiters joined for\n if (entry.settled) {\n return { cacheKey, seq: entry.seq }\n }\n }\n return undefined\n }\n\n /** @internal \u2014 {@link SharedBudget} evicting on this cache's behalf. */\n release(cacheKey: string) {\n this.deleteKey(cacheKey)\n }\n\n /**\n * Evict from the least-recently-used end.\n *\n * Reads still in flight are skipped: they are not results yet, they have no\n * weight to reclaim, and dropping one would lose the de-duplication every\n * caller joined to it is relying on.\n *\n * The last settled entry is kept whatever the budget. A single value larger\n * than the whole budget is still worth holding \u2014 the caller needs it for the\n * request in flight, so dropping it only buys an immediate re-read.\n */\n // Under the batch policy nothing is evicted until the whole batch has\n // settled: a request that starts many reads at once is still holding all of\n // their values, so evicting one frees nothing and only costs a re-read.\n private maybeEvict() {\n if (this.evictionPolicy === 'lru' || this.pending === 0) {\n this.evict()\n // Ends the batch, and belongs here rather than in evict() because ending\n // one is what *settling* the last read of it means. Down in evict() it\n // also ran on the maxSize setter, which ends a batch still in flight: its\n // entries then age out the instant they settle, so a consumer shedding\n // memory mid-request silently got lru behaviour out of a batch cache. It\n // sat below evict()'s `limit === Infinity` guard too, so a batch cache\n // that started unbounded never advanced at all, and imposing a budget on\n // one later spared every entry it had ever held.\n //\n // Bumping the number the survivors are compared against ages every one of\n // them out at once, where clearing a mark per entry was O(entries) on\n // every batch \u2014 including the batches under budget, which reach here only\n // to do that.\n if (this.evictionPolicy === 'batch') {\n this.batch++\n }\n // after the local pass, so a cache that can get under its own ceiling\n // does that first and only then competes for the shared one\n this.budget?.evict()\n }\n }\n\n private evict() {\n if (this.limit === Infinity) {\n return\n }\n if (this.evictionPolicy === 'batch') {\n for (const [cacheKey, entry] of this.entries) {\n if (this.total <= this.limit) {\n break\n }\n if (entry.batch !== this.batch && entry.settled) {\n this.deleteKey(cacheKey)\n }\n }\n return\n }\n\n // Before the loop below, which a cache comfortably under its budget would\n // otherwise enter and leave for nothing on every settle.\n if (this.total <= this.limit) {\n return\n }\n\n for (const [cacheKey, entry] of this.entries) {\n if (this.total <= this.limit || this.settledCount <= 1) {\n break\n }\n if (entry.settled) {\n this.deleteKey(cacheKey)\n }\n }\n }\n}\n", "import type {\n BufferEncoding,\n FilehandleOptions,\n ProgressCallback,\n} from './filehandle.ts'\n\n// Response.bytes() / Blob.bytes() is widely available but not yet in all\n// lib.dom.d.ts versions, so the optional-chain check is load-bearing for older\n// runtimes despite TS thinking it's always defined.\nexport async function toBytes(\n src: Response | Blob,\n): Promise<Uint8Array<ArrayBuffer>> {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n return src.bytes ? src.bytes() : new Uint8Array(await src.arrayBuffer())\n}\n\n/**\n * The body of a `readFile()`, decoded per the caller's encoding.\n *\n * Shared by RemoteFile and BlobFile because the branch is the same in both:\n * text for utf8, bytes for no encoding, an error for an encoding neither can\n * decode. Both spellings of utf8 count \u2014 node's `readFile` accepts `utf-8`, so\n * LocalFile does too, and rejecting it only here would make the encoding a\n * property of which filehandle you happened to hold.\n */\nexport async function readBody(\n src: Response | Blob,\n encoding: BufferEncoding | undefined,\n onProgress?: ProgressCallback,\n): Promise<Uint8Array<ArrayBuffer> | string> {\n if (encoding === 'utf8' || encoding === 'utf-8') {\n return src.text()\n } else if (encoding) {\n throw new Error(`unsupported encoding: ${encoding}`)\n }\n // duck-typed rather than `instanceof Response`, because a custom `fetch` may\n // hand back a Response from another realm or another implementation\n // altogether, and taking the no-progress path there leaves a progress bar at\n // zero for the whole download. Only Response has `body`.\n return onProgress && 'body' in src\n ? toBytesWithProgress(src, onProgress)\n : toBytes(src)\n}\n\n/**\n * `readFile()` takes either a bare encoding string or an options object, in\n * every implementation. Split whichever was passed into the two things callers\n * actually branch on.\n */\nexport function splitReadFileOptions(\n options: FilehandleOptions | BufferEncoding | undefined,\n): { encoding?: BufferEncoding; opts: FilehandleOptions } {\n return typeof options === 'string'\n ? { encoding: options, opts: {} }\n : { encoding: options?.encoding, opts: options ?? {} }\n}\n\n/**\n * Total file size from a `Content-Range: bytes 0-9/1234` header, or undefined\n * if the header is absent or gives the size as `*`.\n */\nexport function parseContentRangeSize(\n contentRange: string | null,\n): number | undefined {\n const size = /\\/(\\d+)$/.exec(contentRange ?? '')?.[1]\n return size === undefined ? undefined : parseInt(size, 10)\n}\n\n/**\n * Content-Length as a usable byte count. A malformed header yields undefined\n * rather than NaN, which would otherwise survive an `=== undefined` check and\n * poison every arithmetic use downstream.\n */\nexport function parseContentLength(res: Response): number | undefined {\n const header = res.headers.get('content-length')\n const parsed = header === null ? Number.NaN : Number(header)\n return Number.isSafeInteger(parsed) && parsed >= 0 ? parsed : undefined\n}\n\n// throttle intermediate progress ticks; a large body can yield thousands of\n// chunks and the final exact count is always emitted regardless\nconst PROGRESS_THROTTLE_MS = 50\n\n/**\n * Read a Response body to bytes while reporting download progress.\n *\n * When Content-Length is known the body is streamed directly into one pre-sized\n * buffer (no per-chunk array, no second copy), ticking `onProgress` as chunks\n * arrive. Without a known length there is no fraction to show, so it falls back\n * to a single one-shot read and one completion tick rather than buffering\n * chunks. Only used when a caller opts in via `onProgress`; the plain {@link\n * toBytes} fast path is unaffected.\n */\nexport async function toBytesWithProgress(\n res: Response,\n onProgress: ProgressCallback,\n): Promise<Uint8Array<ArrayBuffer>> {\n const total = parseContentLength(res)\n const body = res.body\n if (!body || total === undefined) {\n const bytes = await toBytes(res)\n onProgress(bytes.byteLength, total ?? bytes.byteLength)\n return bytes\n }\n\n const reader = body.getReader()\n let out = new Uint8Array(total)\n let received = 0\n let lastTick = Date.now()\n onProgress(0, total)\n for (\n let chunk = await reader.read();\n !chunk.done;\n chunk = await reader.read()\n ) {\n // a decoded body can exceed Content-Length (e.g. gzip transfer-encoding);\n // grow the buffer rather than throwing on out.set() overflow\n if (received + chunk.value.byteLength > out.length) {\n const grown = new Uint8Array(\n Math.max(received + chunk.value.byteLength, out.length * 2),\n )\n grown.set(out.subarray(0, received))\n out = grown\n }\n out.set(chunk.value, received)\n received += chunk.value.byteLength\n const now = Date.now()\n if (now - lastTick >= PROGRESS_THROTTLE_MS) {\n lastTick = now\n onProgress(received, total)\n }\n }\n\n onProgress(received, total)\n // copy rather than return a view: a body shorter than its Content-Length\n // would otherwise pin the whole over-allocated buffer, and hand the caller\n // bytes whose `.buffer` is longer than the view over it\n return received === out.length ? out : out.slice(0, received)\n}\n", "import {\n parseContentRangeSize,\n readBody,\n splitReadFileOptions,\n toBytes,\n toBytesWithProgress,\n} from './util.ts'\n\nimport type {\n BufferEncoding,\n Fetcher,\n FilehandleOptions,\n GenericFilehandle,\n ReadFileOptions,\n ReadFileTextOptions,\n Stats,\n} from './filehandle.ts'\n\n// header names are case-insensitive but object keys are not, so a caller's\n// `Range` and the `range` a ranged GET adds are two keys \u2014 and fetch folds them\n// into one comma-joined multi-range request, whose multipart/byteranges body we\n// would hand back as file bytes. Ours wins, however the caller spelled it.\nfunction mergeHeaders(\n headers: Record<string, string>,\n ours: Record<string, string> = {},\n) {\n const names = new Set(Object.keys(ours).map(k => k.toLowerCase()))\n const kept = Object.entries(headers).filter(\n ([k]) => !names.has(k.toLowerCase()),\n )\n return { ...Object.fromEntries(kept), ...ours }\n}\n\nfunction isByteOffset(n: number) {\n return Number.isSafeInteger(n) && n >= 0\n}\n\nfunction getMessage(e: unknown) {\n const r =\n typeof e === 'object' &&\n e !== null &&\n 'message' in e &&\n typeof e.message === 'string'\n ? e.message\n : `${e}`\n // strip trailing period so the wrapped form `${msg} fetching ${url}` reads cleanly\n return r.replace(/\\.$/, '')\n}\n\nexport default class RemoteFile implements GenericFilehandle {\n protected url: string\n\n /** the URL this handle fetches \u2014 see {@link GenericFilehandle.source} */\n public get source() {\n return this.url\n }\n\n private _stat?: Stats\n private statProbe?: Promise<unknown>\n private fetchImplementation: Fetcher\n private baseHeaders: Record<string, string>\n private baseOverrides: Omit<RequestInit, 'headers'>\n private baseSignal?: AbortSignal\n\n public constructor(source: string, opts: FilehandleOptions = {}) {\n this.url = source\n this.baseHeaders = opts.headers ?? {}\n this.baseOverrides = opts.overrides ?? {}\n this.baseSignal = opts.signal\n this.fetchImplementation = opts.fetch ?? globalThis.fetch.bind(globalThis)\n }\n\n private buildRequest(\n opts: FilehandleOptions,\n extraHeaders?: Record<string, string>,\n ): RequestInit {\n // a per-call signal beats the constructor's, which beats one supplied via\n // overrides; omit the key entirely when there is none, so we don't write\n // `signal: undefined` over an overrides-supplied signal\n const signal = opts.signal ?? this.baseSignal\n return {\n // defaults first: `overrides` is documented as extra fetch params, so a\n // caller passing e.g. mode/redirect/method has to be able to win\n method: 'GET',\n redirect: 'follow',\n mode: 'cors',\n ...this.baseOverrides,\n ...opts.overrides,\n headers: mergeHeaders(\n { ...this.baseHeaders, ...opts.headers },\n extraHeaders,\n ),\n ...(signal ? { signal } : {}),\n }\n }\n\n public async fetch(\n input: RequestInfo,\n init?: RequestInit,\n ): Promise<Response> {\n const wrapError = (e: unknown) =>\n new Error(`${getMessage(e)} fetching ${input}`, { cause: e })\n\n let response: Response\n try {\n response = await this.fetchImplementation(input, init)\n } catch (e) {\n if (`${e}`.includes('Failed to fetch')) {\n // refetch to help work around a chrome bug (discussed in\n // generic-filehandle issue #72) in which the chrome cache returns a\n // CORS error for content in its cache. see also\n // https://github.com/GMOD/jbrowse-components/pull/1511\n console.warn(\n `generic-filehandle: refetching ${input} to attempt to work around chrome CORS header caching bug`,\n )\n try {\n response = await this.fetchImplementation(input, {\n ...init,\n cache: 'reload',\n })\n } catch (e) {\n throw wrapError(e)\n }\n } else {\n throw wrapError(e)\n }\n }\n return response\n }\n\n public async read(\n length: number,\n position: number,\n opts: FilehandleOptions = {},\n ): Promise<Uint8Array<ArrayBuffer>> {\n if (length === 0) {\n return new Uint8Array(0)\n }\n // NaN is the one that motivated this \u2014 a corrupt index yields it from\n // ordinary arithmetic \u2014 but a fractional or negative byte offset is just as\n // unsendable, and reaches the server as a range header it can only reject\n if (!isByteOffset(length) || !isByteOffset(position)) {\n throw new TypeError(\n `read() called with an invalid length or position (length=${length}, position=${position}). The index file may be corrupt.`,\n )\n }\n return this.fetchBytes(length, position, opts)\n }\n\n /**\n * The bytes for one byte range \u2014 the seam a subclass that can serve those\n * bytes some other way overrides.\n *\n * The alternative is overriding {@link fetch}, and for a subclass holding a\n * byte cache that is the wrong altitude: it has bytes, so it has to wrap them\n * in a `Response` that `read` immediately unwraps again. Both halves copy.\n * Measured against JBrowse's `RemoteFileWithRangeCache` on a fully warm cache\n * with no network at all, that round trip was **69-77% of the entire read** \u2014\n * 6.15ms vs 1.90ms for 16MB, and the same ratio down to 256KB.\n *\n * So: override this to serve bytes, override {@link fetch} to change how\n * requests are made. Overriding neither leaves the ranged GET below, and the\n * default implementation still goes through `this.fetch`, so a subclass that\n * only wraps `fetch` keeps working untouched.\n */\n protected async fetchBytes(\n length: number,\n position: number,\n opts: FilehandleOptions,\n ): Promise<Uint8Array<ArrayBuffer>> {\n const res = await this.fetch(\n this.url,\n this.buildRequest(opts, {\n range: `bytes=${position}-${position + length - 1}`,\n }),\n )\n\n // HTTP 416 Range Not Satisfiable: the requested range starts past EOF.\n // Translate to an empty read so callers can detect EOF via short/empty\n // returns instead of needing a separate size oracle (stat) to stay clear of\n // the end of the file.\n if (res.status === 416) {\n return new Uint8Array(0)\n }\n\n this.checkOk(res)\n\n if ((res.status === 200 && position === 0) || res.status === 206) {\n // try to parse out the size of the remote file\n const size = parseContentRangeSize(res.headers.get('content-range'))\n if (size !== undefined) {\n this._stat = { size }\n }\n\n const resData = opts.onProgress\n ? await toBytesWithProgress(res, opts.onProgress)\n : await toBytes(res)\n // server didn't honor the range request and returned the full file \u2014\n // the body length is the actual file size\n if (!this._stat && res.status === 200) {\n this._stat = { size: resData.byteLength }\n }\n // the server over-delivered (it ignored our range header and sent the\n // whole file). copy out the requested slice rather than returning a\n // subarray view, which would pin the entire body in memory for as long\n // as the caller holds those few bytes.\n return resData.byteLength <= length ? resData : resData.slice(0, length)\n }\n\n throw new Error(\n res.status === 200\n ? `${this.url} fetch returned status 200, expected 206`\n : `HTTP ${res.status} fetching ${this.url}`,\n )\n }\n\n private checkOk(res: Response) {\n if (!res.ok) {\n throw new Error(`HTTP ${res.status} fetching ${this.url}`)\n }\n }\n\n public async readFile(\n options?: ReadFileOptions,\n ): Promise<Uint8Array<ArrayBuffer>>\n public async readFile(options: ReadFileTextOptions): Promise<string>\n public async readFile(\n options?: FilehandleOptions | BufferEncoding,\n ): Promise<Uint8Array<ArrayBuffer> | string> {\n const { encoding, opts } = splitReadFileOptions(options)\n const res = await this.fetch(this.url, this.buildRequest(opts))\n this.checkOk(res)\n const body = await readBody(res, encoding, opts.onProgress)\n // a 200 means we hold the entire file, so its length is the file size \u2014\n // record it so a subsequent stat() doesn't need another request. a 206\n // (caller supplied their own range header) tells us nothing.\n if (res.status === 200 && typeof body !== 'string') {\n this._stat = { size: body.byteLength }\n }\n return body\n }\n\n public async stat(): Promise<Stats> {\n if (!this._stat) {\n // share one probe between concurrent stat() callers instead of each\n // firing its own request; cleared afterwards so a failed probe retries\n this.statProbe ??= this.read(10, 0).finally(() => {\n this.statProbe = undefined\n })\n await this.statProbe\n }\n // Content-Range may not be exposed due to CORS \u2014 return size 0 rather\n // than crashing so callers can degrade gracefully.\n return this._stat ?? { size: 0 }\n }\n\n public close(): Promise<void> {\n return Promise.resolve()\n }\n}\n", "// Browser-specific exports that exclude Node.js-only modules\nimport type {\n FilehandleOptions,\n GenericFilehandle,\n ReadFileOptions,\n ReadFileTextOptions,\n} from './filehandle.ts'\nimport type { LocalFileOptions } from './localFile.ts'\n\nexport * from './filehandle.ts'\nexport type { LocalFileOptions } from './localFile.ts'\n\nexport { default as BlobFile } from './blobFile.ts'\nexport { default as RemoteFile } from './remoteFile.ts'\n\n/**\n * Stub standing in for the Node.js LocalFile in browser builds. Every member\n * carries the same signature as the real one \u2014 otherwise code written against\n * the node class fails to compile in any bundle that resolves the `browser`\n * export condition, which is the one thing this stub exists to prevent.\n * `implements GenericFilehandle` keeps drift from the interface a compile\n * error rather than a runtime one.\n *\n * The parameters go unread: every call rejects. They are here to be typed, so\n * a bundle only discovers that a local file is unavailable in the browser at\n * the point it actually tries to read one.\n */\nexport class LocalFile implements GenericFilehandle {\n /** the path this stub was handed \u2014 see {@link GenericFilehandle.source} */\n public readonly source: string\n\n // takes the options argument too, for the same reason it takes `source`: a\n // bundle resolving the `browser` condition must still typecheck a call\n // written against the node class, options and all\n public constructor(source: string, _opts: LocalFileOptions = {}) {\n this.source = source\n }\n\n private unimplemented(): Promise<never> {\n return Promise.reject(\n new Error(`LocalFile is unimplemented in the browser (${this.source})`),\n )\n }\n\n readFile(options?: ReadFileOptions): Promise<Uint8Array<ArrayBuffer>>\n readFile(options: ReadFileTextOptions): Promise<string>\n readFile(_options?: unknown): Promise<never> {\n return this.unimplemented()\n }\n read(\n _length: number,\n _position?: number,\n _opts?: FilehandleOptions,\n ): Promise<never> {\n return this.unimplemented()\n }\n stat(): Promise<never> {\n return this.unimplemented()\n }\n close(): Promise<never> {\n return this.unimplemented()\n }\n}\n", "import type VirtualOffset from './virtualOffset.ts'\n\n// little class representing a chunk in the index\nexport default class Chunk {\n public minv: VirtualOffset\n public maxv: VirtualOffset\n public bin: number\n // Absolute byte offset where the fetch for this chunk ends. The compressed\n // size of the final BGZF block (the one at maxv.blockPosition) is unknown\n // from the index, so this defaults to a full max-size block past maxv. It can\n // be tightened to the next known block boundary via clampChunkEnds.\n public endPosition: number\n\n constructor(\n minv: VirtualOffset,\n maxv: VirtualOffset,\n bin: number,\n endPosition = maxv.blockPosition + (1 << 16),\n ) {\n this.minv = minv\n this.maxv = maxv\n this.bin = bin\n this.endPosition = endPosition\n }\n\n toString() {\n return `${this.minv.toString()}..${this.maxv.toString()} (bin ${\n this.bin\n }, fetchedSize ${this.fetchedSize()})`\n }\n\n fetchedSize() {\n return this.endPosition - this.minv.blockPosition\n }\n}\n", "export default class QuickLRU extends Map {\n\t#size = 0\n\t#cache = new Map()\n\t#oldCache = new Map()\n\t#maxSize\n\t#maxAge\n\t#onEviction\n\n\tconstructor(options = {}) {\n\t\tsuper()\n\n\t\tif (!(options.maxSize && options.maxSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0')\n\t\t}\n\n\t\tif (typeof options.maxAge === 'number' && options.maxAge === 0) {\n\t\t\tthrow new TypeError('`maxAge` must be a number greater than 0')\n\t\t}\n\n\t\tthis.#maxSize = options.maxSize\n\t\tthis.#maxAge = options.maxAge || Number.POSITIVE_INFINITY\n\t\tthis.#onEviction = options.onEviction\n\t}\n\n\t// For tests.\n\tget __oldCache() {\n\t\treturn this.#oldCache\n\t}\n\n\t#emitEvictions(cache) {\n\t\tif (typeof this.#onEviction !== 'function') {\n\t\t\treturn\n\t\t}\n\n\t\tfor (const [key, item] of cache) {\n\t\t\tthis.#onEviction(key, item.value)\n\t\t}\n\t}\n\n\t#deleteIfExpired(key, item) {\n\t\tif (typeof item.expiry === 'number' && item.expiry <= Date.now()) {\n\t\t\tif (typeof this.#onEviction === 'function') {\n\t\t\t\tthis.#onEviction(key, item.value)\n\t\t\t}\n\n\t\t\treturn this.delete(key)\n\t\t}\n\n\t\treturn false\n\t}\n\n\t#getOrDeleteIfExpired(key, item) {\n\t\tconst deleted = this.#deleteIfExpired(key, item)\n\t\tif (!deleted) {\n\t\t\treturn item.value\n\t\t}\n\t}\n\n\t#getItemValue(key, item) {\n\t\treturn item.expiry ? this.#getOrDeleteIfExpired(key, item) : item.value\n\t}\n\n\t#peek(key, cache) {\n\t\tconst item = cache.get(key)\n\t\treturn this.#getItemValue(key, item)\n\t}\n\n\t#set(key, value) {\n\t\tthis.#cache.set(key, value)\n\t\tthis.#size++\n\n\t\tif (this.#size >= this.#maxSize) {\n\t\t\tthis.#size = 0\n\t\t\tthis.#emitEvictions(this.#oldCache)\n\t\t\tthis.#oldCache = this.#cache\n\t\t\tthis.#cache = new Map()\n\t\t}\n\t}\n\n\t#moveToRecent(key, item) {\n\t\tthis.#oldCache.delete(key)\n\t\tthis.#set(key, item)\n\t}\n\n\t*#entriesAscending() {\n\t\tfor (const item of this.#oldCache) {\n\t\t\tconst [key, value] = item\n\t\t\tif (!this.#cache.has(key)) {\n\t\t\t\tconst deleted = this.#deleteIfExpired(key, value)\n\t\t\t\tif (!deleted) {\n\t\t\t\t\tyield item\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const item of this.#cache) {\n\t\t\tconst [key, value] = item\n\t\t\tconst deleted = this.#deleteIfExpired(key, value)\n\t\t\tif (!deleted) {\n\t\t\t\tyield item\n\t\t\t}\n\t\t}\n\t}\n\n\tget(key) {\n\t\tif (this.#cache.has(key)) {\n\t\t\tconst item = this.#cache.get(key)\n\t\t\treturn this.#getItemValue(key, item)\n\t\t}\n\n\t\tif (this.#oldCache.has(key)) {\n\t\t\tconst item = this.#oldCache.get(key)\n\t\t\tif (!this.#deleteIfExpired(key, item)) {\n\t\t\t\tthis.#moveToRecent(key, item)\n\t\t\t\treturn item.value\n\t\t\t}\n\t\t}\n\t}\n\n\tset(key, value, { maxAge = this.#maxAge } = {}) {\n\t\tconst expiry =\n\t\t\ttypeof maxAge === 'number' && maxAge !== Number.POSITIVE_INFINITY\n\t\t\t\t? Date.now() + maxAge\n\t\t\t\t: undefined\n\n\t\tif (this.#cache.has(key)) {\n\t\t\tthis.#cache.set(key, {\n\t\t\t\tvalue,\n\t\t\t\texpiry,\n\t\t\t})\n\t\t} else {\n\t\t\tthis.#set(key, { value, expiry })\n\t\t}\n\n\t\treturn this\n\t}\n\n\thas(key) {\n\t\tif (this.#cache.has(key)) {\n\t\t\treturn !this.#deleteIfExpired(key, this.#cache.get(key))\n\t\t}\n\n\t\tif (this.#oldCache.has(key)) {\n\t\t\treturn !this.#deleteIfExpired(key, this.#oldCache.get(key))\n\t\t}\n\n\t\treturn false\n\t}\n\n\tpeek(key) {\n\t\tif (this.#cache.has(key)) {\n\t\t\treturn this.#peek(key, this.#cache)\n\t\t}\n\n\t\tif (this.#oldCache.has(key)) {\n\t\t\treturn this.#peek(key, this.#oldCache)\n\t\t}\n\t}\n\n\texpiresIn(key) {\n\t\tconst item = this.#cache.get(key) ?? this.#oldCache.get(key)\n\t\tif (item) {\n\t\t\treturn item.expiry ? item.expiry - Date.now() : Number.POSITIVE_INFINITY\n\t\t}\n\t}\n\n\tdelete(key) {\n\t\tconst deleted = this.#cache.delete(key)\n\t\tif (deleted) {\n\t\t\tthis.#size--\n\t\t}\n\n\t\treturn this.#oldCache.delete(key) || deleted\n\t}\n\n\tclear() {\n\t\tthis.#cache.clear()\n\t\tthis.#oldCache.clear()\n\t\tthis.#size = 0\n\t}\n\n\tresize(newSize) {\n\t\tif (!(newSize && newSize > 0)) {\n\t\t\tthrow new TypeError('`maxSize` must be a number greater than 0')\n\t\t}\n\n\t\tconst items = [...this.#entriesAscending()]\n\t\tconst removeCount = items.length - newSize\n\t\tif (removeCount < 0) {\n\t\t\tthis.#cache = new Map(items)\n\t\t\tthis.#oldCache = new Map()\n\t\t\tthis.#size = items.length\n\t\t} else {\n\t\t\tif (removeCount > 0) {\n\t\t\t\tthis.#emitEvictions(items.slice(0, removeCount))\n\t\t\t}\n\n\t\t\tthis.#oldCache = new Map(items.slice(removeCount))\n\t\t\tthis.#cache = new Map()\n\t\t\tthis.#size = 0\n\t\t}\n\n\t\tthis.#maxSize = newSize\n\t}\n\n\tevict(count = 1) {\n\t\tconst requested = count\n\t\tif (!requested || requested <= 0) {\n\t\t\treturn\n\t\t}\n\n\t\tconst items = [...this.#entriesAscending()]\n\t\tconst evictCount = Math.trunc(\n\t\t\tMath.min(requested, Math.max(items.length - 1, 0)),\n\t\t)\n\t\tif (evictCount <= 0) {\n\t\t\treturn\n\t\t}\n\n\t\tthis.#emitEvictions(items.slice(0, evictCount))\n\t\tthis.#oldCache = new Map(items.slice(evictCount))\n\t\tthis.#cache = new Map()\n\t\tthis.#size = 0\n\t}\n\n\t*keys() {\n\t\tfor (const [key] of this) {\n\t\t\tyield key\n\t\t}\n\t}\n\n\t*values() {\n\t\tfor (const [, value] of this) {\n\t\t\tyield value\n\t\t}\n\t}\n\n\t*[Symbol.iterator]() {\n\t\tfor (const item of this.#cache) {\n\t\t\tconst [key, value] = item\n\t\t\tconst deleted = this.#deleteIfExpired(key, value)\n\t\t\tif (!deleted) {\n\t\t\t\tyield [key, value.value]\n\t\t\t}\n\t\t}\n\n\t\tfor (const item of this.#oldCache) {\n\t\t\tconst [key, value] = item\n\t\t\tif (!this.#cache.has(key)) {\n\t\t\t\tconst deleted = this.#deleteIfExpired(key, value)\n\t\t\t\tif (!deleted) {\n\t\t\t\t\tyield [key, value.value]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t*entriesDescending() {\n\t\tlet items = [...this.#cache]\n\t\tfor (let i = items.length - 1; i >= 0; --i) {\n\t\t\tconst item = items[i]\n\t\t\tconst [key, value] = item\n\t\t\tconst deleted = this.#deleteIfExpired(key, value)\n\t\t\tif (!deleted) {\n\t\t\t\tyield [key, value.value]\n\t\t\t}\n\t\t}\n\n\t\titems = [...this.#oldCache]\n\t\tfor (let i = items.length - 1; i >= 0; --i) {\n\t\t\tconst item = items[i]\n\t\t\tconst [key, value] = item\n\t\t\tif (!this.#cache.has(key)) {\n\t\t\t\tconst deleted = this.#deleteIfExpired(key, value)\n\t\t\t\tif (!deleted) {\n\t\t\t\t\tyield [key, value.value]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t*entriesAscending() {\n\t\tfor (const [key, value] of this.#entriesAscending()) {\n\t\t\tyield [key, value.value]\n\t\t}\n\t}\n\n\tget size() {\n\t\tif (!this.#size) {\n\t\t\treturn this.#oldCache.size\n\t\t}\n\n\t\tlet oldCacheSize = 0\n\t\tfor (const key of this.#oldCache.keys()) {\n\t\t\tif (!this.#cache.has(key)) {\n\t\t\t\toldCacheSize++\n\t\t\t}\n\t\t}\n\n\t\treturn Math.min(this.#size + oldCacheSize, this.#maxSize)\n\t}\n\n\tget maxSize() {\n\t\treturn this.#maxSize\n\t}\n\n\tget maxAge() {\n\t\treturn this.#maxAge\n\t}\n\n\tentries() {\n\t\treturn this.entriesAscending()\n\t}\n\n\tforEach(callbackFunction, thisArgument = this) {\n\t\tfor (const [key, value] of this.entriesAscending()) {\n\t\t\tcallbackFunction.call(thisArgument, value, key, this)\n\t\t}\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/class-literal-property-style\n\tget [Symbol.toStringTag]() {\n\t\treturn 'QuickLRU'\n\t}\n\n\ttoString() {\n\t\treturn `QuickLRU(${this.size}/${this.maxSize})`\n\t}\n\n\t[Symbol.for('nodejs.util.inspect.custom')]() {\n\t\treturn this.toString()\n\t}\n}\n", "const TWO_PWR_32_DBL = 2 ** 32\n\nexport function longFromBytesToUnsigned(source: Uint8Array, i = 0) {\n const low =\n source[i]! |\n (source[i + 1]! << 8) |\n (source[i + 2]! << 16) |\n (source[i + 3]! << 24)\n const high =\n source[i + 4]! |\n (source[i + 5]! << 8) |\n (source[i + 6]! << 16) |\n (source[i + 7]! << 24)\n return (high >>> 0) * TWO_PWR_32_DBL + (low >>> 0)\n}\n", "export default class VirtualOffset {\n public blockPosition: number\n public dataPosition: number\n constructor(blockPosition: number, dataPosition: number) {\n this.blockPosition = blockPosition // < offset of the compressed data block\n this.dataPosition = dataPosition // < offset into the uncompressed data\n }\n\n toString() {\n return `${this.blockPosition}:${this.dataPosition}`\n }\n\n compareTo(b: VirtualOffset) {\n return (\n this.blockPosition - b.blockPosition || this.dataPosition - b.dataPosition\n )\n }\n}\nexport function fromBytes(bytes: Uint8Array, offset = 0) {\n return new VirtualOffset(\n bytes[offset + 7]! * 0x1_00_00_00_00_00 +\n bytes[offset + 6]! * 0x1_00_00_00_00 +\n bytes[offset + 5]! * 0x1_00_00_00 +\n bytes[offset + 4]! * 0x1_00_00 +\n bytes[offset + 3]! * 0x1_00 +\n bytes[offset + 2]!,\n (bytes[offset + 1]! << 8) | bytes[offset]!,\n )\n}\n", "import LRU from '@jbrowse/quick-lru'\n\nimport Chunk from './chunk.ts'\nimport { longFromBytesToUnsigned } from './long.ts'\nimport VirtualOffset from './virtualOffset.ts'\n\n// SYNC: ~/src/gmod/bam-js/src/util.ts optimizeChunks\n// Re-exported so the internal import path stays './util.ts'. The\n// implementation moved to @gmod/shared-read-cache, which needs it anyway --\n// every consumer of that package was carrying an identical copy.\nexport { throwIfAborted } from '@gmod/shared-read-cache'\n\nexport function optimizeChunks(chunks: Chunk[], lowest?: VirtualOffset) {\n const n = chunks.length\n if (n === 0) {\n return chunks\n }\n\n // Pre-filter before sorting: discard chunks whose maxv is at or before\n // `lowest` (the linear-index floor). Avoids sorting chunks that will be\n // dropped anyway \u2014 significant win when the linear index prunes most bins.\n let filtered: Chunk[]\n if (lowest) {\n const lowestBlock = lowest.blockPosition\n const lowestData = lowest.dataPosition\n filtered = []\n for (let i = 0; i < n; i++) {\n const chunk = chunks[i]!\n const cmp =\n chunk.maxv.blockPosition - lowestBlock ||\n chunk.maxv.dataPosition - lowestData\n if (cmp > 0) {\n filtered.push(chunk)\n }\n }\n if (filtered.length === 0) {\n return filtered\n }\n } else {\n filtered = chunks\n }\n\n filtered.sort((c0, c1) => {\n const dif = c0.minv.blockPosition - c1.minv.blockPosition\n return dif === 0 ? c0.minv.dataPosition - c1.minv.dataPosition : dif\n })\n\n // Merge adjacent/overlapping chunks. Track min/max blockPositions in locals\n // to avoid repeated property-chain reads in the hot loop.\n // Chunks are never mutated \u2014 merging produces a new Chunk instance.\n const mergedChunks: Chunk[] = [filtered[0]!]\n let lastMinBlock = filtered[0]!.minv.blockPosition\n let lastMaxBlock = filtered[0]!.maxv.blockPosition\n\n for (let i = 1; i < filtered.length; i++) {\n const chunk = filtered[i]!\n const chunkMinBlock = chunk.minv.blockPosition\n const chunkMaxBlock = chunk.maxv.blockPosition\n if (\n chunkMinBlock - lastMaxBlock < 65_000 &&\n chunkMaxBlock - lastMinBlock < 5_000_000\n ) {\n const lastChunk = mergedChunks.at(-1)!\n const cmp =\n chunkMaxBlock - lastMaxBlock ||\n chunk.maxv.dataPosition - lastChunk.maxv.dataPosition\n if (cmp > 0) {\n mergedChunks[mergedChunks.length - 1] = new Chunk(\n lastChunk.minv,\n chunk.maxv,\n lastChunk.bin,\n chunk.endPosition,\n )\n lastMaxBlock = chunkMaxBlock\n }\n } else {\n mergedChunks.push(chunk)\n lastMinBlock = chunkMinBlock\n lastMaxBlock = chunkMaxBlock\n }\n }\n\n return makeDisjoint(mergedChunks)\n}\n\n// SYNC: ~/src/gmod/bam-js/src/util.ts makeDisjoint\n/**\n * Trim any chunk that starts before its predecessor ends, so the spans a query\n * reads never overlap.\n *\n * Merging alone does not guarantee this. Two chunks from different bins can\n * overlap inside a single BGZF block while the merge above still declines to\n * join them, because the combined span would exceed its 5MB cap. The shared\n * bytes are then fetched, decompressed and decoded by both chunks, and every\n * line in the overlap is returned TWICE from getLines \u2014 a duplicated VCF\n * record or GFF feature, with a duplicated fileOffset.\n *\n * Safe because a chunk's `maxv` is the virtual offset just past its last\n * record \u2014 a record boundary \u2014 so no record begins inside the trimmed span and\n * the union of the chunks is unchanged.\n *\n * No fixture here reproduces it (@gmod/bam found it on an 18MB BAM, where\n * out.bam returned 5 of its 6551 records twice); this keeps the two copies of\n * optimizeChunks in step and pins the invariant.\n */\nfunction makeDisjoint(chunks: Chunk[]) {\n const out: Chunk[] = [chunks[0]!]\n for (let i = 1; i < chunks.length; i++) {\n const chunk = chunks[i]!\n const prevMax = out.at(-1)!.maxv\n const cmp =\n chunk.minv.blockPosition - prevMax.blockPosition ||\n chunk.minv.dataPosition - prevMax.dataPosition\n if (cmp >= 0) {\n out.push(chunk)\n continue\n }\n const stillHasData =\n chunk.maxv.blockPosition - prevMax.blockPosition ||\n chunk.maxv.dataPosition - prevMax.dataPosition\n if (stillHasData > 0) {\n out.push(new Chunk(prevMax, chunk.maxv, chunk.bin, chunk.endPosition))\n }\n }\n return out\n}\n\n// Tighten each chunk's endPosition (default: a full max-size BGZF block past\n// maxv) down to the next known block boundary. Every chunk min/maxv blockPosition\n// and every extraBoundary (e.g. linear-index entries) is a real BGZF block start;\n// since blocks don't overlap, the first boundary strictly greater than a chunk's\n// maxv.blockPosition is an upper bound on where that final block ends \u2014 always at\n// least the true block end, so the clamped fetch still contains the whole block.\n// Shrinks both the byte estimate and the actual fetch with no extra I/O.\nexport function clampChunkEnds(\n chunks: Chunk[],\n extraBoundaries: number[] = [],\n) {\n // Array#sort with a comparator beats a Float64Array numeric sort here:\n // extraBoundaries (the linear index) arrives already sorted and TimSort\n // exploits the existing run, which introsort cannot.\n const boundaries = [...extraBoundaries]\n for (const c of chunks) {\n boundaries.push(c.minv.blockPosition, c.maxv.blockPosition)\n }\n boundaries.sort((a, b) => a - b)\n\n for (const c of chunks) {\n const max = c.maxv.blockPosition\n // first boundary strictly greater than max\n let lo = 0\n let hi = boundaries.length\n while (lo < hi) {\n const mid = (lo + hi) >>> 1\n if (boundaries[mid]! > max) {\n hi = mid\n } else {\n lo = mid + 1\n }\n }\n if (lo < boundaries.length) {\n c.endPosition = Math.min(c.endPosition, boundaries[lo]!)\n }\n }\n}\n\n/**\n * The smallest of `current` and the `count` packed virtual offsets starting at\n * `offset`, allocating at most one VirtualOffset rather than one per entry.\n *\n * The index first pass exists only to find this minimum, and it visits every\n * linear-index entry in the file to do it \u2014 301k of them on\n * test/data/failing_tabix.vcf.gz.tbi against 19k bin chunks. Building a\n * VirtualOffset per entry to compare and discard it is the bulk of that pass.\n */\nexport function minVirtualOffset(\n bytes: Uint8Array,\n offset: number,\n count: number,\n current: VirtualOffset | undefined,\n) {\n let minBlock = current ? current.blockPosition : Infinity\n let minData = current ? current.dataPosition : 0\n let found = false\n for (let i = 0; i < count; i++) {\n const p = offset + i * 8\n const block =\n bytes[p + 7]! * 0x1_00_00_00_00_00 +\n bytes[p + 6]! * 0x1_00_00_00_00 +\n bytes[p + 5]! * 0x1_00_00_00 +\n bytes[p + 4]! * 0x1_00_00 +\n bytes[p + 3]! * 0x1_00 +\n bytes[p + 2]!\n const data = (bytes[p + 1]! << 8) | bytes[p]!\n if (block < minBlock || (block === minBlock && data < minData)) {\n minBlock = block\n minData = data\n found = true\n }\n }\n return found ? new VirtualOffset(minBlock, minData) : current\n}\n\nexport function parseNameBytes(namesBytes: Uint8Array) {\n const decoder = new TextDecoder('utf-8')\n const refIdToName: string[] = []\n const refNameToId: Record<string, number> = {}\n let currRefId = 0\n let pos = 0\n while (pos < namesBytes.length) {\n const end = namesBytes.indexOf(0, pos)\n if (end === -1) {\n break\n }\n if (end > pos) {\n const refName = decoder.decode(namesBytes.subarray(pos, end))\n refIdToName[currRefId] = refName\n refNameToId[refName] = currRefId\n }\n pos = end + 1\n currRefId++\n }\n return { refNameToId, refIdToName }\n}\n\nconst tabixFormats: Record<number, string> = {\n 0: 'generic',\n 1: 'SAM',\n 2: 'VCF',\n}\n\nexport function parseAuxData(bytes: Uint8Array, offset: number) {\n const dataView = new DataView(\n bytes.buffer,\n bytes.byteOffset,\n bytes.byteLength,\n )\n const formatFlags = dataView.getInt32(offset, true)\n const coordinateType =\n formatFlags & 0x1_00_00 ? 'zero-based-half-open' : '1-based-closed'\n const format = tabixFormats[formatFlags & 0xf]\n if (!format) {\n throw new Error(`invalid Tabix preset format flags ${formatFlags}`)\n }\n const columnNumbers = {\n ref: dataView.getInt32(offset + 4, true),\n start: dataView.getInt32(offset + 8, true),\n end: dataView.getInt32(offset + 12, true),\n }\n const metaValue = dataView.getInt32(offset + 16, true)\n const metaChar = metaValue ? String.fromCharCode(metaValue) : undefined\n const skipLines = dataView.getInt32(offset + 20, true)\n const nameSectionLength = dataView.getInt32(offset + 24, true)\n const { refIdToName, refNameToId } = parseNameBytes(\n bytes.subarray(offset + 28, offset + 28 + nameSectionLength),\n )\n return {\n refIdToName,\n refNameToId,\n skipLines,\n metaChar,\n columnNumbers,\n format,\n coordinateType,\n }\n}\n\nexport function parsePseudoBin(bytes: Uint8Array, offset: number) {\n return { lineCount: longFromBytesToUnsigned(bytes, offset) }\n}\n\n// SYNC: ~/src/gmod/bam-js/src/indexFile.ts memoizeByRefId\nexport function memoizeByRefId<T>(\n getIndices: (refId: number) => T | undefined,\n maxSize = 5,\n): (refId: number) => T | undefined {\n const lru = new LRU<number, T>({ maxSize })\n return (refId: number) => {\n const cached = lru.get(refId)\n if (cached !== undefined) {\n return cached\n }\n const result = getIndices(refId)\n if (result !== undefined) {\n lru.set(refId, result)\n }\n return result\n }\n}\n", "import { unzip } from '@gmod/bgzf-filehandle'\nimport { SharedReadCache } from '@gmod/shared-read-cache'\n\nimport { optimizeChunks } from './util.ts'\n\nimport type Chunk from './chunk.ts'\nimport type VirtualOffset from './virtualOffset.ts'\nimport type { GenericFilehandle } from 'generic-filehandle2'\n\n/**\n * The virtual offset past which a coordinate-sorted file holds nothing\n * overlapping `[.., end)`, from the binning index alone: htslib's `max_off`\n * (`hts_itr_query` in hts.c).\n *\n * Walk right from the finest bin after the one holding `end - 1`, stepping up\n * to the parent at every first child, so each bin visited begins at or past\n * `end` and never overlaps the query. Every record in such a bin starts at or\n * past `end`, so the first chunk of the first bin that exists is a record past\n * the query, and in a sorted file so is every record after it.\n *\n * SYNC: ~/src/gmod/bam-js/src/indexFile.ts maxOffset, and see bam-js ADR 0023\n * for why the caller drops whole merged chunks with it rather than trimming.\n */\nexport function maxOffset(\n binIndex: Record<number, Chunk[]>,\n end: number,\n minShift: number,\n depth: number,\n) {\n if (end > 2 ** (minShift + depth * 3)) {\n return undefined\n }\n const binCount = (8 ** (depth + 1) - 1) / 7\n let bin = (8 ** depth - 1) / 7 + Math.floor((end - 1) / 2 ** minShift) + 1\n if (bin >= binCount) {\n bin = 0\n }\n for (;;) {\n while (bin % 8 === 1) {\n bin = (bin - 1) / 8\n }\n if (bin === 0) {\n return undefined\n }\n const chunks = binIndex[bin]\n if (chunks?.length) {\n let lowest = chunks[0]!.minv\n for (let i = 1; i < chunks.length; i++) {\n const minv = chunks[i]!.minv\n if (minv.compareTo(lowest) < 0) {\n lowest = minv\n }\n }\n return lowest\n }\n bin++\n }\n}\n\nexport interface Options {\n signal?: AbortSignal\n /**\n * Called as the index (.tbi/.csi) is downloaded, with cumulative downloaded\n * bytes and the total. The index is a whole-file read, so this streams real\n * byte progress. Lets callers show a determinate \"downloading index\" bar.\n */\n onProgress?: (bytesDownloaded: number, totalBytes?: number) => void\n}\n\nexport interface RefIndex {\n binIndex: Record<number, Chunk[]>\n stats?: { lineCount: number }\n linearIndex?: VirtualOffset[]\n /** CSI only: per-bin loffset, the linear index's equivalent for pruning */\n loffsets?: Record<number, VirtualOffset>\n}\n\nexport interface IndexData {\n refNameToId: Record<string, number>\n refIdToName: string[]\n metaChar: string | undefined\n columnNumbers: { ref: number; start: number; end: number }\n coordinateType: string\n format: string\n indices: (refId: number) => RefIndex | undefined\n maxRefLength: number\n skipLines?: number\n maxBlockSize: number\n firstDataLine?: VirtualOffset\n refCount?: number\n csi?: boolean\n csiVersion?: number\n /**\n * The binning scheme. TBI reports these too, though its own are fixed by the\n * format (minShift 14, depth 5) rather than read from the file: they are the\n * same scheme, and CSI exists to let a file choose other values for them.\n */\n minShift: number\n depth: number\n maxBinNumber: number\n}\n\nexport default abstract class IndexFile {\n public filehandle: GenericFilehandle\n /**\n * The parsed index, as a shared read \u2014 see {@link parse}. One entry, never\n * evicted, which is what a memo is.\n */\n private parseCache = new SharedReadCache<string, IndexData>({})\n\n constructor({ filehandle }: { filehandle: GenericFilehandle }) {\n this.filehandle = filehandle\n }\n\n protected abstract _parse(opts: Options): Promise<IndexData>\n\n /**\n * The bins that may overlap [beg, end), as one inclusive [first, last] range\n * per level of the binning scheme.\n */\n protected abstract reg2bins(\n beg: number,\n end: number,\n indexData: IndexData,\n ): (readonly [number, number])[]\n\n /**\n * The earliest virtual offset any record overlapping `beg` can have, so that\n * chunks ending at or before it can be dropped. TBI reads it off the linear\n * index; CSI, which has none, off the bins' loffsets.\n */\n protected abstract lowestOffset(\n ref: RefIndex,\n beg: number,\n indexData: IndexData,\n ): VirtualOffset | undefined\n\n /**\n * The whole index file, decompressed, with a DataView over it. Both .tbi and\n * .csi are bgzf-compressed and read whole, so both parsers start here.\n */\n protected async readIndexBytes(opts: Options) {\n const buf = await this.filehandle.readFile({\n signal: opts.signal,\n onProgress: opts.onProgress,\n })\n const bytes = await unzip(buf)\n return {\n bytes,\n dataView: new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength),\n }\n }\n\n /** @internal */\n public async lineCount(refName: string, opts: Options = {}) {\n const indexData = await this.parse(opts)\n const refId = indexData.refNameToId[refName]\n if (refId === undefined) {\n return -1\n }\n return indexData.indices(refId)?.stats?.lineCount ?? -1\n }\n\n /** @internal */\n public async getMetadata(opts: Options = {}) {\n const { indices: _indices, ...rest } = await this.parse(opts)\n return rest\n }\n\n /**\n * The chunks of the data file that may hold records overlapping the region.\n * The two index formats differ only in their binning scheme and in where\n * they keep the pruning floor, which is what the two hooks above supply.\n * The ceiling, `maxOffset`, needs only the bins, so it serves both.\n *\n * @internal\n */\n public async blocksForRange(\n refName: string,\n min: number,\n max: number,\n opts: Options = {},\n ) {\n const indexData = await this.parse(opts)\n const refId = indexData.refNameToId[refName]\n if (refId === undefined) {\n return []\n }\n const ba = indexData.indices(refId)\n if (!ba) {\n return []\n }\n\n // Find chunks in overlapping bins. Leaf bins are not pruned.\n const chunks: Chunk[] = []\n for (const [start, end] of this.reg2bins(min, max, indexData)) {\n for (let bin = start; bin <= end; bin++) {\n const binChunks = ba.binIndex[bin]\n if (binChunks) {\n for (const c of binChunks) {\n chunks.push(c)\n }\n }\n }\n }\n\n const merged = optimizeChunks(chunks, this.lowestOffset(ba, min, indexData))\n const past = maxOffset(\n ba.binIndex,\n max,\n indexData.minShift,\n indexData.depth,\n )\n if (past) {\n let n = merged.length\n while (n > 0 && merged[n - 1]!.minv.compareTo(past) >= 0) {\n n--\n }\n merged.length = n\n }\n return merged\n }\n\n // SYNC: ~/src/gmod/bam-js/src/indexFile.ts parse \u2014 same shape and the same\n // reasoning below.\n /**\n * Parse the index, or join the parse already running.\n *\n * The index is downloaded and parsed once for the life of this object, so it\n * is the one read here that is shared between queries \u2014 and therefore the one\n * place a cancellation can leak from the query that asked for it to a query\n * that did not. `_parse` hands `opts` straight to `readIndexBytes`, so a bare\n * memoized promise makes the first query to arrive the owner of a read every\n * other query depends on: when it pans away, every concurrent query fails\n * with its abort.\n *\n * The same cache `ChunkCache` uses, for the same reason and with the same\n * rule: the parse runs under a signal of its own and is cancelled only once\n * every caller waiting on it has given up, so one query's abort is reported\n * to that query alone and a bystander gets the parse already in flight rather\n * than having to re-read the index. A rejection is dropped rather than\n * cached, so a transient failure does not poison the index for the life of\n * the file.\n *\n * The fill is per call rather than on the cache so that the caller who starts\n * the parse has its `onProgress` reach `readIndexBytes` \u2014 the index is a\n * whole-file read, and a determinate \"downloading index\" bar is what that\n * callback exists for.\n *\n * @internal\n */\n parse(opts: Options = {}): Promise<IndexData> {\n return this.parseCache.get('index', opts.signal, signal =>\n this._parse({ ...opts, signal }),\n )\n }\n\n /** @internal */\n async hasRefSeq(seqId: number, opts: Options = {}) {\n const idx = await this.parse(opts)\n return !!idx.indices(seqId)?.binIndex\n }\n}\n", "import Chunk from './chunk.ts'\nimport IndexFile from './indexFile.ts'\nimport {\n clampChunkEnds,\n memoizeByRefId,\n minVirtualOffset,\n parseAuxData,\n parsePseudoBin,\n} from './util.ts'\nimport { fromBytes } from './virtualOffset.ts'\n\nimport type { IndexData, Options, RefIndex } from './indexFile.ts'\nimport type VirtualOffset from './virtualOffset.ts'\n\nconst CSI1_MAGIC = 21_582_659 // CSI\\1\nconst CSI2_MAGIC = 38_359_875 // CSI\\2\n\n// CSI coordinates can exceed 2^31, so bitwise << / >> (which truncate to int32)\n// are unsafe here; use multiplication/division instead.\nfunction lshift(num: number, bits: number) {\n return num * 2 ** bits\n}\nfunction rshift(num: number, bits: number) {\n return Math.floor(num / 2 ** bits)\n}\n\nexport default class CSI extends IndexFile {\n /** @internal */\n async _parse(opts: Options = {}) {\n const { bytes, dataView } = await this.readIndexBytes(opts)\n\n const magic = dataView.getUint32(0, true)\n let csiVersion\n if (magic === CSI1_MAGIC) {\n csiVersion = 1\n } else if (magic === CSI2_MAGIC) {\n csiVersion = 2\n } else {\n throw new Error(`Not a CSI file (magic=${magic})`)\n }\n\n const minShift = dataView.getInt32(4, true)\n const depth = dataView.getInt32(8, true)\n const maxBinNumber = (8 ** (depth + 1) - 1) / 7\n const maxRefLength = 2 ** (minShift + depth * 3)\n const auxLength = dataView.getInt32(12, true)\n const aux =\n auxLength >= 30\n ? parseAuxData(bytes, 16)\n : {\n refIdToName: [] as string[],\n refNameToId: {} as Record<string, number>,\n metaChar: undefined,\n columnNumbers: { ref: 0, start: 1, end: 2 },\n coordinateType: 'zero-based-half-open',\n format: 'generic',\n }\n const refCount = dataView.getInt32(16 + auxLength, true)\n\n // SYNC: ~/src/gmod/bam-js/src/csi.ts _parse \u2014 two-pass structure\n // First pass: record per-refId byte offsets and find firstDataLine via loffsets\n let curr = 16 + auxLength + 4\n let firstDataLine: VirtualOffset | undefined\n const offsets: number[] = []\n\n for (let i = 0; i < refCount; i++) {\n offsets.push(curr)\n const binCount = dataView.getInt32(curr, true)\n curr += 4\n for (let j = 0; j < binCount; j++) {\n const bin = dataView.getUint32(curr, true)\n curr += 4\n if (bin > maxBinNumber) {\n curr += 28 + 16 // skip pseudo-bin (loffset + nchunk + 2 chunks)\n } else {\n firstDataLine = minVirtualOffset(bytes, curr, 1, firstDataLine)\n curr += 8 // loffset\n const chunkCount = dataView.getInt32(curr, true)\n curr += 4 + 16 * chunkCount\n }\n }\n }\n\n function getIndices(refId: number): RefIndex | undefined {\n const start = offsets[refId]\n if (start === undefined) {\n return undefined\n }\n let pos = start\n const binCount = dataView.getInt32(pos, true)\n pos += 4\n const binIndex: Record<number, Chunk[]> = {}\n const loffsets: Record<number, VirtualOffset> = {}\n let stats\n for (let j = 0; j < binCount; j++) {\n const bin = dataView.getUint32(pos, true)\n pos += 4\n if (bin > maxBinNumber) {\n stats = parsePseudoBin(bytes, pos + 28)\n pos += 28 + 16\n } else {\n loffsets[bin] = fromBytes(bytes, pos)\n pos += 8\n const chunkCount = dataView.getInt32(pos, true)\n pos += 4\n const chunks = Array.from<Chunk>({ length: chunkCount })\n for (let k = 0; k < chunkCount; k++) {\n chunks[k] = new Chunk(\n fromBytes(bytes, pos),\n fromBytes(bytes, pos + 8),\n bin,\n )\n pos += 16\n }\n binIndex[bin] = chunks\n }\n }\n clampChunkEnds(Object.values(binIndex).flat())\n return { binIndex, loffsets, stats }\n }\n\n return {\n ...aux,\n csi: true,\n refCount,\n maxBlockSize: 1 << 16,\n firstDataLine,\n csiVersion,\n indices: memoizeByRefId(getIndices),\n minShift,\n depth,\n maxBinNumber,\n maxRefLength,\n }\n }\n\n /**\n * CSI's equivalent of the BAI/TBI linear index: the loffset of the deepest\n * indexed bin covering `beg` is the earliest virtual offset any record\n * overlapping `beg` can have, so chunks ending at or before it are dead.\n * Walks leaf -> previous sibling -> parent until an indexed bin is found.\n * SYNC: htslib hts_itr_query min_off computation\n */\n protected lowestOffset(\n ref: RefIndex,\n beg: number,\n { minShift, depth }: IndexData,\n ) {\n const { loffsets } = ref\n let found: VirtualOffset | undefined\n if (loffsets) {\n // first bin of the deepest level, i.e. (8**depth - 1) / 7\n let bin =\n (lshift(1, 3 * depth) - 1) / 7 + rshift(Math.max(beg, 0), minShift)\n while (found === undefined && bin > 0) {\n found = loffsets[bin]\n if (found === undefined) {\n const parent = Math.floor((bin - 1) / 8)\n const firstChild = parent * 8 + 1\n bin = bin > firstChild ? bin - 1 : parent\n }\n }\n found ??= loffsets[0]\n }\n return found\n }\n\n protected reg2bins(\n beg: number,\n end: number,\n { minShift, depth, maxBinNumber }: IndexData,\n ) {\n beg = Math.max(beg, 0)\n const maxPos = 2 ** (minShift + depth * 3)\n if (end > maxPos) {\n end = maxPos\n }\n end -= 1\n let l = 0\n let t = 0\n let s = minShift + depth * 3\n const bins: (readonly [number, number])[] = []\n for (; l <= depth; s -= 3, t += lshift(1, l * 3), l += 1) {\n const b = t + rshift(beg, s)\n const e = t + rshift(end, s)\n if (e - b + bins.length > maxBinNumber) {\n throw new Error(\n `query ${beg}-${end} is too large for current binning scheme (shift ${minShift}, depth ${depth}), try a smaller query or a coarser index binning scheme`,\n )\n }\n bins.push([b, e] as const)\n }\n return bins\n }\n}\n", "import Chunk from './chunk.ts'\nimport IndexFile from './indexFile.ts'\nimport {\n clampChunkEnds,\n memoizeByRefId,\n minVirtualOffset,\n parseAuxData,\n parsePseudoBin,\n} from './util.ts'\nimport { fromBytes } from './virtualOffset.ts'\n\nimport type { Options, RefIndex } from './indexFile.ts'\nimport type VirtualOffset from './virtualOffset.ts'\n\nconst TBI_MAGIC = 21_578_324 // TBI\\1\n\n// TBI is always the fixed depth-5, 14-bit-leaf binning scheme\nconst TBI_DEPTH = 5\nconst TBI_MIN_SHIFT = 14\nconst TBI_MAX_REF_LENGTH = 2 ** (TBI_MIN_SHIFT + TBI_DEPTH * 3)\n\n// Clamp a query coordinate into the binning scheme's range. Past 2**31 the\n// int32 shifts below truncate and go negative, which would silently yield no\n// bins.\nfunction clampToRefLength(pos: number) {\n return Math.min(Math.max(pos, 0), TBI_MAX_REF_LENGTH)\n}\n\nexport default class TabixIndex extends IndexFile {\n /**\n * The bins that may overlap [beg, end) (zero-based half-open). TBI's scheme\n * is CSI's with minShift/depth fixed, so this is CSI's reg2bins with the\n * levels unrolled and its float shifts replaced by int32 ones.\n */\n protected reg2bins(beg: number, end: number) {\n if (beg > TBI_MAX_REF_LENGTH) {\n console.warn('querying outside of possible tabix range')\n }\n const b = clampToRefLength(beg)\n const e = Math.min(end, TBI_MAX_REF_LENGTH) - 1\n const bins: (readonly [number, number])[] = []\n if (b <= e) {\n bins.push(\n [0, 0],\n [1 + (b >> 26), 1 + (e >> 26)],\n [9 + (b >> 23), 9 + (e >> 23)],\n [73 + (b >> 20), 73 + (e >> 20)],\n [585 + (b >> 17), 585 + (e >> 17)],\n [4681 + (b >> 14), 4681 + (e >> 14)],\n )\n }\n return bins\n }\n\n /**\n * The linear index is monotonically non-decreasing, so the minimum virtual\n * offset for chunks that could overlap [beg, ...) is its entry for beg.\n * SYNC: ~/src/gmod/bam-js/src/bai.ts getLowestChunk\n */\n protected lowestOffset(ref: RefIndex, beg: number) {\n const linearIndex = ref.linearIndex\n return linearIndex?.[\n Math.min(clampToRefLength(beg) >> TBI_MIN_SHIFT, linearIndex.length - 1)\n ]\n }\n\n /** @internal */\n async _parse(opts: Options = {}) {\n const { bytes, dataView } = await this.readIndexBytes(opts)\n\n if (dataView.getUint32(0, true) !== TBI_MAGIC) {\n throw new Error('Not a TBI file')\n }\n\n const refCount = dataView.getUint32(4, true)\n const maxBinNumber = ((1 << ((TBI_DEPTH + 1) * 3)) - 1) / 7\n\n // TBI header layout matches CSI aux data; parseAuxData handles both\n const {\n refNameToId,\n refIdToName,\n coordinateType,\n format,\n columnNumbers,\n metaChar,\n skipLines,\n } = parseAuxData(bytes, 8)\n // nameSectionLength is at TBI offset 32; re-read to find where bin data starts\n const nameSectionLength = dataView.getInt32(32, true)\n\n // SYNC: ~/src/gmod/bam-js/src/bai.ts _parse \u2014 two-pass structure\n // First pass: record per-refId byte offsets and find firstDataLine.\n //\n // Only the linear index is consulted. Its entry for a window is the\n // smallest virtual offset of any record overlapping that window, so the\n // minimum over the linear index is already the minimum over the bin chunks\n // \u2014 walking the chunks too only re-derives it. Checked against every .tbi\n // in test/data: same answer on all 23, and no ref has bins without a\n // linear index.\n let curr = 36 + nameSectionLength\n let firstDataLine: VirtualOffset | undefined\n const offsets: number[] = []\n\n for (let i = 0; i < refCount; i++) {\n offsets.push(curr)\n const binCount = dataView.getInt32(curr, true)\n curr += 4\n for (let j = 0; j < binCount; j++) {\n const bin = dataView.getUint32(curr, true)\n curr += 4\n const chunkCount = dataView.getInt32(curr, true)\n curr += 4\n if (bin > maxBinNumber + 1) {\n throw new Error(\n 'tabix index contains too many bins, please use a CSI index',\n )\n }\n curr += 16 * chunkCount\n }\n const linearCount = dataView.getInt32(curr, true)\n curr += 4\n firstDataLine = minVirtualOffset(bytes, curr, linearCount, firstDataLine)\n curr += 8 * linearCount\n }\n\n function getIndices(refId: number): RefIndex | undefined {\n const start = offsets[refId]\n if (start === undefined) {\n return undefined\n }\n let pos = start\n const binCount = dataView.getInt32(pos, true)\n pos += 4\n const binIndex: Record<number, Chunk[]> = {}\n let stats\n for (let j = 0; j < binCount; j++) {\n const bin = dataView.getUint32(pos, true)\n pos += 4\n if (bin > maxBinNumber + 1) {\n throw new Error(\n 'tabix index contains too many bins, please use a CSI index',\n )\n } else if (bin === maxBinNumber + 1) {\n const chunkCount = dataView.getInt32(pos, true)\n pos += 4\n if (chunkCount === 2) {\n stats = parsePseudoBin(bytes, pos + 16)\n }\n pos += 16 * chunkCount\n } else {\n const chunkCount = dataView.getInt32(pos, true)\n pos += 4\n const chunks = Array.from<Chunk>({ length: chunkCount })\n for (let k = 0; k < chunkCount; k++) {\n chunks[k] = new Chunk(\n fromBytes(bytes, pos),\n fromBytes(bytes, pos + 8),\n bin,\n )\n pos += 16\n }\n binIndex[bin] = chunks\n }\n }\n const linearCount = dataView.getInt32(pos, true)\n pos += 4\n const linearIndex = Array.from<VirtualOffset>({ length: linearCount })\n for (let k = 0; k < linearCount; k++) {\n linearIndex[k] = fromBytes(bytes, pos)\n pos += 8\n }\n clampChunkEnds(\n Object.values(binIndex).flat(),\n linearIndex.map(v => v.blockPosition),\n )\n return { binIndex, linearIndex, stats }\n }\n\n return {\n indices: memoizeByRefId(getIndices),\n metaChar,\n minShift: TBI_MIN_SHIFT,\n depth: TBI_DEPTH,\n maxBinNumber,\n maxRefLength: TBI_MAX_REF_LENGTH,\n skipLines,\n firstDataLine,\n columnNumbers,\n coordinateType,\n format,\n refIdToName,\n refNameToId,\n maxBlockSize: 1 << 16,\n }\n }\n}\n", "import { unzip, unzipChunkSlice } from '@gmod/bgzf-filehandle'\nimport { SharedReadCache } from '@gmod/shared-read-cache'\nimport { LocalFile, RemoteFile } from 'generic-filehandle2'\n\nimport CSI from './csi.ts'\nimport TBI from './tbi.ts'\nimport { optimizeChunks } from './util.ts'\n\nimport type Chunk from './chunk.ts'\nimport type IndexFile from './indexFile.ts'\nimport type { Options } from './indexFile.ts'\nimport type { BgzfWorkerPool, ChunkSlice } from '@gmod/bgzf-filehandle'\nimport type { SharedBudget } from '@gmod/shared-read-cache'\nimport type { GenericFilehandle } from 'generic-filehandle2'\n\nconst TAB = 9\nconst NEWLINE = 10\nconst CARRIAGE_RETURN = 13\nconst SEMICOLON = 59\n\n// Ceiling on how many chunk reads getLines keeps in flight ahead of the one it\n// is parsing. Six is the HTTP/1.1 per-host connection cap browsers enforce, so\n// going much above it buys nothing on the transport that matters.\nconst MAX_READ_AHEAD_CHUNKS = 6\n\n// SYNC: ~/src/gmod/bam-js/src/bamFile.ts DEFAULT_MAX_CACHE_BYTES\n//\n// We fetch compressed and cache decompressed, and an entry is a whole chunk, so\n// entry count says nothing about memory. How little is easy to underestimate:\n// a dense VCF (test/data/1kg.chr1.subset.vcf.gz \u2014 213MB over 600kb of chr1)\n// has single index bins of 17MB compressed, 120MB decompressed. Panning it\n// under the old 80-entry cache peaked at 2GB RSS.\n//\n// That 120MB figure is also why this is no longer 100MB. A budget below one\n// query's working set does not cache less, it caches NOTHING: each entry is\n// evicted before the next pan can reuse it, so the hit rate is zero and the\n// decompress is paid again every time. On that same fixture, a six-window 50kb\n// pan measured 17 refills out of 17 \u2014 a total miss \u2014 at 100MB, against 0 at\n// 800MB, and 2596ms against 600ms. The working set plateaus at 497MB held, so\n// 1GB clears it with headroom and nothing above 800MB buys anything.\n//\n// Affordable as a ceiling only because of the idle timeout below: it is a peak\n// under panning, not a level a parked consumer holds. A small file is\n// unaffected either way, this being a ceiling and not an allocation.\nconst DEFAULT_CHUNK_CACHE_BYTES = 1024 * 2 ** 20\n\n// SYNC: ~/src/gmod/bam-js/src/bamFile.ts DEFAULT_CACHE_IDLE_TIMEOUT_MS\n//\n// Drop a chunk nothing has looked at for three minutes. The budget above is\n// only applied when a read settles, so it does nothing at all for a consumer\n// sitting still \u2014 and a genome browser holds one of these per track for as long\n// as the track is open. Timed from the last read, not the fetch, so panning\n// back and forth over one region never expires it.\nconst DEFAULT_CHUNK_CACHE_IDLE_TIMEOUT_MS = 3 * 60 * 1000\n\ntype GetLinesCallback = (\n line: string,\n fileOffset: number,\n start: number,\n end: number,\n) => void\n\ninterface GetLinesOpts {\n signal?: AbortSignal\n lineCallback: GetLinesCallback\n /**\n * Called as the chunks covering the query are fetched, with cumulative\n * downloaded bytes and the total bytes to fetch. One tick per chunk \u2014 the run\n * of BGZF blocks the index resolves a query to \u2014 including instant ticks for\n * chunks already cached. That is the natural unit here, since chunk byte\n * sizes are known up front from the index, which is what lets a caller render\n * a determinate progress bar rather than a spinner.\n */\n onProgress?: (bytesDownloaded: number, totalBytes?: number) => void\n}\n\n// The decompressed chunk plus its block offsets, as @gmod/bgzf-filehandle\n// returns them: cpositions/dpositions are Float64Arrays, which is what the\n// wasm decompressor produces, and only indexed reads and `.length` are used\n// here. Taken from the package rather than restated so the two can't drift.\ntype ReadChunk = ChunkSlice\n\nfunction resolveFilehandle(\n filehandle?: GenericFilehandle,\n path?: string,\n url?: string,\n) {\n if (filehandle) {\n return filehandle\n }\n if (path) {\n return new LocalFile(path)\n }\n if (url) {\n return new RemoteFile(url)\n }\n throw new TypeError('must provide either filehandle, path, or url')\n}\n\n// An explicitly supplied index always wins over the `<path>.tbi` /\n// `<url>.tbi` names derived from the data file, whichever kind it is.\nfunction resolveIndex({\n tbiFilehandle,\n csiFilehandle,\n tbiPath,\n csiPath,\n tbiUrl,\n csiUrl,\n path,\n url,\n}: {\n tbiFilehandle?: GenericFilehandle\n csiFilehandle?: GenericFilehandle\n tbiPath?: string\n csiPath?: string\n tbiUrl?: string\n csiUrl?: string\n path?: string\n url?: string\n}) {\n if (tbiFilehandle) {\n return new TBI({ filehandle: tbiFilehandle })\n }\n if (csiFilehandle) {\n return new CSI({ filehandle: csiFilehandle })\n }\n if (tbiPath) {\n return new TBI({ filehandle: new LocalFile(tbiPath) })\n }\n if (csiPath) {\n return new CSI({ filehandle: new LocalFile(csiPath) })\n }\n if (csiUrl) {\n return new CSI({ filehandle: new RemoteFile(csiUrl) })\n }\n if (tbiUrl) {\n return new TBI({ filehandle: new RemoteFile(tbiUrl) })\n }\n if (path) {\n return new TBI({ filehandle: new LocalFile(`${path}.tbi`) })\n }\n if (url) {\n return new TBI({ filehandle: new RemoteFile(`${url}.tbi`) })\n }\n throw new TypeError(\n 'must provide one of tbiFilehandle, tbiPath, csiFilehandle, csiPath, tbiUrl, csiUrl',\n )\n}\n\nfunction calculateFileOffset(\n cpositions: ArrayLike<number>,\n dpositions: ArrayLike<number>,\n pos: number,\n blockStart: number,\n minvDataPosition: number,\n) {\n return (\n cpositions[pos]! * (1 << 8) +\n (blockStart - dpositions[pos]!) +\n minvDataPosition +\n 1\n )\n}\n\nfunction getVcfEnd(\n buffer: Uint8Array,\n startCoordinate: number,\n refStart: number,\n refEnd: number,\n infoStart: number,\n infoEnd: number,\n) {\n const refLen = refEnd - refStart\n let endCoordinate = startCoordinate + refLen\n\n // INFO is '.', no fields to check\n if (buffer[infoStart] === 46) {\n return endCoordinate\n }\n\n // Single pass over semicolon-delimited fields checking prefixes.\n // Avoids repeated indexOf scans for common bytes like 'S' and 'E'\n // that produce many false positives in typical INFO fields.\n let fieldStart = infoStart\n for (let i = infoStart; i <= infoEnd; i++) {\n if (i === infoEnd || buffer[i] === SEMICOLON) {\n const fieldLen = i - fieldStart\n if (\n fieldLen >= 10 &&\n buffer[fieldStart] === 83 && // S\n buffer[fieldStart + 1] === 86 && // V\n buffer[fieldStart + 2] === 84 && // T\n buffer[fieldStart + 3] === 89 && // Y\n buffer[fieldStart + 4] === 80 && // P\n buffer[fieldStart + 5] === 69 && // E\n buffer[fieldStart + 6] === 61 && // =\n buffer[fieldStart + 7] === 84 && // T\n buffer[fieldStart + 8] === 82 && // R\n buffer[fieldStart + 9] === 65 // A\n ) {\n return startCoordinate + 1\n }\n if (\n fieldLen >= 4 &&\n buffer[fieldStart] === 69 && // E\n buffer[fieldStart + 1] === 78 && // N\n buffer[fieldStart + 2] === 68 && // D\n buffer[fieldStart + 3] === 61 // =\n ) {\n endCoordinate = parseIntFromBytes(buffer, fieldStart + 4, i)\n }\n fieldStart = i + 1\n }\n }\n return endCoordinate\n}\n\nconst textDecoder = new TextDecoder()\n\n/**\n * The leading run of meta-character lines \u2014 what `tabix -H` prints. Everything\n * from the first line that doesn't begin with the meta character is dropped.\n */\nfunction trimToMetaLines(bytes: Uint8Array, metaChar: string) {\n let lastNewline = -1\n const metaByte = metaChar.charCodeAt(0)\n\n for (let i = 0, l = bytes.length; i < l; i++) {\n const byte = bytes[i]\n if (i === lastNewline + 1 && byte !== metaByte) {\n break\n }\n if (byte === NEWLINE) {\n lastNewline = i\n }\n }\n return bytes.subarray(0, lastNewline + 1)\n}\n\n/**\n * The first `count` lines. Scans for the count-th newline and decodes only that\n * far, rather than decoding and splitting the whole buffer to keep its first\n * few lines \u2014 the buffer runs to the first data line, which for a file with a\n * long commented preamble above its counted rows can be megabytes.\n */\nfunction firstLines(bytes: Uint8Array, count: number) {\n let end = 0\n for (let i = 0; i < count; i++) {\n const n = bytes.indexOf(NEWLINE, end)\n if (n === -1) {\n end = bytes.length\n break\n }\n end = n + 1\n }\n return textDecoder\n .decode(bytes.subarray(0, end))\n .split(/\\r?\\n/)\n .slice(0, count)\n}\n\nfunction parseIntFromBytes(buffer: Uint8Array, start: number, end: number) {\n let val = 0\n for (let i = start; i < end; i++) {\n const c = buffer[i]!\n if (c >= 48 && c <= 57) {\n val = val * 10 + (c - 48)\n } else {\n break\n }\n }\n return val\n}\n\n/**\n * Reads Tabix-indexed files (bgzipped), supporting both .tbi and .csi index formats.\n */\nexport default class TabixIndexedFile {\n private filehandle: GenericFilehandle\n private index: IndexFile\n public chunkCache: SharedReadCache<Chunk, ReadChunk>\n /**\n * The parsed header, as a shared read \u2014 see {@link getParsedHeader}. One\n * entry, never evicted, which is what a memo is.\n */\n private headerCache = new SharedReadCache<\n string,\n { header: string; skippedLines: string[] }\n >({})\n\n /** see the constructor option of the same name */\n private bgzfWorkerPool?:\n BgzfWorkerPool | Promise<BgzfWorkerPool | undefined> | undefined\n\n constructor({\n path,\n filehandle,\n url,\n tbiPath,\n tbiUrl,\n tbiFilehandle,\n csiPath,\n csiUrl,\n csiFilehandle,\n chunkCacheSize = DEFAULT_CHUNK_CACHE_BYTES,\n chunkCacheIdleTimeoutMs = DEFAULT_CHUNK_CACHE_IDLE_TIMEOUT_MS,\n chunkCacheBudget,\n bgzfWorkerPool,\n }: {\n path?: string\n filehandle?: GenericFilehandle\n url?: string\n tbiPath?: string\n tbiUrl?: string\n tbiFilehandle?: GenericFilehandle\n csiPath?: string\n csiUrl?: string\n csiFilehandle?: GenericFilehandle\n /**\n * Budget for the decompressed chunk cache, in bytes. Default 1GB.\n *\n * **The unit changed in v3.5.2** (ADR 0001). Before that this was divided\n * by 64KB to get an entry count, so a caller passing `50 * 2**20` was\n * asking for 800 whole decompressed chunks \u2014 unbounded in practice. It now\n * means 50MB, twenty times under the default, and the name did not change\n * so nothing warns. If you pinned a value here before v3.5.2, it does not\n * mean what it did.\n *\n * What that costs is worth keeping, because it is the reason to check a\n * pinned value rather than assume it is harmless: jbrowse passed exactly\n * `50 * 2**20` in nine adapters, and measured on\n * `test/data/1kg.chr1.subset.vcf.gz` that was a **total miss** \u2014 47 refills\n * out of 47 on the warm pass against 0 at the default, holding 82.7MB in a\n * single entry, over the budget it was given because the last settled entry\n * is kept whatever the budget. Those nine adapters now pass\n * `chunkCacheBudget` and no `chunkCacheSize` at all, so that particular\n * instance is gone; the trap it demonstrates is not.\n *\n * A retention bound, not a bound on peak memory: reads in flight are never\n * evicted and the last settled entry is kept whatever the budget. Size it\n * to hold several queries \u2014 below one query's working set the hit rate\n * drops to zero while the memory is retained anyway, so a number between\n * the two is the worst available choice.\n */\n chunkCacheSize?: number\n /**\n * Drop a cached chunk once nothing has read it for this many milliseconds.\n * Default 3 minutes; `0` keeps chunks until `chunkCacheSize` evicts them.\n *\n * The only thing that lowers the cache while nothing is happening, and what\n * makes the budget above a peak rather than a resting level.\n */\n chunkCacheIdleTimeoutMs?: number\n /**\n * A budget shared with other files, so that the ceiling applies to their\n * sum rather than to each of them. Any `@gmod/shared-read-cache` consumer\n * that weighs in the same unit can join it: `@gmod/bam` also weighs\n * decompressed bytes, while `@gmod/cram` weighs decoded records and\n * `@gmod/bbi` weighs entries, and a budget mixing those adds bytes to\n * records and bounds neither.\n *\n * {@link chunkCacheSize} is per file, which is not a bound on a consumer\n * that opens one file per track. @gmod/bam measured the shape: six tracks\n * browsing six windows retained 1442 MB with every cache still under its\n * own ceiling, so the ceiling was not holding the line and nothing else\n * was. The idle timeout cannot help there \u2014 it does nothing while the\n * reader is browsing, which is the whole case.\n *\n * Dividing {@link chunkCacheSize} by the track count instead reintroduces\n * the cliff it exists to avoid. A shared budget does not, because a member\n * yields only what is globally least-recently-used: files nobody is\n * reading hand their space to the one being panned.\n */\n chunkCacheBudget?: SharedBudget\n /**\n * A `@gmod/bgzf-filehandle` worker pool to inflate this file's chunks on,\n * instead of inflating them on the calling thread.\n *\n * BGZF decompression dominates a cold query and BGZF blocks are\n * independently inflatable, so this is the one remaining lever of that\n * size. @gmod/bam measured 1.95x end to end wiring the same pool into a\n * genome browser's read path.\n *\n * Accepts the promise `getSharedWorkerPool()` returns as well as a pool,\n * so a caller whose own construction is synchronous can hand the pending\n * pool straight over \u2014 it is awaited at the point of use, by which time it\n * has long since resolved. `undefined` (which is what that helper gives\n * back under node, or anywhere Workers cannot be created) keeps the\n * in-process path, so this is safe to pass unconditionally.\n */\n bgzfWorkerPool?:\n BgzfWorkerPool | Promise<BgzfWorkerPool | undefined> | undefined\n }) {\n this.bgzfWorkerPool = bgzfWorkerPool\n this.filehandle = resolveFilehandle(filehandle, path, url)\n this.index = resolveIndex({\n tbiFilehandle,\n csiFilehandle,\n tbiPath,\n csiPath,\n tbiUrl,\n csiUrl,\n path,\n url,\n })\n\n this.chunkCache = new SharedReadCache<Chunk, ReadChunk>({\n maxSize: chunkCacheSize,\n // decompressed bytes, not entry count: we fetch compressed and cache\n // decompressed, and an entry is a whole chunk\n sizeOf: read => read.buffer.byteLength,\n cacheKey: chunk => chunk.toString(),\n idleTimeoutMs: chunkCacheIdleTimeoutMs,\n budget: chunkCacheBudget,\n fill: (chunk, signal) => this.readChunk(chunk, { signal }),\n })\n }\n\n /**\n * Drops every decompressed chunk held by the cache, and stops the idle sweep\n * until something is cached again.\n *\n * `chunkCacheIdleTimeoutMs` reclaims a view the user has wandered away from;\n * this is for a consumer that knows it is finished \u2014 a closed track, a\n * changed assembly \u2014 and should not have to wait it out.\n */\n clearChunkCache() {\n this.chunkCache.clear()\n }\n\n /**\n * Estimates the compressed byte size of the index chunks covering the given\n * regions. Useful for byte budgeting before issuing a `getLines` call to\n * decide whether a region is too large to fetch.\n */\n async bytesForRegions(\n regions: { refName: string; start: number; end: number }[],\n opts: Options = {},\n ) {\n const all: Chunk[] = []\n for (const { refName, start, end } of regions) {\n const chunks = await this.index.blocksForRange(refName, start, end, opts)\n for (const chunk of chunks) {\n all.push(chunk)\n }\n }\n let bytes = 0\n for (const chunk of optimizeChunks(all)) {\n bytes += chunk.fetchedSize()\n }\n return bytes\n }\n\n /**\n * @param refName name of the reference sequence\n * @param s start of the region (0-based half-open)\n * @param e end of the region (0-based half-open)\n * @param opts callback invoked for each line, or an options object with `lineCallback` and optional `signal`\n */\n async getLines(\n refName: string,\n s: number | undefined,\n e: number | undefined,\n opts: GetLinesOpts | GetLinesCallback,\n ) {\n let signal: AbortSignal | undefined\n let options: Options = {}\n let callback: GetLinesCallback\n let onProgress: GetLinesOpts['onProgress']\n\n if (typeof opts === 'function') {\n callback = opts\n } else {\n options = opts\n callback = opts.lineCallback\n signal = opts.signal\n onProgress = opts.onProgress\n }\n\n const metadata = await this.index.getMetadata(options)\n const start = s ?? 0\n const end = e ?? metadata.maxRefLength\n if (start > end) {\n throw new TypeError(\n 'invalid start and end coordinates. start must be less than or equal to end',\n )\n }\n if (start === end) {\n return\n }\n\n const chunks = await this.index.blocksForRange(refName, start, end, options)\n\n const isVCF = metadata.format === 'VCF'\n const refCol = metadata.columnNumbers.ref || 0\n const startCol = metadata.columnNumbers.start || 0\n const endCol = isVCF ? 8 : metadata.columnNumbers.end || 0\n const maxColumn = Math.max(refCol, startCol, endCol)\n const metaCharCode = metadata.metaChar?.charCodeAt(0)\n const coordinateOffset =\n metadata.coordinateType === '1-based-closed' ? -1 : 0\n\n const encoder = new TextEncoder()\n const decoder = new TextDecoder()\n const regionRefNameBytes = encoder.encode(refName)\n // tabs[N] holds the byte offset of the N-th tab on the current line; with\n // the sentinel tabs[0] = blockStart - 1, column N spans tabs[N-1]+1..tabs[N]\n const tabs = new Int32Array(maxColumn + 1)\n\n let totalBytes = 0\n for (const c of chunks) {\n totalBytes += c.fetchedSize()\n }\n let downloadedBytes = 0\n onProgress?.(0, totalBytes)\n\n // Read ahead, but only as far as the scan has earned. Every chunk is its\n // own range request, so a query spanning many of them pays a network round\n // trip apiece, serially \u2014 for a remote file that dominates, well ahead of\n // decompression (1kg.chr1 over a 1Mb window reads 22 chunks in a row).\n //\n // A fixed window would be wrong, though: blocksForRange offers a chunk per\n // overlapping bin across every level, and on a sparse file the early return\n // below can stop the scan inside the first one, leaving the rest untouched.\n // max_off drops only the chunks it can prove lie past the query, so the\n // scan can still end before the last one it is offered. Prefetching those\n // would multiply the bytes such a query fetches for no gain.\n //\n // Finishing a chunk without hitting the early return proves the next chunk\n // has to be examined, so the window starts at one and doubles per chunk\n // consumed. A query that stops in its first chunk issues exactly the reads\n // a sequential scan did; a long scan reaches full concurrency after three.\n let readAhead = 1\n const reads: Promise<ReadChunk>[] = []\n const ensureReadsStarted = (count: number) => {\n while (reads.length < Math.min(count, chunks.length)) {\n const c = chunks[reads.length]!\n const read = this.chunkCache.get(c, signal)\n void read.catch(() => {\n // a prefetch the early return skips is never awaited, so swallow its\n // rejection here rather than let it surface unhandled\n })\n reads.push(read)\n }\n }\n ensureReadsStarted(1)\n\n for (let ci = 0, cl = chunks.length; ci < cl; ci++) {\n const c = chunks[ci]!\n const { buffer, cpositions, dpositions } = await reads[ci]!\n downloadedBytes += c.fetchedSize()\n onProgress?.(downloadedBytes, totalBytes)\n const minvDataPosition = c.minv.dataPosition\n\n let blockStart = 0\n let pos = 0\n\n while (blockStart < buffer.length) {\n const n = buffer.indexOf(NEWLINE, blockStart)\n if (n === -1) {\n break\n }\n\n const target = blockStart + minvDataPosition\n while (pos < dpositions.length && target >= dpositions[pos]!) {\n pos++\n }\n\n // skip meta lines\n if (metaCharCode !== undefined && buffer[blockStart] === metaCharCode) {\n blockStart = n + 1\n continue\n }\n\n // find tab positions. Columns past the end of the line all get `n`\n // rather than breaking out, which would leave stale offsets from the\n // previous line in the tail of the array.\n tabs[0] = blockStart - 1\n for (let i = 0; i < maxColumn; i++) {\n const prev = tabs[i]!\n const tabPos = prev < n ? buffer.indexOf(TAB, prev + 1) : -1\n tabs[i + 1] = tabPos === -1 || tabPos >= n ? n : tabPos\n }\n\n // compare ref name bytes directly\n const refStart = tabs[refCol - 1]! + 1\n const refEnd = tabs[refCol]!\n const refLen = refEnd - refStart\n if (refLen !== regionRefNameBytes.length) {\n blockStart = n + 1\n continue\n }\n let isRefMatch = true\n for (let i = 0; i < refLen; i++) {\n if (buffer[refStart + i] !== regionRefNameBytes[i]) {\n isRefMatch = false\n break\n }\n }\n if (!isRefMatch) {\n blockStart = n + 1\n continue\n }\n\n // parse start coordinate\n const startCoordinate =\n parseIntFromBytes(buffer, tabs[startCol - 1]! + 1, tabs[startCol]!) +\n coordinateOffset\n\n if (startCoordinate >= end) {\n return\n }\n\n // parse end coordinate\n let endCoordinate: number\n if (endCol === 0 || endCol === startCol) {\n endCoordinate = startCoordinate + 1\n } else if (isVCF) {\n endCoordinate = getVcfEnd(\n buffer,\n startCoordinate,\n tabs[3]! + 1,\n tabs[4]!,\n tabs[endCol - 1]! + 1,\n tabs[endCol]!,\n )\n } else {\n endCoordinate = parseIntFromBytes(\n buffer,\n tabs[endCol - 1]! + 1,\n tabs[endCol]!,\n )\n }\n\n if (endCoordinate > start) {\n // trim a CRLF terminator, matching htslib's line reader\n const lineEnd = buffer[n - 1] === CARRIAGE_RETURN ? n - 1 : n\n const line = decoder.decode(buffer.subarray(blockStart, lineEnd))\n callback(\n line,\n calculateFileOffset(\n cpositions,\n dpositions,\n pos,\n blockStart,\n minvDataPosition,\n ),\n startCoordinate,\n endCoordinate,\n )\n }\n blockStart = n + 1\n }\n\n // every line in this chunk was still inside the query, so the next chunk\n // has to be examined too - widen the window and start the reads for it\n readAhead = Math.min(readAhead * 2, MAX_READ_AHEAD_CHUNKS)\n ensureReadsStarted(ci + 1 + readAhead)\n }\n }\n\n /** @internal */\n async getMetadata(opts: Options = {}) {\n return this.index.getMetadata(opts)\n }\n\n /**\n * The file's leading blocks, decompressed: everything from the start through\n * the end of the block holding the first data line.\n */\n private async readHeaderBytes(opts: Options) {\n const { firstDataLine, maxBlockSize } = await this.getMetadata(opts)\n\n const maxFetch = (firstDataLine?.blockPosition ?? 0) + maxBlockSize\n // TODO: what if we don't have a firstDataLine, and the header actually\n // takes up more than one block? this case is not covered here\n\n const buf = await this.filehandle.read(maxFetch, 0, opts)\n return unzip(buf)\n }\n\n /**\n * Both header forms, from one read of the same bytes: the commented block\n * `tabix -H` prints, and the rows `tabix -S N` counted.\n *\n * Memoized, because asking for one and then the other is the normal way to\n * find a header whichever way the file keeps it (see `getHeaderLines`), and\n * that used to fetch and decompress the file's leading blocks twice. Only\n * the parsed results are retained \u2014 the decompressed bytes are dropped,\n * which matters for a VCF header that can run to megabytes.\n */\n private async parseHeader(opts: Options) {\n const { metaChar, skipLines = 0 } = await this.getMetadata(opts)\n const bytes = await this.readHeaderBytes(opts)\n return {\n header: textDecoder.decode(\n metaChar ? trimToMetaLines(bytes, metaChar) : bytes,\n ),\n skippedLines: skipLines > 0 ? firstLines(bytes, skipLines) : [],\n }\n }\n\n /**\n * Parse the header, or join the parse already running.\n *\n * `parseHeader` threads `opts` into both `getMetadata` and the header read,\n * so memoizing it on the first caller's opts put that caller's signal in\n * charge of a read every later caller joins: when it aborted, they failed\n * with its cancellation, their own signals untouched.\n *\n * The same cache the chunk reads use, and the same rule: the parse runs under\n * a signal of its own and is cancelled only once every caller waiting on it\n * has given up, so one caller's abort is reported to that caller alone and a\n * bystander gets the parse already in flight. There is no retry here because\n * there is nothing to retry \u2014 the parse a bystander joined is not cancelled by\n * someone else's abort. A rejection is dropped rather than cached, so a\n * transient failure does not poison the header for the life of the file.\n *\n * The fill is per call rather than on the cache, so the caller that starts the\n * parse has its `onProgress` reach the index download inside `getMetadata`.\n *\n * SYNC: ~/src/gmod/bam-js/src/bamFile.ts getHeader \u2014 same shape for the same\n * reason, on the header rather than the index.\n */\n private getParsedHeader(opts: Options = {}) {\n return this.headerCache.get('header', opts.signal, signal =>\n this.parseHeader({ ...opts, signal }),\n )\n }\n\n /**\n * The bytes of the commented header. Deliberately not memoized, unlike the\n * string form: this hands back the buffer, and holding one for the lifetime\n * of the file is the caller's decision to make.\n */\n async getHeaderBuffer(opts: Options = {}) {\n const { metaChar } = await this.getMetadata(opts)\n const bytes = await this.readHeaderBytes(opts)\n return metaChar ? trimToMetaLines(bytes, metaChar) : bytes\n }\n\n /**\n * The leading lines the index says to skip \u2014 `tabix -S N` \u2014 which is where a\n * file whose header row is not commented keeps it. Empty when the index\n * records no skipped lines.\n *\n * Deliberately not part of `getHeader`. htslib draws the same distinction:\n * its indexer treats a line as non-data when `lineno <= line_skip` OR it\n * begins with the meta character (tbx.c), while `tabix -H` prints only the\n * leading meta-character lines and never consults line_skip (tabix.c).\n * `getHeader` mirrors `-H`, so a bare header row is absent from it, and\n * callers that need one were left re-reading the file themselves \u2014 guessing\n * at a read size, and unable to tell a headerless file from an uncommented\n * one. PLINK `.ld`, bedGraph and BED deflines are all routinely written this\n * way.\n */\n async getSkippedLines(opts: Options = {}) {\n const { skipLines = 0 } = await this.getMetadata(opts)\n // the index already answers this without reading the file at all\n if (skipLines <= 0) {\n return []\n }\n return (await this.getParsedHeader(opts)).skippedLines\n }\n\n async getHeader(opts: Options = {}) {\n return (await this.getParsedHeader(opts)).header\n }\n\n /**\n * The file's header lines, however that file keeps them: the meta-character\n * block when there is one, and otherwise the rows the index counted. Empty\n * lines are dropped.\n *\n * The two halves answer different questions (see `getSkippedLines`), but\n * \"what are this file's header lines\" is nearly always the question a caller\n * actually has, and answering it from `getHeader` alone is wrong in a way\n * that doesn't announce itself: a bare header row comes back as the empty\n * string, indistinguishable from a file that has no header, so callers fall\n * back to an assumed column layout and quietly mis-name columns. Deciding it\n * here also means one read of the leading blocks instead of two.\n */\n async getHeaderLines(opts: Options = {}) {\n const { header, skippedLines } = await this.getParsedHeader(opts)\n return (header ? header.split(/\\r?\\n/) : skippedLines).filter(Boolean)\n }\n\n async getReferenceSequenceNames(opts: Options = {}) {\n const metadata = await this.getMetadata(opts)\n return metadata.refIdToName\n }\n\n /** @param refName reference sequence name */\n async lineCount(refName: string, opts: Options = {}) {\n return this.index.lineCount(refName, opts)\n }\n\n /** @internal */\n async readChunk(c: Chunk, opts: Options = {}) {\n const ret = await this.filehandle.read(\n c.fetchedSize(),\n c.minv.blockPosition,\n opts,\n )\n // Awaited rather than stored resolved: the pool is commonly handed over as\n // the pending promise from getSharedWorkerPool(), and awaiting an\n // already-settled promise costs a microtask.\n const pool = await this.bgzfWorkerPool\n return unzipChunkSlice(ret, c, pool)\n }\n}\n", "import { TabixIndexedFile } from '@gmod/tabix'\nimport { cachedSetup } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { openLocation, openTabixIndexFilehandle } from '@jbrowse/core/util/io'\n\nimport {\n panSNContig,\n panSNHaplotype,\n panSNMatchesPrefix,\n panSNSample,\n resolvePanSNPrefix,\n} from './pansn.ts'\n\nimport type {\n BaseFeatureDataAdapter,\n BaseOptions,\n} from '@jbrowse/core/data_adapters/BaseAdapter'\nimport type { Region } from '@jbrowse/core/util/types'\n\n// What a tabix-indexed graph track answers about its own reference names, for\n// the two adapters that read one: `RgfaTabixAdapter` over segments and links,\n// and `MinigraphBubbleAdapter` over bubbles.\n//\n// The two carried this verbatim \u2014 the opener, the cached lookup, `getRefNames`,\n// `resolve` \u2014 and the bubble adapter reached across into\n// `RgfaTabixAdapter/rgfaBed.ts` for the lookup half, which is a BED row grammar\n// and not this. Same reason `ComparativeAdapterBase` exists: the answers that do\n// not depend on which config slot names the file belong in one place.\n//\n// A class rather than a base class, for the reason that file records: a base\n// generic over the config cannot prove a slot name to `getConf`, so the adapter\n// keeps the two lines that read its own slots and hands over the file. Reading\n// `assemblyNameToPanSN` IS hoistable, because every schema here declares it and\n// `resolvePanSNPrefix` is already generic over the base adapter type.\n\n// Tabix's own cache, per file. Large because a graph query is a scattered read\n// over a small index: the segment and link files for a 5 Mb window are tens of\n// kB of compressed blocks, and re-fetching them per pan is the cost this avoids.\nconst CHUNK_CACHE_SIZE = 50 * 2 ** 20\n\n// One indexed file from the pair of slots that names it: the data location, and\n// an index slot holding its own `location` and `indexType`. Paths, so the pair\n// can sit in a sub-schema.\nexport function openTabixSlot(\n adapter: BaseFeatureDataAdapter,\n location: string[],\n index: string[],\n) {\n const pm = adapter.pluginManager\n return new TabixIndexedFile({\n filehandle: openLocation(adapter.getConf(location), pm),\n ...openTabixIndexFilehandle(\n adapter.getConf([...index, 'location']),\n adapter.getConf([...index, 'indexType']),\n pm,\n ),\n chunkCacheSize: CHUNK_CACHE_SIZE,\n })\n}\n\n// A tab can occur in neither half \u2014 both come out of BED columns.\nfunction qualifiedKey(assemblyName: string, refName: string) {\n return `${assemblyName}\\t${refName}`\n}\n\n// The stable sequences in these files are usually PanSN (`K12#1#chr`) while the\n// assembly asking for them uses the bare contig (`chr` in assembly `K12`). One\n// map answers both spellings: the raw tabix name, plus a sample+contig key for\n// PanSN names.\nexport function buildRefNameLookup(tabixRefNames: string[]) {\n const lookup = new Map<string, string>()\n for (const name of tabixRefNames) {\n lookup.set(name, name)\n const sample = panSNSample(name)\n if (sample !== name) {\n const contig = panSNContig(name)\n lookup.set(qualifiedKey(sample, contig), name)\n const haplotype = panSNHaplotype(name)\n if (haplotype !== undefined) {\n lookup.set(qualifiedKey(haplotype, contig), name)\n }\n }\n }\n return lookup\n}\n\nexport function resolveRefName(\n lookup: Map<string, string>,\n assemblyName: string,\n refName: string,\n) {\n const qualified = lookup.get(qualifiedKey(assemblyName, refName))\n return qualified === undefined ? lookup.get(refName) : qualified\n}\n\n/**\n * The reference-name half of a tabix graph track, against one indexed file.\n *\n * Constructed with the file the adapter's own slots opened, so this never reads\n * a slot whose name it cannot prove.\n */\nexport class PanSNRefNames {\n // Read once and shared by every query, so it takes on no caller's signal: a\n // track fetch the user panned away from once aborted the read a graph cut\n // was waiting on. cachedSetup withholds the signal and retries a failed read.\n private lookup = cachedSetup({\n setup: async opts =>\n buildRefNameLookup(await this.file.getReferenceSequenceNames(opts)),\n })\n\n constructor(\n private file: TabixIndexedFile,\n private adapter: BaseFeatureDataAdapter,\n ) {}\n\n /**\n * The names the ASSEMBLY uses, not the graph's own.\n *\n * A minigraph graph's stable names are already bare (`chr6`) and pass\n * straight through; a Minigraph-Cactus graph's are PanSN, and returning\n * `GRCh38#0#chr6` here makes JBrowse decide the track has no data for `chr6`\n * and never query it \u2014 the graph view still worked, because it resolves per\n * region rather than through this list, which is exactly how the empty tracks\n * were spotted.\n */\n async assemblyRefNames(opts: BaseOptions = {}) {\n const names = await this.file.getReferenceSequenceNames(opts)\n const prefix = resolvePanSNPrefix(this.adapter, opts.assemblyName)\n const contigs = names\n .filter(n => panSNMatchesPrefix(n, prefix))\n .map(n => panSNContig(n))\n return contigs.length > 0 ? contigs : names\n }\n\n /**\n * The file's own stable name for a region, or undefined when it holds no\n * sequence answering to it.\n *\n * The graph's stable names may be PanSN (`GRCh38#0#chr1`), in which case the\n * assembly name is not the sample prefix; `assemblyNameToPanSN` maps the two,\n * the same slot and helper the all-vs-all PAF adapters use.\n */\n async resolve(region: Region, opts?: BaseOptions) {\n const lookup = await this.lookup(opts)\n return resolveRefName(\n lookup,\n resolvePanSNPrefix(this.adapter, region.assemblyName),\n region.refName,\n )\n }\n}\n"],
|
|
5
|
+
"mappings": "oMAoBO,IAAIA,GAAa,EAEjB,IAAIC,GAAe,EAEnB,IAAIC,GAAW,EAOf,IAAIC,GAAO,EACPC,GAAe,EACfC,GAAc,EAKlB,IAAIC,GAAc,GCtCzB,SAASC,GAAKC,EAAKC,EAAG,CACpB,OAAO,OAAO,UAAU,eAAe,KAAKD,EAAKC,CAAG,CACtD,CAEM,SAAUC,GAAOF,EAAgC,CAErD,QADIG,EAAU,MAAM,UAAU,MAAM,KAAK,UAAW,CAAC,EAC9CA,EAAQ,QAAQ,CACrB,IAAIC,EAASD,EAAQ,MAAK,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,EACAJ,EACAC,EACA,CACA,IAAMY,EAAYT,EAAO,IAAIL,GAAaC,EAAcC,CAAO,CAAC,EAChE,OAAOY,IAAc,OAAYT,EAAO,IAAIH,CAAO,EAAIY,CACzD,CAQO,IAAMC,GAAN,KAAoB,CASzB,YACUC,EACArB,EACR,CAFQ,UAAAqB,EACA,aAAArB,EAPV,KAAQ,UAAS,gBAAY,CAC3B,MAAO,MAAMsB,GACXd,GAAmB,MAAM,KAAK,KAAK,0BAA0Bc,CAAI,CAAC,CACtE,CAAC,CAKE,CAYH,MAAM,iBAAiBA,EAAoB,CAAC,EAAG,CAC7C,IAAMC,EAAQ,MAAM,KAAK,KAAK,0BAA0BD,CAAI,EACtDE,EAASC,GAAmB,KAAK,QAASH,EAAK,YAAY,EAC3DI,EAAUH,EACb,OAAOI,GAAKC,GAAmBD,EAAGH,CAAM,CAAC,EACzC,IAAIG,GAAKZ,GAAYY,CAAC,CAAC,EAC1B,OAAOD,EAAQ,OAAS,EAAIA,EAAUH,CACxC,CAUA,MAAM,QAAQM,EAAgBP,EAAoB,CAChD,IAAMZ,EAAS,MAAM,KAAK,OAAOY,CAAI,EACrC,OAAOJ,GACLR,EACAe,GAAmB,KAAK,QAASI,EAAO,YAAY,EACpDA,EAAO,OACT,CACF,CACF",
|
|
6
|
+
"names": ["Z_NO_FLUSH", "Z_SYNC_FLUSH", "Z_FINISH", "Z_OK", "Z_STREAM_END", "Z_NEED_DICT", "Z_BUF_ERROR", "_has", "obj", "key", "assign", "sources", "source", "p", "shrinkBuf", "buf", "size", "fnTyped", "dest", "src", "src_offs", "len", "dest_offs", "i", "chunks", "l", "pos", "chunk", "result", "fnUntyped", "typedOK", "supported", "arraySet", "flattenChunks", "Buf8", "Buf16", "Buf32", "strApplyOK", "result", "strApplyUintOK", "utf8len", "c", "table", "Buf8", "q", "arg", "string2buf", "str", "buf", "c2", "m_pos", "i", "str_len", "buf_len", "_buf2binstring", "len", "shrinkBuf", "binstring2buf", "str", "buf", "i", "len", "buf2string", "max", "out", "c", "c_len", "utf16buf", "utf8len", "_buf2binstring", "utf8border", "pos", "GZheader", "adler32", "adler", "buf", "len", "pos", "s1", "s2", "n", "makeTable", "c", "table", "n", "k", "crcTable", "crc32", "crc", "buf", "len", "pos", "t", "end", "i", "BAD", "TYPE", "inflate_fast", "strm", "start", "state", "_in", "last", "_out", "beg", "end", "dmax", "wsize", "whave", "wnext", "s_window", "hold", "bits", "lcode", "dcode", "lmask", "dmask", "here", "op", "len", "dist", "from", "from_source", "input", "output", "top", "dolen", "dodist", "MAXBITS", "ENOUGH_LENS", "ENOUGH_DISTS", "CODES", "LENS", "DISTS", "lbase", "lext", "dbase", "dext", "inflate_table", "type", "lens", "lens_index", "codes", "table", "table_index", "work", "opts", "bits", "len", "sym", "min", "max", "root", "curr", "drop", "left", "used", "huff", "incr", "fill", "low", "mask", "next", "base", "base_index", "end", "count", "Buf16", "offs", "extra", "extra_index", "here_bits", "here_op", "here_val", "CODES", "LENS", "DISTS", "Z_FINISH", "Z_BLOCK", "Z_TREES", "Z_OK", "Z_STREAM_END", "Z_NEED_DICT", "Z_STREAM_ERROR", "Z_DATA_ERROR", "Z_MEM_ERROR", "Z_BUF_ERROR", "Z_DEFLATED", "HEAD", "FLAGS", "TIME", "OS", "EXLEN", "EXTRA", "NAME", "COMMENT", "HCRC", "DICTID", "DICT", "TYPE", "TYPEDO", "STORED", "COPY_", "COPY", "TABLE", "LENLENS", "CODELENS", "LEN_", "LEN", "LENEXT", "DIST", "DISTEXT", "MATCH", "LIT", "CHECK", "LENGTH", "DONE", "BAD", "MEM", "SYNC", "ENOUGH_LENS", "ENOUGH_DISTS", "zswap32", "q", "InflateState", "Buf16", "inflateResetKeep", "strm", "state", "Z_STREAM_ERROR", "HEAD", "Buf32", "ENOUGH_LENS", "ENOUGH_DISTS", "Z_OK", "inflateReset", "inflateReset2", "windowBits", "wrap", "inflateInit2", "ret", "virgin", "lenfix", "distfix", "fixedtables", "state", "sym", "Buf32", "inflate_table", "LENS", "DISTS", "updatewindow", "strm", "src", "end", "copy", "dist", "Buf8", "arraySet", "inflate", "flush", "input", "output", "next", "put", "have", "left", "hold", "bits", "_in", "_out", "from", "from_source", "here", "here_bits", "here_op", "here_val", "last_bits", "last_op", "last_val", "len", "ret", "hbuf", "opts", "n", "order", "Z_STREAM_ERROR", "TYPE", "TYPEDO", "Z_OK", "inf_leave", "HEAD", "crc32", "FLAGS", "BAD", "Z_DEFLATED", "DICTID", "TIME", "OS", "EXLEN", "EXTRA", "NAME", "COMMENT", "HCRC", "zswap32", "DICT", "Z_NEED_DICT", "Z_BLOCK", "Z_TREES", "CHECK", "STORED", "LEN_", "TABLE", "COPY_", "COPY", "LENLENS", "CODES", "CODELENS", "LEN", "inflate_fast", "LIT", "LENEXT", "DIST", "DISTEXT", "MATCH", "adler32", "LENGTH", "DONE", "Z_STREAM_END", "Z_DATA_ERROR", "MEM", "Z_MEM_ERROR", "SYNC", "Z_FINISH", "Z_BUF_ERROR", "inflateEnd", "inflateGetHeader", "head", "inflateSetDictionary", "dictionary", "dictLength", "dictid", "messages_default", "ZStream", "toString", "Inflate", "_Inflate", "options", "assign", "opt", "ZStream", "status", "inflateInit2", "Z_OK", "messages_default", "GZheader", "inflateGetHeader", "string2buf", "inflateSetDictionary", "data", "mode", "strm", "chunkSize", "dictionary", "_mode", "next_out_utf8", "tail", "utf8str", "dict", "allowBufError", "Z_FINISH", "Z_NO_FLUSH", "binstring2buf", "Buf8", "inflate", "Z_NEED_DICT", "Z_BUF_ERROR", "Z_STREAM_END", "Z_SYNC_FLUSH", "utf8border", "buf2string", "arraySet", "shrinkBuf", "inflateEnd", "chunk", "flattenChunks", "input", "inflator", "ungzip", "inflate", "scanBgzfBlocks", "input", "minBlockPosition", "maxBlockPosition", "blocks", "offset", "filePosition", "bsize", "trailerPos", "isize", "concatUint8Array", "args", "total", "entry", "mergedArray", "offset", "__webpack_require__", "exports", "definition", "i", "key", "binding", "obj", "prop", "bgzf_wasm_bg_namespaceObject", "ChunkSliceResult", "__wbg_Error_92b29b0548f8b746", "__wbg___wbindgen_throw_344f42d3211c4765", "__wbg_set_wasm", "decompress_all", "decompress_chunk_slice", "wasm_bgzf_wasm_bg_namespaceObject", "_ChunkSliceResult", "ptr", "ChunkSliceResultFinalization", "wasm", "retptr", "r0", "getDataViewMemory0", "r1", "v1", "getArrayU8FromWasm0", "getArrayF64FromWasm0", "input", "ptr0", "passArray8ToWasm0", "len0", "WASM_VECTOR_LEN", "r2", "r3", "takeObject", "v2", "min_block_position", "min_data_position", "max_block_position", "max_data_position", "arg0", "arg1", "ret", "getStringFromWasm0", "addHeapObject", "heap_next", "heap", "idx", "dropObject", "len", "getFloat64ArrayMemory0", "getUint8ArrayMemory0", "cachedDataViewMemory0", "cachedFloat64ArrayMemory0", "decodeText", "cachedUint8ArrayMemory0", "getObject", "arg", "malloc", "cachedTextDecoder", "MAX_SAFARI_DECODE_BYTES", "numBytesDecoded", "val", "wrapper_wasm", "initPromise", "init", "bytes", "instance", "decompressAll", "decompressChunkSlice", "minBlockPosition", "minDataPosition", "maxBlockPosition", "maxDataPosition", "result", "buffer", "cpositions", "dpositions", "BGZF_MIN_BLOCK_SIZE", "hasGzipHeader", "data", "hasBgzfHeader", "errorMessage", "error", "decompressGzip", "inputData", "stream", "ungzip", "wrapGzipHeaderError", "unzip", "decompressAll", "assembleChunkSliceResult", "blocks", "infos", "minv", "maxv", "cpositions", "dpositions", "slices", "dpos", "i", "block", "info", "isLast", "start", "end", "concatUint8Array", "POOL_MIN_DECOMPRESSED_BYTES", "decompressedBytes", "total", "unzipChunkSlice", "chunk", "workerPool", "scanBgzfBlocks", "result", "decompressChunkSlice", "throwIfAborted", "signal", "abortReason", "reason", "unrefIfPossible", "timer", "SharedReadCache", "fill", "maxSize", "sizeOf", "cacheKey", "key", "evictionPolicy", "idleTimeoutMs", "budget", "signal", "throwIfAborted", "entry", "value", "e", "unsubscribe", "_resolve", "reject", "abortReason", "timeout", "cutoff", "sweepable", "interval", "run", "s", "controller", "settle", "size", "delta", "toBytes", "src", "readBody", "encoding", "onProgress", "toBytesWithProgress", "splitReadFileOptions", "options", "parseContentRangeSize", "contentRange", "size", "parseContentLength", "res", "header", "parsed", "PROGRESS_THROTTLE_MS", "total", "body", "bytes", "reader", "out", "received", "lastTick", "chunk", "grown", "now", "mergeHeaders", "headers", "ours", "names", "k", "kept", "isByteOffset", "n", "getMessage", "e", "RemoteFile", "source", "opts", "extraHeaders", "signal", "input", "init", "wrapError", "response", "length", "position", "res", "size", "parseContentRangeSize", "resData", "toBytesWithProgress", "toBytes", "options", "encoding", "splitReadFileOptions", "body", "readBody", "LocalFile", "source", "_opts", "_options", "_length", "_position", "Chunk", "minv", "maxv", "bin", "endPosition", "QuickLRU", "options", "_QuickLRU_size", "_QuickLRU_cache", "_QuickLRU_oldCache", "_QuickLRU_maxSize", "_QuickLRU_maxAge", "_QuickLRU_onEviction", "__classPrivateFieldSet", "__classPrivateFieldGet", "key", "item", "_QuickLRU_instances", "_QuickLRU_getItemValue", "_QuickLRU_deleteIfExpired", "_QuickLRU_moveToRecent", "value", "maxAge", "expiry", "_QuickLRU_set", "_QuickLRU_peek", "deleted", "_a", "newSize", "items", "_QuickLRU_entriesAscending", "removeCount", "_QuickLRU_emitEvictions", "count", "requested", "evictCount", "cache", "_QuickLRU_getOrDeleteIfExpired", "i", "oldCacheSize", "callbackFunction", "thisArgument", "longFromBytesToUnsigned", "source", "i", "low", "VirtualOffset", "blockPosition", "dataPosition", "b", "fromBytes", "bytes", "offset", "optimizeChunks", "chunks", "lowest", "n", "filtered", "lowestBlock", "lowestData", "i", "chunk", "c0", "c1", "dif", "mergedChunks", "lastMinBlock", "lastMaxBlock", "chunkMinBlock", "chunkMaxBlock", "lastChunk", "Chunk", "makeDisjoint", "out", "prevMax", "clampChunkEnds", "extraBoundaries", "boundaries", "c", "a", "b", "max", "lo", "hi", "mid", "minVirtualOffset", "bytes", "offset", "count", "current", "minBlock", "minData", "found", "p", "block", "data", "VirtualOffset", "parseNameBytes", "namesBytes", "decoder", "refIdToName", "refNameToId", "currRefId", "pos", "end", "refName", "tabixFormats", "parseAuxData", "dataView", "formatFlags", "coordinateType", "format", "columnNumbers", "metaValue", "metaChar", "skipLines", "nameSectionLength", "parsePseudoBin", "longFromBytesToUnsigned", "memoizeByRefId", "getIndices", "maxSize", "lru", "QuickLRU", "refId", "cached", "result", "maxOffset", "binIndex", "end", "minShift", "depth", "binCount", "bin", "chunks", "lowest", "i", "minv", "IndexFile", "SharedReadCache", "filehandle", "opts", "buf", "bytes", "unzip", "refName", "indexData", "refId", "_indices", "rest", "min", "max", "ba", "start", "binChunks", "c", "merged", "optimizeChunks", "past", "n", "signal", "seqId", "CSI1_MAGIC", "CSI2_MAGIC", "lshift", "num", "bits", "rshift", "CSI", "IndexFile", "opts", "bytes", "dataView", "magic", "csiVersion", "minShift", "depth", "maxBinNumber", "maxRefLength", "auxLength", "aux", "parseAuxData", "refCount", "curr", "firstDataLine", "offsets", "i", "binCount", "j", "bin", "minVirtualOffset", "chunkCount", "getIndices", "refId", "start", "pos", "binIndex", "loffsets", "stats", "parsePseudoBin", "fromBytes", "chunks", "k", "Chunk", "clampChunkEnds", "memoizeByRefId", "ref", "beg", "found", "parent", "firstChild", "end", "maxPos", "l", "t", "s", "bins", "b", "e", "TBI_MAGIC", "TBI_DEPTH", "TBI_MIN_SHIFT", "TBI_MAX_REF_LENGTH", "clampToRefLength", "pos", "TabixIndex", "IndexFile", "beg", "end", "b", "e", "bins", "ref", "linearIndex", "opts", "bytes", "dataView", "refCount", "maxBinNumber", "refNameToId", "refIdToName", "coordinateType", "format", "columnNumbers", "metaChar", "skipLines", "parseAuxData", "curr", "firstDataLine", "offsets", "i", "binCount", "j", "bin", "chunkCount", "linearCount", "minVirtualOffset", "getIndices", "refId", "start", "binIndex", "stats", "parsePseudoBin", "chunks", "k", "Chunk", "fromBytes", "clampChunkEnds", "v", "memoizeByRefId", "TAB", "NEWLINE", "CARRIAGE_RETURN", "SEMICOLON", "MAX_READ_AHEAD_CHUNKS", "DEFAULT_CHUNK_CACHE_BYTES", "DEFAULT_CHUNK_CACHE_IDLE_TIMEOUT_MS", "resolveFilehandle", "filehandle", "path", "url", "LocalFile", "RemoteFile", "resolveIndex", "tbiFilehandle", "csiFilehandle", "tbiPath", "csiPath", "tbiUrl", "csiUrl", "TabixIndex", "CSI", "calculateFileOffset", "cpositions", "dpositions", "pos", "blockStart", "minvDataPosition", "getVcfEnd", "buffer", "startCoordinate", "refStart", "refEnd", "infoStart", "infoEnd", "refLen", "endCoordinate", "fieldStart", "i", "fieldLen", "parseIntFromBytes", "textDecoder", "trimToMetaLines", "bytes", "metaChar", "lastNewline", "metaByte", "l", "byte", "firstLines", "count", "end", "start", "val", "c", "TabixIndexedFile", "SharedReadCache", "chunkCacheSize", "chunkCacheIdleTimeoutMs", "chunkCacheBudget", "bgzfWorkerPool", "read", "chunk", "signal", "regions", "opts", "all", "refName", "chunks", "optimizeChunks", "s", "e", "options", "callback", "onProgress", "metadata", "isVCF", "refCol", "startCol", "endCol", "maxColumn", "metaCharCode", "coordinateOffset", "encoder", "decoder", "regionRefNameBytes", "tabs", "totalBytes", "downloadedBytes", "readAhead", "reads", "ensureReadsStarted", "ci", "cl", "n", "target", "prev", "tabPos", "isRefMatch", "lineEnd", "line", "firstDataLine", "maxBlockSize", "maxFetch", "buf", "unzip", "skipLines", "header", "skippedLines", "ret", "pool", "unzipChunkSlice", "import_BaseAdapter", "import_io", "CHUNK_CACHE_SIZE", "openTabixSlot", "adapter", "location", "index", "pm", "TabixIndexedFile", "qualifiedKey", "assemblyName", "refName", "buildRefNameLookup", "tabixRefNames", "lookup", "name", "sample", "panSNSample", "contig", "panSNContig", "haplotype", "panSNHaplotype", "resolveRefName", "qualified", "PanSNRefNames", "file", "opts", "names", "prefix", "resolvePanSNPrefix", "contigs", "n", "panSNMatchesPrefix", "region"]
|
|
7
|
+
}
|