@gen-epix/ui-client-casedb 4.0.2 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/_chunks/AddCasesToEventDialog.js.map +1 -1
  2. package/dist/_chunks/CaseDbDownloadUtil.js +1 -1
  3. package/dist/_chunks/CaseDbDownloadUtil.js.map +1 -1
  4. package/dist/_chunks/CaseInfoDialog.js +4 -4
  5. package/dist/_chunks/CaseInfoDialog.js.map +1 -1
  6. package/dist/_chunks/CaseSetInfoDialog.js +4 -4
  7. package/dist/_chunks/CaseSetInfoDialog.js.map +1 -1
  8. package/dist/_chunks/CasesAlreadyInCaseSetWarning.js.map +1 -1
  9. package/dist/_chunks/Dashboard.js +3 -2
  10. package/dist/_chunks/Dashboard.js.map +1 -1
  11. package/dist/_chunks/FindSimilarCasesDialog.js +6 -6
  12. package/dist/_chunks/FindSimilarCasesDialog.js.map +1 -1
  13. package/dist/_chunks/HomePageTrends.js.map +1 -1
  14. package/dist/_chunks/LineListWidget.js +46 -45
  15. package/dist/_chunks/LineListWidget.js.map +1 -1
  16. package/dist/_chunks/Upload.js +308 -304
  17. package/dist/_chunks/Upload.js.map +1 -1
  18. package/dist/_chunks/UploadUtil.js +44 -40
  19. package/dist/_chunks/UploadUtil.js.map +1 -1
  20. package/dist/_chunks/dashboardStore.js.map +1 -1
  21. package/dist/classes/services/EventBusService/EventBusService.d.ts +9 -2
  22. package/dist/classes/services/EventBusService/index.js.map +1 -1
  23. package/dist/components/ui/MapWidget/index.js.map +1 -1
  24. package/dist/components/ui/RemoveCasesFromEventDialog/index.js.map +1 -1
  25. package/dist/components/ui/SequenceDownloadDialog/index.js +53 -40
  26. package/dist/components/ui/SequenceDownloadDialog/index.js.map +1 -1
  27. package/dist/components/ui/TreeWidget/index.js +8 -2
  28. package/dist/components/ui/TreeWidget/index.js.map +1 -1
  29. package/dist/locale/en.json +0 -11
  30. package/dist/locale/nl.json +0 -11
  31. package/dist/models/config.d.ts +2 -0
  32. package/dist/utils/UploadUtil/UploadUtil.d.ts +1 -0
  33. package/package.json +15 -23
  34. package/dist/components/ui/FileSelector/FileSelector.d.ts +0 -7
  35. package/dist/components/ui/FileSelector/index.d.ts +0 -1
  36. package/dist/components/ui/FileSelector/index.js +0 -206
  37. package/dist/components/ui/FileSelector/index.js.map +0 -1
  38. package/dist/utils/FileUtil/FileUtil.d.ts +0 -5
  39. package/dist/utils/FileUtil/index.d.ts +0 -1
  40. package/dist/utils/FileUtil/index.js +0 -15
  41. package/dist/utils/FileUtil/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"UploadUtil.js","names":["_typeof","Parser","_typeof","_defineProperties","_toPropertyKey","_createClass","_toPrimitive","_classCallCheck","_inherits","_createSuper","_isNativeReflectConstruct","_getPrototypeOf","_possibleConstructorReturn","_assertThisInitialized","_wrapNativeSuper","_isNativeFunction","_construct","_setPrototypeOf","_typeof","_defineProperties","_toPropertyKey","_createClass","_toPrimitive","_classCallCheck","_inherits","_createSuper","_isNativeReflectConstruct","_getPrototypeOf","_possibleConstructorReturn","_assertThisInitialized","_wrapNativeSuper","_isNativeFunction","_construct","_setPrototypeOf","_typeof","_defineProperties","_toPropertyKey","_createClass","_toPrimitive","_classCallCheck","_inherits","_createSuper","_isNativeReflectConstruct","_getPrototypeOf","_possibleConstructorReturn","_assertThisInitialized","_wrapNativeSuper","_isNativeFunction","_construct","_setPrototypeOf","_createForOfIteratorHelperLoose","_unsupportedIterableToArray","_arrayLikeToArray","_typeof","_excluded","ownKeys","_objectSpread","_defineProperty","_toPropertyKey","_toPrimitive","_objectWithoutProperties","_objectWithoutPropertiesLoose","_slicedToArray","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","_arrayLikeToArray","EMPTY_CELL_VALUE","_slicedToArray","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","_createForOfIteratorHelperLoose","_arrayLikeToArray","EMPTY_CELL_VALUE","parseSheet","strFromU8_","_typeof","_typeof","_defineProperties","_toPropertyKey","_createClass","_toPrimitive","_classCallCheck","_inherits","_createSuper","_isNativeReflectConstruct","_getPrototypeOf","_possibleConstructorReturn","_assertThisInitialized","_wrapNativeSuper","_isNativeFunction","_construct","_setPrototypeOf","_typeof","_createForOfIteratorHelperLoose","_unsupportedIterableToArray","_arrayLikeToArray","ownKeys","_objectSpread","_defineProperty","_toPropertyKey","_toPrimitive","parseSheet","parseSpreadsheetContents","createWorkerFunction","_typeof","_toPropertyKey","_toPrimitive","_typeof","ownKeys","_objectSpread","_defineProperty","_toPropertyKey","_toPrimitive","parseSpreadsheetContents","createWorkerFunction"],"sources":["../../../../node_modules/.pnpm/worker-f@0.1.20/node_modules/worker-f/lib/stringifyFunctionReferences.js","../../../../node_modules/.pnpm/worker-f@0.1.20/node_modules/worker-f/lib/createWorker.js","../../../../node_modules/.pnpm/worker-f@0.1.20/node_modules/worker-f/lib/createWorkerFunction_.js","../../../../node_modules/.pnpm/worker-f@0.1.20/node_modules/worker-f/lib/createWorkerFunction.js","../../../../node_modules/.pnpm/worker-f@0.1.20/node_modules/worker-f/lib/environment/createWorkerInBrowser.js","../../../../node_modules/.pnpm/worker-f@0.1.20/node_modules/worker-f/lib/export/browser/createWorkerFunctionInBrowser.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/saxen/parser.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xml/parseXmlStream.saxen.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/InvalidSpreadsheetError.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xml/parseXml.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/zip/UnzipError.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/zip/unzipFromArrayBuffer.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/file/InvalidInputError.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/export/filterZipArchiveEntry.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/file/createFileTypeDetector.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/file/validateLeadingBytes.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/utility/checkpoint.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/export/unpackXlsxFileBrowser.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseSpreadsheetInfo.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseFilePaths.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseStyles.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseSharedStrings.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseExcelTimestamp.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/isDateFormat.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/isDateFormatStyle.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseCell.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseCellAddress.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseSheet.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/utility/convertValuesFromUint8ArraysToStrings.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/utility/isPromise.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/SheetNotFoundError.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseSpreadsheetContents.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/export/readXlsxFileBrowser.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/parseSheetData/InvalidError.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/parseSheetData/types/Number.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/parseSheetData/types/String.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/parseSheetData/types/Boolean.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/parseSheetData/types/Date.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/utility/isObject.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/parseSheetData/parseSheetData.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/export/parseSheet.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/export/readSheetBrowser.js","../../src/utils/UploadUtil/UploadUtil.ts"],"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// An approximate regular expression of a javascript variable name letter.\n// `\\w` covers `a-z`, `A-Z`, `0-9`, and `_`.\n// First letter can't be a digit, so this reg exp consists of two parts.\nconst JAVASCRIPT_VARIABLE_NAME_REG_EXP = /^[$_\\u0080-\\uFFFFa-zA-Z][$_\\u0080-\\uFFFF\\w]*$/;\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(']')).split(',').map(_ => _.trim());\n // Although it doesn't seem to be reproducible in the tests,\n // I did experience a strange bug when commenting out a dependency\n // resulted in `referencedNames` still including the commented-out variable name.\n // To work around that, it could either validate that `references.length === referencedNames.length`,\n // or validate each referenced name for illegal characters (which includes \"//\").\n for (const name of referencedNames) {\n if (!JAVASCRIPT_VARIABLE_NAME_REG_EXP.test(name)) {\n throw new Error(`Invalid dependency name: ${name}`);\n }\n }\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 // Non-function/non-class values don't need to be stringified\n // because they could be just \"cloned\" in most cases, but not all cases:\n // https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\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 a class.\n *\n * For non-\"native\" classes, the end result will depend on the name of the class,\n * which should be passed as a second argument for that reason. Specifically,\n * the name of the class will be used when defining its `prototype` properties.\n *\n * \"Native\" functions or classes will be stringified to their \"native\" global name.\n * For example, a reference to `ArrayBuffer` will be stringified as `\"ArrayBuffer\"`.\n *\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 because they're written in C++, etc.\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]') >= 0) {\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 // The code of non-\"native\" classes will have to include the source code\n // of all their `prototype` properties.\n let code = funcSourceCode;\n for (const key in func.prototype) {\n // Sidenote: For `TextDecoder` global class in Node.js, I saw it output a \"weird\" error\n // `TypeError: Value of \"this\" must be of type TextDecoder` when attempting to read `func.prototype[\"encoding\"]`.\n // Perhaps that's because the `encoding` property of `TextDecoder` is a \"getter\"\n // rather than a property, and that \"getter\" function relies on `this` being `TextDecoder`:\n // `get encoding() { return this.#encoding; }`.\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 // Stops the worker.\n const stop = () => {\n worker.stop();\n };\n // Ingests data into the worker.\n const ingest = (data, transferList) => {\n try {\n worker.ingest(data, transferList);\n }\n catch (error) {\n // If a `DOMException [DataCloneError]` is thrown, stop the worker, otherwise\n // it will stay running and will prevent Node.js process from exiting.\n stop();\n // Re-throw the error.\n throw error;\n }\n };\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 ingest(vars, dependenciesTransferList);\n }\n };\n return {\n start,\n stop,\n ingest\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 // For each referenced \"external\" function (or class), define it as a global variable\n // using the dependency name as the global variable's name\n // and the source code of the function (or class) as the global variable's value.\n //\n // \"Native\" global classes or functions such as `ArrayBuffer` won't have any source code\n // and it will be just their global name. This means that if someone passes something like\n // `ArrayBuffer` as a dependency, it will produce code like `ArrayBuffer=ArrayBuffer`,\n // which doesn't really make any sense, but it still works and it doesn't result in any bugs,\n // so it's not handled in any special way. And if someone passes something like\n // `const ab = ArrayBuffer` as a dependency, it will produce code like `ab=ArrayBuffer`,\n // and in such case it does make sense.\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 // This variable is defined here just to work around TypeScript compiler error message:\n // \"Type 'number' is not assignable to type 'undefined'.\"\n let numberOrUndefined;\n // Declare a worker function. It will be returned from this function.\n const workerFn = Object.assign({ inputLatency: numberOrUndefined, outputLatency: numberOrUndefined, \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 = -1;\n let inputReceivedTimestamp = -1;\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 // `createInputHandler()` function could call `send()` right away\n // without waiting to receive any input.\n // In such case, `inputLatency` should stay `undefined`.\n if (inputSentTimestamp !== -1) {\n workerFn.inputLatency = inputReceivedTimestamp - inputSentTimestamp;\n }\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 error = new Error(errorData[0]);\n error.stack = errorData[1];\n let i = 2;\n while (i < errorData.length) {\n error[errorData[i][0]] = errorData[i][1];\n i++;\n }\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 = '$err$';\nconst JAVASCRIPT_CODE_ADDITIONAL = \n// Listen to incoming messages from the main thread.\n'self.onmessage = function(evt) {' +\n 'onMessage(evt.data)' +\n '}' + ';' +\n // Reports an error to the main thread.\n 'function onErr(err_, msg) {' +\n 'var err = err_ instanceof Error ? err_ : new Error(msg)' + ';' +\n 'postMessage({' +\n ERROR_MESSAGE_PROPERTY_NAME + ':' + '[' +\n // `message` is a \"non-enumerable\" property of an `Error` class\n // and it won't be present in `Object.keys(error)`.\n 'err.message' + ',' +\n // `stack` is a \"non-enumerable\" property of an `Error` class\n // and it won't be present in `Object.keys(error)`.\n 'err.stack' +\n '].concat(' +\n // Add any \"rest\" properties of the error such as `name` or `code`.\n 'Object.keys(err).map(' +\n 'function(k){' +\n 'return[k,err[k]]' +\n '}' +\n ')' +\n ')' +\n '})' +\n '}' + ';' +\n // Define a `postMessage()` function that will be used to send messages to the main thread.\n 'var postMessage = self.postMessage' + ';' +\n // Listen to any \"synchronous\" errors that occur inside the worker.\n //\n // \"The error event is fired on a Window object when a resource failed to load\n // or couldn't be used — for example if a script has an execution error.\"\n //\n // \"This event is only generated for script errors thrown synchronously,\n // such as during initial loading or within event handlers.\n // If a promise was rejected (including an uncaught throw within an async function)\n // and no rejection handlers were attached, an `unhandledrejection` event is fired instead.\"\n //\n 'addEventListener(\"error\",' +\n // `evt` argument is an instance of `ErrorEvent` class, which inherits from `Event` class.\n // https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent\n 'function(evt) {' +\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 'onErr(evt.error, evt.message)' +\n '}' +\n ')' + ';' +\n // Listen to any \"asynchronous\" errors that occur inside the worker.\n //\n // \"The `unhandledrejection` event is sent to the global scope of a script\n // when a JavaScript Promise that has no rejection handler is rejected;\n // typically, this is the window, but may also be a Worker.\"\n //\n 'addEventListener(\"unhandledrejection\",' +\n // `evt` argument is an instance of `PromiseRejectionEvent` class, which inherits from `Event` class.\n // https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent\n 'function(evt) {' +\n // Prevent the default logging behavior in the browser console.\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/unhandledrejection_event#preventing_default_handling\n 'evt.preventDefault()' + ';' +\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 'onErr(evt.reason, String(evt.reason))' +\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. &nbsp;\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 (&amp;) as well as\r\n * hex (&#xaaf;) and decimal (&#1231;) 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\n // const xmlns = false\n\n var parser = new Parser();\n\n // // Whether it should parse XML \"namespaces\" (`xmlns` stuff).\n // // It parses faster when the \"namespaces\" mode is disabled.\n // // That's why it's not enabled.\n // if (xmlns) {\n // // // See `xml/xlsxNamespaces.js` file for the list of possible `.xlsx` namespaces.\n // // parser.ns(xlsxNamespaces)\n // parser.ns()\n // }\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 (`&#233;`, `&amp;`, 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(elementName, getAttributes, decodeEntities, selfClosing, getContext) {\n if (onOpenTag) {\n var attributes = getAttributes();\n // `saxen` doesn't decode character references (`&#233;`, `&amp;`, etc)\n // in attribute values either, so decode them here.\n // The reason why `saxen` deliberately doesn't decode character references by default\n // is performance, I assume.\n for (var name in attributes) {\n // Also remove an `xmlns` prefix from the attribute name, if present.\n // When doing so, don't clean up the attribute name with a prefix\n // because it doesn't interfere, and it's faster this way.\n attributes[trimXmlnsPrefix(name, true)] = decodeEntities(attributes[name]);\n }\n onOpenTag(trimXmlnsPrefix(elementName), attributes, state);\n }\n };\n\n // closed a tag.\n var onclosetag = function onclosetag(elementName) {\n if (onCloseTag) {\n onCloseTag(trimXmlnsPrefix(elementName), 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}\nfunction trimXmlnsPrefix(string, isAttributeName) {\n var i = 0;\n while (i < string.length) {\n if (string[i] === ':') {\n // If `string` is an attribute name, filter out `xmlns:...` cases\n // which aren't really attributes but rather xmlns schema URIs.\n if (isAttributeName && i === 5 && string.slice(0, 5) === 'xmlns') {\n // Ignore this attribute.\n } else {\n return string.slice(i + 1);\n }\n }\n i++;\n }\n return string;\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","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","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","// 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","// 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.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 // There're two standards of `.xlsx` files:\n // * So-called \"transitional\", that emerged originally in 2006 and debuted widely with Microsoft Office 2007.\n // * So-called \"strict\", that emerged in 2008 with the publication of the ISO/IEC 29500 specification.\n //\n // \"Transitional\" standard was released in 2007 and includes legacy elements, old namespaces,\n // and compatibility features to support conversions from 1990s binary format `.xls`.\n // This remains Excel's default save format.\n //\n // \"Strict\" standard was introduced conceptually in 2008, but fully realized with modern namespaces\n // and no legacy tags (like VML or old drawing quirks) later on. Microsoft added reading support\n // in Excel 2010 and the ability to save Strict files starting in Excel 2013.\n //\n var RELATIONSHIPS_BASE_URL_TRANSITIONAL_STANDARD = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/';\n var RELATIONSHIPS_BASE_URL_STRICT_STANDARD = 'http://purl.oclc.org/ooxml/officeDocument/relationships/';\n\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 RELATIONSHIPS_BASE_URL_TRANSITIONAL_STANDARD + 'styles':\n case RELATIONSHIPS_BASE_URL_STRICT_STANDARD + 'styles':\n state.styles = getFilePathFromRelationTarget(target);\n break;\n case RELATIONSHIPS_BASE_URL_TRANSITIONAL_STANDARD + 'sharedStrings':\n case RELATIONSHIPS_BASE_URL_STRICT_STANDARD + 'sharedStrings':\n state.sharedStrings = getFilePathFromRelationTarget(target);\n break;\n case RELATIONSHIPS_BASE_URL_TRANSITIONAL_STANDARD + 'worksheet':\n case RELATIONSHIPS_BASE_URL_STRICT_STANDARD + '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 var numFmtId = Number(attributes.numFmtId);\n var numberFormat = {\n id: numFmtId\n };\n //\n // If (and only if) `numFmtId` is >= 164, it is supposed to specify a `formatCode` (a template).\n //\n // For some reason, Microsoft Excel 2007 doesn't allow to redefine `numFmtId=\"99\"`\n // but at the same time does allow redefining `numFmtId=\"100\"`.\n //\n // Google AI says:\n //\n // \"Standard built-in Excel formats use IDs from 0 to 49 (and some regional ones up to 81).\n // IDs 164 and above are officially reserved for custom formats, but third-party spreadsheet\n // generators or older templates frequently assign custom IDs starting at 100 (or lower)\"\n //\n // Because of such \"non-strict\" behavior of Microsoft Excel 2007 regarding overwriting\n // number formats with ID >= 100, this package mimicks such \"non-strict\" approach.\n //\n if (numFmtId >= 100) {\n numberFormat.template = attributes.formatCode;\n }\n state.numberFormats[numFmtId] = numberFormat;\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 if (attributes.numFmtId) {\n var numFmtId = Number(attributes.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: 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","// In some date formats, there's a \";@\" postfix.\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 variable is exported only to be specified in `worker-f` dependencies.\n//\nexport var DATE_FORMAT_POSTFIX_THAT_ALLOWS_ANY_ARBITRARY_TEXT_INPUT = /;@$/;\n\n// Date format template will be cleared of any \"unrelated\" characters.\n//\n// * Characters `a-z` are \"related\" because they're used as date format tokens.\n// * d — Day\n// * yyyy — Year\n// * etc\n//\n// * Characters `0#?,.%` are \"related\" because they indicate a numeric number format.\n// * 0 — Mandatory digit placeholder\n// * # — Optional digit placeholder\n// * ? — Digit placeholder that aligns decimals or fraction spaces\n// * , or . — Thousands and decimal separators. This one is ignored because\n// it could also be present in a valid date template: \"d mmmm yyyy г.\" or \"mmm dddd, yyyy\"\n// * % — Percentage multiplier\n//\n// This variable is exported only to be specified in `worker-f` dependencies.\n//\nexport var DATE_FORMAT_TOKEN_SPLITTER_REG_EXP = /[^a-z0#\\?%]+/;\n\n/**\r\n * XLSX standard does have \"d\" type for dates, but it's not commonly used.\r\n * Instead, `.xlsx` files use \"n\" type for storing both numbers and dates (as timestamps).\r\n * So how does one tell if a cell value should be interpreted as a number or as a date?\r\n * The answer is in the \"format\" that is used to \"format\" the cell value: if it's\r\n * date-specific then it's a date, otherwise it's a number.\r\n * This function tells if a given number format template represents a date rather than a number.\r\n * @param {number} formatId\r\n * @param {string} template\r\n * @param {boolean?[]} dateFormatDetectionCache\r\n * @returns {boolean}\r\n */\nexport default function isDateFormat(formatId, template, dateFormatDetectionCache) {\n var cachedResult = dateFormatDetectionCache[formatId];\n if (cachedResult === undefined) {\n return dateFormatDetectionCache[formatId] = isDateFormatTemplate(template);\n }\n return cachedResult;\n}\n\n/**\r\n * XLSX standard does have \"d\" type for dates, but it's not commonly used.\r\n * Instead, `.xlsx` files use \"n\" type for storing both numbers and dates (as timestamps).\r\n * So how does one tell if a cell value should be interpreted as a number or as a date?\r\n * The answer is in the \"format\" that is used to \"format\" the cell value: if it's\r\n * date-specific then it's a date, otherwise it's a number.\r\n * This function tells if a given number format template represents a date rather than a number.\r\n * @param {string} numberFormat\r\n * @returns {boolean}\r\n */\nexport function isDateFormatTemplate(template) {\n // Date format tokens could be in upper case or in lower case.\n // Normalize the format template by lowercasing it first.\n template = template.toLowerCase();\n\n // In some date formats, there's an \";@\" suffix. Remove it.\n //\n // Adding \";@\"\" at the end ensures that if someone types text into the cell\n // instead of a date, Excel displays that text normally rather than hiding it or throwing an error.\n // Because it occurs in almost all Excel date formats, it should be stripped.\n //\n template = template.replace(DATE_FORMAT_POSTFIX_THAT_ALLOWS_ANY_ARBITRARY_TEXT_INPUT, '');\n\n // Replace any escaped characters with a dummy placeholder\n // that won't be recognized as a \"meaningful\" character,\n // and therefore it won't influence further parsing.\n //\n // The dummy placeholder is not removed because it still acts as a sepaarator\n // between potential adjacent \"meaningful\" tokens. If it was simply removed\n // then it could potentially merge two valid date format tokens into an invalid one.\n // Example: \"d\\my\" → \"d y\" (tokens: \"d\" and \"y\" — both valid) vs \"d\\my\" → \"dy\" (unknown token \"dy\").\n //\n // Escaping is done by putting a backslash (\\) directly before a character.\n // For example, `0.00\\m` displays letter \"m\" literally instead of interpreting it\n // as a month or minute token.\n //\n template = template.replace(/\\\\./g, ' ');\n\n // Split the template by semicolon character into potential multiple independent parts\n // and then test each part independently. If one part represents a date format then\n // the entire format does.\n //\n // What are the cases when there could be a semicolon in a date format tempalte:\n //\n // * There could be a conditional prefix — `[Condition]TrueFormat;FalseFormat` —\n // that splits the template into `TrueFormat` and `FalseFormat` parts which\n // should be evaluated independently. If `TrueFormat` or `FalseFormat` part\n // represents a date format then the entire format represents a date.\n //\n // * Example: `[<45000]\"Old: \"yyyy-mm-dd;yyyy-mm-dd` displays \"Old\"\n // if the date serial is under 45000, otherwise it shows the date.\n //\n // * Possible operators:\n // * [>number] (Greater than)\n // * [>=number] (Greater than or equal to)\n // * [<number] (Less than)\n // * [<=number] (Less than or equal to)\n // * [=number] (Equal to)\n // * [<>number] (Not equal to)\n //\n // * Excel only allows one conditional prefix to be used.\n // * Correct: `[<45000]MM/DD/YYYY; DD-MMM-YYYY`\n // * Incorrect: `[<45000]MM/DD/YYYY; [>=45000]DD-MMM-YYYY`\n //\n // * Another possible case of using semicolons is dividing a format for different types of data:\n // `Positive values; Negative values; Zero values; Text`.\n // In such case, if any of these parts represent a date then the entire format represents a date.\n //\n // * Example: `yyyy-mm-dd;[Red]yyyy-mm-dd; \"No Date\"` — Displays normal dates normally,\n // negative/error serials in red, and text/zero entries as \"No Date\".\n //\n var templates = template.split(';');\n\n // If any of the sub-templates represent a date then the entire template represents a date.\n return templates.some(isDateFormatSubTemplate);\n\n /**\r\n * Tells if a given format template formats a date.\r\n * @param {string} template\r\n * @returns {boolean}\r\n */\n function isDateFormatSubTemplate(template) {\n // Replace any quoted text with a dummy placeholder\n // that won't be recognized as a \"meaningful\" character,\n // and therefore it won't influence further parsing.\n //\n // The dummy placeholder is not removed because it still acts as a sepaarator\n // between potential adjacent \"meaningful\" tokens.If it was simply removed\n // then it could potentially merge two valid date format tokens into an invalid one.\n // Example: `d\"-\"y` → `d y` (tokens: \"d\" and \"y\" — both valid) vs `d\"-\"y` → `dy` (unknown token \"dy\").\n //\n // Formats could include arbitrary prefixes or postfixes.\n // Example: `\"Date: \"yyyy-mm-dd` will display \"Date: 2026-06-06\".\n // Example: `yyyy-mm-dd \"EST\"` will display \"2026-08-09 EST\".\n //\n template = template.replace(/\"[^\"]*\"/g, ' ');\n\n // Remove \".0\" or \".00\" or \".000\" tokens from the format template.\n //\n // * Adding \".0\" after \"s\" tells Excel to displays the fractional part of a second\n // rounded to one decimal place (tenths). For example, a template \"mm:ss.0\"\n // will output: 30:00.0, 30:00.1, 30:00.2, etc.\n //\n // * Another example: \"[ss].0\" format displays elapsed time in seconds\n // with fractional tenths of a second, allowing seconds to accumulate\n // past 59 without rolling over into minutes: 59.0, 60.0, 61.0, 62.0, etc.\n //\n // * Adding \".00\" after \"s\" tells Excel to displays the fractional part of a second\n // rounded to two decimal places (hundredths). For example, a template \"mm:ss.00\"\n // will output: 30:00.00, 30:00.01, 30:00.02, etc.\n //\n // * Adding \".000\" after \"s\" (such as \"ss.000\" or \"s.000\") displays milliseconds\n // (fractional seconds) up to three decimal places: 30:00.000, etc.\n //\n // Sidenote: The character before `00` or `000` could not only be `.` but also `,`\n // depending on the system's language settings (European regions use `,`).\n //\n // Such tokens are also used in general number formats, so they're not exclusive to dates.\n // For example, \".000\" token forces a number to display exactly three decimal places,\n // padding with zeros if necessary and rounding if there are more.\n //\n // This is the reason why \"00\" or \"000\" aren't added to `DATE_TEMPLATE_TOKENS` —\n // because they're not exclusively \"date template tokens\" but rather\n // \"numeric template tokens\" in general. Hence, they should be removed\n // at the clean-up stage, because their presence can't be a deciding factor\n // when telling if a given template corresponds to a date or not.\n //\n template = template.replace(/(\\[?[smhd]{1,2}\\]?)[\\.\\,]00?0?/g, '$1');\n\n // Replace elapsed time brackets with regular time tokens.\n //\n // Formats like `[h]:mm:ss` or `[m]:ss` explicitly represent durations (elapsed time)\n // rather than standard calendar dates, but they are parsed under the Date/Time engine\n // umbrella in Excel. The presence of `[d]` or `[h]` or `[m]` or `[s]` with square brackets\n // (or same tokens with duplicate letters like `[ss]` that conditionally add a leading zero)\n // automatically categorizes it as a Time format.\n //\n template = template.replace(/\\[([smhd]{1,2})\\]/g, '$1');\n\n // Remove any prefixes from the format template.\n //\n // There could be multiple prefixes in a date format template.\n // Example: `[Yellow][DBNum1][$-404]yyyy\"年\"m\"月\"d\"日\";@`\n // Any of those prefixes, as their name suggests, could only be present at the start.\n // They could be present in any number and in any order.\n // All those prefixes should be stripped.\n //\n // What kinds of prefixes could there be?\n //\n // * Conditional prefix — `[Condition]TrueFormat;FalseFormat` — has already been explained earlier.\n //\n // * Native number modifier — It changes standard numbers or date values into native character sets,\n // specifically lowercase Kanji, Chinese, or Korean numerals.\n //\n // Example values:\n //\n // * [DBNum1] / [NatNum1]: Displays numbers as lowercase or standard Kanji/native numerals\n // (e.g., 一, 二, 三).\n // * [DBNum2] / [NatNum2]: Displays numbers as formal/uppercase Kanji or traditional numerals\n // (e.g., 壱, 弐, 参).\n // * [DBNum3] / [NatNum3]: Displays numbers using full-width Arabic numerals.\n // * [DBNum4]: Often maps to specific local simplified or phonetic numeral representations\n // depending on the system language settings.\n //\n // * Color prefix — outputs the value in a given color.\n //\n // Example values:\n //\n // * `[ColorN]`\n // * `[Red]`\n // * `[Yellow]`\n //\n // * Locale prefix — outputs the value using according to a given locale.\n //\n // Syntax format: [$-LCID], where \"LCID\" means \"Windows Locale ID\" and is a hexademical number.\n //\n // Example values:\n //\n // * [$-0409] — English (United States)\n // * [$-0809] — English (United Kingdom)\n // * [$-0407] — German (Germany)\n // * [$-40c] — French (France)\n // * [$-ru-RU] — Russian (Russia)\n // * [$-x-sysdate] — Uses the computer's local system long date format\n //\n // Example: `[$-0407]dd-mmm-yyyy` forces the short month name to output in German.\n //\n // Such prefix could also specify an alternative calendar system using specific trailing letters:\n //\n // Example values:\n //\n // * [$-,F] — Lunar calendar\n // * [$-,G] — Indian Civil calendar\n // * [$-,M] — Persian calendar\n // * [$-,N] — Hijri (Islamic) calendar\n // * [$-,106] or [$-0106] — Arabic / Islamic calendar\n // * [$-,B1] (legacy) — Forces standard Gregorian interpretation\n // * [$-,B2] (legacy) — Forces Hijri interpretation mode\n //\n // Seeing a locale prefix in a format doesn't necessarily imply that this is a date format.\n // For example, `[$-409]#,##0.00` format could be used on a generic number to force\n // standard dot-and-comma layout that is used the US English locale.\n //\n template = template.replace(/\\[[^\\]]*\\]/g, '');\n\n // Extract any remaining alphabetic parts from what's left from the template string.\n // Example: \"mm/dd/yyyy\" → [\"mm\", \"dd\", \"yyyy\"]\n var tokens = template.split(DATE_FORMAT_TOKEN_SPLITTER_REG_EXP)\n // Filter out any empty-string tokens.\n // For example, Russian template \"d mmmm yyyy г.\" contains \"г.\" postfix after year.\n // Splitting it by the above regexp would prodce an empty-string token at the end of the template.\n // Similarly, splitting a non-existing template \"г. d mmmm yyyy\" by the regexp above\n // would produce an empty-string token at the start of the template.\n // So any instances of an empty-string token at the start or at the end should be filtered out.\n // Normally, Excel would escape any such \"г.\" strings (and even spaced) with a backslash,\n // but an `.xlsx` file could come from any other source that does not perform such escaping,\n // such as a hand-made script.\n .filter(function (_) {\n return _;\n });\n\n // Normally, if there're any date-specific tokens in the template then it is considered\n // a date format. Otherwise, it is considered a number format.\n //\n // That algorithm works if the format template parsing engine is solid and covered\n // with a gazillion of tests, because otherwise it could potentially produce \"false positive\"\n // results due to the very \"permissive\" nature of it making a decision.\n //\n // If the format parsing engine has some kind of a bug, and falsely categorizes a format\n // to represent a date when in reality it represents a number, things could go wrong\n // and the user would get weird output when some numbers are presented as if they were dates.\n //\n // In order to avoid such \"false positives\", there're two ways:\n // * Someone ports a format template parsing engine from an existing spreadsheet editor application's code.\n // * The format template parsing engine stays as is but becomes less permissive when making a decision.\n //\n // The latter approach is used, meaning that inclusion of any \"unexpected\" characters in the template\n // will stop it from being treated as a date template. What should the \"unexpected\" characters be then?\n // I'd suppose that those should be ones that're known to be used in numeric number formats:\n //\n // * 0 — Mandatory digit placeholder\n // * # — Optional digit placeholder\n // * ? — Digit placeholder that aligns decimals or fraction spaces\n // * , or . — Thousands and decimal separators. This one is not included because it could also be used in date formats.\n // * % — Percentage multiplier\n\n return tokens.length === 0\n // If no date-template-specific tokens 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 // I.e. it's better to output a \"false positive\" here rather than end up\n // accidentally interpreting numbers as dates, which users wouldn't want.\n ? false\n // If a non-date-format-specific token is found, then it might not necessarily be a date format.\n // In order to make a certain guess and avoid \"false positives\", it should treat any\n // unexpected situations as \"not a date template\" so that it doesn't accidentally\n // interpret numbers as dates, which users wouldn't want.\n : tokens.every(function (token) {\n return DATE_FORMAT_TEMPLATE_TOKENS.indexOf(token) >= 0;\n });\n }\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_FORMAT_TEMPLATE_TOKENS = [\n// Seconds.\n's',\n// Seconds (min two digits). Example: \"05\".\n'ss',\n// Minutes. Could also means months, depending on the context. Example: \"5\".\n'm',\n// Minutes (min two digits). Could also means months, depending on the context. Example: \"05\".\n'mm',\n// Hours. Example: \"1\".\n'h',\n// Hours (min two digits). Example: \"01\".\n'hh',\n// \"am\" part of \"am/pm\" or \"AM/PM\".\n'am',\n// \"pm\" part of \"am/pm\" or \"AM/PM\".\n'pm',\n// \"a\" part of \"a/p\" or \"A/P\".\n'a',\n// \"p\" part of \"a/p\" or \"A/P\".\n'p',\n// Day. Example: \"1\"\n'd',\n// Day (min two digits). Example: \"01\"\n'dd',\n// Short, three-letter abbreviation for the day of the week. Example: \"Mon\"\n'ddd',\n// Full name of the day of the week. Example: \"Monday\"\n'dddd',\n// Abbreviated weekday name. Example: \"Mon\", \"Tue\"\n'aaa',\n// Full weekday name. Example: \"Monday\", \"Tuesday\"\n'aaaa',\n// First letter of the weekday name. Example: \"M\", \"T\"\n'aaaaa',\n// Month (numeric). Could also mean minutes, depending on the context. Example: \"1\".\n'm',\n// Month (numeric, min two digits). Could also mean minutes, depending on the context. Example: \"01\".\n'mm',\n// Month (shortened month name). Example: \"Jan\".\n'mmm',\n// Month (full month name). Example: \"January\".\n'mmmm',\n// Month (first letter). Example: \"J\".\n'mmmmm',\n// Excel typically treats a single `y` the same as `yy` in custom formatting,\n// though standard practice is using `yy` or `yyyy`.\n'y',\n// Two-digit year, with a leading zero if needed. Example: \"01\".\n'yy',\n// Full year. Example: \"2001\".\n'yyyy',\n//\n// `e` or `ee` token stands for \"era year\" and represents an era-based year,\n// primarily supporting Japanese, Taiwanese, or Minguo/Buddhist calendar systems.\n// An example of an \"era year\" would be Heisei or Reiwa year numbers,\n// or Buddhist Era years which are Gregorian years plus 543.\n//\n// * `e` outputs the era year as a 4-digit (or unpadded) number.\n// For example, `2026` or `115` depending on the active regional era.\n// In standard Western/Gregorian locales, Excel often falls back to treating `e`\n// similarly to a regular year layout.\n//\n// * `ee` outputs a 2-digit padded era year. For example, `26` or `15`.\n//\n// * `eeee` — While `yyyy` is the standard token for a 4-digit year,\n// `eeee` is historically used for specialized international calendar eras\n// (like the Japanese or Taiwanese imperial eras). However, in standard\n// Western/Gregorian system locales, Excel treats `eeee` exactly like `yyyy`.\n'e', 'ee', 'eeee'];\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, dateFormatDetectionCache) {\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.id, style.numberFormat.template, dateFormatDetectionCache)) {\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, 7),\n sharedStrings = _ref2[0],\n styles = _ref2[1],\n epoch1904 = _ref2[2],\n dateFormatDetectionCache = _ref2[3],\n defaultDateFormat = _ref2[4],\n dateTemplateParser = _ref2[5],\n parseNumberCustom = _ref2[6];\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, dateFormatDetectionCache)) {\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","/**\r\n * Parses cell address into a row number and a column number.\r\n * Examples: \"A1\" → [1,1], \"B2\" → [2,2], \"AA2091\" → [2091, 27], \"R988\" → [988, 18].\r\n * @param {string} cellAddress\r\n * @returns {number[]} Returns `[rowNumber, columnNumber]`\r\n */\nexport default function parseCellAddress(cellAddress) {\n // const CELL_ADDRESS_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 // Split a cell coordinate into the letter part (left) and numeric part (right).\n // Cell coordinate example: \"AA2091\", \"R988\", \"B1\".\n var columnNumber = 0;\n var i = 0;\n while (i < cellAddress.length) {\n var charCode = cellAddress.charCodeAt(i);\n // `48` is the character code of \"0\", `57` is the character code of \"9\".\n if (charCode >= 48 && charCode <= 57) {\n var rowNumber = Number(cellAddress.slice(i));\n if (isNaN(rowNumber)) {\n invalidCellAddress(cellAddress);\n }\n return [\n // Row number (starting at `1`).\n rowNumber,\n // Column number (starting at `1`).\n columnNumber];\n }\n // Convert a letter coordinate to a digit coordinate.\n // Examples: \"A\" -> 1, \"B\" -> 2, \"Z\" -> 26, \"AA\" -> 27, etc.\n columnNumber *= 26; // Same as: CELL_ADDRESS_LETTERS.length\n columnNumber += cellAddress.charCodeAt(i) - 64; // Same as: CELL_ADDRESS_LETTERS.indexOf(cellAddress[i]) + 1\n i++;\n }\n invalidCellAddress(cellAddress);\n}\nfunction invalidCellAddress(cellAddress) {\n throw new Error(\"<c r=\\\"\".concat(cellAddress, \"\\\">\"));\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 _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 dateFormatDetectionCache = _ref.dateFormatDetectionCache,\n options = _ref.options;\n var parseCellParameters = [sharedStrings, styles, epoch1904, dateFormatDetectionCache, 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(sheet, sheets) {\n var _this;\n _classCallCheck(this, SheetNotFoundError);\n _this = _super.call(this, \"Sheet not found: \".concat(typeof sheet === 'number' ? sheet + '. Sheet count: ' + sheets.length : sheet + '. Available sheets: ' + sheets.join(', ')));\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\n // Sheet name or sheet number.\n _this.sheet = sheet;\n\n // Available sheet names.\n _this.sheets = sheets;\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/**\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 var dateFormatDetectionCache = [];\n\n // Parse sheets data.\n return readFiles(getSheetDataXmlFiles(filePaths, sheetRelationIdsToRead, {\n sharedStrings: sharedStrings,\n styles: styles,\n epoch1904: spreadsheetInfo.epoch1904,\n dateFormatDetectionCache: dateFormatDetectionCache,\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. Not used.\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 return parseSpreadsheetContents(parseXml, contents, options);\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 } else {\n if (sheet <= sheets.length) {\n return sheets[sheet - 1].relationId;\n }\n }\n throw new SheetNotFoundError(sheet, sheets.map(function (_) {\n return _.name;\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 _ref3;\n return _ref3 = {}, _defineProperty(_ref3, 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: Promise.resolve([])\n }), _defineProperty(_ref3, filePaths.styles || 'xl/styles.xml', {\n name: 'styles',\n parse: parseStyles,\n fallback: {}\n }), _ref3;\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","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 InvalidError = /*#__PURE__*/function (_Error) {\n _inherits(InvalidError, _Error);\n var _super = _createSuper(InvalidError);\n function InvalidError(reason) {\n var _this;\n _classCallCheck(this, InvalidError);\n _this = _super.call(this, 'invalid');\n _this.reason = reason;\n return _this;\n }\n return _createClass(InvalidError);\n}( /*#__PURE__*/_wrapNativeSuper(Error));\nexport { InvalidError as default };\n//# sourceMappingURL=InvalidError.js.map","import InvalidError from '../InvalidError.js';\nexport default function NumberType(value) {\n // An XLSX file editing software might not always correctly\n // detect numeric values in string-type cells. Users won't bother\n // manually selecting a cell type, so the editing software has to guess\n // based on the user's input. One can assume that such auto-detection\n // might not always work.\n //\n // So, if a cell is supposed to be a numeric one, convert a string value to a number.\n //\n if (typeof value === 'string') {\n var stringifiedValue = value;\n value = Number(value);\n if (String(value) !== stringifiedValue) {\n throw new InvalidError('not_a_number');\n }\n }\n if (typeof value !== 'number') {\n throw new InvalidError('not_a_number');\n }\n if (isNaN(value)) {\n throw new InvalidError('invalid_number');\n }\n // At this point, `value` can only be a number.\n //\n // The global `isFinite()` function filters out:\n // * NaN\n // * -Infinity\n // * Infinity\n //\n // All other values pass (including non-numbers).\n //\n if (!isFinite(value)) {\n throw new InvalidError('out_of_bounds');\n }\n return value;\n}\n//# sourceMappingURL=Number.js.map","import InvalidError from '../InvalidError.js';\nexport default function StringType(value) {\n if (typeof value === 'string') {\n return value;\n }\n // Excel tends to perform a forced automatic convertion of string-type values\n // to number-type ones when the user has input them. Otherwise, users wouldn't\n // be able to perform formula calculations on those cell values because users\n // won't bother manually choosing a \"numeric\" cell type for each cell, and\n // even if they did, choosing a \"numeric\" cell type every time wouldn't be an\n // acceptable \"user experience\".\n //\n // So, if a cell value is supposed to be a string and Excel has automatically\n // converted it to a number, perform a backwards conversion.\n //\n if (typeof value === 'number') {\n if (isNaN(value)) {\n throw new InvalidError('invalid_number');\n }\n // The global `isFinite()` function filters out:\n // * NaN\n // * -Infinity\n // * Infinity\n //\n // All other values pass (including non-numbers).\n //\n if (!isFinite(value)) {\n throw new InvalidError('out_of_bounds');\n }\n return String(value);\n }\n throw new InvalidError('not_a_string');\n}\n//# sourceMappingURL=String.js.map","import InvalidError from '../InvalidError.js';\nexport default function BooleanType(value) {\n if (typeof value === 'boolean') {\n return value;\n }\n throw new InvalidError('not_a_boolean');\n}\n//# sourceMappingURL=Boolean.js.map","import InvalidError from '../InvalidError.js';\nexport default function DateType(value) {\n // XLSX has no specific format for dates.\n // Sometimes a date can be heuristically detected.\n // https://github.com/catamphetamine/read-excel-file/issues/3#issuecomment-395770777\n if (value instanceof Date) {\n if (isNaN(value.valueOf())) {\n throw new InvalidError('out_of_bounds');\n }\n return value;\n }\n throw new InvalidError('not_a_date');\n}\n//# sourceMappingURL=Date.js.map","var objectConstructor = {}.constructor;\nexport default function isObject(object) {\n return object !== undefined && object !== null && object.constructor === objectConstructor;\n}\n\n// export default function isObject(object: unknown): object is object {\n// return object !== undefined && object !== null && object.constructor === objectConstructor\n// }\n//# sourceMappingURL=isObject.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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\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 _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _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 _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\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 _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 NumberType from './types/Number.js';\nimport StringType from './types/String.js';\nimport BooleanType from './types/Boolean.js';\nimport DateType from './types/Date.js';\nimport isObject from '../utility/isObject.js';\nimport checkpoint from '../utility/checkpoint.js';\n\n// An empty cell has `null` value.\nvar EMPTY_CELL_VALUE = null;\n\n/**\r\n * Converts spreadsheet-alike data structure into an array of JSON objects.\r\n *\r\n * Parameters:\r\n *\r\n * * `data` — An array of rows, each row being an array of cells. The first row should be the list of column headers and the rest of the rows should be the data.\r\n * * `schema` — A \"to JSON\" convertion schema (see above).\r\n * * `options` — (optional) Schema conversion parameters of `read-excel-file`:\r\n * * `propertyValueWhenColumnIsMissing` — By default, when some of the `schema` columns are missing in the input `data`, those properties are set to `undefined` in the output objects. Pass `propertyValueWhenColumnIsMissing: null` to set such \"missing column\" properties to `null` in the output objects.\r\n * * `propertyValueWhenCellIsEmpty` — By default, when it encounters a `null` value in a cell in input `data`, it sets it to `undefined` in the output object. Pass `propertyValueWhenCellIsEmpty: null` to make it set such values as `null`s in output objects.\r\n * // * `shouldSkipRequiredValidationWhenColumnIsMissing: (column: string, { object }) => boolean` — By default, it does apply `required` validation to `schema` properties for which columns are missing in the input `data`. One could pass a custom `shouldSkipRequiredValidationWhenColumnIsMissing(column, { object })` to disable `required` validation for missing columns in some or all cases.\r\n * * `transformEmptyObject(object, { path? })` — By default, it returns `null` for \"empty\" objects. One could override that value using `transformEmptyObject(object, { path })` parameter. The value applies to both top-level object and any nested sub-objects in case of a nested schema, hence the additional (optional) `path?: string` parameter.\r\n * * `transformEmptyArray(array, { path })` — By default, it returns `null` for an \"empty\" array value. One could override that value using `transformEmptyArray(array, { path })` parameter.\r\n * * `separatorCharacter` — By default, it splits array-type cell values by a comma character.\r\n *\r\n * When parsing a property value, in case of an error, the value of that property is gonna be `undefined`.\r\n *\r\n * @param {SheetData} data - An array of rows, each row being an array of cells.\r\n * @param {object} schema\r\n * @param {object} [options]\r\n * @param {any} [options.propertyValueWhenColumnIsMissing] — By default, when some of the `schema` columns are missing in the input `data`, those properties are set to `undefined` in the output objects. Pass `propertyValueWhenColumnIsMissing: null` to set such \"missing column\" properties to `null` in the output objects.\r\n * @param {any} [options.propertyValueWhenCellIsEmpty] — By default, when it encounters a `null` value in a cell in input `data`, it leaves the value as is. Pass a custom `propertyValueWhenCellIsEmpty` to make it set such values to that value.\r\n * // @param {boolean} [options.shouldSkipRequiredValidationWhenColumnIsMissing(column: string, { object })] — By default, it does apply `required` validation to `schema` properties for which columns are missing in the input `data`. One could pass a custom `shouldSkipRequiredValidationWhenColumnIsMissing(column, { object })` to disable `required` validation for missing columns in some or all cases.\r\n * @param {function} [options.transformEmptyObject(object, { path })] — By default, it returns `null` for an \"empty\" resulting object. One could override that value using `transformEmptyObject(object, { path })` parameter. The value applies to both top-level object and any nested sub-objects in case of a nested schema, hence the additional `path?: string` parameter.\r\n * @param {function} [options.transformEmptyArray(array, { path })] — By default, it returns `null` for an \"empty\" array value. One could override that value using `transformEmptyArray(array, { path })` parameter.\r\n * @param {string} [options.separatorCharacter] — When specified, string values will be split by this separator to get the array.\r\n * @return {object} — An object of shape `{ objects, errors }`. Either `objects` or `errors` is going to be `undefined`.\r\n */\nexport default function parseSheetData(data, schema, optionsCustom) {\n checkpoint('parse sheet data using schema');\n var objects = [];\n var errors = [];\n var parsedRows = parseSheetDataWithPerRowErrors(data, schema, optionsCustom);\n var parsedRowIndex = 0;\n for (var _iterator = _createForOfIteratorHelperLoose(parsedRows), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n object = _step$value.object,\n rowErrors = _step$value.errors;\n if (rowErrors) {\n errors = errors.concat(rowErrors.map(\n // Add row number property to each row error.\n function (rowError) {\n return _objectSpread(_objectSpread({}, rowError), {}, {\n row: parsedRowIndex + 1\n });\n }));\n } else {\n objects.push(object);\n }\n parsedRowIndex++;\n }\n checkpoint('end');\n if (errors.length > 0) {\n return {\n errors: errors\n };\n }\n return {\n objects: objects\n };\n}\n\n// This one is only used in tests.\nexport function parseSheetDataWithPerRowErrors(data, schema, optionsCustom) {\n validateSchema(schema);\n var options = applyDefaultOptions(optionsCustom);\n var _data = _toArray(data),\n columns = _data[0],\n dataRows = _data.slice(1);\n return dataRows.map(function (row) {\n return parseDataRow(row, schema, columns, options);\n });\n}\nfunction parseDataRow(dataRow, schema, columns, options) {\n // Create a `schemaEntry` for the top-level object.\n var schemaEntry = {\n schema: schema\n };\n\n // Parse the values in the given data row into an object.\n var _parseProperty = parseProperty(dataRow, schemaEntry, undefined, columns, options),\n value = _parseProperty.value,\n isEmptyValue = _parseProperty.isEmptyValue,\n errors = _parseProperty.errors,\n children = _parseProperty.children;\n\n // Simulate a \"dummy\" parent object for the top-level object.\n // It will be used when running `required` validations.\n var dummyParentObject = {\n // The \"dummy\" parent object has a \"dummy\" value.\n // This value is irrelevant because it won't be read anywhere.\n value: PARSED_OBJECT_TREE_START,\n // The \"dummy\" parent object is empty if the parsed row is empty.\n isEmptyValue: isEmptyValue,\n // The \"dummy\" object has the same errors as the parsed row.\n errors: errors,\n // The parsed object by default is not required to have any data\n // so the \"dummy\" object is not required.\n isRequired: undefined\n };\n\n // Run any `required` validations.\n //\n // `required` validations should be run after the entire data row has been parsed,\n // i.e. when the entire object structure has been parsed.\n // The reason is that a `required` validation could be either a simple boolean or a \"complex\" function.\n // In the latter case, the result of a `required()` function may depend on any other property of the object,\n // hence the actual `required` flag value could only be obtained after the entire data row has been parsed.\n //\n // For example, consider a top-level object:\n //\n // {\n // firstName: string,\n // lastName: string,\n // pet?: { name: string }\n // }\n //\n // A corresponding schema would be:\n //\n // {\n // firstName: {\n // required: true\n // },\n // lastName: {\n // required: true\n // },\n // pet: {\n // required: false,\n // schema: {\n // name: {\n // required: true\n // }\n // }\n // }\n // }\n //\n // I.e. when a `pet` exists, it must have a `name`.\n //\n // In such case, the `required: true` check of the `pet`'s `name` property\n // should not be performed if the `pet` is not present, because the `pet` nested object\n // is marked as `required: false`, meaning that `pet` data is not required to be present.\n //\n var requiredErrors = runPendingRequiredValidations(schemaEntry, value, isEmptyValue, errors, children,\n // Simulate a \"dummy\" parent object for the top-level object.\n dummyParentObject.isRequired, dummyParentObject.value, dummyParentObject.isEmptyValue, dummyParentObject.errors, columns);\n\n // If there were any errors, whether caused by `required`\n // or occured while parsing the values, return those errors.\n if (errors || requiredErrors) {\n return {\n errors: (errors || []).concat(requiredErrors || [])\n };\n }\n\n // Return the parsed object.\n return {\n object: transformValue(value, isEmptyValue, undefined, options)\n };\n}\nfunction parseObject(row, schema, path, columns, options) {\n var object = {};\n var isEmptyObject = true;\n var errors = [];\n var children = [];\n\n // For each property of the object.\n for (var _i = 0, _Object$keys = Object.keys(schema); _i < _Object$keys.length; _i++) {\n var key = _Object$keys[_i];\n var child = parseProperty(row, schema[key], getPropertyPath(key, path), columns, options);\n if (child.errors) {\n errors = errors.concat(child.errors);\n } else {\n object[key] = transformValue(child.value, child.isEmptyValue, getPropertyPath(key, path), options);\n // Potentially unmark the object as \"empty\".\n if (isEmptyObject && !child.isEmptyValue) {\n isEmptyObject = false;\n }\n }\n children.push(_objectSpread(_objectSpread({}, child), {}, {\n // `schemaEntry` will be used when running `required` validation of this property (later),\n schemaEntry: schema[key]\n }));\n }\n\n // If there were any errors, return them.\n if (errors.length > 0) {\n return {\n // Return the errors.\n errors: errors,\n // Return the `children` because `required` validations still have to be run (later).\n children: children\n };\n }\n return {\n value: object,\n isEmptyValue: isEmptyObject,\n // Return the `children` because `required` validations still have to be run (later).\n children: children\n };\n}\nfunction parseProperty(row, schemaEntry, path, columns, options) {\n var columnIndex = schemaEntry.column ? columns.indexOf(schemaEntry.column) : undefined;\n var isMissingColumn = schemaEntry.column ? columnIndex < 0 : undefined;\n var _ref = schemaEntry.column ? isMissingColumn ? {\n value: options.propertyValueWhenColumnIsMissing,\n isEmptyValue: true\n } : parseCellValueWithPossibleErrors(row[columnIndex], schemaEntry, columnIndex, options) : parseObject(row, schemaEntry.schema, path, columns, options),\n value = _ref.value,\n isEmptyValue = _ref.isEmptyValue,\n errors = _ref.errors,\n children = _ref.children;\n\n // If there were any errors, return them.\n if (errors) {\n return {\n // Return the errors.\n errors: errors,\n // Return the `children` because `required` validations still have to be run (later).\n children: children\n };\n }\n return {\n value: value,\n isEmptyValue: isEmptyValue,\n // Return the `children` because `required` validations still have to be run (later).\n children: children\n };\n}\nfunction parseCellValueWithPossibleErrors(cellValue, schemaEntry, columnIndex, options) {\n var _parseCellValue = parseCellValue(cellValue, schemaEntry, options),\n value = _parseCellValue.value,\n isEmptyValue = _parseCellValue.isEmptyValue,\n errorMessage = _parseCellValue.error,\n errorReason = _parseCellValue.reason;\n if (errorMessage) {\n var error = createError({\n error: errorMessage,\n reason: errorReason,\n column: schemaEntry.column,\n columnIndex: columnIndex,\n valueType: schemaEntry.type,\n value: cellValue\n });\n return {\n errors: [error]\n };\n }\n return {\n value: value,\n isEmptyValue: isEmptyValue\n };\n}\n\n/**\r\n * Converts a cell value value to a javascript typed value.\r\n * @param {any} cellValue\r\n * @param {object} schemaEntry\r\n * @param {string} propertyPath\r\n * @param {object} options\r\n * @return {{ value?: any, isEmptyValue: boolean } | { error: string, reason?: string }}\r\n */\nfunction parseCellValue(cellValue, schemaEntry, options) {\n if (cellValue === undefined) {\n // This isn't supposed to be possible when reading spreadsheet data:\n // cell values are always read as `null` when those cells are empty.\n // It's currently impossible for `read-excel-file` to return `undefined` cell value.\n // Here it uses some \"sensible default\" fallback by treating `undefined` as \"column missing\".\n return {\n value: options.propertyValueWhenColumnIsMissing,\n isEmptyValue: true\n };\n }\n if (cellValue === EMPTY_CELL_VALUE) {\n return {\n value: options.propertyValueWhenCellIsEmpty,\n isEmptyValue: true\n };\n }\n\n // Parse comma-separated cell value.\n if (Array.isArray(schemaEntry.type)) {\n return parseArrayValue(cellValue, schemaEntry, options);\n }\n return parseValue(cellValue, schemaEntry, options);\n}\n\n/**\r\n * Converts textual value to a javascript typed array value.\r\n * @param {any} value\r\n * @param {object} schemaEntry\r\n * @param {object} options\r\n * @return {{ value?: any, isEmptyValue: boolean } | { error: string, reason?: string }}\r\n */\nfunction parseArrayValue(value, schemaEntry, options) {\n // If the cell value is not a string — i.e. a number, a boolean, a Date —\n // then throw an error.\n if (typeof value !== 'string') {\n return {\n error: 'not_a_string'\n };\n }\n var isEmptyArray = true;\n var errors = [];\n var reasons = [];\n var values = parseSeparatedSubstrings(value, options.separatorCharacter).map(function (substring) {\n // If any substring was already detected to be invalid\n // don't attempt to parse any other substrings.\n if (errors.length > 0) {\n return;\n }\n\n // If an empty substring was extracted, it means that there was an out-of-place separator.\n if (!substring) {\n errors.push('invalid');\n reasons.push('syntax');\n return;\n }\n var _parseValue = parseValue(substring, schemaEntry, options),\n value = _parseValue.value,\n isEmptyValue = _parseValue.isEmptyValue,\n error = _parseValue.error,\n reason = _parseValue.reason;\n if (error) {\n errors.push(error);\n reasons.push(reason);\n return;\n }\n if (isEmptyArray && !isEmptyValue) {\n isEmptyArray = false;\n }\n return value;\n });\n if (errors.length > 0) {\n return {\n error: errors[0],\n reason: reasons[0]\n };\n }\n return {\n value: values,\n isEmptyValue: isEmptyArray\n };\n}\n\n/**\r\n * Converts textual value to a javascript typed value.\r\n * @param {any} value\r\n * @param {object} schemaEntry\r\n * @param {object} options\r\n * @return {{ value?: any, isEmptyValue: boolean } | { error: string }}\r\n */\nexport function parseValue(value, schemaEntry, options) {\n // `null` values (i.e. empty cells) don't get parsed.\n if (value === EMPTY_CELL_VALUE) {\n return {\n value: value,\n isEmptyValue: true\n };\n }\n\n // Parse the value according to the `type` that is specified in the schema entry.\n var result;\n if (schemaEntry.type) {\n result = parseValueOfType(value,\n // Get the type of the value.\n //\n // Handle the case if it's a comma-separated value.\n // Example `type`: String[]\n // Example Input Value: 'Barack Obama, \"String, with, colons\", Donald Trump'\n // Example Parsed Value: ['Barack Obama', 'String, with, colons', 'Donald Trump']\n //\n Array.isArray(schemaEntry.type) ? schemaEntry.type[0] : schemaEntry.type, options);\n } else {\n // If the `type` is not specified for a given schema entry, the `value` will be returned as is.\n result = {\n value: value\n };\n // throw new Error('Invalid schema entry: no `type` specified:\\n\\n' + JSON.stringify(schemaEntry, null, 2))\n }\n\n // If there was an error when parsing the value then return the error.\n if (result.error) {\n return result;\n }\n\n // If the parsed value is empty, return it.\n if (value === EMPTY_CELL_VALUE) {\n return {\n value: value,\n isEmptyValue: true\n };\n }\n\n // Value is not empty.\n // Validate it and return.\n\n // Perform `oneOf` validation.\n if (schemaEntry.oneOf) {\n var errorAndReason = validateOneOf(result.value, schemaEntry.oneOf);\n if (errorAndReason) {\n return errorAndReason;\n }\n }\n\n // Perform `validate()` validation.\n if (schemaEntry.validate) {\n try {\n schemaEntry.validate(result.value);\n } catch (error) {\n return {\n error: error.message\n };\n }\n }\n\n // Return the value.\n return {\n value: result.value,\n isEmptyValue: isEmptyValue(result.value)\n };\n}\nfunction validateOneOf(value, oneOf) {\n if (oneOf.indexOf(value) < 0) {\n return {\n error: 'invalid',\n reason: 'unknown'\n };\n }\n}\n\n/**\r\n * Converts cell value to a javascript typed value.\r\n * @param {(string|number|boolean|Date)} value\r\n * @param {function} type\r\n * @return {object} Either `{ value: (string|number|Date|boolean) }` or `{ error: string, reason?: string }`\r\n */\nfunction parseValueOfType(value, type) {\n switch (type) {\n case String:\n return parseValueUsingTypeParser(value, StringType);\n case Number:\n return parseValueUsingTypeParser(value, NumberType);\n case Date:\n return parseValueUsingTypeParser(value, DateType);\n case Boolean:\n return parseValueUsingTypeParser(value, BooleanType);\n default:\n // Validate `type`\n if (typeof type !== 'function') {\n throw new Error(\"Unsupported schema `type`: \".concat(type && type.name || type));\n }\n return parseValueUsingTypeParser(value, type);\n }\n}\n\n/**\r\n * Converts textual value to a custom value using supplied `type`.\r\n * @param {any} value\r\n * @param {function} type\r\n * @return {{ value: any, error: string }}\r\n */\nfunction parseValueUsingTypeParser(value, type) {\n try {\n var parsedValue = type(value);\n // Returning `undefined` from a `type` parser is treated as returning `null`.\n if (parsedValue === undefined) {\n return {\n value: EMPTY_CELL_VALUE\n };\n }\n return {\n value: parsedValue\n };\n } catch (error) {\n var result = {\n error: error.message\n };\n // Built-in types such as `Number` or `Date` may also report\n // a specific `reason` of the error.\n if (error.reason) {\n result.reason = error.reason;\n }\n return result;\n }\n}\n\n// Extracts a substring from a string.\nexport function getNextSubstring(string, separatorCharacter, startIndex) {\n var i = 0;\n var substring = '';\n while (startIndex + i < string.length) {\n var character = string[startIndex + i];\n if (character === separatorCharacter) {\n return [substring, i];\n }\n // Previously, it used to treat `\"` character similar to how it's treated in `.csv` files:\n // any commas inside quotes are ignored. But then I thought that it could introduce more\n // issues than it was originally intending to fix, and it also didn't provide an \"escape\" mechanism.\n // Overall, a decision was made to simplify the whole thing and drop the concept of quotes as special characters.\n //\n // else if (character === '\"') {\n // const quotedSubstring = getNextSubstring(string, '\"', startIndex + i + 1)\n // substring += quotedSubstring[0]\n // i += '\"'.length + quotedSubstring[1] + '\"'.length\n // }\n else {\n substring += character;\n i++;\n }\n }\n return [substring, i];\n}\n\n/**\r\n * Parses a string of comma-separated substrings into an array of substrings.\r\n * (the `export` is just for tests)\r\n * @param {string} string — A string of comma-separated substrings.\r\n * @return {string[]} An array of substrings.\r\n */\nexport function parseSeparatedSubstrings(string, separatorCharacter) {\n var elements = [];\n var index = 0;\n while (index < string.length) {\n var _getNextSubstring = getNextSubstring(string, separatorCharacter, index),\n _getNextSubstring2 = _slicedToArray(_getNextSubstring, 2),\n substring = _getNextSubstring2[0],\n length = _getNextSubstring2[1];\n index += length + separatorCharacter.length;\n elements.push(substring.trim());\n }\n return elements;\n}\nfunction transformValue(value, isEmptyValue, path, options) {\n if (isEmptyValue) {\n if (isObject(value)) {\n return options.transformEmptyObject(value, {\n path: path\n });\n } else if (Array.isArray(value)) {\n return options.transformEmptyArray(value, {\n path: path\n });\n }\n }\n return value;\n}\nfunction getPropertyPath(propertyName, parentObjectPath) {\n return \"\".concat(parentObjectPath ? parentObjectPath + '.' : '').concat(propertyName);\n}\n\n// Recursively runs `required` validations for the parsed data row tree.\nfunction runPendingRequiredValidations(schemaEntry, value, isEmptyValue, errors, children, parentObjectIsRequired, parentObjectValue, parentObjectValueIsEmpty, parentObjectErrors, columns) {\n var requiredErrors = [];\n\n // See if this property is required.\n var isRequired = isPropertyRequired(schemaEntry, parentObjectIsRequired, parentObjectValue, parentObjectValueIsEmpty, parentObjectErrors);\n\n // If this property is required and empty, create a \"required\" error.\n if (isRequired && isEmptyValue) {\n requiredErrors.push(createError({\n error: 'required',\n column: schemaEntry.column,\n columnIndex: columns.indexOf(schemaEntry.column),\n valueType: schemaEntry.type,\n value: value\n }));\n }\n\n // Run `required` validations of the children.\n if (children) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(children), _step2; !(_step2 = _iterator2()).done;) {\n var child = _step2.value;\n var requiredErrorsOfChild = runPendingRequiredValidations(child.schemaEntry, child.value, child.isEmptyValue, child.errors, child.children,\n // The following properties describe the parent object of the `child`,\n // i.e. the current (iterated) object.\n isRequired, value, isEmptyValue, errors, columns);\n if (requiredErrorsOfChild) {\n requiredErrors = requiredErrors.concat(requiredErrorsOfChild);\n }\n }\n }\n if (requiredErrors.length > 0) {\n return requiredErrors;\n }\n}\nfunction isPropertyRequired(schemaEntry, parentObjectIsRequired, parentObjectValue, parentObjectValueIsEmpty, parentObjectErrors) {\n // If the parent object is marked as `required: false` then it's allowed\n // to be absent entirely from the input data. If that's the case,\n // i.e. if the parent object is absent entirely from the input data,\n // then any descendant properties of such object are allowed to be absent too,\n // which means that they should also be considered being `required: false`.\n //\n // Also, if the parent object couldn't be parsed due to some non-`required` errors,\n // it can't be known whether it's actually empty or not. In case of such uncertainty,\n // the code shouldn't attempt to be overly smart and do things that might not be necessary,\n // so such parent object is just assumed to be empty in order to not falsly trigger\n // any `required` validations that otherwise wouldn't have been run.\n // In other words, skipping some `required` validations is better than\n // running `required` validations that shouldn't have been run.\n //\n if (parentObjectIsRequired === false && (parentObjectValueIsEmpty || parentObjectErrors)) {\n return false;\n }\n return schemaEntry.required && (typeof schemaEntry.required === 'boolean' ? schemaEntry.required :\n // If there were any non-`required` errors when parsing the parent object,\n // the `parentObject` will be `undefined`. In that case, \"complex\" `required()`\n // validations — the ones where `required` is a function — can't really be run\n // because those validations assume a fully and correctly parsed parent object\n // be passed as an argument, and the thing is that the `parentObject` is unknown.\n // As a result, only \"basic\" `required` validations could be run,\n // i.e. the ones where `required` is just a boolean, and \"complex\" `required`\n // validations, i.e. the ones where `required` is a functions, should be skipped,\n // because it's better to skip some `required` errors than to trigger falsy ones.\n parentObjectErrors ? false : schemaEntry.required(parentObjectValue));\n}\nfunction createError(_ref2) {\n var column = _ref2.column,\n columnIndex = _ref2.columnIndex,\n valueType = _ref2.valueType,\n value = _ref2.value,\n errorMessage = _ref2.error,\n reason = _ref2.reason;\n var error = {\n error: errorMessage,\n column: column,\n columnIndex: columnIndex,\n value: value\n };\n if (reason) {\n error.reason = reason;\n }\n // * Regular values specify a `type?` property, which is included in the `error` object.\n // * Nested objects specify a `schema` property, which is not included in the `error` object.\n if (valueType) {\n error.type = valueType;\n }\n return error;\n}\nfunction validateSchema(schema) {\n for (var _i2 = 0, _Object$keys2 = Object.keys(schema); _i2 < _Object$keys2.length; _i2++) {\n var key = _Object$keys2[_i2];\n var schemaEntry = schema[key];\n // Validate that the `schema` is not using a deprecated `type: nestedSchema` format.\n if (_typeof(schemaEntry.type) === 'object' && !Array.isArray(schemaEntry.type)) {\n throw new Error('When defining a nested schema, use a `schema` property instead of a `type` property');\n }\n // Validate that every property has a source `column` title specified for it.\n if (!schemaEntry.schema) {\n if (!schemaEntry.column) {\n throw new Error(\"\\\"column\\\" not defined for schema entry \\\"\".concat(key, \"\\\".\"));\n }\n }\n }\n\n // A nested object could have a `required` property but the only allowed value is `false`.\n // The reason why `true` value is not allowed is because in case of a \"required\" error\n // there's no single column title corresponding to such nested object, and column title\n // is required to create a \"required\" error.\n validateObjectSchemaRequiredProperty(schema, undefined);\n}\nfunction validateObjectSchemaRequiredProperty(schema, required) {\n if (required !== undefined && required !== false) {\n throw new Error(\"In a schema, a nested object can have a `required` property but the only allowed value is `undefined` or `false`. Otherwise, a \\\"required\\\" error for a nested object would have to include a specific `column` title and a nested object doesn't have one. You've specified the following `required`: \".concat(required));\n }\n // For each property of the described object.\n for (var _i3 = 0, _Object$keys3 = Object.keys(schema); _i3 < _Object$keys3.length; _i3++) {\n var key = _Object$keys3[_i3];\n // If this property is itself an object.\n if (isObject(schema[key].schema)) {\n // Validate that a `column` property can't coexist with a `schema` property.\n if (schema[key].column) {\n throw new Error(\"In a schema, `column` property is only allowed when describing a property value rather than a nested object. Key: \".concat(key, \". Schema:\\n\").concat(JSON.stringify(schema[key], null, 2)));\n }\n // Recurse into the child object.\n validateObjectSchemaRequiredProperty(schema[key].schema, schema[key].required);\n }\n }\n}\nfunction isEmptyValue(value) {\n return value === undefined || value === null;\n}\nvar DEFAULT_OPTIONS = {\n propertyValueWhenColumnIsMissing: undefined,\n propertyValueWhenCellIsEmpty: null,\n // shouldSkipRequiredValidationWhenColumnIsMissing: () => false,\n // `transformEmptyObject(object, { path })` applies to both the top-level object\n // and any of its nested objects.\n transformEmptyObject: function transformEmptyObject() {\n return null;\n },\n transformEmptyArray: function transformEmptyArray() {\n return null;\n },\n separatorCharacter: ','\n};\nfunction applyDefaultOptions(options) {\n if (options) {\n return _objectSpread(_objectSpread({}, DEFAULT_OPTIONS), options);\n } else {\n return DEFAULT_OPTIONS;\n }\n}\n\n// This `value` marks the start of a tree structure that is parsed from a given data row.\nvar PARSED_OBJECT_TREE_START = {};\n//# sourceMappingURL=parseSheetData.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 = [\"schema\"];\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; }\nimport parseSpreadsheetContents from '../xlsx/parseSpreadsheetContents.js';\nimport parseSheetData from '../parseSheetData/parseSheetData.js';\n\n/**\r\n * Reads data from a single sheet of an `.xlsx` file as an array of rows (which are arrays of cells) or as an array of objects (if `options.schema` was passed).\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 {string|number} [sheet] — Sheet name or number.\r\n * @param {object} [options]\r\n * @return {Promise<SheetData>}\r\n */\nexport default function parseSheet(createWorkerFunction, parseXml, contents, sheet, optionsWithSchema) {\n // `schema` has to be excluded from the `options`\n var _ref = optionsWithSchema || {},\n schema = _ref.schema,\n options = _objectWithoutProperties(_ref, _excluded);\n return parseSpreadsheetContents(createWorkerFunction, parseXml, contents, _objectSpread(_objectSpread({}, options), {}, {\n sheets: [sheet === undefined ? 1 : sheet]\n })).then(function (sheets) {\n var sheetData = sheets[0].data;\n if (schema) {\n return parseSheetData(sheetData, schema);\n }\n return sheetData;\n });\n}\n//# sourceMappingURL=parseSheet.js.map","import createWorkerFunction from 'worker-f/browser';\nimport parseXml from '../xml/parseXml.js';\nimport unpackXlsxFile from './unpackXlsxFileBrowser.js';\nimport parseSheet from './parseSheet.js';\n\n/**\r\n * Reads a single sheet from an `.xlsx` file.\r\n * @param {(Blob|ArrayBuffer)} input\r\n * @param {(number|string)} [sheet] — Sheet number or sheet name\r\n * @param {object} [options]\r\n * @return {Promise<SheetData>}\r\n */\nexport default function readSheet(input, sheet, options) {\n // `sheet` argument is optional.\n // It could be omitted while `options` argument is passed.\n if (!options && sheet && typeof sheet !== 'number' && typeof sheet !== 'string') {\n options = sheet;\n sheet = undefined;\n }\n return unpackXlsxFile(input).then(function (contents) {\n return parseSheet(createWorkerFunction, parseXml, contents, sheet, options);\n });\n}\n//# sourceMappingURL=readSheetBrowser.js.map","import readXlsxFile, { readSheet } from 'read-excel-file/browser';\nimport type {\n CellValue,\n SheetData,\n} from 'read-excel-file/browser';\nimport { parse } from 'csv/browser/esm/sync';\nimport type {\n AnyObject,\n ObjectSchema,\n} from 'yup';\nimport {\n lazy,\n object,\n string,\n} from 'yup';\nimport { t } from 'i18next';\nimport difference from 'lodash/difference';\nimport uniq from 'lodash/uniq';\nimport { format } from 'date-fns';\nimport type {\n CaseDbCaseBatchUploadResult,\n CaseDbCaseForUpload,\n CaseDbCaseType,\n CaseDbCaseUploadResult,\n CaseDbCol,\n CaseDbCompleteCaseType,\n CaseDbReadSetForUpload,\n CaseDbSeqForUpload,\n} from '@gen-epix/api-casedb';\nimport {\n CaseDbCaseApi,\n CaseDbColType,\n CaseDbEtlStatus,\n CaseDbReadsFileFormat,\n CaseDbSeqFileFormat,\n CaseDbUploadAction,\n} from '@gen-epix/api-casedb';\nimport { QueryClientService } from '@gen-epix/ui-client-common/classes/services/QueryClientService';\nimport { ValidationUtil } from '@gen-epix/ui-core/utils/ValidationUtil';\nimport { ObjectUtil } from '@gen-epix/ui-core/utils/ObjectUtil';\nimport { StringUtil } from '@gen-epix/ui-core/utils/StringUtil';\nimport type {\n AutoCompleteOption,\n FormFieldDefinition,\n OptionBase,\n} from '@gen-epix/ui-core-form/models/form';\nimport { FORM_FIELD_DEFINITION_TYPE } from '@gen-epix/ui-core-form/models/form';\nimport { DATE_FORMAT } from '@gen-epix/ui-core/constants/date';\n\nimport { CaseTypeUtil } from '../CaseTypeUtil';\nimport { CaseUtil } from '../CaseUtil';\nimport type {\n UploadCompleteColStats,\n UploadMappedColumn,\n UploadMappedColumnsFormFields,\n UploadSequenceMapping,\n UploadSequenceMappingForCaseId,\n} from '../../models/upload';\nimport { FileUtil } from '../FileUtil';\nimport { UploadError } from '../../classes/errors';\nimport { CASEDB_QUERY_KEY } from '../../constants/query';\n\nexport class UploadUtil {\n public static readonly caseDateColumnAliases = ['_case_date', 'case date', 'case_date', 'casedate', 'case.date'];\n public static readonly caseIdColumnAliases = ['_case_id', 'case id', 'case_id', 'caseid', 'case.id'];\n public static readonly colAliases = ['_case_type', 'case type', 'case_type', 'casetype', 'case.type'];\n\n public static areMappedColumnsEqual(a: UploadMappedColumn[], b: UploadMappedColumn[]): boolean {\n if (a.length !== b.length) {\n return false;\n }\n\n return a.every((itemA, index) => {\n const itemB = b[index];\n const stringifiedA = `${itemA.originalIndex}-${itemA.originalLabel}`;\n const stringifiedB = `${itemB.originalIndex}-${itemB.originalLabel}`;\n return stringifiedA === stringifiedB;\n });\n }\n\n public static async createCases(kwArgs: {\n assemblyProtocolId: string;\n casesForVerificationFromSourceData: CaseDbCaseForUpload[];\n completeCaseType: CaseDbCompleteCaseType;\n createdInDataCollectionId: string;\n mappedColumns: UploadMappedColumn[];\n sampleIdColId: string;\n selectedValidatedCases: CaseDbCaseUploadResult[];\n sequenceMapping: UploadSequenceMapping;\n sequencingProtocolId: string;\n signal: AbortSignal;\n }): Promise<CaseDbCaseBatchUploadResult> {\n const {\n assemblyProtocolId,\n casesForVerificationFromSourceData,\n completeCaseType,\n createdInDataCollectionId,\n mappedColumns,\n sampleIdColId,\n selectedValidatedCases: validatedCases,\n sequenceMapping,\n sequencingProtocolId,\n signal,\n } = kwArgs;\n\n const { col: mappedSampleIdCol, sampleIdentifierIssuerId } = mappedColumns.find(mc => mc.col?.id === sampleIdColId) ?? {};\n\n return (await CaseDbCaseApi.getInstance().uploadCases({\n case_batch: {\n cases: validatedCases.map((vc) => {\n const caseId = vc.id;\n const readSetsForUpload: CaseDbReadSetForUpload[] = [];\n const seqsForUpload: CaseDbSeqForUpload[] = [];\n const externalSampleId = mappedSampleIdCol ? CaseUtil.getRowValue(\n vc.validated_content,\n mappedSampleIdCol,\n completeCaseType,\n )?.raw : null;\n const caseFromSourceData = casesForVerificationFromSourceData.find(c => c.id === vc.id);\n\n if (externalSampleId) {\n if (sequenceMapping[vc.id]?.sequenceFileNames) {\n Object.entries(sequenceMapping[vc.id].sequenceFileNames).forEach(([colId, fileName]) => {\n if (fileName) {\n seqsForUpload.push({\n case_id: caseId ?? undefined,\n col_id: colId,\n other_sample_identifier: {\n external_id: externalSampleId,\n identifier_issuer_id: sampleIdentifierIssuerId,\n },\n protocol_id: assemblyProtocolId,\n } satisfies CaseDbSeqForUpload);\n }\n });\n }\n if (sequenceMapping[vc.id]?.readsFileNames) {\n Object.entries(sequenceMapping[vc.id].readsFileNames).forEach(([colId, fileNames]) => {\n if (fileNames.fwd || fileNames.rev) {\n readSetsForUpload.push({\n case_id: caseId ?? undefined,\n col_id: colId,\n other_sample_identifier: {\n external_id: externalSampleId,\n identifier_issuer_id: sampleIdentifierIssuerId,\n },\n protocol_id: sequencingProtocolId,\n } satisfies CaseDbReadSetForUpload);\n }\n });\n }\n }\n\n return ObjectUtil.deepNullifyEmptyStrings<CaseDbCaseForUpload>({\n case: {\n case_type_id: completeCaseType.id,\n content: vc.validated_content,\n created_in_data_collection_id: caseFromSourceData?.case?.created_in_data_collection_id ?? createdInDataCollectionId,\n id: caseId ?? undefined,\n },\n read_sets: readSetsForUpload,\n seqs: seqsForUpload,\n });\n }),\n },\n case_type_id: completeCaseType.id,\n default_created_in_data_collection_id: createdInDataCollectionId ?? undefined,\n on_exists: CaseDbUploadAction.UPDATE,\n }, { signal })).data;\n }\n\n public static async createCasesAndUploadFiles(kwArgs: {\n assemblyProtocolId: string;\n casesForVerificationFromSourceData: CaseDbCaseForUpload[];\n completeCaseType: CaseDbCompleteCaseType;\n createdInDataCollectionId: string;\n mappedColumns: UploadMappedColumn[];\n onComplete: () => void;\n onError: (error: Error) => void;\n onProgress: (progress: number, message: string) => void;\n sampleIdColId: string;\n selectedValidatedCases: CaseDbCaseUploadResult[];\n sequenceFilesDataTransfer: DataTransfer;\n sequenceMapping: UploadSequenceMapping;\n sequencingProtocolId: string;\n signal: AbortSignal;\n }): Promise<CaseDbCaseBatchUploadResult> {\n const {\n onComplete,\n onError,\n onProgress,\n } = kwArgs;\n\n try {\n onProgress(0, t('Creating cases...'));\n const caseBatchUploadResult = await UploadUtil.createCases(kwArgs);\n\n if (caseBatchUploadResult.status === CaseDbEtlStatus.FAILED) {\n throw new UploadError(t('Failed to create cases during upload.'), caseBatchUploadResult);\n }\n\n await UploadUtil.uploadFilesForCases({ ...kwArgs, caseBatchUploadResult, endPercentage: 99, startPercentage: 1 });\n onProgress(100, t('Upload complete.'));\n\n await QueryClientService.getInstance().invalidateQueryKeys(QueryClientService.getInstance().getQueryKeyDependencies([CASEDB_QUERY_KEY.CASES], true));\n onComplete();\n return caseBatchUploadResult;\n } catch (error) {\n onError(error instanceof Error ? error : new Error('Unknown error occurred during upload'));\n throw error;\n }\n }\n\n public static getCasesForUpload(kwArgs: { caseTypeId: string; createdInDataCollectionId: string; mappedColumns: UploadMappedColumn[]; rawData: string[][] }): CaseDbCaseForUpload[] {\n const { caseTypeId, createdInDataCollectionId, mappedColumns, rawData } = kwArgs;\n return rawData.slice(1).map((rawDataRow) => {\n const rawDataCaseIdColumnIndex = mappedColumns.find((mappedColumn) => mappedColumn.isCaseIdColumn)?.originalIndex;\n const content: { [key: string]: string } = {};\n\n mappedColumns.forEach((mappedColumn) => {\n if (mappedColumn.col) {\n content[mappedColumn.col.id] = rawDataRow[mappedColumn.originalIndex];\n }\n });\n let id: string;\n if (!isNaN(rawDataCaseIdColumnIndex) && rawDataRow[rawDataCaseIdColumnIndex]) {\n id = rawDataRow[rawDataCaseIdColumnIndex];\n } else {\n id = StringUtil.createUuid();\n }\n\n const caseForCreateUpdate: CaseDbCaseForUpload = {\n case: {\n case_type_id: caseTypeId,\n content: ObjectUtil.deepNullifyEmptyStrings(content),\n created_in_data_collection_id: createdInDataCollectionId,\n },\n id,\n };\n\n return { ...caseForCreateUpdate, content };\n });\n }\n\n public static getCaseTypeFromColumnLabels(cols: CaseDbCol[], columnLabels: string[]): CaseDbCaseType {\n const bestMatch = {\n caseType: null as CaseDbCaseType,\n matchCount: 0,\n };\n\n // Group columns by case type ID to count matches per case type\n const caseTypeMatches = new Map<string, { caseType: CaseDbCaseType; matchCount: number }>();\n\n cols.forEach(col => {\n const matchCount = columnLabels.filter(label =>\n this.matchColumnLabel(label, col)).length;\n\n if (matchCount > 0) {\n const caseTypeId = col.case_type_id;\n const existing = caseTypeMatches.get(caseTypeId);\n\n if (existing) {\n existing.matchCount += matchCount;\n } else {\n // Note: We don't have access to the full CaseType object here,\n // so we create a minimal one with the ID. In a real implementation,\n // you might need to pass the complete case type data or modify the method signature.\n caseTypeMatches.set(caseTypeId, {\n caseType: { id: caseTypeId } as CaseDbCaseType,\n matchCount,\n });\n }\n }\n });\n\n // Find the case type with the highest match count\n caseTypeMatches.forEach(match => {\n if (match.matchCount > bestMatch.matchCount) {\n bestMatch.caseType = match.caseType;\n bestMatch.matchCount = match.matchCount;\n }\n });\n\n return bestMatch.caseType;\n }\n\n public static getColumnMappingFormFieldDefinitions(completeCaseType: CaseDbCompleteCaseType, rawDataHeaders: string[], _fileName: string): FormFieldDefinition<UploadMappedColumnsFormFields>[] {\n const fields: FormFieldDefinition<UploadMappedColumnsFormFields>[] = [];\n const options: AutoCompleteOption<string>[] = [];\n\n options.push({\n label: 'Case ID',\n value: 'case_id',\n });\n\n const allowedColIds = CaseTypeUtil.getWritableImportExportColIds(completeCaseType);\n completeCaseType.ordered_col_ids.filter(x => allowedColIds.includes(x)).forEach((colId) => {\n const col = completeCaseType.cols[colId];\n\n options.push({\n label: col.label,\n value: col.id,\n });\n });\n\n rawDataHeaders.forEach((header, index) => {\n fields.push({\n definition: FORM_FIELD_DEFINITION_TYPE.SELECT,\n label: header,\n name: index.toString(),\n options,\n });\n });\n\n return fields;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n public static getColumnMappingSchema(rawData: string[][], completeCaseType: CaseDbCompleteCaseType): ObjectSchema<{}, AnyObject, {}, ''> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const fields: { [key: string]: any } = {};\n const fieldNames: string[] = rawData[0].map((_, index) => index.toString());\n const sampleIdColIds = UploadUtil.getSampleIdColIds(completeCaseType);\n\n sampleIdColIds.forEach((colId) => {\n fields[colId] = lazy(() => string().nullable().when(fieldNames, (otherFieldValues, schema) => {\n return schema.test('needs-identifier-issuer', t('An identifier issuer must be selected.'), (fieldValue) => {\n const allFieldValues = [...otherFieldValues as string[], fieldValue];\n if (allFieldValues.includes(colId)) {\n return !!fieldValue;\n }\n return true;\n });\n }));\n });\n\n fieldNames.forEach((fieldName, fieldIndex) => {\n const otherFieldNames = fieldNames.filter(name => name !== fieldName);\n fields[fieldName] = lazy(() => string().nullable().when(otherFieldNames, (otherFieldValues, schema) => {\n return schema\n .test('unique', t('This column has already been mapped to another field.'), (fieldValue) => {\n return !fieldValue || !otherFieldValues.includes(fieldValue);\n })\n .test('valid-case-id-values', t('The column mapped to the case id field must contain valid UUID\\'s.'), (fieldValue) => {\n if (fieldValue !== 'case_id') {\n return true;\n }\n const values = rawData.slice(1).map(row => row[fieldIndex]);\n return values.every(value => !value || ValidationUtil.validate('UUID4', value));\n });\n }));\n });\n\n return object().shape(fields);\n }\n\n\n public static getCompleteCaseTypeColStats(completeCaseType: CaseDbCompleteCaseType): UploadCompleteColStats {\n const sampleIdColumns = CaseTypeUtil.getColsByType(completeCaseType, [CaseDbColType.ID_SAMPLE]);\n const sequenceColumns = CaseTypeUtil.getColsByType(completeCaseType, [CaseDbColType.GENETIC_SEQUENCE]);\n const readsColumns = CaseTypeUtil.getColsByType(completeCaseType, [CaseDbColType.GENETIC_READS]);\n const writableColumns = Object.values(completeCaseType.cols).filter(col => CaseTypeUtil.getWritableColIds(completeCaseType).includes(col.id));\n\n return { readsColumns, sampleIdColumns, sequenceColumns, writableColumns };\n }\n\n public static getDefaultColumnMappingFormValues(rawDataHeaders: string[], mappedColumns: UploadMappedColumn[], identifierIssuerOptions: OptionBase<string>[]): UploadMappedColumnsFormFields {\n const defaultFormValues: UploadMappedColumnsFormFields = Object.fromEntries(Object.keys(rawDataHeaders).map<[string, null]>(x => [x.toString(), null]));\n const caseIdColumn = mappedColumns.find(mappedColumn => mappedColumn.isCaseIdColumn);\n\n if (caseIdColumn) {\n defaultFormValues[caseIdColumn.originalIndex.toString()] = 'case_id';\n }\n\n mappedColumns.forEach((mappedColumn) => {\n if (mappedColumn.col) {\n defaultFormValues[mappedColumn.originalIndex.toString()] = mappedColumn.col.id;\n if (mappedColumn.isSampleIdColumn) {\n defaultFormValues[mappedColumn.col.id] = mappedColumn.sampleIdentifierIssuerId || identifierIssuerOptions.length === 1 ? identifierIssuerOptions[0].value : null;\n }\n }\n });\n return defaultFormValues;\n }\n\n public static getEpiUploadSequenceMapping(completeCaseType: CaseDbCompleteCaseType, validatedCases: CaseDbCaseUploadResult[], sequenceFilesDataTransfer: DataTransfer): UploadSequenceMapping {\n if (!sequenceFilesDataTransfer || sequenceFilesDataTransfer.files.length === 0) {\n return {};\n }\n\n const stats = UploadUtil.getCompleteCaseTypeColStats(completeCaseType);\n const result: UploadSequenceMapping = {};\n\n (JSON.parse(JSON.stringify(validatedCases)) as CaseDbCaseUploadResult[]).forEach((vc) => {\n const caseSequenceMapping: UploadSequenceMappingForCaseId = {\n readsFileNames: {},\n sequenceFileNames: {},\n };\n\n // modify by reference\n result[vc.id] = caseSequenceMapping;\n\n if (stats.sequenceColumns.length !== 1 && stats.readsColumns.length !== 1) {\n return;\n }\n\n const sampleIdColumnIds: string[] = [];\n stats.sampleIdColumns.forEach((idCol) => {\n const rowValue = CaseUtil.getRowValue(vc.validated_content, idCol, completeCaseType);\n if (rowValue && !rowValue.isMissing) {\n sampleIdColumnIds.push(rowValue.raw);\n }\n });\n if (!sampleIdColumnIds.length) {\n return;\n }\n\n stats.sequenceColumns.forEach((seqCol) => {\n caseSequenceMapping.sequenceFileNames[seqCol.id] = '';\n });\n stats.readsColumns.forEach((readCol) => {\n caseSequenceMapping.readsFileNames[readCol.id] = {\n fwd: '',\n rev: '',\n };\n });\n\n const sequenceFiles: string[] = [];\n const readsFiles: string[] = [];\n Array.from(sequenceFilesDataTransfer.files).forEach((file) => {\n const fileName = file.name;\n const lowerName = fileName.toLowerCase();\n const matchesId = sampleIdColumnIds.some((id) => lowerName.match(UploadUtil.idToRegex(id.toLowerCase())));\n if (matchesId) {\n if (UploadUtil.isGenomeFile(fileName)) {\n sequenceFiles.push(fileName);\n } else if (UploadUtil.isReadsFile(fileName)) {\n readsFiles.push(fileName);\n }\n }\n });\n\n if (stats.sequenceColumns.length === 1 && sequenceFiles.length === 1) {\n caseSequenceMapping.sequenceFileNames[stats.sequenceColumns[0].id] = sequenceFiles[0];\n }\n if (stats.readsColumns.length === 1) {\n if (readsFiles.length === 1) {\n caseSequenceMapping.readsFileNames[stats.readsColumns[0].id].fwd = readsFiles[0];\n }\n if (readsFiles.length === 2) {\n const sortedReadsFiles = readsFiles.sort((a, b) => a.localeCompare(b));\n caseSequenceMapping.readsFileNames[stats.readsColumns[0].id].fwd = sortedReadsFiles[0];\n caseSequenceMapping.readsFileNames[stats.readsColumns[0].id].rev = sortedReadsFiles[1];\n }\n }\n });\n return result;\n }\n\n public static getInitialMappedColumns(completeCaseType: CaseDbCompleteCaseType, rawData: string[][]): UploadMappedColumn[] {\n if (rawData.length === 0) {\n return [];\n }\n const writableColIds = CaseTypeUtil.getWritableColIds(completeCaseType);\n const filteredCols = CaseTypeUtil.getWritableImportExportColIds(completeCaseType).map(id => completeCaseType.cols[id]);\n const sampleIdColIds = UploadUtil.getSampleIdColIds(completeCaseType);\n const mappedColumns = rawData[0].map((label, index) => {\n const isCaseIdColumn = UploadUtil.isCaseIdColumn(label);\n const isCol = UploadUtil.isCol(label);\n\n let col: CaseDbCol = null;\n let isSampleIdColumn = false;\n\n if (!isCaseIdColumn && !isCol) {\n col = filteredCols.find(c => UploadUtil.matchColumnLabel(label, c)) || null;\n if (col && !writableColIds.includes(col.id)) {\n col = null;\n }\n isSampleIdColumn = col ? sampleIdColIds.includes(col.id) : false;\n }\n\n return {\n col,\n isCaseIdColumn,\n isCol,\n isSampleIdColumn,\n originalIndex: index,\n originalLabel: label,\n sampleIdentifierIssuerId: null as string,\n } satisfies UploadMappedColumn;\n });\n\n return mappedColumns.filter(mc => {\n return mc.isCaseIdColumn || mc.col;\n });\n }\n\n public static getMappedColumnsFromFormData(data: UploadMappedColumnsFormFields, rawData: string[][], colMap: Map<string, CaseDbCol>, completeCaseType: CaseDbCompleteCaseType): UploadMappedColumn[] {\n const mappedColumns: UploadMappedColumn[] = [];\n const sampleIdColIds = UploadUtil.getSampleIdColIds(completeCaseType);\n Object.entries(data).forEach(([originalIndexString, formValue]) => {\n if (!formValue) {\n return;\n }\n const originalIndex = parseInt(originalIndexString, 10);\n const isCaseIdColumn = formValue === 'case_id';\n let col: CaseDbCol = null;\n if (!isCaseIdColumn) {\n col = colMap.get(formValue) || null;\n }\n let sampleIdentifierIssuerId: string = null;\n const isSampleIdColumn = col ? sampleIdColIds.includes(col.id) : false;\n if (isSampleIdColumn) {\n sampleIdentifierIssuerId = data[formValue] || null;\n }\n mappedColumns.push({\n col,\n isCaseIdColumn,\n isSampleIdColumn,\n originalIndex,\n originalLabel: rawData[0][originalIndex] || '',\n sampleIdentifierIssuerId,\n } satisfies UploadMappedColumn);\n });\n return mappedColumns;\n }\n\n public static getSampleIdColIds(completeCaseType: CaseDbCompleteCaseType): string[] {\n const colsIds: string[] = [];\n Object.values(Object.keys(completeCaseType.cols)).forEach(colId => {\n const col = completeCaseType.cols[colId];\n const refCol = completeCaseType.ref_cols[col.ref_col_id];\n if (refCol?.col_type === CaseDbColType.ID_SAMPLE) {\n colsIds.push(col.id);\n }\n });\n return colsIds;\n }\n\n public static getSequenceMappingStats(sequenceMapping: UploadSequenceMapping, sequenceFilesDataTransfer: DataTransfer): {\n mappedFiles: string[];\n mappedReadsFiles: string[];\n mappedSequenceFiles: string[];\n numberOfFilesToMap: number;\n unmappedFileNames: string[];\n unmappedReadsFiles: string[];\n unmappedSequenceFiles: string[];\n } {\n const sequenceFiles = Array.from(sequenceFilesDataTransfer.files).map(file => file.name).filter(fileName => UploadUtil.isGenomeFile(fileName));\n const readsFiles = Array.from(sequenceFilesDataTransfer.files).map(file => file.name).filter(fileName => UploadUtil.isReadsFile(fileName));\n const files = [...sequenceFiles, ...readsFiles];\n const numberOfFilesToMap = files.length;\n\n const mappedSequenceFiles = uniq(Object.values(sequenceMapping).flatMap(mapping => Object.values(mapping.sequenceFileNames)).filter(x => x));\n const mappedReadsFiles = uniq(Object.values(sequenceMapping).flatMap(mapping => Object.values(mapping.readsFileNames).flatMap(reads => [reads.fwd, reads.rev])).filter(x => x));\n const mappedFiles = [...mappedSequenceFiles, ...mappedReadsFiles];\n\n const unmappedSequenceFiles = difference(sequenceFiles, mappedSequenceFiles);\n const unmappedReadsFiles = difference(readsFiles, mappedReadsFiles);\n const unmappedFileNames = difference(files, mappedFiles);\n\n return {\n mappedFiles,\n mappedReadsFiles,\n mappedSequenceFiles,\n numberOfFilesToMap,\n unmappedFileNames,\n unmappedReadsFiles,\n unmappedSequenceFiles,\n };\n }\n\n public static async getSheetNameOptions(fileList: FileList): Promise<AutoCompleteOption<string>[]> {\n const file = fileList[0];\n const fileName = file.name.toLowerCase();\n\n if (UploadUtil.isXlsxFile(fileName)) {\n return (await readXlsxFile(file, { trim: true })).map(({ sheet: sheetName }) => ({\n label: sheetName,\n value: sheetName,\n }));\n }\n return [];\n }\n\n public static hasReadsColumnMapped(mappedColumns: UploadMappedColumn[], completeCaseTypeColStats: UploadCompleteColStats): boolean {\n return mappedColumns.some((mappedColumn) => {\n return completeCaseTypeColStats.readsColumns.some(readCol => mappedColumn.col?.id === readCol.id);\n });\n }\n\n public static hasSequenceColumnMapped(mappedColumns: UploadMappedColumn[], completeCaseTypeColStats: UploadCompleteColStats): boolean {\n return mappedColumns.some((mappedColumn) => {\n return completeCaseTypeColStats.sequenceColumns.some(seqCol => mappedColumn.col?.id === seqCol.id);\n });\n }\n\n public static isCaseDateColumn(label: string): boolean {\n return this.caseDateColumnAliases.includes(label.toLocaleLowerCase());\n }\n\n public static isCaseIdColumn(label: string): boolean {\n return this.caseIdColumnAliases.includes(label.toLocaleLowerCase());\n }\n\n public static isCol(label: string): boolean {\n return this.colAliases.includes(label.toLocaleLowerCase());\n }\n\n public static isGenomeFile(fileName: string): boolean {\n const lowerName = fileName.toLowerCase();\n return lowerName.endsWith('.fa') ||\n lowerName.endsWith('.fasta') ||\n lowerName.endsWith('.fa.gz') ||\n lowerName.endsWith('.fasta.gz');\n }\n\n public static isReadsFile(fileName: string): boolean {\n const lowerName = fileName.toLowerCase();\n return lowerName.endsWith('.fq') ||\n lowerName.endsWith('.fastq') ||\n lowerName.endsWith('.fq.gz') ||\n lowerName.endsWith('.fastq.gz');\n }\n\n public static isSupportedGeneticFile(fileName: string): boolean {\n return UploadUtil.isGenomeFile(fileName) || UploadUtil.isReadsFile(fileName);\n }\n\n\n public static isTextFile(fileName: string): boolean {\n const lowerName = fileName?.toLowerCase();\n return lowerName?.endsWith('.csv') || lowerName?.endsWith('.tsv') || lowerName?.endsWith('.txt');\n }\n\n public static isXlsxFile(fileName: string): boolean {\n return fileName?.toLowerCase()?.endsWith('.xlsx');\n }\n\n public static matchColumnLabel(columnLabel: string, col: CaseDbCol): boolean {\n if (!columnLabel || typeof columnLabel !== 'string') {\n return false;\n }\n const labelLowerCase = columnLabel.toLocaleLowerCase();\n return labelLowerCase === col.label.toLocaleLowerCase() || labelLowerCase === col.code.toLowerCase() || labelLowerCase === col.id.toLocaleLowerCase();\n }\n\n public static async readFileAsBase64(file: File): Promise<string> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n const result = reader.result as string;\n const base64 = result.split(',')[1]; // Remove data:*/*;base64, prefix\n resolve(base64);\n };\n reader.onerror = (_) => {\n reject(Error('File read error'));\n };\n reader.readAsDataURL(file);\n });\n }\n\n public static async readRawData(fileList: FileList, sheet?: string): Promise<string[][]> {\n const file = fileList[0];\n const fileName = file.name.toLowerCase();\n let result: string[][];\n\n if (UploadUtil.isTextFile(fileName)) {\n // Parse CSV file\n let text = await file.text();\n if (fileName.endsWith('.tsv')) {\n // Convert TSV to CSV by replacing tabs with commas\n text = text.replace(/\\t/g, ',');\n }\n if (fileName.endsWith('.txt')) {\n // Attempt to auto-detect delimiter (comma, tab, semicolon)\n const lines = text.split(/\\r?\\n/).filter(line => line.trim() !== '');\n if (lines.length > 0) {\n const delimiters = [',', '\\t', ';'];\n let bestDelimiter = ',';\n let maxFields = 0;\n delimiters.forEach(delimiter => {\n const fieldsCount = lines[0].split(delimiter).length;\n if (fieldsCount > maxFields) {\n maxFields = fieldsCount;\n bestDelimiter = delimiter;\n }\n });\n if (bestDelimiter !== ',') {\n const regex = new RegExp(bestDelimiter.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'), 'g');\n text = text.replace(regex, ',');\n }\n }\n }\n result = parse(text, {\n columns: false, // Keep as array of arrays\n skip_empty_lines: true,\n trim: true,\n });\n } else if (UploadUtil.isXlsxFile(fileName)) {\n // Parse Excel file\n const excelData = sheet\n ? await readSheet(file, sheet, { trim: true })\n : await readSheet(file, { trim: true });\n result = UploadUtil.mapExcelSheetData(excelData);\n } else {\n throw new Error('Unsupported file format. Please select a CSV or Excel file.');\n }\n if (result.length < 2 || result[0].length < 2) {\n throw new Error('The selected file does not contain enough data. Please ensure it has at least a header row and one data row.');\n }\n return result;\n }\n\n public static reportFileUploadProgress(kwArgs: {\n endPercentage: number;\n fileSize: number;\n message: string;\n onProgress: (progress: number, message: string) => void;\n startPercentage: number;\n totalFileSizeToUpload: number;\n uploadedFileSize: number;\n }): void {\n const {\n endPercentage,\n fileSize,\n message,\n onProgress,\n startPercentage,\n totalFileSizeToUpload,\n uploadedFileSize,\n } = kwArgs;\n\n const percentageRange = endPercentage - startPercentage;\n const percentageRangePerByte = percentageRange / totalFileSizeToUpload;\n const overallProgress = startPercentage + (uploadedFileSize * percentageRangePerByte) + (fileSize * percentageRangePerByte);\n\n onProgress(overallProgress, message);\n }\n\n public static async uploadFilesForCases(kwArgs: {\n assemblyProtocolId: string;\n caseBatchUploadResult: CaseDbCaseBatchUploadResult;\n completeCaseType: CaseDbCompleteCaseType;\n createdInDataCollectionId: string;\n endPercentage: number;\n mappedColumns: UploadMappedColumn[];\n onComplete: () => void;\n onError: (error: Error) => void;\n onProgress: (progress: number, message: string) => void;\n sampleIdColId: string;\n selectedValidatedCases: CaseDbCaseUploadResult[];\n sequenceFilesDataTransfer: DataTransfer;\n sequenceMapping: UploadSequenceMapping;\n sequencingProtocolId: string;\n signal: AbortSignal;\n startPercentage: number;\n }): Promise<void> {\n const {\n caseBatchUploadResult,\n endPercentage,\n onProgress,\n sequenceFilesDataTransfer,\n sequenceMapping,\n signal,\n startPercentage,\n } = kwArgs;\n\n const seqsToBeUploaded: Array<{ caseId: string; colId: string; fileName: string }> = [];\n const readSetsToBeUploaded: Array<{ caseId: string; colId: string; fileName: string; is_fwd: boolean }> = [];\n let totalFileSizeToUpload = 0;\n\n for (const [index, caseUploadResult] of caseBatchUploadResult.cases.entries()) {\n const { id } = kwArgs.selectedValidatedCases[index];\n if (sequenceMapping[id]) {\n const caseId = caseUploadResult.id;\n for (const [colId, fileName] of Object.entries(sequenceMapping[id].sequenceFileNames)) {\n if (fileName) {\n const file = Array.from(sequenceFilesDataTransfer.files).find(f => f.name === fileName);\n if (file) {\n seqsToBeUploaded.push({ caseId, colId, fileName });\n totalFileSizeToUpload = totalFileSizeToUpload + (file?.size || 0);\n }\n }\n }\n for (const [colId, fileNames] of Object.entries(sequenceMapping[id].readsFileNames)) {\n if (fileNames.fwd) {\n const file = Array.from(sequenceFilesDataTransfer.files).find(f => f.name === fileNames.fwd);\n if (file) {\n readSetsToBeUploaded.push({ caseId, colId, fileName: fileNames.fwd, is_fwd: true });\n totalFileSizeToUpload = totalFileSizeToUpload + (file?.size || 0);\n }\n }\n if (fileNames.rev) {\n const file = Array.from(sequenceFilesDataTransfer.files).find(f => f.name === fileNames.rev);\n if (file) {\n readSetsToBeUploaded.push({ caseId, colId, fileName: fileNames.rev, is_fwd: false });\n totalFileSizeToUpload = totalFileSizeToUpload + (file?.size || 0);\n }\n }\n }\n }\n }\n\n // upload in order of cases\n let uploadedFileSize = 0;\n for (const caseUploadResult of caseBatchUploadResult.cases) {\n const caseSeqToBeUploaded = seqsToBeUploaded.find(s => s.caseId === caseUploadResult.id);\n const caseReadSetsToBeUploaded = readSetsToBeUploaded.filter(rs => rs.caseId === caseUploadResult.id);\n\n if (caseSeqToBeUploaded) {\n const file = Array.from(sequenceFilesDataTransfer.files).find(f => f.name === caseSeqToBeUploaded.fileName);\n if (file) {\n const fileSize = file.size;\n const base64Data = await UploadUtil.readFileAsBase64(file);\n await CaseDbCaseApi.getInstance().createFileForSeq(caseSeqToBeUploaded.caseId, caseSeqToBeUploaded.colId, {\n file_compression: FileUtil.getFileCompressionFromFileName(caseSeqToBeUploaded.fileName),\n file_content: base64Data,\n file_format: CaseDbSeqFileFormat.FASTA,\n }, { signal });\n UploadUtil.reportFileUploadProgress({\n endPercentage,\n fileSize,\n message: t('Uploading sequence file \"{{fileName}}\" for case ID \"{{caseId}}\"...', { caseId: caseSeqToBeUploaded.caseId, fileName: caseSeqToBeUploaded.fileName }),\n onProgress,\n startPercentage,\n totalFileSizeToUpload,\n uploadedFileSize,\n });\n uploadedFileSize += fileSize;\n }\n }\n for (const caseReadSetToBeUploaded of caseReadSetsToBeUploaded) {\n const file = Array.from(sequenceFilesDataTransfer.files).find(f => f.name === caseReadSetToBeUploaded.fileName);\n if (file) {\n const fileSize = file.size;\n const base64Data = await UploadUtil.readFileAsBase64(file);\n await CaseDbCaseApi.getInstance().createFileForReadSet(caseReadSetToBeUploaded.caseId, caseReadSetToBeUploaded.colId, {\n file_compression: FileUtil.getFileCompressionFromFileName(caseReadSetToBeUploaded.fileName),\n file_content: base64Data,\n file_format: CaseDbReadsFileFormat.FASTQ,\n is_fwd: caseReadSetToBeUploaded.is_fwd,\n }, { signal });\n UploadUtil.reportFileUploadProgress({\n endPercentage,\n fileSize,\n message: t('Uploading read set file \"{{fileName}}\" for case ID \"{{caseId}}\"...', { caseId: caseReadSetToBeUploaded.caseId, fileName: caseReadSetToBeUploaded.fileName }),\n onProgress,\n startPercentage,\n totalFileSizeToUpload,\n uploadedFileSize,\n });\n uploadedFileSize += fileSize;\n }\n }\n }\n }\n\n private static idToRegex(id: string): RegExp {\n // Create regex that matches the id somewhere in a string\n return new RegExp(id.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'));\n }\n\n private static mapExcelCellToString(cell: CellValue | null): string {\n if (cell instanceof Date) {\n return format(cell, DATE_FORMAT.DATE);\n }\n if (cell === null || cell === undefined) {\n return '';\n }\n return cell.toString();\n }\n\n private static mapExcelSheetData(sheetData: SheetData): string[][] {\n return sheetData.map(row => row.map(cell => UploadUtil.mapExcelCellToString(cell)));\n }\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41],"mappings":";;;;;;;;;;;;;;;;;;AAMA,IAAM,IAAmC;AAoBzC,SAAwB,EAA4B,GAAiB;CACjE,IAAM,IAAY,CAAC,GACb,IAAY,CAAC,GACb,IAAa,EAAgB,GAC7B,IAA0B,EAAgB,SAAS,GACnD,IAAkB,EAAwB,MAAM,EAAwB,QAAQ,GAAG,IAAI,GAAG,EAAwB,YAAY,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAI,MAAK,EAAE,KAAK,CAAC;CAMtK,KAAK,IAAM,KAAQ,GACf,IAAI,CAAC,EAAiC,KAAK,CAAI,GAC3C,MAAU,MAAM,4BAA4B,GAAM;CAG1D,IAAI,IAAI;CACR,OAAO,IAAI,EAAW,SAAQ;EAC1B,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A;MACA,SAAS,EAAE,0EAAsE;OAAE,QAAQ,EAAoB;OAAQ,UAAU,EAAoB;MAAS,CAAC;MAC/J;MACA;MACA;MACA;KACF,CAAC,GACD,KAAoB;IACtB;GACF;GACA,KAAK,IAAM,KAA2B,GAA0B;IAC9D,IAAM,IAAO,MAAM,KAAK,EAA0B,KAAK,CAAC,CAAC,MAAK,MAAK,EAAE,SAAS,EAAwB,QAAQ;IAC9G,IAAI,GAAM;KACR,IAAM,IAAW,EAAK,MAChB,IAAa,MAAM,EAAW,iBAAiB,CAAI;KAgBzD,AAfA,MAAM,EAAc,YAAY,CAAC,CAAC,qBAAqB,EAAwB,QAAQ,EAAwB,OAAO;MACpH,kBAAkB,EAAS,+BAA+B,EAAwB,QAAQ;MAC1F,cAAc;MACd,aAAa,EAAsB;MACnC,QAAQ,EAAwB;KAClC,GAAG,EAAE,UAAO,CAAC,GACb,EAAW,yBAAyB;MAClC;MACA;MACA,SAAS,EAAE,0EAAsE;OAAE,QAAQ,EAAwB;OAAQ,UAAU,EAAwB;MAAS,CAAC;MACvK;MACA;MACA;MACA;KACF,CAAC,GACD,KAAoB;IACtB;GACF;EACF;CACF;CAEA,OAAe,UAAU,GAAoB;EAE3C,OAAO,IAAI,OAAO,EAAG,QAAQ,yBAAyB,MAAM,CAAC;CAC/D;CAEA,OAAe,qBAAqB,GAAgC;EAOlE,OANI,aAAgB,OACX,EAAO,GAAM,EAAY,IAAI,IAElC,KAAS,OACJ,KAEF,EAAK,SAAS;CACvB;CAEA,OAAe,kBAAkB,GAAkC;EACjE,OAAO,EAAU,KAAI,MAAO,EAAI,KAAI,MAAQ,EAAW,qBAAqB,CAAI,CAAC,CAAC;CACpF;AACF"}
1
+ {"version":3,"file":"UploadUtil.js","names":["_typeof","Parser","_typeof","_defineProperties","_toPropertyKey","_createClass","_toPrimitive","_classCallCheck","_inherits","_createSuper","_isNativeReflectConstruct","_getPrototypeOf","_possibleConstructorReturn","_assertThisInitialized","_wrapNativeSuper","_isNativeFunction","_construct","_setPrototypeOf","_typeof","_defineProperties","_toPropertyKey","_createClass","_toPrimitive","_classCallCheck","_inherits","_createSuper","_isNativeReflectConstruct","_getPrototypeOf","_possibleConstructorReturn","_assertThisInitialized","_wrapNativeSuper","_isNativeFunction","_construct","_setPrototypeOf","_typeof","_defineProperties","_toPropertyKey","_createClass","_toPrimitive","_classCallCheck","_inherits","_createSuper","_isNativeReflectConstruct","_getPrototypeOf","_possibleConstructorReturn","_assertThisInitialized","_wrapNativeSuper","_isNativeFunction","_construct","_setPrototypeOf","_createForOfIteratorHelperLoose","_unsupportedIterableToArray","_arrayLikeToArray","_typeof","_excluded","ownKeys","_objectSpread","_defineProperty","_toPropertyKey","_toPrimitive","_objectWithoutProperties","_objectWithoutPropertiesLoose","_slicedToArray","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","_arrayLikeToArray","EMPTY_CELL_VALUE","_slicedToArray","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","_createForOfIteratorHelperLoose","_arrayLikeToArray","EMPTY_CELL_VALUE","parseSheet","strFromU8_","_typeof","_typeof","_defineProperties","_toPropertyKey","_createClass","_toPrimitive","_classCallCheck","_inherits","_createSuper","_isNativeReflectConstruct","_getPrototypeOf","_possibleConstructorReturn","_assertThisInitialized","_wrapNativeSuper","_isNativeFunction","_construct","_setPrototypeOf","_typeof","_createForOfIteratorHelperLoose","_unsupportedIterableToArray","_arrayLikeToArray","ownKeys","_objectSpread","_defineProperty","_toPropertyKey","_toPrimitive","parseSheet","parseSpreadsheetContents","createWorkerFunction","_typeof","_toPropertyKey","_toPrimitive","_typeof","ownKeys","_objectSpread","_defineProperty","_toPropertyKey","_toPrimitive","parseSpreadsheetContents","createWorkerFunction"],"sources":["../../../../node_modules/.pnpm/worker-f@0.1.20/node_modules/worker-f/lib/stringifyFunctionReferences.js","../../../../node_modules/.pnpm/worker-f@0.1.20/node_modules/worker-f/lib/createWorker.js","../../../../node_modules/.pnpm/worker-f@0.1.20/node_modules/worker-f/lib/createWorkerFunction_.js","../../../../node_modules/.pnpm/worker-f@0.1.20/node_modules/worker-f/lib/createWorkerFunction.js","../../../../node_modules/.pnpm/worker-f@0.1.20/node_modules/worker-f/lib/environment/createWorkerInBrowser.js","../../../../node_modules/.pnpm/worker-f@0.1.20/node_modules/worker-f/lib/export/browser/createWorkerFunctionInBrowser.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/saxen/parser.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xml/parseXmlStream.saxen.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/InvalidSpreadsheetError.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xml/parseXml.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/zip/UnzipError.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/zip/unzipFromArrayBuffer.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/file/InvalidInputError.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/export/filterZipArchiveEntry.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/file/createFileTypeDetector.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/file/validateLeadingBytes.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/utility/checkpoint.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/export/unpackXlsxFileBrowser.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseSpreadsheetInfo.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseFilePaths.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseStyles.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseSharedStrings.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseExcelTimestamp.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/isDateFormat.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/isDateFormatStyle.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseCell.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseCellAddress.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseSheet.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/utility/convertValuesFromUint8ArraysToStrings.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/utility/isPromise.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/SheetNotFoundError.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/xlsx/parseSpreadsheetContents.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/export/readXlsxFileBrowser.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/parseSheetData/InvalidError.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/parseSheetData/types/Number.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/parseSheetData/types/String.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/parseSheetData/types/Boolean.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/parseSheetData/types/Date.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/utility/isObject.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/parseSheetData/parseSheetData.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/export/parseSheet.js","../../../../node_modules/.pnpm/read-excel-file@9.3.10/node_modules/read-excel-file/modules/export/readSheetBrowser.js","../../src/utils/UploadUtil/UploadUtil.ts"],"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// An approximate regular expression of a javascript variable name letter.\n// `\\w` covers `a-z`, `A-Z`, `0-9`, and `_`.\n// First letter can't be a digit, so this reg exp consists of two parts.\nconst JAVASCRIPT_VARIABLE_NAME_REG_EXP = /^[$_\\u0080-\\uFFFFa-zA-Z][$_\\u0080-\\uFFFF\\w]*$/;\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(']')).split(',').map(_ => _.trim());\n // Although it doesn't seem to be reproducible in the tests,\n // I did experience a strange bug when commenting out a dependency\n // resulted in `referencedNames` still including the commented-out variable name.\n // To work around that, it could either validate that `references.length === referencedNames.length`,\n // or validate each referenced name for illegal characters (which includes \"//\").\n for (const name of referencedNames) {\n if (!JAVASCRIPT_VARIABLE_NAME_REG_EXP.test(name)) {\n throw new Error(`Invalid dependency name: ${name}`);\n }\n }\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 // Non-function/non-class values don't need to be stringified\n // because they could be just \"cloned\" in most cases, but not all cases:\n // https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm\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 a class.\n *\n * For non-\"native\" classes, the end result will depend on the name of the class,\n * which should be passed as a second argument for that reason. Specifically,\n * the name of the class will be used when defining its `prototype` properties.\n *\n * \"Native\" functions or classes will be stringified to their \"native\" global name.\n * For example, a reference to `ArrayBuffer` will be stringified as `\"ArrayBuffer\"`.\n *\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 because they're written in C++, etc.\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]') >= 0) {\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 // The code of non-\"native\" classes will have to include the source code\n // of all their `prototype` properties.\n let code = funcSourceCode;\n for (const key in func.prototype) {\n // Sidenote: For `TextDecoder` global class in Node.js, I saw it output a \"weird\" error\n // `TypeError: Value of \"this\" must be of type TextDecoder` when attempting to read `func.prototype[\"encoding\"]`.\n // Perhaps that's because the `encoding` property of `TextDecoder` is a \"getter\"\n // rather than a property, and that \"getter\" function relies on `this` being `TextDecoder`:\n // `get encoding() { return this.#encoding; }`.\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 // Stops the worker.\n const stop = () => {\n worker.stop();\n };\n // Ingests data into the worker.\n const ingest = (data, transferList) => {\n try {\n worker.ingest(data, transferList);\n }\n catch (error) {\n // If a `DOMException [DataCloneError]` is thrown, stop the worker, otherwise\n // it will stay running and will prevent Node.js process from exiting.\n stop();\n // Re-throw the error.\n throw error;\n }\n };\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 ingest(vars, dependenciesTransferList);\n }\n };\n return {\n start,\n stop,\n ingest\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 // For each referenced \"external\" function (or class), define it as a global variable\n // using the dependency name as the global variable's name\n // and the source code of the function (or class) as the global variable's value.\n //\n // \"Native\" global classes or functions such as `ArrayBuffer` won't have any source code\n // and it will be just their global name. This means that if someone passes something like\n // `ArrayBuffer` as a dependency, it will produce code like `ArrayBuffer=ArrayBuffer`,\n // which doesn't really make any sense, but it still works and it doesn't result in any bugs,\n // so it's not handled in any special way. And if someone passes something like\n // `const ab = ArrayBuffer` as a dependency, it will produce code like `ab=ArrayBuffer`,\n // and in such case it does make sense.\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 // This variable is defined here just to work around TypeScript compiler error message:\n // \"Type 'number' is not assignable to type 'undefined'.\"\n let numberOrUndefined;\n // Declare a worker function. It will be returned from this function.\n const workerFn = Object.assign({ inputLatency: numberOrUndefined, outputLatency: numberOrUndefined, \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 = -1;\n let inputReceivedTimestamp = -1;\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 // `createInputHandler()` function could call `send()` right away\n // without waiting to receive any input.\n // In such case, `inputLatency` should stay `undefined`.\n if (inputSentTimestamp !== -1) {\n workerFn.inputLatency = inputReceivedTimestamp - inputSentTimestamp;\n }\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 error = new Error(errorData[0]);\n error.stack = errorData[1];\n let i = 2;\n while (i < errorData.length) {\n error[errorData[i][0]] = errorData[i][1];\n i++;\n }\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 = '$err$';\nconst JAVASCRIPT_CODE_ADDITIONAL = \n// Listen to incoming messages from the main thread.\n'self.onmessage = function(evt) {' +\n 'onMessage(evt.data)' +\n '}' + ';' +\n // Reports an error to the main thread.\n 'function onErr(err_, msg) {' +\n 'var err = err_ instanceof Error ? err_ : new Error(msg)' + ';' +\n 'postMessage({' +\n ERROR_MESSAGE_PROPERTY_NAME + ':' + '[' +\n // `message` is a \"non-enumerable\" property of an `Error` class\n // and it won't be present in `Object.keys(error)`.\n 'err.message' + ',' +\n // `stack` is a \"non-enumerable\" property of an `Error` class\n // and it won't be present in `Object.keys(error)`.\n 'err.stack' +\n '].concat(' +\n // Add any \"rest\" properties of the error such as `name` or `code`.\n 'Object.keys(err).map(' +\n 'function(k){' +\n 'return[k,err[k]]' +\n '}' +\n ')' +\n ')' +\n '})' +\n '}' + ';' +\n // Define a `postMessage()` function that will be used to send messages to the main thread.\n 'var postMessage = self.postMessage' + ';' +\n // Listen to any \"synchronous\" errors that occur inside the worker.\n //\n // \"The error event is fired on a Window object when a resource failed to load\n // or couldn't be used — for example if a script has an execution error.\"\n //\n // \"This event is only generated for script errors thrown synchronously,\n // such as during initial loading or within event handlers.\n // If a promise was rejected (including an uncaught throw within an async function)\n // and no rejection handlers were attached, an `unhandledrejection` event is fired instead.\"\n //\n 'addEventListener(\"error\",' +\n // `evt` argument is an instance of `ErrorEvent` class, which inherits from `Event` class.\n // https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent\n 'function(evt) {' +\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 'onErr(evt.error, evt.message)' +\n '}' +\n ')' + ';' +\n // Listen to any \"asynchronous\" errors that occur inside the worker.\n //\n // \"The `unhandledrejection` event is sent to the global scope of a script\n // when a JavaScript Promise that has no rejection handler is rejected;\n // typically, this is the window, but may also be a Worker.\"\n //\n 'addEventListener(\"unhandledrejection\",' +\n // `evt` argument is an instance of `PromiseRejectionEvent` class, which inherits from `Event` class.\n // https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent\n 'function(evt) {' +\n // Prevent the default logging behavior in the browser console.\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/unhandledrejection_event#preventing_default_handling\n 'evt.preventDefault()' + ';' +\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 'onErr(evt.reason, String(evt.reason))' +\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. &nbsp;\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 (&amp;) as well as\r\n * hex (&#xaaf;) and decimal (&#1231;) 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\n // const xmlns = false\n\n var parser = new Parser();\n\n // // Whether it should parse XML \"namespaces\" (`xmlns` stuff).\n // // It parses faster when the \"namespaces\" mode is disabled.\n // // That's why it's not enabled.\n // if (xmlns) {\n // // // See `xml/xlsxNamespaces.js` file for the list of possible `.xlsx` namespaces.\n // // parser.ns(xlsxNamespaces)\n // parser.ns()\n // }\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 (`&#233;`, `&amp;`, 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(elementName, getAttributes, decodeEntities, selfClosing, getContext) {\n if (onOpenTag) {\n var attributes = getAttributes();\n // `saxen` doesn't decode character references (`&#233;`, `&amp;`, etc)\n // in attribute values either, so decode them here.\n // The reason why `saxen` deliberately doesn't decode character references by default\n // is performance, I assume.\n for (var name in attributes) {\n // Also remove an `xmlns` prefix from the attribute name, if present.\n // When doing so, don't clean up the attribute name with a prefix\n // because it doesn't interfere, and it's faster this way.\n attributes[trimXmlnsPrefix(name, true)] = decodeEntities(attributes[name]);\n }\n onOpenTag(trimXmlnsPrefix(elementName), attributes, state);\n }\n };\n\n // closed a tag.\n var onclosetag = function onclosetag(elementName) {\n if (onCloseTag) {\n onCloseTag(trimXmlnsPrefix(elementName), 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}\nfunction trimXmlnsPrefix(string, isAttributeName) {\n var i = 0;\n while (i < string.length) {\n if (string[i] === ':') {\n // If `string` is an attribute name, filter out `xmlns:...` cases\n // which aren't really attributes but rather xmlns schema URIs.\n if (isAttributeName && i === 5 && string.slice(0, 5) === 'xmlns') {\n // Ignore this attribute.\n } else {\n return string.slice(i + 1);\n }\n }\n i++;\n }\n return string;\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","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","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","// 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","// 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.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 // There're two standards of `.xlsx` files:\n // * So-called \"transitional\", that emerged originally in 2006 and debuted widely with Microsoft Office 2007.\n // * So-called \"strict\", that emerged in 2008 with the publication of the ISO/IEC 29500 specification.\n //\n // \"Transitional\" standard was released in 2007 and includes legacy elements, old namespaces,\n // and compatibility features to support conversions from 1990s binary format `.xls`.\n // This remains Excel's default save format.\n //\n // \"Strict\" standard was introduced conceptually in 2008, but fully realized with modern namespaces\n // and no legacy tags (like VML or old drawing quirks) later on. Microsoft added reading support\n // in Excel 2010 and the ability to save Strict files starting in Excel 2013.\n //\n var RELATIONSHIPS_BASE_URL_TRANSITIONAL_STANDARD = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/';\n var RELATIONSHIPS_BASE_URL_STRICT_STANDARD = 'http://purl.oclc.org/ooxml/officeDocument/relationships/';\n\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 RELATIONSHIPS_BASE_URL_TRANSITIONAL_STANDARD + 'styles':\n case RELATIONSHIPS_BASE_URL_STRICT_STANDARD + 'styles':\n state.styles = getFilePathFromRelationTarget(target);\n break;\n case RELATIONSHIPS_BASE_URL_TRANSITIONAL_STANDARD + 'sharedStrings':\n case RELATIONSHIPS_BASE_URL_STRICT_STANDARD + 'sharedStrings':\n state.sharedStrings = getFilePathFromRelationTarget(target);\n break;\n case RELATIONSHIPS_BASE_URL_TRANSITIONAL_STANDARD + 'worksheet':\n case RELATIONSHIPS_BASE_URL_STRICT_STANDARD + '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 var numFmtId = Number(attributes.numFmtId);\n var numberFormat = {\n id: numFmtId\n };\n //\n // If (and only if) `numFmtId` is >= 164, it is supposed to specify a `formatCode` (a template).\n //\n // For some reason, Microsoft Excel 2007 doesn't allow to redefine `numFmtId=\"99\"`\n // but at the same time does allow redefining `numFmtId=\"100\"`.\n //\n // Google AI says:\n //\n // \"Standard built-in Excel formats use IDs from 0 to 49 (and some regional ones up to 81).\n // IDs 164 and above are officially reserved for custom formats, but third-party spreadsheet\n // generators or older templates frequently assign custom IDs starting at 100 (or lower)\"\n //\n // Because of such \"non-strict\" behavior of Microsoft Excel 2007 regarding overwriting\n // number formats with ID >= 100, this package mimicks such \"non-strict\" approach.\n //\n if (numFmtId >= 100) {\n numberFormat.template = attributes.formatCode;\n }\n state.numberFormats[numFmtId] = numberFormat;\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 if (attributes.numFmtId) {\n var numFmtId = Number(attributes.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: 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","// In some date formats, there's a \";@\" postfix.\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 variable is exported only to be specified in `worker-f` dependencies.\n//\nexport var DATE_FORMAT_POSTFIX_THAT_ALLOWS_ANY_ARBITRARY_TEXT_INPUT = /;@$/;\n\n// Date format template will be cleared of any \"unrelated\" characters.\n//\n// * Characters `a-z` are \"related\" because they're used as date format tokens.\n// * d — Day\n// * yyyy — Year\n// * etc\n//\n// * Characters `0#?,.%` are \"related\" because they indicate a numeric number format.\n// * 0 — Mandatory digit placeholder\n// * # — Optional digit placeholder\n// * ? — Digit placeholder that aligns decimals or fraction spaces\n// * , or . — Thousands and decimal separators. This one is ignored because\n// it could also be present in a valid date template: \"d mmmm yyyy г.\" or \"mmm dddd, yyyy\"\n// * % — Percentage multiplier\n//\n// This variable is exported only to be specified in `worker-f` dependencies.\n//\nexport var DATE_FORMAT_TOKEN_SPLITTER_REG_EXP = /[^a-z0#\\?%]+/;\n\n/**\r\n * XLSX standard does have \"d\" type for dates, but it's not commonly used.\r\n * Instead, `.xlsx` files use \"n\" type for storing both numbers and dates (as timestamps).\r\n * So how does one tell if a cell value should be interpreted as a number or as a date?\r\n * The answer is in the \"format\" that is used to \"format\" the cell value: if it's\r\n * date-specific then it's a date, otherwise it's a number.\r\n * This function tells if a given number format template represents a date rather than a number.\r\n * @param {number} formatId\r\n * @param {string} template\r\n * @param {boolean?[]} dateFormatDetectionCache\r\n * @returns {boolean}\r\n */\nexport default function isDateFormat(formatId, template, dateFormatDetectionCache) {\n var cachedResult = dateFormatDetectionCache[formatId];\n if (cachedResult === undefined) {\n return dateFormatDetectionCache[formatId] = isDateFormatTemplate(template);\n }\n return cachedResult;\n}\n\n/**\r\n * XLSX standard does have \"d\" type for dates, but it's not commonly used.\r\n * Instead, `.xlsx` files use \"n\" type for storing both numbers and dates (as timestamps).\r\n * So how does one tell if a cell value should be interpreted as a number or as a date?\r\n * The answer is in the \"format\" that is used to \"format\" the cell value: if it's\r\n * date-specific then it's a date, otherwise it's a number.\r\n * This function tells if a given number format template represents a date rather than a number.\r\n * @param {string} numberFormat\r\n * @returns {boolean}\r\n */\nexport function isDateFormatTemplate(template) {\n // Date format tokens could be in upper case or in lower case.\n // Normalize the format template by lowercasing it first.\n template = template.toLowerCase();\n\n // In some date formats, there's an \";@\" suffix. Remove it.\n //\n // Adding \";@\"\" at the end ensures that if someone types text into the cell\n // instead of a date, Excel displays that text normally rather than hiding it or throwing an error.\n // Because it occurs in almost all Excel date formats, it should be stripped.\n //\n template = template.replace(DATE_FORMAT_POSTFIX_THAT_ALLOWS_ANY_ARBITRARY_TEXT_INPUT, '');\n\n // Replace any escaped characters with a dummy placeholder\n // that won't be recognized as a \"meaningful\" character,\n // and therefore it won't influence further parsing.\n //\n // The dummy placeholder is not removed because it still acts as a sepaarator\n // between potential adjacent \"meaningful\" tokens. If it was simply removed\n // then it could potentially merge two valid date format tokens into an invalid one.\n // Example: \"d\\my\" → \"d y\" (tokens: \"d\" and \"y\" — both valid) vs \"d\\my\" → \"dy\" (unknown token \"dy\").\n //\n // Escaping is done by putting a backslash (\\) directly before a character.\n // For example, `0.00\\m` displays letter \"m\" literally instead of interpreting it\n // as a month or minute token.\n //\n template = template.replace(/\\\\./g, ' ');\n\n // Split the template by semicolon character into potential multiple independent parts\n // and then test each part independently. If one part represents a date format then\n // the entire format does.\n //\n // What are the cases when there could be a semicolon in a date format tempalte:\n //\n // * There could be a conditional prefix — `[Condition]TrueFormat;FalseFormat` —\n // that splits the template into `TrueFormat` and `FalseFormat` parts which\n // should be evaluated independently. If `TrueFormat` or `FalseFormat` part\n // represents a date format then the entire format represents a date.\n //\n // * Example: `[<45000]\"Old: \"yyyy-mm-dd;yyyy-mm-dd` displays \"Old\"\n // if the date serial is under 45000, otherwise it shows the date.\n //\n // * Possible operators:\n // * [>number] (Greater than)\n // * [>=number] (Greater than or equal to)\n // * [<number] (Less than)\n // * [<=number] (Less than or equal to)\n // * [=number] (Equal to)\n // * [<>number] (Not equal to)\n //\n // * Excel only allows one conditional prefix to be used.\n // * Correct: `[<45000]MM/DD/YYYY; DD-MMM-YYYY`\n // * Incorrect: `[<45000]MM/DD/YYYY; [>=45000]DD-MMM-YYYY`\n //\n // * Another possible case of using semicolons is dividing a format for different types of data:\n // `Positive values; Negative values; Zero values; Text`.\n // In such case, if any of these parts represent a date then the entire format represents a date.\n //\n // * Example: `yyyy-mm-dd;[Red]yyyy-mm-dd; \"No Date\"` — Displays normal dates normally,\n // negative/error serials in red, and text/zero entries as \"No Date\".\n //\n var templates = template.split(';');\n\n // If any of the sub-templates represent a date then the entire template represents a date.\n return templates.some(isDateFormatSubTemplate);\n\n /**\r\n * Tells if a given format template formats a date.\r\n * @param {string} template\r\n * @returns {boolean}\r\n */\n function isDateFormatSubTemplate(template) {\n // Replace any quoted text with a dummy placeholder\n // that won't be recognized as a \"meaningful\" character,\n // and therefore it won't influence further parsing.\n //\n // The dummy placeholder is not removed because it still acts as a sepaarator\n // between potential adjacent \"meaningful\" tokens.If it was simply removed\n // then it could potentially merge two valid date format tokens into an invalid one.\n // Example: `d\"-\"y` → `d y` (tokens: \"d\" and \"y\" — both valid) vs `d\"-\"y` → `dy` (unknown token \"dy\").\n //\n // Formats could include arbitrary prefixes or postfixes.\n // Example: `\"Date: \"yyyy-mm-dd` will display \"Date: 2026-06-06\".\n // Example: `yyyy-mm-dd \"EST\"` will display \"2026-08-09 EST\".\n //\n template = template.replace(/\"[^\"]*\"/g, ' ');\n\n // Remove \".0\" or \".00\" or \".000\" tokens from the format template.\n //\n // * Adding \".0\" after \"s\" tells Excel to displays the fractional part of a second\n // rounded to one decimal place (tenths). For example, a template \"mm:ss.0\"\n // will output: 30:00.0, 30:00.1, 30:00.2, etc.\n //\n // * Another example: \"[ss].0\" format displays elapsed time in seconds\n // with fractional tenths of a second, allowing seconds to accumulate\n // past 59 without rolling over into minutes: 59.0, 60.0, 61.0, 62.0, etc.\n //\n // * Adding \".00\" after \"s\" tells Excel to displays the fractional part of a second\n // rounded to two decimal places (hundredths). For example, a template \"mm:ss.00\"\n // will output: 30:00.00, 30:00.01, 30:00.02, etc.\n //\n // * Adding \".000\" after \"s\" (such as \"ss.000\" or \"s.000\") displays milliseconds\n // (fractional seconds) up to three decimal places: 30:00.000, etc.\n //\n // Sidenote: The character before `00` or `000` could not only be `.` but also `,`\n // depending on the system's language settings (European regions use `,`).\n //\n // Such tokens are also used in general number formats, so they're not exclusive to dates.\n // For example, \".000\" token forces a number to display exactly three decimal places,\n // padding with zeros if necessary and rounding if there are more.\n //\n // This is the reason why \"00\" or \"000\" aren't added to `DATE_TEMPLATE_TOKENS` —\n // because they're not exclusively \"date template tokens\" but rather\n // \"numeric template tokens\" in general. Hence, they should be removed\n // at the clean-up stage, because their presence can't be a deciding factor\n // when telling if a given template corresponds to a date or not.\n //\n template = template.replace(/(\\[?[smhd]{1,2}\\]?)[\\.\\,]00?0?/g, '$1');\n\n // Replace elapsed time brackets with regular time tokens.\n //\n // Formats like `[h]:mm:ss` or `[m]:ss` explicitly represent durations (elapsed time)\n // rather than standard calendar dates, but they are parsed under the Date/Time engine\n // umbrella in Excel. The presence of `[d]` or `[h]` or `[m]` or `[s]` with square brackets\n // (or same tokens with duplicate letters like `[ss]` that conditionally add a leading zero)\n // automatically categorizes it as a Time format.\n //\n template = template.replace(/\\[([smhd]{1,2})\\]/g, '$1');\n\n // Remove any prefixes from the format template.\n //\n // There could be multiple prefixes in a date format template.\n // Example: `[Yellow][DBNum1][$-404]yyyy\"年\"m\"月\"d\"日\";@`\n // Any of those prefixes, as their name suggests, could only be present at the start.\n // They could be present in any number and in any order.\n // All those prefixes should be stripped.\n //\n // What kinds of prefixes could there be?\n //\n // * Conditional prefix — `[Condition]TrueFormat;FalseFormat` — has already been explained earlier.\n //\n // * Native number modifier — It changes standard numbers or date values into native character sets,\n // specifically lowercase Kanji, Chinese, or Korean numerals.\n //\n // Example values:\n //\n // * [DBNum1] / [NatNum1]: Displays numbers as lowercase or standard Kanji/native numerals\n // (e.g., 一, 二, 三).\n // * [DBNum2] / [NatNum2]: Displays numbers as formal/uppercase Kanji or traditional numerals\n // (e.g., 壱, 弐, 参).\n // * [DBNum3] / [NatNum3]: Displays numbers using full-width Arabic numerals.\n // * [DBNum4]: Often maps to specific local simplified or phonetic numeral representations\n // depending on the system language settings.\n //\n // * Color prefix — outputs the value in a given color.\n //\n // Example values:\n //\n // * `[ColorN]`\n // * `[Red]`\n // * `[Yellow]`\n //\n // * Locale prefix — outputs the value using according to a given locale.\n //\n // Syntax format: [$-LCID], where \"LCID\" means \"Windows Locale ID\" and is a hexademical number.\n //\n // Example values:\n //\n // * [$-0409] — English (United States)\n // * [$-0809] — English (United Kingdom)\n // * [$-0407] — German (Germany)\n // * [$-40c] — French (France)\n // * [$-ru-RU] — Russian (Russia)\n // * [$-x-sysdate] — Uses the computer's local system long date format\n //\n // Example: `[$-0407]dd-mmm-yyyy` forces the short month name to output in German.\n //\n // Such prefix could also specify an alternative calendar system using specific trailing letters:\n //\n // Example values:\n //\n // * [$-,F] — Lunar calendar\n // * [$-,G] — Indian Civil calendar\n // * [$-,M] — Persian calendar\n // * [$-,N] — Hijri (Islamic) calendar\n // * [$-,106] or [$-0106] — Arabic / Islamic calendar\n // * [$-,B1] (legacy) — Forces standard Gregorian interpretation\n // * [$-,B2] (legacy) — Forces Hijri interpretation mode\n //\n // Seeing a locale prefix in a format doesn't necessarily imply that this is a date format.\n // For example, `[$-409]#,##0.00` format could be used on a generic number to force\n // standard dot-and-comma layout that is used the US English locale.\n //\n template = template.replace(/\\[[^\\]]*\\]/g, '');\n\n // Extract any remaining alphabetic parts from what's left from the template string.\n // Example: \"mm/dd/yyyy\" → [\"mm\", \"dd\", \"yyyy\"]\n var tokens = template.split(DATE_FORMAT_TOKEN_SPLITTER_REG_EXP)\n // Filter out any empty-string tokens.\n // For example, Russian template \"d mmmm yyyy г.\" contains \"г.\" postfix after year.\n // Splitting it by the above regexp would prodce an empty-string token at the end of the template.\n // Similarly, splitting a non-existing template \"г. d mmmm yyyy\" by the regexp above\n // would produce an empty-string token at the start of the template.\n // So any instances of an empty-string token at the start or at the end should be filtered out.\n // Normally, Excel would escape any such \"г.\" strings (and even spaced) with a backslash,\n // but an `.xlsx` file could come from any other source that does not perform such escaping,\n // such as a hand-made script.\n .filter(function (_) {\n return _;\n });\n\n // Normally, if there're any date-specific tokens in the template then it is considered\n // a date format. Otherwise, it is considered a number format.\n //\n // That algorithm works if the format template parsing engine is solid and covered\n // with a gazillion of tests, because otherwise it could potentially produce \"false positive\"\n // results due to the very \"permissive\" nature of it making a decision.\n //\n // If the format parsing engine has some kind of a bug, and falsely categorizes a format\n // to represent a date when in reality it represents a number, things could go wrong\n // and the user would get weird output when some numbers are presented as if they were dates.\n //\n // In order to avoid such \"false positives\", there're two ways:\n // * Someone ports a format template parsing engine from an existing spreadsheet editor application's code.\n // * The format template parsing engine stays as is but becomes less permissive when making a decision.\n //\n // The latter approach is used, meaning that inclusion of any \"unexpected\" characters in the template\n // will stop it from being treated as a date template. What should the \"unexpected\" characters be then?\n // I'd suppose that those should be ones that're known to be used in numeric number formats:\n //\n // * 0 — Mandatory digit placeholder\n // * # — Optional digit placeholder\n // * ? — Digit placeholder that aligns decimals or fraction spaces\n // * , or . — Thousands and decimal separators. This one is not included because it could also be used in date formats.\n // * % — Percentage multiplier\n\n return tokens.length === 0\n // If no date-template-specific tokens 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 // I.e. it's better to output a \"false positive\" here rather than end up\n // accidentally interpreting numbers as dates, which users wouldn't want.\n ? false\n // If a non-date-format-specific token is found, then it might not necessarily be a date format.\n // In order to make a certain guess and avoid \"false positives\", it should treat any\n // unexpected situations as \"not a date template\" so that it doesn't accidentally\n // interpret numbers as dates, which users wouldn't want.\n : tokens.every(function (token) {\n return DATE_FORMAT_TEMPLATE_TOKENS.indexOf(token) >= 0;\n });\n }\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_FORMAT_TEMPLATE_TOKENS = [\n// Seconds.\n's',\n// Seconds (min two digits). Example: \"05\".\n'ss',\n// Minutes. Could also means months, depending on the context. Example: \"5\".\n'm',\n// Minutes (min two digits). Could also means months, depending on the context. Example: \"05\".\n'mm',\n// Hours. Example: \"1\".\n'h',\n// Hours (min two digits). Example: \"01\".\n'hh',\n// \"am\" part of \"am/pm\" or \"AM/PM\".\n'am',\n// \"pm\" part of \"am/pm\" or \"AM/PM\".\n'pm',\n// \"a\" part of \"a/p\" or \"A/P\".\n'a',\n// \"p\" part of \"a/p\" or \"A/P\".\n'p',\n// Day. Example: \"1\"\n'd',\n// Day (min two digits). Example: \"01\"\n'dd',\n// Short, three-letter abbreviation for the day of the week. Example: \"Mon\"\n'ddd',\n// Full name of the day of the week. Example: \"Monday\"\n'dddd',\n// Abbreviated weekday name. Example: \"Mon\", \"Tue\"\n'aaa',\n// Full weekday name. Example: \"Monday\", \"Tuesday\"\n'aaaa',\n// First letter of the weekday name. Example: \"M\", \"T\"\n'aaaaa',\n// Month (numeric). Could also mean minutes, depending on the context. Example: \"1\".\n'm',\n// Month (numeric, min two digits). Could also mean minutes, depending on the context. Example: \"01\".\n'mm',\n// Month (shortened month name). Example: \"Jan\".\n'mmm',\n// Month (full month name). Example: \"January\".\n'mmmm',\n// Month (first letter). Example: \"J\".\n'mmmmm',\n// Excel typically treats a single `y` the same as `yy` in custom formatting,\n// though standard practice is using `yy` or `yyyy`.\n'y',\n// Two-digit year, with a leading zero if needed. Example: \"01\".\n'yy',\n// Full year. Example: \"2001\".\n'yyyy',\n//\n// `e` or `ee` token stands for \"era year\" and represents an era-based year,\n// primarily supporting Japanese, Taiwanese, or Minguo/Buddhist calendar systems.\n// An example of an \"era year\" would be Heisei or Reiwa year numbers,\n// or Buddhist Era years which are Gregorian years plus 543.\n//\n// * `e` outputs the era year as a 4-digit (or unpadded) number.\n// For example, `2026` or `115` depending on the active regional era.\n// In standard Western/Gregorian locales, Excel often falls back to treating `e`\n// similarly to a regular year layout.\n//\n// * `ee` outputs a 2-digit padded era year. For example, `26` or `15`.\n//\n// * `eeee` — While `yyyy` is the standard token for a 4-digit year,\n// `eeee` is historically used for specialized international calendar eras\n// (like the Japanese or Taiwanese imperial eras). However, in standard\n// Western/Gregorian system locales, Excel treats `eeee` exactly like `yyyy`.\n'e', 'ee', 'eeee'];\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, dateFormatDetectionCache) {\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.id, style.numberFormat.template, dateFormatDetectionCache)) {\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, 7),\n sharedStrings = _ref2[0],\n styles = _ref2[1],\n epoch1904 = _ref2[2],\n dateFormatDetectionCache = _ref2[3],\n defaultDateFormat = _ref2[4],\n dateTemplateParser = _ref2[5],\n parseNumberCustom = _ref2[6];\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, dateFormatDetectionCache)) {\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","/**\r\n * Parses cell address into a row number and a column number.\r\n * Examples: \"A1\" → [1,1], \"B2\" → [2,2], \"AA2091\" → [2091, 27], \"R988\" → [988, 18].\r\n * @param {string} cellAddress\r\n * @returns {number[]} Returns `[rowNumber, columnNumber]`\r\n */\nexport default function parseCellAddress(cellAddress) {\n // const CELL_ADDRESS_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 // Split a cell coordinate into the letter part (left) and numeric part (right).\n // Cell coordinate example: \"AA2091\", \"R988\", \"B1\".\n var columnNumber = 0;\n var i = 0;\n while (i < cellAddress.length) {\n var charCode = cellAddress.charCodeAt(i);\n // `48` is the character code of \"0\", `57` is the character code of \"9\".\n if (charCode >= 48 && charCode <= 57) {\n var rowNumber = Number(cellAddress.slice(i));\n if (isNaN(rowNumber)) {\n invalidCellAddress(cellAddress);\n }\n return [\n // Row number (starting at `1`).\n rowNumber,\n // Column number (starting at `1`).\n columnNumber];\n }\n // Convert a letter coordinate to a digit coordinate.\n // Examples: \"A\" -> 1, \"B\" -> 2, \"Z\" -> 26, \"AA\" -> 27, etc.\n columnNumber *= 26; // Same as: CELL_ADDRESS_LETTERS.length\n columnNumber += cellAddress.charCodeAt(i) - 64; // Same as: CELL_ADDRESS_LETTERS.indexOf(cellAddress[i]) + 1\n i++;\n }\n invalidCellAddress(cellAddress);\n}\nfunction invalidCellAddress(cellAddress) {\n throw new Error(\"<c r=\\\"\".concat(cellAddress, \"\\\">\"));\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 _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 dateFormatDetectionCache = _ref.dateFormatDetectionCache,\n options = _ref.options;\n var parseCellParameters = [sharedStrings, styles, epoch1904, dateFormatDetectionCache, 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(sheet, sheets) {\n var _this;\n _classCallCheck(this, SheetNotFoundError);\n _this = _super.call(this, \"Sheet not found: \".concat(typeof sheet === 'number' ? sheet + '. Sheet count: ' + sheets.length : sheet + '. Available sheets: ' + sheets.join(', ')));\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\n // Sheet name or sheet number.\n _this.sheet = sheet;\n\n // Available sheet names.\n _this.sheets = sheets;\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/**\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 var dateFormatDetectionCache = [];\n\n // Parse sheets data.\n return readFiles(getSheetDataXmlFiles(filePaths, sheetRelationIdsToRead, {\n sharedStrings: sharedStrings,\n styles: styles,\n epoch1904: spreadsheetInfo.epoch1904,\n dateFormatDetectionCache: dateFormatDetectionCache,\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. Not used.\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 return parseSpreadsheetContents(parseXml, contents, options);\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 } else {\n if (sheet <= sheets.length) {\n return sheets[sheet - 1].relationId;\n }\n }\n throw new SheetNotFoundError(sheet, sheets.map(function (_) {\n return _.name;\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 _ref3;\n return _ref3 = {}, _defineProperty(_ref3, 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: Promise.resolve([])\n }), _defineProperty(_ref3, filePaths.styles || 'xl/styles.xml', {\n name: 'styles',\n parse: parseStyles,\n fallback: {}\n }), _ref3;\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","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 InvalidError = /*#__PURE__*/function (_Error) {\n _inherits(InvalidError, _Error);\n var _super = _createSuper(InvalidError);\n function InvalidError(reason) {\n var _this;\n _classCallCheck(this, InvalidError);\n _this = _super.call(this, 'invalid');\n _this.reason = reason;\n return _this;\n }\n return _createClass(InvalidError);\n}( /*#__PURE__*/_wrapNativeSuper(Error));\nexport { InvalidError as default };\n//# sourceMappingURL=InvalidError.js.map","import InvalidError from '../InvalidError.js';\nexport default function NumberType(value) {\n // An XLSX file editing software might not always correctly\n // detect numeric values in string-type cells. Users won't bother\n // manually selecting a cell type, so the editing software has to guess\n // based on the user's input. One can assume that such auto-detection\n // might not always work.\n //\n // So, if a cell is supposed to be a numeric one, convert a string value to a number.\n //\n if (typeof value === 'string') {\n var stringifiedValue = value;\n value = Number(value);\n if (String(value) !== stringifiedValue) {\n throw new InvalidError('not_a_number');\n }\n }\n if (typeof value !== 'number') {\n throw new InvalidError('not_a_number');\n }\n if (isNaN(value)) {\n throw new InvalidError('invalid_number');\n }\n // At this point, `value` can only be a number.\n //\n // The global `isFinite()` function filters out:\n // * NaN\n // * -Infinity\n // * Infinity\n //\n // All other values pass (including non-numbers).\n //\n if (!isFinite(value)) {\n throw new InvalidError('out_of_bounds');\n }\n return value;\n}\n//# sourceMappingURL=Number.js.map","import InvalidError from '../InvalidError.js';\nexport default function StringType(value) {\n if (typeof value === 'string') {\n return value;\n }\n // Excel tends to perform a forced automatic convertion of string-type values\n // to number-type ones when the user has input them. Otherwise, users wouldn't\n // be able to perform formula calculations on those cell values because users\n // won't bother manually choosing a \"numeric\" cell type for each cell, and\n // even if they did, choosing a \"numeric\" cell type every time wouldn't be an\n // acceptable \"user experience\".\n //\n // So, if a cell value is supposed to be a string and Excel has automatically\n // converted it to a number, perform a backwards conversion.\n //\n if (typeof value === 'number') {\n if (isNaN(value)) {\n throw new InvalidError('invalid_number');\n }\n // The global `isFinite()` function filters out:\n // * NaN\n // * -Infinity\n // * Infinity\n //\n // All other values pass (including non-numbers).\n //\n if (!isFinite(value)) {\n throw new InvalidError('out_of_bounds');\n }\n return String(value);\n }\n throw new InvalidError('not_a_string');\n}\n//# sourceMappingURL=String.js.map","import InvalidError from '../InvalidError.js';\nexport default function BooleanType(value) {\n if (typeof value === 'boolean') {\n return value;\n }\n throw new InvalidError('not_a_boolean');\n}\n//# sourceMappingURL=Boolean.js.map","import InvalidError from '../InvalidError.js';\nexport default function DateType(value) {\n // XLSX has no specific format for dates.\n // Sometimes a date can be heuristically detected.\n // https://github.com/catamphetamine/read-excel-file/issues/3#issuecomment-395770777\n if (value instanceof Date) {\n if (isNaN(value.valueOf())) {\n throw new InvalidError('out_of_bounds');\n }\n return value;\n }\n throw new InvalidError('not_a_date');\n}\n//# sourceMappingURL=Date.js.map","var objectConstructor = {}.constructor;\nexport default function isObject(object) {\n return object !== undefined && object !== null && object.constructor === objectConstructor;\n}\n\n// export default function isObject(object: unknown): object is object {\n// return object !== undefined && object !== null && object.constructor === objectConstructor\n// }\n//# sourceMappingURL=isObject.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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\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 _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _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 _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\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 _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 NumberType from './types/Number.js';\nimport StringType from './types/String.js';\nimport BooleanType from './types/Boolean.js';\nimport DateType from './types/Date.js';\nimport isObject from '../utility/isObject.js';\nimport checkpoint from '../utility/checkpoint.js';\n\n// An empty cell has `null` value.\nvar EMPTY_CELL_VALUE = null;\n\n/**\r\n * Converts spreadsheet-alike data structure into an array of JSON objects.\r\n *\r\n * Parameters:\r\n *\r\n * * `data` — An array of rows, each row being an array of cells. The first row should be the list of column headers and the rest of the rows should be the data.\r\n * * `schema` — A \"to JSON\" convertion schema (see above).\r\n * * `options` — (optional) Schema conversion parameters of `read-excel-file`:\r\n * * `propertyValueWhenColumnIsMissing` — By default, when some of the `schema` columns are missing in the input `data`, those properties are set to `undefined` in the output objects. Pass `propertyValueWhenColumnIsMissing: null` to set such \"missing column\" properties to `null` in the output objects.\r\n * * `propertyValueWhenCellIsEmpty` — By default, when it encounters a `null` value in a cell in input `data`, it sets it to `undefined` in the output object. Pass `propertyValueWhenCellIsEmpty: null` to make it set such values as `null`s in output objects.\r\n * // * `shouldSkipRequiredValidationWhenColumnIsMissing: (column: string, { object }) => boolean` — By default, it does apply `required` validation to `schema` properties for which columns are missing in the input `data`. One could pass a custom `shouldSkipRequiredValidationWhenColumnIsMissing(column, { object })` to disable `required` validation for missing columns in some or all cases.\r\n * * `transformEmptyObject(object, { path? })` — By default, it returns `null` for \"empty\" objects. One could override that value using `transformEmptyObject(object, { path })` parameter. The value applies to both top-level object and any nested sub-objects in case of a nested schema, hence the additional (optional) `path?: string` parameter.\r\n * * `transformEmptyArray(array, { path })` — By default, it returns `null` for an \"empty\" array value. One could override that value using `transformEmptyArray(array, { path })` parameter.\r\n * * `separatorCharacter` — By default, it splits array-type cell values by a comma character.\r\n *\r\n * When parsing a property value, in case of an error, the value of that property is gonna be `undefined`.\r\n *\r\n * @param {SheetData} data - An array of rows, each row being an array of cells.\r\n * @param {object} schema\r\n * @param {object} [options]\r\n * @param {any} [options.propertyValueWhenColumnIsMissing] — By default, when some of the `schema` columns are missing in the input `data`, those properties are set to `undefined` in the output objects. Pass `propertyValueWhenColumnIsMissing: null` to set such \"missing column\" properties to `null` in the output objects.\r\n * @param {any} [options.propertyValueWhenCellIsEmpty] — By default, when it encounters a `null` value in a cell in input `data`, it leaves the value as is. Pass a custom `propertyValueWhenCellIsEmpty` to make it set such values to that value.\r\n * // @param {boolean} [options.shouldSkipRequiredValidationWhenColumnIsMissing(column: string, { object })] — By default, it does apply `required` validation to `schema` properties for which columns are missing in the input `data`. One could pass a custom `shouldSkipRequiredValidationWhenColumnIsMissing(column, { object })` to disable `required` validation for missing columns in some or all cases.\r\n * @param {function} [options.transformEmptyObject(object, { path })] — By default, it returns `null` for an \"empty\" resulting object. One could override that value using `transformEmptyObject(object, { path })` parameter. The value applies to both top-level object and any nested sub-objects in case of a nested schema, hence the additional `path?: string` parameter.\r\n * @param {function} [options.transformEmptyArray(array, { path })] — By default, it returns `null` for an \"empty\" array value. One could override that value using `transformEmptyArray(array, { path })` parameter.\r\n * @param {string} [options.separatorCharacter] — When specified, string values will be split by this separator to get the array.\r\n * @return {object} — An object of shape `{ objects, errors }`. Either `objects` or `errors` is going to be `undefined`.\r\n */\nexport default function parseSheetData(data, schema, optionsCustom) {\n checkpoint('parse sheet data using schema');\n var objects = [];\n var errors = [];\n var parsedRows = parseSheetDataWithPerRowErrors(data, schema, optionsCustom);\n var parsedRowIndex = 0;\n for (var _iterator = _createForOfIteratorHelperLoose(parsedRows), _step; !(_step = _iterator()).done;) {\n var _step$value = _step.value,\n object = _step$value.object,\n rowErrors = _step$value.errors;\n if (rowErrors) {\n errors = errors.concat(rowErrors.map(\n // Add row number property to each row error.\n function (rowError) {\n return _objectSpread(_objectSpread({}, rowError), {}, {\n row: parsedRowIndex + 1\n });\n }));\n } else {\n objects.push(object);\n }\n parsedRowIndex++;\n }\n checkpoint('end');\n if (errors.length > 0) {\n return {\n errors: errors\n };\n }\n return {\n objects: objects\n };\n}\n\n// This one is only used in tests.\nexport function parseSheetDataWithPerRowErrors(data, schema, optionsCustom) {\n validateSchema(schema);\n var options = applyDefaultOptions(optionsCustom);\n var _data = _toArray(data),\n columns = _data[0],\n dataRows = _data.slice(1);\n return dataRows.map(function (row) {\n return parseDataRow(row, schema, columns, options);\n });\n}\nfunction parseDataRow(dataRow, schema, columns, options) {\n // Create a `schemaEntry` for the top-level object.\n var schemaEntry = {\n schema: schema\n };\n\n // Parse the values in the given data row into an object.\n var _parseProperty = parseProperty(dataRow, schemaEntry, undefined, columns, options),\n value = _parseProperty.value,\n isEmptyValue = _parseProperty.isEmptyValue,\n errors = _parseProperty.errors,\n children = _parseProperty.children;\n\n // Simulate a \"dummy\" parent object for the top-level object.\n // It will be used when running `required` validations.\n var dummyParentObject = {\n // The \"dummy\" parent object has a \"dummy\" value.\n // This value is irrelevant because it won't be read anywhere.\n value: PARSED_OBJECT_TREE_START,\n // The \"dummy\" parent object is empty if the parsed row is empty.\n isEmptyValue: isEmptyValue,\n // The \"dummy\" object has the same errors as the parsed row.\n errors: errors,\n // The parsed object by default is not required to have any data\n // so the \"dummy\" object is not required.\n isRequired: undefined\n };\n\n // Run any `required` validations.\n //\n // `required` validations should be run after the entire data row has been parsed,\n // i.e. when the entire object structure has been parsed.\n // The reason is that a `required` validation could be either a simple boolean or a \"complex\" function.\n // In the latter case, the result of a `required()` function may depend on any other property of the object,\n // hence the actual `required` flag value could only be obtained after the entire data row has been parsed.\n //\n // For example, consider a top-level object:\n //\n // {\n // firstName: string,\n // lastName: string,\n // pet?: { name: string }\n // }\n //\n // A corresponding schema would be:\n //\n // {\n // firstName: {\n // required: true\n // },\n // lastName: {\n // required: true\n // },\n // pet: {\n // required: false,\n // schema: {\n // name: {\n // required: true\n // }\n // }\n // }\n // }\n //\n // I.e. when a `pet` exists, it must have a `name`.\n //\n // In such case, the `required: true` check of the `pet`'s `name` property\n // should not be performed if the `pet` is not present, because the `pet` nested object\n // is marked as `required: false`, meaning that `pet` data is not required to be present.\n //\n var requiredErrors = runPendingRequiredValidations(schemaEntry, value, isEmptyValue, errors, children,\n // Simulate a \"dummy\" parent object for the top-level object.\n dummyParentObject.isRequired, dummyParentObject.value, dummyParentObject.isEmptyValue, dummyParentObject.errors, columns);\n\n // If there were any errors, whether caused by `required`\n // or occured while parsing the values, return those errors.\n if (errors || requiredErrors) {\n return {\n errors: (errors || []).concat(requiredErrors || [])\n };\n }\n\n // Return the parsed object.\n return {\n object: transformValue(value, isEmptyValue, undefined, options)\n };\n}\nfunction parseObject(row, schema, path, columns, options) {\n var object = {};\n var isEmptyObject = true;\n var errors = [];\n var children = [];\n\n // For each property of the object.\n for (var _i = 0, _Object$keys = Object.keys(schema); _i < _Object$keys.length; _i++) {\n var key = _Object$keys[_i];\n var child = parseProperty(row, schema[key], getPropertyPath(key, path), columns, options);\n if (child.errors) {\n errors = errors.concat(child.errors);\n } else {\n object[key] = transformValue(child.value, child.isEmptyValue, getPropertyPath(key, path), options);\n // Potentially unmark the object as \"empty\".\n if (isEmptyObject && !child.isEmptyValue) {\n isEmptyObject = false;\n }\n }\n children.push(_objectSpread(_objectSpread({}, child), {}, {\n // `schemaEntry` will be used when running `required` validation of this property (later),\n schemaEntry: schema[key]\n }));\n }\n\n // If there were any errors, return them.\n if (errors.length > 0) {\n return {\n // Return the errors.\n errors: errors,\n // Return the `children` because `required` validations still have to be run (later).\n children: children\n };\n }\n return {\n value: object,\n isEmptyValue: isEmptyObject,\n // Return the `children` because `required` validations still have to be run (later).\n children: children\n };\n}\nfunction parseProperty(row, schemaEntry, path, columns, options) {\n var columnIndex = schemaEntry.column ? columns.indexOf(schemaEntry.column) : undefined;\n var isMissingColumn = schemaEntry.column ? columnIndex < 0 : undefined;\n var _ref = schemaEntry.column ? isMissingColumn ? {\n value: options.propertyValueWhenColumnIsMissing,\n isEmptyValue: true\n } : parseCellValueWithPossibleErrors(row[columnIndex], schemaEntry, columnIndex, options) : parseObject(row, schemaEntry.schema, path, columns, options),\n value = _ref.value,\n isEmptyValue = _ref.isEmptyValue,\n errors = _ref.errors,\n children = _ref.children;\n\n // If there were any errors, return them.\n if (errors) {\n return {\n // Return the errors.\n errors: errors,\n // Return the `children` because `required` validations still have to be run (later).\n children: children\n };\n }\n return {\n value: value,\n isEmptyValue: isEmptyValue,\n // Return the `children` because `required` validations still have to be run (later).\n children: children\n };\n}\nfunction parseCellValueWithPossibleErrors(cellValue, schemaEntry, columnIndex, options) {\n var _parseCellValue = parseCellValue(cellValue, schemaEntry, options),\n value = _parseCellValue.value,\n isEmptyValue = _parseCellValue.isEmptyValue,\n errorMessage = _parseCellValue.error,\n errorReason = _parseCellValue.reason;\n if (errorMessage) {\n var error = createError({\n error: errorMessage,\n reason: errorReason,\n column: schemaEntry.column,\n columnIndex: columnIndex,\n valueType: schemaEntry.type,\n value: cellValue\n });\n return {\n errors: [error]\n };\n }\n return {\n value: value,\n isEmptyValue: isEmptyValue\n };\n}\n\n/**\r\n * Converts a cell value value to a javascript typed value.\r\n * @param {any} cellValue\r\n * @param {object} schemaEntry\r\n * @param {string} propertyPath\r\n * @param {object} options\r\n * @return {{ value?: any, isEmptyValue: boolean } | { error: string, reason?: string }}\r\n */\nfunction parseCellValue(cellValue, schemaEntry, options) {\n if (cellValue === undefined) {\n // This isn't supposed to be possible when reading spreadsheet data:\n // cell values are always read as `null` when those cells are empty.\n // It's currently impossible for `read-excel-file` to return `undefined` cell value.\n // Here it uses some \"sensible default\" fallback by treating `undefined` as \"column missing\".\n return {\n value: options.propertyValueWhenColumnIsMissing,\n isEmptyValue: true\n };\n }\n if (cellValue === EMPTY_CELL_VALUE) {\n return {\n value: options.propertyValueWhenCellIsEmpty,\n isEmptyValue: true\n };\n }\n\n // Parse comma-separated cell value.\n if (Array.isArray(schemaEntry.type)) {\n return parseArrayValue(cellValue, schemaEntry, options);\n }\n return parseValue(cellValue, schemaEntry, options);\n}\n\n/**\r\n * Converts textual value to a javascript typed array value.\r\n * @param {any} value\r\n * @param {object} schemaEntry\r\n * @param {object} options\r\n * @return {{ value?: any, isEmptyValue: boolean } | { error: string, reason?: string }}\r\n */\nfunction parseArrayValue(value, schemaEntry, options) {\n // If the cell value is not a string — i.e. a number, a boolean, a Date —\n // then throw an error.\n if (typeof value !== 'string') {\n return {\n error: 'not_a_string'\n };\n }\n var isEmptyArray = true;\n var errors = [];\n var reasons = [];\n var values = parseSeparatedSubstrings(value, options.separatorCharacter).map(function (substring) {\n // If any substring was already detected to be invalid\n // don't attempt to parse any other substrings.\n if (errors.length > 0) {\n return;\n }\n\n // If an empty substring was extracted, it means that there was an out-of-place separator.\n if (!substring) {\n errors.push('invalid');\n reasons.push('syntax');\n return;\n }\n var _parseValue = parseValue(substring, schemaEntry, options),\n value = _parseValue.value,\n isEmptyValue = _parseValue.isEmptyValue,\n error = _parseValue.error,\n reason = _parseValue.reason;\n if (error) {\n errors.push(error);\n reasons.push(reason);\n return;\n }\n if (isEmptyArray && !isEmptyValue) {\n isEmptyArray = false;\n }\n return value;\n });\n if (errors.length > 0) {\n return {\n error: errors[0],\n reason: reasons[0]\n };\n }\n return {\n value: values,\n isEmptyValue: isEmptyArray\n };\n}\n\n/**\r\n * Converts textual value to a javascript typed value.\r\n * @param {any} value\r\n * @param {object} schemaEntry\r\n * @param {object} options\r\n * @return {{ value?: any, isEmptyValue: boolean } | { error: string }}\r\n */\nexport function parseValue(value, schemaEntry, options) {\n // `null` values (i.e. empty cells) don't get parsed.\n if (value === EMPTY_CELL_VALUE) {\n return {\n value: value,\n isEmptyValue: true\n };\n }\n\n // Parse the value according to the `type` that is specified in the schema entry.\n var result;\n if (schemaEntry.type) {\n result = parseValueOfType(value,\n // Get the type of the value.\n //\n // Handle the case if it's a comma-separated value.\n // Example `type`: String[]\n // Example Input Value: 'Barack Obama, \"String, with, colons\", Donald Trump'\n // Example Parsed Value: ['Barack Obama', 'String, with, colons', 'Donald Trump']\n //\n Array.isArray(schemaEntry.type) ? schemaEntry.type[0] : schemaEntry.type, options);\n } else {\n // If the `type` is not specified for a given schema entry, the `value` will be returned as is.\n result = {\n value: value\n };\n // throw new Error('Invalid schema entry: no `type` specified:\\n\\n' + JSON.stringify(schemaEntry, null, 2))\n }\n\n // If there was an error when parsing the value then return the error.\n if (result.error) {\n return result;\n }\n\n // If the parsed value is empty, return it.\n if (value === EMPTY_CELL_VALUE) {\n return {\n value: value,\n isEmptyValue: true\n };\n }\n\n // Value is not empty.\n // Validate it and return.\n\n // Perform `oneOf` validation.\n if (schemaEntry.oneOf) {\n var errorAndReason = validateOneOf(result.value, schemaEntry.oneOf);\n if (errorAndReason) {\n return errorAndReason;\n }\n }\n\n // Perform `validate()` validation.\n if (schemaEntry.validate) {\n try {\n schemaEntry.validate(result.value);\n } catch (error) {\n return {\n error: error.message\n };\n }\n }\n\n // Return the value.\n return {\n value: result.value,\n isEmptyValue: isEmptyValue(result.value)\n };\n}\nfunction validateOneOf(value, oneOf) {\n if (oneOf.indexOf(value) < 0) {\n return {\n error: 'invalid',\n reason: 'unknown'\n };\n }\n}\n\n/**\r\n * Converts cell value to a javascript typed value.\r\n * @param {(string|number|boolean|Date)} value\r\n * @param {function} type\r\n * @return {object} Either `{ value: (string|number|Date|boolean) }` or `{ error: string, reason?: string }`\r\n */\nfunction parseValueOfType(value, type) {\n switch (type) {\n case String:\n return parseValueUsingTypeParser(value, StringType);\n case Number:\n return parseValueUsingTypeParser(value, NumberType);\n case Date:\n return parseValueUsingTypeParser(value, DateType);\n case Boolean:\n return parseValueUsingTypeParser(value, BooleanType);\n default:\n // Validate `type`\n if (typeof type !== 'function') {\n throw new Error(\"Unsupported schema `type`: \".concat(type && type.name || type));\n }\n return parseValueUsingTypeParser(value, type);\n }\n}\n\n/**\r\n * Converts textual value to a custom value using supplied `type`.\r\n * @param {any} value\r\n * @param {function} type\r\n * @return {{ value: any, error: string }}\r\n */\nfunction parseValueUsingTypeParser(value, type) {\n try {\n var parsedValue = type(value);\n // Returning `undefined` from a `type` parser is treated as returning `null`.\n if (parsedValue === undefined) {\n return {\n value: EMPTY_CELL_VALUE\n };\n }\n return {\n value: parsedValue\n };\n } catch (error) {\n var result = {\n error: error.message\n };\n // Built-in types such as `Number` or `Date` may also report\n // a specific `reason` of the error.\n if (error.reason) {\n result.reason = error.reason;\n }\n return result;\n }\n}\n\n// Extracts a substring from a string.\nexport function getNextSubstring(string, separatorCharacter, startIndex) {\n var i = 0;\n var substring = '';\n while (startIndex + i < string.length) {\n var character = string[startIndex + i];\n if (character === separatorCharacter) {\n return [substring, i];\n }\n // Previously, it used to treat `\"` character similar to how it's treated in `.csv` files:\n // any commas inside quotes are ignored. But then I thought that it could introduce more\n // issues than it was originally intending to fix, and it also didn't provide an \"escape\" mechanism.\n // Overall, a decision was made to simplify the whole thing and drop the concept of quotes as special characters.\n //\n // else if (character === '\"') {\n // const quotedSubstring = getNextSubstring(string, '\"', startIndex + i + 1)\n // substring += quotedSubstring[0]\n // i += '\"'.length + quotedSubstring[1] + '\"'.length\n // }\n else {\n substring += character;\n i++;\n }\n }\n return [substring, i];\n}\n\n/**\r\n * Parses a string of comma-separated substrings into an array of substrings.\r\n * (the `export` is just for tests)\r\n * @param {string} string — A string of comma-separated substrings.\r\n * @return {string[]} An array of substrings.\r\n */\nexport function parseSeparatedSubstrings(string, separatorCharacter) {\n var elements = [];\n var index = 0;\n while (index < string.length) {\n var _getNextSubstring = getNextSubstring(string, separatorCharacter, index),\n _getNextSubstring2 = _slicedToArray(_getNextSubstring, 2),\n substring = _getNextSubstring2[0],\n length = _getNextSubstring2[1];\n index += length + separatorCharacter.length;\n elements.push(substring.trim());\n }\n return elements;\n}\nfunction transformValue(value, isEmptyValue, path, options) {\n if (isEmptyValue) {\n if (isObject(value)) {\n return options.transformEmptyObject(value, {\n path: path\n });\n } else if (Array.isArray(value)) {\n return options.transformEmptyArray(value, {\n path: path\n });\n }\n }\n return value;\n}\nfunction getPropertyPath(propertyName, parentObjectPath) {\n return \"\".concat(parentObjectPath ? parentObjectPath + '.' : '').concat(propertyName);\n}\n\n// Recursively runs `required` validations for the parsed data row tree.\nfunction runPendingRequiredValidations(schemaEntry, value, isEmptyValue, errors, children, parentObjectIsRequired, parentObjectValue, parentObjectValueIsEmpty, parentObjectErrors, columns) {\n var requiredErrors = [];\n\n // See if this property is required.\n var isRequired = isPropertyRequired(schemaEntry, parentObjectIsRequired, parentObjectValue, parentObjectValueIsEmpty, parentObjectErrors);\n\n // If this property is required and empty, create a \"required\" error.\n if (isRequired && isEmptyValue) {\n requiredErrors.push(createError({\n error: 'required',\n column: schemaEntry.column,\n columnIndex: columns.indexOf(schemaEntry.column),\n valueType: schemaEntry.type,\n value: value\n }));\n }\n\n // Run `required` validations of the children.\n if (children) {\n for (var _iterator2 = _createForOfIteratorHelperLoose(children), _step2; !(_step2 = _iterator2()).done;) {\n var child = _step2.value;\n var requiredErrorsOfChild = runPendingRequiredValidations(child.schemaEntry, child.value, child.isEmptyValue, child.errors, child.children,\n // The following properties describe the parent object of the `child`,\n // i.e. the current (iterated) object.\n isRequired, value, isEmptyValue, errors, columns);\n if (requiredErrorsOfChild) {\n requiredErrors = requiredErrors.concat(requiredErrorsOfChild);\n }\n }\n }\n if (requiredErrors.length > 0) {\n return requiredErrors;\n }\n}\nfunction isPropertyRequired(schemaEntry, parentObjectIsRequired, parentObjectValue, parentObjectValueIsEmpty, parentObjectErrors) {\n // If the parent object is marked as `required: false` then it's allowed\n // to be absent entirely from the input data. If that's the case,\n // i.e. if the parent object is absent entirely from the input data,\n // then any descendant properties of such object are allowed to be absent too,\n // which means that they should also be considered being `required: false`.\n //\n // Also, if the parent object couldn't be parsed due to some non-`required` errors,\n // it can't be known whether it's actually empty or not. In case of such uncertainty,\n // the code shouldn't attempt to be overly smart and do things that might not be necessary,\n // so such parent object is just assumed to be empty in order to not falsly trigger\n // any `required` validations that otherwise wouldn't have been run.\n // In other words, skipping some `required` validations is better than\n // running `required` validations that shouldn't have been run.\n //\n if (parentObjectIsRequired === false && (parentObjectValueIsEmpty || parentObjectErrors)) {\n return false;\n }\n return schemaEntry.required && (typeof schemaEntry.required === 'boolean' ? schemaEntry.required :\n // If there were any non-`required` errors when parsing the parent object,\n // the `parentObject` will be `undefined`. In that case, \"complex\" `required()`\n // validations — the ones where `required` is a function — can't really be run\n // because those validations assume a fully and correctly parsed parent object\n // be passed as an argument, and the thing is that the `parentObject` is unknown.\n // As a result, only \"basic\" `required` validations could be run,\n // i.e. the ones where `required` is just a boolean, and \"complex\" `required`\n // validations, i.e. the ones where `required` is a functions, should be skipped,\n // because it's better to skip some `required` errors than to trigger falsy ones.\n parentObjectErrors ? false : schemaEntry.required(parentObjectValue));\n}\nfunction createError(_ref2) {\n var column = _ref2.column,\n columnIndex = _ref2.columnIndex,\n valueType = _ref2.valueType,\n value = _ref2.value,\n errorMessage = _ref2.error,\n reason = _ref2.reason;\n var error = {\n error: errorMessage,\n column: column,\n columnIndex: columnIndex,\n value: value\n };\n if (reason) {\n error.reason = reason;\n }\n // * Regular values specify a `type?` property, which is included in the `error` object.\n // * Nested objects specify a `schema` property, which is not included in the `error` object.\n if (valueType) {\n error.type = valueType;\n }\n return error;\n}\nfunction validateSchema(schema) {\n for (var _i2 = 0, _Object$keys2 = Object.keys(schema); _i2 < _Object$keys2.length; _i2++) {\n var key = _Object$keys2[_i2];\n var schemaEntry = schema[key];\n // Validate that the `schema` is not using a deprecated `type: nestedSchema` format.\n if (_typeof(schemaEntry.type) === 'object' && !Array.isArray(schemaEntry.type)) {\n throw new Error('When defining a nested schema, use a `schema` property instead of a `type` property');\n }\n // Validate that every property has a source `column` title specified for it.\n if (!schemaEntry.schema) {\n if (!schemaEntry.column) {\n throw new Error(\"\\\"column\\\" not defined for schema entry \\\"\".concat(key, \"\\\".\"));\n }\n }\n }\n\n // A nested object could have a `required` property but the only allowed value is `false`.\n // The reason why `true` value is not allowed is because in case of a \"required\" error\n // there's no single column title corresponding to such nested object, and column title\n // is required to create a \"required\" error.\n validateObjectSchemaRequiredProperty(schema, undefined);\n}\nfunction validateObjectSchemaRequiredProperty(schema, required) {\n if (required !== undefined && required !== false) {\n throw new Error(\"In a schema, a nested object can have a `required` property but the only allowed value is `undefined` or `false`. Otherwise, a \\\"required\\\" error for a nested object would have to include a specific `column` title and a nested object doesn't have one. You've specified the following `required`: \".concat(required));\n }\n // For each property of the described object.\n for (var _i3 = 0, _Object$keys3 = Object.keys(schema); _i3 < _Object$keys3.length; _i3++) {\n var key = _Object$keys3[_i3];\n // If this property is itself an object.\n if (isObject(schema[key].schema)) {\n // Validate that a `column` property can't coexist with a `schema` property.\n if (schema[key].column) {\n throw new Error(\"In a schema, `column` property is only allowed when describing a property value rather than a nested object. Key: \".concat(key, \". Schema:\\n\").concat(JSON.stringify(schema[key], null, 2)));\n }\n // Recurse into the child object.\n validateObjectSchemaRequiredProperty(schema[key].schema, schema[key].required);\n }\n }\n}\nfunction isEmptyValue(value) {\n return value === undefined || value === null;\n}\nvar DEFAULT_OPTIONS = {\n propertyValueWhenColumnIsMissing: undefined,\n propertyValueWhenCellIsEmpty: null,\n // shouldSkipRequiredValidationWhenColumnIsMissing: () => false,\n // `transformEmptyObject(object, { path })` applies to both the top-level object\n // and any of its nested objects.\n transformEmptyObject: function transformEmptyObject() {\n return null;\n },\n transformEmptyArray: function transformEmptyArray() {\n return null;\n },\n separatorCharacter: ','\n};\nfunction applyDefaultOptions(options) {\n if (options) {\n return _objectSpread(_objectSpread({}, DEFAULT_OPTIONS), options);\n } else {\n return DEFAULT_OPTIONS;\n }\n}\n\n// This `value` marks the start of a tree structure that is parsed from a given data row.\nvar PARSED_OBJECT_TREE_START = {};\n//# sourceMappingURL=parseSheetData.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 = [\"schema\"];\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; }\nimport parseSpreadsheetContents from '../xlsx/parseSpreadsheetContents.js';\nimport parseSheetData from '../parseSheetData/parseSheetData.js';\n\n/**\r\n * Reads data from a single sheet of an `.xlsx` file as an array of rows (which are arrays of cells) or as an array of objects (if `options.schema` was passed).\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 {string|number} [sheet] — Sheet name or number.\r\n * @param {object} [options]\r\n * @return {Promise<SheetData>}\r\n */\nexport default function parseSheet(createWorkerFunction, parseXml, contents, sheet, optionsWithSchema) {\n // `schema` has to be excluded from the `options`\n var _ref = optionsWithSchema || {},\n schema = _ref.schema,\n options = _objectWithoutProperties(_ref, _excluded);\n return parseSpreadsheetContents(createWorkerFunction, parseXml, contents, _objectSpread(_objectSpread({}, options), {}, {\n sheets: [sheet === undefined ? 1 : sheet]\n })).then(function (sheets) {\n var sheetData = sheets[0].data;\n if (schema) {\n return parseSheetData(sheetData, schema);\n }\n return sheetData;\n });\n}\n//# sourceMappingURL=parseSheet.js.map","import createWorkerFunction from 'worker-f/browser';\nimport parseXml from '../xml/parseXml.js';\nimport unpackXlsxFile from './unpackXlsxFileBrowser.js';\nimport parseSheet from './parseSheet.js';\n\n/**\r\n * Reads a single sheet from an `.xlsx` file.\r\n * @param {(Blob|ArrayBuffer)} input\r\n * @param {(number|string)} [sheet] — Sheet number or sheet name\r\n * @param {object} [options]\r\n * @return {Promise<SheetData>}\r\n */\nexport default function readSheet(input, sheet, options) {\n // `sheet` argument is optional.\n // It could be omitted while `options` argument is passed.\n if (!options && sheet && typeof sheet !== 'number' && typeof sheet !== 'string') {\n options = sheet;\n sheet = undefined;\n }\n return unpackXlsxFile(input).then(function (contents) {\n return parseSheet(createWorkerFunction, parseXml, contents, sheet, options);\n });\n}\n//# sourceMappingURL=readSheetBrowser.js.map","import readXlsxFile, { readSheet } from 'read-excel-file/browser';\nimport type {\n CellValue,\n SheetData,\n} from 'read-excel-file/browser';\nimport { parse } from 'csv/browser/esm/sync';\nimport type {\n AnyObject,\n ObjectSchema,\n} from 'yup';\nimport {\n lazy,\n object,\n string,\n} from 'yup';\nimport { t } from 'i18next';\nimport difference from 'lodash/difference';\nimport uniq from 'lodash/uniq';\nimport { format } from 'date-fns';\nimport type {\n CaseDbCaseBatchUploadResult,\n CaseDbCaseForUpload,\n CaseDbCaseType,\n CaseDbCaseUploadResult,\n CaseDbCol,\n CaseDbCompleteCaseType,\n CaseDbReadSetForUpload,\n CaseDbSeqForUpload,\n} from '@gen-epix/api-casedb';\nimport {\n CaseDbCaseApi,\n CaseDbColType,\n CaseDbEtlStatus,\n CaseDbFileCompression,\n CaseDbReadsFileFormat,\n CaseDbSeqFileFormat,\n CaseDbUploadAction,\n} from '@gen-epix/api-casedb';\nimport { QueryClientService } from '@gen-epix/ui-client-common/classes/services/QueryClientService';\nimport { ValidationUtil } from '@gen-epix/ui-core/utils/ValidationUtil';\nimport { ObjectUtil } from '@gen-epix/ui-core/utils/ObjectUtil';\nimport { StringUtil } from '@gen-epix/ui-core/utils/StringUtil';\nimport type {\n AutoCompleteOption,\n FormFieldDefinition,\n OptionBase,\n} from '@gen-epix/ui-core-form/models/form';\nimport { FORM_FIELD_DEFINITION_TYPE } from '@gen-epix/ui-core-form/models/form';\nimport { DATE_FORMAT } from '@gen-epix/ui-core/constants/date';\n\nimport { CaseTypeUtil } from '../CaseTypeUtil';\nimport { CaseUtil } from '../CaseUtil';\nimport type {\n UploadCompleteColStats,\n UploadMappedColumn,\n UploadMappedColumnsFormFields,\n UploadSequenceMapping,\n UploadSequenceMappingForCaseId,\n} from '../../models/upload';\nimport { UploadError } from '../../classes/errors';\nimport { CASEDB_QUERY_KEY } from '../../constants/query';\n\nexport class UploadUtil {\n public static readonly caseDateColumnAliases = ['_timed_at', 'timed at', 'timed_at', 'timedat', 'case.timed_at', 'timed_at_date'];\n public static readonly caseIdColumnAliases = ['_case_id', 'case id', 'case_id', 'caseid', 'case.id'];\n public static readonly colAliases = ['_case_type', 'case type', 'case_type', 'casetype', 'case.type'];\n\n public static areMappedColumnsEqual(a: UploadMappedColumn[], b: UploadMappedColumn[]): boolean {\n if (a.length !== b.length) {\n return false;\n }\n\n return a.every((itemA, index) => {\n const itemB = b[index];\n const stringifiedA = `${itemA.originalIndex}-${itemA.originalLabel}`;\n const stringifiedB = `${itemB.originalIndex}-${itemB.originalLabel}`;\n return stringifiedA === stringifiedB;\n });\n }\n\n public static async createCases(kwArgs: {\n assemblyProtocolId: string;\n casesForVerificationFromSourceData: CaseDbCaseForUpload[];\n completeCaseType: CaseDbCompleteCaseType;\n createdInDataCollectionId: string;\n mappedColumns: UploadMappedColumn[];\n sampleIdColId: string;\n selectedValidatedCases: CaseDbCaseUploadResult[];\n sequenceMapping: UploadSequenceMapping;\n sequencingProtocolId: string;\n signal: AbortSignal;\n }): Promise<CaseDbCaseBatchUploadResult> {\n const {\n assemblyProtocolId,\n casesForVerificationFromSourceData,\n completeCaseType,\n createdInDataCollectionId,\n mappedColumns,\n sampleIdColId,\n selectedValidatedCases: validatedCases,\n sequenceMapping,\n sequencingProtocolId,\n signal,\n } = kwArgs;\n\n const { col: mappedSampleIdCol, sampleIdentifierIssuerId } = mappedColumns.find(mc => mc.col?.id === sampleIdColId) ?? {};\n\n return (await CaseDbCaseApi.getInstance().uploadCases({\n case_batch: {\n cases: validatedCases.map((vc) => {\n const caseId = vc.id;\n const readSetsForUpload: CaseDbReadSetForUpload[] = [];\n const seqsForUpload: CaseDbSeqForUpload[] = [];\n const externalSampleId = mappedSampleIdCol ? CaseUtil.getRowValue(\n vc.validated_content,\n mappedSampleIdCol,\n completeCaseType,\n )?.raw : null;\n const caseFromSourceData = casesForVerificationFromSourceData.find(c => c.id === vc.id);\n\n if (externalSampleId) {\n if (sequenceMapping[vc.id]?.sequenceFileNames) {\n Object.entries(sequenceMapping[vc.id].sequenceFileNames).forEach(([colId, fileName]) => {\n if (fileName) {\n seqsForUpload.push({\n case_id: caseId ?? undefined,\n col_id: colId,\n other_sample_identifier: {\n external_id: externalSampleId,\n identifier_issuer_id: sampleIdentifierIssuerId,\n },\n protocol_id: assemblyProtocolId,\n } satisfies CaseDbSeqForUpload);\n }\n });\n }\n if (sequenceMapping[vc.id]?.readsFileNames) {\n Object.entries(sequenceMapping[vc.id].readsFileNames).forEach(([colId, fileNames]) => {\n if (fileNames.fwd || fileNames.rev) {\n readSetsForUpload.push({\n case_id: caseId ?? undefined,\n col_id: colId,\n other_sample_identifier: {\n external_id: externalSampleId,\n identifier_issuer_id: sampleIdentifierIssuerId,\n },\n protocol_id: sequencingProtocolId,\n } satisfies CaseDbReadSetForUpload);\n }\n });\n }\n }\n\n return ObjectUtil.deepNullifyEmptyStrings<CaseDbCaseForUpload>({\n case: {\n case_type_id: completeCaseType.id,\n content: vc.validated_content,\n created_in_data_collection_id: caseFromSourceData?.case?.created_in_data_collection_id ?? createdInDataCollectionId,\n id: caseId ?? undefined,\n },\n read_sets: readSetsForUpload,\n seqs: seqsForUpload,\n });\n }),\n },\n case_type_id: completeCaseType.id,\n default_created_in_data_collection_id: createdInDataCollectionId ?? undefined,\n on_exists: CaseDbUploadAction.UPDATE,\n }, { signal })).data;\n }\n\n public static async createCasesAndUploadFiles(kwArgs: {\n assemblyProtocolId: string;\n casesForVerificationFromSourceData: CaseDbCaseForUpload[];\n completeCaseType: CaseDbCompleteCaseType;\n createdInDataCollectionId: string;\n mappedColumns: UploadMappedColumn[];\n onComplete: () => void;\n onError: (error: Error) => void;\n onProgress: (progress: number, message: string) => void;\n sampleIdColId: string;\n selectedValidatedCases: CaseDbCaseUploadResult[];\n sequenceFilesDataTransfer: DataTransfer;\n sequenceMapping: UploadSequenceMapping;\n sequencingProtocolId: string;\n signal: AbortSignal;\n }): Promise<CaseDbCaseBatchUploadResult> {\n const {\n onComplete,\n onError,\n onProgress,\n } = kwArgs;\n\n try {\n onProgress(0, t('Creating cases...'));\n const caseBatchUploadResult = await UploadUtil.createCases(kwArgs);\n\n if (caseBatchUploadResult.status === CaseDbEtlStatus.FAILED) {\n throw new UploadError(t('Failed to create cases during upload.'), caseBatchUploadResult);\n }\n\n await UploadUtil.uploadFilesForCases({ ...kwArgs, caseBatchUploadResult, endPercentage: 99, startPercentage: 1 });\n onProgress(100, t('Upload complete.'));\n\n await QueryClientService.getInstance().invalidateQueryKeys(QueryClientService.getInstance().getQueryKeyDependencies([CASEDB_QUERY_KEY.CASES], true));\n onComplete();\n return caseBatchUploadResult;\n } catch (error) {\n onError(error instanceof Error ? error : new Error('Unknown error occurred during upload'));\n throw error;\n }\n }\n\n public static getCasesForUpload(kwArgs: { caseTypeId: string; createdInDataCollectionId: string; mappedColumns: UploadMappedColumn[]; rawData: string[][] }): CaseDbCaseForUpload[] {\n const { caseTypeId, createdInDataCollectionId, mappedColumns, rawData } = kwArgs;\n return rawData.slice(1).map((rawDataRow) => {\n const rawDataCaseIdColumnIndex = mappedColumns.find((mappedColumn) => mappedColumn.isCaseIdColumn)?.originalIndex;\n const content: { [key: string]: string } = {};\n\n mappedColumns.forEach((mappedColumn) => {\n if (mappedColumn.col) {\n content[mappedColumn.col.id] = rawDataRow[mappedColumn.originalIndex];\n }\n });\n let id: string;\n if (!isNaN(rawDataCaseIdColumnIndex) && rawDataRow[rawDataCaseIdColumnIndex]) {\n id = rawDataRow[rawDataCaseIdColumnIndex];\n } else {\n id = StringUtil.createUuid();\n }\n\n const caseForCreateUpdate: CaseDbCaseForUpload = {\n case: {\n case_type_id: caseTypeId,\n content: ObjectUtil.deepNullifyEmptyStrings(content),\n created_in_data_collection_id: createdInDataCollectionId,\n },\n id,\n };\n\n return { ...caseForCreateUpdate, content };\n });\n }\n\n public static getCaseTypeFromColumnLabels(cols: CaseDbCol[], columnLabels: string[]): CaseDbCaseType {\n const bestMatch = {\n caseType: null as CaseDbCaseType,\n matchCount: 0,\n };\n\n // Group columns by case type ID to count matches per case type\n const caseTypeMatches = new Map<string, { caseType: CaseDbCaseType; matchCount: number }>();\n\n cols.forEach(col => {\n const matchCount = columnLabels.filter(label =>\n this.matchColumnLabel(label, col)).length;\n\n if (matchCount > 0) {\n const caseTypeId = col.case_type_id;\n const existing = caseTypeMatches.get(caseTypeId);\n\n if (existing) {\n existing.matchCount += matchCount;\n } else {\n // Note: We don't have access to the full CaseType object here,\n // so we create a minimal one with the ID. In a real implementation,\n // you might need to pass the complete case type data or modify the method signature.\n caseTypeMatches.set(caseTypeId, {\n caseType: { id: caseTypeId } as CaseDbCaseType,\n matchCount,\n });\n }\n }\n });\n\n // Find the case type with the highest match count\n caseTypeMatches.forEach(match => {\n if (match.matchCount > bestMatch.matchCount) {\n bestMatch.caseType = match.caseType;\n bestMatch.matchCount = match.matchCount;\n }\n });\n\n return bestMatch.caseType;\n }\n\n public static getColumnMappingFormFieldDefinitions(completeCaseType: CaseDbCompleteCaseType, rawDataHeaders: string[], _fileName: string): FormFieldDefinition<UploadMappedColumnsFormFields>[] {\n const fields: FormFieldDefinition<UploadMappedColumnsFormFields>[] = [];\n const options: AutoCompleteOption<string>[] = [];\n\n options.push({\n label: 'Case ID',\n value: 'case_id',\n });\n\n const allowedColIds = CaseTypeUtil.getWritableImportExportColIds(completeCaseType);\n completeCaseType.ordered_col_ids.filter(x => allowedColIds.includes(x)).forEach((colId) => {\n const col = completeCaseType.cols[colId];\n\n options.push({\n label: col.label,\n value: col.id,\n });\n });\n\n rawDataHeaders.forEach((header, index) => {\n fields.push({\n definition: FORM_FIELD_DEFINITION_TYPE.SELECT,\n label: header,\n name: index.toString(),\n options,\n });\n });\n\n return fields;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n public static getColumnMappingSchema(rawData: string[][], completeCaseType: CaseDbCompleteCaseType): ObjectSchema<{}, AnyObject, {}, ''> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const fields: { [key: string]: any } = {};\n const fieldNames: string[] = rawData[0].map((_, index) => index.toString());\n const sampleIdColIds = UploadUtil.getSampleIdColIds(completeCaseType);\n\n sampleIdColIds.forEach((colId) => {\n fields[colId] = lazy(() => string().nullable().when(fieldNames, (otherFieldValues, schema) => {\n return schema.test('needs-identifier-issuer', t('An identifier issuer must be selected.'), (fieldValue) => {\n const allFieldValues = [...otherFieldValues as string[], fieldValue];\n if (allFieldValues.includes(colId)) {\n return !!fieldValue;\n }\n return true;\n });\n }));\n });\n\n fieldNames.forEach((fieldName, fieldIndex) => {\n const otherFieldNames = fieldNames.filter(name => name !== fieldName);\n fields[fieldName] = lazy(() => string().nullable().when(otherFieldNames, (otherFieldValues, schema) => {\n return schema\n .test('unique', t('This column has already been mapped to another field.'), (fieldValue) => {\n return !fieldValue || !otherFieldValues.includes(fieldValue);\n })\n .test('valid-case-id-values', t('The column mapped to the case id field must contain valid UUID\\'s.'), (fieldValue) => {\n if (fieldValue !== 'case_id') {\n return true;\n }\n const values = rawData.slice(1).map(row => row[fieldIndex]);\n return values.every(value => !value || ValidationUtil.validate('UUID4', value));\n });\n }));\n });\n\n return object().shape(fields);\n }\n\n\n public static getCompleteCaseTypeColStats(completeCaseType: CaseDbCompleteCaseType): UploadCompleteColStats {\n const sampleIdColumns = CaseTypeUtil.getColsByType(completeCaseType, [CaseDbColType.ID_SAMPLE]);\n const sequenceColumns = CaseTypeUtil.getColsByType(completeCaseType, [CaseDbColType.GENETIC_SEQUENCE]);\n const readsColumns = CaseTypeUtil.getColsByType(completeCaseType, [CaseDbColType.GENETIC_READS]);\n const writableColumns = Object.values(completeCaseType.cols).filter(col => CaseTypeUtil.getWritableColIds(completeCaseType).includes(col.id));\n\n return { readsColumns, sampleIdColumns, sequenceColumns, writableColumns };\n }\n\n public static getDefaultColumnMappingFormValues(rawDataHeaders: string[], mappedColumns: UploadMappedColumn[], identifierIssuerOptions: OptionBase<string>[]): UploadMappedColumnsFormFields {\n const defaultFormValues: UploadMappedColumnsFormFields = Object.fromEntries(Object.keys(rawDataHeaders).map<[string, null]>(x => [x.toString(), null]));\n const caseIdColumn = mappedColumns.find(mappedColumn => mappedColumn.isCaseIdColumn);\n\n if (caseIdColumn) {\n defaultFormValues[caseIdColumn.originalIndex.toString()] = 'case_id';\n }\n\n mappedColumns.forEach((mappedColumn) => {\n if (mappedColumn.col) {\n defaultFormValues[mappedColumn.originalIndex.toString()] = mappedColumn.col.id;\n if (mappedColumn.isSampleIdColumn) {\n defaultFormValues[mappedColumn.col.id] = mappedColumn.sampleIdentifierIssuerId || identifierIssuerOptions.length === 1 ? identifierIssuerOptions[0].value : null;\n }\n }\n });\n return defaultFormValues;\n }\n\n public static getEpiUploadSequenceMapping(completeCaseType: CaseDbCompleteCaseType, validatedCases: CaseDbCaseUploadResult[], sequenceFilesDataTransfer: DataTransfer): UploadSequenceMapping {\n if (!sequenceFilesDataTransfer || sequenceFilesDataTransfer.files.length === 0) {\n return {};\n }\n\n const stats = UploadUtil.getCompleteCaseTypeColStats(completeCaseType);\n const result: UploadSequenceMapping = {};\n\n (JSON.parse(JSON.stringify(validatedCases)) as CaseDbCaseUploadResult[]).forEach((vc) => {\n const caseSequenceMapping: UploadSequenceMappingForCaseId = {\n readsFileNames: {},\n sequenceFileNames: {},\n };\n\n // modify by reference\n result[vc.id] = caseSequenceMapping;\n\n if (stats.sequenceColumns.length !== 1 && stats.readsColumns.length !== 1) {\n return;\n }\n\n const sampleIdColumnIds: string[] = [];\n stats.sampleIdColumns.forEach((idCol) => {\n const rowValue = CaseUtil.getRowValue(vc.validated_content, idCol, completeCaseType);\n if (rowValue && !rowValue.isMissing) {\n sampleIdColumnIds.push(rowValue.raw);\n }\n });\n if (!sampleIdColumnIds.length) {\n return;\n }\n\n stats.sequenceColumns.forEach((seqCol) => {\n caseSequenceMapping.sequenceFileNames[seqCol.id] = '';\n });\n stats.readsColumns.forEach((readCol) => {\n caseSequenceMapping.readsFileNames[readCol.id] = {\n fwd: '',\n rev: '',\n };\n });\n\n const sequenceFiles: string[] = [];\n const readsFiles: string[] = [];\n Array.from(sequenceFilesDataTransfer.files).forEach((file) => {\n const fileName = file.name;\n const lowerName = fileName.toLowerCase();\n const matchesId = sampleIdColumnIds.some((id) => lowerName.match(UploadUtil.idToRegex(id.toLowerCase())));\n if (matchesId) {\n if (UploadUtil.isGenomeFile(fileName)) {\n sequenceFiles.push(fileName);\n } else if (UploadUtil.isReadsFile(fileName)) {\n readsFiles.push(fileName);\n }\n }\n });\n\n if (stats.sequenceColumns.length === 1 && sequenceFiles.length === 1) {\n caseSequenceMapping.sequenceFileNames[stats.sequenceColumns[0].id] = sequenceFiles[0];\n }\n if (stats.readsColumns.length === 1) {\n if (readsFiles.length === 1) {\n caseSequenceMapping.readsFileNames[stats.readsColumns[0].id].fwd = readsFiles[0];\n }\n if (readsFiles.length === 2) {\n const sortedReadsFiles = readsFiles.sort((a, b) => a.localeCompare(b));\n caseSequenceMapping.readsFileNames[stats.readsColumns[0].id].fwd = sortedReadsFiles[0];\n caseSequenceMapping.readsFileNames[stats.readsColumns[0].id].rev = sortedReadsFiles[1];\n }\n }\n });\n return result;\n }\n\n public static getInitialMappedColumns(completeCaseType: CaseDbCompleteCaseType, rawData: string[][]): UploadMappedColumn[] {\n if (rawData.length === 0) {\n return [];\n }\n const writableColIds = CaseTypeUtil.getWritableColIds(completeCaseType);\n const filteredCols = CaseTypeUtil.getWritableImportExportColIds(completeCaseType).map(id => completeCaseType.cols[id]);\n const sampleIdColIds = UploadUtil.getSampleIdColIds(completeCaseType);\n const mappedColumns = rawData[0].map((label, index) => {\n const isCaseIdColumn = UploadUtil.isCaseIdColumn(label);\n const isCol = UploadUtil.isCol(label);\n\n let col: CaseDbCol = null;\n let isSampleIdColumn = false;\n\n if (!isCaseIdColumn && !isCol) {\n col = filteredCols.find(c => UploadUtil.matchColumnLabel(label, c)) || null;\n if (col && !writableColIds.includes(col.id)) {\n col = null;\n }\n isSampleIdColumn = col ? sampleIdColIds.includes(col.id) : false;\n }\n\n return {\n col,\n isCaseIdColumn,\n isCol,\n isSampleIdColumn,\n originalIndex: index,\n originalLabel: label,\n sampleIdentifierIssuerId: null as string,\n } satisfies UploadMappedColumn;\n });\n\n return mappedColumns.filter(mc => {\n return mc.isCaseIdColumn || mc.col;\n });\n }\n\n public static getMappedColumnsFromFormData(data: UploadMappedColumnsFormFields, rawData: string[][], colMap: Map<string, CaseDbCol>, completeCaseType: CaseDbCompleteCaseType): UploadMappedColumn[] {\n const mappedColumns: UploadMappedColumn[] = [];\n const sampleIdColIds = UploadUtil.getSampleIdColIds(completeCaseType);\n Object.entries(data).forEach(([originalIndexString, formValue]) => {\n if (!formValue) {\n return;\n }\n const originalIndex = parseInt(originalIndexString, 10);\n const isCaseIdColumn = formValue === 'case_id';\n let col: CaseDbCol = null;\n if (!isCaseIdColumn) {\n col = colMap.get(formValue) || null;\n }\n let sampleIdentifierIssuerId: string = null;\n const isSampleIdColumn = col ? sampleIdColIds.includes(col.id) : false;\n if (isSampleIdColumn) {\n sampleIdentifierIssuerId = data[formValue] || null;\n }\n mappedColumns.push({\n col,\n isCaseIdColumn,\n isSampleIdColumn,\n originalIndex,\n originalLabel: rawData[0][originalIndex] || '',\n sampleIdentifierIssuerId,\n } satisfies UploadMappedColumn);\n });\n return mappedColumns;\n }\n\n public static getSampleIdColIds(completeCaseType: CaseDbCompleteCaseType): string[] {\n const colsIds: string[] = [];\n Object.values(Object.keys(completeCaseType.cols)).forEach(colId => {\n const col = completeCaseType.cols[colId];\n const refCol = completeCaseType.ref_cols[col.ref_col_id];\n if (refCol?.col_type === CaseDbColType.ID_SAMPLE) {\n colsIds.push(col.id);\n }\n });\n return colsIds;\n }\n\n public static getSequenceMappingStats(sequenceMapping: UploadSequenceMapping, sequenceFilesDataTransfer: DataTransfer): {\n mappedFiles: string[];\n mappedReadsFiles: string[];\n mappedSequenceFiles: string[];\n numberOfFilesToMap: number;\n unmappedFileNames: string[];\n unmappedReadsFiles: string[];\n unmappedSequenceFiles: string[];\n } {\n const sequenceFiles = Array.from(sequenceFilesDataTransfer.files).map(file => file.name).filter(fileName => UploadUtil.isGenomeFile(fileName));\n const readsFiles = Array.from(sequenceFilesDataTransfer.files).map(file => file.name).filter(fileName => UploadUtil.isReadsFile(fileName));\n const files = [...sequenceFiles, ...readsFiles];\n const numberOfFilesToMap = files.length;\n\n const mappedSequenceFiles = uniq(Object.values(sequenceMapping).flatMap(mapping => Object.values(mapping.sequenceFileNames)).filter(x => x));\n const mappedReadsFiles = uniq(Object.values(sequenceMapping).flatMap(mapping => Object.values(mapping.readsFileNames).flatMap(reads => [reads.fwd, reads.rev])).filter(x => x));\n const mappedFiles = [...mappedSequenceFiles, ...mappedReadsFiles];\n\n const unmappedSequenceFiles = difference(sequenceFiles, mappedSequenceFiles);\n const unmappedReadsFiles = difference(readsFiles, mappedReadsFiles);\n const unmappedFileNames = difference(files, mappedFiles);\n\n return {\n mappedFiles,\n mappedReadsFiles,\n mappedSequenceFiles,\n numberOfFilesToMap,\n unmappedFileNames,\n unmappedReadsFiles,\n unmappedSequenceFiles,\n };\n }\n\n public static async getSheetNameOptions(fileList: FileList): Promise<AutoCompleteOption<string>[]> {\n const file = fileList[0];\n const fileName = file.name.toLowerCase();\n\n if (UploadUtil.isXlsxFile(fileName)) {\n return (await readXlsxFile(file, { trim: true })).map(({ sheet: sheetName }) => ({\n label: sheetName,\n value: sheetName,\n }));\n }\n return [];\n }\n\n public static hasReadsColumnMapped(mappedColumns: UploadMappedColumn[], completeCaseTypeColStats: UploadCompleteColStats): boolean {\n return mappedColumns.some((mappedColumn) => {\n return completeCaseTypeColStats.readsColumns.some(readCol => mappedColumn.col?.id === readCol.id);\n });\n }\n\n public static hasSequenceColumnMapped(mappedColumns: UploadMappedColumn[], completeCaseTypeColStats: UploadCompleteColStats): boolean {\n return mappedColumns.some((mappedColumn) => {\n return completeCaseTypeColStats.sequenceColumns.some(seqCol => mappedColumn.col?.id === seqCol.id);\n });\n }\n\n public static isCaseDateColumn(label: string): boolean {\n return this.caseDateColumnAliases.includes(label.toLocaleLowerCase());\n }\n\n public static isCaseIdColumn(label: string): boolean {\n return this.caseIdColumnAliases.includes(label.toLocaleLowerCase());\n }\n\n public static isCol(label: string): boolean {\n return this.colAliases.includes(label.toLocaleLowerCase());\n }\n\n public static isGenomeFile(fileName: string): boolean {\n const lowerName = fileName.toLowerCase();\n return lowerName.endsWith('.fa') ||\n lowerName.endsWith('.fasta') ||\n lowerName.endsWith('.fa.gz') ||\n lowerName.endsWith('.fasta.gz');\n }\n\n public static isReadsFile(fileName: string): boolean {\n const lowerName = fileName.toLowerCase();\n return lowerName.endsWith('.fq') ||\n lowerName.endsWith('.fastq') ||\n lowerName.endsWith('.fq.gz') ||\n lowerName.endsWith('.fastq.gz');\n }\n\n public static isSupportedGeneticFile(fileName: string): boolean {\n return UploadUtil.isGenomeFile(fileName) || UploadUtil.isReadsFile(fileName);\n }\n\n\n public static isTextFile(fileName: string): boolean {\n const lowerName = fileName?.toLowerCase();\n return lowerName?.endsWith('.csv') || lowerName?.endsWith('.tsv') || lowerName?.endsWith('.txt');\n }\n\n public static isXlsxFile(fileName: string): boolean {\n return fileName?.toLowerCase()?.endsWith('.xlsx');\n }\n\n public static matchColumnLabel(columnLabel: string, col: CaseDbCol): boolean {\n if (!columnLabel || typeof columnLabel !== 'string') {\n return false;\n }\n const labelLowerCase = columnLabel.toLocaleLowerCase();\n return labelLowerCase === col.label.toLocaleLowerCase() || labelLowerCase === col.code.toLowerCase() || labelLowerCase === col.id.toLocaleLowerCase();\n }\n\n public static async readFileAsBase64(file: File): Promise<string> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n const result = reader.result as string;\n const base64 = result.split(',')[1]; // Remove data:*/*;base64, prefix\n resolve(base64);\n };\n reader.onerror = (_) => {\n reject(Error('File read error'));\n };\n reader.readAsDataURL(file);\n });\n }\n\n public static async readRawData(fileList: FileList, sheet?: string): Promise<string[][]> {\n const file = fileList[0];\n const fileName = file.name.toLowerCase();\n let result: string[][];\n\n if (UploadUtil.isTextFile(fileName)) {\n // Parse CSV file\n let text = await file.text();\n if (fileName.endsWith('.tsv')) {\n // Convert TSV to CSV by replacing tabs with commas\n text = text.replace(/\\t/g, ',');\n }\n if (fileName.endsWith('.txt')) {\n // Attempt to auto-detect delimiter (comma, tab, semicolon)\n const lines = text.split(/\\r?\\n/).filter(line => line.trim() !== '');\n if (lines.length > 0) {\n const delimiters = [',', '\\t', ';'];\n let bestDelimiter = ',';\n let maxFields = 0;\n delimiters.forEach(delimiter => {\n const fieldsCount = lines[0].split(delimiter).length;\n if (fieldsCount > maxFields) {\n maxFields = fieldsCount;\n bestDelimiter = delimiter;\n }\n });\n if (bestDelimiter !== ',') {\n const regex = new RegExp(bestDelimiter.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'), 'g');\n text = text.replace(regex, ',');\n }\n }\n }\n result = parse(text, {\n columns: false, // Keep as array of arrays\n skip_empty_lines: true,\n trim: true,\n });\n } else if (UploadUtil.isXlsxFile(fileName)) {\n // Parse Excel file\n const excelData = sheet\n ? await readSheet(file, sheet, { trim: true })\n : await readSheet(file, { trim: true });\n result = UploadUtil.mapExcelSheetData(excelData);\n } else {\n throw new Error('Unsupported file format. Please select a CSV or Excel file.');\n }\n if (result.length < 2 || result[0].length < 2) {\n throw new Error('The selected file does not contain enough data. Please ensure it has at least a header row and one data row.');\n }\n return result;\n }\n\n public static reportFileUploadProgress(kwArgs: {\n endPercentage: number;\n fileSize: number;\n message: string;\n onProgress: (progress: number, message: string) => void;\n startPercentage: number;\n totalFileSizeToUpload: number;\n uploadedFileSize: number;\n }): void {\n const {\n endPercentage,\n fileSize,\n message,\n onProgress,\n startPercentage,\n totalFileSizeToUpload,\n uploadedFileSize,\n } = kwArgs;\n\n const percentageRange = endPercentage - startPercentage;\n const percentageRangePerByte = percentageRange / totalFileSizeToUpload;\n const overallProgress = startPercentage + (uploadedFileSize * percentageRangePerByte) + (fileSize * percentageRangePerByte);\n\n onProgress(overallProgress, message);\n }\n\n public static async uploadFilesForCases(kwArgs: {\n assemblyProtocolId: string;\n caseBatchUploadResult: CaseDbCaseBatchUploadResult;\n completeCaseType: CaseDbCompleteCaseType;\n createdInDataCollectionId: string;\n endPercentage: number;\n mappedColumns: UploadMappedColumn[];\n onComplete: () => void;\n onError: (error: Error) => void;\n onProgress: (progress: number, message: string) => void;\n sampleIdColId: string;\n selectedValidatedCases: CaseDbCaseUploadResult[];\n sequenceFilesDataTransfer: DataTransfer;\n sequenceMapping: UploadSequenceMapping;\n sequencingProtocolId: string;\n signal: AbortSignal;\n startPercentage: number;\n }): Promise<void> {\n const {\n caseBatchUploadResult,\n endPercentage,\n onProgress,\n sequenceFilesDataTransfer,\n sequenceMapping,\n signal,\n startPercentage,\n } = kwArgs;\n\n const seqsToBeUploaded: Array<{ caseId: string; colId: string; fileName: string }> = [];\n const readSetsToBeUploaded: Array<{ caseId: string; colId: string; fileName: string; is_fwd: boolean }> = [];\n let totalFileSizeToUpload = 0;\n\n for (const [index, caseUploadResult] of caseBatchUploadResult.cases.entries()) {\n const { id } = kwArgs.selectedValidatedCases[index];\n if (sequenceMapping[id]) {\n const caseId = caseUploadResult.id;\n for (const [colId, fileName] of Object.entries(sequenceMapping[id].sequenceFileNames)) {\n if (fileName) {\n const file = Array.from(sequenceFilesDataTransfer.files).find(f => f.name === fileName);\n if (file) {\n seqsToBeUploaded.push({ caseId, colId, fileName });\n totalFileSizeToUpload = totalFileSizeToUpload + (file?.size || 0);\n }\n }\n }\n for (const [colId, fileNames] of Object.entries(sequenceMapping[id].readsFileNames)) {\n if (fileNames.fwd) {\n const file = Array.from(sequenceFilesDataTransfer.files).find(f => f.name === fileNames.fwd);\n if (file) {\n readSetsToBeUploaded.push({ caseId, colId, fileName: fileNames.fwd, is_fwd: true });\n totalFileSizeToUpload = totalFileSizeToUpload + (file?.size || 0);\n }\n }\n if (fileNames.rev) {\n const file = Array.from(sequenceFilesDataTransfer.files).find(f => f.name === fileNames.rev);\n if (file) {\n readSetsToBeUploaded.push({ caseId, colId, fileName: fileNames.rev, is_fwd: false });\n totalFileSizeToUpload = totalFileSizeToUpload + (file?.size || 0);\n }\n }\n }\n }\n }\n\n // upload in order of cases\n let uploadedFileSize = 0;\n for (const caseUploadResult of caseBatchUploadResult.cases) {\n const caseSeqToBeUploaded = seqsToBeUploaded.find(s => s.caseId === caseUploadResult.id);\n const caseReadSetsToBeUploaded = readSetsToBeUploaded.filter(rs => rs.caseId === caseUploadResult.id);\n\n if (caseSeqToBeUploaded) {\n const file = Array.from(sequenceFilesDataTransfer.files).find(f => f.name === caseSeqToBeUploaded.fileName);\n if (file) {\n const fileSize = file.size;\n const base64Data = await UploadUtil.readFileAsBase64(file);\n await CaseDbCaseApi.getInstance().createFileForSeq(caseSeqToBeUploaded.caseId, caseSeqToBeUploaded.colId, {\n file_compression: UploadUtil.getFileCompressionFromFileName(caseSeqToBeUploaded.fileName),\n file_content: base64Data,\n file_format: CaseDbSeqFileFormat.FASTA,\n }, { signal });\n UploadUtil.reportFileUploadProgress({\n endPercentage,\n fileSize,\n message: t('Uploading sequence file \"{{fileName}}\" for case ID \"{{caseId}}\"...', { caseId: caseSeqToBeUploaded.caseId, fileName: caseSeqToBeUploaded.fileName }),\n onProgress,\n startPercentage,\n totalFileSizeToUpload,\n uploadedFileSize,\n });\n uploadedFileSize += fileSize;\n }\n }\n for (const caseReadSetToBeUploaded of caseReadSetsToBeUploaded) {\n const file = Array.from(sequenceFilesDataTransfer.files).find(f => f.name === caseReadSetToBeUploaded.fileName);\n if (file) {\n const fileSize = file.size;\n const base64Data = await UploadUtil.readFileAsBase64(file);\n await CaseDbCaseApi.getInstance().createFileForReadSet(caseReadSetToBeUploaded.caseId, caseReadSetToBeUploaded.colId, {\n file_compression: UploadUtil.getFileCompressionFromFileName(caseReadSetToBeUploaded.fileName),\n file_content: base64Data,\n file_format: CaseDbReadsFileFormat.FASTQ,\n is_fwd: caseReadSetToBeUploaded.is_fwd,\n }, { signal });\n UploadUtil.reportFileUploadProgress({\n endPercentage,\n fileSize,\n message: t('Uploading read set file \"{{fileName}}\" for case ID \"{{caseId}}\"...', { caseId: caseReadSetToBeUploaded.caseId, fileName: caseReadSetToBeUploaded.fileName }),\n onProgress,\n startPercentage,\n totalFileSizeToUpload,\n uploadedFileSize,\n });\n uploadedFileSize += fileSize;\n }\n }\n }\n }\n\n private static getFileCompressionFromFileName(fileName: string): CaseDbFileCompression {\n const lowerFileName = fileName.toLowerCase();\n if (lowerFileName.endsWith('.gz') || lowerFileName.endsWith('.gzip')) {\n return CaseDbFileCompression.GZIP;\n }\n return CaseDbFileCompression.NONE;\n }\n\n private static idToRegex(id: string): RegExp {\n // Create regex that matches the id somewhere in a string\n return new RegExp(id.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'));\n }\n\n private static mapExcelCellToString(cell: CellValue | null): string {\n if (cell instanceof Date) {\n return format(cell, DATE_FORMAT.DATE);\n }\n if (cell === null || cell === undefined) {\n return '';\n }\n return cell.toString();\n }\n\n private static mapExcelSheetData(sheetData: SheetData): string[][] {\n return sheetData.map(row => row.map(cell => UploadUtil.mapExcelCellToString(cell)));\n }\n}\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41],"mappings":";;;;;;;;;;;;;;;;;AAMA,IAAM,IAAmC;AAoBzC,SAAwB,EAA4B,GAAiB;CACjE,IAAM,IAAY,CAAC,GACb,IAAY,CAAC,GACb,IAAa,EAAgB,GAC7B,IAA0B,EAAgB,SAAS,GACnD,IAAkB,EAAwB,MAAM,EAAwB,QAAQ,GAAG,IAAI,GAAG,EAAwB,YAAY,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAI,MAAK,EAAE,KAAK,CAAC;CAMtK,KAAK,IAAM,KAAQ,GACf,IAAI,CAAC,EAAiC,KAAK,CAAI,GAC3C,MAAU,MAAM,4BAA4B,GAAM;CAG1D,IAAI,IAAI;CACR,OAAO,IAAI,EAAW,SAAQ;EAC1B,IAAI,IAAO,EAAgB,IACvB,IAAQ,EAAW;EAUvB,AATI,OAAO,KAAU,aACjB,EAAU,KAAQ,EAAsB,GAAO,CAAI,IAMnD,EAAU,KAAQ,GAEtB;CACJ;CACA,OAAO;EACH;EACA;CACJ;AACJ;AAeA,SAAS,EAAsB,GAAM,GAAM;CACvC,IAAM,IAAiB,EAAK,SAAS;CAGrC,IAAI,EAAK,WAAW;EAKhB,IAAI,EAAe,QAAQ,eAAe,KAAK,GAAG;GAE9C,IAAM,IAAmB,EAAe,QAAQ,KAAK,CAAiB,IAAI,GACpE,IAAqB,EAAe,QAAQ,KAAK,CAAgB;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