read-excel-file 9.3.3 → 9.3.5
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/CHANGELOG.md +9 -0
- package/README.md +32 -2
- package/browser/index.cjs +3 -0
- package/browser/index.d.ts +16 -0
- package/browser/index.js +4 -1
- package/bundle/read-excel-file.min.js +1 -1
- package/bundle/read-excel-file.min.js.map +1 -1
- package/commonjs/export/convertInputToNodeStream.js +0 -12
- package/commonjs/export/convertInputToNodeStream.js.map +1 -1
- package/commonjs/export/parseSheet.js +14 -7
- package/commonjs/export/parseSheet.js.map +1 -1
- package/commonjs/export/readSheetBrowser.js +3 -6
- package/commonjs/export/readSheetBrowser.js.map +1 -1
- package/commonjs/export/readSheetNode.js +3 -6
- package/commonjs/export/readSheetNode.js.map +1 -1
- package/commonjs/export/readSheetUniversal.js +2 -2
- package/commonjs/export/readSheetUniversal.js.map +1 -1
- package/commonjs/export/readSheetWebWorker.js +5 -5
- package/commonjs/export/readSheetWebWorker.js.map +1 -1
- package/commonjs/export/readXlsxFileBrowser.js +3 -6
- package/commonjs/export/readXlsxFileBrowser.js.map +1 -1
- package/commonjs/export/readXlsxFileNode.js +3 -6
- package/commonjs/export/readXlsxFileNode.js.map +1 -1
- package/commonjs/export/readXlsxFileUniversal.js +2 -2
- package/commonjs/export/readXlsxFileUniversal.js.map +1 -1
- package/commonjs/export/readXlsxFileWebWorker.js +5 -5
- package/commonjs/export/readXlsxFileWebWorker.js.map +1 -1
- package/commonjs/export/unpackXlsxFileBrowser.js +15 -4
- package/commonjs/export/unpackXlsxFileBrowser.js.map +1 -1
- package/commonjs/export/unpackXlsxFileBrowser.test.js.map +1 -0
- package/commonjs/export/unpackXlsxFileNode.js +32 -5
- package/commonjs/export/unpackXlsxFileNode.js.map +1 -1
- package/commonjs/export/unpackXlsxFileNode.test.js.map +1 -0
- package/commonjs/export/unpackXlsxFileUniversal.js +14 -3
- package/commonjs/export/unpackXlsxFileUniversal.js.map +1 -1
- package/commonjs/export/unpackXlsxFileUniversal.test.js.map +1 -0
- package/commonjs/parseSheetData/parseSheetData.js +9 -6
- package/commonjs/parseSheetData/parseSheetData.js.map +1 -1
- package/commonjs/saxen/parser.js +1 -1
- package/commonjs/saxen/parser.js.map +1 -1
- package/commonjs/utility/convertValuesFromUint8ArraysToStrings.js +100 -0
- package/commonjs/utility/convertValuesFromUint8ArraysToStrings.js.map +1 -0
- package/commonjs/xlsx/InvalidSpreadsheetError.js +55 -0
- package/commonjs/xlsx/InvalidSpreadsheetError.js.map +1 -0
- package/commonjs/xlsx/SheetNotFoundError.js +55 -0
- package/commonjs/xlsx/SheetNotFoundError.js.map +1 -0
- package/commonjs/xlsx/file/InputValidationStream.js +101 -0
- package/commonjs/xlsx/file/InputValidationStream.js.map +1 -0
- package/commonjs/xlsx/file/InputValidationStream.test.js.map +1 -0
- package/commonjs/xlsx/file/InvalidInputError.js +105 -0
- package/commonjs/xlsx/file/InvalidInputError.js.map +1 -0
- package/commonjs/xlsx/file/createFileTypeDetector.js +70 -0
- package/commonjs/xlsx/file/createFileTypeDetector.js.map +1 -0
- package/commonjs/xlsx/file/createFileTypeDetector.test.js.map +1 -0
- package/commonjs/xlsx/file/validateLeadingBytes.js +47 -0
- package/commonjs/xlsx/file/validateLeadingBytes.js.map +1 -0
- package/commonjs/xlsx/file/validateLeadingBytes.test.js.map +1 -0
- package/commonjs/xlsx/isDateFormat.js +32 -27
- package/commonjs/xlsx/isDateFormat.js.map +1 -1
- package/commonjs/xlsx/isDateFormatStyle.js +19 -21
- package/commonjs/xlsx/isDateFormatStyle.js.map +1 -1
- package/commonjs/xlsx/parseCell.js +252 -115
- package/commonjs/xlsx/parseCell.js.map +1 -1
- package/commonjs/xlsx/parseCellAddress.js +22 -18
- package/commonjs/xlsx/parseCellAddress.js.map +1 -1
- package/commonjs/xlsx/parseExcelDate.js +4 -124
- package/commonjs/xlsx/parseExcelDate.js.map +1 -1
- package/commonjs/xlsx/parseExcelDate.test.js.map +1 -1
- package/commonjs/xlsx/parseExcelTimestamp.js +139 -0
- package/commonjs/xlsx/parseExcelTimestamp.js.map +1 -0
- package/commonjs/xlsx/parseFilePaths.js +48 -47
- package/commonjs/xlsx/parseFilePaths.js.map +1 -1
- package/commonjs/xlsx/parseSharedStrings.js +91 -36
- package/commonjs/xlsx/parseSharedStrings.js.map +1 -1
- package/commonjs/xlsx/parseSheet.js +527 -69
- package/commonjs/xlsx/parseSheet.js.map +1 -1
- package/commonjs/xlsx/parseSpreadsheetContents.js +154 -83
- package/commonjs/xlsx/parseSpreadsheetContents.js.map +1 -1
- package/commonjs/xlsx/parseSpreadsheetInfo.js +60 -59
- package/commonjs/xlsx/parseSpreadsheetInfo.js.map +1 -1
- package/commonjs/xlsx/parseStyles.js +75 -75
- package/commonjs/xlsx/parseStyles.js.map +1 -1
- package/commonjs/xml/parseXml.js +112 -0
- package/commonjs/xml/parseXml.js.map +1 -0
- package/commonjs/xml/parseXml.test.js.map +1 -0
- package/commonjs/xml/parseXmlStream.js.map +1 -1
- package/commonjs/xml/parseXmlStream.sax.js +69 -28
- package/commonjs/xml/parseXmlStream.sax.js.map +1 -1
- package/commonjs/xml/parseXmlStream.saxen.js +66 -40
- package/commonjs/xml/parseXmlStream.saxen.js.map +1 -1
- package/commonjs/zip/UnzipError.js +55 -0
- package/commonjs/zip/UnzipError.js.map +1 -0
- package/commonjs/zip/unzipFromArrayBuffer.js +21 -1
- package/commonjs/zip/unzipFromArrayBuffer.js.map +1 -1
- package/commonjs/zip/unzipFromArrayBuffer.test.js.map +1 -0
- package/commonjs/zip/unzipFromStream.fflate.js +43 -35
- package/commonjs/zip/unzipFromStream.fflate.js.map +1 -1
- package/commonjs/zip/unzipFromStream.js +188 -6
- package/commonjs/zip/unzipFromStream.js.map +1 -1
- package/commonjs/zip/unzipFromStream.unzipper.js +19 -34
- package/commonjs/zip/unzipFromStream.unzipper.js.map +1 -1
- package/modules/export/convertInputToNodeStream.js +0 -12
- package/modules/export/convertInputToNodeStream.js.map +1 -1
- package/modules/export/parseSheet.js +13 -6
- package/modules/export/parseSheet.js.map +1 -1
- package/modules/export/readSheetBrowser.js +3 -5
- package/modules/export/readSheetBrowser.js.map +1 -1
- package/modules/export/readSheetNode.js +3 -5
- package/modules/export/readSheetNode.js.map +1 -1
- package/modules/export/readSheetUniversal.js +2 -2
- package/modules/export/readSheetUniversal.js.map +1 -1
- package/modules/export/readSheetWebWorker.js +7 -8
- package/modules/export/readSheetWebWorker.js.map +1 -1
- package/modules/export/readXlsxFileBrowser.js +3 -5
- package/modules/export/readXlsxFileBrowser.js.map +1 -1
- package/modules/export/readXlsxFileNode.js +3 -5
- package/modules/export/readXlsxFileNode.js.map +1 -1
- package/modules/export/readXlsxFileUniversal.js +2 -2
- package/modules/export/readXlsxFileUniversal.js.map +1 -1
- package/modules/export/readXlsxFileWebWorker.js +7 -8
- package/modules/export/readXlsxFileWebWorker.js.map +1 -1
- package/modules/export/unpackXlsxFileBrowser.js +15 -4
- package/modules/export/unpackXlsxFileBrowser.js.map +1 -1
- package/modules/export/unpackXlsxFileBrowser.test.js.map +1 -0
- package/modules/export/unpackXlsxFileNode.js +32 -5
- package/modules/export/unpackXlsxFileNode.js.map +1 -1
- package/modules/export/unpackXlsxFileNode.test.js.map +1 -0
- package/modules/export/unpackXlsxFileUniversal.js +14 -3
- package/modules/export/unpackXlsxFileUniversal.js.map +1 -1
- package/modules/export/unpackXlsxFileUniversal.test.js.map +1 -0
- package/modules/parseSheetData/parseSheetData.js +9 -6
- package/modules/parseSheetData/parseSheetData.js.map +1 -1
- package/modules/saxen/parser.js +1 -1
- package/modules/saxen/parser.js.map +1 -1
- package/modules/utility/convertValuesFromUint8ArraysToStrings.js +92 -0
- package/modules/utility/convertValuesFromUint8ArraysToStrings.js.map +1 -0
- package/modules/xlsx/InvalidSpreadsheetError.js +50 -0
- package/modules/xlsx/InvalidSpreadsheetError.js.map +1 -0
- package/modules/xlsx/SheetNotFoundError.js +50 -0
- package/modules/xlsx/SheetNotFoundError.js.map +1 -0
- package/modules/xlsx/file/InputValidationStream.js +96 -0
- package/modules/xlsx/file/InputValidationStream.js.map +1 -0
- package/modules/xlsx/file/InputValidationStream.test.js.map +1 -0
- package/modules/xlsx/file/InvalidInputError.js +100 -0
- package/modules/xlsx/file/InvalidInputError.js.map +1 -0
- package/modules/xlsx/file/createFileTypeDetector.js +63 -0
- package/modules/xlsx/file/createFileTypeDetector.js.map +1 -0
- package/modules/xlsx/file/createFileTypeDetector.test.js.map +1 -0
- package/modules/xlsx/file/validateLeadingBytes.js +37 -0
- package/modules/xlsx/file/validateLeadingBytes.js.map +1 -0
- package/modules/xlsx/file/validateLeadingBytes.test.js.map +1 -0
- package/modules/xlsx/isDateFormat.js +31 -27
- package/modules/xlsx/isDateFormat.js.map +1 -1
- package/modules/xlsx/isDateFormatStyle.js +18 -21
- package/modules/xlsx/isDateFormatStyle.js.map +1 -1
- package/modules/xlsx/parseCell.js +251 -111
- package/modules/xlsx/parseCell.js.map +1 -1
- package/modules/xlsx/parseCellAddress.js +21 -18
- package/modules/xlsx/parseCellAddress.js.map +1 -1
- package/modules/xlsx/parseExcelDate.js +4 -124
- package/modules/xlsx/parseExcelDate.js.map +1 -1
- package/modules/xlsx/parseExcelDate.test.js.map +1 -1
- package/modules/xlsx/parseExcelTimestamp.js +133 -0
- package/modules/xlsx/parseExcelTimestamp.js.map +1 -0
- package/modules/xlsx/parseFilePaths.js +48 -47
- package/modules/xlsx/parseFilePaths.js.map +1 -1
- package/modules/xlsx/parseSharedStrings.js +91 -37
- package/modules/xlsx/parseSharedStrings.js.map +1 -1
- package/modules/xlsx/parseSheet.js +526 -68
- package/modules/xlsx/parseSheet.js.map +1 -1
- package/modules/xlsx/parseSpreadsheetContents.js +153 -81
- package/modules/xlsx/parseSpreadsheetContents.js.map +1 -1
- package/modules/xlsx/parseSpreadsheetInfo.js +60 -59
- package/modules/xlsx/parseSpreadsheetInfo.js.map +1 -1
- package/modules/xlsx/parseStyles.js +75 -75
- package/modules/xlsx/parseStyles.js.map +1 -1
- package/modules/xml/parseXml.js +106 -0
- package/modules/xml/parseXml.js.map +1 -0
- package/modules/xml/parseXml.test.js.map +1 -0
- package/modules/xml/parseXmlStream.js +2 -0
- package/modules/xml/parseXmlStream.js.map +1 -1
- package/modules/xml/parseXmlStream.sax.js +69 -28
- package/modules/xml/parseXmlStream.sax.js.map +1 -1
- package/modules/xml/parseXmlStream.saxen.js +67 -40
- package/modules/xml/parseXmlStream.saxen.js.map +1 -1
- package/modules/zip/UnzipError.js +49 -0
- package/modules/zip/UnzipError.js.map +1 -0
- package/modules/zip/unzipFromArrayBuffer.js +21 -1
- package/modules/zip/unzipFromArrayBuffer.js.map +1 -1
- package/modules/zip/unzipFromArrayBuffer.test.js.map +1 -0
- package/modules/zip/unzipFromStream.fflate.js +41 -35
- package/modules/zip/unzipFromStream.fflate.js.map +1 -1
- package/modules/zip/unzipFromStream.js +124 -1
- package/modules/zip/unzipFromStream.js.map +1 -1
- package/modules/zip/unzipFromStream.unzipper.js +19 -35
- package/modules/zip/unzipFromStream.unzipper.js.map +1 -1
- package/node/index.cjs +3 -0
- package/node/index.d.ts +16 -0
- package/node/index.js +3 -0
- package/package.json +5 -3
- package/types/InvalidInputError.d.ts +16 -0
- package/types/InvalidSpreadsheetError.d.ts +4 -0
- package/types/SheetNotFoundError.d.ts +4 -0
- package/universal/index.cjs +3 -0
- package/universal/index.d.ts +16 -0
- package/universal/index.js +3 -0
- package/web-worker/index.cjs +3 -0
- package/web-worker/index.d.ts +16 -0
- package/web-worker/index.js +3 -0
- package/commonjs/export/convertValuesFromUint8ArraysToStrings.js +0 -23
- package/commonjs/export/convertValuesFromUint8ArraysToStrings.js.map +0 -1
- package/commonjs/xlsx/convertCellsToData2dArray.js +0 -84
- package/commonjs/xlsx/convertCellsToData2dArray.js.map +0 -1
- package/commonjs/xlsx/dropEmptyColumns.js +0 -40
- package/commonjs/xlsx/dropEmptyColumns.js.map +0 -1
- package/commonjs/xlsx/dropEmptyColumns.test.js.map +0 -1
- package/commonjs/xlsx/dropEmptyRows.js +0 -43
- package/commonjs/xlsx/dropEmptyRows.js.map +0 -1
- package/commonjs/xlsx/dropEmptyRows.test.js.map +0 -1
- package/commonjs/xlsx/parseCellValue.js +0 -186
- package/commonjs/xlsx/parseCellValue.js.map +0 -1
- package/commonjs/xlsx/parseNumber.js +0 -20
- package/commonjs/xlsx/parseNumber.js.map +0 -1
- package/commonjs/xlsx/parseSharedString.js +0 -64
- package/commonjs/xlsx/parseSharedString.js.map +0 -1
- package/commonjs/xlsx/parseSheetData.js +0 -68
- package/commonjs/xlsx/parseSheetData.js.map +0 -1
- package/commonjs/xlsx/reconstructSheetDimensionsFromSheetCells.js +0 -29
- package/commonjs/xlsx/reconstructSheetDimensionsFromSheetCells.js.map +0 -1
- package/commonjs/xml/parseXmlStream.saxen.code.js +0 -953
- package/commonjs/xml/parseXmlStream.saxen.code.js.map +0 -1
- package/commonjs/xml/parseXmlStream.test.js.map +0 -1
- package/modules/export/convertValuesFromUint8ArraysToStrings.js +0 -17
- package/modules/export/convertValuesFromUint8ArraysToStrings.js.map +0 -1
- package/modules/xlsx/convertCellsToData2dArray.js +0 -77
- package/modules/xlsx/convertCellsToData2dArray.js.map +0 -1
- package/modules/xlsx/dropEmptyColumns.js +0 -34
- package/modules/xlsx/dropEmptyColumns.js.map +0 -1
- package/modules/xlsx/dropEmptyColumns.test.js.map +0 -1
- package/modules/xlsx/dropEmptyRows.js +0 -37
- package/modules/xlsx/dropEmptyRows.js.map +0 -1
- package/modules/xlsx/dropEmptyRows.test.js.map +0 -1
- package/modules/xlsx/parseCellValue.js +0 -180
- package/modules/xlsx/parseCellValue.js.map +0 -1
- package/modules/xlsx/parseNumber.js +0 -14
- package/modules/xlsx/parseNumber.js.map +0 -1
- package/modules/xlsx/parseSharedString.js +0 -55
- package/modules/xlsx/parseSharedString.js.map +0 -1
- package/modules/xlsx/parseSheetData.js +0 -55
- package/modules/xlsx/parseSheetData.js.map +0 -1
- package/modules/xlsx/reconstructSheetDimensionsFromSheetCells.js +0 -23
- package/modules/xlsx/reconstructSheetDimensionsFromSheetCells.js.map +0 -1
- package/modules/xml/parseXmlStream.saxen.code.js +0 -947
- package/modules/xml/parseXmlStream.saxen.code.js.map +0 -1
- package/modules/xml/parseXmlStream.test.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-excel-file.min.js","sources":["../modules/saxen/parser.js","../modules/xml/parseXmlStream.saxen.js","../node_modules/fflate/esm/browser.js","../modules/utility/checkpoint.js","../modules/zip/unzipFromArrayBuffer.js","../modules/export/convertValuesFromUint8ArraysToStrings.js","../modules/export/filterZipArchiveEntry.js","../modules/export/unpackXlsxFileBrowser.js","../modules/xlsx/parseSpreadsheetInfo.js","../modules/xlsx/parseFilePaths.js","../modules/xlsx/parseStyles.js","../modules/xlsx/parseSharedStrings.js","../modules/xlsx/parseSharedString.js","../modules/xlsx/parseExcelDate.js","../modules/xlsx/parseNumber.js","../modules/xlsx/isDateFormat.js","../modules/xlsx/isDateFormatStyle.js","../modules/xlsx/parseCellValue.js","../modules/xlsx/parseCellAddress.js","../modules/xlsx/parseCell.js","../modules/xlsx/parseSheetData.js","../modules/xlsx/dropEmptyRows.js","../modules/xlsx/dropEmptyColumns.js","../modules/xlsx/convertCellsToData2dArray.js","../modules/xlsx/parseSheet.js","../modules/xlsx/reconstructSheetDimensionsFromSheetCells.js","../modules/utility/isPromise.js","../modules/xlsx/parseSpreadsheetContents.js","../modules/export/readXlsxFileBrowser.js"],"sourcesContent":["function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\n// See `README.md` for more info\n\nexport default function Parser_(options) {\n // `decode.js` file contents\n\n var fromCharCode = String.fromCharCode;\n var hasOwnProperty = Object.prototype.hasOwnProperty;\n var ENTITY_PATTERN = /&#(\\d+);|&#x([0-9a-f]+);|&(\\w+);/ig;\n var ENTITY_MAPPING = {\n 'amp': '&',\n 'apos': '\\'',\n 'gt': '>',\n 'lt': '<',\n 'quot': '\"'\n };\n\n // map UPPERCASE variants of supported special chars\n Object.keys(ENTITY_MAPPING).forEach(function (k) {\n ENTITY_MAPPING[k.toUpperCase()] = ENTITY_MAPPING[k];\n });\n function replaceEntities(_, d, x, z) {\n // reserved names, i.e. \n if (z) {\n if (hasOwnProperty.call(ENTITY_MAPPING, z)) {\n return ENTITY_MAPPING[z];\n } else {\n // fall back to original value\n return '&' + z + ';';\n }\n }\n\n // decimal encoded char\n if (d) {\n return fromCharCode(d);\n }\n\n // hex encoded char\n return fromCharCode(parseInt(x, 16));\n }\n\n /**\r\n * A basic entity decoder that can decode a minimal\r\n * sub-set of reserved names (&) as well as\r\n * hex (ય) and decimal (ӏ) encoded characters.\r\n *\r\n * @param {string} s\r\n *\r\n * @return {string} decoded string\r\n */\n function decodeEntities(s) {\n if (s.length > 3 && s.indexOf('&') !== -1) {\n return s.replace(ENTITY_PATTERN, replaceEntities);\n }\n return s;\n }\n\n // `parser.js` file contents\n\n var NON_WHITESPACE_OUTSIDE_ROOT_NODE = 'non-whitespace outside of root node';\n function error(msg) {\n return new Error(msg);\n }\n function missingNamespaceForPrefix(prefix) {\n return 'missing namespace for prefix <' + prefix + '>';\n }\n function getter(getFn) {\n return {\n 'get': getFn,\n 'enumerable': true\n };\n }\n function cloneNsMatrix(nsMatrix) {\n var clone = {},\n key;\n for (key in nsMatrix) {\n clone[key] = nsMatrix[key];\n }\n return clone;\n }\n\n // per-matrix element name cache; stored under a symbol so it is\n // invisible to the `for (key in nsMatrix)` clone above and gets\n // collected together with the matrix it belongs to\n var NAME_CACHE = Symbol('nameCache');\n function uriPrefix(prefix) {\n return prefix + '$uri';\n }\n function buildNsMatrix(nsUriToPrefix) {\n var nsMatrix = {},\n uri,\n prefix;\n for (uri in nsUriToPrefix) {\n prefix = nsUriToPrefix[uri];\n nsMatrix[prefix] = prefix;\n nsMatrix[uriPrefix(prefix)] = uri;\n }\n return nsMatrix;\n }\n function noopGetContext() {\n return {\n line: 0,\n column: 0\n };\n }\n function throwFunc(err) {\n throw err;\n }\n\n /**\r\n * Creates a new parser with the given options.\r\n *\r\n * @constructor\r\n *\r\n * @param {!Object<string, ?>=} options\r\n */\n function Parser(options) {\n if (!this) {\n return new Parser(options);\n }\n var proxy = options && options['proxy'];\n var onText,\n onOpenTag,\n onCloseTag,\n onCDATA,\n onError = throwFunc,\n onWarning,\n onComment,\n onQuestion,\n onAttention;\n var getContext = noopGetContext;\n\n /**\r\n * Are we currently consuming a chunked stream of XML,\r\n * i.e. is a `write` call in progress that may be followed\r\n * by more chunks?\r\n *\r\n * @type {boolean}\r\n */\n var streaming = false;\n\n /**\r\n * Did we already encounter the root tag?\r\n *\r\n * Persisted across `write` calls so we can detect a missing\r\n * start tag once the stream ends.\r\n *\r\n * @type {boolean}\r\n */\n var rootTagFound = false;\n\n /**\r\n * Not yet parsed remainder of the previously written chunk,\r\n * i.e. an incomplete token that awaits more input.\r\n *\r\n * @type {string}\r\n */\n var leftoverXml = '';\n\n /**\r\n * Do we need to parse the current elements attributes for namespaces?\r\n *\r\n * @type {boolean}\r\n */\n var maybeNS = false;\n\n /**\r\n * Do we process namespaces at all?\r\n *\r\n * @type {boolean}\r\n */\n var isNamespace = false;\n\n /**\r\n * The caught error returned on parse end\r\n *\r\n * @type {Error}\r\n */\n var returnError = null;\n\n /**\r\n * Should we stop parsing?\r\n *\r\n * @type {boolean}\r\n */\n var parseStop = false;\n\n /**\r\n * Namespace + node state shared across (streamed) parse runs.\r\n */\n var nsMatrixStack, nsMatrix, nodeStack;\n\n /**\r\n * A map of { uri: prefix } used by the parser.\r\n *\r\n * This map will ensure we can normalize prefixes during processing;\r\n * for each uri, only one prefix will be exposed to the handlers.\r\n *\r\n * @type {!Object<string, string>}}\r\n */\n var nsUriToPrefix;\n\n /**\r\n * Handle parse error.\r\n *\r\n * @param {string|Error} err\r\n */\n function handleError(err) {\n if (!(err instanceof Error)) {\n err = error(err);\n }\n returnError = err;\n onError(err, getContext);\n }\n\n /**\r\n * Handle parse error.\r\n *\r\n * @param {string|Error} err\r\n */\n function handleWarning(err) {\n if (!onWarning) {\n return;\n }\n if (!(err instanceof Error)) {\n err = error(err);\n }\n onWarning(err, getContext);\n }\n\n /**\r\n * Register parse listener.\r\n *\r\n * @param {string} name\r\n * @param {Function} cb\r\n *\r\n * @return {Parser}\r\n */\n this['on'] = function (name, cb) {\n if (typeof cb !== 'function') {\n throw error('required args <name, cb>');\n }\n switch (name) {\n case 'openTag':\n onOpenTag = cb;\n break;\n case 'text':\n onText = cb;\n break;\n case 'closeTag':\n onCloseTag = cb;\n break;\n case 'error':\n onError = cb;\n break;\n case 'warn':\n onWarning = cb;\n break;\n case 'cdata':\n onCDATA = cb;\n break;\n case 'attention':\n onAttention = cb;\n break;\n // <!XXXXX zzzz=\"eeee\">\n case 'question':\n onQuestion = cb;\n break;\n // <? .... ?>\n case 'comment':\n onComment = cb;\n break;\n default:\n throw error('unsupported event: ' + name);\n }\n return this;\n };\n\n /**\r\n * Set the namespace to prefix mapping.\r\n *\r\n * @example\r\n *\r\n * parser.ns({\r\n * 'http://foo': 'foo',\r\n * 'http://bar': 'bar'\r\n * });\r\n *\r\n * @param {!Object<string, string>} nsMap\r\n *\r\n * @return {Parser}\r\n */\n this['ns'] = function (nsMap) {\n if (typeof nsMap === 'undefined') {\n nsMap = {};\n }\n if (_typeof(nsMap) !== 'object') {\n throw error('required args <nsMap={}>');\n }\n var _nsUriToPrefix = {},\n k;\n for (k in nsMap) {\n _nsUriToPrefix[k] = nsMap[k];\n }\n isNamespace = true;\n nsUriToPrefix = _nsUriToPrefix;\n return this;\n };\n\n /**\r\n * Reset the parser state before a (streamed) parse run.\r\n */\n function resetState() {\n nsMatrixStack = isNamespace ? [] : null;\n nsMatrix = isNamespace ? buildNsMatrix(nsUriToPrefix) : null;\n nodeStack = [];\n getContext = noopGetContext;\n parseStop = false;\n returnError = null;\n rootTagFound = false;\n leftoverXml = '';\n }\n\n /**\r\n * Parse a complete xml string.\r\n *\r\n * @param {string} xml\r\n *\r\n * @return {Error} returnError, if not thrown\r\n */\n this['parse'] = function (xml) {\n if (typeof xml !== 'string') {\n throw error('required args <xml=string>');\n }\n if (streaming) {\n throw error('parse during stream; call end() first');\n }\n resetState();\n parse(xml);\n getContext = noopGetContext;\n parseStop = false;\n return returnError;\n };\n\n /**\r\n * Write the next chunk of a streamed xml string.\r\n *\r\n * Parse events are emitted for all complete tokens; an\r\n * incomplete trailing token is buffered until the next\r\n * `write` or, ultimately, reported as an error on `end`.\r\n *\r\n * @param {string} xml\r\n *\r\n * @return {Parser} self\r\n */\n this['write'] = function (xml) {\n if (typeof xml !== 'string') {\n throw error('required args <xml=string>');\n }\n if (!streaming) {\n resetState();\n streaming = true;\n }\n if (!returnError) {\n leftoverXml = parse(leftoverXml + xml, true) || '';\n }\n return this;\n };\n\n /**\r\n * Finish parsing a streamed xml string, i.e. signal that\r\n * no more chunks will be written.\r\n *\r\n * @return {Error} returnError, if not thrown\r\n */\n this['end'] = function () {\n if (!streaming) {\n resetState();\n }\n\n // flush the buffered remainder, now treating an incomplete\n // trailing token as a hard error\n streaming = false;\n if (!returnError) {\n parse(leftoverXml);\n }\n leftoverXml = '';\n getContext = noopGetContext;\n parseStop = false;\n return returnError;\n };\n\n /**\r\n * Stop parsing.\r\n */\n this['stop'] = function () {\n parseStop = true;\n };\n\n /**\r\n * Parse string, invoking configured listeners on element.\r\n *\r\n * Namespace and node stack state is shared across (streamed)\r\n * invocations via the enclosing parser scope.\r\n *\r\n * Internal note: while `streaming`, an incomplete trailing token\r\n * is not treated as an error but returned so `write` can buffer it\r\n * and prepend it to the next chunk. This buffered remainder is an\r\n * implementation detail of the streaming buffer, not a public API;\r\n * outside of that case the return value is `undefined`.\r\n *\r\n * @param {string} xml\r\n * @param {boolean} streaming\r\n *\r\n * @return {string|undefined} buffered remainder, streaming internal use only\r\n */\n function parse(xml) {\n var streaming = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var elNameCache = null,\n elNameCacheMatrix = null;\n var _nsMatrix,\n anonymousNsCount = 0,\n tagStart = false,\n tagEnd = false,\n i = 0,\n j = 0,\n x,\n y,\n q,\n w,\n v,\n xmlns,\n elementName,\n _elementName,\n elementProxy;\n var attrsString = '',\n attrsStart = 0,\n cachedAttrs // false = parsed with errors, null = needs parsing\n ;\n\n /**\r\n * Normalize a namespaced attribute name against the current\r\n * namespace matrix.\r\n *\r\n * @param {string} name\r\n * @param {string|boolean} defaultAlias\r\n *\r\n * @return {string|null} normalized name, or `null` when the prefix\r\n * has no namespace (a warning is emitted)\r\n */\n function normalizeAttrName(name, defaultAlias) {\n var w = name.indexOf(':');\n if (w === -1) {\n return name;\n }\n\n // normalize ns attribute name\n var nsName = nsMatrix[name.substring(0, w)];\n if (!nsName) {\n handleWarning(missingNamespaceForPrefix(name.substring(0, w)));\n return null;\n }\n return defaultAlias === nsName ? name.substr(w + 1) : nsName + name.substr(w);\n }\n\n /**\r\n * Parse attributes on demand and returns the parsed attributes.\r\n *\r\n * Return semantics: (1) `false` on attribute parse error,\r\n * (2) object hash on extracted attrs.\r\n *\r\n * @return {boolean|Object}\r\n */\n function getAttrs() {\n if (cachedAttrs !== null) {\n return cachedAttrs;\n }\n var nsUri,\n nsUriPrefix,\n defaultAlias = isNamespace && nsMatrix['xmlns'],\n attrList = isNamespace && maybeNS ? [] : null,\n i = attrsStart,\n s = attrsString,\n l = s.length,\n hasNewMatrix,\n newalias,\n value,\n alias,\n name,\n attrs = {},\n seenAttrs = new Set(),\n skipAttr,\n w,\n j;\n parseAttr: for (; i < l; i++) {\n skipAttr = false;\n w = s.charCodeAt(i);\n if (w === 32 || w < 14 && w > 8) {\n // WHITESPACE={ \\f\\n\\r\\t\\v}\n continue;\n }\n\n // wait for non whitespace character\n if (w < 65 || w > 122 || w > 90 && w < 97) {\n if (w !== 95 && w !== 58) {\n // char 95\"_\" 58\":\"\n handleWarning('illegal first char attribute name');\n skipAttr = true;\n }\n }\n\n // parse attribute name\n for (j = i + 1; j < l; j++) {\n w = s.charCodeAt(j);\n if (w > 96 && w < 123 || w > 64 && w < 91 || w > 47 && w < 59 || w === 46 ||\n // '.'\n w === 45 ||\n // '-'\n w === 95 // '_'\n ) {\n continue;\n }\n\n // unexpected whitespace\n if (w === 32 || w < 14 && w > 8) {\n // WHITESPACE\n handleWarning('missing attribute value');\n i = j;\n continue parseAttr;\n }\n\n // expected \"=\"\n if (w === 61) {\n // \"=\" == 61\n break;\n }\n handleWarning('illegal attribute name char');\n skipAttr = true;\n }\n name = s.substring(i, j);\n if (name === 'xmlns:xmlns') {\n handleWarning('illegal declaration of xmlns');\n skipAttr = true;\n }\n w = s.charCodeAt(j + 1);\n if (w === 34) {\n // '\"'\n j = s.indexOf('\"', i = j + 2);\n if (j === -1) {\n j = s.indexOf('\\'', i);\n if (j !== -1) {\n handleWarning('attribute value quote missmatch');\n skipAttr = true;\n }\n }\n } else if (w === 39) {\n // \"'\"\n j = s.indexOf('\\'', i = j + 2);\n if (j === -1) {\n j = s.indexOf('\"', i);\n if (j !== -1) {\n handleWarning('attribute value quote missmatch');\n skipAttr = true;\n }\n }\n } else {\n handleWarning('missing attribute value quotes');\n skipAttr = true;\n\n // skip to next space\n for (j = j + 1; j < l; j++) {\n w = s.charCodeAt(j + 1);\n if (w === 32 || w < 14 && w > 8) {\n // WHITESPACE\n break;\n }\n }\n }\n if (j === -1) {\n handleWarning('missing closing quotes');\n j = l;\n skipAttr = true;\n }\n if (!skipAttr) {\n value = s.substring(i, j);\n }\n i = j;\n\n // ensure SPACE follows attribute\n // skip illegal content otherwise\n // example a=\"b\"c\n for (; j + 1 < l; j++) {\n w = s.charCodeAt(j + 1);\n if (w === 32 || w < 14 && w > 8) {\n // WHITESPACE\n break;\n }\n\n // FIRST ILLEGAL CHAR\n if (i === j) {\n handleWarning('illegal character after attribute end');\n skipAttr = true;\n }\n }\n\n // advance cursor to next attribute\n i = j + 1;\n if (skipAttr) {\n continue parseAttr;\n }\n\n // check attribute re-declaration\n if (seenAttrs.has(name)) {\n handleWarning('attribute <' + name + '> already defined');\n continue;\n }\n seenAttrs.add(name);\n if (!isNamespace) {\n attrs[name] = value;\n continue;\n }\n\n // try to extract namespace information\n if (maybeNS) {\n newalias = name === 'xmlns' ? 'xmlns' : name.charCodeAt(0) === 120 && name.substr(0, 6) === 'xmlns:' ? name.substr(6) : null;\n\n // handle xmlns(:alias) assignment\n if (newalias !== null) {\n nsUri = decodeEntities(value);\n nsUriPrefix = uriPrefix(newalias);\n alias = nsUriToPrefix[nsUri];\n if (!alias) {\n // no prefix defined or prefix collision\n if (newalias === 'xmlns' || nsUriPrefix in nsMatrix && nsMatrix[nsUriPrefix] !== nsUri) {\n // alocate free ns prefix\n do {\n alias = 'ns' + anonymousNsCount++;\n } while (typeof nsMatrix[alias] !== 'undefined');\n } else {\n alias = newalias;\n }\n nsUriToPrefix[nsUri] = alias;\n }\n if (nsMatrix[newalias] !== alias) {\n if (!hasNewMatrix) {\n nsMatrix = cloneNsMatrix(nsMatrix);\n hasNewMatrix = true;\n }\n nsMatrix[newalias] = alias;\n if (newalias === 'xmlns') {\n nsMatrix[uriPrefix(alias)] = nsUri;\n defaultAlias = alias;\n }\n nsMatrix[nsUriPrefix] = nsUri;\n }\n\n // expose xmlns(:asd)=\"...\" in attributes\n attrs[name] = value;\n continue;\n }\n\n // collect attributes until all namespace\n // declarations are processed\n attrList.push(name, value);\n continue;\n } /** end if (maybeNs) */\n\n // handle attributes on element without\n // namespace declarations\n name = normalizeAttrName(name, defaultAlias);\n if (name === null) {\n continue;\n }\n attrs[name] = value;\n }\n\n // handle deferred, possibly namespaced attributes\n if (maybeNS) {\n // normalize captured attributes\n for (i = 0, l = attrList.length; i < l; i++) {\n name = normalizeAttrName(attrList[i++], defaultAlias);\n value = attrList[i];\n if (name === null) {\n continue;\n }\n attrs[name] = value;\n }\n\n // end: normalize captured attributes\n }\n\n return cachedAttrs = attrs;\n }\n\n /**\r\n * Extract the parse context { line, column, part }\r\n * from the current parser position.\r\n *\r\n * @return {Object} parse context\r\n */\n function getParseContext() {\n var splitsRe = /(\\r\\n|\\r|\\n)/g;\n var line = 0;\n var column = 0;\n var startOfLine = 0;\n var endOfLine = j;\n var match;\n var data;\n while (i >= startOfLine) {\n match = splitsRe.exec(xml);\n if (!match) {\n break;\n }\n\n // end of line = (break idx + break chars)\n endOfLine = match[0].length + match.index;\n if (endOfLine > i) {\n break;\n }\n\n // advance to next line\n line += 1;\n startOfLine = endOfLine;\n }\n\n // EOF errors\n if (i == -1) {\n column = endOfLine;\n data = xml.substring(j);\n } else\n // start errors\n if (j === 0) {\n data = xml.substring(j, i);\n }\n\n // other errors\n else {\n column = i - startOfLine;\n data = j == -1 ? xml.substring(i) : xml.substring(i, j + 1);\n }\n return {\n 'data': data,\n 'line': line,\n 'column': column\n };\n }\n getContext = getParseContext;\n if (proxy) {\n elementProxy = Object.create({}, {\n 'name': getter(function () {\n return elementName;\n }),\n 'originalName': getter(function () {\n return _elementName;\n }),\n 'attrs': getter(getAttrs),\n 'ns': getter(function () {\n return nsMatrix;\n })\n });\n }\n\n // actual parse logic\n while (j !== -1) {\n if (xml.charCodeAt(j) === 60) {\n // \"<\"\n i = j;\n } else {\n i = xml.indexOf('<', j);\n }\n\n // no (more) tags found\n if (i === -1) {\n // buffer the remainder for the next chunk\n if (streaming) {\n return xml.substring(j);\n }\n if (nodeStack.length) {\n return handleError('unexpected end of file');\n }\n if (!rootTagFound) {\n return handleError('missing start tag');\n }\n if (j < xml.length) {\n if (xml.substring(j).trim()) {\n handleWarning(NON_WHITESPACE_OUTSIDE_ROOT_NODE);\n }\n }\n return;\n }\n\n // remember that we saw the root tag\n if (!rootTagFound) {\n rootTagFound = true;\n }\n\n // parse text\n if (j !== i) {\n if (nodeStack.length) {\n if (onText) {\n onText(xml.substring(j, i), decodeEntities, getContext);\n if (parseStop) {\n return;\n }\n }\n } else {\n if (xml.substring(j, i).trim()) {\n handleWarning(NON_WHITESPACE_OUTSIDE_ROOT_NODE);\n if (parseStop) {\n return;\n }\n }\n }\n }\n w = xml.charCodeAt(i + 1);\n\n // parse comments + CDATA\n if (w === 33) {\n // \"!\"\n q = xml.charCodeAt(i + 2);\n\n // CDATA section\n if (q === 91 && xml.substr(i + 3, 6) === 'CDATA[') {\n // 91 == \"[\"\n j = xml.indexOf(']]>', i);\n if (j === -1) {\n if (streaming) {\n return xml.substring(i);\n }\n return handleError('unclosed cdata');\n }\n if (onCDATA) {\n onCDATA(xml.substring(i + 9, j), getContext);\n if (parseStop) {\n return;\n }\n }\n j += 3;\n continue;\n }\n\n // comment\n if (q === 45 && xml.charCodeAt(i + 3) === 45) {\n // 45 == \"-\"\n j = xml.indexOf('-->', i);\n if (j === -1) {\n if (streaming) {\n return xml.substring(i);\n }\n return handleError('unclosed comment');\n }\n if (onComment) {\n onComment(xml.substring(i + 4, j), decodeEntities, getContext);\n if (parseStop) {\n return;\n }\n }\n j += 3;\n continue;\n }\n }\n\n // parse question <? ... ?>\n if (w === 63) {\n // \"?\"\n j = xml.indexOf('?>', i);\n if (j === -1) {\n if (streaming) {\n return xml.substring(i);\n }\n return handleError('unclosed question');\n }\n if (onQuestion) {\n onQuestion(xml.substring(i, j + 2), getContext);\n if (parseStop) {\n return;\n }\n }\n j += 2;\n continue;\n }\n\n // find matching closing tag for attention or standard tags\n // for that we must skip through attribute values\n // (enclosed in single or double quotes)\n for (x = i + 1;; x++) {\n v = xml.charCodeAt(x);\n if (isNaN(v)) {\n if (streaming) {\n return xml.substring(i);\n }\n j = -1;\n return handleError('unclosed tag');\n }\n\n // [10] AttValue ::= '\"' ([^<&\"] | Reference)* '\"' | \"'\" ([^<&'] | Reference)* \"'\"\n // skips the quoted string\n // (double quotes) does not appear in a literal enclosed by (double quotes)\n // (single quote) does not appear in a literal enclosed by (single quote)\n if (v === 34) {\n // '\"'\n q = xml.indexOf('\"', x + 1);\n x = q !== -1 ? q : x;\n } else if (v === 39) {\n // \"'\"\n q = xml.indexOf(\"'\", x + 1);\n x = q !== -1 ? q : x;\n } else if (v === 62) {\n // '>'\n j = x;\n break;\n }\n }\n\n // parse attention <! ...>\n // previously comment and CDATA have already been parsed\n if (w === 33) {\n // \"!\"\n\n if (onAttention) {\n onAttention(xml.substring(i, j + 1), decodeEntities, getContext);\n if (parseStop) {\n return;\n }\n }\n j += 1;\n continue;\n }\n\n // don't process attributes;\n // there are none\n cachedAttrs = {};\n\n // if (xml.charCodeAt(i+1) === 47) { // </...\n if (w === 47) {\n // </...\n tagStart = false;\n tagEnd = true;\n if (!nodeStack.length) {\n return handleError('missing open tag');\n }\n\n // verify open <-> close tag match\n x = elementName = nodeStack.pop();\n q = i + 2 + x.length;\n if (xml.substring(i + 2, q) !== x) {\n return handleError('closing tag mismatch');\n }\n\n // verify chars in close tag\n for (; q < j; q++) {\n w = xml.charCodeAt(q);\n if (w === 32 || w > 8 && w < 14) {\n // \\f\\n\\r\\t\\v space\n continue;\n }\n return handleError('close tag');\n }\n } else {\n if (xml.charCodeAt(j - 1) === 47) {\n // .../>\n x = elementName = xml.substring(i + 1, j - 1);\n tagStart = true;\n tagEnd = true;\n } else {\n x = elementName = xml.substring(i + 1, j);\n tagStart = true;\n tagEnd = false;\n }\n if (!(w > 96 && w < 123 || w > 64 && w < 91 || w === 95 || w === 58)) {\n // char 95\"_\" 58\":\"\n return handleError('illegal first char nodeName');\n }\n for (q = 1, y = x.length; q < y; q++) {\n w = x.charCodeAt(q);\n if (w > 96 && w < 123 || w > 64 && w < 91 || w > 47 && w < 59 || w === 45 || w === 95 || w == 46) {\n continue;\n }\n if (w === 32 || w < 14 && w > 8) {\n // \\f\\n\\r\\t\\v space\n elementName = x.substring(0, q);\n\n // maybe there are attributes\n cachedAttrs = null;\n break;\n }\n return handleError('invalid nodeName');\n }\n if (!tagEnd) {\n nodeStack.push(elementName);\n }\n }\n if (isNamespace) {\n _nsMatrix = nsMatrix;\n if (tagStart) {\n // remember old namespace\n // unless we're self-closing\n if (!tagEnd) {\n nsMatrixStack.push(_nsMatrix);\n }\n if (cachedAttrs === null) {\n // quick check, whether there may be namespace\n // declarations on the node; if that is the case\n // we need to eagerly parse the node attributes\n if (maybeNS = x.indexOf('xmlns', q) !== -1) {\n attrsStart = q;\n attrsString = x;\n getAttrs();\n maybeNS = false;\n }\n }\n }\n _elementName = elementName;\n\n // memoize normalized names per namespace matrix; tag names\n // typically repeat heavily and the matrix rarely changes.\n if (elNameCacheMatrix !== nsMatrix) {\n elNameCache = nsMatrix[NAME_CACHE];\n if (elNameCache === undefined) {\n elNameCache = nsMatrix[NAME_CACHE] = {};\n }\n elNameCacheMatrix = nsMatrix;\n }\n var _cachedName = elNameCache[elementName];\n if (_cachedName !== undefined) {\n elementName = _cachedName;\n } else {\n w = elementName.indexOf(':');\n if (w !== -1) {\n xmlns = nsMatrix[elementName.substring(0, w)];\n\n // prefix given; namespace must exist\n if (!xmlns) {\n return handleError('missing namespace on <' + _elementName + '>');\n }\n elementName = elementName.substr(w + 1);\n } else {\n xmlns = nsMatrix['xmlns'];\n\n // if no default namespace is defined,\n // we'll import the element as anonymous.\n //\n // it is up to users to correct that to the document defined\n // targetNamespace, or whatever their undersanding of the\n // XML spec mandates.\n }\n\n // adjust namespace prefixs as configured\n if (xmlns) {\n elementName = xmlns + ':' + elementName;\n }\n elNameCache[_elementName] = elementName;\n }\n }\n if (tagStart) {\n attrsStart = q;\n attrsString = x;\n if (onOpenTag) {\n if (proxy) {\n onOpenTag(elementProxy, decodeEntities, tagEnd, getContext);\n } else {\n onOpenTag(elementName, getAttrs, decodeEntities, tagEnd, getContext);\n }\n if (parseStop) {\n return;\n }\n }\n }\n if (tagEnd) {\n if (onCloseTag) {\n onCloseTag(proxy ? elementProxy : elementName, decodeEntities, tagStart, getContext);\n if (parseStop) {\n return;\n }\n }\n\n // restore old namespace\n if (isNamespace) {\n if (!tagStart) {\n nsMatrix = nsMatrixStack.pop();\n } else {\n nsMatrix = _nsMatrix;\n }\n }\n }\n j += 1;\n }\n } /** end parse */\n }\n\n return Parser(options);\n}\n//# sourceMappingURL=parser.js.map","// Starting from version `11.x`, `saxen` dropped CommonJS export.\n// CommonJS compatibility was requested by one of the users of this package:\n// https://gitlab.com/catamphetamine/read-excel-file/-/work_items/115\n// Because of that, `saxen` source code had to be copy-pasted.\n//\n// import { Parser } from 'saxen'\nimport Parser from '../saxen/parser.js';\nexport default function parseXmlStream(xml, _ref) {\n var createInitialState = _ref.createInitialState,\n onOpenTag = _ref.onOpenTag,\n onCloseTag = _ref.onCloseTag,\n onText = _ref.onText;\n // This function was put inside the `parseXmlStream()` function body\n // in order to prevent it from becoming an \"external dependency\"\n // when using `worker-f` package to run this code in a worker.\n var TAG_NAME_PREFIX = /.+:/;\n function trimXmlnsPrefix(tagName) {\n return tagName.replace(TAG_NAME_PREFIX, '');\n }\n return new Promise(function (resolve, reject) {\n var errored = false;\n var xmlns = true;\n var state = createInitialState();\n\n // an error happened.\n var onerror = function onerror(error) {\n if (errored) {\n return;\n }\n errored = true;\n reject(error);\n };\n\n // got some text. `text` is the string of text.\n var ontext = function ontext(text, decodeEntities) {\n if (onText) {\n // `saxen` doesn't decode character references (`é`, `&`, etc) in text:\n // instead, it provides a `decodeEntities()` function for the consumer to call.\n onText(decodeEntities(text), state);\n }\n };\n\n // opened a tag. `node` has \"name\" and \"attributes\"\n var onopentag = function onopentag(element, decodeEntities, selfClosing, getContext) {\n if (onOpenTag) {\n // `saxen` doesn't decode character references (`é`, `&`, etc)\n // in attribute values either, so decode them here.\n var attributes = element.attrs;\n for (var name in attributes) {\n attributes[name] = decodeEntities(attributes[name]);\n }\n // * `element.originalName` — The tag name as written in the XML string, retaining the original prefix regardless of the list of pre-configured namespace mappings.\n // * `element.name` — The tag name with the namespace prefix resolved against the list of pre-configured namespace mappings. I.e. the namespace prefix will potentially be replaced with one from the pre-configured namespace map.\n onOpenTag(xmlns ? trimXmlnsPrefix(element.originalName) : element.name, attributes, state);\n }\n };\n\n // closed a tag.\n var onclosetag = function onclosetag(element) {\n if (onCloseTag) {\n // * `element.originalName` — The tag name as written in the XML string, retaining the original prefix regardless of the list of pre-configured namespace mappings.\n // * `element.name` — The tag name with the namespace prefix resolved against the list of pre-configured namespace mappings. I.e. the namespace prefix will potentially be replaced with one from the pre-configured namespace map.\n var tagName = xmlns ? trimXmlnsPrefix(element.originalName) : element.name;\n onCloseTag(tagName, state);\n }\n };\n\n // `proxy: true` option enables \"proxy\" mode.\n //\n // In \"proxy\" mode, `onopentag` and `onclosetag` receive slightly different arguments:\n // * element name is replaced with element object\n // * getAttribute() function is not passed\n //\n var parser = new Parser({\n proxy: true\n });\n\n // Parse XML \"namespaces\" (`xmlns` stuff).\n if (xmlns) {\n parser.ns();\n }\n parser.on('error', onerror);\n parser.on('text', ontext);\n parser.on('openTag', onopentag);\n parser.on('closeTag', onclosetag);\n parser.parse(xml);\n if (errored) {\n return;\n }\n resolve(state);\n });\n}\n//# sourceMappingURL=parseXmlStream.saxen.js.map","// DEFLATE is a complex format; to read this code, you should probably check the RFC first:\n// https://tools.ietf.org/html/rfc1951\n// You may also wish to take a look at the guide I made about this program:\n// https://gist.github.com/101arrowz/253f31eb5abc3d9275ab943003ffecad\n// Some of the following code is similar to that of UZIP.js:\n// https://github.com/photopea/UZIP.js\n// However, the vast majority of the codebase has diverged from UZIP.js to increase performance and reduce bundle size.\n// Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint\n// is better for memory in most engines (I *think*).\nvar ch2 = {};\nvar wk = (function (c, id, msg, transfer, cb) {\n var w = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([\n c + ';addEventListener(\"error\",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'\n ], { type: 'text/javascript' }))));\n w.onmessage = function (e) {\n var d = e.data, ed = d.$e$;\n if (ed) {\n var err = new Error(ed[0]);\n err['code'] = ed[1];\n err.stack = ed[2];\n cb(err, null);\n }\n else\n cb(null, d);\n };\n w.postMessage(msg, transfer);\n return w;\n});\n\n// aliases for shorter compressed code (most minifers don't do this)\nvar u8 = Uint8Array, u16 = Uint16Array, i32 = Int32Array;\n// fixed length extra bits\nvar fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */ 0, 0, /* impossible */ 0]);\n// fixed distance extra bits\nvar fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */ 0, 0]);\n// code length index map\nvar clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);\n// get base, reverse index map from extra bits\nvar freb = function (eb, start) {\n var b = new u16(31);\n for (var i = 0; i < 31; ++i) {\n b[i] = start += 1 << eb[i - 1];\n }\n // numbers here are at max 18 bits\n var r = new i32(b[30]);\n for (var i = 1; i < 30; ++i) {\n for (var j = b[i]; j < b[i + 1]; ++j) {\n r[j] = ((j - b[i]) << 5) | i;\n }\n }\n return { b: b, r: r };\n};\nvar _a = freb(fleb, 2), fl = _a.b, revfl = _a.r;\n// we can ignore the fact that the other numbers are wrong; they never happen anyway\nfl[28] = 258, revfl[258] = 28;\nvar _b = freb(fdeb, 0), fd = _b.b, revfd = _b.r;\n// map of value to reverse (assuming 16 bits)\nvar rev = new u16(32768);\nfor (var i = 0; i < 32768; ++i) {\n // reverse table algorithm from SO\n var x = ((i & 0xAAAA) >> 1) | ((i & 0x5555) << 1);\n x = ((x & 0xCCCC) >> 2) | ((x & 0x3333) << 2);\n x = ((x & 0xF0F0) >> 4) | ((x & 0x0F0F) << 4);\n rev[i] = (((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8)) >> 1;\n}\n// create huffman tree from u8 \"map\": index -> code length for code index\n// mb (max bits) must be at most 15\n// TODO: optimize/split up?\nvar hMap = (function (cd, mb, r) {\n var s = cd.length;\n // index\n var i = 0;\n // u16 \"map\": index -> # of codes with bit length = index\n var l = new u16(mb);\n // length of cd must be 288 (total # of codes)\n for (; i < s; ++i) {\n if (cd[i])\n ++l[cd[i] - 1];\n }\n // u16 \"map\": index -> minimum code for bit length = index\n var le = new u16(mb);\n for (i = 1; i < mb; ++i) {\n le[i] = (le[i - 1] + l[i - 1]) << 1;\n }\n var co;\n if (r) {\n // u16 \"map\": index -> number of actual bits, symbol for code\n co = new u16(1 << mb);\n // bits to remove for reverser\n var rvb = 15 - mb;\n for (i = 0; i < s; ++i) {\n // ignore 0 lengths\n if (cd[i]) {\n // num encoding both symbol and bits read\n var sv = (i << 4) | cd[i];\n // free bits\n var r_1 = mb - cd[i];\n // start value\n var v = le[cd[i] - 1]++ << r_1;\n // m is end value\n for (var m = v | ((1 << r_1) - 1); v <= m; ++v) {\n // every 16 bit value starting with the code yields the same result\n co[rev[v] >> rvb] = sv;\n }\n }\n }\n }\n else {\n co = new u16(s);\n for (i = 0; i < s; ++i) {\n if (cd[i]) {\n co[i] = rev[le[cd[i] - 1]++] >> (15 - cd[i]);\n }\n }\n }\n return co;\n});\n// fixed length tree\nvar flt = new u8(288);\nfor (var i = 0; i < 144; ++i)\n flt[i] = 8;\nfor (var i = 144; i < 256; ++i)\n flt[i] = 9;\nfor (var i = 256; i < 280; ++i)\n flt[i] = 7;\nfor (var i = 280; i < 288; ++i)\n flt[i] = 8;\n// fixed distance tree\nvar fdt = new u8(32);\nfor (var i = 0; i < 32; ++i)\n fdt[i] = 5;\n// fixed length map\nvar flm = /*#__PURE__*/ hMap(flt, 9, 0), flrm = /*#__PURE__*/ hMap(flt, 9, 1);\n// fixed distance map\nvar fdm = /*#__PURE__*/ hMap(fdt, 5, 0), fdrm = /*#__PURE__*/ hMap(fdt, 5, 1);\n// find max of array\nvar max = function (a) {\n var m = a[0];\n for (var i = 1; i < a.length; ++i) {\n if (a[i] > m)\n m = a[i];\n }\n return m;\n};\n// read d, starting at bit p and mask with m\nvar bits = function (d, p, m) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8)) >> (p & 7)) & m;\n};\n// read d, starting at bit p continuing for at least 16 bits\nvar bits16 = function (d, p) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8) | (d[o + 2] << 16)) >> (p & 7));\n};\n// get end of byte\nvar shft = function (p) { return ((p + 7) / 8) | 0; };\n// typed array slice - allows garbage collector to free original reference,\n// while being more compatible than .slice\nvar slc = function (v, s, e) {\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n // can't use .constructor in case user-supplied\n return new u8(v.subarray(s, e));\n};\n/**\n * Codes for errors generated within this library\n */\nexport var FlateErrorCode = {\n UnexpectedEOF: 0,\n InvalidBlockType: 1,\n InvalidLengthLiteral: 2,\n InvalidDistance: 3,\n StreamFinished: 4,\n NoStreamHandler: 5,\n InvalidHeader: 6,\n NoCallback: 7,\n InvalidUTF8: 8,\n ExtraFieldTooLong: 9,\n InvalidDate: 10,\n FilenameTooLong: 11,\n StreamFinishing: 12,\n InvalidZipData: 13,\n UnknownCompressionMethod: 14\n};\n// error codes\nvar ec = [\n 'unexpected EOF',\n 'invalid block type',\n 'invalid length/literal',\n 'invalid distance',\n 'stream finished',\n 'no stream handler',\n , // determined by compression function\n 'no callback',\n 'invalid UTF-8 data',\n 'extra field too long',\n 'date not in range 1980-2099',\n 'filename too long',\n 'stream finishing',\n 'invalid zip data'\n // determined by unknown compression method\n];\n;\nvar err = function (ind, msg, nt) {\n var e = new Error(msg || ec[ind]);\n e.code = ind;\n if (Error.captureStackTrace)\n Error.captureStackTrace(e, err);\n if (!nt)\n throw e;\n return e;\n};\n// expands raw DEFLATE data\nvar inflt = function (dat, st, buf, dict) {\n // source length dict length\n var sl = dat.length, dl = dict ? dict.length : 0;\n if (!sl || st.f && !st.l)\n return buf || new u8(0);\n var noBuf = !buf;\n // have to estimate size\n var resize = noBuf || st.i != 2;\n // no state\n var noSt = st.i;\n // Assumes roughly 33% compression ratio average\n if (noBuf)\n buf = new u8(sl * 3);\n // ensure buffer can fit at least l elements\n var cbuf = function (l) {\n var bl = buf.length;\n // need to increase size to fit\n if (l > bl) {\n // Double or set to necessary, whichever is greater\n var nbuf = new u8(Math.max(bl * 2, l));\n nbuf.set(buf);\n buf = nbuf;\n }\n };\n // last chunk bitpos bytes\n var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;\n // total bits\n var tbts = sl * 8;\n do {\n if (!lm) {\n // BFINAL - this is only 1 when last chunk is next\n final = bits(dat, pos, 1);\n // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman\n var type = bits(dat, pos + 1, 3);\n pos += 3;\n if (!type) {\n // go to end of byte boundary\n var s = shft(pos) + 4, l = dat[s - 4] | (dat[s - 3] << 8), t = s + l;\n if (t > sl) {\n if (noSt)\n err(0);\n break;\n }\n // ensure size\n if (resize)\n cbuf(bt + l);\n // Copy over uncompressed data\n buf.set(dat.subarray(s, t), bt);\n // Get new bitpos, update byte count\n st.b = bt += l, st.p = pos = t * 8, st.f = final;\n continue;\n }\n else if (type == 1)\n lm = flrm, dm = fdrm, lbt = 9, dbt = 5;\n else if (type == 2) {\n // literal lengths\n var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;\n var tl = hLit + bits(dat, pos + 5, 31) + 1;\n pos += 14;\n // length+distance tree\n var ldt = new u8(tl);\n // code length tree\n var clt = new u8(19);\n for (var i = 0; i < hcLen; ++i) {\n // use index map to get real code\n clt[clim[i]] = bits(dat, pos + i * 3, 7);\n }\n pos += hcLen * 3;\n // code lengths bits\n var clb = max(clt), clbmsk = (1 << clb) - 1;\n // code lengths map\n var clm = hMap(clt, clb, 1);\n for (var i = 0; i < tl;) {\n var r = clm[bits(dat, pos, clbmsk)];\n // bits read\n pos += r & 15;\n // symbol\n var s = r >> 4;\n // code length to copy\n if (s < 16) {\n ldt[i++] = s;\n }\n else {\n // copy count\n var c = 0, n = 0;\n if (s == 16)\n n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];\n else if (s == 17)\n n = 3 + bits(dat, pos, 7), pos += 3;\n else if (s == 18)\n n = 11 + bits(dat, pos, 127), pos += 7;\n while (n--)\n ldt[i++] = c;\n }\n }\n // length tree distance tree\n var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);\n // max length bits\n lbt = max(lt);\n // max dist bits\n dbt = max(dt);\n lm = hMap(lt, lbt, 1);\n dm = hMap(dt, dbt, 1);\n }\n else\n err(1);\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n }\n // Make sure the buffer can hold this + the largest possible addition\n // Maximum chunk size (practically, theoretically infinite) is 2^17\n if (resize)\n cbuf(bt + 131072);\n var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;\n var lpos = pos;\n for (;; lpos = pos) {\n // bits read, code\n var c = lm[bits16(dat, pos) & lms], sym = c >> 4;\n pos += c & 15;\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n if (!c)\n err(2);\n if (sym < 256)\n buf[bt++] = sym;\n else if (sym == 256) {\n lpos = pos, lm = null;\n break;\n }\n else {\n var add = sym - 254;\n // no extra bits needed if less\n if (sym > 264) {\n // index\n var i = sym - 257, b = fleb[i];\n add = bits(dat, pos, (1 << b) - 1) + fl[i];\n pos += b;\n }\n // dist\n var d = dm[bits16(dat, pos) & dms], dsym = d >> 4;\n if (!d)\n err(3);\n pos += d & 15;\n var dt = fd[dsym];\n if (dsym > 3) {\n var b = fdeb[dsym];\n dt += bits16(dat, pos) & (1 << b) - 1, pos += b;\n }\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n if (resize)\n cbuf(bt + 131072);\n var end = bt + add;\n if (bt < dt) {\n var shift = dl - dt, dend = Math.min(dt, end);\n if (shift + bt < 0)\n err(3);\n for (; bt < dend; ++bt)\n buf[bt] = dict[shift + bt];\n }\n for (; bt < end; ++bt)\n buf[bt] = buf[bt - dt];\n }\n }\n st.l = lm, st.p = lpos, st.b = bt, st.f = final;\n if (lm)\n final = 1, st.m = lbt, st.d = dm, st.n = dbt;\n } while (!final);\n // don't reallocate for streams or user buffers\n return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);\n};\n// starting at p, write the minimum number of bits that can hold v to d\nvar wbits = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >> 8;\n};\n// starting at p, write the minimum number of bits (>8) that can hold v to d\nvar wbits16 = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >> 8;\n d[o + 2] |= v >> 16;\n};\n// creates code lengths from a frequency table\nvar hTree = function (d, mb) {\n // Need extra info to make a tree\n var t = [];\n for (var i = 0; i < d.length; ++i) {\n if (d[i])\n t.push({ s: i, f: d[i] });\n }\n var s = t.length;\n var t2 = t.slice();\n if (!s)\n return { t: et, l: 0 };\n if (s == 1) {\n var v = new u8(t[0].s + 1);\n v[t[0].s] = 1;\n return { t: v, l: 1 };\n }\n t.sort(function (a, b) { return a.f - b.f; });\n // after i2 reaches last ind, will be stopped\n // freq must be greater than largest possible number of symbols\n t.push({ s: -1, f: 25001 });\n var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;\n t[0] = { s: -1, f: l.f + r.f, l: l, r: r };\n // efficient algorithm from UZIP.js\n // i0 is lookbehind, i2 is lookahead - after processing two low-freq\n // symbols that combined have high freq, will start processing i2 (high-freq,\n // non-composite) symbols instead\n // see https://reddit.com/r/photopea/comments/ikekht/uzipjs_questions/\n while (i1 != s - 1) {\n l = t[t[i0].f < t[i2].f ? i0++ : i2++];\n r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];\n t[i1++] = { s: -1, f: l.f + r.f, l: l, r: r };\n }\n var maxSym = t2[0].s;\n for (var i = 1; i < s; ++i) {\n if (t2[i].s > maxSym)\n maxSym = t2[i].s;\n }\n // code lengths\n var tr = new u16(maxSym + 1);\n // max bits in tree\n var mbt = ln(t[i1 - 1], tr, 0);\n if (mbt > mb) {\n // more algorithms from UZIP.js\n // TODO: find out how this code works (debt)\n // ind debt\n var i = 0, dt = 0;\n // left cost\n var lft = mbt - mb, cst = 1 << lft;\n t2.sort(function (a, b) { return tr[b.s] - tr[a.s] || a.f - b.f; });\n for (; i < s; ++i) {\n var i2_1 = t2[i].s;\n if (tr[i2_1] > mb) {\n dt += cst - (1 << (mbt - tr[i2_1]));\n tr[i2_1] = mb;\n }\n else\n break;\n }\n dt >>= lft;\n while (dt > 0) {\n var i2_2 = t2[i].s;\n if (tr[i2_2] < mb)\n dt -= 1 << (mb - tr[i2_2]++ - 1);\n else\n ++i;\n }\n for (; i >= 0 && dt; --i) {\n var i2_3 = t2[i].s;\n if (tr[i2_3] == mb) {\n --tr[i2_3];\n ++dt;\n }\n }\n mbt = mb;\n }\n return { t: new u8(tr), l: mbt };\n};\n// get the max length and assign length codes\nvar ln = function (n, l, d) {\n return n.s == -1\n ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1))\n : (l[n.s] = d);\n};\n// length codes generation\nvar lc = function (c) {\n var s = c.length;\n // Note that the semicolon was intentional\n while (s && !c[--s])\n ;\n var cl = new u16(++s);\n // ind num streak\n var cli = 0, cln = c[0], cls = 1;\n var w = function (v) { cl[cli++] = v; };\n for (var i = 1; i <= s; ++i) {\n if (c[i] == cln && i != s)\n ++cls;\n else {\n if (!cln && cls > 2) {\n for (; cls > 138; cls -= 138)\n w(32754);\n if (cls > 2) {\n w(cls > 10 ? ((cls - 11) << 5) | 28690 : ((cls - 3) << 5) | 12305);\n cls = 0;\n }\n }\n else if (cls > 3) {\n w(cln), --cls;\n for (; cls > 6; cls -= 6)\n w(8304);\n if (cls > 2)\n w(((cls - 3) << 5) | 8208), cls = 0;\n }\n while (cls--)\n w(cln);\n cls = 1;\n cln = c[i];\n }\n }\n return { c: cl.subarray(0, cli), n: s };\n};\n// calculate the length of output from tree, code lengths\nvar clen = function (cf, cl) {\n var l = 0;\n for (var i = 0; i < cl.length; ++i)\n l += cf[i] * cl[i];\n return l;\n};\n// writes a fixed block\n// returns the new bit pos\nvar wfblk = function (out, pos, dat) {\n // no need to write 00 as type: TypedArray defaults to 0\n var s = dat.length;\n var o = shft(pos + 2);\n out[o] = s & 255;\n out[o + 1] = s >> 8;\n out[o + 2] = out[o] ^ 255;\n out[o + 3] = out[o + 1] ^ 255;\n for (var i = 0; i < s; ++i)\n out[o + i + 4] = dat[i];\n return (o + 4 + s) * 8;\n};\n// writes a block\nvar wblk = function (dat, out, final, syms, lf, df, eb, li, bs, bl, p) {\n wbits(out, p++, final);\n ++lf[256];\n var _a = hTree(lf, 15), dlt = _a.t, mlb = _a.l;\n var _b = hTree(df, 15), ddt = _b.t, mdb = _b.l;\n var _c = lc(dlt), lclt = _c.c, nlc = _c.n;\n var _d = lc(ddt), lcdt = _d.c, ndc = _d.n;\n var lcfreq = new u16(19);\n for (var i = 0; i < lclt.length; ++i)\n ++lcfreq[lclt[i] & 31];\n for (var i = 0; i < lcdt.length; ++i)\n ++lcfreq[lcdt[i] & 31];\n var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l;\n var nlcc = 19;\n for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)\n ;\n var flen = (bl + 5) << 3;\n var ftlen = clen(lf, flt) + clen(df, fdt) + eb;\n var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];\n if (bs >= 0 && flen <= ftlen && flen <= dtlen)\n return wfblk(out, p, dat.subarray(bs, bs + bl));\n var lm, ll, dm, dl;\n wbits(out, p, 1 + (dtlen < ftlen)), p += 2;\n if (dtlen < ftlen) {\n lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;\n var llm = hMap(lct, mlcb, 0);\n wbits(out, p, nlc - 257);\n wbits(out, p + 5, ndc - 1);\n wbits(out, p + 10, nlcc - 4);\n p += 14;\n for (var i = 0; i < nlcc; ++i)\n wbits(out, p + 3 * i, lct[clim[i]]);\n p += 3 * nlcc;\n var lcts = [lclt, lcdt];\n for (var it = 0; it < 2; ++it) {\n var clct = lcts[it];\n for (var i = 0; i < clct.length; ++i) {\n var len = clct[i] & 31;\n wbits(out, p, llm[len]), p += lct[len];\n if (len > 15)\n wbits(out, p, (clct[i] >> 5) & 127), p += clct[i] >> 12;\n }\n }\n }\n else {\n lm = flm, ll = flt, dm = fdm, dl = fdt;\n }\n for (var i = 0; i < li; ++i) {\n var sym = syms[i];\n if (sym > 255) {\n var len = (sym >> 18) & 31;\n wbits16(out, p, lm[len + 257]), p += ll[len + 257];\n if (len > 7)\n wbits(out, p, (sym >> 23) & 31), p += fleb[len];\n var dst = sym & 31;\n wbits16(out, p, dm[dst]), p += dl[dst];\n if (dst > 3)\n wbits16(out, p, (sym >> 5) & 8191), p += fdeb[dst];\n }\n else {\n wbits16(out, p, lm[sym]), p += ll[sym];\n }\n }\n wbits16(out, p, lm[256]);\n return p + ll[256];\n};\n// deflate options (nice << 13) | chain\nvar deo = /*#__PURE__*/ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);\n// empty\nvar et = /*#__PURE__*/ new u8(0);\n// compresses data into a raw DEFLATE buffer\nvar dflt = function (dat, lvl, plvl, pre, post, st) {\n var s = st.z || dat.length;\n var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);\n // writing to this writes to the output buffer\n var w = o.subarray(pre, o.length - post);\n var lst = st.l;\n var pos = (st.r || 0) & 7;\n if (lvl) {\n if (pos)\n w[0] = st.r >> 3;\n var opt = deo[lvl - 1];\n var n = opt >> 13, c = opt & 8191;\n var msk_1 = (1 << plvl) - 1;\n // prev 2-byte val map curr 2-byte val map\n var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1);\n var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;\n var hsh = function (i) { return (dat[i] ^ (dat[i + 1] << bs1_1) ^ (dat[i + 2] << bs2_1)) & msk_1; };\n // 24576 is an arbitrary number of maximum symbols per block\n // 424 buffer for last block\n var syms = new i32(25000);\n // length/literal freq distance freq\n var lf = new u16(288), df = new u16(32);\n // l/lcnt exbits index l/lind waitdx blkpos\n var lc_1 = 0, eb = 0, i = st.i || 0, li = 0, wi = st.w || 0, bs = 0;\n for (; i + 2 < s; ++i) {\n // hash value\n var hv = hsh(i);\n // index mod 32768 previous index mod\n var imod = i & 32767, pimod = head[hv];\n prev[imod] = pimod;\n head[hv] = imod;\n // We always should modify head and prev, but only add symbols if\n // this data is not yet processed (\"wait\" for wait index)\n if (wi <= i) {\n // bytes remaining\n var rem = s - i;\n if ((lc_1 > 7000 || li > 24576) && (rem > 423 || !lst)) {\n pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);\n li = lc_1 = eb = 0, bs = i;\n for (var j = 0; j < 286; ++j)\n lf[j] = 0;\n for (var j = 0; j < 30; ++j)\n df[j] = 0;\n }\n // len dist chain\n var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767;\n if (rem > 2 && hv == hsh(i - dif)) {\n var maxn = Math.min(n, rem) - 1;\n var maxd = Math.min(32767, i);\n // max possible length\n // not capped at dif because decompressors implement \"rolling\" index population\n var ml = Math.min(258, rem);\n while (dif <= maxd && --ch_1 && imod != pimod) {\n if (dat[i + l] == dat[i + l - dif]) {\n var nl = 0;\n for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl)\n ;\n if (nl > l) {\n l = nl, d = dif;\n // break out early when we reach \"nice\" (we are satisfied enough)\n if (nl > maxn)\n break;\n // now, find the rarest 2-byte sequence within this\n // length of literals and search for that instead.\n // Much faster than just using the start\n var mmd = Math.min(dif, nl - 2);\n var md = 0;\n for (var j = 0; j < mmd; ++j) {\n var ti = i - dif + j & 32767;\n var pti = prev[ti];\n var cd = ti - pti & 32767;\n if (cd > md)\n md = cd, pimod = ti;\n }\n }\n }\n // check the previous match\n imod = pimod, pimod = prev[imod];\n dif += imod - pimod & 32767;\n }\n }\n // d will be nonzero only when a match was found\n if (d) {\n // store both dist and len data in one int32\n // Make sure this is recognized as a len/dist with 28th bit (2^28)\n syms[li++] = 268435456 | (revfl[l] << 18) | revfd[d];\n var lin = revfl[l] & 31, din = revfd[d] & 31;\n eb += fleb[lin] + fdeb[din];\n ++lf[257 + lin];\n ++df[din];\n wi = i + l;\n ++lc_1;\n }\n else {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n }\n }\n for (i = Math.max(i, wi); i < s; ++i) {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);\n if (!lst) {\n st.r = (pos & 7) | w[(pos / 8) | 0] << 3;\n // shft(pos) now 1 less if pos & 7 != 0\n pos -= 7;\n st.h = head, st.p = prev, st.i = i, st.w = wi;\n }\n }\n else {\n for (var i = st.w || 0; i < s + lst; i += 65535) {\n // end\n var e = i + 65535;\n if (e >= s) {\n // write final block\n w[(pos / 8) | 0] = lst;\n e = s;\n }\n pos = wfblk(w, pos + 1, dat.subarray(i, e));\n }\n st.i = s;\n }\n return slc(o, 0, pre + shft(pos) + post);\n};\n// CRC32 table\nvar crct = /*#__PURE__*/ (function () {\n var t = new Int32Array(256);\n for (var i = 0; i < 256; ++i) {\n var c = i, k = 9;\n while (--k)\n c = ((c & 1) && -306674912) ^ (c >>> 1);\n t[i] = c;\n }\n return t;\n})();\n// CRC32\nvar crc = function () {\n var c = -1;\n return {\n p: function (d) {\n // closures have awful performance\n var cr = c;\n for (var i = 0; i < d.length; ++i)\n cr = crct[(cr & 255) ^ d[i]] ^ (cr >>> 8);\n c = cr;\n },\n d: function () { return ~c; }\n };\n};\n// Adler32\nvar adler = function () {\n var a = 1, b = 0;\n return {\n p: function (d) {\n // closures have awful performance\n var n = a, m = b;\n var l = d.length | 0;\n for (var i = 0; i != l;) {\n var e = Math.min(i + 2655, l);\n for (; i < e; ++i)\n m += n += d[i];\n n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16);\n }\n a = n, b = m;\n },\n d: function () {\n a %= 65521, b %= 65521;\n return (a & 255) << 24 | (a & 0xFF00) << 8 | (b & 255) << 8 | (b >> 8);\n }\n };\n};\n;\n// deflate with opts\nvar dopt = function (dat, opt, pre, post, st) {\n if (!st) {\n st = { l: 1 };\n if (opt.dictionary) {\n var dict = opt.dictionary.subarray(-32768);\n var newDat = new u8(dict.length + dat.length);\n newDat.set(dict);\n newDat.set(dat, dict.length);\n dat = newDat;\n st.w = dict.length;\n }\n }\n return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? (st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20) : (12 + opt.mem), pre, post, st);\n};\n// Walmart object spread\nvar mrg = function (a, b) {\n var o = {};\n for (var k in a)\n o[k] = a[k];\n for (var k in b)\n o[k] = b[k];\n return o;\n};\n// worker clone\n// This is possibly the craziest part of the entire codebase, despite how simple it may seem.\n// The only parameter to this function is a closure that returns an array of variables outside of the function scope.\n// We're going to try to figure out the variable names used in the closure as strings because that is crucial for workerization.\n// We will return an object mapping of true variable name to value (basically, the current scope as a JS object).\n// The reason we can't just use the original variable names is minifiers mangling the toplevel scope.\n// This took me three weeks to figure out how to do.\nvar wcln = function (fn, fnStr, td) {\n var dt = fn();\n var st = fn.toString();\n var ks = st.slice(st.indexOf('[') + 1, st.lastIndexOf(']')).replace(/\\s+/g, '').split(',');\n for (var i = 0; i < dt.length; ++i) {\n var v = dt[i], k = ks[i];\n if (typeof v == 'function') {\n fnStr += ';' + k + '=';\n var st_1 = v.toString();\n if (v.prototype) {\n // for global objects\n if (st_1.indexOf('[native code]') != -1) {\n var spInd = st_1.indexOf(' ', 8) + 1;\n fnStr += st_1.slice(spInd, st_1.indexOf('(', spInd));\n }\n else {\n fnStr += st_1;\n for (var t in v.prototype)\n fnStr += ';' + k + '.prototype.' + t + '=' + v.prototype[t].toString();\n }\n }\n else\n fnStr += st_1;\n }\n else\n td[k] = v;\n }\n return fnStr;\n};\nvar ch = [];\n// clone bufs\nvar cbfs = function (v) {\n var tl = [];\n for (var k in v) {\n if (v[k].buffer) {\n tl.push((v[k] = new v[k].constructor(v[k])).buffer);\n }\n }\n return tl;\n};\n// use a worker to execute code\nvar wrkr = function (fns, init, id, cb) {\n if (!ch[id]) {\n var fnStr = '', td_1 = {}, m = fns.length - 1;\n for (var i = 0; i < m; ++i)\n fnStr = wcln(fns[i], fnStr, td_1);\n ch[id] = { c: wcln(fns[m], fnStr, td_1), e: td_1 };\n }\n var td = mrg({}, ch[id].e);\n return wk(ch[id].c + ';onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=' + init.toString() + '}', id, td, cbfs(td), cb);\n};\n// base async inflate fn\nvar bInflt = function () { return [u8, u16, i32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, ec, hMap, max, bits, bits16, shft, slc, err, inflt, inflateSync, pbf, gopt]; };\nvar bDflt = function () { return [u8, u16, i32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; };\n// gzip extra\nvar gze = function () { return [gzh, gzhl, wbytes, crc, crct]; };\n// gunzip extra\nvar guze = function () { return [gzs, gzl]; };\n// zlib extra\nvar zle = function () { return [zlh, wbytes, adler]; };\n// unzlib extra\nvar zule = function () { return [zls]; };\n// post buf\nvar pbf = function (msg) { return postMessage(msg, [msg.buffer]); };\n// get opts\nvar gopt = function (o) { return o && {\n out: o.size && new u8(o.size),\n dictionary: o.dictionary\n}; };\n// async helper\nvar cbify = function (dat, opts, fns, init, id, cb) {\n var w = wrkr(fns, init, id, function (err, dat) {\n w.terminate();\n cb(err, dat);\n });\n w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []);\n return function () { w.terminate(); };\n};\n// auto stream\nvar astrm = function (strm) {\n strm.ondata = function (dat, final) { return postMessage([dat, final], [dat.buffer]); };\n return function (ev) {\n if (ev.data[0]) {\n strm.push(ev.data[0], ev.data[1]);\n postMessage([ev.data[0].length]);\n }\n else\n strm.flush(ev.data[1]);\n };\n};\n// async stream attach\nvar astrmify = function (fns, strm, opts, init, id, flush, ext) {\n var t;\n var w = wrkr(fns, init, id, function (err, dat) {\n if (err)\n w.terminate(), strm.ondata.call(strm, err);\n else if (!Array.isArray(dat))\n ext(dat);\n else if (dat.length == 1) {\n strm.queuedSize -= dat[0];\n if (strm.ondrain)\n strm.ondrain(dat[0]);\n }\n else {\n if (dat[1])\n w.terminate();\n strm.ondata.call(strm, err, dat[0], dat[1]);\n }\n });\n w.postMessage(opts);\n strm.queuedSize = 0;\n strm.push = function (d, f) {\n if (!strm.ondata)\n err(5);\n if (t)\n strm.ondata(err(4, 0, 1), null, !!f);\n strm.queuedSize += d.length;\n // can fail for cross-realm Uint8Array, but ok - only a small performance penalty\n w.postMessage([d, t = f], d.buffer instanceof ArrayBuffer ? [d.buffer] : []);\n };\n strm.terminate = function () { w.terminate(); };\n if (flush) {\n strm.flush = function (sync) { w.postMessage([0, sync]); };\n }\n};\n// read 2 bytes\nvar b2 = function (d, b) { return d[b] | (d[b + 1] << 8); };\n// read 4 bytes\nvar b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16) | (d[b + 3] << 24)) >>> 0; };\n// read 8 bytes\nvar b8 = function (d, b) { return b4(d, b) + (b4(d, b + 4) * 4294967296); };\n// write bytes\nvar wbytes = function (d, b, v) {\n for (; v; ++b)\n d[b] = v, v >>>= 8;\n};\n// gzip header\nvar gzh = function (c, o) {\n var fn = o.filename;\n c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; // assume Unix\n if (o.mtime != 0)\n wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1000));\n if (fn) {\n c[3] = 8;\n for (var i = 0; i <= fn.length; ++i)\n c[i + 10] = fn.charCodeAt(i);\n }\n};\n// gzip footer: -8 to -4 = CRC, -4 to -0 is length\n// gzip start\nvar gzs = function (d) {\n if (d[0] != 31 || d[1] != 139 || d[2] != 8)\n err(6, 'invalid gzip data');\n var flg = d[3];\n var st = 10;\n if (flg & 4)\n st += (d[10] | d[11] << 8) + 2;\n for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++])\n ;\n return st + (flg & 2);\n};\n// gzip length\nvar gzl = function (d) {\n var l = d.length;\n return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0;\n};\n// gzip header length\nvar gzhl = function (o) { return 10 + (o.filename ? o.filename.length + 1 : 0); };\n// zlib header\nvar zlh = function (c, o) {\n var lv = o.level, fl = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;\n c[0] = 120, c[1] = (fl << 6) | (o.dictionary && 32);\n c[1] |= 31 - ((c[0] << 8) | c[1]) % 31;\n if (o.dictionary) {\n var h = adler();\n h.p(o.dictionary);\n wbytes(c, 2, h.d());\n }\n};\n// zlib start\nvar zls = function (d, dict) {\n if ((d[0] & 15) != 8 || (d[0] >> 4) > 7 || ((d[0] << 8 | d[1]) % 31))\n err(6, 'invalid zlib data');\n if ((d[1] >> 5 & 1) == +!dict)\n err(6, 'invalid zlib data: ' + (d[1] & 32 ? 'need' : 'unexpected') + ' dictionary');\n return (d[1] >> 3 & 4) + 2;\n};\nfunction StrmOpt(opts, cb) {\n if (typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n return opts;\n}\n/**\n * Streaming DEFLATE compression\n */\nvar Deflate = /*#__PURE__*/ (function () {\n function Deflate(opts, cb) {\n if (typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n this.o = opts || {};\n this.s = { l: 0, i: 32768, w: 32768, z: 32768 };\n // Buffer length must always be 0 mod 32768 for index calculations to be correct when modifying head and prev\n // 98304 = 32768 (lookback) + 65536 (common chunk size)\n this.b = new u8(98304);\n if (this.o.dictionary) {\n var dict = this.o.dictionary.subarray(-32768);\n this.b.set(dict, 32768 - dict.length);\n this.s.i = 32768 - dict.length;\n }\n }\n Deflate.prototype.p = function (c, f) {\n this.ondata(dopt(c, this.o, 0, 0, this.s), f);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Deflate.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (this.s.l)\n err(4);\n var endLen = chunk.length + this.s.z;\n if (endLen > this.b.length) {\n if (endLen > 2 * this.b.length - 32768) {\n var newBuf = new u8(endLen & -32768);\n newBuf.set(this.b.subarray(0, this.s.z));\n this.b = newBuf;\n }\n var split = this.b.length - this.s.z;\n this.b.set(chunk.subarray(0, split), this.s.z);\n this.s.z = this.b.length;\n this.p(this.b, false);\n this.b.set(this.b.subarray(-32768));\n this.b.set(chunk.subarray(split), 32768);\n this.s.z = chunk.length - split + 32768;\n this.s.i = 32766, this.s.w = 32768;\n }\n else {\n this.b.set(chunk, this.s.z);\n this.s.z += chunk.length;\n }\n this.s.l = final & 1;\n if (this.s.z > this.s.w + 8191 || final) {\n this.p(this.b, final || false);\n this.s.w = this.s.i, this.s.i -= 2;\n }\n if (final) {\n // cleanup unneeded buffers/state to reduce memory usage\n this.s = this.o = {};\n this.b = et;\n }\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * deflated output for small inputs.\n * @param sync Whether to flush to a byte boundary. A sync flush takes 4-5\n * extra bytes, but guarantees all pushed data is immediately\n * decompressible. A separate DEFLATE stream may be concatenated\n * with the current output after a sync flush.\n */\n Deflate.prototype.flush = function (sync) {\n if (!this.ondata)\n err(5);\n if (this.s.l)\n err(4);\n this.p(this.b, false);\n this.s.w = this.s.i, this.s.i -= 2;\n // could technically skip writing the type-0 block for (this.s.r & 7) == 0,\n // but the deterministic trailer (00 00 FF FF) is useful in some situations\n if (sync) {\n var c = new u8(6);\n c[0] = this.s.r >> 3;\n // write empty, non-final type-0 block\n var ep = wfblk(c, this.s.r, et);\n this.s.r = 0;\n this.ondata(c.subarray(0, ep >> 3), false);\n }\n };\n return Deflate;\n}());\nexport { Deflate };\n/**\n * Asynchronous streaming DEFLATE compression\n */\nvar AsyncDeflate = /*#__PURE__*/ (function () {\n function AsyncDeflate(opts, cb) {\n astrmify([\n bDflt,\n function () { return [astrm, Deflate]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Deflate(ev.data);\n onmessage = astrm(strm);\n }, 6, 1);\n }\n return AsyncDeflate;\n}());\nexport { AsyncDeflate };\nexport function deflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n ], function (ev) { return pbf(deflateSync(ev.data[0], ev.data[1])); }, 0, cb);\n}\n/**\n * Compresses data with DEFLATE without any wrapper\n * @param data The data to compress\n * @param opts The compression options\n * @returns The deflated version of the data\n */\nexport function deflateSync(data, opts) {\n return dopt(data, opts || {}, 0, 0);\n}\n/**\n * Streaming DEFLATE decompression\n */\nvar Inflate = /*#__PURE__*/ (function () {\n function Inflate(opts, cb) {\n // no StrmOpt here to avoid adding to workerizer\n if (typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n var dict = opts && opts.dictionary && opts.dictionary.subarray(-32768);\n this.s = { i: 0, b: dict ? dict.length : 0 };\n this.o = new u8(32768);\n this.p = new u8(0);\n if (dict)\n this.o.set(dict);\n }\n Inflate.prototype.e = function (c) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n if (!this.p.length)\n this.p = c;\n else if (c.length) {\n var n = new u8(this.p.length + c.length);\n n.set(this.p), n.set(c, this.p.length), this.p = n;\n }\n };\n Inflate.prototype.c = function (final) {\n this.s.i = +(this.d = final || false);\n var bts = this.s.b;\n var dt = inflt(this.p, this.s, this.o);\n this.ondata(slc(dt, bts, this.s.b), this.d);\n this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;\n this.p = slc(this.p, (this.s.p / 8) | 0), this.s.p &= 7;\n };\n /**\n * Pushes a chunk to be inflated\n * @param chunk The chunk to push\n * @param final Whether this is the final chunk\n */\n Inflate.prototype.push = function (chunk, final) {\n this.e(chunk), this.c(final);\n };\n return Inflate;\n}());\nexport { Inflate };\n/**\n * Asynchronous streaming DEFLATE decompression\n */\nvar AsyncInflate = /*#__PURE__*/ (function () {\n function AsyncInflate(opts, cb) {\n astrmify([\n bInflt,\n function () { return [astrm, Inflate]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Inflate(ev.data);\n onmessage = astrm(strm);\n }, 7, 0);\n }\n return AsyncInflate;\n}());\nexport { AsyncInflate };\nexport function inflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt\n ], function (ev) { return pbf(inflateSync(ev.data[0], gopt(ev.data[1]))); }, 1, cb);\n}\nexport function inflateSync(data, opts) {\n return inflt(data, { i: 2 }, opts && opts.out, opts && opts.dictionary);\n}\n// before you yell at me for not just using extends, my reason is that TS inheritance is hard to workerize.\n/**\n * Streaming GZIP compression\n */\nvar Gzip = /*#__PURE__*/ (function () {\n function Gzip(opts, cb) {\n this.c = crc();\n this.l = 0;\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gzip.prototype.push = function (chunk, final) {\n this.c.p(chunk);\n this.l += chunk.length;\n Deflate.prototype.push.call(this, chunk, final);\n };\n Gzip.prototype.p = function (c, f) {\n var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, this.s);\n if (this.v)\n gzh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l);\n this.ondata(raw, f);\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * GZIPped output for small inputs.\n * @param sync Whether to flush to a byte boundary. A sync flush takes 4-5\n * extra bytes, but guarantees all pushed data is immediately\n * decompressible.\n */\n Gzip.prototype.flush = function (sync) {\n Deflate.prototype.flush.call(this, sync);\n };\n return Gzip;\n}());\nexport { Gzip };\n/**\n * Asynchronous streaming GZIP compression\n */\nvar AsyncGzip = /*#__PURE__*/ (function () {\n function AsyncGzip(opts, cb) {\n astrmify([\n bDflt,\n gze,\n function () { return [astrm, Deflate, Gzip]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Gzip(ev.data);\n onmessage = astrm(strm);\n }, 8, 1);\n }\n return AsyncGzip;\n}());\nexport { AsyncGzip };\nexport function gzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n gze,\n function () { return [gzipSync]; }\n ], function (ev) { return pbf(gzipSync(ev.data[0], ev.data[1])); }, 2, cb);\n}\n/**\n * Compresses data with GZIP\n * @param data The data to compress\n * @param opts The compression options\n * @returns The gzipped version of the data\n */\nexport function gzipSync(data, opts) {\n if (!opts)\n opts = {};\n var c = crc(), l = data.length;\n c.p(data);\n var d = dopt(data, opts, gzhl(opts), 8), s = d.length;\n return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d;\n}\n/**\n * Streaming single or multi-member GZIP decompression\n */\nvar Gunzip = /*#__PURE__*/ (function () {\n function Gunzip(opts, cb) {\n this.v = 1;\n this.r = 0;\n Inflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GUNZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gunzip.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n this.r += chunk.length;\n if (this.v) {\n var p = this.p.subarray(this.v - 1);\n var s = p.length > 3 ? gzs(p) : 4;\n if (s > p.length) {\n if (!final)\n return;\n }\n else if (this.v > 1 && this.onmember) {\n this.onmember(this.r - p.length);\n }\n this.p = p.subarray(s), this.v = 0;\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, 0);\n // process concatenated GZIP\n if (this.s.f && !this.s.l) {\n this.v = shft(this.s.p) + 9;\n this.s = { i: 0 };\n this.o = new u8(0);\n this.push(new u8(0), final);\n }\n else if (final) {\n Inflate.prototype.c.call(this, final);\n }\n };\n return Gunzip;\n}());\nexport { Gunzip };\n/**\n * Asynchronous streaming single or multi-member GZIP decompression\n */\nvar AsyncGunzip = /*#__PURE__*/ (function () {\n function AsyncGunzip(opts, cb) {\n var _this = this;\n astrmify([\n bInflt,\n guze,\n function () { return [astrm, Inflate, Gunzip]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Gunzip(ev.data);\n strm.onmember = function (offset) { return postMessage(offset); };\n onmessage = astrm(strm);\n }, 9, 0, function (offset) { return _this.onmember && _this.onmember(offset); });\n }\n return AsyncGunzip;\n}());\nexport { AsyncGunzip };\nexport function gunzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt,\n guze,\n function () { return [gunzipSync]; }\n ], function (ev) { return pbf(gunzipSync(ev.data[0], ev.data[1])); }, 3, cb);\n}\nexport function gunzipSync(data, opts) {\n var st = gzs(data);\n if (st + 8 > data.length)\n err(6, 'invalid gzip data');\n return inflt(data.subarray(st, -8), { i: 2 }, opts && opts.out || new u8(gzl(data)), opts && opts.dictionary);\n}\n/**\n * Streaming Zlib compression\n */\nvar Zlib = /*#__PURE__*/ (function () {\n function Zlib(opts, cb) {\n this.c = adler();\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be zlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Zlib.prototype.push = function (chunk, final) {\n this.c.p(chunk);\n Deflate.prototype.push.call(this, chunk, final);\n };\n Zlib.prototype.p = function (c, f) {\n var raw = dopt(c, this.o, this.v && (this.o.dictionary ? 6 : 2), f && 4, this.s);\n if (this.v)\n zlh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 4, this.c.d());\n this.ondata(raw, f);\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * zlibbed output for small inputs.\n * @param sync Whether to flush to a byte boundary. A sync flush takes 4-5\n * extra bytes, but guarantees all pushed data is immediately\n * decompressible.\n */\n Zlib.prototype.flush = function (sync) {\n Deflate.prototype.flush.call(this, sync);\n };\n return Zlib;\n}());\nexport { Zlib };\n/**\n * Asynchronous streaming Zlib compression\n */\nvar AsyncZlib = /*#__PURE__*/ (function () {\n function AsyncZlib(opts, cb) {\n astrmify([\n bDflt,\n zle,\n function () { return [astrm, Deflate, Zlib]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Zlib(ev.data);\n onmessage = astrm(strm);\n }, 10, 1);\n }\n return AsyncZlib;\n}());\nexport { AsyncZlib };\nexport function zlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n zle,\n function () { return [zlibSync]; }\n ], function (ev) { return pbf(zlibSync(ev.data[0], ev.data[1])); }, 4, cb);\n}\n/**\n * Compress data with Zlib\n * @param data The data to compress\n * @param opts The compression options\n * @returns The zlib-compressed version of the data\n */\nexport function zlibSync(data, opts) {\n if (!opts)\n opts = {};\n var a = adler();\n a.p(data);\n var d = dopt(data, opts, opts.dictionary ? 6 : 2, 4);\n return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;\n}\n/**\n * Streaming Zlib decompression\n */\nvar Unzlib = /*#__PURE__*/ (function () {\n function Unzlib(opts, cb) {\n Inflate.call(this, opts, cb);\n this.v = opts && opts.dictionary ? 2 : 1;\n }\n /**\n * Pushes a chunk to be unzlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzlib.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n if (this.p.length < 6 && !final)\n return;\n this.p = this.p.subarray(zls(this.p, this.v - 1)), this.v = 0;\n }\n if (final) {\n if (this.p.length < 4)\n err(6, 'invalid zlib data');\n this.p = this.p.subarray(0, -4);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Unzlib;\n}());\nexport { Unzlib };\n/**\n * Asynchronous streaming Zlib decompression\n */\nvar AsyncUnzlib = /*#__PURE__*/ (function () {\n function AsyncUnzlib(opts, cb) {\n astrmify([\n bInflt,\n zule,\n function () { return [astrm, Inflate, Unzlib]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Unzlib(ev.data);\n onmessage = astrm(strm);\n }, 11, 0);\n }\n return AsyncUnzlib;\n}());\nexport { AsyncUnzlib };\nexport function unzlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt,\n zule,\n function () { return [unzlibSync]; }\n ], function (ev) { return pbf(unzlibSync(ev.data[0], gopt(ev.data[1]))); }, 5, cb);\n}\nexport function unzlibSync(data, opts) {\n return inflt(data.subarray(zls(data, opts && opts.dictionary), -4), { i: 2 }, opts && opts.out, opts && opts.dictionary);\n}\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzip as compress, AsyncGzip as AsyncCompress };\nexport { gzipSync as compressSync, Gzip as Compress };\n/**\n * Streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar Decompress = /*#__PURE__*/ (function () {\n function Decompress(opts, cb) {\n this.o = StrmOpt.call(this, opts, cb) || {};\n this.G = Gunzip;\n this.I = Inflate;\n this.Z = Unzlib;\n }\n // init substream\n // overriden by AsyncDecompress\n Decompress.prototype.i = function () {\n var _this = this;\n this.s.ondata = function (dat, final) {\n _this.ondata(dat, final);\n };\n };\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Decompress.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (!this.s) {\n if (this.p && this.p.length) {\n var n = new u8(this.p.length + chunk.length);\n n.set(this.p), n.set(chunk, this.p.length);\n }\n else\n this.p = chunk;\n if (this.p.length > 2) {\n this.s = (this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8)\n ? new this.G(this.o)\n : ((this.p[0] & 15) != 8 || (this.p[0] >> 4) > 7 || ((this.p[0] << 8 | this.p[1]) % 31))\n ? new this.I(this.o)\n : new this.Z(this.o);\n this.i();\n this.s.push(this.p, final);\n this.p = null;\n }\n }\n else\n this.s.push(chunk, final);\n };\n return Decompress;\n}());\nexport { Decompress };\n/**\n * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar AsyncDecompress = /*#__PURE__*/ (function () {\n function AsyncDecompress(opts, cb) {\n Decompress.call(this, opts, cb);\n this.queuedSize = 0;\n this.G = AsyncGunzip;\n this.I = AsyncInflate;\n this.Z = AsyncUnzlib;\n }\n AsyncDecompress.prototype.i = function () {\n var _this = this;\n this.s.ondata = function (err, dat, final) {\n _this.ondata(err, dat, final);\n };\n this.s.ondrain = function (size) {\n _this.queuedSize -= size;\n if (_this.ondrain)\n _this.ondrain(size);\n };\n };\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncDecompress.prototype.push = function (chunk, final) {\n this.queuedSize += chunk.length;\n Decompress.prototype.push.call(this, chunk, final);\n };\n return AsyncDecompress;\n}());\nexport { AsyncDecompress };\nexport function decompress(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzip(data, opts, cb)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflate(data, opts, cb)\n : unzlib(data, opts, cb);\n}\n/**\n * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nexport function decompressSync(data, opts) {\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzipSync(data, opts)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflateSync(data, opts)\n : unzlibSync(data, opts);\n}\n// flatten a directory structure\nvar fltn = function (d, p, t, o) {\n for (var k in d) {\n var val = d[k], n = p + k, op = o;\n if (Array.isArray(val))\n op = mrg(o, val[1]), val = val[0];\n if (ArrayBuffer.isView(val))\n t[n] = [val, op];\n else {\n t[n += '/'] = [new u8(0), op];\n fltn(val, n, t, o);\n }\n }\n};\n// text encoder\nvar te = typeof TextEncoder != 'undefined' && /*#__PURE__*/ new TextEncoder();\n// text decoder\nvar td = typeof TextDecoder != 'undefined' && /*#__PURE__*/ new TextDecoder();\n// text decoder stream\nvar tds = 0;\ntry {\n td.decode(et, { stream: true });\n tds = 1;\n}\ncatch (e) { }\n// decode UTF8\nvar dutf8 = function (d) {\n for (var r = '', i = 0;;) {\n var c = d[i++];\n var eb = (c > 127) + (c > 223) + (c > 239);\n if (i + eb > d.length)\n return { s: r, r: slc(d, i - 1) };\n if (!eb)\n r += String.fromCharCode(c);\n else if (eb == 3) {\n c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63)) - 65536,\n r += String.fromCharCode(55296 | (c >> 10), 56320 | (c & 1023));\n }\n else if (eb & 1)\n r += String.fromCharCode((c & 31) << 6 | (d[i++] & 63));\n else\n r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63));\n }\n};\n/**\n * Streaming UTF-8 decoding\n */\nvar DecodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is decoded\n */\n function DecodeUTF8(cb) {\n this.ondata = cb;\n if (tds)\n this.t = new TextDecoder();\n else\n this.p = et;\n }\n /**\n * Pushes a chunk to be decoded from UTF-8 binary\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n DecodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n final = !!final;\n if (this.t) {\n this.ondata(this.t.decode(chunk, { stream: true }), final);\n if (final) {\n if (this.t.decode().length)\n err(8);\n this.t = null;\n }\n return;\n }\n if (!this.p)\n err(4);\n var dat = new u8(this.p.length + chunk.length);\n dat.set(this.p);\n dat.set(chunk, this.p.length);\n var _a = dutf8(dat), s = _a.s, r = _a.r;\n if (final) {\n if (r.length)\n err(8);\n this.p = null;\n }\n else\n this.p = r;\n this.ondata(s, final);\n };\n return DecodeUTF8;\n}());\nexport { DecodeUTF8 };\n/**\n * Streaming UTF-8 encoding\n */\nvar EncodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is encoded\n */\n function EncodeUTF8(cb) {\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be encoded to UTF-8\n * @param chunk The string data to push\n * @param final Whether this is the last chunk\n */\n EncodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n this.ondata(strToU8(chunk), this.d = final || false);\n };\n return EncodeUTF8;\n}());\nexport { EncodeUTF8 };\n/**\n * Converts a string into a Uint8Array for use with compression/decompression methods\n * @param str The string to encode\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless decoding a binary string.\n * @returns The string encoded in UTF-8/Latin-1 binary\n */\nexport function strToU8(str, latin1) {\n if (latin1) {\n var ar_1 = new u8(str.length);\n for (var i = 0; i < str.length; ++i)\n ar_1[i] = str.charCodeAt(i);\n return ar_1;\n }\n if (te)\n return te.encode(str);\n var l = str.length;\n var ar = new u8(str.length + (str.length >> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >> 18)), w(128 | ((c >> 12) & 63)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >> 12)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}\n/**\n * Converts a Uint8Array to a string\n * @param dat The data to decode to string\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless encoding to binary string.\n * @returns The original UTF-8/Latin-1 string\n */\nexport function strFromU8(dat, latin1) {\n if (latin1) {\n var r = '';\n for (var i = 0; i < dat.length; i += 16384)\n r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));\n return r;\n }\n else if (td) {\n return td.decode(dat);\n }\n else {\n var _a = dutf8(dat), s = _a.s, r = _a.r;\n if (r.length)\n err(8);\n return s;\n }\n}\n;\n// deflate bit flag\nvar dbf = function (l) { return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0; };\n// skip local zip header\nvar slzh = function (d, b) { return b + 30 + b2(d, b + 26) + b2(d, b + 28); };\n// read zip header\nvar zh = function (d, b, z) {\n var fnl = b2(d, b + 28), efl = b2(d, b + 30), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl;\n var _a = z64hs(d, es, efl, z, b4(d, b + 20), b4(d, b + 24), b4(d, b + 42)), sc = _a[0], su = _a[1], off = _a[2];\n return [b2(d, b + 10), sc, su, fn, es + efl + b2(d, b + 32), off];\n};\n// read zip64 header sizes\nvar z64hs = function (d, b, l, z, sc, su, off) {\n var nsc = sc == 4294967295, nsu = su == 4294967295, noff = off == 4294967295, e = b + l;\n var nf = nsc + nsu + noff;\n if (z && nf) {\n for (; b + 4 < e; b += 4 + b2(d, b + 2)) {\n if (b2(d, b) == 1) {\n return [\n nsc ? b8(d, b + 4 + 8 * nsu) : sc,\n nsu ? b8(d, b + 4) : su,\n noff ? b8(d, b + 4 + 8 * (nsu + nsc)) : off,\n 1\n ];\n }\n }\n // z == 2 for unknown whether or not zip64\n if (z < 2)\n err(13);\n }\n return [sc, su, off, 0];\n};\n// extra field length\nvar exfl = function (ex) {\n var le = 0;\n if (ex) {\n for (var k in ex) {\n var l = ex[k].length;\n if (l > 65535)\n err(9);\n le += l + 4;\n }\n }\n return le;\n};\n// write zip header\nvar wzh = function (d, b, f, fn, u, c, ce, co) {\n var fl = fn.length, ex = f.extra, col = co && co.length;\n var exl = exfl(ex);\n wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50), b += 4;\n if (ce != null)\n d[b++] = 20, d[b++] = f.os;\n d[b] = 20, b += 2; // spec compliance? what's that?\n d[b++] = (f.flag << 1) | (c < 0 && 8), d[b++] = u && 8;\n d[b++] = f.compression & 255, d[b++] = f.compression >> 8;\n var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980;\n if (y < 0 || y > 119)\n err(10);\n wbytes(d, b, (y << 25) | ((dt.getMonth() + 1) << 21) | (dt.getDate() << 16) | (dt.getHours() << 11) | (dt.getMinutes() << 5) | (dt.getSeconds() >> 1)), b += 4;\n if (c != -1) {\n wbytes(d, b, f.crc);\n wbytes(d, b + 4, c < 0 ? -c - 2 : c);\n wbytes(d, b + 8, f.size);\n }\n wbytes(d, b + 12, fl);\n wbytes(d, b + 14, exl), b += 16;\n if (ce != null) {\n wbytes(d, b, col);\n wbytes(d, b + 6, f.attrs);\n wbytes(d, b + 10, ce), b += 14;\n }\n d.set(fn, b);\n b += fl;\n if (exl) {\n for (var k in ex) {\n var exf = ex[k], l = exf.length;\n wbytes(d, b, +k);\n wbytes(d, b + 2, l);\n d.set(exf, b + 4), b += 4 + l;\n }\n }\n if (col)\n d.set(co, b), b += col;\n return b;\n};\n// write zip footer (end of central directory)\nvar wzf = function (o, b, c, d, e) {\n wbytes(o, b, 0x6054B50); // skip disk\n wbytes(o, b + 8, c);\n wbytes(o, b + 10, c);\n wbytes(o, b + 12, d);\n wbytes(o, b + 16, e);\n};\n/**\n * A pass-through stream to keep data uncompressed in a ZIP archive.\n */\nvar ZipPassThrough = /*#__PURE__*/ (function () {\n /**\n * Creates a pass-through stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n */\n function ZipPassThrough(filename) {\n this.filename = filename;\n this.c = crc();\n this.size = 0;\n this.compression = 0;\n }\n /**\n * Processes a chunk and pushes to the output stream. You can override this\n * method in a subclass for custom behavior, but by default this passes\n * the data through. You must call this.ondata(err, chunk, final) at some\n * point in this method.\n * @param chunk The chunk to process\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.process = function (chunk, final) {\n this.ondata(null, chunk, final);\n };\n /**\n * Pushes a chunk to be added. If you are subclassing this with a custom\n * compression algorithm, note that you must push data from the source\n * file only, pre-compression.\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n this.c.p(chunk);\n this.size += chunk.length;\n if (final)\n this.crc = this.c.d();\n // we shouldn't really do this cast, but properly handling ArrayBufferLike\n // makes the API unergonomic with Buffer\n this.process(chunk, final || false);\n };\n return ZipPassThrough;\n}());\nexport { ZipPassThrough };\n// I don't extend because TypeScript extension adds 1kB of runtime bloat\n/**\n * Streaming DEFLATE compression for ZIP archives. Prefer using AsyncZipDeflate\n * for better performance\n */\nvar ZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function ZipDeflate(filename, opts) {\n var _this = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new Deflate(opts, function (dat, final) {\n _this.ondata(null, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n }\n ZipDeflate.prototype.process = function (chunk, final) {\n try {\n this.d.push(chunk, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return ZipDeflate;\n}());\nexport { ZipDeflate };\n/**\n * Asynchronous streaming DEFLATE compression for ZIP archives\n */\nvar AsyncZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function AsyncZipDeflate(filename, opts) {\n var _this = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new AsyncDeflate(opts, function (err, dat, final) {\n _this.ondata(err, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n this.terminate = this.d.terminate;\n }\n AsyncZipDeflate.prototype.process = function (chunk, final) {\n this.d.push(chunk, final);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return AsyncZipDeflate;\n}());\nexport { AsyncZipDeflate };\n// TODO: Better tree shaking\n/**\n * A zippable archive to which files can incrementally be added\n */\nvar Zip = /*#__PURE__*/ (function () {\n /**\n * Creates an empty ZIP archive to which files can be added\n * @param cb The callback to call whenever data for the generated ZIP archive\n * is available\n */\n function Zip(cb) {\n this.ondata = cb;\n this.u = [];\n this.d = 1;\n }\n /**\n * Adds a file to the ZIP archive\n * @param file The file stream to add\n */\n Zip.prototype.add = function (file) {\n var _this = this;\n if (!this.ondata)\n err(5);\n // finishing or finished\n if (this.d & 2)\n this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, false);\n else {\n var f = strToU8(file.filename), fl_1 = f.length;\n var com = file.comment, o = com && strToU8(com);\n var u = fl_1 != file.filename.length || (o && (com.length != o.length));\n var hl_1 = fl_1 + exfl(file.extra) + 30;\n if (fl_1 > 65535)\n this.ondata(err(11, 0, 1), null, false);\n var header = new u8(hl_1);\n wzh(header, 0, file, f, u, -1);\n var chks_1 = [header];\n var pAll_1 = function () {\n for (var _i = 0, chks_2 = chks_1; _i < chks_2.length; _i++) {\n var chk = chks_2[_i];\n _this.ondata(null, chk, false);\n }\n chks_1 = [];\n };\n var tr_1 = this.d;\n this.d = 0;\n var ind_1 = this.u.length;\n var uf_1 = mrg(file, {\n f: f,\n u: u,\n o: o,\n t: function () {\n if (file.terminate)\n file.terminate();\n },\n r: function () {\n pAll_1();\n if (tr_1) {\n var nxt = _this.u[ind_1 + 1];\n if (nxt)\n nxt.r();\n else\n _this.d = 1;\n }\n tr_1 = 1;\n }\n });\n var cl_1 = 0;\n file.ondata = function (err, dat, final) {\n if (err) {\n _this.ondata(err, dat, final);\n _this.terminate();\n }\n else {\n cl_1 += dat.length;\n chks_1.push(dat);\n if (final) {\n var dd = new u8(16);\n wbytes(dd, 0, 0x8074B50);\n wbytes(dd, 4, file.crc);\n wbytes(dd, 8, cl_1);\n wbytes(dd, 12, file.size);\n chks_1.push(dd);\n uf_1.c = cl_1, uf_1.b = hl_1 + cl_1 + 16, uf_1.crc = file.crc, uf_1.size = file.size;\n if (tr_1)\n uf_1.r();\n tr_1 = 1;\n }\n else if (tr_1)\n pAll_1();\n }\n };\n this.u.push(uf_1);\n }\n };\n /**\n * Ends the process of adding files and prepares to emit the final chunks.\n * This *must* be called after adding all desired files for the resulting\n * ZIP file to work properly.\n */\n Zip.prototype.end = function () {\n var _this = this;\n if (this.d & 2) {\n this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, true);\n return;\n }\n if (this.d)\n this.e();\n else\n this.u.push({\n r: function () {\n if (!(_this.d & 1))\n return;\n _this.u.splice(-1, 1);\n _this.e();\n },\n t: function () { }\n });\n this.d = 3;\n };\n Zip.prototype.e = function () {\n var bt = 0, l = 0, tl = 0;\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n tl += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0);\n }\n var out = new u8(tl + 22);\n for (var _b = 0, _c = this.u; _b < _c.length; _b++) {\n var f = _c[_b];\n wzh(out, bt, f, f.f, f.u, -f.c - 2, l, f.o);\n bt += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0), l += f.b;\n }\n wzf(out, bt, this.u.length, tl, l);\n this.ondata(null, out, true);\n this.d = 2;\n };\n /**\n * A method to terminate any internal workers used by the stream. Subsequent\n * calls to add() will fail.\n */\n Zip.prototype.terminate = function () {\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n f.t();\n }\n this.d = 2;\n };\n return Zip;\n}());\nexport { Zip };\nexport function zip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n var r = {};\n fltn(data, '', r, opts);\n var k = Object.keys(r);\n var lft = k.length, o = 0, tot = 0;\n var slft = lft, files = new Array(lft);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var cbd = function (a, b) {\n mt(function () { cb(a, b); });\n };\n mt(function () { cbd = cb; });\n var cbf = function () {\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n tot = 0;\n for (var i = 0; i < slft; ++i) {\n var f = files[i];\n try {\n var l = f.c.length;\n wzh(out, tot, f, f.f, f.u, l);\n var badd = 30 + f.f.length + exfl(f.extra);\n var loc = tot + badd;\n out.set(f.c, loc);\n wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l;\n }\n catch (e) {\n return cbd(e, null);\n }\n }\n wzf(out, o, files.length, cdl, oe);\n cbd(null, out);\n };\n if (!lft)\n cbf();\n var _loop_1 = function (i) {\n var fn = k[i];\n var _a = r[fn], file = _a[0], p = _a[1];\n var c = crc(), size = file.length;\n c.p(file);\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n var compression = p.level == 0 ? 0 : 8;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n }\n else {\n var l = d.length;\n files[i] = mrg(p, {\n size: size,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n compression: compression\n });\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n if (!--lft)\n cbf();\n }\n };\n if (s > 65535)\n cbl(err(11, 0, 1), null);\n if (!compression)\n cbl(null, file);\n else if (size < 160000) {\n try {\n cbl(null, deflateSync(file, p));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(deflate(file, p, cbl));\n };\n // Cannot use lft because it can decrease\n for (var i = 0; i < slft; ++i) {\n _loop_1(i);\n }\n return tAll;\n}\n/**\n * Synchronously creates a ZIP file. Prefer using `zip` for better performance\n * with more than one file.\n * @param data The directory structure for the ZIP archive\n * @param opts The main options, merged with per-file options\n * @returns The generated ZIP archive\n */\nexport function zipSync(data, opts) {\n if (!opts)\n opts = {};\n var r = {};\n var files = [];\n fltn(data, '', r, opts);\n var o = 0;\n var tot = 0;\n for (var fn in r) {\n var _a = r[fn], file = _a[0], p = _a[1];\n var compression = p.level == 0 ? 0 : 8;\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n if (s > 65535)\n err(11);\n var d = compression ? deflateSync(file, p) : file, l = d.length;\n var c = crc();\n c.p(file);\n files.push(mrg(p, {\n size: file.length,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n o: o,\n compression: compression\n }));\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n }\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n for (var i = 0; i < files.length; ++i) {\n var f = files[i];\n wzh(out, f.o, f, f.f, f.u, f.c.length);\n var badd = 30 + f.f.length + exfl(f.extra);\n out.set(f.c, f.o + badd);\n wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);\n }\n wzf(out, o, files.length, cdl, oe);\n return out;\n}\n/**\n * Streaming pass-through decompression for ZIP archives\n */\nvar UnzipPassThrough = /*#__PURE__*/ (function () {\n function UnzipPassThrough() {\n }\n UnzipPassThrough.prototype.push = function (chunk, final) {\n // same as ZipPassThrough: cast to retain Buffer ergonomics\n this.ondata(null, chunk, final);\n };\n UnzipPassThrough.compression = 0;\n return UnzipPassThrough;\n}());\nexport { UnzipPassThrough };\n/**\n * Streaming DEFLATE decompression for ZIP archives. Prefer AsyncZipInflate for\n * better performance.\n */\nvar UnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function UnzipInflate() {\n var _this = this;\n this.i = new Inflate(function (dat, final) {\n _this.ondata(null, dat, final);\n });\n }\n UnzipInflate.prototype.push = function (chunk, final) {\n try {\n this.i.push(chunk, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n UnzipInflate.compression = 8;\n return UnzipInflate;\n}());\nexport { UnzipInflate };\n/**\n * Asynchronous streaming DEFLATE decompression for ZIP archives\n */\nvar AsyncUnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function AsyncUnzipInflate(_, sz) {\n var _this = this;\n if (sz < 320000) {\n this.i = new Inflate(function (dat, final) {\n _this.ondata(null, dat, final);\n });\n }\n else {\n this.i = new AsyncInflate(function (err, dat, final) {\n _this.ondata(err, dat, final);\n });\n this.terminate = this.i.terminate;\n }\n }\n AsyncUnzipInflate.prototype.push = function (chunk, final) {\n if (this.i.terminate)\n chunk = slc(chunk, 0);\n this.i.push(chunk, final);\n };\n AsyncUnzipInflate.compression = 8;\n return AsyncUnzipInflate;\n}());\nexport { AsyncUnzipInflate };\n/**\n * A ZIP archive decompression stream that emits files as they are discovered\n */\nvar Unzip = /*#__PURE__*/ (function () {\n /**\n * Creates a ZIP decompression stream\n * @param cb The callback to call whenever a file in the ZIP archive is found\n */\n function Unzip(cb) {\n this.onfile = cb;\n this.k = [];\n this.o = {\n 0: UnzipPassThrough\n };\n this.p = et;\n }\n /**\n * Pushes a chunk to be unzipped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzip.prototype.push = function (chunk, final) {\n var _this = this;\n if (!this.onfile)\n err(5);\n if (!this.p)\n err(4);\n if (this.c > 0) {\n var len = Math.min(this.c, chunk.length);\n var toAdd = chunk.subarray(0, len);\n this.c -= len;\n if (this.d)\n this.d.push(toAdd, !this.c);\n else\n this.k[0].push(toAdd);\n chunk = chunk.subarray(len);\n if (chunk.length)\n return this.push(chunk, final);\n }\n else {\n var f = 0, i = 0, is = void 0, buf = void 0;\n if (!this.p.length)\n buf = chunk;\n else if (!chunk.length)\n buf = this.p;\n else {\n buf = new u8(this.p.length + chunk.length);\n buf.set(this.p), buf.set(chunk, this.p.length);\n }\n var l = buf.length, oc = this.c, add = oc && this.d;\n var _loop_2 = function () {\n var sig = b4(buf, i);\n if (sig == 0x4034B50) {\n f = 1, is = i;\n this_1.d = null;\n this_1.c = 0;\n var bf = b2(buf, i + 6), cmp_1 = b2(buf, i + 8), u = bf & 2048, dd = bf & 8, fnl = b2(buf, i + 26), es = b2(buf, i + 28);\n if (l > i + 30 + fnl + es) {\n var chks_3 = [];\n this_1.k.unshift(chks_3);\n f = 2;\n var lsc = b4(buf, i + 18), lsu = b4(buf, i + 22);\n var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u);\n var _a = z64hs(buf, i, es, 2, lsc, lsu, 0), sc_1 = _a[0], su_1 = _a[1], z64 = _a[3];\n if (dd)\n sc_1 = -1 - z64;\n i += es;\n this_1.c = sc_1;\n var d_1;\n var file_1 = {\n name: fn_1,\n compression: cmp_1,\n start: function () {\n if (!file_1.ondata)\n err(5);\n if (!sc_1)\n file_1.ondata(null, et, true);\n else {\n var ctr = _this.o[cmp_1];\n if (!ctr)\n file_1.ondata(err(14, 'unknown compression type ' + cmp_1, 1), null, false);\n d_1 = sc_1 < 0 ? new ctr(fn_1) : new ctr(fn_1, sc_1, su_1);\n d_1.ondata = function (err, dat, final) { file_1.ondata(err, dat, final); };\n for (var _i = 0, chks_4 = chks_3; _i < chks_4.length; _i++) {\n var dat = chks_4[_i];\n d_1.push(dat, false);\n }\n if (_this.k[0] == chks_3 && _this.c)\n _this.d = d_1;\n else\n d_1.push(et, true);\n }\n },\n terminate: function () {\n if (d_1 && d_1.terminate)\n d_1.terminate();\n }\n };\n if (sc_1 >= 0)\n file_1.size = sc_1, file_1.originalSize = su_1;\n this_1.onfile(file_1);\n }\n return \"break\";\n }\n else if (oc) {\n if (sig == 0x8074B50) {\n is = i += 12 + (oc == -2 && 8), f = 3, this_1.c = 0;\n return \"break\";\n }\n else if (sig == 0x2014B50) {\n is = i -= 4, f = 3, this_1.c = 0;\n return \"break\";\n }\n }\n };\n var this_1 = this;\n for (; i < l - 4; ++i) {\n var state_1 = _loop_2();\n if (state_1 === \"break\")\n break;\n }\n this.p = et;\n if (oc < 0) {\n var dat = f ? buf.subarray(0, is - 12 - (oc == -2 && 8) - (b4(buf, is - 16) == 0x8074B50 && 4)) : buf.subarray(0, i);\n if (add)\n add.push(dat, !!f);\n else\n this.k[+(f == 2)].push(dat);\n }\n if (f & 2)\n return this.push(buf.subarray(i), final);\n this.p = buf.subarray(i);\n }\n if (final) {\n if (this.c)\n err(13);\n this.p = null;\n }\n };\n /**\n * Registers a decoder with the stream, allowing for files compressed with\n * the compression type provided to be expanded correctly\n * @param decoder The decoder constructor\n */\n Unzip.prototype.register = function (decoder) {\n this.o[decoder.compression] = decoder;\n };\n return Unzip;\n}());\nexport { Unzip };\nvar mt = typeof queueMicrotask == 'function' ? queueMicrotask : typeof setTimeout == 'function' ? setTimeout : function (fn) { fn(); };\nexport function unzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var files = {};\n var cbd = function (a, b) {\n mt(function () { cb(a, b); });\n };\n mt(function () { cbd = cb; });\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558) {\n cbd(err(13, 0, 1), null);\n return tAll;\n }\n }\n ;\n var lft = b2(data, e + 8);\n if (lft) {\n var c = lft;\n var o = b4(data, e + 16);\n var z = b4(data, e - 20) == 0x7064B50;\n if (z) {\n var ze = b4(data, e - 12);\n z = b4(data, ze) == 0x6064B50;\n if (z) {\n c = lft = b4(data, ze + 32);\n o = b4(data, ze + 48);\n }\n }\n var fltr = opts && opts.filter;\n var _loop_3 = function (i) {\n var _a = zh(data, o, z), c_1 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n }\n else {\n if (d)\n files[fn] = d;\n if (!--lft)\n cbd(null, files);\n }\n };\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_1\n })) {\n if (!c_1)\n cbl(null, slc(data, b, b + sc));\n else if (c_1 == 8) {\n var infl = data.subarray(b, b + sc);\n // Synchronously decompress under 512KB, or barely-compressed data\n if (su < 524288 || sc > 0.8 * su) {\n try {\n cbl(null, inflateSync(infl, { out: new u8(su) }));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(inflate(infl, { size: su }, cbl));\n }\n else\n cbl(err(14, 'unknown compression type ' + c_1, 1), null);\n }\n else\n cbl(null, null);\n };\n for (var i = 0; i < c; ++i) {\n _loop_3(i);\n }\n }\n else\n cbd(null, {});\n return tAll;\n}\n/**\n * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better\n * performance with more than one file.\n * @param data The raw compressed ZIP file\n * @param opts The ZIP extraction options\n * @returns The decompressed files\n */\nexport function unzipSync(data, opts) {\n var files = {};\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558)\n err(13);\n }\n ;\n var c = b2(data, e + 8);\n if (!c)\n return {};\n var o = b4(data, e + 16);\n var z = b4(data, e - 20) == 0x7064B50;\n if (z) {\n var ze = b4(data, e - 12);\n z = b4(data, ze) == 0x6064B50;\n if (z) {\n c = b4(data, ze + 32);\n o = b4(data, ze + 48);\n }\n }\n var fltr = opts && opts.filter;\n for (var i = 0; i < c; ++i) {\n var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_2\n })) {\n if (!c_2)\n files[fn] = slc(data, b, b + sc);\n else if (c_2 == 8)\n files[fn] = inflateSync(data.subarray(b, b + sc), { out: new u8(su) });\n else\n err(14, 'unknown compression type ' + c_2);\n }\n }\n return files;\n}\n","// This code is used to profile reading `.xlsx` files.\n// It shows how much time each stage executes for.\n// To enable the logs with the timing, set a global variable\n// called `READ_EXCEL_FILE_CHECKPOINTS` in Node.js or web browser.\n\n// This global variable is only exported to be added in the dependencies of a worker function.\n// See `worker-f` package for more info.\nexport var latestCheckpointTimestamp;\nexport default function checkpoint(name) {\n var now = Date.now();\n\n // See if the global flag for \"should output log\" is set to `true`.\n var shouldOutputLog = typeof global !== 'undefined' ? Boolean(global.READ_EXCEL_FILE_CHECKPOINTS) : typeof window !== 'undefined' ? Boolean(window.READ_EXCEL_FILE_CHECKPOINTS) : false;\n if (shouldOutputLog) {\n if (latestCheckpointTimestamp) {\n console.log(' -', now - latestCheckpointTimestamp, 'ms');\n }\n console.log('*', name);\n }\n latestCheckpointTimestamp = now;\n}\nexport function resetCheckpoint() {\n latestCheckpointTimestamp = undefined;\n}\n//# sourceMappingURL=checkpoint.js.map","// `fflate` uses \"synchronous\" decompressor on `.zip` files that're under `512KB`\n// (or when the compression level is too low), and an \"asynchronous\" (web worker)\n// decompressor otherwise, as it can be seen from the source code of the `unzip()` function.\n// This is because using web workers comes with an overhead of\n// both creating a new worker and sending data back and forth.\n//\nimport { unzip } from 'fflate';\n\n/**\r\n * Reads `*.zip` file contents. Ignores anything besides `.xml` or `.xml.rels` files.\r\n * @param {ArrayBuffer} input\r\n * @return {Promise<Record<string,Uint8Array>>} Resolves to an object holding `*.zip` file entries.\r\n */\nexport default function unzipFromArrayBuffer(input, options) {\n return unzipFromArrayBufferUsingFunction(input, options, unzipAsync, true);\n}\n\n/**\r\n * Reads `*.zip` file contents. Ignores anything besides `.xml` or `.xml.rels` files.\r\n * @param {ArrayBuffer} input\r\n * @param {(ArrayBuffer) => Record<string, Uint8Array> | Promise<Record<string, Uint8Array>>} unzip\r\n * @param {boolean} isAsync — Should be `true` when `unzip()` returns a `Promise`, `false` otherwise.\r\n * @return {Promise<Record<string,Uint8Array>>|Record<string,Uint8Array>} Resolves to an object holding `*.zip` file entries.\r\n */\nexport function unzipFromArrayBufferUsingFunction(input) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n _filter = _ref.filter;\n var unzip = arguments.length > 2 ? arguments[2] : undefined;\n var isAsync = arguments.length > 3 ? arguments[3] : undefined;\n // Read the `.zip` archive.\n // `result` is either `object` or `Promise<object>`\n return unzip(new Uint8Array(input), {\n // Ignore certain types of files.\n filter: function filter(file) {\n if (_filter) {\n return _filter({\n path: file.name\n });\n }\n return true;\n }\n });\n}\nfunction unzipAsync(archive) {\n return new Promise(function (resolve, reject) {\n // `unzip()` will resort to \"synchronous\" decompression in two edge cases:\n // * When the archive size is less than `512KB`.\n // * When the data is barely compressed, i.e. the compression ratio is less than 20% reduction in size.\n unzip(archive, function (error, files) {\n if (error) {\n reject(error);\n } else {\n resolve(files);\n }\n });\n });\n}\n//# sourceMappingURL=unzipFromArrayBuffer.js.map","import { strFromU8 } from 'fflate';\nimport checkpoint from '../utility/checkpoint.js';\n\n/**\r\n * @param {Record<string,Uint8Array} entries\r\n * @returns {Record<string,string>}\r\n */\nexport default function convertValuesFromUint8ArraysToStrings(entries) {\n checkpoint('convert files to strings');\n var convertedEntries = {};\n for (var _i = 0, _Object$keys = Object.keys(entries); _i < _Object$keys.length; _i++) {\n var key = _Object$keys[_i];\n convertedEntries[key] = strFromU8(entries[key]);\n }\n return convertedEntries;\n}\n//# sourceMappingURL=convertValuesFromUint8ArraysToStrings.js.map","// An `.xlsx` `.zip` archive could contain all kinds of files,\n// such as `.bin` printer settings or `.png` images, etc.\n//\n// Because `read-excel-file` doesn't support returning any of those types of data,\n// there's no need to read those files from the `.xlsx` `.zip` archive,\n// optimizing the unpacking process a little bit.\n//\nexport default function filterZipArchiveEntry(_ref) {\n var path = _ref.path;\n return path.endsWith('.xml') || path.endsWith('.xml.rels');\n}\n//# sourceMappingURL=filterZipArchiveEntry.js.map","// Here it uses the \"async\" version of the unzipper function\n// just because it unzips the files inside an archive in parallel\n// rather than sequentially. It uses web workers for that.\n// Smaller files are still handled synchronously under the hood.\n//\n// It did condict a couple of basic manual tests in a web browser\n// and the results showed that a `1 MB` `.xlsx` file is read in `100 ms`\n// both using \"sync\" and \"async\" versions of the unzipper function,\n// and reading a `200 KB` `.xlsx` file is done in `70 ms` when using\n// the \"sync\" version and in `80 ms\" when using the \"async\" verison.\n//\n// So the \"sync\" version of the unzipper function is faster on smaller file sizes\n// of about < 1 MB. Still, the rest of the parsing code smoothes out this difference,\n// and the end result is not much different. Does the difference of `10 ms` justify\n// the mental overhead of choosing the right variant for a file of a given size?\n// I'd say \"not really\". Sure, performance fans wouldn't scuff on those `10 ms`\n// but it's literally \"a blink of an eye\" and about a duration of a single frame\n// on a 120 FPS screen.\n//\n// Hence, it simply uses the \"async\" variant of the unzipper function in any case.\n//\n// import unzipFromArrayBufferSync from '../zip/unzipFromArrayBufferSync.js'\nimport unzipFromArrayBuffer from '../zip/unzipFromArrayBuffer.js';\nimport convertValuesFromUint8ArraysToStrings from './convertValuesFromUint8ArraysToStrings.js';\nimport filterZipArchiveEntry from './filterZipArchiveEntry.js';\nimport checkpoint, { resetCheckpoint } from '../utility/checkpoint.js';\n\n/**\r\n * Unpacks `*.xlsx` file contents.\r\n * An `.xlsx` file is really just a `.zip` archive with `.xml` files inside.\r\n * @param {(File|Blob|ArrayBuffer)} input\r\n * @return {Promise<Record<string,string>} Resolves to an object holding `*.xlsx` file entries.\r\n */\nexport default function unpackXlsxFile(input) {\n resetCheckpoint();\n checkpoint('unpack files');\n if (input instanceof File || input instanceof Blob) {\n return input.arrayBuffer().then(getResultFromArrayBuffer);\n }\n return Promise.resolve(input).then(getResultFromArrayBuffer);\n}\nfunction getResultFromArrayBuffer(arrayBuffer) {\n return unzipFromArrayBuffer(arrayBuffer, {\n filter: filterZipArchiveEntry\n }).then(convertValuesFromUint8ArraysToStrings);\n}\n\n// function getResultFromArrayBuffer(arrayBuffer) {\n// \tconst result = unzipFromArrayBufferSync(arrayBuffer, { filter: filterZipArchiveEntry })\n// \treturn Promise.resolve(convertValuesFromUint8ArraysToStrings(result))\n// }\n//# sourceMappingURL=unpackXlsxFileBrowser.js.map","/**\r\n * Parses spreadsheet info.\r\n * @param {string} content\r\n * @param {function} parseXmlStream — SAX XML parser.\r\n * @returns {object} An object of shape `{ epoch1904: boolean, sheets: Sheet[] }`.\r\n */\nexport default function parseSpreadsheetInfo(content, parseXmlStream) {\n return parseXmlStream(content, {\n createInitialState: createInitialStateInWorkbookXml,\n onOpenTag: onOpenTagInWorkbookXml\n }).then(function (state) {\n return {\n epoch1904: state.workbookPr ? state.workbookPr.epoch1904 : false,\n sheets: state.sheets\n };\n });\n}\nfunction createInitialStateInWorkbookXml() {\n return {\n workbookPr: undefined,\n sheets: []\n };\n}\nfunction onOpenTagInWorkbookXml(tagName, attributes, state) {\n if (tagName === 'workbookPr') {\n // The official Open XML specification dictates that the top-level `<workbook/>` element\n // should only contain exactly one `<workbookPr/>` element. In case of multiple ones,\n // only the first one is being read and the rest are simply ignored.\n //\n // There's a `1904-based-dates.xlsx` test case that happens to include multiple `<workbookPr/>`\n // elements by accident, most likely because I edited its `.xml` files by hand and didn't notice\n // the already-existing `<workbookPr/>` tag.\n //\n // At first I thought about just fixing that one `.xlsx` test file but later\n // I saw that another library called `SheetJS` specifically handles such cases\n // by only reading the first `<workbookPr/>` element and ignoring the rest,\n // so I though that perhaps it would make some sense to do same thing here.\n // https://github.com/SheetJS/sheetjs/issues/1619\n //\n if (!state.workbookPr) {\n // Read `<workbookPr/>` element attributes to detect whether dates are 1900-based or 1904-based.\n // https://support.microsoft.com/en-gb/help/214330/differences-between-the-1900-and-the-1904-date-system-in-excel\n // http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/workbookPr.html\n state.workbookPr = {\n epoch1904: attributes.date1904 === '1'\n };\n }\n } else if (tagName === 'sheet') {\n // Example of `<sheets/>` element:\n // ```\n // <sheets>\n // <sheet\n // xmlns:ns=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"\n // name=\"Sheet1\"\n // sheetId=\"1\"\n // ns:id=\"rId3\"/>\n // </sheets>\n // ```\n if (attributes.name) {\n state.sheets.push({\n // `sheetId` attribute value is an arbitrary, `1`-based unique positive integer\n // assigned to a worksheet, typically starting at `1` for the first sheet.\n // Deleting and adding new sheets might cause the sheetId values to become non-sequential.\n // For example, `sheetId`s could be `1`, `2`, `4`, if sheet `3` was deleted.\n id: Number(attributes.sheetId),\n name: attributes.name,\n relationId: attributes['r:id']\n });\n }\n }\n}\n//# sourceMappingURL=parseSpreadsheetInfo.js.map","/**\r\n * Returns sheet file paths.\r\n * Seems that the correct place to look for the `sheetId` -> `filename` mapping\r\n * is `xl/_rels/workbook.xml.rels` file.\r\n * https://github.com/tidyverse/readxl/issues/104\r\n * @param {string} content — `xl/_rels/workbook.xml.rels` file contents.\r\n * @param {function} parseXmlStream — SAX XML parser.\r\n * @return {object} — An object of shape `{ sheets: Record<string, string>, sharedStrings: string?, styles: string? }`\r\n */\nexport default function parseFilePaths(content, parseXmlStream) {\n // Example:\n // <Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\n // ...\n // <Relationship\n // Id=\"rId3\"\n // Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\"\n // Target=\"worksheets/sheet1.xml\"/>\n // </Relationships>\n return parseXmlStream(content, {\n createInitialState: createInitialStateInWorkbookRelationships,\n onOpenTag: onOpenTagInWorkbookRelationships\n }).then(function (state) {\n return state;\n });\n}\nfunction createInitialStateInWorkbookRelationships() {\n return {\n sheets: {},\n sharedStrings: undefined,\n styles: undefined\n };\n}\nfunction onOpenTagInWorkbookRelationships(tagName, attributes, state) {\n if (tagName === 'Relationship') {\n addFilePathForRelation(state, attributes.Id, attributes.Type, attributes.Target);\n }\n}\nfunction addFilePathForRelation(state, id, type, target) {\n switch (type) {\n case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles':\n state.styles = getFilePathFromRelationTarget(target);\n break;\n case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings':\n state.sharedStrings = getFilePathFromRelationTarget(target);\n break;\n case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet':\n state.sheets[id] = getFilePathFromRelationTarget(target);\n break;\n }\n}\nfunction getFilePathFromRelationTarget(path) {\n // Normally, `path` is a relative path inside the ZIP archive,\n // like \"worksheets/sheet1.xml\", or \"sharedStrings.xml\", or \"styles.xml\".\n // There has been one weird case when file path was an absolute path,\n // like \"/xl/worksheets/sheet1.xml\" (specifically for sheets):\n // https://github.com/catamphetamine/read-excel-file/pull/95\n // Other libraries (like `xlsx`) and software (like Google Docs)\n // seem to support such absolute file paths, so this library does too.\n if (path[0] === '/') {\n return path.slice('/'.length);\n }\n // // Seems like a path could also be a URL.\n // // http://officeopenxml.com/anatomyofOOXML-xlsx.php\n // if (/^[a-z]+\\:\\/\\//.test(path)) {\n // return path\n // }\n return 'xl/' + path;\n}\n//# sourceMappingURL=parseFilePaths.js.map","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nvar _excluded = [\"xfId\"];\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n/**\r\n * Parses `.xlsx` file styles.\r\n * http://officeopenxml.com/SSstyles.php\r\n * Returns an array of cell styles.\r\n * A cell style index is the cell style ID.\r\n * @param {string} content\r\n * @param {function} parseXmlStream — SAX XML parser.\r\n * @returns {object} styles\r\n */\nexport default function parseStyles(content, parseXmlStream) {\n // https://social.msdn.microsoft.com/Forums/sqlserver/en-US/708978af-b598-45c4-a598-d3518a5a09f0/howwhen-is-cellstylexfs-vs-cellxfs-applied-to-a-cell?forum=os_binaryfile\n // https://www.office-forums.com/threads/cellxfs-cellstylexfs.2163519/\n return parseXmlStream(content, {\n createInitialState: createInitialStateInStyles,\n onOpenTag: onOpenTagInStyles,\n onCloseTag: onCloseTagInStyles\n }).then(function (state) {\n return state.styles.map(function (style) {\n if (style.xfId) {\n var xfId = style.xfId,\n styleProperties = _objectWithoutProperties(style, _excluded);\n return _objectSpread(_objectSpread({}, state.baseStyles[xfId]), styleProperties);\n } else {\n return style;\n }\n });\n });\n}\nfunction createInitialStateInStyles() {\n return {\n numberFormats: {},\n baseStyles: [],\n // The first `164` elements of the `styles` array are going to be `undefined`\n // because those represent the built-in \"default\" styles in `.xlsx` specification.\n // These \"default\" styles have IDs from `0` to `163`, i.e. according to their index.\n styles: [],\n cellStyleXfs: false,\n cellXfs: false\n };\n}\nfunction onOpenTagInStyles(tagName, attributes, state) {\n if (tagName === 'numFmt') {\n // `<numFmts/>` element contains `<numFmt/>` elements.\n // `<numFmt/>` defines a \"number format\" template.\n // The value of `numFmtId` attribute is a (numeric) ID of this \"number format\".\n state.numberFormats[attributes.numFmtId] = {\n id: Number(attributes.numFmtId),\n template: attributes.formatCode\n };\n } else if (tagName === 'cellStyleXfs') {\n // `<cellStyleXfs/>` contains \"base styles\" that could be extended by `<cellXfs/>`.\n // These styles don't apply to individual cells directly. They can only be extended.\n state.cellStyleXfs = true;\n } else if (tagName === 'cellXfs') {\n // `<cellXfs/>` contains individual cell styles. They can extend \"base styles\".\n state.cellXfs = true;\n } else if (tagName === 'xf') {\n if (state.cellStyleXfs) {\n // The index of a `<xf/>` element is by definition its numeric ID.\n // Therefore, even empty `style` elements still must be put into the array.\n state.baseStyles.push(parseCellStyle(attributes));\n } else if (state.cellXfs) {\n var style = parseCellStyle(attributes, state.numberFormats);\n // A style might extend a \"base style\" by its numeric ID.\n if (attributes.xfId) {\n style.xfId = Number(attributes.xfId);\n }\n // The index of a `<xf/>` element is by definition its numeric ID.\n // Therefore, even empty `style` elements still must be put into the array.\n state.styles.push(style);\n }\n }\n}\nfunction onCloseTagInStyles(tagName, state) {\n if (tagName === 'cellStyleXfs') {\n state.cellStyleXfs = false;\n } else if (tagName === 'cellXfs') {\n state.cellXfs = false;\n }\n}\nfunction parseCellStyle(attributes, numberFormats) {\n var style = {};\n // `numFmtId` in `<cellStyleXfs/>` and `<cellXfs/>` is a numerical ID\n // referencing the cell's \"number format\". Values from `0` to `163` are built-in formats,\n // while values `164` and above are custom formats defined in the `<numFmts/>` element.\n var numFmtId = attributes.numFmtId;\n if (numFmtId) {\n // Built-in number formats don't have a `<numFmt/>` element in `styles.xml`.\n // https://hexdocs.pm/xlsxir/number_styles.html\n if (numberFormats && numberFormats[numFmtId]) {\n // Non-built-in number format.\n style.numberFormat = numberFormats[numFmtId];\n } else {\n // Built-in number format.\n style.numberFormat = {\n id: Number(numFmtId)\n };\n }\n }\n return style;\n}\n//# sourceMappingURL=parseStyles.js.map","import { onOpenTagInSharedString, onCloseTagInSharedString, onTextInSharedString, createInitialStateInSharedString } from './parseSharedString.js';\n\n/**\r\n * Parses `sharedStrings.xml` file.\r\n * @param {string} content\r\n * @param {function} parseXmlStream — SAX XML parser.\r\n * @returns {Promise<string[]>}\r\n */\nexport default function parseSharedStrings(content, parseXmlStream) {\n return parseXmlStream(content, {\n createInitialState: createInitialStateInSharedStrings,\n onOpenTag: onOpenTagInSharedStrings,\n onCloseTag: onCloseTagInSharedStrings,\n onText: onTextInSharedStrings\n }).then(function (state) {\n return state.strings;\n });\n}\nfunction createInitialStateInSharedStrings() {\n return {\n si: undefined,\n strings: []\n };\n}\n\n// In an XLSX `sharedStrings.xml` file, a <si/> (string item) element can have\n// either a single child <t/> element (meaning that \"rich formatting\" is not used)\n// or multiple child <r/> elements (meaning that \"rich formatting\" is used).\nfunction onOpenTagInSharedStrings(tagName, attributes, state) {\n if (tagName === 'si') {\n state.si = createInitialStateInSharedString();\n } else if (state.si) {\n onOpenTagInSharedString(tagName, attributes, state.si);\n }\n}\nfunction onCloseTagInSharedStrings(tagName, state) {\n if (tagName === 'si') {\n state.strings.push(state.si.string);\n state.si = undefined;\n } else if (state.si) {\n onCloseTagInSharedString(tagName, state.si);\n }\n}\nfunction onTextInSharedStrings(text, state) {\n if (state.si) {\n onTextInSharedString(text, state.si);\n }\n}\n//# sourceMappingURL=parseSharedStrings.js.map","export function createInitialStateInSharedString() {\n return {\n t: false,\n r: false,\n rPh: false,\n string: ''\n };\n}\n\n// In an XLSX `sharedStrings.xml` file, a <si/> (string item) element can have\n// either a single child <t/> element (meaning that \"rich formatting\" is not used)\n// or multiple child <r/> elements (meaning that \"rich formatting\" is used).\nexport function onOpenTagInSharedString(tagName, attributes, state) {\n // The possible children of <si> are:\n // * <t>: Represents a simple text string. For plain text, this is the only child.\n // * <r>: Represents a rich text run. When a cell contains text where only some words are bolded, colored, or styled differently, multiple <r> elements are used to break the text into formatted segments.\n // * <rPh> (Phonetic Run): Used primarily for East Asian languages to provide phonetic reading/pronunciation data (e.g., furigana in Japanese). It associates a phonetic pronunciation run right alongside the base string text tag <t>.\n // * <phoneticPr>: Defines the phonetic properties used for East Asian languages, specifically mapping how strings should be read for sorting and pronunciation.\n if (tagName === 't') {\n state.t = true;\n } else if (tagName === 'r') {\n // The possible children of <r/> are:\n // * <rPr> (Run Properties): The formatting properties for the text (font, size, color, bold, italic, etc.).\n // * <t> (Text): The actual text payload.\n // * <rPh> (Phonetic Run): Phonetic pronunciation guidance (used for East Asian languages like Japanese). It associates a phonetic pronunciation run right alongside the base string text tag <t>.\n state.r = true;\n } else if (tagName === 'rPh') {\n // The possible children of <rPh/> are:\n // * <t> (Text): Contains the actual phonetic text or reading (usually in Katakana for Japanese) that corresponds to the associated character string.\n state.rPh = true;\n }\n}\nexport function onCloseTagInSharedString(tagName, state) {\n if (tagName === 't') {\n state.t = false;\n } else if (tagName === 'r') {\n state.r = false;\n } else if (tagName === 'rPh') {\n state.rPh = false;\n }\n}\nexport function onTextInSharedString(text, state) {\n if (state.rPh) {\n // Ignore anything inside `<rPh/>` tags\n } else if (state.t) {\n if (state.r) {\n // An `<r/>` element could contain multiple `<t/>` elements,\n // the text content from all of which should be concatenated.\n state.string += text;\n } else {\n state.string = text;\n }\n }\n}\n//# sourceMappingURL=parseSharedString.js.map","// Parses an Excel Date (represented by a \"serial\" floating-point number)\n// into a javascript `Date` in UTC+0 timezone (with time is set to 00:00).\n//\n// https://www.pcworld.com/article/3063622/software/mastering-excel-date-time-serial-numbers-networkdays-datevalue-and-more.html\n// \"If you need to calculate dates in your spreadsheets,\n// Excel uses its own unique system, which it calls Serial Numbers\".\n//\nexport default function parseExcelDate(excelSerialDate, options) {\n // Windows operating system uses floating-point numbers to represent dates,\n // where the number represents the count of days elapsed since January 0th, 1900.\n //\n // This also means that there're 2 aspects associated with this choice:\n //\n // * January 1st, 1900, 00:00 is represented by `1` rather than `0`, which looks a bit weird.\n // * 1900 is a special year because it's a \"one in a 100 years\" occasion when it's not a leap year.\n //\n // To work around those two aspects, Mac OS chose another baseline — January 1st, 1900.\n // Although, that only postponed the second issue because 2100 is going to be the next \"speciaL\" year\n // which is not going to be a \"leap\" one.\n //\n // Older versions of Excel on Mac OS used year 1904 as the default baseline for numeric dates.\n // Since 2011, Microsoft Excel on Mac OS uses year 1900 as the default baseline for cross-platform consistency.\n // https://support.microsoft.com/en-us/office/date-systems-in-excel-e7fe7167-48a9-4b96-bb53-5612a800b487\n //\n // So the 1904 baseline is now deprecated, although still available to be configured manually.\n // So it still might be encountered in Excel files created on MacOS.\n // In that case, the Excel file contains a special flag — `<workbook><workbookPr date1904=\"1\"/>...` —\n // that tells the application which baseline is being used for numeric date timestamps.\n //\n if (options && options.epoch1904) {\n // Convert the numeric date timestamp from 1904 baseline to 1900 baseline.\n excelSerialDate += (1904 - 1900) * DAYS_IN_YEAR + JANUARY_0TH_1900_DAY + ERRONEOUS_FEBRUARY_29_1990_DAY;\n }\n var daysBeforeUnixEpoch = JANUARY_0TH_1900_DAY + ERRONEOUS_FEBRUARY_29_1990_DAY + (1970 - 1900) * DAYS_IN_YEAR + NUMBER_OF_LEAP_YEARS_BETWEEN_1900_AND_1970;\n return new Date(Math.floor((excelSerialDate - daysBeforeUnixEpoch) * DAY));\n}\n\n// \"Excel serial date\" is just a (fractional) count of days passed since `00/01/1900`.\n//\n// In contrast, \"Unix timestamps\" use `01/01/1970` as the baseline for numeric dates.\n//\n// In order to convert one into another, it should calculate the count of days elapsed\n// since `00/01/1900` (Excel epoch) till `01/01/1970` (Unix epoch), or the count of days\n// between year `1900` and year `1970`, plus one day.\n//\n// It also should account for the number of \"leap years\" between year `1900` and year `1970`,\n// which is 17 of them. https://kalender-365.de/leap-years.php\n//\n// \"One year has the length of 365 days, 5 hours, 48 minutes and 45 seconds.\n// These are 365.2421875 days. This is hard to calculate with, so for practical reasons\n// a normal year has been given 365 days and a leap year 366 days. In leap years,\n// February 29th is added as leap day, which doesn't exist in a normal year.\n// A leap year is every 4 years, but not every 100 years, then again every 400 years.\n// So the year 1900 wasn't a leap year, but 2000 was\".\n//\n// And also, Excel has a historical bug when it incorrectly assumes year `1900` to be a leap year,\n// and, as a result, all Excel serial dates starting from March 1st, 1900 lag 1 day behind\n// and require an additional 1 day to be added to them in order to be converted to a proper timestamp.\n//\n// https://learn.microsoft.com/en-us/answers/questions/5249322/why-does-microsoft-excel-considers-29-02-1900-to-b?forum=msoffice-all&referrer=answers#:~:text=This%20made%20it%20easier%20for,other%20programs%20that%20use%20dates.\n//\n// \"When Lotus 1-2-3 was first released, the program assumed that the year 1900 was a leap year,\n// even though it actually was not a leap year. This made it easier for the program to handle\n// leap years and caused no harm to almost all date calculations in Lotus 1-2-3.\n//\n// When Microsoft Multiplan and Microsoft Excel were released, they also assumed that 1900\n// was a leap year. This assumption allowed Microsoft Multiplan and Microsoft Excel to use\n// the same serial date system used by Lotus 1-2-3 and provide greater compatibility with Lotus 1-2-3.\n// Treating 1900 as a leap year also made it easier for users to move worksheets from one program\n// to the other\".\n//\n// So the historical bug is basically that Excel thinks that February 29th, 1900 existed\n// while in reality it didn't. That's why it's actually 1 day off for any date after that one.\n//\nvar NUMBER_OF_LEAP_YEARS_BETWEEN_1900_AND_1970 = 17;\nvar JANUARY_0TH_1900_DAY = 1;\nvar ERRONEOUS_FEBRUARY_29_1990_DAY = 1;\n\n// An approximate count of seconds in a day is:\n// 24 hours * 60 minutes in an hour * 60 seconds in a minute\n//\n// It is approximate because a minute could be longer than 60 seconds, due to \"leap seconds\".\n//\n// Still, javascript `Date`, and UNIX time in general, intentionally\n// drop the concept of \"leap seconds\" in order to make things simpler.\n// So this approximation is valid and doesn't result in any bugs.\n// https://stackoverflow.com/questions/53019726/where-are-the-leap-seconds-in-javascript\n//\n// \"The JavaScript Date object specifically adheres to the concept of Unix Time\n// (albeit with higher precision). This is part of the POSIX specification,\n// and thus is sometimes called \"POSIX Time\". It does not count leap seconds,\n// but rather assumes every day had exactly 86,400 seconds. You can read about\n// this in section 20.3.1.1 of the current ECMAScript specification, which states:\n//\n// \"Time is measured in ECMAScript in milliseconds since 01 January, 1970 UTC.\n// In time values leap seconds are ignored. It is assumed that there are exactly\n// 86,400,000 milliseconds per day.\"\n//\n// The reason is that the unpredictable nature of leap seconds makes them very\n// difficult to work with in APIs. One can't generally pass timestamps around\n// that need leap seconds tables to be interpreted correctly, and expect that\n// one system will interpret them the same as another. For example, a timestamp\n// `1483228826` that accounts for \"leap seconds\" should've been interpreted as\n// \"2017-01-01T00:00:00Z\", but if the receiver doesn't account for \"leap seconds\",\n// they would interpret it as \"2017-01-01T00:00:26Z\" (e.g. POSIX-based systems like Linux),\n// So \"leap seconds\" aren't really portable.\n// Even on systems that have full frequently-updated \"leap second\" tables,\n// there's no telling what adjustments those tables will contain in the future\n// (i.e. beyond the 6-month IERS announcement period) because \"leap seconds\" can't be\n// determined by a fixed mathematical formula or something like that. Instead,\n// scientists introduce them as needed based on the observed Earth's rotation around the sun.\n//\n// \"Because the Earth's rotational speed varies in response to climatic and geological events,\n// UTC leap seconds are irregularly spaced and not precisely predictable. The decision to insert\n// a leap second is made by the International Earth Rotation and Reference Systems Service (IERS),\n// typically about six months in advance, to ensure that the difference between UTC and UT1\n// does not exceed ±0.9 seconds.\"\n//\n// One example is year `1900` which is \"every fourth year\" but it still is not a \"leap year\".\n//\n// To reiterate: to support leap seconds in a programming language, the implementation\n// must go out of its way to do so, and must make tradeoffs that are not always acceptable.\n// Though there are exceptions, the general position is to not support them - not because\n// of any subversion or active countermeasures, but because supporting them properly is much,\n// much harder.\n//\n// https://en.wikipedia.org/wiki/Unix_time#Leap_seconds\n// https://en.wikipedia.org/wiki/Leap_year\n// https://en.wikipedia.org/wiki/Leap_second\n//\nvar DAY = 24 * 60 * 60 * 1000;\nvar DAYS_IN_YEAR = 365;\n//# sourceMappingURL=parseExcelDate.js.map","// Parses a number from string.\n// Throws an error if the number couldn't be parsed.\n// When parsing floating-point number, is affected by\n// the javascript number encoding precision issues:\n// https://www.youtube.com/watch?v=2gIxbTn7GSc\n// https://www.avioconsulting.com/blog/overcoming-javascript-numeric-precision-issues\nexport default function parseNumber(stringifiedNumber) {\n var parsedNumber = Number(stringifiedNumber);\n if (isNaN(parsedNumber)) {\n throw new Error(\"Couldn't parse number: \".concat(stringifiedNumber));\n }\n return parsedNumber;\n}\n//# sourceMappingURL=parseNumber.js.map","function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\n// On some date formats, there's a \"[$-...]\" prefix that locks the locale\n// to be a specific one when formatting a date using this format.\n//\n// https://stackoverflow.com/questions/4730152/what-indicates-an-office-open-xml-cell-contains-a-date-time-value\n//\n// Format examples:\n//\n// * \"[$-404]e/m/d\"\n// * \"[$-414]mmmm\\ yyyy;@\"\n// * \"[$-ru-RU]dd.mm.yyyy;@\"\n// * \"[$-x-sysdate]dddd, mmmm dd, yyyy\"\n//\nvar DATE_FORMAT_SPECIFIC_LOCALE_PREFIX = /^\\[\\$-[^\\]]+\\]/;\n\n// On some date formats, there's a \";@\" suffix.\n// It instructs the spreadsheet editor application to display any non-numeric\n// value as is instead of hiding it or something like that.\n//\n// For example, if one inputs \"Some text\" instead of a date in such cell,\n// it will still show \"Some text\" instead of an empty cell, even though\n// the value is strictly-speaking invalid.\n//\n// Specifically, \";\" means \"anything before this applies only to a numeric value,\n// while anything after it applies to a text value\". And a follow-up \"@\" means\n// \"for a text value, just output it as is\".\n//\n// It's not really clear why would anyone add such a feature to a format.\n// Perhaps it feels more \"user-friendly\" towards a non-\"tech-savvy\" user\n// of a spreadsheet editor application.\n//\n// Format examples:\n//\n// * \"m/d/yyyy;@\"\n// * \"[$-414]mmmm\\ yyyy;@\"\n//\nvar DATE_FORMAT_ALLOW_ANY_OTHER_TEXT_SUFFIX = /;@$/;\nvar CACHE = {};\nexport default function isDateFormatCached(template) {\n if (template in CACHE) {\n return CACHE[template];\n }\n var result = isDateFormat(template);\n CACHE[template] = result;\n return result;\n}\nfunction isDateFormat(template) {\n // Date format tokens could be in upper case or in lower case.\n // There seems to be no single standard.\n // So the template is lowercased first.\n template = template.toLowerCase();\n\n // On some date formats, there's an \"[$-...]\" prefix.\n // It forces a specific locale to be used when formatting a date.\n template = template.replace(DATE_FORMAT_SPECIFIC_LOCALE_PREFIX, '');\n\n // On some date formats, there's an \";@\" suffix.\n // It's not clear why would anyone need it in a date format template.\n // Still, because it occurs there, it should be stripped.\n template = template.replace(DATE_FORMAT_ALLOW_ANY_OTHER_TEXT_SUFFIX, '');\n\n // Extract all alphabetic parts from what's left from the template string.\n // Example: \"mm/dd/yyyy\" → [\"mm\", \"dd\", \"yyyy\"]\n var tokens = template.split(/\\W+/);\n\n // If no alphabetic parts are present in what's left from the template string\n // then it could be any kind of template such as a generic numeric template\n // such as \"$#,##0.00\" currency template or \"0.0%\" percentage template.\n if (tokens.length < 0) {\n return false;\n }\n for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done;) {\n var token = _step.value;\n // If a non-date-format-specific alphabetic substring is found,\n // this might not necessarily be a date format.\n if (DATE_TEMPLATE_TOKENS.indexOf(token) < 0) {\n return false;\n }\n }\n return true;\n}\n\n// These tokens could be in upper case or in lower case.\n// There seems to be no single standard, so using lower case.\nvar DATE_TEMPLATE_TOKENS = [\n// Seconds (min two digits). Example: \"05\".\n'ss',\n// Minutes (min two digits). Example: \"05\". Could also be \"Months\". Weird.\n'mm',\n// Hours. Example: \"1\".\n'h',\n// Hours (min two digits). Example: \"01\".\n'hh',\n// \"AM\" part of \"AM/PM\". Lowercased just in case.\n'am',\n// \"PM\" part of \"AM/PM\". Lowercased just in case.\n'pm',\n// Day. Example: \"1\"\n'd',\n// Day (min two digits). Example: \"01\"\n'dd',\n// Month (numeric). Example: \"1\".\n'm',\n// Month (numeric, min two digits). Example: \"01\". Could also be \"Minutes\". Weird.\n'mm',\n// Month (shortened month name). Example: \"Jan\".\n'mmm',\n// Month (full month name). Example: \"January\".\n'mmmm',\n// Two-digit year. Example: \"20\".\n'yy',\n// Full year. Example: \"2020\".\n'yyyy',\n// I don't have any idea what \"e\" means.\n// It's used in \"built-in\" XLSX formats:\n// * 27 '[$-404]e/m/d';\n// * 36 '[$-404]e/m/d';\n// * 50 '[$-404]e/m/d';\n// * 57 '[$-404]e/m/d';\n'e'];\n//# sourceMappingURL=isDateFormat.js.map","// XLSX does have \"d\" type for dates, but it's not commonly used.\n// Instead, it prefers using \"n\" type for storing dates as timestamps.\n//\n// Whether a numeric value is a number or a date timestamp, it sometimes could be\n// detected by looking at the value \"format\" and seeing if it's a date-specific one.\n\nimport isDateFormat from './isDateFormat.js';\nexport default function isDateFormatStyle(styleId, styles, options) {\n if (styleId !== undefined) {\n var style = styles[styleId];\n if (!style) {\n throw new Error(\"Cell style not found: \".concat(styleId));\n }\n if (!style.numberFormat) {\n return false;\n }\n if (\n // Whether it's a \"number format\" that's conventionally used for storing date timestamps.\n BUILT_IN_DATE_FORMAT_IDS.indexOf(style.numberFormat.id) >= 0 ||\n // Whether it's a \"number format\" that uses a \"formatting template\"\n // that the developer is certain is a date formatting template.\n options.dateFormat && style.numberFormat.template === options.dateFormat ||\n // Whether the \"smart formatting template\" feature is not disabled\n // and it has detected that it's a date formatting template by looking at it.\n options.smartDateParser !== false && style.numberFormat.template && isDateFormat(style.numberFormat.template)) {\n return true;\n }\n }\n}\n\n// Built-in formats have ID < 164.\n// Some of those formats are intended to use when displaying dates.\n//\n// Depending on the \"locale\" used by the spreadsheet viewing application,\n// different built-in format IDs might correspond to different templates.\n// https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.numberingformat?view=openxml-2.8.1\n//\n// Here's a list of \"locale\"-independent built-in format IDs that're known to represent dates.\n//\nvar LOCALE_INDEPENDENT_BUILT_IN_DATE_FORMAT_IDS = [14,\n// mm-dd-yy\n15,\n// d-mmm-yy\n16,\n// d-mmm\n17,\n// mmm-yy\n18,\n// h:mm AM/PM\n19,\n// h:mm:ss AM/PM\n20,\n// h:mm\n21,\n// h:mm:ss\n22,\n// m/d/yy h:mm\n45,\n// mm:ss\n46,\n// [h]:mm:ss\n47 // mmss.0\n];\n\n// \"zh-tw\" OR \"zh-cn\" locales.\n// Language glyphs (aka \"hieroglyphs\") are not replaced with their respective unicode values here.\nvar MAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS = [27,\n// [$-404]e/m/d OR yyyy\"年\"m\"月\"\n28,\n// [$-404]e\"年\"m\"月\"d\"日\" OR m\"月\"d\"日\"\n29,\n// [$-404]e\"年\"m\"月\"d\"日\" OR m\"月\"d\"日\"\n30,\n// m/d/yy OR m-d-yy\n31,\n// yyyy\"年\"m\"月\"d\"日\" OR yyyy\"年\"m\"月\"d\"日\"\n32,\n// hh\"時\"mm\"分\" OR h\"时\"mm\"分\"\n33,\n// hh\"時\"mm\"分\"ss\"秒\" OR h\"时\"mm\"分\"ss\"秒\"\n34,\n// 上午/下午hh\"時\"mm\"分\" OR 上午/下午h\"时\"mm\"分\"\n35,\n// 上午/下午hh\"時\"mm\"分\"ss\"秒\" OR 上午/下午h\"时\"mm\"分\"ss\"秒\"\n36,\n// [$-404]e/m/d OR yyyy\"年\"m\"月\"\n50,\n// [$-404]e/m/d OR yyyy\"年\"m\"月\"\n51,\n// [$-404]e\"年\"m\"月\"d\"日\" OR m\"月\"d\"日\"\n52,\n// 上午/下午hh\"時\"mm\"分\" OR yyyy\"年\"m\"月\"\n53,\n// 上午/下午hh\"時\"mm\"分\"ss\"秒\" OR m\"月\"d\"日\"\n54,\n// [$-404]e\"年\"m\"月\"d\"日\" OR m\"月\"d\"日\"\n55,\n// 上午/下午hh\"時\"mm\"分\" OR 上午/下午h\"时\"mm\"分\"\n56,\n// 上午/下午hh\"時\"mm\"分\"ss\"秒\" OR 上午/下午h\"时\"mm\"分\"ss\"秒\"\n57,\n// [$-404]e/m/d OR yyyy\"年\"m\"月\"\n58 // [$-404]e\"年\"m\"月\"d\"日\" OR m\"月\"d\"日\"\n];\n\n// \"ja-jp\" OR \"ko-kr\" locales.\n// Language glyphs (aka \"hieroglyphs\") are not replaced with their respective unicode values here.\nvar JAPANESE_OR_KOREAN_LOCALE_BUILT_IN_DATE_FORMAT_IDS = [27,\n// [$-411]ge.m.d OR yyyy\"年\" mm\"月\" dd\"日\"\n28,\n// [$-411]ggge\"年\"m\"月\"d\"日\" OR mm-dd\n29,\n// [$-411]ggge\"年\"m\"月\"d\"日\" OR mm-dd\n30,\n// m/d/yy OR mm-dd-yy\n31,\n// yyyy\"年\"m\"月\"d\"日\" OR yyyy\"년\" mm\"월\" dd\"일\"\n32,\n// h\"時\"mm\"分\" OR h\"시\" mm\"분\"\n33,\n// h\"時\"mm\"分\"ss\"秒\" OR h\"시\" mm\"분\" ss\"초\"\n34,\n// yyyy\"年\"m\"月\" OR yyyy-mm-dd\n35,\n// m\"月\"d\"日\" OR yyyy-mm-dd\n36,\n// [$-411]ge.m.d OR yyyy\"年\" mm\"月\" dd\"日\"\n50,\n// [$-411]ge.m.d OR yyyy\"年\" mm\"月\" dd\"日\"\n51,\n// [$-411]ggge\"年\"m\"月\"d\"日\" OR mm-dd\n52,\n// yyyy\"年\"m\"月\" OR yyyy-mm-dd\n53,\n// m\"月\"d\"日\" OR yyyy-mm-dd\n54,\n// [$-411]ggge\"年\"m\"月\"d\"日\" OR mm-dd\n55,\n// yyyy\"年\"m\"月\" OR yyyy-mm-dd\n56,\n// m\"月\"d\"日\" OR yyyy-mm-dd\n57,\n// [$-411]ge.m.d OR yyyy\"年\" mm\"月\" dd\"日\"\n58 // [$-411]ggge\"年\"m\"月\"d\"日\" OR mm-dd\n];\n\n// \"th-th\" locale.\n// Language glyphs (aka \"hieroglyphs\") are not replaced with their respective unicode values here.\nvar THAI_LOCALE_BUILT_IN_DATE_FORMAT_IDS = [71,\n// ว/ด/ปปปป\n72,\n// ว-ดดด-ปป\n73,\n// ว-ดดด\n74,\n// ดดด-ปป\n75,\n// ช:นน\n76,\n// ช:นน:ทท\n77,\n// ว/ด/ปปปป ช:นน\n78,\n// นน:ทท\n79,\n// [ช]:นน:ทท\n80,\n// นน:ทท.0\n81 // d/m/bb\n];\n\n// Start with language-agnostic date format IDs.\nvar BUILT_IN_DATE_FORMAT_IDS = LOCALE_INDEPENDENT_BUILT_IN_DATE_FORMAT_IDS.concat(\n// Add Mainland Chinese or Taiwanese date format IDs that haven't already been added.\nMAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS).concat(\n// Add Japanese or Korean date format IDs that haven't already been added.\nJAPANESE_OR_KOREAN_LOCALE_BUILT_IN_DATE_FORMAT_IDS.filter(function (numberFormatId) {\n return MAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS.indexOf(numberFormatId) < 0;\n})).concat(\n// Add Thai date format IDs that haven't already been added.\nTHAI_LOCALE_BUILT_IN_DATE_FORMAT_IDS.filter(function (numberFormatId) {\n return MAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS.indexOf(numberFormatId) < 0;\n}).filter(function (numberFormatId) {\n return JAPANESE_OR_KOREAN_LOCALE_BUILT_IN_DATE_FORMAT_IDS.indexOf(numberFormatId) < 0;\n}));\n//# sourceMappingURL=isDateFormatStyle.js.map","import parseExcelDate from './parseExcelDate.js';\nimport parseNumber from './parseNumber.js';\nimport isDateFormatStyle from './isDateFormatStyle.js';\n\n// Parses a string `value` of a cell.\nexport default function parseCellValue(value, type, _ref) {\n var inlineString = _ref.inlineString,\n styleId = _ref.styleId,\n styles = _ref.styles,\n sharedStrings = _ref.sharedStrings,\n epoch1904 = _ref.epoch1904,\n options = _ref.options;\n if (!type) {\n // Default cell type is \"n\" (numeric).\n // http://www.datypic.com/sc/ooxml/t-ssml_CT_Cell.html\n type = 'n';\n }\n\n // Available Excel cell types:\n // https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md\n //\n // Some other document (seems to be old):\n // http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/ST_CellType.html\n //\n switch (type) {\n // XLSX tends to store all strings as \"shared\" (indexed) ones\n // using \"s\" cell type (for saving on strage space).\n // \"str\" cell type is then generally only used for storing\n // formula-pre-calculated cell values.\n case 'str':\n value = parseString(value, options);\n break;\n\n // Sometimes, XLSX stores strings as \"inline\" strings rather than \"shared\" (indexed) ones.\n // Perhaps the specification doesn't force it to use one or another.\n // Example: `<sheetData><row r=\"1\"><c r=\"A1\" s=\"1\" t=\"inlineStr\"><is><t>Test 123</t></is></c></row></sheetData>`.\n case 'inlineStr':\n value = inlineString;\n if (value === undefined) {\n throw new Error('Couldn\\'t read \"inline string\" cell value');\n }\n value = parseString(value, options);\n break;\n\n // XLSX tends to store string values as \"shared\" (indexed) ones.\n // \"Shared\" strings is a way for an Excel editor to reduce\n // the file size by storing \"commonly used\" strings in a dictionary\n // and then referring to such strings by their index in that dictionary.\n // Example: `<sheetData><row r=\"1\"><c r=\"A1\" s=\"1\" t=\"s\"><v>0</v></c></row></sheetData>`.\n case 's':\n // If a cell has no value then there's no `<c/>` element for it.\n // If a `<c/>` element exists then it's not empty.\n // The `<v/>`alue is a key in the \"shared strings\" dictionary of the\n // XLSX file, so look it up in the `sharedStrings` dictionary by the numeric key.\n var sharedStringIndex = Number(value);\n if (isNaN(sharedStringIndex)) {\n throw new Error(\"Invalid \\\"shared\\\" string index: \".concat(value));\n }\n if (sharedStringIndex >= sharedStrings.length) {\n throw new Error(\"An out-of-bounds \\\"shared\\\" string index: \".concat(value));\n }\n value = sharedStrings[sharedStringIndex];\n value = parseString(value, options);\n break;\n\n // Boolean (TRUE/FALSE) values are stored as either \"1\" or \"0\"\n // in cells of type \"b\".\n case 'b':\n if (value === '1') {\n value = true;\n } else if (value === '0') {\n value = false;\n } else {\n throw new Error(\"Unsupported \\\"boolean\\\" cell value: \".concat(value));\n }\n break;\n\n // XLSX specification seems to support cells of type \"z\":\n // blank \"stub\" cells that should be ignored by data processing utilities.\n case 'z':\n value = undefined;\n break;\n\n // XLSX specification also defines cells of type \"e\" containing a numeric \"error\" code.\n // It's not clear what that means though.\n // They also wrote: \"and `w` property stores its common name\".\n // It's unclear what they meant by that.\n case 'e':\n value = decodeError(value);\n break;\n\n // XLSX supports date cells of type \"d\", though seems like it (almost?) never\n // uses it for storing dates, preferring \"n\" numeric timestamp cells instead.\n // The value of a \"d\" cell is supposedly a string in \"ISO 8601\" format.\n // I haven't seen an XLSX file having such cells.\n // Example: `<sheetData><row r=\"1\"><c r=\"A1\" s=\"1\" t=\"d\"><v>2021-06-10T00:47:45.700Z</v></c></row></sheetData>`.\n case 'd':\n if (value === undefined) {\n break;\n }\n var parsedDate = new Date(value);\n if (isNaN(parsedDate.valueOf())) {\n throw new Error(\"Unsupported \\\"date\\\" cell value: \".concat(value));\n }\n value = parsedDate;\n break;\n\n // Numeric cells have type \"n\".\n case 'n':\n if (value === undefined) {\n break;\n }\n // XLSX does have \"d\" type for dates, but it's not commonly used.\n // Instead, it prefers using \"n\" type for storing dates as timestamps.\n if (styleId && isDateFormatStyle(styleId, styles, options)) {\n // Parse the number from string.\n value = parseNumber(value);\n // Parse the number as a date timestamp.\n value = parseExcelDate(value, {\n epoch1904: epoch1904\n });\n } else {\n // Parse the number from string.\n // Supports custom parsing function to work around javascript number encoding precision issues.\n // https://gitlab.com/catamphetamine/read-excel-file/-/issues/85\n value = (options.parseNumber || parseNumber)(value);\n }\n break;\n default:\n throw new TypeError(\"Cell type not supported: \".concat(type));\n }\n\n // Convert empty values to `null`.\n if (value === undefined) {\n value = null;\n }\n return value;\n}\n\n// Decodes numeric error code to a string code.\n// https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md\nfunction decodeError(errorCode) {\n // While the error values are determined by the application,\n // the following are some example error values that could be used:\n switch (errorCode) {\n case 0x00:\n return '#NULL!';\n case 0x07:\n return '#DIV/0!';\n case 0x0F:\n return '#VALUE!';\n case 0x17:\n return '#REF!';\n case 0x1D:\n return '#NAME?';\n case 0x24:\n return '#NUM!';\n case 0x2A:\n return '#N/A';\n case 0x2B:\n return '#GETTING_DATA';\n default:\n // Such error code doesn't exist. I made it up.\n return \"#ERROR_\".concat(errorCode);\n }\n}\nfunction parseString(value, options) {\n // In some weird cases, a developer might want to disable\n // the automatic trimming of all strings.\n // For example, leading spaces might express a tree-like hierarchy.\n // https://github.com/catamphetamine/read-excel-file/pull/106#issuecomment-1136062917\n if (options.trim !== false) {\n value = value.trim();\n }\n if (value === '') {\n value = undefined;\n }\n return value;\n}\n//# sourceMappingURL=parseCellValue.js.map","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n/**\r\n * Parses XLSX cell address into a row number and a column number.\r\n * @param {string} coordinatesString\r\n * @returns {number[]} Returns `[rowNumber, columnNumber]`\r\n */\nexport default function parseCellAddress(coordinatesString) {\n // Coordinate examples: \"AA2091\", \"R988\", \"B1\".\n var _coordinatesString$sp = coordinatesString.split(/(\\d+)/),\n _coordinatesString$sp2 = _slicedToArray(_coordinatesString$sp, 2),\n column = _coordinatesString$sp2[0],\n row = _coordinatesString$sp2[1];\n return [\n // Row number (starting at `1`).\n Number(row),\n // Column number (starting at `1`).\n // It's not clear if the `column` part could ever be non-trimmed,\n // but this `.trim()` call was already here when I copied this code from somewhere.\n getColumnNumberFromColumnLetters(column.trim())];\n}\n\n// Maps \"A1\"-like coordinates to `{ row, column }` numeric coordinates.\nvar LETTERS = ['', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];\n\n// Converts a letter coordinate to a digit coordinate.\n// Examples: \"A\" -> 1, \"B\" -> 2, \"Z\" -> 26, \"AA\" -> 27, etc.\nfunction getColumnNumberFromColumnLetters(columnLetters) {\n // `for ... of ...` would require Babel polyfill for iterating a string.\n var n = 0;\n var i = 0;\n while (i < columnLetters.length) {\n n *= 26;\n n += LETTERS.indexOf(columnLetters[i]);\n i++;\n }\n return n;\n}\n//# sourceMappingURL=parseCellAddress.js.map","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nimport parseCellValue from './parseCellValue.js';\nimport parseCellAddress from './parseCellAddress.js';\n\n// Example of a `<c/>`ell element:\n//\n// <c>\n// <f>string</f> — formula.\n// <v>string</v> — formula pre-computed value.\n// <is>\n// <t>string</t> — an `inlineStr` string (rather than a \"common string\" from a dictionary).\n// <r>\n// <rPr>\n// ...\n// </rPr>\n// <t>string</t>\n// </r>\n// <rPh sb=\"1\" eb=\"1\">\n// <t>string</t>\n// </rPh>\n// <phoneticPr fontId=\"1\"/>\n// </is>\n// <extLst>\n// <ext>\n// <!--any element-->\n// </ext>\n// </extLst>\n// </c>\n//\nexport default function parseCell(attributes, value, inlineString, sharedStrings, styles, epoch1904, options) {\n var _parseCellAddress = parseCellAddress(attributes.r),\n _parseCellAddress2 = _slicedToArray(_parseCellAddress, 2),\n row = _parseCellAddress2[0],\n column = _parseCellAddress2[1];\n var type = attributes.t;\n var styleId = attributes.s ? Number(attributes.s) : undefined;\n return {\n row: row,\n column: column,\n value: parseCellValue(value, type, {\n inlineString: inlineString,\n styleId: styleId,\n styles: styles,\n sharedStrings: sharedStrings,\n epoch1904: epoch1904,\n options: options\n })\n };\n}\nexport function createInitialStateInCell() {\n return {\n v: false,\n is: false,\n t: false,\n r: false,\n rPh: false,\n value: undefined,\n inlineString: undefined,\n attributes: undefined\n };\n}\nexport function onOpenTagInCell(tagName, attributes, state) {\n if (tagName === 'v') {\n state.v = true;\n } else if (tagName === 'is') {\n // The possible children of <is> are:\n // * <t> (Text): The standard child to hold plain, simple text.\n // * <r> (Rich Text Run): Used for applying different formatting styles (like bold or italic) to specific segments of text within a single cell.\n // * <rPh> (Phonetic Run): Used primarily for East Asian languages to provide phonetic reading/pronunciation data (e.g., furigana in Japanese). It associates a phonetic pronunciation run right alongside the base string text tag <t>.\n // * <phoneticPr> (Phonetic Properties): Defines formatting and settings for the phonetic text.\n state.is = true;\n state.inlineString = '';\n } else if (tagName === 't') {\n state.t = true;\n } else if (tagName === 'r') {\n // The possible children of <r/> are:\n // * <rPr> (Run Properties): The formatting properties for the text (font, size, color, bold, italic, etc.).\n // * <t> (Text): The actual text payload.\n // * <rPh> (Phonetic Run): Phonetic pronunciation guidance (used for East Asian languages like Japanese). It associates a phonetic pronunciation run right alongside the base string text tag <t>.\n state.r = true;\n } else if (tagName === 'rPh') {\n // The possible children of <rPh/> are:\n // * <t> (Text): Contains the actual phonetic text or reading (usually in Katakana for Japanese) that corresponds to the associated character string.\n state.rPh = true;\n }\n}\nexport function onCloseTagInCell(tagName, state) {\n if (tagName === 'v') {\n state.v = false;\n } else if (tagName === 'is') {\n state.is = false;\n } else if (tagName === 't') {\n state.t = false;\n } else if (tagName === 'r') {\n state.r = false;\n } else if (tagName === 'rPh') {\n state.rPh = false;\n }\n}\nexport function onTextInCell(text, state) {\n if (state.v) {\n state.value = text;\n } else if (state.is) {\n if (state.rPh) {\n // Ignore anything inside `<rPh/>` tags\n } else if (state.t) {\n if (state.r) {\n // An `<r/>` element could contain multiple `<t/>` elements,\n // the text content from all of which should be concatenated.\n state.inlineString += text;\n } else {\n state.inlineString = text;\n }\n }\n }\n}\n//# sourceMappingURL=parseCell.js.map","import parseCell, { createInitialStateInCell, onOpenTagInCell, onCloseTagInCell, onTextInCell } from './parseCell.js';\nexport default function parseSheetData(state, sharedStrings, styles, epoch1904, options) {\n return state.cells.map(function (_ref) {\n var attributes = _ref.attributes,\n value = _ref.value,\n inlineString = _ref.inlineString;\n return parseCell(attributes, value, inlineString, sharedStrings, styles, epoch1904, options);\n });\n}\nexport function createInitialStateInSheetData() {\n return {\n c: undefined,\n cells: []\n };\n}\nexport function onOpenTagInSheetData(tagName, attributes, state) {\n if (tagName === 'c') {\n state.c = createInitialStateInCell();\n state.c.attributes = attributes;\n } else if (state.c) {\n onOpenTagInCell(tagName, attributes, state.c);\n }\n}\nexport function onCloseTagInSheetData(tagName, state) {\n if (tagName === 'c') {\n state.cells.push({\n attributes: state.c.attributes,\n value: state.c.value,\n inlineString: state.c.inlineString\n });\n state.c = undefined;\n } else if (state.c) {\n onCloseTagInCell(tagName, state.c);\n }\n}\nexport function onTextInSheetData(text, state) {\n if (state.c) {\n onTextInCell(text, state.c);\n }\n}\n\n// Here, it could also parse \"merged cells\" and then return them in some special way.\n// But then it's not clear what should be the way to return such merged cells.\n// I.e. should it just return it as a duplicate value in each one of the merged cells?\n// Or should it keep the current behavior of only returning the value of the top-most left-most cell\n// and then just return `null` for the rest of the cells in a \"merged cells\" group?\n// Perhaps the latter (current) approach is the most sensible one, so there's no need\n// to change anything.\n//\n// const mergedCells = getMergedCellCoordinates(sheetDocument)\n// for (const mergedCell of mergedCells) {\n// const [from, to] = mergedCell.split(':').map(parseCellAddress)\n// console.log('Merged Cell.', 'From:', from, 'To:', to)\n// }\n//# sourceMappingURL=parseSheetData.js.map","function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nexport default function dropEmptyRows(data) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n rowIndexSourceMap = _ref.rowIndexSourceMap,\n _ref$accessor = _ref.accessor,\n accessor = _ref$accessor === void 0 ? function (_) {\n return _;\n } : _ref$accessor,\n onlyTrimAtTheEnd = _ref.onlyTrimAtTheEnd;\n // Drop empty rows.\n var i = data.length - 1;\n while (i >= 0) {\n // Check if the row is empty.\n var empty = true;\n for (var _iterator = _createForOfIteratorHelperLoose(data[i]), _step; !(_step = _iterator()).done;) {\n var cell = _step.value;\n if (accessor(cell) !== null) {\n empty = false;\n break;\n }\n }\n // Remove the empty row.\n if (empty) {\n data.splice(i, 1);\n if (rowIndexSourceMap) {\n rowIndexSourceMap.splice(i, 1);\n }\n } else if (onlyTrimAtTheEnd) {\n break;\n }\n i--;\n }\n return data;\n}\n//# sourceMappingURL=dropEmptyRows.js.map","function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nexport default function dropEmptyColumns(data) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n _ref$accessor = _ref.accessor,\n accessor = _ref$accessor === void 0 ? function (_) {\n return _;\n } : _ref$accessor,\n onlyTrimAtTheEnd = _ref.onlyTrimAtTheEnd;\n var i = data[0].length - 1;\n while (i >= 0) {\n var empty = true;\n for (var _iterator = _createForOfIteratorHelperLoose(data), _step; !(_step = _iterator()).done;) {\n var row = _step.value;\n if (accessor(row[i]) !== null) {\n empty = false;\n break;\n }\n }\n if (empty) {\n var j = 0;\n while (j < data.length) {\n data[j].splice(i, 1);\n j++;\n }\n } else if (onlyTrimAtTheEnd) {\n break;\n }\n i--;\n }\n return data;\n}\n//# sourceMappingURL=dropEmptyColumns.js.map","function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nimport dropEmptyRows from './dropEmptyRows.js';\nimport dropEmptyColumns from './dropEmptyColumns.js';\nexport default function convertCellsToData2dArray(cells, dimensions) {\n // If the sheet is empty.\n if (cells.length === 0) {\n return [];\n }\n var _dimensions = _slicedToArray(dimensions, 2),\n leftTop = _dimensions[0],\n rightBottom = _dimensions[1];\n\n // Don't discard empty rows or columns at the start of the spreadsheet,\n // even when the `*.xlsx` file itself tells that the content starts at an offset.\n // https://github.com/catamphetamine/read-excel-file/issues/102\n // const colsCount = (rightBottom.column - leftTop.column) + 1\n // const rowsCount = (rightBottom.row - leftTop.row) + 1\n\n var colsCount = rightBottom.column;\n var rowsCount = rightBottom.row;\n\n // Initialize spreadsheet data structure.\n var data = new Array(rowsCount);\n var i = 0;\n while (i < rowsCount) {\n data[i] = new Array(colsCount);\n var j = 0;\n while (j < colsCount) {\n data[i][j] = null;\n j++;\n }\n i++;\n }\n\n // Fill in spreadsheet `data`.\n for (var _iterator = _createForOfIteratorHelperLoose(cells), _step; !(_step = _iterator()).done;) {\n var cell = _step.value;\n // Don't discard empty rows or columns at the start of the spreadsheet,\n // even when the `*.xlsx` file itself tells that the content starts at an offset.\n // https://github.com/catamphetamine/read-excel-file/issues/102\n // const rowIndex = cell.row - leftTop.row\n // const columnIndex = cell.column - leftTop.column\n var rowIndex = cell.row - 1;\n var columnIndex = cell.column - 1;\n // Ignore the data in the cell if it's outside of the spreadsheet's \"dimensions\".\n if (columnIndex < colsCount && rowIndex < rowsCount) {\n data[rowIndex][columnIndex] = cell.value;\n }\n }\n\n // // Fill in the row map, if the row map was passed.\n // if (options.rowIndexSourceMap) {\n // let i = 0\n // while (i < data.length) {\n // options.rowIndexSourceMap[i] = i\n // i++\n // }\n // }\n\n // Drop (discard) empty columns at the right side.\n // Drop (discard) empty rows at the bottom.\n data = dropEmptyRows(dropEmptyColumns(data, {\n onlyTrimAtTheEnd: true\n }), {\n onlyTrimAtTheEnd: true\n } // { onlyTrimAtTheEnd: true, rowIndexSourceMap: options.rowIndexSourceMap }\n );\n\n return data;\n}\n//# sourceMappingURL=convertCellsToData2dArray.js.map","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nimport parseSheetData, { createInitialStateInSheetData, onOpenTagInSheetData, onCloseTagInSheetData, onTextInSheetData } from './parseSheetData.js';\nimport parseCellAddress from './parseCellAddress.js';\nimport reconstructSheetDimensionsFromSheetCells from './reconstructSheetDimensionsFromSheetCells.js';\nimport convertSheetToData2dArray from './convertCellsToData2dArray.js';\n\n/**\r\n * Parses a `sheet.xml` file.\r\n * @param {string} content\r\n * @param {function} parseXmlStream — SAX XML parser.\r\n * @param {object} options\r\n * @returns {Promise<SheetData>}\r\n */\nexport default function parseSheet(content, parseXmlStream, _ref) {\n var sharedStrings = _ref.sharedStrings,\n styles = _ref.styles,\n epoch1904 = _ref.epoch1904,\n options = _ref.options;\n // When XML parser is finished, it returns a `state`\n // where it has accumulated the cells it encountered during parsing.\n // `getSheetData()` function reads the parser `state` and transforms it to `SheetData`.\n var getSheetData = function getSheetData(state) {\n var cells = parseSheetData(state.sheetData, sharedStrings, styles, epoch1904, options);\n var dimensions = state.dimension ? parseSheetDimensionRef(state.dimension) : reconstructSheetDimensionsFromSheetCells(cells);\n return convertSheetToData2dArray(cells, dimensions);\n };\n return parseXmlStream(content, {\n createInitialState: createInitialStateInSheet,\n onOpenTag: onOpenTagInSheet,\n onCloseTag: onCloseTagInSheet,\n onText: onTextInSheet\n }).then(function (state) {\n return getSheetData(state);\n });\n}\nfunction createInitialStateInSheet() {\n return {\n dimension: undefined,\n sheetData: undefined\n };\n}\nfunction onOpenTagInSheet(tagName, attributes, state) {\n if (tagName === 'dimension') {\n state.dimension = attributes.ref;\n } else if (tagName === 'sheetData') {\n state.sheetData = createInitialStateInSheetData();\n } else if (state.sheetData) {\n onOpenTagInSheetData(tagName, attributes, state.sheetData);\n }\n}\nfunction onCloseTagInSheet(tagName, state) {\n if (state.sheetData) {\n onCloseTagInSheetData(tagName, state.sheetData);\n }\n}\nfunction onTextInSheet(text, state) {\n if (state.sheetData) {\n onTextInSheetData(text, state.sheetData);\n }\n}\n\n/**\r\n * Sheet \"dimension\" defines the spreadsheet area containing all non-empty cells.\r\n * Any cells outside the \"dimension\" are considered empty and should be ignored.\r\n * https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sheetdimension?view=openxml-2.8.1\r\n * @param {string} `ref` — The value of `<dimension ref/>` attribute.\r\n * @returns {object[]} `undefined` or `[{ row, column }, { row, column }]` — \"From row number and column number to row number and column number\".\r\n */\nfunction parseSheetDimensionRef(ref) {\n var dimensions = ref.split(':').map(parseCellAddress).map(function (_ref2) {\n var _ref3 = _slicedToArray(_ref2, 2),\n row = _ref3[0],\n column = _ref3[1];\n return {\n row: row,\n column: column\n };\n });\n // Sometimes there can be just a single cell as a spreadsheet's \"dimensions\".\n // For example, the default \"dimensions\" in Apache POI library is \"A1\",\n // meaning that only the first cell in the spreadsheet is used.\n //\n // A quote from Apache POI library:\n // \"Single cell ranges are formatted like single cell references (e.g. 'A1' instead of 'A1:A1').\"\n //\n if (dimensions.length === 1) {\n dimensions = [dimensions[0], dimensions[0]];\n }\n return dimensions;\n}\n//# sourceMappingURL=parseSheet.js.map","export default function reconstructSheetDimensionsFromSheetCells(cells) {\n var comparator = function comparator(a, b) {\n return a - b;\n };\n var allRows = cells.map(function (cell) {\n return cell.row;\n }).sort(comparator);\n var allCols = cells.map(function (cell) {\n return cell.column;\n }).sort(comparator);\n var minRow = allRows[0];\n var maxRow = allRows[allRows.length - 1];\n var minCol = allCols[0];\n var maxCol = allCols[allCols.length - 1];\n return [{\n row: minRow,\n column: minCol\n }, {\n row: maxRow,\n column: maxCol\n }];\n}\n//# sourceMappingURL=reconstructSheetDimensionsFromSheetCells.js.map","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nexport default function isPromise(anything) {\n return _typeof(anything) === 'object' && typeof anything.then === 'function';\n}\n\n// export default function isPromise<Value>(anything: unknown): anything is Promise<Value> {\n// return (\n// typeof anything === 'object' &&\n// typeof (anything as Promise<unknown>).then === 'function'\n// )\n// }\n//# sourceMappingURL=isPromise.js.map","var _excluded = [\"parseNumber\"];\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport parseSpreadsheetInfo from './parseSpreadsheetInfo.js';\nimport parseFilePaths from './parseFilePaths.js';\nimport parseStyles from './parseStyles.js';\nimport parseSharedStrings from './parseSharedStrings.js';\nimport parseSheet from './parseSheet.js';\nimport parseNumberDefault from './parseNumber.js';\nimport checkpoint, { latestCheckpointTimestamp } from '../utility/checkpoint.js';\nimport isPromise from '../utility/isPromise.js';\n\n// For an introduction in reading `.xlsx` files see \"The minimum viable XLSX reader\":\n// https://www.brendanlong.com/the-minimum-viable-xlsx-reader.html\n\n/**\r\n * Reads data from an `.xlsx` file.\r\n * @param {function} parseXmlStream — SAX XML parser.\r\n * @param {Record<string,string>} contents - A map of `.xml` files inside the `.xlsx` file (which itself is just a zipped directory).\r\n * @param {object} [options]\r\n * @return {Promise<Sheet[]>}\r\n */\nfunction parseSpreadsheetContents(parseXmlStream, contents) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n // Because of how `.xlsx` file contents are defined in the specification,\n // it will have to be read in 3 passes:\n // * First pass — read the actual file paths\n // * Second pass — read \"shared strings\" and \"styles\"\n // * Thirs pass — read the sheets data\n\n checkpoint('parse spreadsheet info and file paths');\n\n // Get spreadsheet info and the paths to files.\n return readFiles(getXmlFilesAtFixedPaths(), contents, parseXmlStream).then(function (_ref) {\n var spreadsheetInfo = _ref.spreadsheetInfo,\n filePaths = _ref.filePaths;\n checkpoint('parse \"shared strings\" and \"styles\"');\n\n // Parse \"shared strings\" and \"styles\".\n return readFiles(getXmlFilesAtNonFixedPaths(filePaths), contents, parseXmlStream).then(function (_ref2) {\n var sharedStrings = _ref2.sharedStrings,\n styles = _ref2.styles;\n var sheetRelationIdsToRead = options.sheets ? options.sheets.map(function (sheet) {\n return getSheetRelationId(sheet, spreadsheetInfo.sheets);\n }) : spreadsheetInfo.sheets.map(function (_) {\n return _.relationId;\n });\n checkpoint(\"parse sheet\".concat(sheetRelationIdsToRead.length === 1 ? '' : 's', \" data\"));\n\n // Parse sheets data.\n return readFiles(getSheetDataXmlFiles(filePaths, sheetRelationIdsToRead, {\n sharedStrings: sharedStrings,\n styles: styles,\n epoch1904: spreadsheetInfo.epoch1904,\n options: options\n }), contents, parseXmlStream).then(function (sheetsData) {\n checkpoint('end');\n // Return sheets data.\n return sheetRelationIdsToRead.map(function (sheetRelationId) {\n return {\n sheet: getSheetNameByRelationId(sheetRelationId, spreadsheetInfo.sheets),\n data: sheetsData[sheetRelationId]\n };\n });\n });\n });\n });\n}\n\n/**\r\n * Reads data from an `.xlsx` file in a worker.\r\n * @param {function} [createWorkerFunction] — Creates a worker function.\r\n * @param {function} parseXmlStream — SAX XML parser.\r\n * @param {Record<string,string>} contents - A map of `.xml` files inside the `.xlsx` file (which itself is just a zipped directory).\r\n * @param {object} [options]\r\n * @return {Promise<Sheet[]>}\r\n */\nexport default function parseSpreadsheetContentsInWorker(createWorkerFunction, parseXmlStream, contents, options) {\n // Assign the default `parseNumber()` function in the `options`.\n // The reason is that the worker code requires it to be non-`undefined`.\n // Otherwise, it would throw \"parseNumber is not defined\".\n if (!(options && options.parseNumber)) {\n options = _objectSpread(_objectSpread({}, options), {}, {\n parseNumber: parseNumberDefault\n });\n }\n\n // Using a worker requires specifying all the top-level variables or functions that it uses.\n // Currently, that list looks a little bit too long so for now workers aren't used for parsing sheet data.\n // See the comment in `createWorkerFunction()` call for more details.\n // createWorkerFunction = undefined\n\n // If the environment doesn't support \"workers\", parse spreadsheet contents \"synchronously\".\n // This will \"block\" the main thread while parsing.\n if (!createWorkerFunction) {\n return parseSpreadsheetContents(parseXmlStream, contents, options);\n }\n\n // Any functions have to be removed from the `options` in order for them to be \"serializable\"\n // before sending them to the worker thread.\n var _options = options,\n parseNumber = _options.parseNumber,\n optionsJson = _objectWithoutProperties(_options, _excluded);\n\n // Create a worker.\n var workerFn = createWorkerFunction(function (data) {\n // Reconstruct the `options`.\n var options = _objectSpread(_objectSpread({}, data.optionsJson), {}, {\n parseNumber: parseNumber\n });\n // Parse sheet data from the `.xml` files.\n return parseSpreadsheetContents(parseXmlStream, data.contents, options);\n });\n workerFn.addDependencies(\n // Any \"outside\" dependencies that're referenced in the function (below).\n function () {\n return [parseXmlStream, parseNumber, parseSpreadsheetContents, getSheetRelationId, getSheetNameByRelationId, getXmlFilesAtFixedPaths, getXmlFilesAtNonFixedPaths, getSheetDataXmlFiles, readFiles, checkpoint, latestCheckpointTimestamp, isPromise\n // parseSheet,\n //\n // This is not the full list by any means. There's more. Quite a lot more of them.\n // It started looking a bit too much so I stopped adding the dependencies here.\n // Now I understand why `fflate`'s source code is all written in a single\n // multi-thousand-line `index.ts` file. The thing is, once one starts splitting\n // the code into modules, they'd have to manually export any top-level variables\n // or functions from those modules and import them here in order to specify them\n // in the list of dependencies. And even if doing so for every top-level variable\n // or function in every imported module doesn't seem like an impossible task,\n // imagine someone refactoring the code later and extracting new top-level\n // variables or functions. Without 100% code coverage requirement, it won't be caught\n // at build time and can only be caught in production, which isn't ideal to say the least.\n // So it seems like users of this package will have to just deal with the \"blocking\"\n // nature of the sheet data parser, because I won't follow into `fflate`'s steps\n // and rewrite this package as a single `index.js` file.\n // Users of this package will have to manually put their code in a worker\n // in case they'd prefer it to run in a separate thread to prevent \"blocking\"\n // the main thread when parsing sheet data.\n ];\n });\n\n // Post a message with some data to the worker\n // so that it starts processing the data\n // and later posts a message back to the main thread\n // with the result of the calculation.\n return workerFn.callOnce({\n optionsJson: optionsJson,\n contents: contents\n }); // (optional) add `transferList` argument.\n}\n\nfunction getSheetRelationId(sheet, sheets) {\n if (typeof sheet === 'string') {\n for (var _iterator = _createForOfIteratorHelperLoose(sheets), _step; !(_step = _iterator()).done;) {\n var _sheet = _step.value;\n if (_sheet.name === sheet) {\n return _sheet.relationId;\n }\n }\n throw new Error(\"Sheet \\\"\".concat(sheet, \"\\\" not found. Available sheets: \").concat(sheets.map(function (_ref3) {\n var name = _ref3.name;\n return \"\\\"\".concat(name, \"\\\"\");\n }).join(', ')));\n } else {\n if (sheet <= sheets.length) {\n return sheets[sheet - 1].relationId;\n }\n throw new Error(\"Sheet number out of bounds: \".concat(sheet, \". Available sheets count: \").concat(sheets.length));\n }\n}\nfunction getSheetNameByRelationId(sheetRelationId, sheets) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(sheets), _step2; !(_step2 = _iterator2()).done;) {\n var sheet = _step2.value;\n if (sheet.relationId === sheetRelationId) {\n return sheet.name;\n }\n }\n throw new Error(\"Sheet relation ID not found: \".concat(sheetRelationId));\n}\nfunction getXmlFilesAtFixedPaths() {\n return {\n // Read the paths to certain files inside the `.xlsx` file, which is itself just a `.zip` archive.\n // These paths aren't standardized between different spreadsheet editors.\n // https://github.com/tidyverse/readxl/issues/104\n 'xl/_rels/workbook.xml.rels': {\n name: 'filePaths',\n parse: parseFilePaths\n },\n // General info on the spreadsheet.\n 'xl/workbook.xml': {\n name: 'spreadsheetInfo',\n parse: parseSpreadsheetInfo\n }\n };\n}\nfunction getXmlFilesAtNonFixedPaths(filePaths) {\n var _ref4;\n return _ref4 = {}, _defineProperty(_ref4, filePaths.sharedStrings || 'xl/sharedStrings.xml', {\n name: 'sharedStrings',\n // `parseSharedStrings()` returns a `Promise`.\n parse: parseSharedStrings,\n // It seems that \"sharedStrings.xml\" is not required to exist.\n // For example, that could be the case when a spreadsheet doesn't contain any strings.\n // https://github.com/catamphetamine/read-excel-file/issues/85\n fallback: []\n }), _defineProperty(_ref4, filePaths.styles || 'xl/styles.xml', {\n name: 'styles',\n parse: parseStyles,\n fallback: {}\n }), _ref4;\n}\n\n// Returns the list of sheet data `.xml` files.\nfunction getSheetDataXmlFiles(filePaths, sheetRelationIdsToRead, sheetDataParserParameters) {\n return Object.keys(filePaths.sheets).filter(function (sheetRelationId) {\n return sheetRelationIdsToRead.includes(sheetRelationId);\n }).reduce(function (filesInfo, sheetRelationId) {\n return _objectSpread(_objectSpread({}, filesInfo), {}, _defineProperty({}, filePaths.sheets[sheetRelationId], {\n name: sheetRelationId,\n // `parseSheet()` returns a `Promise`.\n parse: function parse(content, parseXmlStream) {\n return parseSheet(content, parseXmlStream, sheetDataParserParameters);\n }\n }));\n }, {});\n}\n\n// In case of converting `.zip` file reader from a \"read-and-return\" one to a \"streaming\" one,\n// this function could be modified to process the files as they come rather than all-at-once.\n\n// Reads files from inside an `.xlsx` archive by file paths.\n//\n// In case of converting `.zip` file reader from a \"read-and-return\" one to a \"streaming\" one,\n// this function could be modified to process the files as they come rather than all-at-once.\n//\n// But there's a catch: inside an `.xlsx` file, some file paths are not fixed\n// and are instead defined in \"xl/_rels/workbook.xml.rels\" file,\n// which presents a \"chicken and an egg\" dilemma: how could one possibly\n// read an `.xlsx` file in one go when the order of the files inside it isn't fixed\n// and could be random. Most likely, in the majority of cases, \"xl/_rels/workbook.xml.rels\"\n// file is gonna be one of the first in a given `.xlsx` archive, but still it's not guaranteed.\n// A solution would be reading an `.xlsx` file in two passes: one pass would be just to read\n// the \"xl/_rels/workbook.xml.rels\" and ignore decompressing anything else,\n// and then the second pass would be to read all other files whose paths are now known.\n//\n// Returns:\n// * If none of the `parse()` functions returned a `Promise`, it returns a map of files' contents.\n// * If any of the `parse()` functions returned a `Promise`, it returns a `Promise` that resolves to a map of files' contents.\n//\nfunction readFiles(filesInfo, contents, parseXmlStream) {\n // Get files' contents.\n var results = {};\n var _loop = function _loop() {\n var filePath = _Object$keys[_i];\n var fileInfo = filesInfo[filePath];\n results[fileInfo.name] = contents[filePath] === undefined ? fileInfo.fallback === undefined ? function () {\n throw new Error(\"\\\"\".concat(filePath, \"\\\" file not found inside the `.xlsx` file\"));\n }() : fileInfo.fallback : fileInfo.parse(contents[filePath], parseXmlStream);\n };\n for (var _i = 0, _Object$keys = Object.keys(filesInfo); _i < _Object$keys.length; _i++) {\n _loop();\n }\n // Resolve any `Promise`s.\n var promises = [];\n var _loop2 = function _loop2() {\n var name = _Object$keys2[_i2];\n if (isPromise(results[name])) {\n promises.push(results[name].then(function (result) {\n results[name] = result;\n }));\n }\n };\n for (var _i2 = 0, _Object$keys2 = Object.keys(results); _i2 < _Object$keys2.length; _i2++) {\n _loop2();\n }\n if (promises.length > 0) {\n return Promise.all(promises).then(function () {\n return results;\n });\n }\n return results;\n}\n//# sourceMappingURL=parseSpreadsheetContents.js.map","// import createWorkerFunction from 'worker-f/browser'\n\nimport parseXmlStream from '../xml/parseXmlStream.js';\nimport unpackXlsxFile from './unpackXlsxFileBrowser.js';\nimport parseSpreadsheetContents from '../xlsx/parseSpreadsheetContents.js';\nvar createWorkerFunction = undefined;\n\n/**\r\n * Reads an `.xlsx` file.\r\n * @param {(File|Blob|ArrayBuffer)} input\r\n * @param {object} [options]\r\n * @return {Promise<Sheet[]>}\r\n */\nexport default function readXlsxFile(input, options) {\n return unpackXlsxFile(input).then(function (contents) {\n return parseSpreadsheetContents(createWorkerFunction, parseXmlStream, contents, options);\n });\n}\n//# sourceMappingURL=readXlsxFileBrowser.js.map"],"names":["_typeof","o","Symbol","iterator","constructor","prototype","Parser_","options","fromCharCode","String","hasOwnProperty","Object","ENTITY_PATTERN","ENTITY_MAPPING","amp","apos","gt","lt","quot","replaceEntities","_","d","x","z","call","parseInt","decodeEntities","s","length","indexOf","replace","keys","forEach","k","toUpperCase","NON_WHITESPACE_OUTSIDE_ROOT_NODE","error","msg","Error","getter","getFn","get","enumerable","cloneNsMatrix","nsMatrix","key","clone","NAME_CACHE","uriPrefix","prefix","noopGetContext","line","column","throwFunc","err","Parser","this","onText","onOpenTag","onCloseTag","onCDATA","onWarning","onComment","onQuestion","onAttention","nsMatrixStack","nodeStack","nsUriToPrefix","proxy","onError","getContext","streaming","rootTagFound","leftoverXml","maybeNS","isNamespace","returnError","parseStop","handleError","handleWarning","resetState","uri","buildNsMatrix","parse","xml","_nsMatrix","y","q","w","v","xmlns","elementName","_elementName","elementProxy","cachedAttrs","arguments","undefined","elNameCache","elNameCacheMatrix","anonymousNsCount","tagStart","tagEnd","i","j","attrsString","attrsStart","normalizeAttrName","name","defaultAlias","nsName","substring","substr","getAttrs","nsUri","nsUriPrefix","hasNewMatrix","newalias","value","alias","skipAttr","attrList","l","attrs","seenAttrs","Set","parseAttr","charCodeAt","has","add","push","match","data","splitsRe","startOfLine","endOfLine","exec","index","create","originalName","ns","trim","isNaN","pop","_cachedName","cb","nsMap","_nsUriToPrefix","parseXmlStream","_ref","createInitialState","TAG_NAME_PREFIX","trimXmlnsPrefix","tagName","Promise","resolve","reject","errored","state","parser","on","text","element","selfClosing","attributes","ch2","u8","Uint8Array","u16","Uint16Array","i32","Int32Array","fleb","fdeb","clim","freb","eb","start","b","r","_a","fl","revfl","fd","rev","hMap","cd","mb","co","le","rvb","sv","r_1","m","flt","fdt","flrm","fdrm","max","a","bits","p","bits16","shft","slc","e","subarray","ec","ind","nt","code","captureStackTrace","inflt","dat","st","buf","dict","sl","dl","f","noBuf","resize","noSt","cbuf","bl","nbuf","Math","set","final","pos","bt","lm","dm","lbt","dbt","n","tbts","type","t","hLit","hcLen","tl","ldt","clt","clb","clbmsk","clm","c","dt","lms","dms","lpos","sym","dsym","end","shift","dend","min","et","wcln","fn","fnStr","td","toString","ks","slice","lastIndexOf","split","st_1","spInd","ch","wrkr","fns","init","id","td_1","mrg","transfer","Worker","URL","createObjectURL","Blob","onmessage","ed","$e$","stack","postMessage","wk","buffer","cbfs","bInflt","inflateSync","pbf","gopt","out","size","dictionary","cbify","opts","terminate","consume","b2","b4","b8","TextDecoder","decode","stream","dutf8","strFromU8","latin1","apply","latestCheckpointTimestamp","slzh","zh","fnl","efl","es","z64hs","sc","su","off","nsc","nsu","noff","mt","queueMicrotask","setTimeout","unzip","term","tAll","files","cbd","lft","ze","fltr","filter","_loop_3","c_1","no","cbl","originalSize","compression","infl","ev","inflate","unzipFromArrayBuffer","input","_filter","file","path","unzipFromArrayBufferUsingFunction","unzipAsync","archive","checkpoint","now","Date","global","Boolean","READ_EXCEL_FILE_CHECKPOINTS","window","console","log","convertValuesFromUint8ArraysToStrings","entries","convertedEntries","_i","_Object$keys","filterZipArchiveEntry","endsWith","unpackXlsxFile","File","arrayBuffer","then","getResultFromArrayBuffer","parseSpreadsheetInfo","content","createInitialStateInWorkbookXml","onOpenTagInWorkbookXml","epoch1904","workbookPr","sheets","date1904","Number","sheetId","relationId","parseFilePaths","createInitialStateInWorkbookRelationships","onOpenTagInWorkbookRelationships","sharedStrings","styles","target","getFilePathFromRelationTarget","addFilePathForRelation","Id","Type","Target","_excluded","ownKeys","getOwnPropertySymbols","getOwnPropertyDescriptor","_objectSpread","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","obj","arg","hint","prim","toPrimitive","res","TypeError","_toPrimitive","_toPropertyKey","configurable","writable","_objectWithoutProperties","source","excluded","sourceKeys","_objectWithoutPropertiesLoose","sourceSymbolKeys","propertyIsEnumerable","parseStyles","createInitialStateInStyles","onOpenTagInStyles","onCloseTagInStyles","map","style","xfId","styleProperties","baseStyles","numberFormats","cellStyleXfs","cellXfs","numFmtId","template","formatCode","parseCellStyle","numberFormat","parseSharedStrings","createInitialStateInSharedStrings","onOpenTagInSharedStrings","onCloseTagInSharedStrings","onTextInSharedStrings","strings","si","rPh","string","onOpenTagInSharedString","onCloseTagInSharedString","onTextInSharedString","NUMBER_OF_LEAP_YEARS_BETWEEN_1900_AND_1970","JANUARY_0TH_1900_DAY","ERRONEOUS_FEBRUARY_29_1990_DAY","DAY","DAYS_IN_YEAR","parseNumber","stringifiedNumber","parsedNumber","concat","_createForOfIteratorHelperLoose","allowArrayLike","it","next","bind","Array","isArray","minLen","_arrayLikeToArray","from","test","_unsupportedIterableToArray","done","arr","len","arr2","DATE_FORMAT_SPECIFIC_LOCALE_PREFIX","DATE_FORMAT_ALLOW_ANY_OTHER_TEXT_SUFFIX","CACHE","isDateFormatCached","result","toLowerCase","tokens","_step","_iterator","token","DATE_TEMPLATE_TOKENS","isDateFormat","MAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS","JAPANESE_OR_KOREAN_LOCALE_BUILT_IN_DATE_FORMAT_IDS","BUILT_IN_DATE_FORMAT_IDS","numberFormatId","parseCellValue","inlineString","styleId","parseString","sharedStringIndex","errorCode","decodeError","parsedDate","valueOf","dateFormat","smartDateParser","isDateFormatStyle","excelSerialDate","daysBeforeUnixEpoch","floor","parseExcelDate","_slicedToArray","_arrayWithHoles","u","_iterableToArrayLimit","_nonIterableRest","parseCellAddress","coordinatesString","_coordinatesString$sp2","row","getColumnNumberFromColumnLetters","LETTERS","columnLetters","parseSheetData","cells","_parseCellAddress2","parseCell","convertCellsToData2dArray","dimensions","_dimensions","rightBottom","colsCount","rowsCount","cell","rowIndex","columnIndex","rowIndexSourceMap","_ref$accessor","accessor","onlyTrimAtTheEnd","empty","splice","dropEmptyRows","dropEmptyColumns","parseSheet","getSheetData","sheetData","dimension","ref","_ref2","_ref3","parseSheetDimensionRef","comparator","allRows","sort","allCols","minRow","maxRow","reconstructSheetDimensionsFromSheetCells","convertSheetToData2dArray","createInitialStateInSheet","onOpenTagInSheet","onCloseTagInSheet","onTextInSheet","is","onOpenTagInCell","onOpenTagInSheetData","onCloseTagInCell","onCloseTagInSheetData","onTextInCell","onTextInSheetData","isPromise","anything","parseSpreadsheetContents","contents","readFiles","getXmlFilesAtFixedPaths","spreadsheetInfo","filePaths","getXmlFilesAtNonFixedPaths","sheetRelationIdsToRead","sheet","getSheetRelationId","getSheetDataXmlFiles","sheetsData","sheetRelationId","getSheetNameByRelationId","_sheet","join","_step2","_iterator2","_ref4","fallback","sheetDataParserParameters","includes","reduce","filesInfo","filePath","fileInfo","results","promises","_loop2","_Object$keys2","_i2","all","createWorkerFunction","parseNumberDefault","_options","optionsJson","workerFn","addDepend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ib/stringifyFunctionReferences.js","../node_modules/worker-f/lib/createWorker.js","../node_modules/worker-f/lib/createWorkerFunction_.js","../node_modules/worker-f/lib/createWorkerFunction.js","../node_modules/worker-f/lib/environment/createWorkerInBrowser.js","../node_modules/worker-f/lib/export/browser/createWorkerFunctionInBrowser.js","../modules/saxen/parser.js","../modules/xml/parseXmlStream.saxen.js","../modules/xlsx/InvalidSpreadsheetError.js","../modules/xml/parseXml.js","../node_modules/fflate/esm/browser.js","../modules/zip/UnzipError.js","../modules/zip/unzipFromArrayBuffer.js","../modules/xlsx/file/InvalidInputError.js","../modules/export/filterZipArchiveEntry.js","../modules/xlsx/file/createFileTypeDetector.js","../modules/utility/checkpoint.js","../modules/xlsx/file/validateLeadingBytes.js","../modules/export/unpackXlsxFileBrowser.js","../modules/xlsx/parseSpreadsheetInfo.js","../modules/xlsx/parseFilePaths.js","../modules/xlsx/parseStyles.js","../modules/xlsx/parseSharedStrings.js","../modules/xlsx/parseExcelTimestamp.js","../modules/xlsx/isDateFormat.js","../modules/xlsx/isDateFormatStyle.js","../modules/xlsx/parseCell.js","../modules/xlsx/parseCellAddress.js","../modules/xlsx/parseSheet.js","../modules/utility/convertValuesFromUint8ArraysToStrings.js","../modules/utility/isPromise.js","../modules/xlsx/SheetNotFoundError.js","../modules/xlsx/parseSpreadsheetContents.js","../modules/export/readXlsxFileBrowser.js"],"sourcesContent":["// This source code was originally copy-pasted from `fflate`'s `wcln` function\n// and then refactored according to my personal taste. Also added comments.\n// https://github.com/101arrowz/fflate/blob/master/src/index.ts\n/**\n * In a given list of dependencies, it stringifies any functions to their javascript source code strings.\n * It could've used simple `.toString()` if it wasn't for \"minification\" process which eventually renames\n * all functions to random shortened names. Why do function names matter? Because the worker will have to\n * call those functions by name rather than by reference, because a worker can't share any runtime code\n * with the parent thread, hence the stringification to javascript source code.\n *\n * Alternatively, the code that is executed inside a worker could abstain from using global function references\n * and instead reference any functions from some kind of a `context` object. In that case, minifiers\n * won't touch the property names in that `context` object. The \"pros\" would be not having to use this \"magic\" function.\n * The \"cons\" would be having to prepend the `context.` prefix to every function being called,\n * and if any of those functions happen to call another functions, those would have to be called\n * from the `context` too, which could quickly turn the code into a context-passing \"spaghetti\" mess.\n * Not to mention having to define the `Context` type in case of TypeScript.\n * But otherwise, both approaches would work and there's no other difference between them.\n *\n * @param {function} getDependencies — Returns an array of dependencies. This function must adhere to a strict form: it has to be a \"closure\" that returns an array of named variables. The restriction is because the exact variable names have to be known from the stringified form of this function.\n * @returns {object} — An object of shape: `{ functions, values }` where `functions` contains the source code of any functions by their actual name, and `values` contains any \"regular values\" — strings, numbers, objects, arrays, etc — in their original (non-stringified) form.\n */\nexport default function stringifyFunctionReferences(getDependencies) {\n const functions = {};\n const variables = {};\n const references = getDependencies();\n const getReferencesSourceCode = getDependencies.toString();\n const referencedNames = getReferencesSourceCode.slice(getReferencesSourceCode.indexOf('[') + 1, getReferencesSourceCode.lastIndexOf(']')).replace(/\\s+/g, '').split(',');\n let i = 0;\n while (i < references.length) {\n let name = referencedNames[i];\n let value = references[i];\n if (typeof value === 'function') {\n functions[name] = getFunctionSourceCode(value, name);\n }\n else {\n // Regular values don't need to be stringified because they could be just \"cloned\".\n variables[name] = value;\n }\n i++;\n }\n return {\n functions,\n variables\n };\n}\n/**\n * Returns the source code for a function (or class), provided that it will be referenced by `name`.\n * @param {function} func\n * @param {string} name\n * @returns {string}\n */\nfunction getFunctionSourceCode(func, name) {\n const funcSourceCode = func.toString();\n // If the \"function\" is actually not a function but rather a class definition\n // then it should also replace the class name in the definition of any of its methods.\n if (func.prototype) {\n // \"Native\" classes don't have javascript source code.\n // In such case, the source code for such class could be replaced with the class name itself,\n // because \"native\" classes are globally available everywhere and printing a \"native\" class name\n // is evaluated as the definition of such class, so there's no need to pass the definition as source code.\n if (funcSourceCode.indexOf('[native code]') != -1) {\n // `funcSourceCode` example: \"function DOMParser() { [native code] }\"\n const funcNameStartsAt = funcSourceCode.indexOf(' ', 'function'.length) + ' '.length;\n const funcNameEndsBefore = funcSourceCode.indexOf('(', funcNameStartsAt);\n return funcSourceCode.slice(funcNameStartsAt, funcNameEndsBefore);\n }\n else {\n // Non-\"native\" classes will have all their method definitions printed.\n // In those method definitions,\n let code = funcSourceCode;\n for (const key in func.prototype) {\n code += ';' + name + '.prototype.' + key + '=' + func.prototype[key].toString();\n }\n return code;\n }\n }\n else {\n return funcSourceCode;\n }\n}\n","import stringifyFunctionReferences from \"./stringifyFunctionReferences.js\";\n/**\n * Creates a worker.\n *\n * @example\n * ```js\n * // When running in a web browser.\n * import createWorkerInBrowser from './createWorkerInBrowser.ts'\n *\n * // Create a worker.\n * const workerFn = createWorkerFn(\n * \t// Creates a worker in a given environment.\n * \tcreateWorkerInBrowser,\n *\n * \t// (optional) Filters `transferList` argument.\n * \tundefined,\n *\n * \t// Any \"outside\" dependencies that're referenced in the function (below).\n * \t[() => [outsideVar1, outsideVar2, func1, func2]],\n *\n * \t// Returns a function in the worker that processes input data.\n * \t(respond) => {\n * \treturn (data) => {\n * \t\t\t// Process the data (perform some kind of calculation).\n * \t\t\tconst result = processData(data)\n * \t\t\t// Post the result of the calculation back to the main thread.\n * \t\t\trespond(result) // (optional) add `transferList` argument.\n * \t\t}\n * },\n *\n * \t// A function in the main thread that will be called every time\n * \t// when the worker has finished processing the data\n * \t// (or threw an error while doing that).\n * \t(error, result) => {\n * \t\tif (error) {\n * \t\t\tworkerFn.stop()\n * \t\t\tthrow error\n * \t\t}\n * \t\t// If no more data will be passed to the worker, it should be terminated.\n * \t\tworkerFn.stop()\n * \t\tconsole.log(result)\n * \t}\n * )\n *\n * workerFn.start()\n *\n * // Post a message with some data to the worker\n * // so that it starts processing the data\n * // and later posts a message back to the main thread\n * // with the result of the calculation.\n * workerFn.input(inputData) // (optional) add `transferList` argument.\n * ```\n *\n * @param {function} createWorkerInEnvironment — Creates a worker in a given environment. The worker must call globally-available `onMessage(data)` function every time it receives a message, and it must define a `var postMessage = (data) => void` function that posts a message to the parent (main) thread.\n * @param {function} createInputHandler — A \"creator\" that creates a function that will be called with message data every time a message is sent to this worker. The \"creator\" function receives a single argument — a function that posts data back to the main thread, with two arguments: `outputData` and (optional) `transferList`.\n * @param {function} onError — This function will be called every time when there was an error while processing an incoming message. It would be logical to call `worker.terminate()` inside this function.\n * @param {function} onOutput — This function will be called every time when done processing an incoming message.\n * @param {function} getFromCache — Could be used to add caching. Has no arguments. Returns the cached value.\n * @param {function} setInCache — Could be used to add caching. Receives the value to cache as an argument. Doesn't return anything.\n * @returns {Worker} — An object with methods: `start(getDependenciesFunctionOrArrayOfGetDependenciesFunctions)`, `stop()`, `input(data, [transferList])`. Calling `stop()` requests termination of the worker. Calling `stop()` multiple times is safe and will not throw any errors.\n */\nexport default function createWorker(createWorkerInEnvironment, createInputHandler, onError, onOutput, getFromCache, setInCache) {\n // Was the worker ever started?\n let started = false;\n let worker;\n // Starts the worker.\n const start = (arrayOfGetDependenciesFunctions, dependenciesTransferList) => {\n // A worker can't be started twice or restarted after being stopped.\n if (started) {\n throw new Error('Was started');\n }\n started = true;\n const cacheValue = getFromCache();\n const cachedCodeAndVars = cacheValue && cacheValue._;\n const codeAndVars = cachedCodeAndVars || getCodeAndVars(createInputHandler, arrayOfGetDependenciesFunctions);\n if (!cachedCodeAndVars) {\n setInCache({ _: codeAndVars });\n }\n const [code, vars] = codeAndVars;\n // Cache accessors for use in `createWorkerInEnvironment`.\n const getOtherFromCache = () => {\n const properties = getFromCache();\n if (properties) {\n return properties.other;\n }\n };\n const setOtherInCache = (value) => {\n setInCache(Object.assign(Object.assign({}, getFromCache()), { other: value }));\n };\n // Create a worker in a specific environment.\n worker = createWorkerInEnvironment(code, getOtherFromCache, setOtherInCache, onError, onOutput);\n // Here is still the main thread code.\n // Initialize the worker with the global variables by sending a message with the variables\n // to the worker.\n //\n // `transferList` is not used here because using it would result in the corresponding\n // values to become \"detached\" from the main thread, and, therefore, unusable at next\n // creation of same type of worker (if there'll ever be one).\n //\n if (vars) {\n worker.ingest(vars, dependenciesTransferList);\n }\n };\n return {\n start,\n stop: () => {\n worker.stop();\n },\n ingest: (data, transferList) => {\n worker.ingest(data, transferList);\n }\n };\n}\nconst JAVASCRIPT_CODE_BEFORE_CREATE_INPUT_HANDLER_FUNCTION = \n// Handles any messages that're sent from the main thread.\n'var onMessage = function(data) {' +\n // The first message from the main thread will initialize the variables.\n // Put all initialization variables in the global scope.\n 'for (var key in data) {' +\n 'self[key] = data[key]' +\n '}' +\n // Any subsequent messages from the main thread will be handled\n // by a custom message handler returned from the supplied \"creator\" function.\n 'onMessage = (';\nconst JAVASCRIPT_CODE_AFTER_CREATE_INPUT_HANDLER_FUNCTION = ')(postMessage)' +\n '}';\nfunction getCodeAndVars(createInputHandler, arrayOfGetDependenciesFunctions) {\n const [functionDefinitions, vars] = createFunctionsCodeAndVars(arrayOfGetDependenciesFunctions);\n // Create javascript code of the worker.\n const code = functionDefinitions +\n ';' +\n JAVASCRIPT_CODE_BEFORE_CREATE_INPUT_HANDLER_FUNCTION +\n createInputHandler.toString() +\n JAVASCRIPT_CODE_AFTER_CREATE_INPUT_HANDLER_FUNCTION;\n return [code, vars];\n}\nfunction createFunctionsCodeAndVars(arrayOfGetDependenciesFunctions) {\n let funcs = {};\n let vars = {};\n for (const getDependencies of arrayOfGetDependenciesFunctions) {\n // Get stringified `functions` and `values`.\n const { functions, variables } = stringifyFunctionReferences(getDependencies);\n // Put the `functions` in the combined map.\n // If some keys get overridden, that's considered ok\n // because those're supposed to be the same global functions.\n funcs = Object.assign(Object.assign({}, funcs), functions);\n // Put the `values` in the combined map.\n // If some keys get overridden, that's considered ok\n // because those're supposed to be the same global variables.\n vars = Object.assign(Object.assign({}, vars), variables);\n }\n const functionDefinitions = Object.keys(funcs).map((functionName) => {\n return functionName + '=' + funcs[functionName];\n }).join(';');\n return [functionDefinitions, vars];\n}\n","import createWorker from \"./createWorker.js\";\nexport default function createWorkerFunction_(createWorkerInEnvironment, fnOrAlias, createMethods, createInputHandler, handleError, handleOutput) {\n // \"Started\" and \"stopped\" flags.\n let started = false;\n let stopped = false;\n // \"Closure\" functions that return any external dependencies.\n let getDependenciesFunctions = [];\n // `transferList` for external dependencies.\n const dependenciesTransferList = undefined;\n let inputTransferList = () => [];\n let outputTransferList = () => [];\n // (optional) Caching.\n let alias = undefined;\n let cacheValue = undefined;\n const getFromCache = (cacheKey) => {\n return CACHE[cacheKey];\n };\n const setInCache = (cacheKey, value) => {\n CACHE[cacheKey] = value;\n };\n const mustHaveStarted = () => {\n if (!started) {\n throw new Error('Not started');\n }\n };\n const mustNotHaveStarted = () => {\n if (started) {\n throw new Error('Was started');\n }\n };\n const mustNotHaveStopped = () => {\n if (stopped) {\n throw new Error('Was stopped');\n }\n };\n const mustNotHaveAlias = () => {\n if (alias) {\n throw new Error('Has alias');\n }\n };\n const argumentMustBeFunction = (arg) => {\n if (typeof arg !== 'function') {\n throw new TypeError('Argument must be a function');\n }\n };\n let fn;\n // See whether the argument is an alias string or a function.\n if (typeof fnOrAlias === 'string') {\n alias = fnOrAlias;\n cacheValue = getFromCache(alias);\n // The additional `if` conditions were added just to work around\n // TypeScript compiler error message.\n if (!cacheValue || !cacheValue.$) {\n throw new Error('Not found');\n }\n // Restore the functions from cache.\n fn = cacheValue.$[0];\n getDependenciesFunctions = cacheValue.$[1];\n inputTransferList = cacheValue.$[2];\n outputTransferList = cacheValue.$[3];\n // The \"expect error\" guard below checks that a developer of this package\n // didn't \"forget\" to restore any other stuff from cache.\n // @ts-expect-error: All elements of the `cacheValue` array should be restored above. In case of adding new stuff in `cachedValue`, increment the index below accordingly.\n cacheValue.$[4];\n }\n else {\n fn = fnOrAlias;\n }\n // Validate the function.\n argumentMustBeFunction(fn);\n let worker;\n /**\n * Adds external dependencies.\n * These dependencies must not change after the function is started.\n *\n * @param {function} getDependencies — A \"closure\" function that returns an array of dependencies — global variables or functions — that will be used in this worker. If some dependencies get overlooked, the worker will throw \"[name] is not defined\".\n */\n const addDependencies_ = (getDependencies) => {\n mustNotHaveStopped();\n mustNotHaveStarted();\n // Non-TypeScript code argument validation.\n argumentMustBeFunction(getDependencies);\n getDependenciesFunctions.push(getDependencies);\n };\n // Starts the worker.\n const start = () => {\n mustNotHaveStopped();\n mustNotHaveStarted();\n // These dependencies can change before the function is started, but not after that.\n //\n // `createInputHandler()` is not supplied by the user, and it stays the same.\n // It's the same between any two \"streaming\" or non-\"streaming\" worker functions.\n //\n const getInitialDependencies = () => [\n fn,\n outputTransferList,\n createInputHandler\n ];\n addDependencies_(getInitialDependencies);\n started = true;\n worker.start(getDependenciesFunctions, dependenciesTransferList);\n };\n // Stops the worker.\n // Calling this function multiple times is normal and it won't produce any errors.\n const stop = () => {\n stopped = true;\n worker.stop();\n };\n // Sends input data to the worker.\n const sendToWorker = (inputArgs) => {\n worker.ingest([Date.now(), inputArgs], inputTransferList(...inputArgs));\n };\n // These two variables are defined here just to work around\n // TypeScript compiler error message.\n let inputLatency;\n let outputLatency;\n // Declare a worker function. It will be returned from this function.\n const workerFn = Object.assign({ inputLatency,\n outputLatency,\n /**\n * Adds external dependencies.\n * These dependencies must not change after the function is started.\n *\n * @param {function} getDependencies — A \"closure\" function that returns an array of dependencies — global variables or functions — that will be used in this worker. If some dependencies get overlooked, the worker will throw \"[name] is not defined\".\n */\n addDependencies(getDependencies) {\n mustNotHaveAlias();\n addDependencies_(getDependencies);\n }, \n // `transferList` for the arguments of the function.\n inputTransferList: (fn) => {\n mustNotHaveStopped();\n mustNotHaveStarted();\n mustNotHaveAlias();\n // Non-TypeScript code argument validation.\n argumentMustBeFunction(fn);\n inputTransferList = fn;\n }, \n // `transferList` for the result of the function.\n outputTransferList: (fn) => {\n mustNotHaveStopped();\n mustNotHaveStarted();\n mustNotHaveAlias();\n // Non-TypeScript code argument validation.\n argumentMustBeFunction(fn);\n outputTransferList = fn;\n }, \n // (optional) Enables caching.\n alias(alias_) {\n mustNotHaveStopped();\n mustNotHaveStarted();\n mustNotHaveAlias();\n alias = alias_;\n setInCache(alias, {\n $: [fn, getDependenciesFunctions, inputTransferList, outputTransferList]\n });\n },\n start,\n stop }, createMethods(start, stop, started, stopped, sendToWorker, mustHaveStarted, mustNotHaveStarted, mustNotHaveStopped));\n // Cache accessors for use in `createWorker`.\n const getOtherFromCache = () => {\n if (alias) {\n const properties = getFromCache(alias);\n if (properties) {\n return properties.other;\n }\n }\n };\n const setOtherInCache = (value) => {\n if (alias) {\n setInCache(alias, Object.assign(Object.assign({}, getFromCache(alias)), { other: value }));\n }\n };\n worker = createWorker(\n // Creates a worker in a specific environment such as a web browser or Node.js.\n createWorkerInEnvironment, \n // This function will be executed in the worker thread.\n // It will be stringified and injected in the worker source code.\n // It must create an input handler function.\n (\n // This function sends output from the worker thread to the main thread.\n sendOutput_) => {\n let inputSentTimestamp = 0;\n let inputReceivedTimestamp = 0;\n const sendOutput = (output) => {\n sendOutput_([inputSentTimestamp, inputReceivedTimestamp, Date.now(), output], outputTransferList(output));\n };\n const inputHandler = createInputHandler(fn, sendOutput);\n return ([inputSentAt, input]) => {\n inputSentTimestamp = inputSentAt;\n inputReceivedTimestamp = Date.now();\n return inputHandler(input);\n };\n }, \n // This function will be executed in the main thread\n // when an error is received from the worker.\n // Currently, we are in the main thread.\n (error) => {\n if (!stopped) {\n handleError(error);\n }\n }, \n // This function will be executed in the main thread\n // when output is received from the worker.\n // Currently, we are in the main thread.\n ([inputSentTimestamp, inputReceivedTimestamp, outputTimestamp, output]) => {\n if (!stopped) {\n workerFn.inputLatency = inputReceivedTimestamp - inputSentTimestamp;\n workerFn.outputLatency = Date.now() - outputTimestamp;\n handleOutput(output);\n }\n }, \n // Caching.\n getOtherFromCache, setOtherInCache);\n return workerFn;\n}\nconst CACHE = {};\n","import createWorkerFunction_ from \"./createWorkerFunction_.js\";\nexport default function createWorkerFunction(createWorkerInEnvironment, fnOrAlias) {\n // When the worker function returns a monolithic response,\n // use `resolveCall()`/`rejectCall()` functions to report the response to the main thread.\n // These functions will `resolve` or `reject` the `Promise` returned from `.call()` or `.callOnce()`.\n let resolveCall = undefined;\n let rejectCall = undefined;\n const createMethods = (start, stop, started, stopped, sendToWorker, mustHaveStarted, mustNotHaveStarted, mustNotHaveStopped) => ({\n // Calls the function. Could be used multiple times.\n call(...args) {\n mustNotHaveStopped();\n mustHaveStarted();\n if (resolveCall || rejectCall) {\n throw new Error('Previous call not finished');\n }\n // isStreamingFn = false\n return new Promise((resolve, reject) => {\n resolveCall = resolve;\n rejectCall = reject;\n sendToWorker(args);\n });\n },\n // Calls the function once.\n callOnce(...args) {\n start();\n return this.call(...args).finally(stop);\n }\n });\n // This function will be executed in the worker thread.\n // It will be stringified and injected in the worker source code.\n // Therefore, it should be a \"self-contained\" function,\n // i.e. it shouldn't reference anything outside of its body.\n const createInputHandler = (fn, send) => {\n const isPromise = (anything) => {\n return (anything !== null &&\n typeof anything === 'object' &&\n typeof anything.then === 'function');\n };\n return (args) => {\n const result = fn(...args);\n if (isPromise(result)) {\n result.then(send);\n }\n else {\n send(result);\n }\n };\n };\n // This function will be executed in the main thread.\n // Currently, we are in the main thread.\n const handleError = (error) => {\n if (rejectCall) {\n rejectCall(error);\n resolveCall = undefined;\n rejectCall = undefined;\n }\n else {\n throw new Error('`reject` callback not found');\n }\n };\n // This function will be executed in the main thread.\n // Currently, we are in the main thread.\n const handleOutput = (output) => {\n if (resolveCall) {\n resolveCall(output);\n resolveCall = undefined;\n rejectCall = undefined;\n }\n else {\n throw new Error('`resolve` callback not found');\n }\n };\n return createWorkerFunction_(createWorkerInEnvironment, fnOrAlias, createMethods, createInputHandler, handleError, handleOutput);\n}\n","// This source code was originally copy-pasted from `fflate`'s repository\n// and then refactored according to my personal taste. Also added comments.\n// https://github.com/101arrowz/fflate/blob/master/src/worker.ts\n/**\n * Creates a worker in a web browser.\n *\n * Defines a `var postMessage = (data, [transferList]) => ...` function.\n * Requires a `var onMessage = (data) => ...` function to be defined.\n *\n * @param {string} javascriptCode\n * @param {function} getFromCache — Could be used to add caching. Has no arguments. Returns the cached value.\n * @param {function} setInCache — Could be used to add caching. Receives the value to cache as an argument. Doesn't return anything.\n * @param {function} onError — This function will be called every time when there was an error while processing an incoming message. It would be logical to call `worker.terminate()` inside this function.\n * @param {function} onOutput — This function will be called every time when done processing an incoming message.\n * @returns {Worker} — An object with methods: `ingest(data, transferList)`, `stop()`.\n */\nexport default function createWorkerInBrowser(javascriptCode, getFromCache, setInCache, onError, onOutput) {\n // Worker's code URL — \"blob://...\"\n let url = getFromCache();\n if (!url) {\n url = createWorkerCodeUrl(javascriptCode);\n setInCache(url);\n }\n // Create a worker.\n const worker = new Worker(url);\n // A \"message\" event fires in the main thread (i.e. here) whenever the worker\n // sends a message to the main thread. Because this code is the main thread,\n // here it sets up a message listener to receive results from the worker.\n // Upon receiving a result (or an error) from the worker, it calls the `callback`.\n worker.onmessage = (event) => {\n const data = event.data;\n const errorData = data ? data[ERROR_MESSAGE_PROPERTY_NAME] : undefined;\n if (errorData) {\n const [name, message, code, stack] = errorData;\n const error = new Error(message);\n error.name = name; // This semicolon is required to prevent an error: \"name is not a function\" which is caused by an opening parenthesis on the next line.\n // `code` property doesn't exist on `Error` class\n // but it does exist in some of its subclasses.\n error.code = code;\n error.stack = stack;\n onError(error);\n // Terminate the worker thread to mimick Node.js's \"unrecoverable\" behavior.\n worker.terminate();\n }\n else {\n onOutput(data);\n }\n };\n return {\n // Calling `worker.terminate()` will kill the worker thread immediately.\n // Calling `worker.terminate()` multiple times is safe and will not throw any errors.\n stop: worker.terminate.bind(worker),\n ingest: worker.postMessage.bind(worker)\n };\n}\nfunction createWorkerCodeUrl(javascriptCode) {\n return URL.createObjectURL(new Blob([\n javascriptCode + ';' + JAVASCRIPT_CODE_ADDITIONAL\n ], { type: 'text/javascript' }));\n}\nconst ERROR_MESSAGE_PROPERTY_NAME = '$error$';\nconst JAVASCRIPT_CODE_ADDITIONAL = \n// Listen to incoming messages from the main thread.\n'self.onmessage = function(event) {' +\n 'onMessage(event.data)' +\n '}' + ';' +\n // Sends a message to the main thread.\n 'var postMessage = self.postMessage' + ';' +\n // Listen to any \"synchronous\" errors that occur inside the worker.\n 'addEventListener(\"error\",' +\n 'function(event) {' +\n 'var error = event.error' + ';' +\n // The worker will halt execution (unless `event.preventDefault()` is called).\n // The error will be propagated to the main thread's console.\n // Notify the main thread about this error so that it could call the `callback`.\n 'postMessage({' +\n ERROR_MESSAGE_PROPERTY_NAME + ':' + '[' +\n 'error.name' + ',' +\n 'error.message' + ',' +\n 'error.code' + ',' +\n 'error.stack' +\n ']' +\n '})' +\n '}' +\n ')' + ';' +\n // Listen to any \"asynchronous\" errors that occur inside the worker.\n 'addEventListener(\"unhandledrejection\",' +\n 'function(event) {' +\n // Prevent the default logging behavior in the browser console.\n 'event.preventDefault()' + ';' +\n // Get the `error` instance.\n 'var error = event.reason instanceof Error ? event.reason : new Error(event.reason)' + ';' +\n // The worker will halt execution (unless `event.preventDefault()` is called).\n // The error will be propagated to the main thread's console.\n // Notify the main thread about this error so that it could call the `callback`.\n 'postMessage({' +\n ERROR_MESSAGE_PROPERTY_NAME + ':' + '[' +\n 'error.name' + ',' +\n 'error.message' + ',' +\n 'error.code' + ',' +\n 'error.stack' +\n ']' +\n '})' +\n '}' +\n ')';\n","import createWorkerFunction from \"../../createWorkerFunction.js\";\nimport createWorkerInBrowser from \"../../environment/createWorkerInBrowser.js\";\nexport default function createWorkerFunctionInBrowser(fnOrAlias) {\n return createWorkerFunction(createWorkerInBrowser, fnOrAlias);\n}\n","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\n// See `README.md` for more info\n\nexport default function Parser_(options) {\n // `decode.js` file contents\n\n var fromCharCode = String.fromCharCode;\n var hasOwnProperty = Object.prototype.hasOwnProperty;\n var ENTITY_PATTERN = /&#(\\d+);|&#x([0-9a-f]+);|&(\\w+);/ig;\n var ENTITY_MAPPING = {\n 'amp': '&',\n 'apos': '\\'',\n 'gt': '>',\n 'lt': '<',\n 'quot': '\"'\n };\n\n // map UPPERCASE variants of supported special chars\n Object.keys(ENTITY_MAPPING).forEach(function (k) {\n ENTITY_MAPPING[k.toUpperCase()] = ENTITY_MAPPING[k];\n });\n function replaceEntities(_, d, x, z) {\n // reserved names, i.e. \n if (z) {\n if (hasOwnProperty.call(ENTITY_MAPPING, z)) {\n return ENTITY_MAPPING[z];\n } else {\n // fall back to original value\n return '&' + z + ';';\n }\n }\n\n // decimal encoded char\n if (d) {\n return fromCharCode(d);\n }\n\n // hex encoded char\n return fromCharCode(parseInt(x, 16));\n }\n\n /**\r\n * A basic entity decoder that can decode a minimal\r\n * sub-set of reserved names (&) as well as\r\n * hex (ય) and decimal (ӏ) encoded characters.\r\n *\r\n * @param {string} s\r\n *\r\n * @return {string} decoded string\r\n */\n function decodeEntities(s) {\n if (s.length > 3 && s.indexOf('&') !== -1) {\n return s.replace(ENTITY_PATTERN, replaceEntities);\n }\n return s;\n }\n\n // `parser.js` file contents\n\n var NON_WHITESPACE_OUTSIDE_ROOT_NODE = 'non-whitespace outside of root node';\n function error(msg) {\n return new Error(msg);\n }\n function missingNamespaceForPrefix(prefix) {\n return 'missing namespace for prefix <' + prefix + '>';\n }\n function getter(getFn) {\n return {\n 'get': getFn,\n 'enumerable': true\n };\n }\n function cloneNsMatrix(nsMatrix) {\n var clone = {},\n key;\n for (key in nsMatrix) {\n clone[key] = nsMatrix[key];\n }\n return clone;\n }\n\n // per-matrix element name cache; stored under a symbol so it is\n // invisible to the `for (key in nsMatrix)` clone above and gets\n // collected together with the matrix it belongs to\n var NAME_CACHE = Symbol('nameCache');\n function uriPrefix(prefix) {\n return prefix + '$uri';\n }\n function buildNsMatrix(nsUriToPrefix) {\n var nsMatrix = {},\n uri,\n prefix;\n for (uri in nsUriToPrefix) {\n prefix = nsUriToPrefix[uri];\n nsMatrix[prefix] = prefix;\n nsMatrix[uriPrefix(prefix)] = uri;\n }\n return nsMatrix;\n }\n function noopGetContext() {\n return {\n line: 0,\n column: 0\n };\n }\n function throwFunc(err) {\n throw err;\n }\n\n /**\r\n * Creates a new parser with the given options.\r\n *\r\n * @constructor\r\n *\r\n * @param {!Object<string, ?>=} options\r\n */\n function Parser(options) {\n if (!this) {\n return new Parser(options);\n }\n var proxy = options && options['proxy'];\n var onText,\n onOpenTag,\n onCloseTag,\n onCDATA,\n onError = throwFunc,\n onWarning,\n onComment,\n onQuestion,\n onAttention;\n var getContext = noopGetContext;\n\n /**\r\n * Are we currently consuming a chunked stream of XML,\r\n * i.e. is a `write` call in progress that may be followed\r\n * by more chunks?\r\n *\r\n * @type {boolean}\r\n */\n var streaming = false;\n\n /**\r\n * Did we already encounter the root tag?\r\n *\r\n * Persisted across `write` calls so we can detect a missing\r\n * start tag once the stream ends.\r\n *\r\n * @type {boolean}\r\n */\n var rootTagFound = false;\n\n /**\r\n * Not yet parsed remainder of the previously written chunk,\r\n * i.e. an incomplete token that awaits more input.\r\n *\r\n * @type {string}\r\n */\n var leftoverXml = '';\n\n /**\r\n * Do we need to parse the current elements attributes for namespaces?\r\n *\r\n * @type {boolean}\r\n */\n var maybeNS = false;\n\n /**\r\n * Do we process namespaces at all?\r\n *\r\n * @type {boolean}\r\n */\n var isNamespace = false;\n\n /**\r\n * The caught error returned on parse end\r\n *\r\n * @type {Error}\r\n */\n var returnError = null;\n\n /**\r\n * Should we stop parsing?\r\n *\r\n * @type {boolean}\r\n */\n var parseStop = false;\n\n /**\r\n * Namespace + node state shared across (streamed) parse runs.\r\n */\n var nsMatrixStack, nsMatrix, nodeStack;\n\n /**\r\n * A map of { uri: prefix } used by the parser.\r\n *\r\n * This map will ensure we can normalize prefixes during processing;\r\n * for each uri, only one prefix will be exposed to the handlers.\r\n *\r\n * @type {!Object<string, string>}}\r\n */\n var nsUriToPrefix;\n\n /**\r\n * Handle parse error.\r\n *\r\n * @param {string|Error} err\r\n */\n function handleError(err) {\n if (!(err instanceof Error)) {\n err = error(err);\n }\n returnError = err;\n onError(err, getContext);\n }\n\n /**\r\n * Handle parse error.\r\n *\r\n * @param {string|Error} err\r\n */\n function handleWarning(err) {\n if (!onWarning) {\n return;\n }\n if (!(err instanceof Error)) {\n err = error(err);\n }\n onWarning(err, getContext);\n }\n\n /**\r\n * Register parse listener.\r\n *\r\n * @param {string} name\r\n * @param {Function} cb\r\n *\r\n * @return {Parser}\r\n */\n this['on'] = function (name, cb) {\n if (typeof cb !== 'function') {\n throw error('required args <name, cb>');\n }\n switch (name) {\n case 'openTag':\n onOpenTag = cb;\n break;\n case 'text':\n onText = cb;\n break;\n case 'closeTag':\n onCloseTag = cb;\n break;\n case 'error':\n onError = cb;\n break;\n case 'warn':\n onWarning = cb;\n break;\n case 'cdata':\n onCDATA = cb;\n break;\n case 'attention':\n onAttention = cb;\n break;\n // <!XXXXX zzzz=\"eeee\">\n case 'question':\n onQuestion = cb;\n break;\n // <? .... ?>\n case 'comment':\n onComment = cb;\n break;\n default:\n throw error('unsupported event: ' + name);\n }\n return this;\n };\n\n /**\r\n * Set the namespace to prefix mapping.\r\n *\r\n * @example\r\n *\r\n * parser.ns({\r\n * 'http://foo': 'foo',\r\n * 'http://bar': 'bar'\r\n * });\r\n *\r\n * @param {!Object<string, string>} nsMap\r\n *\r\n * @return {Parser}\r\n */\n this['ns'] = function (nsMap) {\n if (typeof nsMap === 'undefined') {\n nsMap = {};\n }\n if (_typeof(nsMap) !== 'object') {\n throw error('required args <nsMap={}>');\n }\n var _nsUriToPrefix = {},\n k;\n for (k in nsMap) {\n _nsUriToPrefix[k] = nsMap[k];\n }\n isNamespace = true;\n nsUriToPrefix = _nsUriToPrefix;\n return this;\n };\n\n /**\r\n * Reset the parser state before a (streamed) parse run.\r\n */\n function resetState() {\n nsMatrixStack = isNamespace ? [] : null;\n nsMatrix = isNamespace ? buildNsMatrix(nsUriToPrefix) : null;\n nodeStack = [];\n getContext = noopGetContext;\n parseStop = false;\n returnError = null;\n rootTagFound = false;\n leftoverXml = '';\n }\n\n /**\r\n * Parse a complete xml string.\r\n *\r\n * @param {string} xml\r\n *\r\n * @return {Error} returnError, if not thrown\r\n */\n this['parse'] = function (xml) {\n if (typeof xml !== 'string') {\n throw error('required args <xml=string>');\n }\n if (streaming) {\n throw error('parse during stream; call end() first');\n }\n resetState();\n parse(xml);\n getContext = noopGetContext;\n parseStop = false;\n return returnError;\n };\n\n /**\r\n * Write the next chunk of a streamed xml string.\r\n *\r\n * Parse events are emitted for all complete tokens; an\r\n * incomplete trailing token is buffered until the next\r\n * `write` or, ultimately, reported as an error on `end`.\r\n *\r\n * @param {string} xml\r\n *\r\n * @return {Parser} self\r\n */\n this['write'] = function (xml) {\n if (typeof xml !== 'string') {\n throw error('required args <xml=string>');\n }\n if (!streaming) {\n resetState();\n streaming = true;\n }\n if (!returnError) {\n leftoverXml = parse(leftoverXml + xml, true) || '';\n }\n return this;\n };\n\n /**\r\n * Finish parsing a streamed xml string, i.e. signal that\r\n * no more chunks will be written.\r\n *\r\n * @return {Error} returnError, if not thrown\r\n */\n this['end'] = function () {\n if (!streaming) {\n resetState();\n }\n\n // flush the buffered remainder, now treating an incomplete\n // trailing token as a hard error\n streaming = false;\n if (!returnError) {\n parse(leftoverXml);\n }\n leftoverXml = '';\n getContext = noopGetContext;\n parseStop = false;\n return returnError;\n };\n\n /**\r\n * Stop parsing.\r\n */\n this['stop'] = function () {\n parseStop = true;\n };\n\n /**\r\n * Parse string, invoking configured listeners on element.\r\n *\r\n * Namespace and node stack state is shared across (streamed)\r\n * invocations via the enclosing parser scope.\r\n *\r\n * Internal note: while `streaming`, an incomplete trailing token\r\n * is not treated as an error but returned so `write` can buffer it\r\n * and prepend it to the next chunk. This buffered remainder is an\r\n * implementation detail of the streaming buffer, not a public API;\r\n * outside of that case the return value is `undefined`.\r\n *\r\n * @param {string} xml\r\n * @param {boolean} streaming\r\n *\r\n * @return {string|undefined} buffered remainder, streaming internal use only\r\n */\n function parse(xml) {\n var streaming = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var elNameCache = null,\n elNameCacheMatrix = null;\n var _nsMatrix,\n anonymousNsCount = 0,\n tagStart = false,\n tagEnd = false,\n i = 0,\n j = 0,\n x,\n y,\n q,\n w,\n v,\n xmlns,\n elementName,\n _elementName,\n elementProxy;\n var attrsString = '',\n attrsStart = 0,\n cachedAttrs // false = parsed with errors, null = needs parsing\n ;\n\n /**\r\n * Normalize a namespaced attribute name against the current\r\n * namespace matrix.\r\n *\r\n * @param {string} name\r\n * @param {string|boolean} defaultAlias\r\n *\r\n * @return {string|null} normalized name, or `null` when the prefix\r\n * has no namespace (a warning is emitted)\r\n */\n function normalizeAttrName(name, defaultAlias) {\n var w = name.indexOf(':');\n if (w === -1) {\n return name;\n }\n\n // normalize ns attribute name\n var nsName = nsMatrix[name.substring(0, w)];\n if (!nsName) {\n handleWarning(missingNamespaceForPrefix(name.substring(0, w)));\n return null;\n }\n return defaultAlias === nsName ? name.substr(w + 1) : nsName + name.substr(w);\n }\n\n /**\r\n * Parse attributes on demand and returns the parsed attributes.\r\n *\r\n * Return semantics: (1) `false` on attribute parse error,\r\n * (2) object hash on extracted attrs.\r\n *\r\n * @return {boolean|Object}\r\n */\n function getAttrs() {\n if (cachedAttrs !== null) {\n return cachedAttrs;\n }\n var nsUri,\n nsUriPrefix,\n defaultAlias = isNamespace && nsMatrix['xmlns'],\n attrList = isNamespace && maybeNS ? [] : null,\n i = attrsStart,\n s = attrsString,\n l = s.length,\n hasNewMatrix,\n newalias,\n value,\n alias,\n name,\n attrs = {},\n seenAttrs = new Set(),\n skipAttr,\n w,\n j;\n parseAttr: for (; i < l; i++) {\n skipAttr = false;\n w = s.charCodeAt(i);\n if (w === 32 || w < 14 && w > 8) {\n // WHITESPACE={ \\f\\n\\r\\t\\v}\n continue;\n }\n\n // wait for non whitespace character\n if (w < 65 || w > 122 || w > 90 && w < 97) {\n if (w !== 95 && w !== 58) {\n // char 95\"_\" 58\":\"\n handleWarning('illegal first char attribute name');\n skipAttr = true;\n }\n }\n\n // parse attribute name\n for (j = i + 1; j < l; j++) {\n w = s.charCodeAt(j);\n if (w > 96 && w < 123 || w > 64 && w < 91 || w > 47 && w < 59 || w === 46 ||\n // '.'\n w === 45 ||\n // '-'\n w === 95 // '_'\n ) {\n continue;\n }\n\n // unexpected whitespace\n if (w === 32 || w < 14 && w > 8) {\n // WHITESPACE\n handleWarning('missing attribute value');\n i = j;\n continue parseAttr;\n }\n\n // expected \"=\"\n if (w === 61) {\n // \"=\" == 61\n break;\n }\n handleWarning('illegal attribute name char');\n skipAttr = true;\n }\n name = s.substring(i, j);\n if (name === 'xmlns:xmlns') {\n handleWarning('illegal declaration of xmlns');\n skipAttr = true;\n }\n w = s.charCodeAt(j + 1);\n if (w === 34) {\n // '\"'\n j = s.indexOf('\"', i = j + 2);\n if (j === -1) {\n j = s.indexOf('\\'', i);\n if (j !== -1) {\n handleWarning('attribute value quote missmatch');\n skipAttr = true;\n }\n }\n } else if (w === 39) {\n // \"'\"\n j = s.indexOf('\\'', i = j + 2);\n if (j === -1) {\n j = s.indexOf('\"', i);\n if (j !== -1) {\n handleWarning('attribute value quote missmatch');\n skipAttr = true;\n }\n }\n } else {\n handleWarning('missing attribute value quotes');\n skipAttr = true;\n\n // skip to next space\n for (j = j + 1; j < l; j++) {\n w = s.charCodeAt(j + 1);\n if (w === 32 || w < 14 && w > 8) {\n // WHITESPACE\n break;\n }\n }\n }\n if (j === -1) {\n handleWarning('missing closing quotes');\n j = l;\n skipAttr = true;\n }\n if (!skipAttr) {\n value = s.substring(i, j);\n }\n i = j;\n\n // ensure SPACE follows attribute\n // skip illegal content otherwise\n // example a=\"b\"c\n for (; j + 1 < l; j++) {\n w = s.charCodeAt(j + 1);\n if (w === 32 || w < 14 && w > 8) {\n // WHITESPACE\n break;\n }\n\n // FIRST ILLEGAL CHAR\n if (i === j) {\n handleWarning('illegal character after attribute end');\n skipAttr = true;\n }\n }\n\n // advance cursor to next attribute\n i = j + 1;\n if (skipAttr) {\n continue parseAttr;\n }\n\n // check attribute re-declaration\n if (seenAttrs.has(name)) {\n handleWarning('attribute <' + name + '> already defined');\n continue;\n }\n seenAttrs.add(name);\n if (!isNamespace) {\n attrs[name] = value;\n continue;\n }\n\n // try to extract namespace information\n if (maybeNS) {\n newalias = name === 'xmlns' ? 'xmlns' : name.charCodeAt(0) === 120 && name.substr(0, 6) === 'xmlns:' ? name.substr(6) : null;\n\n // handle xmlns(:alias) assignment\n if (newalias !== null) {\n nsUri = decodeEntities(value);\n nsUriPrefix = uriPrefix(newalias);\n alias = nsUriToPrefix[nsUri];\n if (!alias) {\n // no prefix defined or prefix collision\n if (newalias === 'xmlns' || nsUriPrefix in nsMatrix && nsMatrix[nsUriPrefix] !== nsUri) {\n // alocate free ns prefix\n do {\n alias = 'ns' + anonymousNsCount++;\n } while (typeof nsMatrix[alias] !== 'undefined');\n } else {\n alias = newalias;\n }\n nsUriToPrefix[nsUri] = alias;\n }\n if (nsMatrix[newalias] !== alias) {\n if (!hasNewMatrix) {\n nsMatrix = cloneNsMatrix(nsMatrix);\n hasNewMatrix = true;\n }\n nsMatrix[newalias] = alias;\n if (newalias === 'xmlns') {\n nsMatrix[uriPrefix(alias)] = nsUri;\n defaultAlias = alias;\n }\n nsMatrix[nsUriPrefix] = nsUri;\n }\n\n // expose xmlns(:asd)=\"...\" in attributes\n attrs[name] = value;\n continue;\n }\n\n // collect attributes until all namespace\n // declarations are processed\n attrList.push(name, value);\n continue;\n } /** end if (maybeNs) */\n\n // handle attributes on element without\n // namespace declarations\n name = normalizeAttrName(name, defaultAlias);\n if (name === null) {\n continue;\n }\n attrs[name] = value;\n }\n\n // handle deferred, possibly namespaced attributes\n if (maybeNS) {\n // normalize captured attributes\n for (i = 0, l = attrList.length; i < l; i++) {\n name = normalizeAttrName(attrList[i++], defaultAlias);\n value = attrList[i];\n if (name === null) {\n continue;\n }\n attrs[name] = value;\n }\n\n // end: normalize captured attributes\n }\n\n return cachedAttrs = attrs;\n }\n\n /**\r\n * Extract the parse context { line, column, part }\r\n * from the current parser position.\r\n *\r\n * @return {Object} parse context\r\n */\n function getParseContext() {\n var splitsRe = /(\\r\\n|\\r|\\n)/g;\n var line = 0;\n var column = 0;\n var startOfLine = 0;\n var endOfLine = j;\n var match;\n var data;\n while (i >= startOfLine) {\n match = splitsRe.exec(xml);\n if (!match) {\n break;\n }\n\n // end of line = (break idx + break chars)\n endOfLine = match[0].length + match.index;\n if (endOfLine > i) {\n break;\n }\n\n // advance to next line\n line += 1;\n startOfLine = endOfLine;\n }\n\n // EOF errors\n if (i == -1) {\n column = endOfLine;\n data = xml.substring(j);\n } else\n // start errors\n if (j === 0) {\n data = xml.substring(j, i);\n }\n\n // other errors\n else {\n column = i - startOfLine;\n data = j == -1 ? xml.substring(i) : xml.substring(i, j + 1);\n }\n return {\n 'data': data,\n 'line': line,\n 'column': column\n };\n }\n getContext = getParseContext;\n if (proxy) {\n elementProxy = Object.create({}, {\n 'name': getter(function () {\n return elementName;\n }),\n 'originalName': getter(function () {\n return _elementName;\n }),\n 'attrs': getter(getAttrs),\n 'ns': getter(function () {\n return nsMatrix;\n })\n });\n }\n\n // actual parse logic\n while (j !== -1) {\n if (xml.charCodeAt(j) === 60) {\n // \"<\"\n i = j;\n } else {\n i = xml.indexOf('<', j);\n }\n\n // no (more) tags found\n if (i === -1) {\n // buffer the remainder for the next chunk\n if (streaming) {\n return xml.substring(j);\n }\n if (nodeStack.length) {\n return handleError('unexpected end of file');\n }\n if (!rootTagFound) {\n return handleError('missing start tag');\n }\n if (j < xml.length) {\n if (xml.substring(j).trim()) {\n handleWarning(NON_WHITESPACE_OUTSIDE_ROOT_NODE);\n }\n }\n return;\n }\n\n // remember that we saw the root tag\n if (!rootTagFound) {\n rootTagFound = true;\n }\n\n // parse text\n if (j !== i) {\n if (nodeStack.length) {\n if (onText) {\n onText(xml.substring(j, i), decodeEntities, getContext);\n if (parseStop) {\n return;\n }\n }\n } else {\n if (xml.substring(j, i).trim()) {\n handleWarning(NON_WHITESPACE_OUTSIDE_ROOT_NODE);\n if (parseStop) {\n return;\n }\n }\n }\n }\n w = xml.charCodeAt(i + 1);\n\n // parse comments + CDATA\n if (w === 33) {\n // \"!\"\n q = xml.charCodeAt(i + 2);\n\n // CDATA section\n if (q === 91 && xml.substr(i + 3, 6) === 'CDATA[') {\n // 91 == \"[\"\n j = xml.indexOf(']]>', i);\n if (j === -1) {\n if (streaming) {\n return xml.substring(i);\n }\n return handleError('unclosed cdata');\n }\n if (onCDATA) {\n onCDATA(xml.substring(i + 9, j), getContext);\n if (parseStop) {\n return;\n }\n }\n j += 3;\n continue;\n }\n\n // comment\n if (q === 45 && xml.charCodeAt(i + 3) === 45) {\n // 45 == \"-\"\n j = xml.indexOf('-->', i);\n if (j === -1) {\n if (streaming) {\n return xml.substring(i);\n }\n return handleError('unclosed comment');\n }\n if (onComment) {\n onComment(xml.substring(i + 4, j), decodeEntities, getContext);\n if (parseStop) {\n return;\n }\n }\n j += 3;\n continue;\n }\n }\n\n // parse question <? ... ?>\n if (w === 63) {\n // \"?\"\n j = xml.indexOf('?>', i);\n if (j === -1) {\n if (streaming) {\n return xml.substring(i);\n }\n return handleError('unclosed question');\n }\n if (onQuestion) {\n onQuestion(xml.substring(i, j + 2), getContext);\n if (parseStop) {\n return;\n }\n }\n j += 2;\n continue;\n }\n\n // find matching closing tag for attention or standard tags\n // for that we must skip through attribute values\n // (enclosed in single or double quotes)\n for (x = i + 1;; x++) {\n v = xml.charCodeAt(x);\n if (isNaN(v)) {\n if (streaming) {\n return xml.substring(i);\n }\n j = -1;\n return handleError('unclosed tag');\n }\n\n // [10] AttValue ::= '\"' ([^<&\"] | Reference)* '\"' | \"'\" ([^<&'] | Reference)* \"'\"\n // skips the quoted string\n // (double quotes) does not appear in a literal enclosed by (double quotes)\n // (single quote) does not appear in a literal enclosed by (single quote)\n if (v === 34) {\n // '\"'\n q = xml.indexOf('\"', x + 1);\n x = q !== -1 ? q : x;\n } else if (v === 39) {\n // \"'\"\n q = xml.indexOf(\"'\", x + 1);\n x = q !== -1 ? q : x;\n } else if (v === 62) {\n // '>'\n j = x;\n break;\n }\n }\n\n // parse attention <! ...>\n // previously comment and CDATA have already been parsed\n if (w === 33) {\n // \"!\"\n\n if (onAttention) {\n onAttention(xml.substring(i, j + 1), decodeEntities, getContext);\n if (parseStop) {\n return;\n }\n }\n j += 1;\n continue;\n }\n\n // don't process attributes;\n // there are none\n cachedAttrs = {};\n\n // if (xml.charCodeAt(i+1) === 47) { // </...\n if (w === 47) {\n // </...\n tagStart = false;\n tagEnd = true;\n if (!nodeStack.length) {\n return handleError('missing open tag');\n }\n\n // verify open <-> close tag match\n x = elementName = nodeStack.pop();\n q = i + 2 + x.length;\n if (xml.substring(i + 2, q) !== x) {\n return handleError('closing tag mismatch');\n }\n\n // verify chars in close tag\n for (; q < j; q++) {\n w = xml.charCodeAt(q);\n if (w === 32 || w > 8 && w < 14) {\n // \\f\\n\\r\\t\\v space\n continue;\n }\n return handleError('close tag');\n }\n } else {\n if (xml.charCodeAt(j - 1) === 47) {\n // .../>\n x = elementName = xml.substring(i + 1, j - 1);\n tagStart = true;\n tagEnd = true;\n } else {\n x = elementName = xml.substring(i + 1, j);\n tagStart = true;\n tagEnd = false;\n }\n if (!(w > 96 && w < 123 || w > 64 && w < 91 || w === 95 || w === 58)) {\n // char 95\"_\" 58\":\"\n return handleError('illegal first char nodeName');\n }\n for (q = 1, y = x.length; q < y; q++) {\n w = x.charCodeAt(q);\n if (w > 96 && w < 123 || w > 64 && w < 91 || w > 47 && w < 59 || w === 45 || w === 95 || w == 46) {\n continue;\n }\n if (w === 32 || w < 14 && w > 8) {\n // \\f\\n\\r\\t\\v space\n elementName = x.substring(0, q);\n\n // maybe there are attributes\n cachedAttrs = null;\n break;\n }\n return handleError('invalid nodeName');\n }\n if (!tagEnd) {\n nodeStack.push(elementName);\n }\n }\n if (isNamespace) {\n _nsMatrix = nsMatrix;\n if (tagStart) {\n // remember old namespace\n // unless we're self-closing\n if (!tagEnd) {\n nsMatrixStack.push(_nsMatrix);\n }\n if (cachedAttrs === null) {\n // quick check, whether there may be namespace\n // declarations on the node; if that is the case\n // we need to eagerly parse the node attributes\n if (maybeNS = x.indexOf('xmlns', q) !== -1) {\n attrsStart = q;\n attrsString = x;\n getAttrs();\n maybeNS = false;\n }\n }\n }\n _elementName = elementName;\n\n // memoize normalized names per namespace matrix; tag names\n // typically repeat heavily and the matrix rarely changes.\n if (elNameCacheMatrix !== nsMatrix) {\n elNameCache = nsMatrix[NAME_CACHE];\n if (elNameCache === undefined) {\n elNameCache = nsMatrix[NAME_CACHE] = {};\n }\n elNameCacheMatrix = nsMatrix;\n }\n var _cachedName = elNameCache[elementName];\n if (_cachedName !== undefined) {\n elementName = _cachedName;\n } else {\n w = elementName.indexOf(':');\n if (w !== -1) {\n xmlns = nsMatrix[elementName.substring(0, w)];\n\n // prefix given; namespace must exist\n if (!xmlns) {\n return handleError('missing namespace on <' + _elementName + '>');\n }\n elementName = elementName.substr(w + 1);\n } else {\n xmlns = nsMatrix['xmlns'];\n\n // if no default namespace is defined,\n // we'll import the element as anonymous.\n //\n // it is up to users to correct that to the document defined\n // targetNamespace, or whatever their undersanding of the\n // XML spec mandates.\n }\n\n // adjust namespace prefixs as configured\n if (xmlns) {\n elementName = xmlns + ':' + elementName;\n }\n elNameCache[_elementName] = elementName;\n }\n }\n if (tagStart) {\n attrsStart = q;\n attrsString = x;\n if (onOpenTag) {\n if (proxy) {\n onOpenTag(elementProxy, decodeEntities, tagEnd, getContext);\n } else {\n onOpenTag(elementName, getAttrs, decodeEntities, tagEnd, getContext);\n }\n if (parseStop) {\n return;\n }\n }\n }\n if (tagEnd) {\n if (onCloseTag) {\n onCloseTag(proxy ? elementProxy : elementName, decodeEntities, tagStart, getContext);\n if (parseStop) {\n return;\n }\n }\n\n // restore old namespace\n if (isNamespace) {\n if (!tagStart) {\n nsMatrix = nsMatrixStack.pop();\n } else {\n nsMatrix = _nsMatrix;\n }\n }\n }\n j += 1;\n }\n } /** end parse */\n }\n\n return new Parser(options);\n}\n//# sourceMappingURL=parser.js.map","// Starting from version `11.x`, `saxen` dropped CommonJS export.\n// CommonJS compatibility was requested by one of the users of this package:\n// https://gitlab.com/catamphetamine/read-excel-file/-/work_items/115\n// Because of that, `saxen` source code had to be copy-pasted.\n//\n// Not to mention that it would have to be copy-pasted anyway for compatiblity with `worker-f`\n// because `Parser` is not a \"self-contained\" function.\n//\n// import { Parser } from 'saxen'\nimport Parser from '../saxen/parser.js';\n\n/**\r\n * Parses XML markup in a streaming fashion by calling the supplied callback functions as the XML markup is being input.\r\n * @param {any} state — The initial `state`. This `state` will supposedly be modified by the callback functions as the XML is being parsed.\r\n * @param {function} [onOpenTag]\r\n * @param {function} [onCloseTag]\r\n * @param {function} [onText]\r\n * @returns {object} An object with properties: `promise`, `write(string)`, `end()`. The `promise` resolves with nothing.\r\n */\nexport default function parseXmlStream(state, onOpenTag, onCloseTag, onText) {\n var errored = false;\n var mustNotHaveErrored = function mustNotHaveErrored() {\n if (errored) {\n // If this error is thrown then it means that there's a bug in the code\n // because the code should not have got here if the XML parsing process\n // has already errored.\n throw new Error('Errored');\n }\n };\n var resolvePromise;\n var xmlns = true;\n\n // `proxy: true` option enables \"proxy\" mode.\n //\n // In \"proxy\" mode, `onopentag` and `onclosetag` receive slightly different arguments:\n // * element name is replaced with element object\n // * getAttribute() function is not passed\n //\n var parser = new Parser({\n proxy: true\n });\n\n // Parse XML \"namespaces\" (`xmlns` stuff).\n if (xmlns) {\n parser.ns();\n }\n var write = function write(xml) {\n mustNotHaveErrored();\n parser.write(xml);\n };\n var end = function end() {\n mustNotHaveErrored();\n parser.end();\n resolvePromise();\n };\n\n // This `promise` resolves with the final `state` when finished parsing.\n var promise = new Promise(function (resolve, reject) {\n resolvePromise = resolve;\n\n // on XML parsing error\n var onerror = function onerror(error) {\n errored = true;\n // If the error is not re-thrown here, the parser will simply keep parsing,\n // i.e. it doesn't halt after encountering an error and doesn't require manual resuming.\n // So it must re-throw the error here in order for the parser to stop.\n // Because the error is thrown inside a `new Promise()` constructor,\n // the promise will reject automatically.\n throw error;\n };\n\n // got some text. `text` is the string of text.\n var ontext = function ontext(text, decodeEntities) {\n if (onText) {\n // `saxen` doesn't decode character references (`é`, `&`, etc) in text:\n // instead, it provides a `decodeEntities()` function for the consumer to call.\n onText(decodeEntities(text), state);\n }\n };\n\n // opened a tag. `node` has \"name\" and \"attributes\"\n var onopentag = function onopentag(element, decodeEntities, selfClosing, getContext) {\n if (onOpenTag) {\n // `saxen` doesn't decode character references (`é`, `&`, etc)\n // in attribute values either, so decode them here.\n var attributes = element.attrs;\n for (var name in attributes) {\n attributes[name] = decodeEntities(attributes[name]);\n }\n // * `element.originalName` — The tag name as written in the XML string, retaining the original prefix regardless of the list of pre-configured namespace mappings.\n // * `element.name` — The tag name with the namespace prefix resolved against the list of pre-configured namespace mappings. I.e. the namespace prefix will potentially be replaced with one from the pre-configured namespace map.\n onOpenTag(xmlns ? trimXmlnsPrefix(element.originalName) : element.name, attributes, state);\n }\n };\n\n // closed a tag.\n var onclosetag = function onclosetag(element) {\n if (onCloseTag) {\n // * `element.originalName` — The tag name as written in the XML string, retaining the original prefix regardless of the list of pre-configured namespace mappings.\n // * `element.name` — The tag name with the namespace prefix resolved against the list of pre-configured namespace mappings. I.e. the namespace prefix will potentially be replaced with one from the pre-configured namespace map.\n var tagName = xmlns ? trimXmlnsPrefix(element.originalName) : element.name;\n onCloseTag(tagName, state);\n }\n };\n parser.on('error', onerror);\n parser.on('text', ontext);\n parser.on('openTag', onopentag);\n parser.on('closeTag', onclosetag);\n });\n return {\n promise: promise,\n write: write,\n end: end\n };\n}\nvar TAG_NAME_PREFIX = /.+:/;\nfunction trimXmlnsPrefix(tagName) {\n return tagName.replace(TAG_NAME_PREFIX, '');\n}\n//# sourceMappingURL=parseXmlStream.saxen.js.map","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar InvalidSpreadsheetError = /*#__PURE__*/function (_Error) {\n _inherits(InvalidSpreadsheetError, _Error);\n var _super = _createSuper(InvalidSpreadsheetError);\n function InvalidSpreadsheetError(message) {\n var _this;\n _classCallCheck(this, InvalidSpreadsheetError);\n _this = _super.call(this, message);\n\n // Set `name` property.\n //\n // This error could be detected either by `instanceof InvalidInputError`\n // or by comparing its `name` property value to \"InvalidInputError\".\n // Why use the `name` comparison when `instanceof` operator is available?\n // Google AI tells that it does make sense in the cases when an error is\n // \"serialized\" and then \"deserialized\" in a \"distributed\" environment such as\n // throwing an error in a worker thread and then handling it in a main thread,\n // or when throwing it in one \"microservice\" and then catching it in another one,\n // or just logging as in `sentry.io`. And in those cases, `error.constructor.name`\n // isn't always available for same reason of \"serializing\" and then \"deserializing\".\n //\n // For example, even if `InvalidInputError` is a named export of this package,\n // when later bunding the application code with a bundler it will still be minified and renamed.\n // That's when the `name` property could be used to find out the actual type of the error\n // in case it gets thrown and reported to a remote system like `sentry.io`.\n //\n // By the way, core Node.js errors themselves have a `name` property.\n //\n _this.name = 'InvalidSpreadsheetError';\n return _this;\n }\n return _createClass(InvalidSpreadsheetError);\n}( /*#__PURE__*/_wrapNativeSuper(Error));\nexport { InvalidSpreadsheetError as default };\n//# sourceMappingURL=InvalidSpreadsheetError.js.map","import parseXmlStream from './parseXmlStream.js';\nimport InvalidSpreadsheetError from '../xlsx/InvalidSpreadsheetError.js';\n\n/**\r\n * Parses XML markup by calling the supplied callback functions.\r\n * @param {string} xml\r\n * @param {any} state — The initial `state`. This `state` will supposedly be modified by the callback functions as the XML is being parsed.\r\n * @param {function} [onOpenTag]\r\n * @param {function} [onCloseTag]\r\n * @param {function} [onText]\r\n * @param {function} [onProgress] — If defined, will be called every time it finishes parsing yet another chunk of XML.\r\n * @returns {Promise<void>} Returns a `Promise` that resolves to nothing. Inspect the passed `state` argument for changes.\r\n */\nexport default function parseXml(xml, state, onOpenTag, onCloseTag, onText, onProgress) {\n var parser = parseXmlStream(state, onOpenTag, onCloseTag, onText);\n if (onProgress) {\n parseXmlInChunks(parser, xml, onProgress);\n } else {\n // Parse XML \"all at once\"\n parser.write(xml);\n parser.end();\n }\n return parser.promise.then(function (result) {\n return result;\n }, function (error) {\n // If the error is not re-thrown here, the parser will simply keep parsing,\n // i.e. it doesn't halt after encountering an error and doesn't require manual resuming.\n // So it must re-throw the error here in order for the parser to stop.\n // Because the error is thrown inside a `new Promise()` constructor,\n // the promise will reject automatically.\n var spreadsheetError = new InvalidSpreadsheetError(error.message);\n spreadsheetError.stack = error.stack;\n spreadsheetError.cause = error;\n throw spreadsheetError;\n });\n\n // This function is placed here inside the wrapper function body\n // in order to not to hav `worker-f`\n /**\r\n * Parses XML in chunks.\r\n * @param {object} parser — An object returned from `parseXmlStream()` function.\r\n * @param {string} xml\r\n * @param {function} [onProgress] — Will be called after yet another chunk of XML has been parsed.\r\n * @param {boolean} [nonBlocking] — If `true` is passed then it won't block the current thread while parsing. Otherwise, it will block the current thread until all the XML is parsed.\r\n */\n function parseXmlInChunks(parser, xml, onProgress, nonBlocking) {\n var MAX_CHUNK_PROCESSING_TIME = 7; // 16 ms — 60 fps, 7 ms — 144 fps\n var INITIAL_CHUNK_SIZE = 64 * 1024; // 64 KB\n\n var chunksCount = 0;\n var chunkSize = INITIAL_CHUNK_SIZE;\n\n /**\r\n * Parses next chunk of XML.\r\n * @returns {boolean} Returns `true` if there're more chunks to write.\r\n */\n var parseNextChunk = function parseNextChunk() {\n chunksCount++;\n var startedAt = Date.now();\n if (xml.length > chunkSize) {\n parser.write(xml.slice(0, chunkSize));\n if (onProgress) {\n onProgress(false);\n }\n xml = xml.slice(chunkSize);\n var chunkProcessingTime = Date.now() - startedAt;\n if (chunkProcessingTime < MAX_CHUNK_PROCESSING_TIME * 0.5) {\n chunkSize *= 2;\n } else if (chunkProcessingTime > MAX_CHUNK_PROCESSING_TIME) {\n chunkSize /= 2;\n }\n return true;\n } else {\n parser.write(xml);\n parser.end();\n if (onProgress) {\n onProgress(true);\n }\n return false;\n }\n };\n\n /**\r\n * Parses next chunk of XML and then repeats.\r\n */\n var loop = function loop() {\n if (parseNextChunk()) {\n if (nonBlocking) {\n if (typeof setImmediate !== 'undefined') {\n setImmediate(loop);\n } else {\n setTimeout(loop, 0);\n }\n } else {\n loop();\n }\n } else {\n // Finished\n // console.log('* chunk size', chunkSize)\n // console.log('* chunks count', chunksCount)\n }\n };\n loop();\n }\n}\n//# sourceMappingURL=parseXml.js.map","// DEFLATE is a complex format; to read this code, you should probably check the RFC first:\n// https://tools.ietf.org/html/rfc1951\n// You may also wish to take a look at the guide I made about this program:\n// https://gist.github.com/101arrowz/253f31eb5abc3d9275ab943003ffecad\n// Some of the following code is similar to that of UZIP.js:\n// https://github.com/photopea/UZIP.js\n// However, the vast majority of the codebase has diverged from UZIP.js to increase performance and reduce bundle size.\n// Sometimes 0 will appear where -1 would be more appropriate. This is because using a uint\n// is better for memory in most engines (I *think*).\nvar ch2 = {};\nvar wk = (function (c, id, msg, transfer, cb) {\n var w = new Worker(ch2[id] || (ch2[id] = URL.createObjectURL(new Blob([\n c + ';addEventListener(\"error\",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'\n ], { type: 'text/javascript' }))));\n w.onmessage = function (e) {\n var d = e.data, ed = d.$e$;\n if (ed) {\n var err = new Error(ed[0]);\n err['code'] = ed[1];\n err.stack = ed[2];\n cb(err, null);\n }\n else\n cb(null, d);\n };\n w.postMessage(msg, transfer);\n return w;\n});\n\n// aliases for shorter compressed code (most minifers don't do this)\nvar u8 = Uint8Array, u16 = Uint16Array, i32 = Int32Array;\n// fixed length extra bits\nvar fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */ 0, 0, /* impossible */ 0]);\n// fixed distance extra bits\nvar fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */ 0, 0]);\n// code length index map\nvar clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);\n// get base, reverse index map from extra bits\nvar freb = function (eb, start) {\n var b = new u16(31);\n for (var i = 0; i < 31; ++i) {\n b[i] = start += 1 << eb[i - 1];\n }\n // numbers here are at max 18 bits\n var r = new i32(b[30]);\n for (var i = 1; i < 30; ++i) {\n for (var j = b[i]; j < b[i + 1]; ++j) {\n r[j] = ((j - b[i]) << 5) | i;\n }\n }\n return { b: b, r: r };\n};\nvar _a = freb(fleb, 2), fl = _a.b, revfl = _a.r;\n// we can ignore the fact that the other numbers are wrong; they never happen anyway\nfl[28] = 258, revfl[258] = 28;\nvar _b = freb(fdeb, 0), fd = _b.b, revfd = _b.r;\n// map of value to reverse (assuming 16 bits)\nvar rev = new u16(32768);\nfor (var i = 0; i < 32768; ++i) {\n // reverse table algorithm from SO\n var x = ((i & 0xAAAA) >> 1) | ((i & 0x5555) << 1);\n x = ((x & 0xCCCC) >> 2) | ((x & 0x3333) << 2);\n x = ((x & 0xF0F0) >> 4) | ((x & 0x0F0F) << 4);\n rev[i] = (((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8)) >> 1;\n}\n// create huffman tree from u8 \"map\": index -> code length for code index\n// mb (max bits) must be at most 15\n// TODO: optimize/split up?\nvar hMap = (function (cd, mb, r) {\n var s = cd.length;\n // index\n var i = 0;\n // u16 \"map\": index -> # of codes with bit length = index\n var l = new u16(mb);\n // length of cd must be 288 (total # of codes)\n for (; i < s; ++i) {\n if (cd[i])\n ++l[cd[i] - 1];\n }\n // u16 \"map\": index -> minimum code for bit length = index\n var le = new u16(mb);\n for (i = 1; i < mb; ++i) {\n le[i] = (le[i - 1] + l[i - 1]) << 1;\n }\n var co;\n if (r) {\n // u16 \"map\": index -> number of actual bits, symbol for code\n co = new u16(1 << mb);\n // bits to remove for reverser\n var rvb = 15 - mb;\n for (i = 0; i < s; ++i) {\n // ignore 0 lengths\n if (cd[i]) {\n // num encoding both symbol and bits read\n var sv = (i << 4) | cd[i];\n // free bits\n var r_1 = mb - cd[i];\n // start value\n var v = le[cd[i] - 1]++ << r_1;\n // m is end value\n for (var m = v | ((1 << r_1) - 1); v <= m; ++v) {\n // every 16 bit value starting with the code yields the same result\n co[rev[v] >> rvb] = sv;\n }\n }\n }\n }\n else {\n co = new u16(s);\n for (i = 0; i < s; ++i) {\n if (cd[i]) {\n co[i] = rev[le[cd[i] - 1]++] >> (15 - cd[i]);\n }\n }\n }\n return co;\n});\n// fixed length tree\nvar flt = new u8(288);\nfor (var i = 0; i < 144; ++i)\n flt[i] = 8;\nfor (var i = 144; i < 256; ++i)\n flt[i] = 9;\nfor (var i = 256; i < 280; ++i)\n flt[i] = 7;\nfor (var i = 280; i < 288; ++i)\n flt[i] = 8;\n// fixed distance tree\nvar fdt = new u8(32);\nfor (var i = 0; i < 32; ++i)\n fdt[i] = 5;\n// fixed length map\nvar flm = /*#__PURE__*/ hMap(flt, 9, 0), flrm = /*#__PURE__*/ hMap(flt, 9, 1);\n// fixed distance map\nvar fdm = /*#__PURE__*/ hMap(fdt, 5, 0), fdrm = /*#__PURE__*/ hMap(fdt, 5, 1);\n// find max of array\nvar max = function (a) {\n var m = a[0];\n for (var i = 1; i < a.length; ++i) {\n if (a[i] > m)\n m = a[i];\n }\n return m;\n};\n// read d, starting at bit p and mask with m\nvar bits = function (d, p, m) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8)) >> (p & 7)) & m;\n};\n// read d, starting at bit p continuing for at least 16 bits\nvar bits16 = function (d, p) {\n var o = (p / 8) | 0;\n return ((d[o] | (d[o + 1] << 8) | (d[o + 2] << 16)) >> (p & 7));\n};\n// get end of byte\nvar shft = function (p) { return ((p + 7) / 8) | 0; };\n// typed array slice - allows garbage collector to free original reference,\n// while being more compatible than .slice\nvar slc = function (v, s, e) {\n if (s == null || s < 0)\n s = 0;\n if (e == null || e > v.length)\n e = v.length;\n // can't use .constructor in case user-supplied\n return new u8(v.subarray(s, e));\n};\n/**\n * Codes for errors generated within this library\n */\nexport var FlateErrorCode = {\n UnexpectedEOF: 0,\n InvalidBlockType: 1,\n InvalidLengthLiteral: 2,\n InvalidDistance: 3,\n StreamFinished: 4,\n NoStreamHandler: 5,\n InvalidHeader: 6,\n NoCallback: 7,\n InvalidUTF8: 8,\n ExtraFieldTooLong: 9,\n InvalidDate: 10,\n FilenameTooLong: 11,\n StreamFinishing: 12,\n InvalidZipData: 13,\n UnknownCompressionMethod: 14\n};\n// error codes\nvar ec = [\n 'unexpected EOF',\n 'invalid block type',\n 'invalid length/literal',\n 'invalid distance',\n 'stream finished',\n 'no stream handler',\n , // determined by compression function\n 'no callback',\n 'invalid UTF-8 data',\n 'extra field too long',\n 'date not in range 1980-2099',\n 'filename too long',\n 'stream finishing',\n 'invalid zip data'\n // determined by unknown compression method\n];\n;\nvar err = function (ind, msg, nt) {\n var e = new Error(msg || ec[ind]);\n e.code = ind;\n if (Error.captureStackTrace)\n Error.captureStackTrace(e, err);\n if (!nt)\n throw e;\n return e;\n};\n// expands raw DEFLATE data\nvar inflt = function (dat, st, buf, dict) {\n // source length dict length\n var sl = dat.length, dl = dict ? dict.length : 0;\n if (!sl || st.f && !st.l)\n return buf || new u8(0);\n var noBuf = !buf;\n // have to estimate size\n var resize = noBuf || st.i != 2;\n // no state\n var noSt = st.i;\n // Assumes roughly 33% compression ratio average\n if (noBuf)\n buf = new u8(sl * 3);\n // ensure buffer can fit at least l elements\n var cbuf = function (l) {\n var bl = buf.length;\n // need to increase size to fit\n if (l > bl) {\n // Double or set to necessary, whichever is greater\n var nbuf = new u8(Math.max(bl * 2, l));\n nbuf.set(buf);\n buf = nbuf;\n }\n };\n // last chunk bitpos bytes\n var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;\n // total bits\n var tbts = sl * 8;\n do {\n if (!lm) {\n // BFINAL - this is only 1 when last chunk is next\n final = bits(dat, pos, 1);\n // type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman\n var type = bits(dat, pos + 1, 3);\n pos += 3;\n if (!type) {\n // go to end of byte boundary\n var s = shft(pos) + 4, l = dat[s - 4] | (dat[s - 3] << 8), t = s + l;\n if (t > sl) {\n if (noSt)\n err(0);\n break;\n }\n // ensure size\n if (resize)\n cbuf(bt + l);\n // Copy over uncompressed data\n buf.set(dat.subarray(s, t), bt);\n // Get new bitpos, update byte count\n st.b = bt += l, st.p = pos = t * 8, st.f = final;\n continue;\n }\n else if (type == 1)\n lm = flrm, dm = fdrm, lbt = 9, dbt = 5;\n else if (type == 2) {\n // literal lengths\n var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;\n var tl = hLit + bits(dat, pos + 5, 31) + 1;\n pos += 14;\n // length+distance tree\n var ldt = new u8(tl);\n // code length tree\n var clt = new u8(19);\n for (var i = 0; i < hcLen; ++i) {\n // use index map to get real code\n clt[clim[i]] = bits(dat, pos + i * 3, 7);\n }\n pos += hcLen * 3;\n // code lengths bits\n var clb = max(clt), clbmsk = (1 << clb) - 1;\n // code lengths map\n var clm = hMap(clt, clb, 1);\n for (var i = 0; i < tl;) {\n var r = clm[bits(dat, pos, clbmsk)];\n // bits read\n pos += r & 15;\n // symbol\n var s = r >> 4;\n // code length to copy\n if (s < 16) {\n ldt[i++] = s;\n }\n else {\n // copy count\n var c = 0, n = 0;\n if (s == 16)\n n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];\n else if (s == 17)\n n = 3 + bits(dat, pos, 7), pos += 3;\n else if (s == 18)\n n = 11 + bits(dat, pos, 127), pos += 7;\n while (n--)\n ldt[i++] = c;\n }\n }\n // length tree distance tree\n var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);\n // max length bits\n lbt = max(lt);\n // max dist bits\n dbt = max(dt);\n lm = hMap(lt, lbt, 1);\n dm = hMap(dt, dbt, 1);\n }\n else\n err(1);\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n }\n // Make sure the buffer can hold this + the largest possible addition\n // Maximum chunk size (practically, theoretically infinite) is 2^17\n if (resize)\n cbuf(bt + 131072);\n var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;\n var lpos = pos;\n for (;; lpos = pos) {\n // bits read, code\n var c = lm[bits16(dat, pos) & lms], sym = c >> 4;\n pos += c & 15;\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n if (!c)\n err(2);\n if (sym < 256)\n buf[bt++] = sym;\n else if (sym == 256) {\n lpos = pos, lm = null;\n break;\n }\n else {\n var add = sym - 254;\n // no extra bits needed if less\n if (sym > 264) {\n // index\n var i = sym - 257, b = fleb[i];\n add = bits(dat, pos, (1 << b) - 1) + fl[i];\n pos += b;\n }\n // dist\n var d = dm[bits16(dat, pos) & dms], dsym = d >> 4;\n if (!d)\n err(3);\n pos += d & 15;\n var dt = fd[dsym];\n if (dsym > 3) {\n var b = fdeb[dsym];\n dt += bits16(dat, pos) & (1 << b) - 1, pos += b;\n }\n if (pos > tbts) {\n if (noSt)\n err(0);\n break;\n }\n if (resize)\n cbuf(bt + 131072);\n var end = bt + add;\n if (bt < dt) {\n var shift = dl - dt, dend = Math.min(dt, end);\n if (shift + bt < 0)\n err(3);\n for (; bt < dend; ++bt)\n buf[bt] = dict[shift + bt];\n }\n for (; bt < end; ++bt)\n buf[bt] = buf[bt - dt];\n }\n }\n st.l = lm, st.p = lpos, st.b = bt, st.f = final;\n if (lm)\n final = 1, st.m = lbt, st.d = dm, st.n = dbt;\n } while (!final);\n // don't reallocate for streams or user buffers\n return bt != buf.length && noBuf ? slc(buf, 0, bt) : buf.subarray(0, bt);\n};\n// starting at p, write the minimum number of bits that can hold v to d\nvar wbits = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >> 8;\n};\n// starting at p, write the minimum number of bits (>8) that can hold v to d\nvar wbits16 = function (d, p, v) {\n v <<= p & 7;\n var o = (p / 8) | 0;\n d[o] |= v;\n d[o + 1] |= v >> 8;\n d[o + 2] |= v >> 16;\n};\n// creates code lengths from a frequency table\nvar hTree = function (d, mb) {\n // Need extra info to make a tree\n var t = [];\n for (var i = 0; i < d.length; ++i) {\n if (d[i])\n t.push({ s: i, f: d[i] });\n }\n var s = t.length;\n var t2 = t.slice();\n if (!s)\n return { t: et, l: 0 };\n if (s == 1) {\n var v = new u8(t[0].s + 1);\n v[t[0].s] = 1;\n return { t: v, l: 1 };\n }\n t.sort(function (a, b) { return a.f - b.f; });\n // after i2 reaches last ind, will be stopped\n // freq must be greater than largest possible number of symbols\n t.push({ s: -1, f: 25001 });\n var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;\n t[0] = { s: -1, f: l.f + r.f, l: l, r: r };\n // efficient algorithm from UZIP.js\n // i0 is lookbehind, i2 is lookahead - after processing two low-freq\n // symbols that combined have high freq, will start processing i2 (high-freq,\n // non-composite) symbols instead\n // see https://reddit.com/r/photopea/comments/ikekht/uzipjs_questions/\n while (i1 != s - 1) {\n l = t[t[i0].f < t[i2].f ? i0++ : i2++];\n r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];\n t[i1++] = { s: -1, f: l.f + r.f, l: l, r: r };\n }\n var maxSym = t2[0].s;\n for (var i = 1; i < s; ++i) {\n if (t2[i].s > maxSym)\n maxSym = t2[i].s;\n }\n // code lengths\n var tr = new u16(maxSym + 1);\n // max bits in tree\n var mbt = ln(t[i1 - 1], tr, 0);\n if (mbt > mb) {\n // more algorithms from UZIP.js\n // TODO: find out how this code works (debt)\n // ind debt\n var i = 0, dt = 0;\n // left cost\n var lft = mbt - mb, cst = 1 << lft;\n t2.sort(function (a, b) { return tr[b.s] - tr[a.s] || a.f - b.f; });\n for (; i < s; ++i) {\n var i2_1 = t2[i].s;\n if (tr[i2_1] > mb) {\n dt += cst - (1 << (mbt - tr[i2_1]));\n tr[i2_1] = mb;\n }\n else\n break;\n }\n dt >>= lft;\n while (dt > 0) {\n var i2_2 = t2[i].s;\n if (tr[i2_2] < mb)\n dt -= 1 << (mb - tr[i2_2]++ - 1);\n else\n ++i;\n }\n for (; i >= 0 && dt; --i) {\n var i2_3 = t2[i].s;\n if (tr[i2_3] == mb) {\n --tr[i2_3];\n ++dt;\n }\n }\n mbt = mb;\n }\n return { t: new u8(tr), l: mbt };\n};\n// get the max length and assign length codes\nvar ln = function (n, l, d) {\n return n.s == -1\n ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1))\n : (l[n.s] = d);\n};\n// length codes generation\nvar lc = function (c) {\n var s = c.length;\n // Note that the semicolon was intentional\n while (s && !c[--s])\n ;\n var cl = new u16(++s);\n // ind num streak\n var cli = 0, cln = c[0], cls = 1;\n var w = function (v) { cl[cli++] = v; };\n for (var i = 1; i <= s; ++i) {\n if (c[i] == cln && i != s)\n ++cls;\n else {\n if (!cln && cls > 2) {\n for (; cls > 138; cls -= 138)\n w(32754);\n if (cls > 2) {\n w(cls > 10 ? ((cls - 11) << 5) | 28690 : ((cls - 3) << 5) | 12305);\n cls = 0;\n }\n }\n else if (cls > 3) {\n w(cln), --cls;\n for (; cls > 6; cls -= 6)\n w(8304);\n if (cls > 2)\n w(((cls - 3) << 5) | 8208), cls = 0;\n }\n while (cls--)\n w(cln);\n cls = 1;\n cln = c[i];\n }\n }\n return { c: cl.subarray(0, cli), n: s };\n};\n// calculate the length of output from tree, code lengths\nvar clen = function (cf, cl) {\n var l = 0;\n for (var i = 0; i < cl.length; ++i)\n l += cf[i] * cl[i];\n return l;\n};\n// writes a fixed block\n// returns the new bit pos\nvar wfblk = function (out, pos, dat) {\n // no need to write 00 as type: TypedArray defaults to 0\n var s = dat.length;\n var o = shft(pos + 2);\n out[o] = s & 255;\n out[o + 1] = s >> 8;\n out[o + 2] = out[o] ^ 255;\n out[o + 3] = out[o + 1] ^ 255;\n for (var i = 0; i < s; ++i)\n out[o + i + 4] = dat[i];\n return (o + 4 + s) * 8;\n};\n// writes a block\nvar wblk = function (dat, out, final, syms, lf, df, eb, li, bs, bl, p) {\n wbits(out, p++, final);\n ++lf[256];\n var _a = hTree(lf, 15), dlt = _a.t, mlb = _a.l;\n var _b = hTree(df, 15), ddt = _b.t, mdb = _b.l;\n var _c = lc(dlt), lclt = _c.c, nlc = _c.n;\n var _d = lc(ddt), lcdt = _d.c, ndc = _d.n;\n var lcfreq = new u16(19);\n for (var i = 0; i < lclt.length; ++i)\n ++lcfreq[lclt[i] & 31];\n for (var i = 0; i < lcdt.length; ++i)\n ++lcfreq[lcdt[i] & 31];\n var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l;\n var nlcc = 19;\n for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)\n ;\n var flen = (bl + 5) << 3;\n var ftlen = clen(lf, flt) + clen(df, fdt) + eb;\n var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];\n if (bs >= 0 && flen <= ftlen && flen <= dtlen)\n return wfblk(out, p, dat.subarray(bs, bs + bl));\n var lm, ll, dm, dl;\n wbits(out, p, 1 + (dtlen < ftlen)), p += 2;\n if (dtlen < ftlen) {\n lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;\n var llm = hMap(lct, mlcb, 0);\n wbits(out, p, nlc - 257);\n wbits(out, p + 5, ndc - 1);\n wbits(out, p + 10, nlcc - 4);\n p += 14;\n for (var i = 0; i < nlcc; ++i)\n wbits(out, p + 3 * i, lct[clim[i]]);\n p += 3 * nlcc;\n var lcts = [lclt, lcdt];\n for (var it = 0; it < 2; ++it) {\n var clct = lcts[it];\n for (var i = 0; i < clct.length; ++i) {\n var len = clct[i] & 31;\n wbits(out, p, llm[len]), p += lct[len];\n if (len > 15)\n wbits(out, p, (clct[i] >> 5) & 127), p += clct[i] >> 12;\n }\n }\n }\n else {\n lm = flm, ll = flt, dm = fdm, dl = fdt;\n }\n for (var i = 0; i < li; ++i) {\n var sym = syms[i];\n if (sym > 255) {\n var len = (sym >> 18) & 31;\n wbits16(out, p, lm[len + 257]), p += ll[len + 257];\n if (len > 7)\n wbits(out, p, (sym >> 23) & 31), p += fleb[len];\n var dst = sym & 31;\n wbits16(out, p, dm[dst]), p += dl[dst];\n if (dst > 3)\n wbits16(out, p, (sym >> 5) & 8191), p += fdeb[dst];\n }\n else {\n wbits16(out, p, lm[sym]), p += ll[sym];\n }\n }\n wbits16(out, p, lm[256]);\n return p + ll[256];\n};\n// deflate options (nice << 13) | chain\nvar deo = /*#__PURE__*/ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);\n// empty\nvar et = /*#__PURE__*/ new u8(0);\n// compresses data into a raw DEFLATE buffer\nvar dflt = function (dat, lvl, plvl, pre, post, st) {\n var s = st.z || dat.length;\n var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7000)) + post);\n // writing to this writes to the output buffer\n var w = o.subarray(pre, o.length - post);\n var lst = st.l;\n var pos = (st.r || 0) & 7;\n if (lvl) {\n if (pos)\n w[0] = st.r >> 3;\n var opt = deo[lvl - 1];\n var n = opt >> 13, c = opt & 8191;\n var msk_1 = (1 << plvl) - 1;\n // prev 2-byte val map curr 2-byte val map\n var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1);\n var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;\n var hsh = function (i) { return (dat[i] ^ (dat[i + 1] << bs1_1) ^ (dat[i + 2] << bs2_1)) & msk_1; };\n // 24576 is an arbitrary number of maximum symbols per block\n // 424 buffer for last block\n var syms = new i32(25000);\n // length/literal freq distance freq\n var lf = new u16(288), df = new u16(32);\n // l/lcnt exbits index l/lind waitdx blkpos\n var lc_1 = 0, eb = 0, i = st.i || 0, li = 0, wi = st.w || 0, bs = 0;\n for (; i + 2 < s; ++i) {\n // hash value\n var hv = hsh(i);\n // index mod 32768 previous index mod\n var imod = i & 32767, pimod = head[hv];\n prev[imod] = pimod;\n head[hv] = imod;\n // We always should modify head and prev, but only add symbols if\n // this data is not yet processed (\"wait\" for wait index)\n if (wi <= i) {\n // bytes remaining\n var rem = s - i;\n if ((lc_1 > 7000 || li > 24576) && (rem > 423 || !lst)) {\n pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);\n li = lc_1 = eb = 0, bs = i;\n for (var j = 0; j < 286; ++j)\n lf[j] = 0;\n for (var j = 0; j < 30; ++j)\n df[j] = 0;\n }\n // len dist chain\n var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767;\n if (rem > 2 && hv == hsh(i - dif)) {\n var maxn = Math.min(n, rem) - 1;\n var maxd = Math.min(32767, i);\n // max possible length\n // not capped at dif because decompressors implement \"rolling\" index population\n var ml = Math.min(258, rem);\n while (dif <= maxd && --ch_1 && imod != pimod) {\n if (dat[i + l] == dat[i + l - dif]) {\n var nl = 0;\n for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl)\n ;\n if (nl > l) {\n l = nl, d = dif;\n // break out early when we reach \"nice\" (we are satisfied enough)\n if (nl > maxn)\n break;\n // now, find the rarest 2-byte sequence within this\n // length of literals and search for that instead.\n // Much faster than just using the start\n var mmd = Math.min(dif, nl - 2);\n var md = 0;\n for (var j = 0; j < mmd; ++j) {\n var ti = i - dif + j & 32767;\n var pti = prev[ti];\n var cd = ti - pti & 32767;\n if (cd > md)\n md = cd, pimod = ti;\n }\n }\n }\n // check the previous match\n imod = pimod, pimod = prev[imod];\n dif += imod - pimod & 32767;\n }\n }\n // d will be nonzero only when a match was found\n if (d) {\n // store both dist and len data in one int32\n // Make sure this is recognized as a len/dist with 28th bit (2^28)\n syms[li++] = 268435456 | (revfl[l] << 18) | revfd[d];\n var lin = revfl[l] & 31, din = revfd[d] & 31;\n eb += fleb[lin] + fdeb[din];\n ++lf[257 + lin];\n ++df[din];\n wi = i + l;\n ++lc_1;\n }\n else {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n }\n }\n for (i = Math.max(i, wi); i < s; ++i) {\n syms[li++] = dat[i];\n ++lf[dat[i]];\n }\n pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);\n if (!lst) {\n st.r = (pos & 7) | w[(pos / 8) | 0] << 3;\n // shft(pos) now 1 less if pos & 7 != 0\n pos -= 7;\n st.h = head, st.p = prev, st.i = i, st.w = wi;\n }\n }\n else {\n for (var i = st.w || 0; i < s + lst; i += 65535) {\n // end\n var e = i + 65535;\n if (e >= s) {\n // write final block\n w[(pos / 8) | 0] = lst;\n e = s;\n }\n pos = wfblk(w, pos + 1, dat.subarray(i, e));\n }\n st.i = s;\n }\n return slc(o, 0, pre + shft(pos) + post);\n};\n// CRC32 table\nvar crct = /*#__PURE__*/ (function () {\n var t = new Int32Array(256);\n for (var i = 0; i < 256; ++i) {\n var c = i, k = 9;\n while (--k)\n c = ((c & 1) && -306674912) ^ (c >>> 1);\n t[i] = c;\n }\n return t;\n})();\n// CRC32\nvar crc = function () {\n var c = -1;\n return {\n p: function (d) {\n // closures have awful performance\n var cr = c;\n for (var i = 0; i < d.length; ++i)\n cr = crct[(cr & 255) ^ d[i]] ^ (cr >>> 8);\n c = cr;\n },\n d: function () { return ~c; }\n };\n};\n// Adler32\nvar adler = function () {\n var a = 1, b = 0;\n return {\n p: function (d) {\n // closures have awful performance\n var n = a, m = b;\n var l = d.length | 0;\n for (var i = 0; i != l;) {\n var e = Math.min(i + 2655, l);\n for (; i < e; ++i)\n m += n += d[i];\n n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16);\n }\n a = n, b = m;\n },\n d: function () {\n a %= 65521, b %= 65521;\n return (a & 255) << 24 | (a & 0xFF00) << 8 | (b & 255) << 8 | (b >> 8);\n }\n };\n};\n;\n// deflate with opts\nvar dopt = function (dat, opt, pre, post, st) {\n if (!st) {\n st = { l: 1 };\n if (opt.dictionary) {\n var dict = opt.dictionary.subarray(-32768);\n var newDat = new u8(dict.length + dat.length);\n newDat.set(dict);\n newDat.set(dat, dict.length);\n dat = newDat;\n st.w = dict.length;\n }\n }\n return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? (st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20) : (12 + opt.mem), pre, post, st);\n};\n// Walmart object spread\nvar mrg = function (a, b) {\n var o = {};\n for (var k in a)\n o[k] = a[k];\n for (var k in b)\n o[k] = b[k];\n return o;\n};\n// worker clone\n// This is possibly the craziest part of the entire codebase, despite how simple it may seem.\n// The only parameter to this function is a closure that returns an array of variables outside of the function scope.\n// We're going to try to figure out the variable names used in the closure as strings because that is crucial for workerization.\n// We will return an object mapping of true variable name to value (basically, the current scope as a JS object).\n// The reason we can't just use the original variable names is minifiers mangling the toplevel scope.\n// This took me three weeks to figure out how to do.\nvar wcln = function (fn, fnStr, td) {\n var dt = fn();\n var st = fn.toString();\n var ks = st.slice(st.indexOf('[') + 1, st.lastIndexOf(']')).replace(/\\s+/g, '').split(',');\n for (var i = 0; i < dt.length; ++i) {\n var v = dt[i], k = ks[i];\n if (typeof v == 'function') {\n fnStr += ';' + k + '=';\n var st_1 = v.toString();\n if (v.prototype) {\n // for global objects\n if (st_1.indexOf('[native code]') != -1) {\n var spInd = st_1.indexOf(' ', 8) + 1;\n fnStr += st_1.slice(spInd, st_1.indexOf('(', spInd));\n }\n else {\n fnStr += st_1;\n for (var t in v.prototype)\n fnStr += ';' + k + '.prototype.' + t + '=' + v.prototype[t].toString();\n }\n }\n else\n fnStr += st_1;\n }\n else\n td[k] = v;\n }\n return fnStr;\n};\nvar ch = [];\n// clone bufs\nvar cbfs = function (v) {\n var tl = [];\n for (var k in v) {\n if (v[k].buffer) {\n tl.push((v[k] = new v[k].constructor(v[k])).buffer);\n }\n }\n return tl;\n};\n// use a worker to execute code\nvar wrkr = function (fns, init, id, cb) {\n if (!ch[id]) {\n var fnStr = '', td_1 = {}, m = fns.length - 1;\n for (var i = 0; i < m; ++i)\n fnStr = wcln(fns[i], fnStr, td_1);\n ch[id] = { c: wcln(fns[m], fnStr, td_1), e: td_1 };\n }\n var td = mrg({}, ch[id].e);\n return wk(ch[id].c + ';onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage=' + init.toString() + '}', id, td, cbfs(td), cb);\n};\n// base async inflate fn\nvar bInflt = function () { return [u8, u16, i32, fleb, fdeb, clim, fl, fd, flrm, fdrm, rev, ec, hMap, max, bits, bits16, shft, slc, err, inflt, inflateSync, pbf, gopt]; };\nvar bDflt = function () { return [u8, u16, i32, fleb, fdeb, clim, revfl, revfd, flm, flt, fdm, fdt, rev, deo, et, hMap, wbits, wbits16, hTree, ln, lc, clen, wfblk, wblk, shft, slc, dflt, dopt, deflateSync, pbf]; };\n// gzip extra\nvar gze = function () { return [gzh, gzhl, wbytes, crc, crct]; };\n// gunzip extra\nvar guze = function () { return [gzs, gzl]; };\n// zlib extra\nvar zle = function () { return [zlh, wbytes, adler]; };\n// unzlib extra\nvar zule = function () { return [zls]; };\n// post buf\nvar pbf = function (msg) { return postMessage(msg, [msg.buffer]); };\n// get opts\nvar gopt = function (o) { return o && {\n out: o.size && new u8(o.size),\n dictionary: o.dictionary\n}; };\n// async helper\nvar cbify = function (dat, opts, fns, init, id, cb) {\n var w = wrkr(fns, init, id, function (err, dat) {\n w.terminate();\n cb(err, dat);\n });\n w.postMessage([dat, opts], opts.consume ? [dat.buffer] : []);\n return function () { w.terminate(); };\n};\n// auto stream\nvar astrm = function (strm) {\n strm.ondata = function (dat, final) { return postMessage([dat, final], [dat.buffer]); };\n return function (ev) {\n if (ev.data[0]) {\n strm.push(ev.data[0], ev.data[1]);\n postMessage([ev.data[0].length]);\n }\n else\n strm.flush(ev.data[1]);\n };\n};\n// async stream attach\nvar astrmify = function (fns, strm, opts, init, id, flush, ext) {\n var t;\n var w = wrkr(fns, init, id, function (err, dat) {\n if (err)\n w.terminate(), strm.ondata.call(strm, err);\n else if (!Array.isArray(dat))\n ext(dat);\n else if (dat.length == 1) {\n strm.queuedSize -= dat[0];\n if (strm.ondrain)\n strm.ondrain(dat[0]);\n }\n else {\n if (dat[1])\n w.terminate();\n strm.ondata.call(strm, err, dat[0], dat[1]);\n }\n });\n w.postMessage(opts);\n strm.queuedSize = 0;\n strm.push = function (d, f) {\n if (!strm.ondata)\n err(5);\n if (t)\n strm.ondata(err(4, 0, 1), null, !!f);\n strm.queuedSize += d.length;\n // can fail for cross-realm Uint8Array, but ok - only a small performance penalty\n w.postMessage([d, t = f], d.buffer instanceof ArrayBuffer ? [d.buffer] : []);\n };\n strm.terminate = function () { w.terminate(); };\n if (flush) {\n strm.flush = function (sync) { w.postMessage([0, sync]); };\n }\n};\n// read 2 bytes\nvar b2 = function (d, b) { return d[b] | (d[b + 1] << 8); };\n// read 4 bytes\nvar b4 = function (d, b) { return (d[b] | (d[b + 1] << 8) | (d[b + 2] << 16) | (d[b + 3] << 24)) >>> 0; };\n// read 8 bytes\nvar b8 = function (d, b) { return b4(d, b) + (b4(d, b + 4) * 4294967296); };\n// write bytes\nvar wbytes = function (d, b, v) {\n for (; v; ++b)\n d[b] = v, v >>>= 8;\n};\n// gzip header\nvar gzh = function (c, o) {\n var fn = o.filename;\n c[0] = 31, c[1] = 139, c[2] = 8, c[8] = o.level < 2 ? 4 : o.level == 9 ? 2 : 0, c[9] = 3; // assume Unix\n if (o.mtime != 0)\n wbytes(c, 4, Math.floor(new Date(o.mtime || Date.now()) / 1000));\n if (fn) {\n c[3] = 8;\n for (var i = 0; i <= fn.length; ++i)\n c[i + 10] = fn.charCodeAt(i);\n }\n};\n// gzip footer: -8 to -4 = CRC, -4 to -0 is length\n// gzip start\nvar gzs = function (d) {\n if (d[0] != 31 || d[1] != 139 || d[2] != 8)\n err(6, 'invalid gzip data');\n var flg = d[3];\n var st = 10;\n if (flg & 4)\n st += (d[10] | d[11] << 8) + 2;\n for (var zs = (flg >> 3 & 1) + (flg >> 4 & 1); zs > 0; zs -= !d[st++])\n ;\n return st + (flg & 2);\n};\n// gzip length\nvar gzl = function (d) {\n var l = d.length;\n return (d[l - 4] | d[l - 3] << 8 | d[l - 2] << 16 | d[l - 1] << 24) >>> 0;\n};\n// gzip header length\nvar gzhl = function (o) { return 10 + (o.filename ? o.filename.length + 1 : 0); };\n// zlib header\nvar zlh = function (c, o) {\n var lv = o.level, fl = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;\n c[0] = 120, c[1] = (fl << 6) | (o.dictionary && 32);\n c[1] |= 31 - ((c[0] << 8) | c[1]) % 31;\n if (o.dictionary) {\n var h = adler();\n h.p(o.dictionary);\n wbytes(c, 2, h.d());\n }\n};\n// zlib start\nvar zls = function (d, dict) {\n if ((d[0] & 15) != 8 || (d[0] >> 4) > 7 || ((d[0] << 8 | d[1]) % 31))\n err(6, 'invalid zlib data');\n if ((d[1] >> 5 & 1) == +!dict)\n err(6, 'invalid zlib data: ' + (d[1] & 32 ? 'need' : 'unexpected') + ' dictionary');\n return (d[1] >> 3 & 4) + 2;\n};\nfunction StrmOpt(opts, cb) {\n if (typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n return opts;\n}\n/**\n * Streaming DEFLATE compression\n */\nvar Deflate = /*#__PURE__*/ (function () {\n function Deflate(opts, cb) {\n if (typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n this.o = opts || {};\n this.s = { l: 0, i: 32768, w: 32768, z: 32768 };\n // Buffer length must always be 0 mod 32768 for index calculations to be correct when modifying head and prev\n // 98304 = 32768 (lookback) + 65536 (common chunk size)\n this.b = new u8(98304);\n if (this.o.dictionary) {\n var dict = this.o.dictionary.subarray(-32768);\n this.b.set(dict, 32768 - dict.length);\n this.s.i = 32768 - dict.length;\n }\n }\n Deflate.prototype.p = function (c, f) {\n this.ondata(dopt(c, this.o, 0, 0, this.s), f);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Deflate.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (this.s.l)\n err(4);\n var endLen = chunk.length + this.s.z;\n if (endLen > this.b.length) {\n if (endLen > 2 * this.b.length - 32768) {\n var newBuf = new u8(endLen & -32768);\n newBuf.set(this.b.subarray(0, this.s.z));\n this.b = newBuf;\n }\n var split = this.b.length - this.s.z;\n this.b.set(chunk.subarray(0, split), this.s.z);\n this.s.z = this.b.length;\n this.p(this.b, false);\n this.b.set(this.b.subarray(-32768));\n this.b.set(chunk.subarray(split), 32768);\n this.s.z = chunk.length - split + 32768;\n this.s.i = 32766, this.s.w = 32768;\n }\n else {\n this.b.set(chunk, this.s.z);\n this.s.z += chunk.length;\n }\n this.s.l = final & 1;\n if (this.s.z > this.s.w + 8191 || final) {\n this.p(this.b, final || false);\n this.s.w = this.s.i, this.s.i -= 2;\n }\n if (final) {\n // cleanup unneeded buffers/state to reduce memory usage\n this.s = this.o = {};\n this.b = et;\n }\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * deflated output for small inputs.\n * @param sync Whether to flush to a byte boundary. A sync flush takes 4-5\n * extra bytes, but guarantees all pushed data is immediately\n * decompressible. A separate DEFLATE stream may be concatenated\n * with the current output after a sync flush.\n */\n Deflate.prototype.flush = function (sync) {\n if (!this.ondata)\n err(5);\n if (this.s.l)\n err(4);\n this.p(this.b, false);\n this.s.w = this.s.i, this.s.i -= 2;\n // could technically skip writing the type-0 block for (this.s.r & 7) == 0,\n // but the deterministic trailer (00 00 FF FF) is useful in some situations\n if (sync) {\n var c = new u8(6);\n c[0] = this.s.r >> 3;\n // write empty, non-final type-0 block\n var ep = wfblk(c, this.s.r, et);\n this.s.r = 0;\n this.ondata(c.subarray(0, ep >> 3), false);\n }\n };\n return Deflate;\n}());\nexport { Deflate };\n/**\n * Asynchronous streaming DEFLATE compression\n */\nvar AsyncDeflate = /*#__PURE__*/ (function () {\n function AsyncDeflate(opts, cb) {\n astrmify([\n bDflt,\n function () { return [astrm, Deflate]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Deflate(ev.data);\n onmessage = astrm(strm);\n }, 6, 1);\n }\n return AsyncDeflate;\n}());\nexport { AsyncDeflate };\nexport function deflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n ], function (ev) { return pbf(deflateSync(ev.data[0], ev.data[1])); }, 0, cb);\n}\n/**\n * Compresses data with DEFLATE without any wrapper\n * @param data The data to compress\n * @param opts The compression options\n * @returns The deflated version of the data\n */\nexport function deflateSync(data, opts) {\n return dopt(data, opts || {}, 0, 0);\n}\n/**\n * Streaming DEFLATE decompression\n */\nvar Inflate = /*#__PURE__*/ (function () {\n function Inflate(opts, cb) {\n // no StrmOpt here to avoid adding to workerizer\n if (typeof opts == 'function')\n cb = opts, opts = {};\n this.ondata = cb;\n var dict = opts && opts.dictionary && opts.dictionary.subarray(-32768);\n this.s = { i: 0, b: dict ? dict.length : 0 };\n this.o = new u8(32768);\n this.p = new u8(0);\n if (dict)\n this.o.set(dict);\n }\n Inflate.prototype.e = function (c) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n if (!this.p.length)\n this.p = c;\n else if (c.length) {\n var n = new u8(this.p.length + c.length);\n n.set(this.p), n.set(c, this.p.length), this.p = n;\n }\n };\n Inflate.prototype.c = function (final) {\n this.s.i = +(this.d = final || false);\n var bts = this.s.b;\n var dt = inflt(this.p, this.s, this.o);\n this.ondata(slc(dt, bts, this.s.b), this.d);\n this.o = slc(dt, this.s.b - 32768), this.s.b = this.o.length;\n this.p = slc(this.p, (this.s.p / 8) | 0), this.s.p &= 7;\n };\n /**\n * Pushes a chunk to be inflated\n * @param chunk The chunk to push\n * @param final Whether this is the final chunk\n */\n Inflate.prototype.push = function (chunk, final) {\n this.e(chunk), this.c(final);\n };\n return Inflate;\n}());\nexport { Inflate };\n/**\n * Asynchronous streaming DEFLATE decompression\n */\nvar AsyncInflate = /*#__PURE__*/ (function () {\n function AsyncInflate(opts, cb) {\n astrmify([\n bInflt,\n function () { return [astrm, Inflate]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Inflate(ev.data);\n onmessage = astrm(strm);\n }, 7, 0);\n }\n return AsyncInflate;\n}());\nexport { AsyncInflate };\nexport function inflate(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt\n ], function (ev) { return pbf(inflateSync(ev.data[0], gopt(ev.data[1]))); }, 1, cb);\n}\nexport function inflateSync(data, opts) {\n return inflt(data, { i: 2 }, opts && opts.out, opts && opts.dictionary);\n}\n// before you yell at me for not just using extends, my reason is that TS inheritance is hard to workerize.\n/**\n * Streaming GZIP compression\n */\nvar Gzip = /*#__PURE__*/ (function () {\n function Gzip(opts, cb) {\n this.c = crc();\n this.l = 0;\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gzip.prototype.push = function (chunk, final) {\n this.c.p(chunk);\n this.l += chunk.length;\n Deflate.prototype.push.call(this, chunk, final);\n };\n Gzip.prototype.p = function (c, f) {\n var raw = dopt(c, this.o, this.v && gzhl(this.o), f && 8, this.s);\n if (this.v)\n gzh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 8, this.c.d()), wbytes(raw, raw.length - 4, this.l);\n this.ondata(raw, f);\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * GZIPped output for small inputs.\n * @param sync Whether to flush to a byte boundary. A sync flush takes 4-5\n * extra bytes, but guarantees all pushed data is immediately\n * decompressible.\n */\n Gzip.prototype.flush = function (sync) {\n Deflate.prototype.flush.call(this, sync);\n };\n return Gzip;\n}());\nexport { Gzip };\n/**\n * Asynchronous streaming GZIP compression\n */\nvar AsyncGzip = /*#__PURE__*/ (function () {\n function AsyncGzip(opts, cb) {\n astrmify([\n bDflt,\n gze,\n function () { return [astrm, Deflate, Gzip]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Gzip(ev.data);\n onmessage = astrm(strm);\n }, 8, 1);\n }\n return AsyncGzip;\n}());\nexport { AsyncGzip };\nexport function gzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n gze,\n function () { return [gzipSync]; }\n ], function (ev) { return pbf(gzipSync(ev.data[0], ev.data[1])); }, 2, cb);\n}\n/**\n * Compresses data with GZIP\n * @param data The data to compress\n * @param opts The compression options\n * @returns The gzipped version of the data\n */\nexport function gzipSync(data, opts) {\n if (!opts)\n opts = {};\n var c = crc(), l = data.length;\n c.p(data);\n var d = dopt(data, opts, gzhl(opts), 8), s = d.length;\n return gzh(d, opts), wbytes(d, s - 8, c.d()), wbytes(d, s - 4, l), d;\n}\n/**\n * Streaming single or multi-member GZIP decompression\n */\nvar Gunzip = /*#__PURE__*/ (function () {\n function Gunzip(opts, cb) {\n this.v = 1;\n this.r = 0;\n Inflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be GUNZIPped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Gunzip.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n this.r += chunk.length;\n if (this.v) {\n var p = this.p.subarray(this.v - 1);\n var s = p.length > 3 ? gzs(p) : 4;\n if (s > p.length) {\n if (!final)\n return;\n }\n else if (this.v > 1 && this.onmember) {\n this.onmember(this.r - p.length);\n }\n this.p = p.subarray(s), this.v = 0;\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, 0);\n // process concatenated GZIP\n if (this.s.f && !this.s.l) {\n this.v = shft(this.s.p) + 9;\n this.s = { i: 0 };\n this.o = new u8(0);\n this.push(new u8(0), final);\n }\n else if (final) {\n Inflate.prototype.c.call(this, final);\n }\n };\n return Gunzip;\n}());\nexport { Gunzip };\n/**\n * Asynchronous streaming single or multi-member GZIP decompression\n */\nvar AsyncGunzip = /*#__PURE__*/ (function () {\n function AsyncGunzip(opts, cb) {\n var _this = this;\n astrmify([\n bInflt,\n guze,\n function () { return [astrm, Inflate, Gunzip]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Gunzip(ev.data);\n strm.onmember = function (offset) { return postMessage(offset); };\n onmessage = astrm(strm);\n }, 9, 0, function (offset) { return _this.onmember && _this.onmember(offset); });\n }\n return AsyncGunzip;\n}());\nexport { AsyncGunzip };\nexport function gunzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt,\n guze,\n function () { return [gunzipSync]; }\n ], function (ev) { return pbf(gunzipSync(ev.data[0], ev.data[1])); }, 3, cb);\n}\nexport function gunzipSync(data, opts) {\n var st = gzs(data);\n if (st + 8 > data.length)\n err(6, 'invalid gzip data');\n return inflt(data.subarray(st, -8), { i: 2 }, opts && opts.out || new u8(gzl(data)), opts && opts.dictionary);\n}\n/**\n * Streaming Zlib compression\n */\nvar Zlib = /*#__PURE__*/ (function () {\n function Zlib(opts, cb) {\n this.c = adler();\n this.v = 1;\n Deflate.call(this, opts, cb);\n }\n /**\n * Pushes a chunk to be zlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Zlib.prototype.push = function (chunk, final) {\n this.c.p(chunk);\n Deflate.prototype.push.call(this, chunk, final);\n };\n Zlib.prototype.p = function (c, f) {\n var raw = dopt(c, this.o, this.v && (this.o.dictionary ? 6 : 2), f && 4, this.s);\n if (this.v)\n zlh(raw, this.o), this.v = 0;\n if (f)\n wbytes(raw, raw.length - 4, this.c.d());\n this.ondata(raw, f);\n };\n /**\n * Flushes buffered uncompressed data. Useful to immediately retrieve the\n * zlibbed output for small inputs.\n * @param sync Whether to flush to a byte boundary. A sync flush takes 4-5\n * extra bytes, but guarantees all pushed data is immediately\n * decompressible.\n */\n Zlib.prototype.flush = function (sync) {\n Deflate.prototype.flush.call(this, sync);\n };\n return Zlib;\n}());\nexport { Zlib };\n/**\n * Asynchronous streaming Zlib compression\n */\nvar AsyncZlib = /*#__PURE__*/ (function () {\n function AsyncZlib(opts, cb) {\n astrmify([\n bDflt,\n zle,\n function () { return [astrm, Deflate, Zlib]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Zlib(ev.data);\n onmessage = astrm(strm);\n }, 10, 1);\n }\n return AsyncZlib;\n}());\nexport { AsyncZlib };\nexport function zlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bDflt,\n zle,\n function () { return [zlibSync]; }\n ], function (ev) { return pbf(zlibSync(ev.data[0], ev.data[1])); }, 4, cb);\n}\n/**\n * Compress data with Zlib\n * @param data The data to compress\n * @param opts The compression options\n * @returns The zlib-compressed version of the data\n */\nexport function zlibSync(data, opts) {\n if (!opts)\n opts = {};\n var a = adler();\n a.p(data);\n var d = dopt(data, opts, opts.dictionary ? 6 : 2, 4);\n return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;\n}\n/**\n * Streaming Zlib decompression\n */\nvar Unzlib = /*#__PURE__*/ (function () {\n function Unzlib(opts, cb) {\n Inflate.call(this, opts, cb);\n this.v = opts && opts.dictionary ? 2 : 1;\n }\n /**\n * Pushes a chunk to be unzlibbed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzlib.prototype.push = function (chunk, final) {\n Inflate.prototype.e.call(this, chunk);\n if (this.v) {\n if (this.p.length < 6 && !final)\n return;\n this.p = this.p.subarray(zls(this.p, this.v - 1)), this.v = 0;\n }\n if (final) {\n if (this.p.length < 4)\n err(6, 'invalid zlib data');\n this.p = this.p.subarray(0, -4);\n }\n // necessary to prevent TS from using the closure value\n // This allows for workerization to function correctly\n Inflate.prototype.c.call(this, final);\n };\n return Unzlib;\n}());\nexport { Unzlib };\n/**\n * Asynchronous streaming Zlib decompression\n */\nvar AsyncUnzlib = /*#__PURE__*/ (function () {\n function AsyncUnzlib(opts, cb) {\n astrmify([\n bInflt,\n zule,\n function () { return [astrm, Inflate, Unzlib]; }\n ], this, StrmOpt.call(this, opts, cb), function (ev) {\n var strm = new Unzlib(ev.data);\n onmessage = astrm(strm);\n }, 11, 0);\n }\n return AsyncUnzlib;\n}());\nexport { AsyncUnzlib };\nexport function unzlib(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return cbify(data, opts, [\n bInflt,\n zule,\n function () { return [unzlibSync]; }\n ], function (ev) { return pbf(unzlibSync(ev.data[0], gopt(ev.data[1]))); }, 5, cb);\n}\nexport function unzlibSync(data, opts) {\n return inflt(data.subarray(zls(data, opts && opts.dictionary), -4), { i: 2 }, opts && opts.out, opts && opts.dictionary);\n}\n// Default algorithm for compression (used because having a known output size allows faster decompression)\nexport { gzip as compress, AsyncGzip as AsyncCompress };\nexport { gzipSync as compressSync, Gzip as Compress };\n/**\n * Streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar Decompress = /*#__PURE__*/ (function () {\n function Decompress(opts, cb) {\n this.o = StrmOpt.call(this, opts, cb) || {};\n this.G = Gunzip;\n this.I = Inflate;\n this.Z = Unzlib;\n }\n // init substream\n // overriden by AsyncDecompress\n Decompress.prototype.i = function () {\n var _this = this;\n this.s.ondata = function (dat, final) {\n _this.ondata(dat, final);\n };\n };\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Decompress.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (!this.s) {\n if (this.p && this.p.length) {\n var n = new u8(this.p.length + chunk.length);\n n.set(this.p), n.set(chunk, this.p.length);\n }\n else\n this.p = chunk;\n if (this.p.length > 2) {\n this.s = (this.p[0] == 31 && this.p[1] == 139 && this.p[2] == 8)\n ? new this.G(this.o)\n : ((this.p[0] & 15) != 8 || (this.p[0] >> 4) > 7 || ((this.p[0] << 8 | this.p[1]) % 31))\n ? new this.I(this.o)\n : new this.Z(this.o);\n this.i();\n this.s.push(this.p, final);\n this.p = null;\n }\n }\n else\n this.s.push(chunk, final);\n };\n return Decompress;\n}());\nexport { Decompress };\n/**\n * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression\n */\nvar AsyncDecompress = /*#__PURE__*/ (function () {\n function AsyncDecompress(opts, cb) {\n Decompress.call(this, opts, cb);\n this.queuedSize = 0;\n this.G = AsyncGunzip;\n this.I = AsyncInflate;\n this.Z = AsyncUnzlib;\n }\n AsyncDecompress.prototype.i = function () {\n var _this = this;\n this.s.ondata = function (err, dat, final) {\n _this.ondata(err, dat, final);\n };\n this.s.ondrain = function (size) {\n _this.queuedSize -= size;\n if (_this.ondrain)\n _this.ondrain(size);\n };\n };\n /**\n * Pushes a chunk to be decompressed\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncDecompress.prototype.push = function (chunk, final) {\n this.queuedSize += chunk.length;\n Decompress.prototype.push.call(this, chunk, final);\n };\n return AsyncDecompress;\n}());\nexport { AsyncDecompress };\nexport function decompress(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzip(data, opts, cb)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflate(data, opts, cb)\n : unzlib(data, opts, cb);\n}\n/**\n * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format\n * @param data The data to decompress\n * @param opts The decompression options\n * @returns The decompressed version of the data\n */\nexport function decompressSync(data, opts) {\n return (data[0] == 31 && data[1] == 139 && data[2] == 8)\n ? gunzipSync(data, opts)\n : ((data[0] & 15) != 8 || (data[0] >> 4) > 7 || ((data[0] << 8 | data[1]) % 31))\n ? inflateSync(data, opts)\n : unzlibSync(data, opts);\n}\n// flatten a directory structure\nvar fltn = function (d, p, t, o) {\n for (var k in d) {\n var val = d[k], n = p + k, op = o;\n if (Array.isArray(val))\n op = mrg(o, val[1]), val = val[0];\n if (ArrayBuffer.isView(val))\n t[n] = [val, op];\n else {\n t[n += '/'] = [new u8(0), op];\n fltn(val, n, t, o);\n }\n }\n};\n// text encoder\nvar te = typeof TextEncoder != 'undefined' && /*#__PURE__*/ new TextEncoder();\n// text decoder\nvar td = typeof TextDecoder != 'undefined' && /*#__PURE__*/ new TextDecoder();\n// text decoder stream\nvar tds = 0;\ntry {\n td.decode(et, { stream: true });\n tds = 1;\n}\ncatch (e) { }\n// decode UTF8\nvar dutf8 = function (d) {\n for (var r = '', i = 0;;) {\n var c = d[i++];\n var eb = (c > 127) + (c > 223) + (c > 239);\n if (i + eb > d.length)\n return { s: r, r: slc(d, i - 1) };\n if (!eb)\n r += String.fromCharCode(c);\n else if (eb == 3) {\n c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63)) - 65536,\n r += String.fromCharCode(55296 | (c >> 10), 56320 | (c & 1023));\n }\n else if (eb & 1)\n r += String.fromCharCode((c & 31) << 6 | (d[i++] & 63));\n else\n r += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63));\n }\n};\n/**\n * Streaming UTF-8 decoding\n */\nvar DecodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is decoded\n */\n function DecodeUTF8(cb) {\n this.ondata = cb;\n if (tds)\n this.t = new TextDecoder();\n else\n this.p = et;\n }\n /**\n * Pushes a chunk to be decoded from UTF-8 binary\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n DecodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n final = !!final;\n if (this.t) {\n this.ondata(this.t.decode(chunk, { stream: true }), final);\n if (final) {\n if (this.t.decode().length)\n err(8);\n this.t = null;\n }\n return;\n }\n if (!this.p)\n err(4);\n var dat = new u8(this.p.length + chunk.length);\n dat.set(this.p);\n dat.set(chunk, this.p.length);\n var _a = dutf8(dat), s = _a.s, r = _a.r;\n if (final) {\n if (r.length)\n err(8);\n this.p = null;\n }\n else\n this.p = r;\n this.ondata(s, final);\n };\n return DecodeUTF8;\n}());\nexport { DecodeUTF8 };\n/**\n * Streaming UTF-8 encoding\n */\nvar EncodeUTF8 = /*#__PURE__*/ (function () {\n /**\n * Creates a UTF-8 decoding stream\n * @param cb The callback to call whenever data is encoded\n */\n function EncodeUTF8(cb) {\n this.ondata = cb;\n }\n /**\n * Pushes a chunk to be encoded to UTF-8\n * @param chunk The string data to push\n * @param final Whether this is the last chunk\n */\n EncodeUTF8.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n if (this.d)\n err(4);\n this.ondata(strToU8(chunk), this.d = final || false);\n };\n return EncodeUTF8;\n}());\nexport { EncodeUTF8 };\n/**\n * Converts a string into a Uint8Array for use with compression/decompression methods\n * @param str The string to encode\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless decoding a binary string.\n * @returns The string encoded in UTF-8/Latin-1 binary\n */\nexport function strToU8(str, latin1) {\n if (latin1) {\n var ar_1 = new u8(str.length);\n for (var i = 0; i < str.length; ++i)\n ar_1[i] = str.charCodeAt(i);\n return ar_1;\n }\n if (te)\n return te.encode(str);\n var l = str.length;\n var ar = new u8(str.length + (str.length >> 1));\n var ai = 0;\n var w = function (v) { ar[ai++] = v; };\n for (var i = 0; i < l; ++i) {\n if (ai + 5 > ar.length) {\n var n = new u8(ai + 8 + ((l - i) << 1));\n n.set(ar);\n ar = n;\n }\n var c = str.charCodeAt(i);\n if (c < 128 || latin1)\n w(c);\n else if (c < 2048)\n w(192 | (c >> 6)), w(128 | (c & 63));\n else if (c > 55295 && c < 57344)\n c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),\n w(240 | (c >> 18)), w(128 | ((c >> 12) & 63)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n else\n w(224 | (c >> 12)), w(128 | ((c >> 6) & 63)), w(128 | (c & 63));\n }\n return slc(ar, 0, ai);\n}\n/**\n * Converts a Uint8Array to a string\n * @param dat The data to decode to string\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\n * not need to be true unless encoding to binary string.\n * @returns The original UTF-8/Latin-1 string\n */\nexport function strFromU8(dat, latin1) {\n if (latin1) {\n var r = '';\n for (var i = 0; i < dat.length; i += 16384)\n r += String.fromCharCode.apply(null, dat.subarray(i, i + 16384));\n return r;\n }\n else if (td) {\n return td.decode(dat);\n }\n else {\n var _a = dutf8(dat), s = _a.s, r = _a.r;\n if (r.length)\n err(8);\n return s;\n }\n}\n;\n// deflate bit flag\nvar dbf = function (l) { return l == 1 ? 3 : l < 6 ? 2 : l == 9 ? 1 : 0; };\n// skip local zip header\nvar slzh = function (d, b) { return b + 30 + b2(d, b + 26) + b2(d, b + 28); };\n// read zip header\nvar zh = function (d, b, z) {\n var fnl = b2(d, b + 28), efl = b2(d, b + 30), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl;\n var _a = z64hs(d, es, efl, z, b4(d, b + 20), b4(d, b + 24), b4(d, b + 42)), sc = _a[0], su = _a[1], off = _a[2];\n return [b2(d, b + 10), sc, su, fn, es + efl + b2(d, b + 32), off];\n};\n// read zip64 header sizes\nvar z64hs = function (d, b, l, z, sc, su, off) {\n var nsc = sc == 4294967295, nsu = su == 4294967295, noff = off == 4294967295, e = b + l;\n var nf = nsc + nsu + noff;\n if (z && nf) {\n for (; b + 4 < e; b += 4 + b2(d, b + 2)) {\n if (b2(d, b) == 1) {\n return [\n nsc ? b8(d, b + 4 + 8 * nsu) : sc,\n nsu ? b8(d, b + 4) : su,\n noff ? b8(d, b + 4 + 8 * (nsu + nsc)) : off,\n 1\n ];\n }\n }\n // z == 2 for unknown whether or not zip64\n if (z < 2)\n err(13);\n }\n return [sc, su, off, 0];\n};\n// extra field length\nvar exfl = function (ex) {\n var le = 0;\n if (ex) {\n for (var k in ex) {\n var l = ex[k].length;\n if (l > 65535)\n err(9);\n le += l + 4;\n }\n }\n return le;\n};\n// write zip header\nvar wzh = function (d, b, f, fn, u, c, ce, co) {\n var fl = fn.length, ex = f.extra, col = co && co.length;\n var exl = exfl(ex);\n wbytes(d, b, ce != null ? 0x2014B50 : 0x4034B50), b += 4;\n if (ce != null)\n d[b++] = 20, d[b++] = f.os;\n d[b] = 20, b += 2; // spec compliance? what's that?\n d[b++] = (f.flag << 1) | (c < 0 && 8), d[b++] = u && 8;\n d[b++] = f.compression & 255, d[b++] = f.compression >> 8;\n var dt = new Date(f.mtime == null ? Date.now() : f.mtime), y = dt.getFullYear() - 1980;\n if (y < 0 || y > 119)\n err(10);\n wbytes(d, b, (y << 25) | ((dt.getMonth() + 1) << 21) | (dt.getDate() << 16) | (dt.getHours() << 11) | (dt.getMinutes() << 5) | (dt.getSeconds() >> 1)), b += 4;\n if (c != -1) {\n wbytes(d, b, f.crc);\n wbytes(d, b + 4, c < 0 ? -c - 2 : c);\n wbytes(d, b + 8, f.size);\n }\n wbytes(d, b + 12, fl);\n wbytes(d, b + 14, exl), b += 16;\n if (ce != null) {\n wbytes(d, b, col);\n wbytes(d, b + 6, f.attrs);\n wbytes(d, b + 10, ce), b += 14;\n }\n d.set(fn, b);\n b += fl;\n if (exl) {\n for (var k in ex) {\n var exf = ex[k], l = exf.length;\n wbytes(d, b, +k);\n wbytes(d, b + 2, l);\n d.set(exf, b + 4), b += 4 + l;\n }\n }\n if (col)\n d.set(co, b), b += col;\n return b;\n};\n// write zip footer (end of central directory)\nvar wzf = function (o, b, c, d, e) {\n wbytes(o, b, 0x6054B50); // skip disk\n wbytes(o, b + 8, c);\n wbytes(o, b + 10, c);\n wbytes(o, b + 12, d);\n wbytes(o, b + 16, e);\n};\n/**\n * A pass-through stream to keep data uncompressed in a ZIP archive.\n */\nvar ZipPassThrough = /*#__PURE__*/ (function () {\n /**\n * Creates a pass-through stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n */\n function ZipPassThrough(filename) {\n this.filename = filename;\n this.c = crc();\n this.size = 0;\n this.compression = 0;\n }\n /**\n * Processes a chunk and pushes to the output stream. You can override this\n * method in a subclass for custom behavior, but by default this passes\n * the data through. You must call this.ondata(err, chunk, final) at some\n * point in this method.\n * @param chunk The chunk to process\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.process = function (chunk, final) {\n this.ondata(null, chunk, final);\n };\n /**\n * Pushes a chunk to be added. If you are subclassing this with a custom\n * compression algorithm, note that you must push data from the source\n * file only, pre-compression.\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipPassThrough.prototype.push = function (chunk, final) {\n if (!this.ondata)\n err(5);\n this.c.p(chunk);\n this.size += chunk.length;\n if (final)\n this.crc = this.c.d();\n // we shouldn't really do this cast, but properly handling ArrayBufferLike\n // makes the API unergonomic with Buffer\n this.process(chunk, final || false);\n };\n return ZipPassThrough;\n}());\nexport { ZipPassThrough };\n// I don't extend because TypeScript extension adds 1kB of runtime bloat\n/**\n * Streaming DEFLATE compression for ZIP archives. Prefer using AsyncZipDeflate\n * for better performance\n */\nvar ZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function ZipDeflate(filename, opts) {\n var _this = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new Deflate(opts, function (dat, final) {\n _this.ondata(null, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n }\n ZipDeflate.prototype.process = function (chunk, final) {\n try {\n this.d.push(chunk, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n ZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return ZipDeflate;\n}());\nexport { ZipDeflate };\n/**\n * Asynchronous streaming DEFLATE compression for ZIP archives\n */\nvar AsyncZipDeflate = /*#__PURE__*/ (function () {\n /**\n * Creates an asynchronous DEFLATE stream that can be added to ZIP archives\n * @param filename The filename to associate with this data stream\n * @param opts The compression options\n */\n function AsyncZipDeflate(filename, opts) {\n var _this = this;\n if (!opts)\n opts = {};\n ZipPassThrough.call(this, filename);\n this.d = new AsyncDeflate(opts, function (err, dat, final) {\n _this.ondata(err, dat, final);\n });\n this.compression = 8;\n this.flag = dbf(opts.level);\n this.terminate = this.d.terminate;\n }\n AsyncZipDeflate.prototype.process = function (chunk, final) {\n this.d.push(chunk, final);\n };\n /**\n * Pushes a chunk to be deflated\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n AsyncZipDeflate.prototype.push = function (chunk, final) {\n ZipPassThrough.prototype.push.call(this, chunk, final);\n };\n return AsyncZipDeflate;\n}());\nexport { AsyncZipDeflate };\n// TODO: Better tree shaking\n/**\n * A zippable archive to which files can incrementally be added\n */\nvar Zip = /*#__PURE__*/ (function () {\n /**\n * Creates an empty ZIP archive to which files can be added\n * @param cb The callback to call whenever data for the generated ZIP archive\n * is available\n */\n function Zip(cb) {\n this.ondata = cb;\n this.u = [];\n this.d = 1;\n }\n /**\n * Adds a file to the ZIP archive\n * @param file The file stream to add\n */\n Zip.prototype.add = function (file) {\n var _this = this;\n if (!this.ondata)\n err(5);\n // finishing or finished\n if (this.d & 2)\n this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, false);\n else {\n var f = strToU8(file.filename), fl_1 = f.length;\n var com = file.comment, o = com && strToU8(com);\n var u = fl_1 != file.filename.length || (o && (com.length != o.length));\n var hl_1 = fl_1 + exfl(file.extra) + 30;\n if (fl_1 > 65535)\n this.ondata(err(11, 0, 1), null, false);\n var header = new u8(hl_1);\n wzh(header, 0, file, f, u, -1);\n var chks_1 = [header];\n var pAll_1 = function () {\n for (var _i = 0, chks_2 = chks_1; _i < chks_2.length; _i++) {\n var chk = chks_2[_i];\n _this.ondata(null, chk, false);\n }\n chks_1 = [];\n };\n var tr_1 = this.d;\n this.d = 0;\n var ind_1 = this.u.length;\n var uf_1 = mrg(file, {\n f: f,\n u: u,\n o: o,\n t: function () {\n if (file.terminate)\n file.terminate();\n },\n r: function () {\n pAll_1();\n if (tr_1) {\n var nxt = _this.u[ind_1 + 1];\n if (nxt)\n nxt.r();\n else\n _this.d = 1;\n }\n tr_1 = 1;\n }\n });\n var cl_1 = 0;\n file.ondata = function (err, dat, final) {\n if (err) {\n _this.ondata(err, dat, final);\n _this.terminate();\n }\n else {\n cl_1 += dat.length;\n chks_1.push(dat);\n if (final) {\n var dd = new u8(16);\n wbytes(dd, 0, 0x8074B50);\n wbytes(dd, 4, file.crc);\n wbytes(dd, 8, cl_1);\n wbytes(dd, 12, file.size);\n chks_1.push(dd);\n uf_1.c = cl_1, uf_1.b = hl_1 + cl_1 + 16, uf_1.crc = file.crc, uf_1.size = file.size;\n if (tr_1)\n uf_1.r();\n tr_1 = 1;\n }\n else if (tr_1)\n pAll_1();\n }\n };\n this.u.push(uf_1);\n }\n };\n /**\n * Ends the process of adding files and prepares to emit the final chunks.\n * This *must* be called after adding all desired files for the resulting\n * ZIP file to work properly.\n */\n Zip.prototype.end = function () {\n var _this = this;\n if (this.d & 2) {\n this.ondata(err(4 + (this.d & 1) * 8, 0, 1), null, true);\n return;\n }\n if (this.d)\n this.e();\n else\n this.u.push({\n r: function () {\n if (!(_this.d & 1))\n return;\n _this.u.splice(-1, 1);\n _this.e();\n },\n t: function () { }\n });\n this.d = 3;\n };\n Zip.prototype.e = function () {\n var bt = 0, l = 0, tl = 0;\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n tl += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0);\n }\n var out = new u8(tl + 22);\n for (var _b = 0, _c = this.u; _b < _c.length; _b++) {\n var f = _c[_b];\n wzh(out, bt, f, f.f, f.u, -f.c - 2, l, f.o);\n bt += 46 + f.f.length + exfl(f.extra) + (f.o ? f.o.length : 0), l += f.b;\n }\n wzf(out, bt, this.u.length, tl, l);\n this.ondata(null, out, true);\n this.d = 2;\n };\n /**\n * A method to terminate any internal workers used by the stream. Subsequent\n * calls to add() will fail.\n */\n Zip.prototype.terminate = function () {\n for (var _i = 0, _a = this.u; _i < _a.length; _i++) {\n var f = _a[_i];\n f.t();\n }\n this.d = 2;\n };\n return Zip;\n}());\nexport { Zip };\nexport function zip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n var r = {};\n fltn(data, '', r, opts);\n var k = Object.keys(r);\n var lft = k.length, o = 0, tot = 0;\n var slft = lft, files = new Array(lft);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var cbd = function (a, b) {\n mt(function () { cb(a, b); });\n };\n mt(function () { cbd = cb; });\n var cbf = function () {\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n tot = 0;\n for (var i = 0; i < slft; ++i) {\n var f = files[i];\n try {\n var l = f.c.length;\n wzh(out, tot, f, f.f, f.u, l);\n var badd = 30 + f.f.length + exfl(f.extra);\n var loc = tot + badd;\n out.set(f.c, loc);\n wzh(out, o, f, f.f, f.u, l, tot, f.m), o += 16 + badd + (f.m ? f.m.length : 0), tot = loc + l;\n }\n catch (e) {\n return cbd(e, null);\n }\n }\n wzf(out, o, files.length, cdl, oe);\n cbd(null, out);\n };\n if (!lft)\n cbf();\n var _loop_1 = function (i) {\n var fn = k[i];\n var _a = r[fn], file = _a[0], p = _a[1];\n var c = crc(), size = file.length;\n c.p(file);\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n var compression = p.level == 0 ? 0 : 8;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n }\n else {\n var l = d.length;\n files[i] = mrg(p, {\n size: size,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n compression: compression\n });\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n if (!--lft)\n cbf();\n }\n };\n if (s > 65535)\n cbl(err(11, 0, 1), null);\n if (!compression)\n cbl(null, file);\n else if (size < 160000) {\n try {\n cbl(null, deflateSync(file, p));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(deflate(file, p, cbl));\n };\n // Cannot use lft because it can decrease\n for (var i = 0; i < slft; ++i) {\n _loop_1(i);\n }\n return tAll;\n}\n/**\n * Synchronously creates a ZIP file. Prefer using `zip` for better performance\n * with more than one file.\n * @param data The directory structure for the ZIP archive\n * @param opts The main options, merged with per-file options\n * @returns The generated ZIP archive\n */\nexport function zipSync(data, opts) {\n if (!opts)\n opts = {};\n var r = {};\n var files = [];\n fltn(data, '', r, opts);\n var o = 0;\n var tot = 0;\n for (var fn in r) {\n var _a = r[fn], file = _a[0], p = _a[1];\n var compression = p.level == 0 ? 0 : 8;\n var f = strToU8(fn), s = f.length;\n var com = p.comment, m = com && strToU8(com), ms = m && m.length;\n var exl = exfl(p.extra);\n if (s > 65535)\n err(11);\n var d = compression ? deflateSync(file, p) : file, l = d.length;\n var c = crc();\n c.p(file);\n files.push(mrg(p, {\n size: file.length,\n crc: c.d(),\n c: d,\n f: f,\n m: m,\n u: s != fn.length || (m && (com.length != ms)),\n o: o,\n compression: compression\n }));\n o += 30 + s + exl + l;\n tot += 76 + 2 * (s + exl) + (ms || 0) + l;\n }\n var out = new u8(tot + 22), oe = o, cdl = tot - o;\n for (var i = 0; i < files.length; ++i) {\n var f = files[i];\n wzh(out, f.o, f, f.f, f.u, f.c.length);\n var badd = 30 + f.f.length + exfl(f.extra);\n out.set(f.c, f.o + badd);\n wzh(out, o, f, f.f, f.u, f.c.length, f.o, f.m), o += 16 + badd + (f.m ? f.m.length : 0);\n }\n wzf(out, o, files.length, cdl, oe);\n return out;\n}\n/**\n * Streaming pass-through decompression for ZIP archives\n */\nvar UnzipPassThrough = /*#__PURE__*/ (function () {\n function UnzipPassThrough() {\n }\n UnzipPassThrough.prototype.push = function (chunk, final) {\n // same as ZipPassThrough: cast to retain Buffer ergonomics\n this.ondata(null, chunk, final);\n };\n UnzipPassThrough.compression = 0;\n return UnzipPassThrough;\n}());\nexport { UnzipPassThrough };\n/**\n * Streaming DEFLATE decompression for ZIP archives. Prefer AsyncZipInflate for\n * better performance.\n */\nvar UnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function UnzipInflate() {\n var _this = this;\n this.i = new Inflate(function (dat, final) {\n _this.ondata(null, dat, final);\n });\n }\n UnzipInflate.prototype.push = function (chunk, final) {\n try {\n this.i.push(chunk, final);\n }\n catch (e) {\n this.ondata(e, null, final);\n }\n };\n UnzipInflate.compression = 8;\n return UnzipInflate;\n}());\nexport { UnzipInflate };\n/**\n * Asynchronous streaming DEFLATE decompression for ZIP archives\n */\nvar AsyncUnzipInflate = /*#__PURE__*/ (function () {\n /**\n * Creates a DEFLATE decompression that can be used in ZIP archives\n */\n function AsyncUnzipInflate(_, sz) {\n var _this = this;\n if (sz < 320000) {\n this.i = new Inflate(function (dat, final) {\n _this.ondata(null, dat, final);\n });\n }\n else {\n this.i = new AsyncInflate(function (err, dat, final) {\n _this.ondata(err, dat, final);\n });\n this.terminate = this.i.terminate;\n }\n }\n AsyncUnzipInflate.prototype.push = function (chunk, final) {\n if (this.i.terminate)\n chunk = slc(chunk, 0);\n this.i.push(chunk, final);\n };\n AsyncUnzipInflate.compression = 8;\n return AsyncUnzipInflate;\n}());\nexport { AsyncUnzipInflate };\n/**\n * A ZIP archive decompression stream that emits files as they are discovered\n */\nvar Unzip = /*#__PURE__*/ (function () {\n /**\n * Creates a ZIP decompression stream\n * @param cb The callback to call whenever a file in the ZIP archive is found\n */\n function Unzip(cb) {\n this.onfile = cb;\n this.k = [];\n this.o = {\n 0: UnzipPassThrough\n };\n this.p = et;\n }\n /**\n * Pushes a chunk to be unzipped\n * @param chunk The chunk to push\n * @param final Whether this is the last chunk\n */\n Unzip.prototype.push = function (chunk, final) {\n var _this = this;\n if (!this.onfile)\n err(5);\n if (!this.p)\n err(4);\n if (this.c > 0) {\n var len = Math.min(this.c, chunk.length);\n var toAdd = chunk.subarray(0, len);\n this.c -= len;\n if (this.d)\n this.d.push(toAdd, !this.c);\n else\n this.k[0].push(toAdd);\n chunk = chunk.subarray(len);\n if (chunk.length)\n return this.push(chunk, final);\n }\n else {\n var f = 0, i = 0, is = void 0, buf = void 0;\n if (!this.p.length)\n buf = chunk;\n else if (!chunk.length)\n buf = this.p;\n else {\n buf = new u8(this.p.length + chunk.length);\n buf.set(this.p), buf.set(chunk, this.p.length);\n }\n var l = buf.length, oc = this.c, add = oc && this.d;\n var _loop_2 = function () {\n var sig = b4(buf, i);\n if (sig == 0x4034B50) {\n f = 1, is = i;\n this_1.d = null;\n this_1.c = 0;\n var bf = b2(buf, i + 6), cmp_1 = b2(buf, i + 8), u = bf & 2048, dd = bf & 8, fnl = b2(buf, i + 26), es = b2(buf, i + 28);\n if (l > i + 30 + fnl + es) {\n var chks_3 = [];\n this_1.k.unshift(chks_3);\n f = 2;\n var lsc = b4(buf, i + 18), lsu = b4(buf, i + 22);\n var fn_1 = strFromU8(buf.subarray(i + 30, i += 30 + fnl), !u);\n var _a = z64hs(buf, i, es, 2, lsc, lsu, 0), sc_1 = _a[0], su_1 = _a[1], z64 = _a[3];\n if (dd)\n sc_1 = -1 - z64;\n i += es;\n this_1.c = sc_1;\n var d_1;\n var file_1 = {\n name: fn_1,\n compression: cmp_1,\n start: function () {\n if (!file_1.ondata)\n err(5);\n if (!sc_1)\n file_1.ondata(null, et, true);\n else {\n var ctr = _this.o[cmp_1];\n if (!ctr)\n file_1.ondata(err(14, 'unknown compression type ' + cmp_1, 1), null, false);\n d_1 = sc_1 < 0 ? new ctr(fn_1) : new ctr(fn_1, sc_1, su_1);\n d_1.ondata = function (err, dat, final) { file_1.ondata(err, dat, final); };\n for (var _i = 0, chks_4 = chks_3; _i < chks_4.length; _i++) {\n var dat = chks_4[_i];\n d_1.push(dat, false);\n }\n if (_this.k[0] == chks_3 && _this.c)\n _this.d = d_1;\n else\n d_1.push(et, true);\n }\n },\n terminate: function () {\n if (d_1 && d_1.terminate)\n d_1.terminate();\n }\n };\n if (sc_1 >= 0)\n file_1.size = sc_1, file_1.originalSize = su_1;\n this_1.onfile(file_1);\n }\n return \"break\";\n }\n else if (oc) {\n if (sig == 0x8074B50) {\n is = i += 12 + (oc == -2 && 8), f = 3, this_1.c = 0;\n return \"break\";\n }\n else if (sig == 0x2014B50) {\n is = i -= 4, f = 3, this_1.c = 0;\n return \"break\";\n }\n }\n };\n var this_1 = this;\n for (; i < l - 4; ++i) {\n var state_1 = _loop_2();\n if (state_1 === \"break\")\n break;\n }\n this.p = et;\n if (oc < 0) {\n var dat = f ? buf.subarray(0, is - 12 - (oc == -2 && 8) - (b4(buf, is - 16) == 0x8074B50 && 4)) : buf.subarray(0, i);\n if (add)\n add.push(dat, !!f);\n else\n this.k[+(f == 2)].push(dat);\n }\n if (f & 2)\n return this.push(buf.subarray(i), final);\n this.p = buf.subarray(i);\n }\n if (final) {\n if (this.c)\n err(13);\n this.p = null;\n }\n };\n /**\n * Registers a decoder with the stream, allowing for files compressed with\n * the compression type provided to be expanded correctly\n * @param decoder The decoder constructor\n */\n Unzip.prototype.register = function (decoder) {\n this.o[decoder.compression] = decoder;\n };\n return Unzip;\n}());\nexport { Unzip };\nvar mt = typeof queueMicrotask == 'function' ? queueMicrotask : typeof setTimeout == 'function' ? setTimeout : function (fn) { fn(); };\nexport function unzip(data, opts, cb) {\n if (!cb)\n cb = opts, opts = {};\n if (typeof cb != 'function')\n err(7);\n var term = [];\n var tAll = function () {\n for (var i = 0; i < term.length; ++i)\n term[i]();\n };\n var files = {};\n var cbd = function (a, b) {\n mt(function () { cb(a, b); });\n };\n mt(function () { cbd = cb; });\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558) {\n cbd(err(13, 0, 1), null);\n return tAll;\n }\n }\n ;\n var lft = b2(data, e + 8);\n if (lft) {\n var c = lft;\n var o = b4(data, e + 16);\n var z = b4(data, e - 20) == 0x7064B50;\n if (z) {\n var ze = b4(data, e - 12);\n z = b4(data, ze) == 0x6064B50;\n if (z) {\n c = lft = b4(data, ze + 32);\n o = b4(data, ze + 48);\n }\n }\n var fltr = opts && opts.filter;\n var _loop_3 = function (i) {\n var _a = zh(data, o, z), c_1 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n var cbl = function (e, d) {\n if (e) {\n tAll();\n cbd(e, null);\n }\n else {\n if (d)\n files[fn] = d;\n if (!--lft)\n cbd(null, files);\n }\n };\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_1\n })) {\n if (!c_1)\n cbl(null, slc(data, b, b + sc));\n else if (c_1 == 8) {\n var infl = data.subarray(b, b + sc);\n // Synchronously decompress under 512KB, or barely-compressed data\n if (su < 524288 || sc > 0.8 * su) {\n try {\n cbl(null, inflateSync(infl, { out: new u8(su) }));\n }\n catch (e) {\n cbl(e, null);\n }\n }\n else\n term.push(inflate(infl, { size: su }, cbl));\n }\n else\n cbl(err(14, 'unknown compression type ' + c_1, 1), null);\n }\n else\n cbl(null, null);\n };\n for (var i = 0; i < c; ++i) {\n _loop_3(i);\n }\n }\n else\n cbd(null, {});\n return tAll;\n}\n/**\n * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better\n * performance with more than one file.\n * @param data The raw compressed ZIP file\n * @param opts The ZIP extraction options\n * @returns The decompressed files\n */\nexport function unzipSync(data, opts) {\n var files = {};\n var e = data.length - 22;\n for (; b4(data, e) != 0x6054B50; --e) {\n if (!e || data.length - e > 65558)\n err(13);\n }\n ;\n var c = b2(data, e + 8);\n if (!c)\n return {};\n var o = b4(data, e + 16);\n var z = b4(data, e - 20) == 0x7064B50;\n if (z) {\n var ze = b4(data, e - 12);\n z = b4(data, ze) == 0x6064B50;\n if (z) {\n c = b4(data, ze + 32);\n o = b4(data, ze + 48);\n }\n }\n var fltr = opts && opts.filter;\n for (var i = 0; i < c; ++i) {\n var _a = zh(data, o, z), c_2 = _a[0], sc = _a[1], su = _a[2], fn = _a[3], no = _a[4], off = _a[5], b = slzh(data, off);\n o = no;\n if (!fltr || fltr({\n name: fn,\n size: sc,\n originalSize: su,\n compression: c_2\n })) {\n if (!c_2)\n files[fn] = slc(data, b, b + sc);\n else if (c_2 == 8)\n files[fn] = inflateSync(data.subarray(b, b + sc), { out: new u8(su) });\n else\n err(14, 'unknown compression type ' + c_2);\n }\n }\n return files;\n}\n","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar UnzipError = /*#__PURE__*/function (_Error) {\n _inherits(UnzipError, _Error);\n var _super = _createSuper(UnzipError);\n function UnzipError() {\n _classCallCheck(this, UnzipError);\n return _super.apply(this, arguments);\n }\n return _createClass(UnzipError);\n}( /*#__PURE__*/_wrapNativeSuper(Error));\nexport { UnzipError as default };\nexport function createUnzipError(error) {\n var unzipError = new UnzipError(error.message);\n // Keep original stack if it exists\n if (error.stack) {\n unzipError.stack = error.stack;\n }\n // Clean up stack trace a bit in Node.js/V8 environments\n if (Error.captureStackTrace) {\n Error.captureStackTrace(unzipError, createUnzipError);\n }\n // `Error.prototype.cause` property indicates the specific, original reason\n // a given error occurred. Standardized in ES2022, it allows you to chain errors\n // by catching a low-level exception and re-throwing a meaningful, high-level error\n // without wiping out the diagnostic context or stack trace of the original failure.\n //\n // Adding a `.cause` property mimics modern error chaining for environments that support it\n // while remaining completely harmless in older systems.\n //\n unzipError.cause = error;\n // Return the error.\n return unzipError;\n}\n//# sourceMappingURL=UnzipError.js.map","// `fflate` uses \"synchronous\" decompressor on `.zip` files that're under `512KB`\n// (or when the compression level is too low), and an \"asynchronous\" (web worker)\n// decompressor otherwise, as it can be seen from the source code of the `unzip()` function.\n// This is because using web workers comes with an overhead of\n// both creating a new worker and sending data back and forth.\n//\nimport { unzip } from 'fflate';\nimport { createUnzipError } from './UnzipError.js';\n\n/**\r\n * Reads `*.zip` file contents. Ignores anything besides `.xml` or `.xml.rels` files.\r\n * @param {ArrayBuffer} input\r\n * @return {Promise<Record<string,Uint8Array>>} Resolves to an object holding `*.zip` file entries.\r\n */\nexport default function unzipFromArrayBuffer(input, options) {\n return unzipFromArrayBufferUsingFunction(input, options, unzipAsync, true);\n}\n\n/**\r\n * Reads `*.zip` file contents. Ignores anything besides `.xml` or `.xml.rels` files.\r\n * @param {ArrayBuffer} input\r\n * @param {(ArrayBuffer) => Record<string, Uint8Array> | Promise<Record<string, Uint8Array>>} unzip\r\n * @param {boolean} isAsync — Should be `true` when `unzip()` returns a `Promise`, `false` otherwise.\r\n * @return {Promise<Record<string,Uint8Array>> | Record<string,Uint8Array>} Resolves to an object holding `*.zip` file entries.\r\n */\nexport function unzipFromArrayBufferUsingFunction(input) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n _filter = _ref.filter;\n var unzip = arguments.length > 2 ? arguments[2] : undefined;\n var isAsync = arguments.length > 3 ? arguments[3] : undefined;\n // Read the `.zip` archive.\n // `result` is either `object` or `Promise<object>`\n return unzip(new Uint8Array(input), {\n // Ignore certain types of files.\n filter: function filter(file) {\n if (_filter) {\n return _filter({\n path: file.name\n });\n }\n return true;\n }\n }).then(function (result) {\n return result;\n }, function (error) {\n // If `fflate` throws its specific error then it implies that the `.zip` file is not valid.\n if (isFlateError(error)) {\n throw createUnzipError(error);\n } else {\n throw error;\n }\n });\n}\nfunction unzipAsync(archive) {\n return new Promise(function (resolve, reject) {\n // `unzip()` will resort to \"synchronous\" decompression in two edge cases:\n // * When the archive size is less than `512KB`.\n // * When the data is barely compressed, i.e. the compression ratio is less than 20% reduction in size.\n unzip(archive, function (error, files) {\n if (error) {\n reject(error);\n } else {\n resolve(files);\n }\n });\n });\n}\n\n// This function attempts to guess if a given `error` was thrown by `fflate`.\nfunction isFlateError(error) {\n // `fflate` doesn't export a `FlateError` class.\n // https://github.com/101arrowz/fflate/issues/290\n // return error instanceof FlateError\n\n // Here, it attempts to guess if an `error` is a `FlateError` by checking if `error.code` is a `number`.\n return typeof error.code === 'number';\n}\n//# sourceMappingURL=unzipFromArrayBuffer.js.map","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n// This code was originally submitted by Etienne Prothon.\n// https://gitlab.com/catamphetamine/read-excel-file/-/merge_requests/11\n\n// An error thrown when the input passed to `readXlsxFile()` is not a valid `.xlsx` file.\n//\n// Carries a documented, stable `code` property that consumers can reliably\n// branch on — same convention as the schema-parsing `InvalidError` class\n// (`error.code`) — instead of string-matching a low-level error message\n// leaked from a transitive dependency (Hyrum's law).\n//\n// The `name` property is set so that the error type can also be detected via\n// `error.name === 'InvalidInputError'` in setups where `instanceof` is unreliable\n// (e.g. when both the ES-module and the CommonJS builds of this package end up\n// being loaded in the same application).\n\nvar MESSAGES = {\n XLS_FILE_NOT_SUPPORTED: 'You passed a legacy `.xls` file. Only `.xlsx` files are supported',\n FILE_NOT_SUPPORTED: 'Doesn\\'t look like an `.xlsx` file',\n INVALID_ZIP: 'Couldn\\'t unzip `.xlsx` file contents',\n NO_DATA: 'No data'\n};\n\n// `.xlsx` files are just ZIP archives, so every valid `.xlsx` file starts with a\n// ZIP local file header signature \"PK\" (`0x50 0x4B`). When the input isn't a ZIP\n// archive, a 3rd-party unzipper library throws an obscure low-level error\n// (for example `\"invalid signature: 0xe011cfd0\"` — the four leading bytes of a\n// binary `.xls` file read in little-endian).\n// That gives the caller nothing stable to branch on, and the exact wording can change\n// depending on the 3rd-party unzipper library being used.\n// This error standardizes the handling of cases when an invalid file is passed.\nvar InvalidInputError = /*#__PURE__*/function (_Error) {\n _inherits(InvalidInputError, _Error);\n var _super = _createSuper(InvalidInputError);\n /**\r\n * Creates an `InvalidInputError` instance.\r\n * @param {string} code\r\n * @param {any} [cause]\r\n */\n function InvalidInputError(code, cause) {\n var _this;\n _classCallCheck(this, InvalidInputError);\n _this = _super.call(this, MESSAGES[code] || code);\n\n // Set `code` property.\n _this.code = code;\n\n // Set `name` property.\n //\n // This error could be detected either by `instanceof InvalidInputError`\n // or by comparing its `name` property value to \"InvalidInputError\".\n // Why use the `name` comparison when `instanceof` operator is available?\n // Google AI tells that it does make sense in the cases when an error is\n // \"serialized\" and then \"deserialized\" in a \"distributed\" environment such as\n // throwing an error in a worker thread and then handling it in a main thread,\n // or when throwing it in one \"microservice\" and then catching it in another one,\n // or just logging as in `sentry.io`. And in those cases, `error.constructor.name`\n // isn't always available for same reason of \"serializing\" and then \"deserializing\".\n //\n // For example, even if `InvalidInputError` is a named export of this package,\n // when later bunding the application code with a bundler it will still be minified and renamed.\n // That's when the `name` property could be used to find out the actual type of the error\n // in case it gets thrown and reported to a remote system like `sentry.io`.\n //\n // By the way, core Node.js errors themselves have a `name` property.\n //\n _this.name = 'InvalidInputError';\n\n // Set `cause` property.\n //\n // `Error.prototype.cause` property indicates the specific, original reason\n // a given error occurred. Standardized in ES2022, it allows you to chain errors\n // by catching a low-level exception and re-throwing a meaningful, high-level error\n // without wiping out the diagnostic context or stack trace of the original failure.\n //\n // Adding a `.cause` property mimics modern error chaining for environments that support it\n // while remaining completely harmless in older systems.\n //\n _this.cause = cause;\n return _this;\n }\n return _createClass(InvalidInputError);\n}( /*#__PURE__*/_wrapNativeSuper(Error));\nexport { InvalidInputError as default };\n//# sourceMappingURL=InvalidInputError.js.map","// An `.xlsx` `.zip` archive could contain all kinds of files,\n// such as `.bin` printer settings or `.png` images, etc.\n//\n// Because `read-excel-file` doesn't support returning any of those types of data,\n// there's no need to read those files from the `.xlsx` `.zip` archive,\n// optimizing the unpacking process a little bit.\n//\nexport default function filterZipArchiveEntry(_ref) {\n var path = _ref.path;\n return path.endsWith('.xml') || path.endsWith('.xml.rels');\n}\n//# sourceMappingURL=filterZipArchiveEntry.js.map","// This code was originally submitted by Etienne Prothon.\n// https://gitlab.com/catamphetamine/read-excel-file/-/merge_requests/11\n\n// ZIP local file header signature: \"PK\\x03\\x04\". The first two bytes \"PK\" are\n// shared by every ZIP variant (including the empty-archive `PK\\x05\\x06` and the\n// spanned `PK\\x07\\x08` markers), so matching just \"PK\" up front avoids rejecting\n// any valid — if unusual — archive; anything malformed past that point is still\n// caught by the actual unzipper.\nvar ZIP_FILE_SIGNATURE = [0x50, 0x4B];\n\n// The first four bytes of the OLE2 Compound File Binary format (`0xD0 0xCF 0x11 0xE0`),\n// which is the container of legacy binary `.xls` files.\nvar XLS_FILE_SIGNATURE = [0xD0, 0xCF, 0x11, 0xE0];\nvar FILE_TYPE_SIGNATURES = [ZIP_FILE_SIGNATURE, XLS_FILE_SIGNATURE];\n\n// File type \"enum\".\nexport var XLSX_FILE_TYPE = FILE_TYPE_SIGNATURES.indexOf(ZIP_FILE_SIGNATURE);\nexport var XLS_FILE_TYPE = FILE_TYPE_SIGNATURES.indexOf(XLS_FILE_SIGNATURE);\n\n/**\r\n * Creates a function get determines a file type based on the leading bytes.\r\n * @return {function} A function that receives a `byte` (an element of a `Uint8Array`) and returns a `type: number?` — an index in the file types \"enum\", or `-1` if it doesn't match any file type, or `undefined` if it's still deciding on the file type.\r\n * @throws {InvalidInputError}\r\n */\nexport default function createFileTypeDetector() {\n var type;\n var possibleTypes = indexesOf(FILE_TYPE_SIGNATURES);\n var i = 0;\n // Returns a function that should be called for each leading byte of the file\n // until it starts returning a number.\n return function (_byte) {\n // If the type of the file is still being determined.\n if (isNaN(type)) {\n var t;\n possibleTypes = possibleTypes.filter(function (typeIndex) {\n if (_byte === FILE_TYPE_SIGNATURES[typeIndex][i]) {\n if (FILE_TYPE_SIGNATURES[typeIndex].length === i + 1) {\n t = typeIndex;\n }\n return true;\n }\n });\n if (possibleTypes.length === 1) {\n type = t;\n } else if (possibleTypes.length === 0) {\n // `type: -1` means \"the type of the file couldn't be determined\"\n type = -1;\n }\n }\n i++;\n return type;\n };\n}\nfunction indexesOf(array) {\n var indexes = [];\n var i = 0;\n while (i < array.length) {\n indexes.push(i);\n i++;\n }\n return indexes;\n}\n//# sourceMappingURL=createFileTypeDetector.js.map","// This code is used to profile reading `.xlsx` files.\n// It shows how much time each stage executes for.\n// To enable the logs with the timing, set a global variable\n// called `READ_EXCEL_FILE_CHECKPOINTS` in Node.js or web browser.\n\n// This global variable is only exported to be added in the dependencies of a worker function.\n// See `worker-f` package for more info.\nexport var latestCheckpointTimestamp;\nexport default function checkpoint(name) {\n var now = Date.now();\n\n // See if the global flag for \"should output log\" is set to `true`.\n var shouldOutputLog = typeof global !== 'undefined' ? Boolean(global.READ_EXCEL_FILE_CHECKPOINTS) : typeof window !== 'undefined' ? Boolean(window.READ_EXCEL_FILE_CHECKPOINTS) : false;\n if (shouldOutputLog) {\n if (latestCheckpointTimestamp) {\n console.log(' -', now - latestCheckpointTimestamp, 'ms');\n }\n console.log('*', name);\n }\n latestCheckpointTimestamp = now;\n}\nexport function resetCheckpoint() {\n latestCheckpointTimestamp = undefined;\n}\n//# sourceMappingURL=checkpoint.js.map","function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\n// This code was originally submitted by Etienne Prothon.\n// https://gitlab.com/catamphetamine/read-excel-file/-/merge_requests/11\n\nimport InvalidInputError from './InvalidInputError.js';\nimport createFileTypeDetector, { XLS_FILE_TYPE } from './createFileTypeDetector.js';\nexport default function validateLeadingBytes(bytes) {\n var fileTypeDetector = createFileTypeDetector();\n for (var _iterator = _createForOfIteratorHelperLoose(bytes), _step; !(_step = _iterator()).done;) {\n var _byte = _step.value;\n if (validateByte(_byte, fileTypeDetector)) {\n return;\n }\n }\n noFileTypeCouldBeDetermined(bytes.length);\n}\nexport function validateByte(_byte2, fileTypeDetector) {\n var fileType = fileTypeDetector(_byte2);\n if (fileType !== undefined) {\n // If it has determined that the file type is `.xls`.\n if (fileType === XLS_FILE_TYPE) {\n throw new InvalidInputError('XLS_FILE_NOT_SUPPORTED');\n }\n // If it has determined that the file type is none of the known ones.\n if (fileType < 0) {\n throw new InvalidInputError('FILE_NOT_SUPPORTED');\n }\n return true;\n }\n}\nexport function noFileTypeCouldBeDetermined(byteCount) {\n // The file type couldn't be determined — not enough bytes.\n throw new InvalidInputError(byteCount === 0 ? 'NO_DATA' : 'FILE_NOT_SUPPORTED');\n}\n//# sourceMappingURL=validateLeadingBytes.js.map","// Here it uses the \"async\" version of the unzipper function\n// just because it unzips the files inside an archive in parallel\n// rather than sequentially. It uses web workers for that.\n// Smaller files are still handled synchronously under the hood.\n//\n// It did condict a couple of basic manual tests in a web browser\n// and the results showed that a `1 MB` `.xlsx` file is read in `100 ms`\n// both using \"sync\" and \"async\" versions of the unzipper function,\n// and reading a `200 KB` `.xlsx` file is done in `70 ms` when using\n// the \"sync\" version and in `80 ms\" when using the \"async\" verison.\n//\n// So the \"sync\" version of the unzipper function is faster on smaller file sizes\n// of about < 1 MB. Still, the rest of the parsing code smoothes out this difference,\n// and the end result is not much different. Does the difference of `10 ms` justify\n// the mental overhead of choosing the right variant for a file of a given size?\n// I'd say \"not really\". Sure, performance fans wouldn't scuff on those `10 ms`\n// but it's literally \"a blink of an eye\" and about a duration of a single frame\n// on a 120 FPS screen.\n//\n// Hence, it simply uses the \"async\" variant of the unzipper function in any case.\n//\n// import unzipFromArrayBufferSync from '../zip/unzipFromArrayBufferSync.js'\nimport unzipFromArrayBuffer from '../zip/unzipFromArrayBuffer.js';\nimport UnzipError from '../zip/UnzipError.js';\nimport InvalidInputError from '../xlsx/file/InvalidInputError.js';\nimport filterZipArchiveEntry from './filterZipArchiveEntry.js';\nimport validateLeadingBytes from '../xlsx/file/validateLeadingBytes.js';\nimport checkpoint, { resetCheckpoint } from '../utility/checkpoint.js';\n\n/**\r\n * Unpacks `*.xlsx` file contents.\r\n * An `.xlsx` file is really just a `.zip` archive with `.xml` files inside.\r\n * @param {(File|Blob|ArrayBuffer)} input\r\n * @return {Promise<Record<string,Uint8Array>} Resolves to an object holding `*.xlsx` file entries.\r\n */\nexport default function unpackXlsxFile(input) {\n resetCheckpoint();\n checkpoint('unpack files');\n if (input instanceof File || input instanceof Blob) {\n return input.arrayBuffer().then(getResultFromArrayBuffer);\n }\n return Promise.resolve(input).then(getResultFromArrayBuffer);\n}\nfunction getResultFromArrayBuffer(arrayBuffer) {\n validateLeadingBytes(new Uint8Array(arrayBuffer));\n return unzipFromArrayBuffer(arrayBuffer, {\n filter: filterZipArchiveEntry\n }).then(function (result) {\n return result;\n }, function (error) {\n if (error instanceof UnzipError) {\n throw new InvalidInputError('INVALID_ZIP', error.cause);\n } else {\n throw error;\n }\n });\n}\n\n// function getResultFromArrayBuffer(arrayBuffer) {\n// \tconst result = unzipFromArrayBufferSync(arrayBuffer, { filter: filterZipArchiveEntry })\n// \treturn Promise.resolve(result)\n// }\n//# sourceMappingURL=unpackXlsxFileBrowser.js.map","/**\r\n * Parses spreadsheet info.\r\n * @param {string} content\r\n * @param {function} parseXml — SAX XML parser.\r\n * @returns {object} An object of shape `{ epoch1904: boolean, sheets: Sheet[] }`.\r\n */\nexport default function parseSpreadsheetInfo(content, parseXml) {\n var state = createInitialState();\n return parseXml(content, state, onOpenTag, null, null).then(function () {\n return getResultFromState(state);\n });\n function createInitialState() {\n return {\n workbookPr: undefined,\n sheets: []\n };\n }\n function getResultFromState(state) {\n return {\n epoch1904: state.workbookPr ? state.workbookPr.epoch1904 : false,\n sheets: state.sheets\n };\n }\n function onOpenTag(tagName, attributes, state) {\n if (tagName === 'workbookPr') {\n // The official Open XML specification dictates that the top-level `<workbook/>` element\n // should only contain exactly one `<workbookPr/>` element. In case of multiple ones,\n // only the first one is being read and the rest are simply ignored.\n //\n // There's a `1904-based-dates.xlsx` test case that happens to include multiple `<workbookPr/>`\n // elements by accident, most likely because I edited its `.xml` files by hand and didn't notice\n // the already-existing `<workbookPr/>` tag.\n //\n // At first I thought about just fixing that one `.xlsx` test file but later\n // I saw that another library called `SheetJS` specifically handles such cases\n // by only reading the first `<workbookPr/>` element and ignoring the rest,\n // so I though that perhaps it would make some sense to do same thing here.\n // https://github.com/SheetJS/sheetjs/issues/1619\n //\n if (!state.workbookPr) {\n // Read `<workbookPr/>` element attributes to detect whether dates are 1900-based or 1904-based.\n // https://support.microsoft.com/en-gb/help/214330/differences-between-the-1900-and-the-1904-date-system-in-excel\n // http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/workbookPr.html\n state.workbookPr = {\n epoch1904: attributes.date1904 === '1'\n };\n }\n } else if (tagName === 'sheet') {\n // Example of `<sheets/>` element:\n // ```\n // <sheets>\n // <sheet\n // xmlns:ns=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"\n // name=\"Sheet1\"\n // sheetId=\"1\"\n // ns:id=\"rId3\"/>\n // </sheets>\n // ```\n if (attributes.name) {\n state.sheets.push({\n // `sheetId` attribute value is an arbitrary, `1`-based unique positive integer\n // assigned to a worksheet, typically starting at `1` for the first sheet.\n // Deleting and adding new sheets might cause the sheetId values to become non-sequential.\n // For example, `sheetId`s could be `1`, `2`, `4`, if sheet `3` was deleted.\n id: Number(attributes.sheetId),\n name: attributes.name,\n relationId: attributes['r:id']\n });\n }\n }\n }\n}\n//# sourceMappingURL=parseSpreadsheetInfo.js.map","/**\r\n * Returns sheet file paths.\r\n * Seems that the correct place to look for the `sheetId` -> `filename` mapping\r\n * is `xl/_rels/workbook.xml.rels` file.\r\n * https://github.com/tidyverse/readxl/issues/104\r\n * @param {string} content — `xl/_rels/workbook.xml.rels` file contents.\r\n * @param {function} parseXml — SAX XML parser.\r\n * @return {object} — An object of shape `{ sheets: Record<string, string>, sharedStrings: string?, styles: string? }`\r\n */\nexport default function parseFilePaths(content, parseXml) {\n // Example:\n // <Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\n // ...\n // <Relationship\n // Id=\"rId3\"\n // Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet\"\n // Target=\"worksheets/sheet1.xml\"/>\n // </Relationships>\n var state = createInitialState();\n return parseXml(content, state, onOpenTag, null, null).then(function () {\n return getResultFromState(state);\n });\n function createInitialState() {\n return {\n sheets: {},\n sharedStrings: undefined,\n styles: undefined\n };\n }\n function getResultFromState(state) {\n return state;\n }\n function onOpenTag(tagName, attributes, state) {\n if (tagName === 'Relationship') {\n addFilePathForRelation(state, attributes.Id, attributes.Type, attributes.Target);\n }\n }\n function addFilePathForRelation(state, id, type, target) {\n switch (type) {\n case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles':\n state.styles = getFilePathFromRelationTarget(target);\n break;\n case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings':\n state.sharedStrings = getFilePathFromRelationTarget(target);\n break;\n case 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet':\n state.sheets[id] = getFilePathFromRelationTarget(target);\n break;\n }\n }\n function getFilePathFromRelationTarget(path) {\n // Normally, `path` is a relative path inside the ZIP archive,\n // like \"worksheets/sheet1.xml\", or \"sharedStrings.xml\", or \"styles.xml\".\n // There has been one weird case when file path was an absolute path,\n // like \"/xl/worksheets/sheet1.xml\" (specifically for sheets):\n // https://github.com/catamphetamine/read-excel-file/pull/95\n // Other libraries (like `xlsx`) and software (like Google Docs)\n // seem to support such absolute file paths, so this library does too.\n if (path[0] === '/') {\n return path.slice('/'.length);\n }\n // // Seems like a path could also be a URL.\n // // http://officeopenxml.com/anatomyofOOXML-xlsx.php\n // if (/^[a-z]+\\:\\/\\//.test(path)) {\n // return path\n // }\n return 'xl/' + path;\n }\n}\n//# sourceMappingURL=parseFilePaths.js.map","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nvar _excluded = [\"xfId\"];\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n/**\r\n * Parses `.xlsx` file styles.\r\n * http://officeopenxml.com/SSstyles.php\r\n * Returns an array of cell styles.\r\n * A cell style index is the cell style ID.\r\n * @param {string} content\r\n * @param {function} parseXml — SAX XML parser.\r\n * @returns {object} styles\r\n */\nexport default function parseStyles(content, parseXml) {\n // https://social.msdn.microsoft.com/Forums/sqlserver/en-US/708978af-b598-45c4-a598-d3518a5a09f0/howwhen-is-cellstylexfs-vs-cellxfs-applied-to-a-cell?forum=os_binaryfile\n // https://www.office-forums.com/threads/cellxfs-cellstylexfs.2163519/\n var state = createInitialState();\n return parseXml(content, state, onOpenTag, onCloseTag, null).then(function () {\n return getResultFromState(state);\n });\n function createInitialState() {\n return {\n numberFormats: {},\n baseStyles: [],\n // The first `164` elements of the `styles` array are going to be `undefined`\n // because those represent the built-in \"default\" styles in `.xlsx` specification.\n // These \"default\" styles have IDs from `0` to `163`, i.e. according to their index.\n styles: [],\n cellStyleXfs: false,\n cellXfs: false\n };\n }\n function getResultFromState(state) {\n return state.styles.map(function (style) {\n if (style.xfId) {\n var xfId = style.xfId,\n styleProperties = _objectWithoutProperties(style, _excluded);\n return _objectSpread(_objectSpread({}, state.baseStyles[xfId]), styleProperties);\n } else {\n return style;\n }\n });\n }\n function onOpenTag(tagName, attributes, state) {\n if (tagName === 'numFmt') {\n // `<numFmts/>` element contains `<numFmt/>` elements.\n // `<numFmt/>` defines a \"number format\" template.\n // The value of `numFmtId` attribute is a (numeric) ID of this \"number format\".\n state.numberFormats[attributes.numFmtId] = {\n id: Number(attributes.numFmtId),\n template: attributes.formatCode\n };\n } else if (tagName === 'cellStyleXfs') {\n // `<cellStyleXfs/>` contains \"base styles\" that could be extended by `<cellXfs/>`.\n // These styles don't apply to individual cells directly. They can only be extended.\n state.cellStyleXfs = true;\n } else if (tagName === 'cellXfs') {\n // `<cellXfs/>` contains individual cell styles. They can extend \"base styles\".\n state.cellXfs = true;\n } else if (tagName === 'xf') {\n if (state.cellStyleXfs) {\n // The index of a `<xf/>` element is by definition its numeric ID.\n // Therefore, even empty `style` elements still must be put into the array.\n state.baseStyles.push(parseCellStyle(attributes));\n } else if (state.cellXfs) {\n var style = parseCellStyle(attributes, state.numberFormats);\n // A style might extend a \"base style\" by its numeric ID.\n if (attributes.xfId) {\n style.xfId = Number(attributes.xfId);\n }\n // The index of a `<xf/>` element is by definition its numeric ID.\n // Therefore, even empty `style` elements still must be put into the array.\n state.styles.push(style);\n }\n }\n }\n function onCloseTag(tagName, state) {\n if (tagName === 'cellStyleXfs') {\n state.cellStyleXfs = false;\n } else if (tagName === 'cellXfs') {\n state.cellXfs = false;\n }\n }\n function parseCellStyle(attributes, numberFormats) {\n var style = {};\n // `numFmtId` in `<cellStyleXfs/>` and `<cellXfs/>` is a numerical ID\n // referencing the cell's \"number format\". Values from `0` to `163` are built-in formats,\n // while values `164` and above are custom formats defined in the `<numFmts/>` element.\n var numFmtId = attributes.numFmtId;\n if (numFmtId) {\n // Built-in number formats don't have a `<numFmt/>` element in `styles.xml`.\n // https://hexdocs.pm/xlsxir/number_styles.html\n if (numberFormats && numberFormats[numFmtId]) {\n // Non-built-in number format.\n style.numberFormat = numberFormats[numFmtId];\n } else {\n // Built-in number format.\n style.numberFormat = {\n id: Number(numFmtId)\n };\n }\n }\n return style;\n }\n}\n//# sourceMappingURL=parseStyles.js.map","/**\r\n * Parses `sharedStrings.xml` file.\r\n * @param {string} content\r\n * @param {function} parseXml — SAX XML parser.\r\n * @returns {Promise<string[]>}\r\n */\nexport default function parseSharedStrings(content, parseXml) {\n var state = createInitialState();\n return parseXml(content, state, onOpenTag, onCloseTag, onText).then(function () {\n return getResultFromState(state);\n });\n function createInitialState() {\n return {\n si: undefined,\n strings: []\n };\n }\n function getResultFromState(state) {\n return state.strings;\n }\n\n // In an XLSX `sharedStrings.xml` file, a <si/> (string item) element can have\n // either a single child <t/> element (meaning that \"rich formatting\" is not used)\n // or multiple child <r/> elements (meaning that \"rich formatting\" is used).\n function onOpenTag(tagName, attributes, state) {\n if (tagName === 'si') {\n state.si = createInitialStateInSharedString();\n } else if (state.si) {\n onOpenTagInSharedString(tagName, attributes, state.si);\n }\n }\n function onCloseTag(tagName, state) {\n if (tagName === 'si') {\n state.strings.push(state.si.string);\n state.si = undefined;\n } else if (state.si) {\n onCloseTagInSharedString(tagName, state.si);\n }\n }\n function onText(text, state) {\n if (state.si) {\n onTextInSharedString(text, state.si);\n }\n }\n\n // Shared String\n\n function createInitialStateInSharedString() {\n return {\n t: false,\n r: false,\n rPh: false,\n string: ''\n };\n }\n\n // In an XLSX `sharedStrings.xml` file, a <si/> (string item) element can have\n // either a single child <t/> element (meaning that \"rich formatting\" is not used)\n // or multiple child <r/> elements (meaning that \"rich formatting\" is used).\n function onOpenTagInSharedString(tagName, attributes, state) {\n // The possible children of <si> are:\n // * <t>: Represents a simple text string. For plain text, this is the only child.\n // * <r>: Represents a rich text run. When a cell contains text where only some words are bolded, colored, or styled differently, multiple <r> elements are used to break the text into formatted segments.\n // * <rPh> (Phonetic Run): Used primarily for East Asian languages to provide phonetic reading/pronunciation data (e.g., furigana in Japanese). It associates a phonetic pronunciation run right alongside the base string text tag <t>.\n // * <phoneticPr>: Defines the phonetic properties used for East Asian languages, specifically mapping how strings should be read for sorting and pronunciation.\n if (tagName === 't') {\n state.t = true;\n } else if (tagName === 'r') {\n // The possible children of <r/> are:\n // * <rPr> (Run Properties): The formatting properties for the text (font, size, color, bold, italic, etc.).\n // * <t> (Text): The actual text payload.\n // * <rPh> (Phonetic Run): Phonetic pronunciation guidance (used for East Asian languages like Japanese). It associates a phonetic pronunciation run right alongside the base string text tag <t>.\n state.r = true;\n } else if (tagName === 'rPh') {\n // The possible children of <rPh/> are:\n // * <t> (Text): Contains the actual phonetic text or reading (usually in Katakana for Japanese) that corresponds to the associated character string.\n state.rPh = true;\n }\n }\n function onCloseTagInSharedString(tagName, state) {\n if (tagName === 't') {\n state.t = false;\n } else if (tagName === 'r') {\n state.r = false;\n } else if (tagName === 'rPh') {\n state.rPh = false;\n }\n }\n function onTextInSharedString(text, state) {\n if (state.rPh) {\n // Ignore anything inside `<rPh/>` tags\n } else if (state.t) {\n if (state.r) {\n // An `<r/>` element could contain multiple `<t/>` elements,\n // the text content from all of which should be concatenated.\n state.string += text;\n } else {\n state.string = text;\n }\n }\n }\n}\n//# sourceMappingURL=parseSharedStrings.js.map","// Parses an Excel Date (represented by a \"serial\" floating-point number)\n// into a javascript `Date` timestamp in UTC+0 timezone (with time is set to 00:00).\n//\n// https://www.pcworld.com/article/3063622/software/mastering-excel-date-time-serial-numbers-networkdays-datevalue-and-more.html\n// \"If you need to calculate dates in your spreadsheets,\n// Excel uses its own unique system, which it calls Serial Numbers\".\n//\nexport default function parseExcelTimestamp(excelSerialDate, epoch1904) {\n // \"Excel serial date\" is just a (fractional) count of days passed since `00/01/1900`.\n //\n // In contrast, \"Unix timestamps\" use `01/01/1970` as the baseline for numeric dates.\n //\n // In order to convert one into another, it should calculate the count of days elapsed\n // since `00/01/1900` (Excel epoch) till `01/01/1970` (Unix epoch), or the count of days\n // between year `1900` and year `1970`, plus one day.\n //\n // It also should account for the number of \"leap years\" between year `1900` and year `1970`,\n // which is 17 of them. https://kalender-365.de/leap-years.php\n //\n // \"One year has the length of 365 days, 5 hours, 48 minutes and 45 seconds.\n // These are 365.2421875 days. This is hard to calculate with, so for practical reasons\n // a normal year has been given 365 days and a leap year 366 days. In leap years,\n // February 29th is added as leap day, which doesn't exist in a normal year.\n // A leap year is every 4 years, but not every 100 years, then again every 400 years.\n // So the year 1900 wasn't a leap year, but 2000 was\".\n //\n // And also, Excel has a historical bug when it incorrectly assumes year `1900` to be a leap year,\n // and, as a result, all Excel serial dates starting from March 1st, 1900 lag 1 day behind\n // and require an additional 1 day to be added to them in order to be converted to a proper timestamp.\n //\n // https://learn.microsoft.com/en-us/answers/questions/5249322/why-does-microsoft-excel-considers-29-02-1900-to-b?forum=msoffice-all&referrer=answers#:~:text=This%20made%20it%20easier%20for,other%20programs%20that%20use%20dates.\n //\n // \"When Lotus 1-2-3 was first released, the program assumed that the year 1900 was a leap year,\n // even though it actually was not a leap year. This made it easier for the program to handle\n // leap years and caused no harm to almost all date calculations in Lotus 1-2-3.\n //\n // When Microsoft Multiplan and Microsoft Excel were released, they also assumed that 1900\n // was a leap year. This assumption allowed Microsoft Multiplan and Microsoft Excel to use\n // the same serial date system used by Lotus 1-2-3 and provide greater compatibility with Lotus 1-2-3.\n // Treating 1900 as a leap year also made it easier for users to move worksheets from one program\n // to the other\".\n //\n // So the historical bug is basically that Excel thinks that February 29th, 1900 existed\n // while in reality it didn't. That's why it's actually 1 day off for any date after that one.\n //\n var NUMBER_OF_LEAP_YEARS_BETWEEN_1900_AND_1970 = 17;\n var JANUARY_0TH_1900_DAY = 1;\n var ERRONEOUS_FEBRUARY_29_1990_DAY = 1;\n\n // An approximate count of seconds in a day is:\n // 24 hours * 60 minutes in an hour * 60 seconds in a minute\n //\n // It is approximate because a minute could be longer than 60 seconds, due to \"leap seconds\".\n //\n // Still, javascript `Date`, and UNIX time in general, intentionally\n // drop the concept of \"leap seconds\" in order to make things simpler.\n // So this approximation is valid and doesn't result in any bugs.\n // https://stackoverflow.com/questions/53019726/where-are-the-leap-seconds-in-javascript\n //\n // \"The JavaScript Date object specifically adheres to the concept of Unix Time\n // (albeit with higher precision). This is part of the POSIX specification,\n // and thus is sometimes called \"POSIX Time\". It does not count leap seconds,\n // but rather assumes every day had exactly 86,400 seconds. You can read about\n // this in section 20.3.1.1 of the current ECMAScript specification, which states:\n //\n // \"Time is measured in ECMAScript in milliseconds since 01 January, 1970 UTC.\n // In time values leap seconds are ignored. It is assumed that there are exactly\n // 86,400,000 milliseconds per day.\"\n //\n // The reason is that the unpredictable nature of leap seconds makes them very\n // difficult to work with in APIs. One can't generally pass timestamps around\n // that need leap seconds tables to be interpreted correctly, and expect that\n // one system will interpret them the same as another. For example, a timestamp\n // `1483228826` that accounts for \"leap seconds\" should've been interpreted as\n // \"2017-01-01T00:00:00Z\", but if the receiver doesn't account for \"leap seconds\",\n // they would interpret it as \"2017-01-01T00:00:26Z\" (e.g. POSIX-based systems like Linux),\n // So \"leap seconds\" aren't really portable.\n // Even on systems that have full frequently-updated \"leap second\" tables,\n // there's no telling what adjustments those tables will contain in the future\n // (i.e. beyond the 6-month IERS announcement period) because \"leap seconds\" can't be\n // determined by a fixed mathematical formula or something like that. Instead,\n // scientists introduce them as needed based on the observed Earth's rotation around the sun.\n //\n // \"Because the Earth's rotational speed varies in response to climatic and geological events,\n // UTC leap seconds are irregularly spaced and not precisely predictable. The decision to insert\n // a leap second is made by the International Earth Rotation and Reference Systems Service (IERS),\n // typically about six months in advance, to ensure that the difference between UTC and UT1\n // does not exceed ±0.9 seconds.\"\n //\n // One example is year `1900` which is \"every fourth year\" but it still is not a \"leap year\".\n //\n // To reiterate: to support leap seconds in a programming language, the implementation\n // must go out of its way to do so, and must make tradeoffs that are not always acceptable.\n // Though there are exceptions, the general position is to not support them - not because\n // of any subversion or active countermeasures, but because supporting them properly is much,\n // much harder.\n //\n // https://en.wikipedia.org/wiki/Unix_time#Leap_seconds\n // https://en.wikipedia.org/wiki/Leap_year\n // https://en.wikipedia.org/wiki/Leap_second\n //\n var DAY = 24 * 60 * 60 * 1000;\n var DAYS_IN_YEAR = 365;\n\n // Windows operating system uses floating-point numbers to represent dates,\n // where the number represents the count of days elapsed since January 0th, 1900.\n //\n // This also means that there're 2 aspects associated with this choice:\n //\n // * January 1st, 1900, 00:00 is represented by `1` rather than `0`, which looks a bit weird.\n // * 1900 is a special year because it's a \"one in a 100 years\" occasion when it's not a leap year.\n //\n // To work around those two aspects, Mac OS chose another baseline — January 1st, 1900.\n // Although, that only postponed the second issue because 2100 is going to be the next \"speciaL\" year\n // which is not going to be a \"leap\" one.\n //\n // Older versions of Excel on Mac OS used year 1904 as the default baseline for numeric dates.\n // Since 2011, Microsoft Excel on Mac OS uses year 1900 as the default baseline for cross-platform consistency.\n // https://support.microsoft.com/en-us/office/date-systems-in-excel-e7fe7167-48a9-4b96-bb53-5612a800b487\n //\n // So the 1904 baseline is now deprecated, although still available to be configured manually.\n // So it still might be encountered in Excel files created on MacOS.\n // In that case, the Excel file contains a special flag — `<workbook><workbookPr date1904=\"1\"/>...` —\n // that tells the application which baseline is being used for numeric date timestamps.\n //\n if (epoch1904) {\n // Convert the numeric date timestamp from 1904 baseline to 1900 baseline.\n excelSerialDate += (1904 - 1900) * DAYS_IN_YEAR + JANUARY_0TH_1900_DAY + ERRONEOUS_FEBRUARY_29_1990_DAY;\n }\n var daysBeforeUnixEpoch = JANUARY_0TH_1900_DAY + ERRONEOUS_FEBRUARY_29_1990_DAY + (1970 - 1900) * DAYS_IN_YEAR + NUMBER_OF_LEAP_YEARS_BETWEEN_1900_AND_1970;\n return Math.floor((excelSerialDate - daysBeforeUnixEpoch) * DAY);\n}\n//# sourceMappingURL=parseExcelTimestamp.js.map","// On some date formats, there's a \"[$-...]\" prefix that locks the locale\n// to be a specific one when formatting a date using this format.\n//\n// https://stackoverflow.com/questions/4730152/what-indicates-an-office-open-xml-cell-contains-a-date-time-value\n//\n// Format examples:\n//\n// * \"[$-404]e/m/d\"\n// * \"[$-414]mmmm\\ yyyy;@\"\n// * \"[$-ru-RU]dd.mm.yyyy;@\"\n// * \"[$-x-sysdate]dddd, mmmm dd, yyyy\"\n//\n// This is exported only to be specified in `worker-f` dependencies.\n//\nexport var DATE_FORMAT_SPECIFIC_LOCALE_PREFIX = /^\\[\\$-[^\\]]+\\]/;\n\n// On some date formats, there's a \";@\" suffix.\n// It instructs the spreadsheet editor application to display any non-numeric\n// value as is instead of hiding it or something like that.\n//\n// For example, if one inputs \"Some text\" instead of a date in such cell,\n// it will still show \"Some text\" instead of an empty cell, even though\n// the value is strictly-speaking invalid.\n//\n// Specifically, \";\" means \"anything before this applies only to a numeric value,\n// while anything after it applies to a text value\". And a follow-up \"@\" means\n// \"for a text value, just output it as is\".\n//\n// It's not really clear why would anyone add such a feature to a format.\n// Perhaps it feels more \"user-friendly\" towards a non-\"tech-savvy\" user\n// of a spreadsheet editor application.\n//\n// Format examples:\n//\n// * \"m/d/yyyy;@\"\n// * \"[$-414]mmmm\\ yyyy;@\"\n//\n// This is exported only to be specified in `worker-f` dependencies.\n//\nexport var DATE_FORMAT_ALLOW_ANY_OTHER_TEXT_SUFFIX = /;@$/;\n\n// This is exported only to be specified in `worker-f` dependencies.\n//\nexport var IS_DATE_FORMAT_CACHE = {};\nexport default function isDateFormatCached(template) {\n if (template in IS_DATE_FORMAT_CACHE) {\n return IS_DATE_FORMAT_CACHE[template];\n }\n\n // Date format tokens could be in upper case or in lower case.\n // There seems to be no single standard.\n // So the template is lowercased first.\n template = template.toLowerCase();\n\n // On some date formats, there's an \"[$-...]\" prefix.\n // It forces a specific locale to be used when formatting a date.\n template = template.replace(DATE_FORMAT_SPECIFIC_LOCALE_PREFIX, '');\n\n // On some date formats, there's an \";@\" suffix.\n // It's not clear why would anyone need it in a date format template.\n // Still, because it occurs there, it should be stripped.\n template = template.replace(DATE_FORMAT_ALLOW_ANY_OTHER_TEXT_SUFFIX, '');\n\n // Extract all alphabetic parts from what's left from the template string.\n // Example: \"mm/dd/yyyy\" → [\"mm\", \"dd\", \"yyyy\"]\n var tokens = template.split(/\\W+/);\n var result = tokens.length === 0\n // If no alphabetic parts are present in what's left from the template string\n // then it could be any kind of template such as a generic numeric template\n // such as \"$#,##0.00\" currency template or \"0.0%\" percentage template.\n ? false\n // If a non-date-format-specific alphabetic substring is found,\n // then it might be not necessarily a date format.\n // In order to make a certain guess, all tokens have to represent viable parts of a date format.\n : tokens.every(function (token) {\n return DATE_TEMPLATE_TOKENS.indexOf(token) >= 0;\n });\n\n // Cache the result\n IS_DATE_FORMAT_CACHE[template] = result;\n\n // Return the result\n return result;\n}\n\n// These tokens could be in upper case or in lower case.\n// There seems to be no single standard, so using lower case.\n//\n// This is exported only to be specified in `worker-f` dependencies.\n//\nexport var DATE_TEMPLATE_TOKENS = [\n// Seconds (min two digits). Example: \"05\".\n'ss',\n// Minutes (min two digits). Example: \"05\". Could also be \"Months\". Weird.\n'mm',\n// Hours. Example: \"1\".\n'h',\n// Hours (min two digits). Example: \"01\".\n'hh',\n// \"AM\" part of \"AM/PM\". Lowercased just in case.\n'am',\n// \"PM\" part of \"AM/PM\". Lowercased just in case.\n'pm',\n// Day. Example: \"1\"\n'd',\n// Day (min two digits). Example: \"01\"\n'dd',\n// Month (numeric). Example: \"1\".\n'm',\n// Month (numeric, min two digits). Example: \"01\". Could also be \"Minutes\". Weird.\n'mm',\n// Month (shortened month name). Example: \"Jan\".\n'mmm',\n// Month (full month name). Example: \"January\".\n'mmmm',\n// Two-digit year. Example: \"20\".\n'yy',\n// Full year. Example: \"2020\".\n'yyyy',\n// I don't have any idea what \"e\" means.\n// It's used in \"built-in\" XLSX formats:\n// * 27 '[$-404]e/m/d';\n// * 36 '[$-404]e/m/d';\n// * 50 '[$-404]e/m/d';\n// * 57 '[$-404]e/m/d';\n'e'];\n//# sourceMappingURL=isDateFormat.js.map","// XLSX does have \"d\" type for dates, but it's not commonly used.\n// Instead, it prefers using \"n\" type for storing dates as timestamps.\n//\n// Whether a numeric value is a number or a date timestamp, it sometimes could be\n// detected by looking at the value \"format\" and seeing if it's a date-specific one.\n\nimport isDateFormat from './isDateFormat.js';\nexport default function isDateFormatStyle(style, defaultDateFormat, shouldGuessDateFormatFromNumberFormatTemplate) {\n if (!style.numberFormat) {\n return false;\n }\n if (\n // Whether it's a \"number format\" that's conventionally used for storing date timestamps.\n BUILT_IN_DATE_FORMAT_IDS.indexOf(style.numberFormat.id) >= 0 ||\n // Whether it's a \"number format\" that uses a \"formatting template\"\n // that the developer is certain is a date formatting template.\n defaultDateFormat && style.numberFormat.template === defaultDateFormat ||\n // Whether the \"smart formatting template\" feature is not disabled\n // and it has detected that it's a date formatting template by looking at it.\n shouldGuessDateFormatFromNumberFormatTemplate && style.numberFormat.template && isDateFormat(style.numberFormat.template)) {\n return true;\n }\n return false;\n}\n\n// Built-in formats have ID < 164.\n// Some of those formats are intended to use when displaying dates.\n//\n// Depending on the \"locale\" used by the spreadsheet viewing application,\n// different built-in format IDs might correspond to different templates.\n// https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.numberingformat?view=openxml-2.8.1\n//\n// Here's a list of \"locale\"-independent built-in format IDs that're known to represent dates.\n//\nvar LOCALE_INDEPENDENT_BUILT_IN_DATE_FORMAT_IDS = [14,\n// mm-dd-yy\n15,\n// d-mmm-yy\n16,\n// d-mmm\n17,\n// mmm-yy\n18,\n// h:mm AM/PM\n19,\n// h:mm:ss AM/PM\n20,\n// h:mm\n21,\n// h:mm:ss\n22,\n// m/d/yy h:mm\n45,\n// mm:ss\n46,\n// [h]:mm:ss\n47 // mmss.0\n];\n\n// \"zh-tw\" OR \"zh-cn\" locales.\n// Language glyphs (aka \"hieroglyphs\") are not replaced with their respective unicode values here.\nvar MAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS = [27,\n// [$-404]e/m/d OR yyyy\"年\"m\"月\"\n28,\n// [$-404]e\"年\"m\"月\"d\"日\" OR m\"月\"d\"日\"\n29,\n// [$-404]e\"年\"m\"月\"d\"日\" OR m\"月\"d\"日\"\n30,\n// m/d/yy OR m-d-yy\n31,\n// yyyy\"年\"m\"月\"d\"日\" OR yyyy\"年\"m\"月\"d\"日\"\n32,\n// hh\"時\"mm\"分\" OR h\"时\"mm\"分\"\n33,\n// hh\"時\"mm\"分\"ss\"秒\" OR h\"时\"mm\"分\"ss\"秒\"\n34,\n// 上午/下午hh\"時\"mm\"分\" OR 上午/下午h\"时\"mm\"分\"\n35,\n// 上午/下午hh\"時\"mm\"分\"ss\"秒\" OR 上午/下午h\"时\"mm\"分\"ss\"秒\"\n36,\n// [$-404]e/m/d OR yyyy\"年\"m\"月\"\n50,\n// [$-404]e/m/d OR yyyy\"年\"m\"月\"\n51,\n// [$-404]e\"年\"m\"月\"d\"日\" OR m\"月\"d\"日\"\n52,\n// 上午/下午hh\"時\"mm\"分\" OR yyyy\"年\"m\"月\"\n53,\n// 上午/下午hh\"時\"mm\"分\"ss\"秒\" OR m\"月\"d\"日\"\n54,\n// [$-404]e\"年\"m\"月\"d\"日\" OR m\"月\"d\"日\"\n55,\n// 上午/下午hh\"時\"mm\"分\" OR 上午/下午h\"时\"mm\"分\"\n56,\n// 上午/下午hh\"時\"mm\"分\"ss\"秒\" OR 上午/下午h\"时\"mm\"分\"ss\"秒\"\n57,\n// [$-404]e/m/d OR yyyy\"年\"m\"月\"\n58 // [$-404]e\"年\"m\"月\"d\"日\" OR m\"月\"d\"日\"\n];\n\n// \"ja-jp\" OR \"ko-kr\" locales.\n// Language glyphs (aka \"hieroglyphs\") are not replaced with their respective unicode values here.\nvar JAPANESE_OR_KOREAN_LOCALE_BUILT_IN_DATE_FORMAT_IDS = [27,\n// [$-411]ge.m.d OR yyyy\"年\" mm\"月\" dd\"日\"\n28,\n// [$-411]ggge\"年\"m\"月\"d\"日\" OR mm-dd\n29,\n// [$-411]ggge\"年\"m\"月\"d\"日\" OR mm-dd\n30,\n// m/d/yy OR mm-dd-yy\n31,\n// yyyy\"年\"m\"月\"d\"日\" OR yyyy\"년\" mm\"월\" dd\"일\"\n32,\n// h\"時\"mm\"分\" OR h\"시\" mm\"분\"\n33,\n// h\"時\"mm\"分\"ss\"秒\" OR h\"시\" mm\"분\" ss\"초\"\n34,\n// yyyy\"年\"m\"月\" OR yyyy-mm-dd\n35,\n// m\"月\"d\"日\" OR yyyy-mm-dd\n36,\n// [$-411]ge.m.d OR yyyy\"年\" mm\"月\" dd\"日\"\n50,\n// [$-411]ge.m.d OR yyyy\"年\" mm\"月\" dd\"日\"\n51,\n// [$-411]ggge\"年\"m\"月\"d\"日\" OR mm-dd\n52,\n// yyyy\"年\"m\"月\" OR yyyy-mm-dd\n53,\n// m\"月\"d\"日\" OR yyyy-mm-dd\n54,\n// [$-411]ggge\"年\"m\"月\"d\"日\" OR mm-dd\n55,\n// yyyy\"年\"m\"月\" OR yyyy-mm-dd\n56,\n// m\"月\"d\"日\" OR yyyy-mm-dd\n57,\n// [$-411]ge.m.d OR yyyy\"年\" mm\"月\" dd\"日\"\n58 // [$-411]ggge\"年\"m\"月\"d\"日\" OR mm-dd\n];\n\n// \"th-th\" locale.\n// Language glyphs (aka \"hieroglyphs\") are not replaced with their respective unicode values here.\nvar THAI_LOCALE_BUILT_IN_DATE_FORMAT_IDS = [71,\n// ว/ด/ปปปป\n72,\n// ว-ดดด-ปป\n73,\n// ว-ดดด\n74,\n// ดดด-ปป\n75,\n// ช:นน\n76,\n// ช:นน:ทท\n77,\n// ว/ด/ปปปป ช:นน\n78,\n// นน:ทท\n79,\n// [ช]:นน:ทท\n80,\n// นน:ทท.0\n81 // d/m/bb\n];\n\n// This is exported only to be passed in `worker-f` dependencies.\n//\n// Start with language-agnostic date format IDs.\nexport var BUILT_IN_DATE_FORMAT_IDS = LOCALE_INDEPENDENT_BUILT_IN_DATE_FORMAT_IDS.concat(\n// Add Mainland Chinese or Taiwanese date format IDs that haven't already been added.\nMAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS).concat(\n// Add Japanese or Korean date format IDs that haven't already been added.\nJAPANESE_OR_KOREAN_LOCALE_BUILT_IN_DATE_FORMAT_IDS.filter(function (numberFormatId) {\n return MAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS.indexOf(numberFormatId) < 0;\n})).concat(\n// Add Thai date format IDs that haven't already been added.\nTHAI_LOCALE_BUILT_IN_DATE_FORMAT_IDS.filter(function (numberFormatId) {\n return MAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS.indexOf(numberFormatId) < 0;\n}).filter(function (numberFormatId) {\n return JAPANESE_OR_KOREAN_LOCALE_BUILT_IN_DATE_FORMAT_IDS.indexOf(numberFormatId) < 0;\n}));\n//# sourceMappingURL=isDateFormatStyle.js.map","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nimport parseExcelTimestamp from './parseExcelTimestamp.js';\nimport isDateFormatStyle from './isDateFormatStyle.js';\n\n// An empty cell has `null` value.\nvar EMPTY_CELL_VALUE = null;\n\n// This variable represents a cell with a `null` value.\n// It is exported only to be specified as a dependency when using `worker-f`.\nexport var EMPTY_CELL = [null, EMPTY_CELL_VALUE];\n\n/**\r\n * Parses a cell from the info extracted from XML.\r\n * @param {string} [t] — `<c t/>` attribute value (cell type). One of: b (Boolean), e (Error), n (Number), d (Date), s (String).\r\n * @param {string} [s] — `<c s/>` attribute value (formatting style ID). When present, should be a stringified zero-based index of the formatting style for a numberic cell.\r\n * @param {string} [v] — `<v/>` element text content (value). Will be `undefined` if the `<v/>` element absent. Will be an empty string `\"\"` if the `<v/>` element is present but is empty.\r\n * @param {string} [inlineString] — Inline string value.\r\n * @param {any[]} parameters\r\n * @returns {[string|null,string|number|boolean|null] | string} Either `[type, value]` or `error`, where `value` is the cell value, `type` depends on the type of `value` and could be one of: 's' (string), 'b' (boolean), 'n' (number string), 'd' (date timestamp), 'e' (formula cell error), `null` (null); `error` is an error message: `VALUE_MISSING`, `VALUE_INVALID`, `FORMAT_INVALID`, `TYPE_INVALID`.\r\n */\nexport default function parseCell(t, s, v, inlineString, _ref) {\n var _ref2 = _slicedToArray(_ref, 6),\n sharedStrings = _ref2[0],\n styles = _ref2[1],\n epoch1904 = _ref2[2],\n defaultDateFormat = _ref2[3],\n dateTemplateParser = _ref2[4],\n parseNumberCustom = _ref2[5];\n // Available Excel cell types:\n // https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md\n //\n // Some other document (seems to be old):\n // http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/ST_CellType.html\n //\n // The default cell type is \"n\" (numeric), according to XLSX specification.\n //\n switch (t || 'n') {\n // `t=\"str\"` means that the cell value is calculated using a formula.\n // The formula is defined as the text of a child `<f/>` element.\n //\n // It could optionally include a `<v/>` element whose text is the cached result\n // of the calculation from the last time the file was saved in a spreadsheet editor application.\n //\n // An optional `<v/>` element holds a pre-computed result of the formula defined by `<f/>`.\n //\n // Example:\n //\n // <c r=\"B3\" t=\"str\">\n // \t<f>CONCATENATE(C1,D1)</f>\n // \t<v>C1ValueD1Value</v>\n // </c>\n //\n // Here's a guide on formulas in XLSX files:\n // https://github.com/MiniMax-AI/skills/blob/main/skills/minimax-xlsx/references/validate.md\n //\n case 'str':\n // The `<v/>` element could be absent because it's not required to be pre-computed by the spec.\n // In such case, `v` argument value would be `undefined`.\n // Because this package can't include the whole formula calculation engine,\n // it has to interpret this situation as an error.\n if (v === undefined) {\n return 'VALUE_MISSING';\n }\n // The `<v/>` element could be present but its text content could be empty\n // because the formula returns an empty string.\n // For example, a valid case of `v` argument value being an empty string `\"\"` is when\n // a formula in cell `A1` is `=CONCATENATE(B1,C1)` and both `B1` and `C1` cells are empty.\n if (!v) {\n return EMPTY_CELL;\n }\n return ['s', v];\n\n // `t=\"inlineStr\"` means that `<is/>` holds the string value.\n //\n // Inside a `<c t=\"inlineStr\"/>`, the specification requires there to exist an `<is/>` element,\n // and within that `<is/>` element it requires to exist a `<t/>` element.\n //\n // Example:\n //\n // <c r=\"A1\" s=\"1\" t=\"inlineStr\">\n // <is>\n // <t>\n // Test 123\n // </t>\n // </is>\n // </c>\n //\n case 'inlineStr':\n if (inlineString === undefined) {\n return 'VALUE_MISSING';\n }\n return ['s', inlineString];\n\n // `type=\"s\"` means that the string value is stored in the Shared Strings Table.\n // This way it attempts to compress the `.xlsx` file by reusing all string values\n // in case they repeat throughout the spreadsheet.\n //\n // This optimization can't be used when writing an `.xlsx` file in a \"streaming\"\n // fashion, i.e. when the entire spreadsheet data is not known in adavance\n // at the start of writing the file.\n // But it can be used in all other situations. And hence, it is used.\n // So this is the most common cell type, actually.\n //\n // Example:\n //\n // <c r=\"A3\" t=\"s\">\n // <v>3</v>\n // </c>\n //\n case 's':\n // If a cell has no value then there's no `<c/>` element for it.\n // If a `<c/>` element exists then it's not empty.\n // The `<v/>` element's text is a zero-based index in the \"shared strings\" dictionary.\n if (!v) {\n return 'VALUE_MISSING';\n }\n var sharedStringIndex = Number(v);\n // The shared string index value could be:\n // * not a number\n // * a number but a fractional one\n // * an integer that is out of bounds of the shared strings array\n if (isNaN(sharedStringIndex) || sharedStrings[sharedStringIndex] === undefined) {\n return 'VALUE_INVALID';\n }\n return ['s', sharedStrings[sharedStringIndex]];\n\n // Boolean (TRUE/FALSE) values are stored as either \"1\" or \"0\" in cells of type \"b\".\n //\n // Example:\n //\n // <c r=\"A1\" t=\"b\">\n // <v>1</v>\n // </c>\n //\n case 'b':\n if (!v) {\n return 'VALUE_MISSING';\n }\n if (v === '1') {\n return ['b', true];\n }\n if (v === '0') {\n return ['b', false];\n }\n return 'VALUE_INVALID';\n\n // If cell type is \"e\", the `<v/>` element's text is an error code string (required).\n //\n // Example:\n //\n // <c r=\"A1\" t=\"e\">\n // <f>1/0</f>\n // <v>#DIV/0!</v>\n // </c>\n //\n case 'e':\n // Examples of error codes:\n //\n // '#NULL!'\n // '#DIV/0!'\n // '#VALUE!'\n // '#REF!'\n // '#NAME!'\n // '#NUM!'\n // '#N/A'\n // '#SPILL!'\n //\n // The description of each error could be read in the formulas guide:\n // https://github.com/MiniMax-AI/skills/blob/main/skills/minimax-xlsx/references/validate.md\n //\n if (!v) {\n return 'VALUE_MISSING';\n }\n return ['e', v];\n\n // XLSX supports date cells of type \"d\", though it seems like it (almost?) never\n // uses type \"d\" for storing dates, preferring type \"n\" and numeric timestamp instead.\n // The value of a \"d\" cell is supposedly a string in \"ISO 8601\" format.\n // I haven't seen an `.xlsx` file having such cells.\n //\n // Example:\n //\n // <c r=\"A1\" s=\"1\" t=\"d\">\n // <v>\n // 2021-06-10T00:47:45.700Z\n // </v>\n // </c>\n //\n case 'd':\n if (!v) {\n return EMPTY_CELL;\n }\n var parsedDate = new Date(v);\n if (isNaN(parsedDate.valueOf())) {\n return 'VALUE_INVALID';\n }\n return ['d', parsedDate.getTime()];\n\n // type \"n\" is used for numeric cells.\n //\n // An optional `s` attribute defines how this number should be formatted — \n // it should be a zero-based index of the style (XF record) in `styles.xml`.\n //\n // Example:\n //\n // <c r=\"A1\" s=\"1\" t=\"n\">\n // <v>123.45</v>\n // </c>\n //\n case 'n':\n // Numeric cell value is allowed to be missing in the XLSX specification\n // because \"n\" is the default type of a cell, so it ends up representing empty cells too.\n if (!v) {\n return EMPTY_CELL;\n }\n // XLSX does support `type: \"d\"` cells for storing dates, but it's not commonly used.\n // Instead, it prefers using `type: \"n\"` cells for storing dates as timestamps\n // with a corresponding `s` formatting style.\n if (s) {\n var styleId = Number(s);\n // The style ID value could be:\n // * not a number\n // * a number but a fractional one\n // * an integer that is out of bounds of the styles array\n if (isNaN(styleId) || styles[styleId] === undefined) {\n return 'FORMAT_INVALID';\n }\n // Whether it's a date cell or just a numeric cell could only be determined\n // by looking at the formatting style.\n if (isDateFormatStyle(styles[styleId], defaultDateFormat, dateTemplateParser)) {\n var timestamp = Number(v);\n if (isNaN(timestamp)) {\n return 'VALUE_INVALID';\n }\n // First, parse the \"serial date\" number from string.\n // Then convert the \"serial date\" number to a date timestamp.\n return ['d', parseExcelTimestamp(timestamp, epoch1904)];\n }\n }\n // Return the cell value as a number,\n // unless custom `parseNumber()` function was passed,\n // in which case return the number as an unparsed string.\n // Some people prefer passing a custom `parseNumber()` function\n // to parse \"big integers\" without losing any precision.\n if (parseNumberCustom) {\n return ['n', v];\n }\n var number = Number(v);\n if (isNaN(number)) {\n return 'VALUE_INVALID';\n }\n return ['n', number];\n default:\n return 'TYPE_INVALID';\n }\n}\n//# sourceMappingURL=parseCell.js.map","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n/**\r\n * Parses XLSX cell address into a row number and a column number.\r\n * @param {string} coordinatesString\r\n * @returns {number[]} Returns `[rowNumber, columnNumber]`\r\n */\nexport default function parseCellAddress(coordinatesString) {\n // Coordinate examples: \"AA2091\", \"R988\", \"B1\".\n var _coordinatesString$sp = coordinatesString.split(/(\\d+)/),\n _coordinatesString$sp2 = _slicedToArray(_coordinatesString$sp, 2),\n columnLetters = _coordinatesString$sp2[0],\n rowNumberString = _coordinatesString$sp2[1];\n\n // Converts a letter coordinate to a digit coordinate.\n // Examples: \"A\" -> 1, \"B\" -> 2, \"Z\" -> 26, \"AA\" -> 27, etc.\n //\n // This function is inlined only to avoid passing it in `worker-f` dependencies.\n // Otherwise, it would throw: \"getColumnNumberFromColumnLetters is not defined\".\n //\n var n = 0;\n var i = 0;\n while (i < columnLetters.length) {\n n *= 26;\n n += LETTERS.indexOf(columnLetters[i]);\n i++;\n }\n var columnNumberFromColumnLetters = n;\n return [\n // Row number (starting at `1`).\n Number(rowNumberString),\n // Column number (starting at `1`).\n columnNumberFromColumnLetters];\n}\n\n// Maps \"A1\"-like coordinates to `{ row, column }` numeric coordinates.\n//\n// This is `export`ed only to be passed in `worker-f` dependencies.\n// Otherwise, it would throw: \"LETTERS is not defined\".\n//\nexport var LETTERS = ['', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];\n//# sourceMappingURL=parseCellAddress.js.map","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nimport parseCell, { EMPTY_CELL } from './parseCell.js';\nimport parseCellAddress from './parseCellAddress.js';\nimport InvalidSpreadsheetError from './InvalidSpreadsheetError.js';\n\n// An empty cell has `null` value.\nvar EMPTY_CELL_VALUE = null;\n\n/**\r\n * Parses a `sheet.xml` file.\r\n * @param {string} content\r\n * @param {function} parseXml — SAX XML parser.\r\n * @param {object} options\r\n * @returns {Promise<SheetData>}\r\n */\nexport default function parseSheet(content, parseXml, _ref) {\n var sharedStrings = _ref.sharedStrings,\n styles = _ref.styles,\n epoch1904 = _ref.epoch1904,\n options = _ref.options;\n var parseCellParameters = [sharedStrings, styles, epoch1904, options.dateFormat,\n // defaultDateFormat\n options.smartDateParser !== false,\n // dateTemplateParser\n options.parseNumber // parseNumberCustom\n ];\n\n var rows = [];\n var errors = [];\n var state = createInitialState();\n return parseXml(content, state, onOpenTag, onCloseTag, onText, onProgress).then(function () {\n var _state$sheetData = state.sheetData,\n rowCount = _state$sheetData.rowCount,\n columnCount = _state$sheetData.columnCount,\n dataRowCount = _state$sheetData.dataRowCount,\n dataColumnCount = _state$sheetData.dataColumnCount;\n // Drop (discard) empty rows at the bottom.\n if (dataRowCount < rowCount) {\n rows = rows.slice(0, dataRowCount);\n }\n // Drop (discard) empty columns at the right side.\n if (dataColumnCount < columnCount) {\n var i = 0;\n while (i < rows.length) {\n if (rows[i].length > dataColumnCount) {\n rows[i] = rows[i].slice(0, dataColumnCount);\n }\n i++;\n }\n }\n var startedAt = Date.now();\n // Add `null` values where there're \"gaps\" at the right side of rows.\n for (var _iterator = _createForOfIteratorHelperLoose(rows), _step; !(_step = _iterator()).done;) {\n var row = _step.value;\n while (row.length < dataColumnCount) {\n row.push(EMPTY_CELL_VALUE);\n }\n }\n return rows;\n });\n function createInitialState() {\n return {\n dimension: undefined,\n sheetData: undefined\n };\n }\n function getRowsFromState(state) {\n return state.sheetData.rows;\n }\n function setRowsInState(state, rows) {\n state.sheetData.rowIndexShift += state.sheetData.rows.length - rows.length;\n state.sheetData.rows = rows;\n }\n function getErrorsFromState(state) {\n return state.sheetData.errors;\n }\n function setErrorsInState(state, errors) {\n state.sheetData.errors = errors;\n }\n\n // Throw an error as soon as a non-recoverable error is encountered when parsing a cell.\n var THROW_ON_FIRST_CELL_ERROR = true;\n function throwInvalidCellError(_ref2) {\n var row = _ref2.row,\n column = _ref2.column,\n error = _ref2.error;\n // The sheet name or index is unknown, so it's not reported here.\n throw new InvalidSpreadsheetError(\"<c/> at row \".concat(row, \", col \").concat(column, \": \").concat(error));\n }\n function onProgress(end) {\n // Here, it could look at `state.dimension?` in order to avoid reading unused cells.\n // For example, there could be a sheet with a million rows and a million columns\n // but only the top-left cell in that sheet would be not an empty cell.\n // The rest of the cells could be empty, but it would be valid for such sheet to exist.\n // So there would be empty `<row/>` or `<c/>` elements all around, and those could be skipped\n // if `<dimension/>` element is present in the `sheet.xml` file.\n // The `<dimension/>` element tells which area of the sheet really contains non-empty data.\n // But it's an optional element, and also there's an additional question of:\n // \"What should happen if an .xlsx writer sets it erroneously? Should it auto-repair such sheet?\".\n // I imagine, such situations aren't really possible in real life but still mathematically it's possible,\n // because the `<dimension/>` element is more of a \"supplementary\" or \"advisory\" one\n // and it's not supposed to \"break\" anything in case its value is incorrect.\n // So that's why `read-excel-file` just simply ignores the `<dimension/>` element\n // even though it can read and \"understand\" it.\n // console.log(state.dimension)\n var rowsRead = getRowsFromState(state);\n var errorsEncountered = getErrorsFromState(state);\n if (end) {\n rows = rows.concat(rowsRead);\n errors = errors.concat(errorsEncountered);\n if (errors.length > 0) {\n throwInvalidCellError(errors[0]);\n }\n } else {\n if (rowsRead.length > 1) {\n // The rows except for the last one have already been \"finalized\",\n // i.e. it can be said that those rows don't have any more cells yet to be parsed.\n // The last row is still being read so it's not \"finalized\" yet,\n // i.e. it's unknown at this point whether there will be more cells of it.\n var finalizedRows = rowsRead.slice(0, -1);\n // Move the finalized rows from the \"in-progress\" rows to the \"result\" rows.\n rows = rows.concat(finalizedRows);\n // Add any errors that have been encountered while parsing this chunk of rows.\n errors = errors.concat(errorsEncountered);\n // Proceeed with just the last row and the next chunk.\n setRowsInState(state, rowsRead.slice(-1));\n // Proceeed with clean errors list.\n setErrorsInState(state, []);\n }\n }\n }\n function onOpenTag(tagName, attributes, state) {\n if (tagName === 'dimension') {\n state.dimension = parseSheetDimensionRef(attributes.ref);\n } else if (tagName === 'sheetData') {\n state.sheetData = createInitialStateInSheetData();\n } else if (state.sheetData) {\n onOpenTagInSheetData(tagName, attributes, state.sheetData);\n }\n }\n function onCloseTag(tagName, state) {\n if (state.sheetData) {\n onCloseTagInSheetData(tagName, state.sheetData);\n }\n }\n function onText(text, state) {\n if (state.sheetData) {\n onTextInSheetData(text, state.sheetData);\n }\n }\n\n /**\r\n * Sheet \"dimension\" defines the spreadsheet area containing all non-empty cells.\r\n * Any cells outside the \"dimension\" are considered empty and should be ignored.\r\n * https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sheetdimension?view=openxml-2.8.1\r\n * @param {string} `ref` — The value of `<dimension ref/>` attribute.\r\n * @returns {[[number,number],[number,number]]} `undefined` or `[{ row, column }, { row, column }]` — \"From row number and column number to row number and column number\".\r\n */\n function parseSheetDimensionRef(ref) {\n var dimensions = ref.split(':').map(parseCellAddress);\n // Sometimes there can be just a single cell as a spreadsheet's \"dimensions\".\n // For example, the default \"dimensions\" in Apache POI library is \"A1\",\n // meaning that only the first cell in the spreadsheet is used.\n //\n // A quote from Apache POI library:\n // \"Single cell ranges are formatted like single cell references (e.g. 'A1' instead of 'A1:A1').\"\n //\n if (dimensions.length === 1) {\n dimensions = [dimensions[0], dimensions[0]];\n }\n return dimensions;\n }\n\n // Sheet Data\n\n function createInitialStateInSheetData() {\n return {\n c: undefined,\n rows: [],\n row: undefined,\n rowNumber: undefined,\n // How many rows have been removed from the start of `state.rows`\n // as part of `onProgress()` handler calls.\n rowIndexShift: 0,\n // Current position in the sheet.\n cursor: [0, 0],\n // Total row count.\n rowCount: 0,\n // Total column count.\n columnCount: 0,\n // Non-empty row count.\n dataRowCount: 0,\n // Non-empty column count.\n dataColumnCount: 0,\n // Cell with errors.\n errors: []\n };\n }\n function onOpenTagInSheetData(tagName, attributes, state) {\n if (tagName === 'row') {\n // Read an optional `r` attribute, which represents a 1-based row number.\n // If the `r` attribute is not present on a `<row>` then the row number is either defined by\n // `<c>` elements in it, or just assumed to be \"previous row number + 1\".\n if (attributes.r) {\n state.rowNumber = Number(attributes.r);\n }\n state.row = [];\n } else if (tagName === 'c') {\n state.c = createInitialStateInCell();\n state.c.attributes = attributes;\n } else if (state.c) {\n onOpenTagInCell(tagName, attributes, state.c);\n }\n }\n function onCloseTagInSheetData(tagName, state) {\n if (tagName === 'row') {\n // If the row number is known, check for any inter-row gaps that it might introduce.\n if (state.rowNumber) {\n // Google AI says that `<row>` elements must be ordered by row number ascending,\n // so the code assumes that there can't be an out-of-order `<row>`.\n var previousRowNumber = state.rowIndexShift + state.rows.length;\n if (state.rowNumber <= previousRowNumber) {\n throw new InvalidSpreadsheetError(\"Out-of-place <row/> number \".concat(state.rowNumber, \" follows <row/> number \").concat(previousRowNumber));\n }\n // Insert empty rows where there're gaps between the rows.\n while (state.rowNumber > state.rowIndexShift + state.rows.length + 1) {\n state.rows.push([]);\n }\n }\n // Add the parsed row to the list of rows.\n state.rows.push(state.row);\n // Update the total non-empty row count.\n if (state.row.length > 0) {\n state.dataRowCount = state.rowNumber;\n }\n // Update the total row count.\n if (state.rowNumber > state.rowCount) {\n state.rowCount = state.rowNumber;\n }\n // Reset state.\n state.row = undefined;\n state.rowNumber = undefined;\n } else if (tagName === 'c') {\n var cell = parseCellFromXmlData(state.c);\n // Google AI says that the Open XML specification (ISO/IEC 29500) strictly dictates\n // that `<c>` elements within `sheet.xml` (or specifically `<sheetData>`)\n // must be written in ascending order of their `r` attributes (e.g., \"A1\", \"B1\", \"C1\").\n if (cell.row < state.cursor[0] || cell.row === state.cursor[0] && cell.column <= state.cursor[1]) {\n throw new InvalidSpreadsheetError(\"Out-of-place <c/> at row \".concat(cell.row, \" col \").concat(cell.column, \" follows <c/> at row \").concat(state.cursor[0], \" col \").concat(state.cursor[1]));\n }\n // Update the cursor.\n state.cursor[0] = cell.row;\n state.cursor[1] = cell.column;\n // If the `r` attribute is not present on a `<row>` then the row number is either defined by\n // `<c>` elements in it, or just assumed to be \"previous row number + 1\".\n if (!state.rowNumber) {\n state.rowNumber = cell.row;\n }\n // If the cell has an error.\n if (cell.error) {\n if (THROW_ON_FIRST_CELL_ERROR) {\n throwInvalidCellError(cell);\n }\n state.errors.push(cell);\n }\n // If the cell is not empty.\n else if (cell.value !== EMPTY_CELL_VALUE) {\n // Insert empty cells where there're gaps between the columns.\n while (cell.column > state.row.length + 1) {\n state.row.push(EMPTY_CELL_VALUE);\n }\n // Add the parsed cell value to the list of cell values in the current row.\n state.row.push(cell.value);\n // Update the total non-empty column count.\n if (cell.column > state.dataColumnCount) {\n state.dataColumnCount = cell.column;\n }\n }\n // Update the total column count.\n if (cell.column > state.columnCount) {\n state.columnCount = cell.column;\n }\n // Reset state.\n state.c = undefined;\n } else if (state.c) {\n onCloseTagInCell(tagName, state.c);\n }\n }\n function onTextInSheetData(text, state) {\n if (state.c) {\n onTextInCell(text, state.c);\n }\n }\n\n /**\r\n * Parses the XML values of a `<c/>` element into an object representing a cell value.\r\n * @param {object} — `{ attributes: Record<string,string>, inlineString?: string, vText?: string }`. If `<v/>` element is present but is empty, `vText` will be an empty string. If `<v/>` element is absent, `vText` will be `undefined`.\r\n * @returns {object} Either `{ row: number, column: number, error: string }` or `{ row: number, column: number, value: string|number|boolean|null }`\r\n */\n function parseCellFromXmlData(_ref3) {\n var attributes = _ref3.attributes,\n inlineString = _ref3.inlineString,\n vText = _ref3.vText;\n var _parseCellAddress = parseCellAddress(attributes.r),\n _parseCellAddress2 = _slicedToArray(_parseCellAddress, 2),\n row = _parseCellAddress2[0],\n column = _parseCellAddress2[1];\n var errorOrTypeAndValue = parseCellAndTrimValue(attributes.t, attributes.s, vText, inlineString, parseCellParameters, options.trim !== false);\n if (typeof errorOrTypeAndValue === 'string') {\n return {\n row: row,\n column: column,\n error: errorOrTypeAndValue\n // // Report the \"raw\" unparsed value of the cell for potential debugging.\n // // Also report the cell type and the format in case of a numeric value.\n // //\n // // For \"inline string\" cells, the value should actually be the `inlineString` argument\n // // rather than `vText` argument, but the only case when it could throw an error\n // // when parsing an \"inline string\" cell is `VALUE_MISSING` which means that\n // // `inlineString` argument is `undefined`, same as `vText` argument in this case,\n // // so the resulting `value` property is correct anyway.\n // //\n // value: vText,\n // type: attributes.t,\n // formatId: attributes.s\n };\n }\n\n return {\n row: row,\n column: column,\n value: parseCellValue(errorOrTypeAndValue[1], errorOrTypeAndValue[0])\n };\n }\n\n // Here, it could also parse \"merged cells\" and then return them in some special way.\n // But then it's not clear what should be the way to return such merged cells.\n // I.e. should it just return it as a duplicate value in each one of the merged cells?\n // Or should it keep the current behavior of only returning the value of the top-most left-most cell\n // and then just return `null` for the rest of the cells in a \"merged cells\" group?\n // Perhaps the latter (current) approach is the most sensible one, so there's no need\n // to change anything.\n //\n // const mergedCells = getMergedCellCoordinates(sheetDocument)\n // for (const mergedCell of mergedCells) {\n // const [from, to] = mergedCell.split(':').map(parseCellAddress)\n // console.log('Merged Cell.', 'From:', from, 'To:', to)\n // }\n\n // Cell\n\n /**\r\n * Parses a cell from the info extracted from the cell XML.\r\n * If the cell is of type string, it trims the value (by default).\r\n *\r\n * Receives same arguments as `parseCell()` function, with an additional argument\r\n * `trimStrings: boolean` which tells if it should trim any string values.\r\n *\r\n * Produces same result as `parseCell()` function, except for cells of type \"e\".\r\n */\n function parseCellAndTrimValue(t, s, v, inlineString, parameters, trimStrings) {\n // Parse cell value from cell XML.\n var errorOrTypeAndValue = parseCellWithRepairAbility(t, s, v, inlineString, parameters);\n // Trim any text cell values (by default)\n if (Array.isArray(errorOrTypeAndValue) && errorOrTypeAndValue[0] === 's') {\n // A developer could optionally disable the automatic trimming of all strings.\n // For example, leading spaces might express a tree-like hierarchy, in which case they should be preserved.\n // https://github.com/catamphetamine/read-excel-file/pull/106#issuecomment-1136062917\n if (trimStrings) {\n errorOrTypeAndValue[1] = errorOrTypeAndValue[1].trim();\n }\n // Convert empty strings to `null`\n if (errorOrTypeAndValue[1] === '') {\n return EMPTY_CELL;\n }\n }\n // Return the cell's type and value.\n return errorOrTypeAndValue;\n }\n\n /**\r\n * Parses cell value and optionally repairs any repairable errors.\r\n * Receives same arguments as `parseCell()` function.\r\n * Produces same result as `parseCell()` function, except for cells of type \"e\".\r\n */\n function parseCellWithRepairAbility(t, s, v, inlineString, parameters) {\n // Parse cell value from cell XML.\n var errorOrTypeAndValue = parseCell(t, s, v, inlineString, parameters);\n // If the cell value was expected but is missing,\n // it is considered a repairable situation.\n if (errorOrTypeAndValue === 'VALUE_MISSING') {\n // The default cell type is \"n\" (numeric), according to XLSX specification.\n switch (t || 'n') {\n // * If the cell is defined by a formula.\n // * Or contains an inline string.\n // * Or contains a shared string.\n // * Or contains a boolean value.\n case 'str':\n case 'inlineStr':\n case 's':\n case 'b':\n // * If the formula result is not pre-computed (which is allowed by the spec)\n // then just ignore this cell.\n // * If the inline string value is not specified then just ignore this cell.\n // * If the shared string index is not specified then just ignore this cell.\n // * If the boolean value is not specified then just ignore this cell.\n return EMPTY_CELL;\n }\n }\n // If the cell contains a formula that couldn't be calculated due to an error,\n // simply ignore such cell and assume it to be empty.\n if (t === 'e') {\n return EMPTY_CELL;\n }\n // Return either the error code or the cell's type and value.\n return errorOrTypeAndValue;\n }\n\n /**\r\n * For certain types of cell, it transforms the value.\r\n * Specifically, for cells of type \"n\" or \"d\", it transforms the value to `Number` or `Date` respectively.\r\n *\r\n * The reason it is done separately is because before this function is called,\r\n * the cells are easily \"serializable\". And after this function is called,\r\n * some of the cells' `value` properties become instances of `Date` class or any other class,\r\n * such as `BigInt`, serializing which would require additional manual steps to be performed.\r\n * Serializing cells could be utilized in case of \"transferring\" data between workers\r\n * with a `transferList`, argument which could hypothetically result in better performance\r\n * and less time being blocked by the \"synchronous\" JSON serialization.\r\n *\r\n * @param {string|number|boolean|null} value\r\n * @param {string} type — One of: \"s\", \"n\", \"d\", \"b\", \"-\"\r\n * @return {string|ParsedNumber|Date|boolean|null}\r\n */\n function parseCellValue(value, type) {\n if (type === 'n') {\n // Parse number from string.\n // Supports custom parsing function to work around the javascript number precision limitation.\n // https://gitlab.com/catamphetamine/read-excel-file/-/issues/85\n if (options.parseNumber) {\n return options.parseNumber(value);\n }\n return value;\n } else if (type === 'd') {\n return new Date(value);\n } else {\n return value;\n }\n }\n function createInitialStateInCell() {\n return {\n v: false,\n is: false,\n t: false,\n r: false,\n rPh: false,\n vText: undefined,\n inlineString: undefined,\n attributes: undefined\n };\n }\n function onOpenTagInCell(tagName, attributes, state) {\n if (tagName === 'v') {\n state.v = true;\n } else if (tagName === 'is') {\n // The possible children of <is> are:\n // * <t> (Text): The standard child to hold plain, simple text.\n // * <r> (Rich Text Run): Used for applying different formatting styles (like bold or italic) to specific segments of text within a single cell.\n // * <rPh> (Phonetic Run): Used primarily for East Asian languages to provide phonetic reading/pronunciation data (e.g., furigana in Japanese). It associates a phonetic pronunciation run right alongside the base string text tag <t>.\n // * <phoneticPr> (Phonetic Properties): Defines formatting and settings for the phonetic text.\n state.is = true;\n state.inlineString = '';\n } else if (tagName === 't') {\n state.t = true;\n } else if (tagName === 'r') {\n // The possible children of <r/> are:\n // * <rPr> (Run Properties): The formatting properties for the text (font, size, color, bold, italic, etc.).\n // * <t> (Text): The actual text payload.\n // * <rPh> (Phonetic Run): Phonetic pronunciation guidance (used for East Asian languages like Japanese). It associates a phonetic pronunciation run right alongside the base string text tag <t>.\n state.r = true;\n } else if (tagName === 'rPh') {\n // The possible children of <rPh/> are:\n // * <t> (Text): Contains the actual phonetic text or reading (usually in Katakana for Japanese) that corresponds to the associated character string.\n state.rPh = true;\n }\n }\n function onCloseTagInCell(tagName, state) {\n if (tagName === 'v') {\n state.v = false;\n // If the `<v/>` element is present but is empty,\n // reassign `vText` property from `undefined` to an empty string `\"\"`.\n // This is to differentiate between two separate cases:\n // * When `<f/>` formula is present but its result is not pre-computed (`<v/>` is absent)\n // * When `<f/>` formula is present and its result is an empty string (`<v/>` is present but empty)\n state.vText || (state.vText = '');\n } else if (tagName === 'is') {\n state.is = false;\n } else if (tagName === 't') {\n state.t = false;\n } else if (tagName === 'r') {\n state.r = false;\n } else if (tagName === 'rPh') {\n state.rPh = false;\n }\n }\n function onTextInCell(text, state) {\n if (state.v) {\n state.vText = text;\n } else if (state.is) {\n if (state.rPh) {\n // Ignore anything inside `<rPh/>` tags\n } else if (state.t) {\n if (state.r) {\n // An `<r/>` element could contain multiple `<t/>` elements,\n // the text content from all of which should be concatenated.\n state.inlineString += text;\n } else {\n state.inlineString = text;\n }\n }\n }\n }\n\n // Dimensions\n\n function getSheetDimensions(cells) {\n // The left-top boundary is ignored and is always assumed to be `0, 0`.\n // It used to be not ignored in the past but that produced confusing behavior\n // when empty rows or columns at the start of a sheet were discarded,\n // and that was not something that users of this package expected.\n // https://github.com/catamphetamine/read-excel-file/issues/102#issuecomment-973238655\n var minRow = cells.length === 0 ? 0 : 1;\n var minCol = cells.length === 0 ? 0 : 1;\n var maxRow = 0;\n var maxCol = 0;\n for (var _iterator2 = _createForOfIteratorHelperLoose(cells), _step2; !(_step2 = _iterator2()).done;) {\n var cell = _step2.value;\n if (maxRow < cell.row) {\n maxRow = cell.row;\n }\n if (maxCol < cell.column) {\n maxCol = cell.column;\n }\n }\n return [[minRow, minCol], [maxRow, maxCol]];\n }\n}\n//# sourceMappingURL=parseSheet.js.map","// Sidenote: `strFromU8()` function from `fflate` is not \"self-contained\",\n// i.e. it references some variables outside of its scope,\n// which doesn't work with `worker-f` package and throws an error: \"td is not defined\".\n//\n// But `woker-f` package is currently not used, so this `import` is not commented out.\n//\nimport { strFromU8 as strFromU8_ } from 'fflate';\nimport checkpoint from './checkpoint.js';\n\n/**\r\n * @param {Record<string,Uint8Array} entries\r\n * @returns {Record<string,string>}\r\n */\nexport default function convertValuesFromUint8ArraysToStrings(entries) {\n checkpoint('convert files to strings');\n var convertedEntries = {};\n for (var _i = 0, _Object$keys = Object.keys(entries); _i < _Object$keys.length; _i++) {\n var key = _Object$keys[_i];\n convertedEntries[key] = strFromU8(entries[key]);\n }\n return convertedEntries;\n}\n\n// There's a strange thing with using `fflate`'s `strFromU8()` function:\n// when `import`ed directly from `fflate` package, the benchmark runs about 10% slower\n// then when using `new TextDecoder().decode(data)`, even though `strFromU8()`\n// does the same thing internally. So it's a bit mysterious.\n//\n// Because manually calling `new TextDecoder().decode(data)` is measurably faster for some reason,\n// `fflate`'s `strFromU8()` is used as a backup for old web browsers that don't support `TextDecoder`.\n//\n/**\r\n * Converts a Uint8Array to a string\r\n * @param data The data to decode to string\r\n * @param latin1 Whether or not to interpret the data as Latin-1. This should\r\n * not need to be true unless encoding to binary string.\r\n * @returns The original UTF-8/Latin-1 string\r\n */\nexport function strFromU8(data) {\n // https://caniuse.com/?search=TextDecoder\n if (typeof TextDecoder !== 'undefined') {\n return new TextDecoder().decode(data);\n } else {\n return strFromU8_(data);\n // Alternatively, it could call a copy-pasted \"rest\" part of the `strFromU8()` function:\n // const [string, leftovers] = decodeUtf8String(data)\n // console.log(leftovers)\n // if (leftovers.length) {\n // \tthrow new Error('Decode UTF8')\n // }\n // return string\n }\n}\n\n// This function's code is a copy-paste of `dutf8()` function in `fflate` repository from Jul 12th, 2026.\n// https://github.com/101arrowz/fflate/blob/master/src/index.ts\n//\n// By the way, this function errors when running test case:\n// \"made-in-macos-excel-2011-with-custom-font\".\n// The leftover is `Uint8Array(2) [ 255, 217 ]`.\n// To reproduce the error, replace the entire `strFromU8()` function\n// in `convertValuesFromUint8ArraysToStrings()` with this function and see what happens.\n//\n// /**\n// * Decodes a `Uint8Array` into a UTF8 string.\n// * @param {Uint8Array} d\n// * @returns {[string, Uint8Array]} — The decoded string and what's left undecoded\n// */\n// export function decodeUtf8String(d) {\n// for (let s = '', i = 0;;) {\n// let c = d[i++]\n// const charType = (c > 127) + (c > 223) + (c > 239)\n// if (i + charType > d.length) {\n// \t\t\t// Returns a slice of an array.\n// \t\t\t// Allows garbage collector to free the original reference.\n// \t\t\t// This function is browser-compatible than `Uint8Array.slice()`.\n// \t\t\tconst leftovers = new Uint8Array(d.subarray(i - 1))\n// \t\t\treturn [s, leftovers]\n// \t\t}\n// if (!charType) {\n// \t\t\ts += String.fromCharCode(c)\n// \t\t} else if (charType == 3) {\n// c = ((c & 15) << 18 | (d[i++] & 63) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63)) - 65536\n// s += String.fromCharCode(55296 | (c >> 10), 56320 | (c & 1023))\n// } else if (charType & 1) {\n// \t\t\ts += String.fromCharCode((c & 31) << 6 | (d[i++] & 63))\n// \t\t} else {\n// \t\t\ts += String.fromCharCode((c & 15) << 12 | (d[i++] & 63) << 6 | (d[i++] & 63))\n// \t\t}\n// }\n// }\n//# sourceMappingURL=convertValuesFromUint8ArraysToStrings.js.map","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nexport default function isPromise(anything) {\n return _typeof(anything) === 'object' && typeof anything.then === 'function';\n}\n\n// export default function isPromise<Value>(anything: unknown): anything is Promise<Value> {\n// return (\n// typeof anything === 'object' &&\n// typeof (anything as Promise<unknown>).then === 'function'\n// )\n// }\n//# sourceMappingURL=isPromise.js.map","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\nvar SheetNotFoundError = /*#__PURE__*/function (_Error) {\n _inherits(SheetNotFoundError, _Error);\n var _super = _createSuper(SheetNotFoundError);\n function SheetNotFoundError(message) {\n var _this;\n _classCallCheck(this, SheetNotFoundError);\n _this = _super.call(this, message);\n\n // Set `name` property.\n //\n // This error could be detected either by `instanceof InvalidInputError`\n // or by comparing its `name` property value to \"InvalidInputError\".\n // Why use the `name` comparison when `instanceof` operator is available?\n // Google AI tells that it does make sense in the cases when an error is\n // \"serialized\" and then \"deserialized\" in a \"distributed\" environment such as\n // throwing an error in a worker thread and then handling it in a main thread,\n // or when throwing it in one \"microservice\" and then catching it in another one,\n // or just logging as in `sentry.io`. And in those cases, `error.constructor.name`\n // isn't always available for same reason of \"serializing\" and then \"deserializing\".\n //\n // For example, even if `InvalidInputError` is a named export of this package,\n // when later bunding the application code with a bundler it will still be minified and renamed.\n // That's when the `name` property could be used to find out the actual type of the error\n // in case it gets thrown and reported to a remote system like `sentry.io`.\n //\n // By the way, core Node.js errors themselves have a `name` property.\n //\n _this.name = 'SheetNotFoundError';\n return _this;\n }\n return _createClass(SheetNotFoundError);\n}( /*#__PURE__*/_wrapNativeSuper(Error));\nexport { SheetNotFoundError as default };\n//# sourceMappingURL=SheetNotFoundError.js.map","function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport parseSpreadsheetInfo from './parseSpreadsheetInfo.js';\nimport parseFilePaths from './parseFilePaths.js';\nimport parseStyles from './parseStyles.js';\nimport parseSharedStrings from './parseSharedStrings.js';\nimport parseSheet from './parseSheet.js';\nimport convertValuesFromUint8ArraysToStrings from '../utility/convertValuesFromUint8ArraysToStrings.js';\nimport checkpoint from '../utility/checkpoint.js';\nimport isPromise from '../utility/isPromise.js';\nimport InvalidSpreadsheetError from './InvalidSpreadsheetError.js';\nimport SheetNotFoundError from './SheetNotFoundError.js';\n\n// These exports are only used in `worker-f` dependencies:\n// import parseXmlStream '../xml/parseXmlStream.js'\n// import { decodeUtf8String, strFromU8 } from '../utility/convertValuesFromUint8ArraysToStrings.js'\n// import parseExcelDate from './parseExcelDate.js'\n// import parseExcelTimestamp from './parseExcelTimestamp.js'\n// import isDateFormat, { DATE_FORMAT_SPECIFIC_LOCALE_PREFIX, DATE_FORMAT_ALLOW_ANY_OTHER_TEXT_SUFFIX, IS_DATE_FORMAT_CACHE, DATE_TEMPLATE_TOKENS } from './isDateFormat.js'\n// import isDateFormatStyle, { BUILT_IN_DATE_FORMAT_IDS } from './isDateFormatStyle.js'\n// import parseCell, { EMPTY_CELL } from './parseCell.js'\n// import parseCellAddress, { LETTERS } from './parseCellAddress.js'\n// import convertArrayOfCellsTo2dArrayOfValues from './convertArrayOfCellsTo2dArrayOfValues.js'\n// import dropEmptyTrailingRows from './dropEmptyTrailingRows.js'\n// import dropEmptyTrailingColumns from './dropEmptyTrailingColumns.js'\n// import { latestCheckpointTimestamp } from '../utility/checkpoint.js'\n\n// `worker-f` is not used because passing cells data from the worker thread\n// to the main thread was a lengthy-enough operation. For example, when running\n// the benchmark, the output latency was: `10` ms on \"1mb.xlsx\", `70` ms on \"10mb.xlsx\"\n// and `500` ms on \"50mb.xlsx\", meaning that it would still have issues with\n// blocking the main thread when passing the result back to it from the worker thread,\n// negating the effect of using `worker-f` in the first place.\n//\n// As a way to work around the slow \"structured clone\" algorithm for input/output data,\n// I played around with implementing a `serializeCells()` function that would serialize\n// sheet data into an `ArrayBuffer` in order for it to be \"transferred\" instantly\n// to the main thread, but this serialization itself was even slower, meaning that it would\n// still block the main thread when deserializing that `ArrayBuffer` back to sheet data,\n// so the entire idea of using `worker-f` was eventually dismissed.\n//\n// Instead of that, I submitted a PR in `saxen` repo that added \"streaming mode\" to the XML parser.\n// https://github.com/nikku/saxen/pull/27\n// That PR got merged, so a simple alternative now is to parse sheet data chunk-by-chunk,\n// spacing it out with `setTimeout(0)` interrupts.\n//\n// In case of re-enabling `worker-f`, uncomment the relevant code above and below,\n// and also replace `import { Parser } from 'saxen'` with an copy-paste of `saxen`'s code\n// in `parseXmlStream.saxen.js`, otherwise it'll throw: \"Parser is not defined\".\n// Also, in `convertValuesFromUint8ArraysToStrings.js`, replace `import { strFromU8 } from 'fflate'`\n// with a copy-paste of the `strFromU8()` function code from `fflate`'s repo,\n// because otherwise it'd throw: \"td is not defined\".\n//\nvar CAN_USE_WORKER = false;\n\n/**\r\n * Reads data from an `.xlsx` file.\r\n * @param {function} parseXml — SAX XML parser.\r\n * @param {Record<string,Uint8Array>} contents - A map of `.xml` files inside the `.xlsx` file (which itself is just a zipped directory).\r\n * @param {object} [options]\r\n * @return {Promise<Sheet[]>}\r\n */\nfunction parseSpreadsheetContents(parseXml, contents_) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n // For an introduction in reading `.xlsx` files see \"The minimum viable XLSX reader\":\n // https://www.brendanlong.com/the-minimum-viable-xlsx-reader.html\n\n // Convert the values in `contents_` from `Uint8Array`s to `string`s.\n //\n // This function is a bit of a bottleneck on large `.xlsx` files.\n // For example, when running the benchmark, the time of calling this function is:\n //\n // * \"1mb.xlsx\" — 2\n // * \"10mb.xlsx\" — 7\n // * \"50mb.xlsx\" — 35\n //\n // When running this code in a worker, it's no longer a \"bottleneck\"\n // because in that case it doesn't block the main thread.\n //\n var contents = convertValuesFromUint8ArraysToStrings(contents_);\n\n // Because of how `.xlsx` file contents are defined in the specification,\n // it will have to be read in 3 passes:\n // * First pass — read the actual file paths\n // * Second pass — read \"shared strings\" and \"styles\"\n // * Thirs pass — read the sheets data\n\n checkpoint('parse spreadsheet info and file paths');\n\n // Get spreadsheet info and the paths to files.\n return readFiles(getXmlFilesAtFixedPaths(), contents, parseXml).then(function (_ref) {\n var spreadsheetInfo = _ref.spreadsheetInfo,\n filePaths = _ref.filePaths;\n checkpoint('parse \"shared strings\" and \"styles\"');\n\n // Parse \"shared strings\" and \"styles\".\n return readFiles(getXmlFilesAtNonFixedPaths(filePaths), contents, parseXml).then(function (_ref2) {\n var sharedStrings = _ref2.sharedStrings,\n styles = _ref2.styles;\n var sheetRelationIdsToRead = options.sheets ? options.sheets.map(function (sheet) {\n return getSheetRelationId(sheet, spreadsheetInfo.sheets);\n }) : spreadsheetInfo.sheets.map(function (_) {\n return _.relationId;\n });\n checkpoint(\"parse sheet\".concat(sheetRelationIdsToRead.length === 1 ? '' : 's', \" data\"));\n\n // Parse sheets data.\n return readFiles(getSheetDataXmlFiles(filePaths, sheetRelationIdsToRead, {\n sharedStrings: sharedStrings,\n styles: styles,\n epoch1904: spreadsheetInfo.epoch1904,\n options: options\n }), contents, parseXml).then(function (sheetsData) {\n checkpoint('end');\n // Return sheets data.\n return sheetRelationIdsToRead.map(function (sheetRelationId) {\n return {\n sheet: getSheetNameByRelationId(sheetRelationId, spreadsheetInfo.sheets),\n data: sheetsData[sheetRelationId]\n };\n });\n });\n });\n });\n}\n\n/**\r\n * Reads data from an `.xlsx` file in a worker.\r\n * @param {function} [createWorkerFunction] — Creates a worker function.\r\n * @param {function} parseXml — SAX XML parser.\r\n * @param {Record<string,Uint8Array>} contents - A map of `.xml` files inside the `.xlsx` file (which itself is just a zipped directory).\r\n * @param {object} [options]\r\n * @return {Promise<Sheet[]>}\r\n */\nexport default function parseSpreadsheetContentsInWorker(createWorkerFunction, parseXml, contents, options) {\n // Assign a default value of `null` to `parseNumber()` function in the `options`.\n // The reason is that the worker code requires it to be non-`undefined`.\n // Otherwise, it would throw \"parseNumber is not defined\".\n if (!(options && options.parseNumber)) {\n options = _objectSpread(_objectSpread({}, options), {}, {\n parseNumber: null\n });\n }\n\n // If the environment doesn't support \"workers\", parse spreadsheet contents \"synchronously\".\n // This will \"block\" the main thread while parsing.\n if (!createWorkerFunction || !CAN_USE_WORKER) {\n return parseSpreadsheetContents(parseXml, contents, options);\n }\n\n // // Any functions have to be removed from the `options` in order for them to be \"serializable\"\n // // before sending them to the worker thread.\n // const { parseNumber: parseNumber_, ...optionsJson } = options\n //\n // // Create a worker from a function.\n // const workerFn = createWorkerFunction(\n // (data) => {\n // // Reconstruct the `options`.\n // const options = {\n // ...data.optionsJson,\n // parseNumber: parseNumber_\n // }\n // // Parse sheet data from the `.xml` files.\n // return parseSpreadsheetContents(parseXml, data.contents, options)\n // }\n // )\n //\n // workerFn.addDependencies(\n // // Any \"outside\" dependencies that're referenced from the function body.\n // () => [\n // parseXml,\n // parseXmlStream,\n // parseNumber,\n // parseNumber_,\n // parseExcelDate,\n // parseExcelTimestamp,\n // parseCell,\n // EMPTY_CELL,\n // parseCellAddress,\n // LETTERS,\n // convertArrayOfCellsTo2dArrayOfValues,\n // convertValuesFromUint8ArraysToStrings,\n // strFromU8,\n // decodeUtf8String,\n // dropEmptyTrailingRows,\n // dropEmptyTrailingColumns,\n // isDateFormat,\n // DATE_FORMAT_SPECIFIC_LOCALE_PREFIX,\n // DATE_FORMAT_ALLOW_ANY_OTHER_TEXT_SUFFIX,\n // IS_DATE_FORMAT_CACHE, DATE_TEMPLATE_TOKENS,\n // isDateFormatStyle,\n // BUILT_IN_DATE_FORMAT_IDS,\n // parseSpreadsheetContents,\n // parseFilePaths,\n // parseSpreadsheetInfo,\n // parseSharedStrings,\n // parseStyles,\n // parseSheet,\n // getSheetRelationId,\n // getSheetNameByRelationId,\n // getXmlFilesAtFixedPaths,\n // getXmlFilesAtNonFixedPaths,\n // getSheetDataXmlFiles,\n // readFiles,\n // checkpoint,\n // latestCheckpointTimestamp,\n // isPromise\n // ]\n // )\n //\n // workerFn.inputTransferList(({ optionsJson, contents }) => Object.keys(contents).map(key => contents[key].buffer))\n //\n // return workerFn.callOnce({ optionsJson, contents }).then((result) => {\n // console.log('~ Input latency', workerFn.inputLatency)\n // console.log('~ Output latency', workerFn.outputLatency)\n // return result\n // })\n}\n\nfunction getSheetRelationId(sheet, sheets) {\n if (typeof sheet === 'string') {\n for (var _iterator = _createForOfIteratorHelperLoose(sheets), _step; !(_step = _iterator()).done;) {\n var _sheet = _step.value;\n if (_sheet.name === sheet) {\n return _sheet.relationId;\n }\n }\n throw new SheetNotFoundError(\"Sheet \\\"\".concat(sheet, \"\\\" not found. Available sheets: \").concat(sheets.map(function (_ref3) {\n var name = _ref3.name;\n return \"\\\"\".concat(name, \"\\\"\");\n }).join(', ')));\n } else {\n if (sheet <= sheets.length) {\n return sheets[sheet - 1].relationId;\n }\n throw new SheetNotFoundError(\"Sheet number out of bounds: \".concat(sheet, \". Available sheets count: \").concat(sheets.length));\n }\n}\nfunction getSheetNameByRelationId(sheetRelationId, sheets) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(sheets), _step2; !(_step2 = _iterator2()).done;) {\n var sheet = _step2.value;\n if (sheet.relationId === sheetRelationId) {\n return sheet.name;\n }\n }\n // The only way of getting `sheetRelationId` here is from the `sheets`,\n // so this error is not technically possible. And if it is thrown\n // then it means that there's a bug in the code because it's not\n // supposed to get `sheetRelationId` from anywhere other than the `sheets`.\n throw new Error(\"Sheet relation ID not found: \".concat(sheetRelationId));\n}\nfunction getXmlFilesAtFixedPaths() {\n return {\n // Read the paths to certain files inside the `.xlsx` file, which is itself just a `.zip` archive.\n // These paths aren't standardized between different spreadsheet editors.\n // https://github.com/tidyverse/readxl/issues/104\n 'xl/_rels/workbook.xml.rels': {\n name: 'filePaths',\n parse: parseFilePaths\n },\n // General info on the spreadsheet.\n 'xl/workbook.xml': {\n name: 'spreadsheetInfo',\n parse: parseSpreadsheetInfo\n }\n };\n}\nfunction getXmlFilesAtNonFixedPaths(filePaths) {\n var _ref4;\n return _ref4 = {}, _defineProperty(_ref4, filePaths.sharedStrings || 'xl/sharedStrings.xml', {\n name: 'sharedStrings',\n // `parseSharedStrings()` returns a `Promise`.\n parse: parseSharedStrings,\n // It seems that \"sharedStrings.xml\" is not required to exist.\n // For example, that could be the case when a spreadsheet doesn't contain any strings.\n // https://github.com/catamphetamine/read-excel-file/issues/85\n fallback: []\n }), _defineProperty(_ref4, filePaths.styles || 'xl/styles.xml', {\n name: 'styles',\n parse: parseStyles,\n fallback: {}\n }), _ref4;\n}\n\n// Returns the list of sheet data `.xml` files.\nfunction getSheetDataXmlFiles(filePaths, sheetRelationIdsToRead, sheetDataParserParameters) {\n return Object.keys(filePaths.sheets).filter(function (sheetRelationId) {\n return sheetRelationIdsToRead.includes(sheetRelationId);\n }).reduce(function (filesInfo, sheetRelationId) {\n return _objectSpread(_objectSpread({}, filesInfo), {}, _defineProperty({}, filePaths.sheets[sheetRelationId], {\n name: sheetRelationId,\n // `parseSheet()` returns a `Promise`.\n parse: function parse(content, parseXml) {\n return parseSheet(content, parseXml, sheetDataParserParameters);\n }\n }));\n }, {});\n}\n\n// In case of converting `.zip` file reader from a \"read-and-return\" one to a \"streaming\" one,\n// this function could be modified to process the files as they come rather than all-at-once.\n\n// Reads files from inside an `.xlsx` archive by file paths.\n//\n// In case of converting `.zip` file reader from a \"read-and-return\" one to a \"streaming\" one,\n// this function could be modified to process the files as they come rather than all-at-once.\n//\n// But there's a catch: inside an `.xlsx` file, some file paths are not fixed\n// and are instead defined in \"xl/_rels/workbook.xml.rels\" file,\n// which presents a \"chicken and an egg\" dilemma: how could one possibly\n// read an `.xlsx` file in one go when the order of the files inside it isn't fixed\n// and could be random. Most likely, in the majority of cases, \"xl/_rels/workbook.xml.rels\"\n// file is gonna be one of the first in a given `.xlsx` archive, but still it's not guaranteed.\n// A solution would be reading an `.xlsx` file in two passes: one pass would be just to read\n// the \"xl/_rels/workbook.xml.rels\" and ignore decompressing anything else,\n// and then the second pass would be to read all other files whose paths are now known.\n//\n// Returns:\n// * If none of the `parse()` functions returned a `Promise`, it returns a map of files' contents.\n// * If any of the `parse()` functions returned a `Promise`, it returns a `Promise` that resolves to a map of files' contents.\n//\nfunction readFiles(filesInfo, contents, parseXml) {\n // Get files' contents.\n var results = {};\n var _loop = function _loop() {\n var filePath = _Object$keys[_i];\n var fileInfo = filesInfo[filePath];\n results[fileInfo.name] = contents[filePath] === undefined ? fileInfo.fallback === undefined ? function () {\n throw new InvalidSpreadsheetError(\"\\\"\".concat(filePath, \"\\\" file not found inside the `.xlsx` file\"));\n }() : fileInfo.fallback : fileInfo.parse(contents[filePath], parseXml);\n };\n for (var _i = 0, _Object$keys = Object.keys(filesInfo); _i < _Object$keys.length; _i++) {\n _loop();\n }\n // Resolve any `Promise`s.\n var promises = [];\n var _loop2 = function _loop2() {\n var name = _Object$keys2[_i2];\n if (isPromise(results[name])) {\n promises.push(results[name].then(function (result) {\n results[name] = result;\n }));\n }\n };\n for (var _i2 = 0, _Object$keys2 = Object.keys(results); _i2 < _Object$keys2.length; _i2++) {\n _loop2();\n }\n if (promises.length > 0) {\n return Promise.all(promises).then(function () {\n return results;\n });\n }\n return results;\n}\n//# sourceMappingURL=parseSpreadsheetContents.js.map","import createWorkerFunction from 'worker-f/browser';\nimport parseXml from '../xml/parseXml.js';\nimport unpackXlsxFile from './unpackXlsxFileBrowser.js';\nimport parseSpreadsheetContents from '../xlsx/parseSpreadsheetContents.js';\n\n/**\r\n * Reads an `.xlsx` file.\r\n * @param {(File|Blob|ArrayBuffer)} input\r\n * @param {object} [options]\r\n * @return {Promise<Sheet[]>}\r\n */\nexport default function readXlsxFile(input, options) {\n return unpackXlsxFile(input).then(function (contents) {\n return parseSpreadsheetContents(createWorkerFunction, parseXml, contents, options);\n });\n}\n//# sourceMappingURL=readXlsxFileBrowser.js.map"],"names":["stringifyFunctionReferences","getDependencies","functions","variables","references","getReferencesSourceCode","toString","referencedNames","slice","indexOf","lastIndexOf","replace","split","i","length","name","value","getFunctionSourceCode","func","funcSourceCode","prototype","funcNameStartsAt","funcNameEndsBefore","code","key","createWorker","createWorkerInEnvironment","createInputHandler","onError","onOutput","getFromCache","setInCache","worker","started","start","arrayOfGetDependenciesFunctions","dependenciesTransferList","Error","cacheValue","cachedCodeAndVars","_","codeAndVars","functionDefinitions","vars","funcs","Object","assign","keys","map","functionName","join","createFunctionsCodeAndVars","JAVASCRIPT_CODE_BEFORE_CREATE_INPUT_HANDLER_FUNCTION","JAVASCRIPT_CODE_AFTER_CREATE_INPUT_HANDLER_FUNCTION","getCodeAndVars","properties","other","ingest","stop","data","transferList","CACHE","createWorkerFunction","fnOrAlias","resolveCall","rejectCall","createMethods","handleError","handleOutput","alias","stopped","getDependenciesFunctions","inputTransferList","outputTransferList","cacheKey","mustNotHaveStarted","mustNotHaveStopped","mustNotHaveAlias","argumentMustBeFunction","arg","TypeError","fn","$","addDependencies_","push","undefined","workerFn","inputLatency","outputLatency","addDependencies","alias_","inputArgs","Date","now","sendOutput_","inputSentTimestamp","inputReceivedTimestamp","inputHandler","output","inputSentAt","input","error","outputTimestamp","createWorkerFunction_","sendToWorker","mustHaveStarted","call","args","Promise","resolve","reject","callOnce","this","finally","send","result","anything","then","createWorkerInBrowser","javascriptCode","url","URL","createObjectURL","Blob","JAVASCRIPT_CODE_ADDITIONAL","type","createWorkerCodeUrl","Worker","onmessage","event","errorData","ERROR_MESSAGE_PROPERTY_NAME","message","stack","terminate","bind","postMessage","createWorkerFunctionInBrowser","_typeof","o","Symbol","iterator","constructor","Parser_","options","fromCharCode","String","hasOwnProperty","ENTITY_PATTERN","ENTITY_MAPPING","amp","apos","gt","lt","quot","replaceEntities","d","x","z","parseInt","decodeEntities","s","forEach","k","toUpperCase","NON_WHITESPACE_OUTSIDE_ROOT_NODE","msg","getter","getFn","get","enumerable","cloneNsMatrix","nsMatrix","clone","NAME_CACHE","uriPrefix","prefix","noopGetContext","line","column","throwFunc","err","Parser","onText","onOpenTag","onCloseTag","onCDATA","onWarning","onComment","onQuestion","onAttention","nsMatrixStack","nodeStack","nsUriToPrefix","proxy","getContext","streaming","rootTagFound","leftoverXml","maybeNS","isNamespace","returnError","parseStop","handleWarning","resetState","uri","buildNsMatrix","parse","xml","_nsMatrix","y","q","w","v","xmlns","elementName","_elementName","elementProxy","cachedAttrs","arguments","elNameCache","elNameCacheMatrix","anonymousNsCount","tagStart","tagEnd","j","attrsString","attrsStart","normalizeAttrName","defaultAlias","nsName","substring","substr","getAttrs","nsUri","nsUriPrefix","hasNewMatrix","newalias","skipAttr","attrList","l","attrs","seenAttrs","Set","parseAttr","charCodeAt","has","add","match","splitsRe","startOfLine","endOfLine","exec","index","create","originalName","ns","trim","isNaN","pop","_cachedName","cb","nsMap","_nsUriToPrefix","TAG_NAME_PREFIX","trimXmlnsPrefix","tagName","_defineProperties","target","props","descriptor","configurable","writable","defineProperty","hint","prim","toPrimitive","res","Number","_toPrimitive","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","Super","_getPrototypeOf","NewTarget","Reflect","construct","apply","self","ReferenceError","_assertThisInitialized","_possibleConstructorReturn","_wrapNativeSuper","Class","_cache","Map","Function","set","Wrapper","_construct","_setPrototypeOf","Parent","a","instance","sham","Proxy","Boolean","valueOf","e","p","setPrototypeOf","__proto__","getPrototypeOf","InvalidSpreadsheetError","_Error","subClass","superClass","_inherits","Constructor","protoProps","staticProps","_super","_this","_classCallCheck","parseXml","state","onProgress","parser","resolvePromise","errored","mustNotHaveErrored","promise","on","text","element","selfClosing","attributes","write","end","parseXmlStream","nonBlocking","MAX_CHUNK_PROCESSING_TIME","chunkSize","parseNextChunk","startedAt","chunkProcessingTime","loop","setImmediate","setTimeout","parseXmlInChunks","spreadsheetError","cause","ch2","u8","Uint8Array","u16","Uint16Array","i32","Int32Array","fleb","fdeb","clim","freb","eb","b","r","_a","fl","revfl","fd","rev","hMap","cd","mb","co","le","rvb","sv","r_1","m","flt","fdt","flrm","fdrm","max","bits","bits16","shft","slc","subarray","ec","ind","nt","captureStackTrace","inflt","dat","st","buf","dict","sl","dl","f","noBuf","resize","noSt","cbuf","bl","nbuf","Math","final","pos","bt","lm","dm","lbt","dbt","n","tbts","t","hLit","hcLen","tl","ldt","clt","clb","clbmsk","clm","c","dt","lms","dms","lpos","sym","dsym","shift","dend","min","et","wcln","fnStr","td","ks","st_1","spInd","ch","wrkr","fns","init","id","td_1","mrg","transfer","ed","$e$","wk","buffer","cbfs","bInflt","inflateSync","pbf","gopt","out","size","dictionary","cbify","opts","consume","b2","b4","b8","TextDecoder","decode","stream","dutf8","strFromU8","latin1","slzh","zh","fnl","efl","es","z64hs","sc","su","off","nsc","nsu","noff","mt","queueMicrotask","unzip","term","tAll","files","cbd","lft","ze","fltr","filter","_loop_3","c_1","no","cbl","originalSize","compression","infl","ev","inflate","UnzipError","createUnzipError","unzipError","unzipFromArrayBuffer","_ref","_filter","file","path","isFlateError","unzipFromArrayBufferUsingFunction","unzipAsync","archive","MESSAGES","XLS_FILE_NOT_SUPPORTED","FILE_NOT_SUPPORTED","INVALID_ZIP","NO_DATA","InvalidInputError","filterZipArchiveEntry","endsWith","ZIP_FILE_SIGNATURE","XLS_FILE_SIGNATURE","FILE_TYPE_SIGNATURES","latestCheckpointTimestamp","XLS_FILE_TYPE","_createForOfIteratorHelperLoose","allowArrayLike","it","next","Array","isArray","minLen","_arrayLikeToArray","from","test","_unsupportedIterableToArray","done","arr","len","arr2","validateLeadingBytes","bytes","_step","fileTypeDetector","possibleTypes","array","indexes","indexesOf","_byte","typeIndex","createFileTypeDetector","_iterator","validateByte","byteCount","noFileTypeCouldBeDetermined","_byte2","fileType","checkpoint","global","READ_EXCEL_FILE_CHECKPOINTS","window","console","log","unpackXlsxFile","File","arrayBuffer","getResultFromArrayBuffer","parseSpreadsheetInfo","content","workbookPr","sheets","epoch1904","date1904","sheetId","relationId","getResultFromState","parseFilePaths","sharedStrings","styles","getFilePathFromRelationTarget","addFilePathForRelation","Id","Type","Target","_excluded","ownKeys","getOwnPropertySymbols","getOwnPropertyDescriptor","_objectSpread","_defineProperty","getOwnPropertyDescriptors","defineProperties","obj","_toPropertyKey","_objectWithoutProperties","source","excluded","sourceKeys","_objectWithoutPropertiesLoose","sourceSymbolKeys","propertyIsEnumerable","parseStyles","numberFormats","baseStyles","cellStyleXfs","cellXfs","numFmtId","template","formatCode","parseCellStyle","style","xfId","styleProperties","numberFormat","parseSharedStrings","si","strings","rPh","string","onOpenTagInSharedString","onCloseTagInSharedString","onTextInSharedString","parseExcelTimestamp","excelSerialDate","floor","JANUARY_0TH_1900_DAY","DATE_FORMAT_SPECIFIC_LOCALE_PREFIX","DATE_FORMAT_ALLOW_ANY_OTHER_TEXT_SUFFIX","IS_DATE_FORMAT_CACHE","DATE_TEMPLATE_TOKENS","isDateFormatStyle","defaultDateFormat","shouldGuessDateFormatFromNumberFormatTemplate","BUILT_IN_DATE_FORMAT_IDS","tokens","toLowerCase","every","token","isDateFormat","MAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS","JAPANESE_OR_KOREAN_LOCALE_BUILT_IN_DATE_FORMAT_IDS","concat","numberFormatId","_slicedToArray","_arrayWithHoles","u","_iterableToArrayLimit","_nonIterableRest","EMPTY_CELL","parseCellAddress","coordinatesString","_coordinatesString$sp2","columnLetters","rowNumberString","LETTERS","columnNumberFromColumnLetters","EMPTY_CELL_VALUE","parseSheet","THROW_ON_FIRST_CELL_ERROR","parseCellParameters","dateFormat","smartDateParser","parseNumber","rows","errors","dimension","sheetData","ref","dimensions","parseSheetDimensionRef","row","rowNumber","rowIndexShift","cursor","rowCount","columnCount","dataRowCount","dataColumnCount","is","vText","inlineString","onOpenTagInCell","onOpenTagInSheetData","previousRowNumber","cell","_ref3","_parseCellAddress2","errorOrTypeAndValue","parameters","trimStrings","_ref2","dateTemplateParser","parseNumberCustom","sharedStringIndex","parsedDate","getTime","styleId","timestamp","number","parseCell","parseCellWithRepairAbility","parseCellAndTrimValue","parseCellValue","parseCellFromXmlData","throwInvalidCellError","onCloseTagInCell","onCloseTagInSheetData","onTextInCell","onTextInSheetData","rowsRead","getRowsFromState","errorsEncountered","getErrorsFromState","finalizedRows","setRowsInState","setErrorsInState","_state$sheetData","strFromU8_","SheetNotFoundError","CAN_USE_WORKER","parseSpreadsheetContents","contents_","contents","entries","convertedEntries","_i","_Object$keys","convertValuesFromUint8ArraysToStrings","readFiles","spreadsheetInfo","filePaths","_ref4","fallback","getXmlFilesAtNonFixedPaths","sheetRelationIdsToRead","sheet","_sheet","getSheetRelationId","sheetDataParserParameters","sheetRelationId","includes","reduce","filesInfo","getSheetDataXmlFiles","sheetsData","getSheetNameByRelationId","_step2","_iterator2","filePath","fileInfo","results","promises","_loop2","_Object$keys2","_i2","all"],"mappings":"6OAsBe,SAASA,EAA4BC,GAChD,MAAMC,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