read-excel-file 9.3.4 → 9.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -2
- package/README.md +32 -2
- package/browser/index.cjs +3 -0
- package/browser/index.d.ts +16 -0
- package/browser/index.js +4 -1
- package/bundle/read-excel-file.min.js +1 -1
- package/bundle/read-excel-file.min.js.map +1 -1
- package/commonjs/export/convertInputToNodeStream.js +0 -12
- package/commonjs/export/convertInputToNodeStream.js.map +1 -1
- package/commonjs/export/parseSheet.js +14 -7
- package/commonjs/export/parseSheet.js.map +1 -1
- package/commonjs/export/readSheetBrowser.js +3 -6
- package/commonjs/export/readSheetBrowser.js.map +1 -1
- package/commonjs/export/readSheetNode.js +3 -6
- package/commonjs/export/readSheetNode.js.map +1 -1
- package/commonjs/export/readSheetUniversal.js +2 -2
- package/commonjs/export/readSheetUniversal.js.map +1 -1
- package/commonjs/export/readSheetWebWorker.js +5 -5
- package/commonjs/export/readSheetWebWorker.js.map +1 -1
- package/commonjs/export/readXlsxFileBrowser.js +3 -6
- package/commonjs/export/readXlsxFileBrowser.js.map +1 -1
- package/commonjs/export/readXlsxFileNode.js +3 -6
- package/commonjs/export/readXlsxFileNode.js.map +1 -1
- package/commonjs/export/readXlsxFileUniversal.js +2 -2
- package/commonjs/export/readXlsxFileUniversal.js.map +1 -1
- package/commonjs/export/readXlsxFileWebWorker.js +5 -5
- package/commonjs/export/readXlsxFileWebWorker.js.map +1 -1
- package/commonjs/export/unpackXlsxFileBrowser.js +15 -4
- package/commonjs/export/unpackXlsxFileBrowser.js.map +1 -1
- package/commonjs/export/unpackXlsxFileBrowser.test.js.map +1 -0
- package/commonjs/export/unpackXlsxFileNode.js +32 -5
- package/commonjs/export/unpackXlsxFileNode.js.map +1 -1
- package/commonjs/export/unpackXlsxFileNode.test.js.map +1 -0
- package/commonjs/export/unpackXlsxFileUniversal.js +14 -3
- package/commonjs/export/unpackXlsxFileUniversal.js.map +1 -1
- package/commonjs/export/unpackXlsxFileUniversal.test.js.map +1 -0
- package/commonjs/parseSheetData/parseSheetData.js +9 -6
- package/commonjs/parseSheetData/parseSheetData.js.map +1 -1
- package/commonjs/utility/convertValuesFromUint8ArraysToStrings.js +100 -0
- package/commonjs/utility/convertValuesFromUint8ArraysToStrings.js.map +1 -0
- package/commonjs/xlsx/InvalidSpreadsheetError.js +55 -0
- package/commonjs/xlsx/InvalidSpreadsheetError.js.map +1 -0
- package/commonjs/xlsx/SheetNotFoundError.js +55 -0
- package/commonjs/xlsx/SheetNotFoundError.js.map +1 -0
- package/commonjs/xlsx/file/InputValidationStream.js +101 -0
- package/commonjs/xlsx/file/InputValidationStream.js.map +1 -0
- package/commonjs/xlsx/file/InputValidationStream.test.js.map +1 -0
- package/commonjs/xlsx/file/InvalidInputError.js +105 -0
- package/commonjs/xlsx/file/InvalidInputError.js.map +1 -0
- package/commonjs/xlsx/file/createFileTypeDetector.js +70 -0
- package/commonjs/xlsx/file/createFileTypeDetector.js.map +1 -0
- package/commonjs/xlsx/file/createFileTypeDetector.test.js.map +1 -0
- package/commonjs/xlsx/file/validateLeadingBytes.js +47 -0
- package/commonjs/xlsx/file/validateLeadingBytes.js.map +1 -0
- package/commonjs/xlsx/file/validateLeadingBytes.test.js.map +1 -0
- package/commonjs/xlsx/isDateFormat.js +32 -27
- package/commonjs/xlsx/isDateFormat.js.map +1 -1
- package/commonjs/xlsx/isDateFormatStyle.js +19 -21
- package/commonjs/xlsx/isDateFormatStyle.js.map +1 -1
- package/commonjs/xlsx/parseCell.js +252 -115
- package/commonjs/xlsx/parseCell.js.map +1 -1
- package/commonjs/xlsx/parseCellAddress.js +22 -18
- package/commonjs/xlsx/parseCellAddress.js.map +1 -1
- package/commonjs/xlsx/parseExcelDate.js +4 -124
- package/commonjs/xlsx/parseExcelDate.js.map +1 -1
- package/commonjs/xlsx/parseExcelDate.test.js.map +1 -1
- package/commonjs/xlsx/parseExcelTimestamp.js +139 -0
- package/commonjs/xlsx/parseExcelTimestamp.js.map +1 -0
- package/commonjs/xlsx/parseFilePaths.js +48 -47
- package/commonjs/xlsx/parseFilePaths.js.map +1 -1
- package/commonjs/xlsx/parseSharedStrings.js +91 -36
- package/commonjs/xlsx/parseSharedStrings.js.map +1 -1
- package/commonjs/xlsx/parseSheet.js +527 -69
- package/commonjs/xlsx/parseSheet.js.map +1 -1
- package/commonjs/xlsx/parseSpreadsheetContents.js +154 -83
- package/commonjs/xlsx/parseSpreadsheetContents.js.map +1 -1
- package/commonjs/xlsx/parseSpreadsheetInfo.js +60 -59
- package/commonjs/xlsx/parseSpreadsheetInfo.js.map +1 -1
- package/commonjs/xlsx/parseStyles.js +75 -75
- package/commonjs/xlsx/parseStyles.js.map +1 -1
- package/commonjs/xml/parseXml.js +112 -0
- package/commonjs/xml/parseXml.js.map +1 -0
- package/commonjs/xml/parseXml.test.js.map +1 -0
- package/commonjs/xml/parseXmlStream.js.map +1 -1
- package/commonjs/xml/parseXmlStream.sax.js +69 -28
- package/commonjs/xml/parseXmlStream.sax.js.map +1 -1
- package/commonjs/xml/parseXmlStream.saxen.js +66 -40
- package/commonjs/xml/parseXmlStream.saxen.js.map +1 -1
- package/commonjs/zip/UnzipError.js +55 -0
- package/commonjs/zip/UnzipError.js.map +1 -0
- package/commonjs/zip/unzipFromArrayBuffer.js +21 -1
- package/commonjs/zip/unzipFromArrayBuffer.js.map +1 -1
- package/commonjs/zip/unzipFromArrayBuffer.test.js.map +1 -0
- package/commonjs/zip/unzipFromStream.fflate.js +43 -35
- package/commonjs/zip/unzipFromStream.fflate.js.map +1 -1
- package/commonjs/zip/unzipFromStream.js +188 -6
- package/commonjs/zip/unzipFromStream.js.map +1 -1
- package/commonjs/zip/unzipFromStream.unzipper.js +19 -34
- package/commonjs/zip/unzipFromStream.unzipper.js.map +1 -1
- package/modules/export/convertInputToNodeStream.js +0 -12
- package/modules/export/convertInputToNodeStream.js.map +1 -1
- package/modules/export/parseSheet.js +13 -6
- package/modules/export/parseSheet.js.map +1 -1
- package/modules/export/readSheetBrowser.js +3 -5
- package/modules/export/readSheetBrowser.js.map +1 -1
- package/modules/export/readSheetNode.js +3 -5
- package/modules/export/readSheetNode.js.map +1 -1
- package/modules/export/readSheetUniversal.js +2 -2
- package/modules/export/readSheetUniversal.js.map +1 -1
- package/modules/export/readSheetWebWorker.js +7 -8
- package/modules/export/readSheetWebWorker.js.map +1 -1
- package/modules/export/readXlsxFileBrowser.js +3 -5
- package/modules/export/readXlsxFileBrowser.js.map +1 -1
- package/modules/export/readXlsxFileNode.js +3 -5
- package/modules/export/readXlsxFileNode.js.map +1 -1
- package/modules/export/readXlsxFileUniversal.js +2 -2
- package/modules/export/readXlsxFileUniversal.js.map +1 -1
- package/modules/export/readXlsxFileWebWorker.js +7 -8
- package/modules/export/readXlsxFileWebWorker.js.map +1 -1
- package/modules/export/unpackXlsxFileBrowser.js +15 -4
- package/modules/export/unpackXlsxFileBrowser.js.map +1 -1
- package/modules/export/unpackXlsxFileBrowser.test.js.map +1 -0
- package/modules/export/unpackXlsxFileNode.js +32 -5
- package/modules/export/unpackXlsxFileNode.js.map +1 -1
- package/modules/export/unpackXlsxFileNode.test.js.map +1 -0
- package/modules/export/unpackXlsxFileUniversal.js +14 -3
- package/modules/export/unpackXlsxFileUniversal.js.map +1 -1
- package/modules/export/unpackXlsxFileUniversal.test.js.map +1 -0
- package/modules/parseSheetData/parseSheetData.js +9 -6
- package/modules/parseSheetData/parseSheetData.js.map +1 -1
- package/modules/utility/convertValuesFromUint8ArraysToStrings.js +92 -0
- package/modules/utility/convertValuesFromUint8ArraysToStrings.js.map +1 -0
- package/modules/xlsx/InvalidSpreadsheetError.js +50 -0
- package/modules/xlsx/InvalidSpreadsheetError.js.map +1 -0
- package/modules/xlsx/SheetNotFoundError.js +50 -0
- package/modules/xlsx/SheetNotFoundError.js.map +1 -0
- package/modules/xlsx/file/InputValidationStream.js +96 -0
- package/modules/xlsx/file/InputValidationStream.js.map +1 -0
- package/modules/xlsx/file/InputValidationStream.test.js.map +1 -0
- package/modules/xlsx/file/InvalidInputError.js +100 -0
- package/modules/xlsx/file/InvalidInputError.js.map +1 -0
- package/modules/xlsx/file/createFileTypeDetector.js +63 -0
- package/modules/xlsx/file/createFileTypeDetector.js.map +1 -0
- package/modules/xlsx/file/createFileTypeDetector.test.js.map +1 -0
- package/modules/xlsx/file/validateLeadingBytes.js +37 -0
- package/modules/xlsx/file/validateLeadingBytes.js.map +1 -0
- package/modules/xlsx/file/validateLeadingBytes.test.js.map +1 -0
- package/modules/xlsx/isDateFormat.js +31 -27
- package/modules/xlsx/isDateFormat.js.map +1 -1
- package/modules/xlsx/isDateFormatStyle.js +18 -21
- package/modules/xlsx/isDateFormatStyle.js.map +1 -1
- package/modules/xlsx/parseCell.js +251 -111
- package/modules/xlsx/parseCell.js.map +1 -1
- package/modules/xlsx/parseCellAddress.js +21 -18
- package/modules/xlsx/parseCellAddress.js.map +1 -1
- package/modules/xlsx/parseExcelDate.js +4 -124
- package/modules/xlsx/parseExcelDate.js.map +1 -1
- package/modules/xlsx/parseExcelDate.test.js.map +1 -1
- package/modules/xlsx/parseExcelTimestamp.js +133 -0
- package/modules/xlsx/parseExcelTimestamp.js.map +1 -0
- package/modules/xlsx/parseFilePaths.js +48 -47
- package/modules/xlsx/parseFilePaths.js.map +1 -1
- package/modules/xlsx/parseSharedStrings.js +91 -37
- package/modules/xlsx/parseSharedStrings.js.map +1 -1
- package/modules/xlsx/parseSheet.js +526 -68
- package/modules/xlsx/parseSheet.js.map +1 -1
- package/modules/xlsx/parseSpreadsheetContents.js +153 -81
- package/modules/xlsx/parseSpreadsheetContents.js.map +1 -1
- package/modules/xlsx/parseSpreadsheetInfo.js +60 -59
- package/modules/xlsx/parseSpreadsheetInfo.js.map +1 -1
- package/modules/xlsx/parseStyles.js +75 -75
- package/modules/xlsx/parseStyles.js.map +1 -1
- package/modules/xml/parseXml.js +106 -0
- package/modules/xml/parseXml.js.map +1 -0
- package/modules/xml/parseXml.test.js.map +1 -0
- package/modules/xml/parseXmlStream.js +2 -0
- package/modules/xml/parseXmlStream.js.map +1 -1
- package/modules/xml/parseXmlStream.sax.js +69 -28
- package/modules/xml/parseXmlStream.sax.js.map +1 -1
- package/modules/xml/parseXmlStream.saxen.js +67 -40
- package/modules/xml/parseXmlStream.saxen.js.map +1 -1
- package/modules/zip/UnzipError.js +49 -0
- package/modules/zip/UnzipError.js.map +1 -0
- package/modules/zip/unzipFromArrayBuffer.js +21 -1
- package/modules/zip/unzipFromArrayBuffer.js.map +1 -1
- package/modules/zip/unzipFromArrayBuffer.test.js.map +1 -0
- package/modules/zip/unzipFromStream.fflate.js +41 -35
- package/modules/zip/unzipFromStream.fflate.js.map +1 -1
- package/modules/zip/unzipFromStream.js +124 -1
- package/modules/zip/unzipFromStream.js.map +1 -1
- package/modules/zip/unzipFromStream.unzipper.js +19 -35
- package/modules/zip/unzipFromStream.unzipper.js.map +1 -1
- package/node/index.cjs +3 -0
- package/node/index.d.ts +16 -0
- package/node/index.js +3 -0
- package/package.json +5 -3
- package/types/InvalidInputError.d.ts +16 -0
- package/types/InvalidSpreadsheetError.d.ts +4 -0
- package/types/SheetNotFoundError.d.ts +4 -0
- package/universal/index.cjs +3 -0
- package/universal/index.d.ts +16 -0
- package/universal/index.js +3 -0
- package/web-worker/index.cjs +3 -0
- package/web-worker/index.d.ts +16 -0
- package/web-worker/index.js +3 -0
- package/commonjs/export/convertValuesFromUint8ArraysToStrings.js +0 -23
- package/commonjs/export/convertValuesFromUint8ArraysToStrings.js.map +0 -1
- package/commonjs/xlsx/convertCellsToData2dArray.js +0 -84
- package/commonjs/xlsx/convertCellsToData2dArray.js.map +0 -1
- package/commonjs/xlsx/dropEmptyColumns.js +0 -40
- package/commonjs/xlsx/dropEmptyColumns.js.map +0 -1
- package/commonjs/xlsx/dropEmptyColumns.test.js.map +0 -1
- package/commonjs/xlsx/dropEmptyRows.js +0 -43
- package/commonjs/xlsx/dropEmptyRows.js.map +0 -1
- package/commonjs/xlsx/dropEmptyRows.test.js.map +0 -1
- package/commonjs/xlsx/parseCellValue.js +0 -189
- package/commonjs/xlsx/parseCellValue.js.map +0 -1
- package/commonjs/xlsx/parseNumber.js +0 -20
- package/commonjs/xlsx/parseNumber.js.map +0 -1
- package/commonjs/xlsx/parseSharedString.js +0 -64
- package/commonjs/xlsx/parseSharedString.js.map +0 -1
- package/commonjs/xlsx/parseSheetData.js +0 -68
- package/commonjs/xlsx/parseSheetData.js.map +0 -1
- package/commonjs/xlsx/reconstructSheetDimensionsFromSheetCells.js +0 -29
- package/commonjs/xlsx/reconstructSheetDimensionsFromSheetCells.js.map +0 -1
- package/commonjs/xml/parseXmlStream.saxen.code.js +0 -953
- package/commonjs/xml/parseXmlStream.saxen.code.js.map +0 -1
- package/commonjs/xml/parseXmlStream.test.js.map +0 -1
- package/modules/export/convertValuesFromUint8ArraysToStrings.js +0 -17
- package/modules/export/convertValuesFromUint8ArraysToStrings.js.map +0 -1
- package/modules/xlsx/convertCellsToData2dArray.js +0 -77
- package/modules/xlsx/convertCellsToData2dArray.js.map +0 -1
- package/modules/xlsx/dropEmptyColumns.js +0 -34
- package/modules/xlsx/dropEmptyColumns.js.map +0 -1
- package/modules/xlsx/dropEmptyColumns.test.js.map +0 -1
- package/modules/xlsx/dropEmptyRows.js +0 -37
- package/modules/xlsx/dropEmptyRows.js.map +0 -1
- package/modules/xlsx/dropEmptyRows.test.js.map +0 -1
- package/modules/xlsx/parseCellValue.js +0 -183
- package/modules/xlsx/parseCellValue.js.map +0 -1
- package/modules/xlsx/parseNumber.js +0 -14
- package/modules/xlsx/parseNumber.js.map +0 -1
- package/modules/xlsx/parseSharedString.js +0 -55
- package/modules/xlsx/parseSharedString.js.map +0 -1
- package/modules/xlsx/parseSheetData.js +0 -55
- package/modules/xlsx/parseSheetData.js.map +0 -1
- package/modules/xlsx/reconstructSheetDimensionsFromSheetCells.js +0 -23
- package/modules/xlsx/reconstructSheetDimensionsFromSheetCells.js.map +0 -1
- package/modules/xml/parseXmlStream.saxen.code.js +0 -947
- package/modules/xml/parseXmlStream.saxen.code.js.map +0 -1
- package/modules/xml/parseXmlStream.test.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputValidationStream.test.js","names":["describe","it","expect","Readable","InputValidationStream","done","XLSX_FILE_FIRST_BYTES","Buffer","from","input","createReadableStreamFromBuffer","inputValidator","pipe","on","error","XLS_FILE_FIRST_BYTES","to","have","property","Error","NOT_A_ZIP_FILE_FIRST_BYTES","slice","buffer"],"sources":["../../../source/xlsx/file/InputValidationStream.test.js"],"sourcesContent":["import { describe, it } from 'mocha'\r\nimport { expect } from 'chai'\r\n\r\nimport { Readable } from 'node:stream'\r\n\r\nimport InputValidationStream from './InputValidationStream.js'\r\n\r\ndescribe('InputValidationStream', () => {\r\n\tit('should not throw when ZIP file signature is present', (done) => {\r\n\t\t// \"PK\\x03\\x04\" — a normal ZIP file signature.\r\n\t\tconst XLSX_FILE_FIRST_BYTES = Buffer.from([0x50, 0x4B, 0x03, 0x04])\r\n\r\n\t\tconst input = createReadableStreamFromBuffer(XLSX_FILE_FIRST_BYTES)\r\n\t\tconst inputValidator = new InputValidationStream()\r\n\r\n\t\tinput.pipe(inputValidator)\r\n\t\t\t.on('error', (error) => {\r\n\t\t\t\tdone(error)\r\n\t\t\t})\r\n\t\t\t.on('finish', () => {\r\n\t\t\t\tdone()\r\n\t\t\t})\r\n\t})\r\n\r\n\tit('should throw when it detects a legacy binary `.xls` file (CFB signature)', (done) => {\r\n\t\tconst XLS_FILE_FIRST_BYTES = Buffer.from([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1])\r\n\r\n\t\tconst input = createReadableStreamFromBuffer(XLS_FILE_FIRST_BYTES)\r\n\t\tconst inputValidator = new InputValidationStream()\r\n\r\n\t\tinput.pipe(inputValidator)\r\n\t\t\t.on('error', (error) => {\r\n\t\t\t\texpect(error).to.have.property('name', 'InvalidInputError')\r\n\t\t\t\texpect(error).to.have.property('code', 'XLS_FILE_NOT_SUPPORTED')\r\n\t\t\t\tdone()\r\n\t\t\t})\r\n\t\t\t.on('finish', () => {\r\n\t\t\t\tdone(new Error('Expected to throw `InvalidInputError`'))\r\n\t\t\t})\r\n\t})\r\n\r\n\tit('should throw when it encounters a non-ZIP file signature', (done) => {\r\n\t\tconst NOT_A_ZIP_FILE_FIRST_BYTES = Buffer.from([0x00, 0x01, 0x02, 0x03])\r\n\r\n\t\tconst input = createReadableStreamFromBuffer(NOT_A_ZIP_FILE_FIRST_BYTES)\r\n\t\tconst inputValidator = new InputValidationStream()\r\n\r\n\t\tinput.pipe(inputValidator)\r\n\t\t\t.on('error', (error) => {\r\n\t\t\t\texpect(error).to.have.property('name', 'InvalidInputError')\r\n\t\t\t\texpect(error).to.have.property('code', 'FILE_NOT_SUPPORTED')\r\n\t\t\t\tdone()\r\n\t\t\t})\r\n\t\t\t.on('finish', () => {\r\n\t\t\t\tdone(new Error('Expected to throw `InvalidInputError`'))\r\n\t\t\t})\r\n\t})\r\n\r\n\tit('should throw when the input is shorter than the ZIP file signature (0 bytes)', (done) => {\r\n\t\tconst XLSX_FILE_FIRST_BYTES = Buffer.from([0x50, 0x4B, 0x03, 0x04])\r\n\r\n\t\tconst input = createReadableStreamFromBuffer(XLSX_FILE_FIRST_BYTES.slice(0, 0))\r\n\t\tconst inputValidator = new InputValidationStream()\r\n\r\n\t\tinput.pipe(inputValidator)\r\n\t\t\t.on('error', (error) => {\r\n\t\t\t\texpect(error).to.have.property('name', 'InvalidInputError')\r\n\t\t\t\texpect(error).to.have.property('code', 'NO_DATA')\r\n\t\t\t\tdone()\r\n\t\t\t})\r\n\t\t\t.on('finish', () => {\r\n\t\t\t\tdone(new Error('Expected to throw `InvalidInputError`'))\r\n\t\t\t})\r\n\t})\r\n\r\n\tit('should throw when the input is shorter than the ZIP file signature (1 byte)', (done) => {\r\n\t\tconst XLSX_FILE_FIRST_BYTES = Buffer.from([0x50, 0x4B, 0x03, 0x04])\r\n\r\n\t\tconst input = createReadableStreamFromBuffer(XLSX_FILE_FIRST_BYTES.slice(0, 1))\r\n\t\tconst inputValidator = new InputValidationStream()\r\n\r\n\t\tinput.pipe(inputValidator)\r\n\t\t\t.on('error', (error) => {\r\n\t\t\t\texpect(error).to.have.property('name', 'InvalidInputError')\r\n\t\t\t\texpect(error).to.have.property('code', 'FILE_NOT_SUPPORTED')\r\n\t\t\t\tdone()\r\n\t\t\t})\r\n\t\t\t.on('finish', () => {\r\n\t\t\t\tdone(new Error('Expected to throw `InvalidInputError`'))\r\n\t\t\t})\r\n\t})\r\n\r\n\tit('should not throw when the input is not shorter than a bare minimum ZIP file signature (2 bytes)', (done) => {\r\n\t\tconst XLSX_FILE_FIRST_BYTES = Buffer.from([0x50, 0x4B, 0x03, 0x04])\r\n\r\n\t\tconst input = createReadableStreamFromBuffer(XLSX_FILE_FIRST_BYTES.slice(0, 2))\r\n\t\tconst inputValidator = new InputValidationStream()\r\n\r\n\t\tinput.pipe(inputValidator)\r\n\t\t\t.on('error', (error) => {\r\n\t\t\t\tdone(error)\r\n\t\t\t})\r\n\t\t\t.on('finish', () => {\r\n\t\t\t\tdone()\r\n\t\t\t})\r\n\t})\r\n})\r\n\r\n// Creates a readable stream from a `Buffer`.\r\nfunction createReadableStreamFromBuffer(buffer) {\r\n\treturn Readable.from(buffer)\r\n}\r\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,QAAQ,OAAO;AACpC,SAASC,MAAM,QAAQ,MAAM;AAE7B,SAASC,QAAQ,QAAQ,aAAa;AAEtC,OAAOC,qBAAqB,MAAM,4BAA4B;AAE9DJ,QAAQ,CAAC,uBAAuB,EAAE,YAAM;EACvCC,EAAE,CAAC,qDAAqD,EAAE,UAACI,IAAI,EAAK;IACnE;IACA,IAAMC,qBAAqB,GAAGC,MAAM,CAACC,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IA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qBAAqB,CAACe,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/E,IAAMV,cAAc,GAAG,IAAIP,qBAAqB,CAAC,CAAC;IAElDK,KAAK,CAACG,IAAI,CAACD,cAAc,CAAC,CACxBE,EAAE,CAAC,OAAO,EAAE,UAACC,KAAK,EAAK;MACvBT,IAAI,CAACS,KAAK,CAAC;IACZ,CAAC,CAAC,CACDD,EAAE,CAAC,QAAQ,EAAE,YAAM;MACnBR,IAAI,CAAC,CAAC;IACP,CAAC,CAAC;EACJ,CAAC,CAAC;AACH,CAAC,CAAC;;AAEF;AACA,SAASK,8BAA8BA,CAACY,MAAM,EAAE;EAC/C,OAAOnB,QAAQ,CAACK,IAAI,CAACc,MAAM,CAAC;AAC7B"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
function _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); } }
|
|
3
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
5
|
+
function _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); }
|
|
6
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
7
|
+
function _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); }
|
|
8
|
+
function _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); }; }
|
|
9
|
+
function _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); }
|
|
10
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
11
|
+
function _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); }
|
|
12
|
+
function _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); }
|
|
13
|
+
function _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; } }
|
|
14
|
+
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
|
|
15
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
16
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
17
|
+
// This code was originally submitted by Etienne Prothon.
|
|
18
|
+
// https://gitlab.com/catamphetamine/read-excel-file/-/merge_requests/11
|
|
19
|
+
|
|
20
|
+
// An error thrown when the input passed to `readXlsxFile()` is not a valid `.xlsx` file.
|
|
21
|
+
//
|
|
22
|
+
// Carries a documented, stable `code` property that consumers can reliably
|
|
23
|
+
// branch on — same convention as the schema-parsing `InvalidError` class
|
|
24
|
+
// (`error.code`) — instead of string-matching a low-level error message
|
|
25
|
+
// leaked from a transitive dependency (Hyrum's law).
|
|
26
|
+
//
|
|
27
|
+
// The `name` property is set so that the error type can also be detected via
|
|
28
|
+
// `error.name === 'InvalidInputError'` in setups where `instanceof` is unreliable
|
|
29
|
+
// (e.g. when both the ES-module and the CommonJS builds of this package end up
|
|
30
|
+
// being loaded in the same application).
|
|
31
|
+
|
|
32
|
+
var MESSAGES = {
|
|
33
|
+
XLS_FILE_NOT_SUPPORTED: 'You passed a legacy `.xls` file. Only `.xlsx` files are supported',
|
|
34
|
+
FILE_NOT_SUPPORTED: 'Doesn\'t look like an `.xlsx` file',
|
|
35
|
+
INVALID_ZIP: 'Couldn\'t unzip `.xlsx` file contents',
|
|
36
|
+
NO_DATA: 'No data'
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// `.xlsx` files are just ZIP archives, so every valid `.xlsx` file starts with a
|
|
40
|
+
// ZIP local file header signature "PK" (`0x50 0x4B`). When the input isn't a ZIP
|
|
41
|
+
// archive, a 3rd-party unzipper library throws an obscure low-level error
|
|
42
|
+
// (for example `"invalid signature: 0xe011cfd0"` — the four leading bytes of a
|
|
43
|
+
// binary `.xls` file read in little-endian).
|
|
44
|
+
// That gives the caller nothing stable to branch on, and the exact wording can change
|
|
45
|
+
// depending on the 3rd-party unzipper library being used.
|
|
46
|
+
// This error standardizes the handling of cases when an invalid file is passed.
|
|
47
|
+
var InvalidInputError = /*#__PURE__*/function (_Error) {
|
|
48
|
+
_inherits(InvalidInputError, _Error);
|
|
49
|
+
var _super = _createSuper(InvalidInputError);
|
|
50
|
+
/**
|
|
51
|
+
* Creates an `InvalidInputError` instance.
|
|
52
|
+
* @param {string} code
|
|
53
|
+
* @param {any} [cause]
|
|
54
|
+
*/
|
|
55
|
+
function InvalidInputError(code, cause) {
|
|
56
|
+
var _this;
|
|
57
|
+
_classCallCheck(this, InvalidInputError);
|
|
58
|
+
_this = _super.call(this, MESSAGES[code] || code);
|
|
59
|
+
|
|
60
|
+
// Set `code` property.
|
|
61
|
+
_this.code = code;
|
|
62
|
+
|
|
63
|
+
// Set `name` property.
|
|
64
|
+
//
|
|
65
|
+
// This error could be detected either by `instanceof InvalidInputError`
|
|
66
|
+
// or by comparing its `name` property value to "InvalidInputError".
|
|
67
|
+
// Why use the `name` comparison when `instanceof` operator is available?
|
|
68
|
+
// Google AI tells that it does make sense in the cases when an error is
|
|
69
|
+
// "serialized" and then "deserialized" in a "distributed" environment such as
|
|
70
|
+
// throwing an error in a worker thread and then handling it in a main thread,
|
|
71
|
+
// or when throwing it in one "microservice" and then catching it in another one,
|
|
72
|
+
// or just logging as in `sentry.io`. And in those cases, `error.constructor.name`
|
|
73
|
+
// isn't always available for same reason of "serializing" and then "deserializing".
|
|
74
|
+
//
|
|
75
|
+
// For example, even if `InvalidInputError` is a named export of this package,
|
|
76
|
+
// when later bunding the application code with a bundler it will still be minified and renamed.
|
|
77
|
+
// That's when the `name` property could be used to find out the actual type of the error
|
|
78
|
+
// in case it gets thrown and reported to a remote system like `sentry.io`.
|
|
79
|
+
//
|
|
80
|
+
// By the way, core Node.js errors themselves have a `name` property.
|
|
81
|
+
//
|
|
82
|
+
_this.name = 'InvalidInputError';
|
|
83
|
+
|
|
84
|
+
// Set `cause` property.
|
|
85
|
+
//
|
|
86
|
+
// `Error.prototype.cause` property indicates the specific, original reason
|
|
87
|
+
// a given error occurred. Standardized in ES2022, it allows you to chain errors
|
|
88
|
+
// by catching a low-level exception and re-throwing a meaningful, high-level error
|
|
89
|
+
// without wiping out the diagnostic context or stack trace of the original failure.
|
|
90
|
+
//
|
|
91
|
+
// Adding a `.cause` property mimics modern error chaining for environments that support it
|
|
92
|
+
// while remaining completely harmless in older systems.
|
|
93
|
+
//
|
|
94
|
+
_this.cause = cause;
|
|
95
|
+
return _this;
|
|
96
|
+
}
|
|
97
|
+
return _createClass(InvalidInputError);
|
|
98
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
99
|
+
export { InvalidInputError as default };
|
|
100
|
+
//# sourceMappingURL=InvalidInputError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InvalidInputError.js","names":["MESSAGES","XLS_FILE_NOT_SUPPORTED","FILE_NOT_SUPPORTED","INVALID_ZIP","NO_DATA","InvalidInputError","_Error","_inherits","_super","_createSuper","code","cause","_this","_classCallCheck","call","name","_createClass","_wrapNativeSuper","Error","default"],"sources":["../../../source/xlsx/file/InvalidInputError.js"],"sourcesContent":["// This code was originally submitted by Etienne Prothon.\r\n// https://gitlab.com/catamphetamine/read-excel-file/-/merge_requests/11\r\n\r\n// An error thrown when the input passed to `readXlsxFile()` is not a valid `.xlsx` file.\r\n//\r\n// Carries a documented, stable `code` property that consumers can reliably\r\n// branch on — same convention as the schema-parsing `InvalidError` class\r\n// (`error.code`) — instead of string-matching a low-level error message\r\n// leaked from a transitive dependency (Hyrum's law).\r\n//\r\n// The `name` property is set so that the error type can also be detected via\r\n// `error.name === 'InvalidInputError'` in setups where `instanceof` is unreliable\r\n// (e.g. when both the ES-module and the CommonJS builds of this package end up\r\n// being loaded in the same application).\r\n\r\nconst MESSAGES = {\r\n\tXLS_FILE_NOT_SUPPORTED:\r\n\t\t'You passed a legacy `.xls` file. Only `.xlsx` files are supported',\r\n\tFILE_NOT_SUPPORTED:\r\n\t\t'Doesn\\'t look like an `.xlsx` file',\r\n\tINVALID_ZIP:\r\n\t\t'Couldn\\'t unzip `.xlsx` file contents',\r\n\tNO_DATA:\r\n\t\t'No data'\r\n}\r\n\r\n// `.xlsx` files are just ZIP archives, so every valid `.xlsx` file starts with a\r\n// ZIP local file header signature \"PK\" (`0x50 0x4B`). When the input isn't a ZIP\r\n// archive, a 3rd-party unzipper library throws an obscure low-level error\r\n// (for example `\"invalid signature: 0xe011cfd0\"` — the four leading bytes of a\r\n// binary `.xls` file read in little-endian).\r\n// That gives the caller nothing stable to branch on, and the exact wording can change\r\n// depending on the 3rd-party unzipper library being used.\r\n// This error standardizes the handling of cases when an invalid file is passed.\r\nexport default class InvalidInputError extends Error {\r\n\t/**\r\n\t * Creates an `InvalidInputError` instance.\r\n\t * @param {string} code\r\n\t * @param {any} [cause]\r\n\t */\r\n\tconstructor(code, cause) {\r\n\t\tsuper(MESSAGES[code] || code)\r\n\r\n\t\t// Set `code` property.\r\n\t\tthis.code = code\r\n\r\n\t\t// Set `name` property.\r\n\t\t//\r\n\t\t// This error could be detected either by `instanceof InvalidInputError`\r\n\t\t// or by comparing its `name` property value to \"InvalidInputError\".\r\n\t\t// Why use the `name` comparison when `instanceof` operator is available?\r\n\t\t// Google AI tells that it does make sense in the cases when an error is\r\n\t\t// \"serialized\" and then \"deserialized\" in a \"distributed\" environment such as\r\n\t\t// throwing an error in a worker thread and then handling it in a main thread,\r\n\t\t// or when throwing it in one \"microservice\" and then catching it in another one,\r\n\t\t// or just logging as in `sentry.io`. And in those cases, `error.constructor.name`\r\n\t\t// isn't always available for same reason of \"serializing\" and then \"deserializing\".\r\n\t\t//\r\n\t\t// For example, even if `InvalidInputError` is a named export of this package,\r\n\t\t// when later bunding the application code with a bundler it will still be minified and renamed.\r\n\t\t// That's when the `name` property could be used to find out the actual type of the error\r\n\t\t// in case it gets thrown and reported to a remote system like `sentry.io`.\r\n\t\t//\r\n\t\t// By the way, core Node.js errors themselves have a `name` property.\r\n\t\t//\r\n\t\tthis.name = 'InvalidInputError'\r\n\r\n\t\t// Set `cause` property.\r\n\t\t//\r\n\t\t// `Error.prototype.cause` property indicates the specific, original reason\r\n\t\t// a given error occurred. Standardized in ES2022, it allows you to chain errors\r\n\t\t// by catching a low-level exception and re-throwing a meaningful, high-level error\r\n\t\t// without wiping out the diagnostic context or stack trace of the original failure.\r\n\t\t//\r\n\t\t// Adding a `.cause` property mimics modern error chaining for environments that support it\r\n\t\t// while remaining completely harmless in older systems.\r\n\t\t//\r\n\t\tthis.cause = cause\r\n\t}\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,IAAMA,QAAQ,GAAG;EAChBC,sBAAsB,EACrB,mEAAmE;EACpEC,kBAAkB,EACjB,oCAAoC;EACrCC,WAAW,EACV,uCAAuC;EACxCC,OAAO,EACN;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,IACqBC,iBAAiB,0BAAAC,MAAA;EAAAC,SAAA,CAAAF,iBAAA,EAAAC,MAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,iBAAA;EACrC;AACD;AACA;AACA;AACA;EACC,SAAAA,kBAAYK,IAAI,EAAEC,KAAK,EAAE;IAAA,IAAAC,KAAA;IAAAC,eAAA,OAAAR,iBAAA;IACxBO,KAAA,GAAAJ,MAAA,CAAAM,IAAA,OAAMd,QAAQ,CAACU,IAAI,CAAC,IAAIA,IAAI;;IAE5B;IACAE,KAAA,CAAKF,IAAI,GAAGA,IAAI;;IAEhB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACAE,KAAA,CAAKG,IAAI,GAAG,mBAAmB;;IAE/B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACAH,KAAA,CAAKD,KAAK,GAAGA,KAAK;IAAA,OAAAC,KAAA;EACnB;EAAC,OAAAI,YAAA,CAAAX,iBAAA;AAAA,gBAAAY,gBAAA,CA5C6CC,KAAK;AAAA,SAA/Bb,iBAAiB,IAAAc,OAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// This code was originally submitted by Etienne Prothon.
|
|
2
|
+
// https://gitlab.com/catamphetamine/read-excel-file/-/merge_requests/11
|
|
3
|
+
|
|
4
|
+
// ZIP local file header signature: "PK\x03\x04". The first two bytes "PK" are
|
|
5
|
+
// shared by every ZIP variant (including the empty-archive `PK\x05\x06` and the
|
|
6
|
+
// spanned `PK\x07\x08` markers), so matching just "PK" up front avoids rejecting
|
|
7
|
+
// any valid — if unusual — archive; anything malformed past that point is still
|
|
8
|
+
// caught by the actual unzipper.
|
|
9
|
+
var ZIP_FILE_SIGNATURE = [0x50, 0x4B];
|
|
10
|
+
|
|
11
|
+
// The first four bytes of the OLE2 Compound File Binary format (`0xD0 0xCF 0x11 0xE0`),
|
|
12
|
+
// which is the container of legacy binary `.xls` files.
|
|
13
|
+
var XLS_FILE_SIGNATURE = [0xD0, 0xCF, 0x11, 0xE0];
|
|
14
|
+
var FILE_TYPE_SIGNATURES = [ZIP_FILE_SIGNATURE, XLS_FILE_SIGNATURE];
|
|
15
|
+
|
|
16
|
+
// File type "enum".
|
|
17
|
+
export var XLSX_FILE_TYPE = FILE_TYPE_SIGNATURES.indexOf(ZIP_FILE_SIGNATURE);
|
|
18
|
+
export var XLS_FILE_TYPE = FILE_TYPE_SIGNATURES.indexOf(XLS_FILE_SIGNATURE);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Creates a function get determines a file type based on the leading bytes.
|
|
22
|
+
* @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.
|
|
23
|
+
* @throws {InvalidInputError}
|
|
24
|
+
*/
|
|
25
|
+
export default function createFileTypeDetector() {
|
|
26
|
+
var type;
|
|
27
|
+
var possibleTypes = indexesOf(FILE_TYPE_SIGNATURES);
|
|
28
|
+
var i = 0;
|
|
29
|
+
// Returns a function that should be called for each leading byte of the file
|
|
30
|
+
// until it starts returning a number.
|
|
31
|
+
return function (_byte) {
|
|
32
|
+
// If the type of the file is still being determined.
|
|
33
|
+
if (isNaN(type)) {
|
|
34
|
+
var t;
|
|
35
|
+
possibleTypes = possibleTypes.filter(function (typeIndex) {
|
|
36
|
+
if (_byte === FILE_TYPE_SIGNATURES[typeIndex][i]) {
|
|
37
|
+
if (FILE_TYPE_SIGNATURES[typeIndex].length === i + 1) {
|
|
38
|
+
t = typeIndex;
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
if (possibleTypes.length === 1) {
|
|
44
|
+
type = t;
|
|
45
|
+
} else if (possibleTypes.length === 0) {
|
|
46
|
+
// `type: -1` means "the type of the file couldn't be determined"
|
|
47
|
+
type = -1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
i++;
|
|
51
|
+
return type;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function indexesOf(array) {
|
|
55
|
+
var indexes = [];
|
|
56
|
+
var i = 0;
|
|
57
|
+
while (i < array.length) {
|
|
58
|
+
indexes.push(i);
|
|
59
|
+
i++;
|
|
60
|
+
}
|
|
61
|
+
return indexes;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=createFileTypeDetector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createFileTypeDetector.js","names":["ZIP_FILE_SIGNATURE","XLS_FILE_SIGNATURE","FILE_TYPE_SIGNATURES","XLSX_FILE_TYPE","indexOf","XLS_FILE_TYPE","createFileTypeDetector","type","possibleTypes","indexesOf","i","byte","isNaN","t","filter","typeIndex","length","array","indexes","push"],"sources":["../../../source/xlsx/file/createFileTypeDetector.js"],"sourcesContent":["// This code was originally submitted by Etienne Prothon.\r\n// https://gitlab.com/catamphetamine/read-excel-file/-/merge_requests/11\r\n\r\n// ZIP local file header signature: \"PK\\x03\\x04\". The first two bytes \"PK\" are\r\n// shared by every ZIP variant (including the empty-archive `PK\\x05\\x06` and the\r\n// spanned `PK\\x07\\x08` markers), so matching just \"PK\" up front avoids rejecting\r\n// any valid — if unusual — archive; anything malformed past that point is still\r\n// caught by the actual unzipper.\r\nconst ZIP_FILE_SIGNATURE = [0x50, 0x4B]\r\n\r\n// The first four bytes of the OLE2 Compound File Binary format (`0xD0 0xCF 0x11 0xE0`),\r\n// which is the container of legacy binary `.xls` files.\r\nconst XLS_FILE_SIGNATURE = [0xD0, 0xCF, 0x11, 0xE0]\r\n\r\nconst FILE_TYPE_SIGNATURES = [\r\n\tZIP_FILE_SIGNATURE,\r\n\tXLS_FILE_SIGNATURE\r\n]\r\n\r\n// File type \"enum\".\r\nexport const XLSX_FILE_TYPE = FILE_TYPE_SIGNATURES.indexOf(ZIP_FILE_SIGNATURE)\r\nexport const XLS_FILE_TYPE = FILE_TYPE_SIGNATURES.indexOf(XLS_FILE_SIGNATURE)\r\n\r\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 */\r\nexport default function createFileTypeDetector() {\r\n\tlet type\r\n\tlet possibleTypes = indexesOf(FILE_TYPE_SIGNATURES)\r\n\tlet i = 0\r\n\t// Returns a function that should be called for each leading byte of the file\r\n\t// until it starts returning a number.\r\n\treturn (byte) => {\r\n\t\t// If the type of the file is still being determined.\r\n\t\tif (isNaN(type)) {\r\n\t\t\tlet t\r\n\t\t\tpossibleTypes = possibleTypes.filter((typeIndex) => {\r\n\t\t\t\tif (byte === FILE_TYPE_SIGNATURES[typeIndex][i]) {\r\n\t\t\t\t\tif (FILE_TYPE_SIGNATURES[typeIndex].length === i + 1) {\r\n\t\t\t\t\t\tt = typeIndex\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn true\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\tif (possibleTypes.length === 1) {\r\n\t\t\t\ttype = t\r\n\t\t\t} else if (possibleTypes.length === 0) {\r\n\t\t\t\t// `type: -1` means \"the type of the file couldn't be determined\"\r\n\t\t\t\ttype = -1\r\n\t\t\t}\r\n\t\t}\r\n\t\ti++\r\n\t\treturn type\r\n\t}\r\n}\r\n\r\nfunction indexesOf(array) {\r\n\tconst indexes = []\r\n\tlet i = 0\r\n\twhile (i < array.length) {\r\n\t\tindexes.push(i)\r\n\t\ti++\r\n\t}\r\n\treturn indexes\r\n}"],"mappings":"AAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAMA,kBAAkB,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC;;AAEvC;AACA;AACA,IAAMC,kBAAkB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;AAEnD,IAAMC,oBAAoB,GAAG,CAC5BF,kBAAkB,EAClBC,kBAAkB,CAClB;;AAED;AACA,OAAO,IAAME,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ypeDetector.test.js","names":["describe","it","expect","createFileTypeDetector","XLSX_FILE_TYPE","XLS_FILE_TYPE","InvalidInputError","XLSX_FILE_FIRST_BYTES","fileTypeDetector","to","be","undefined","equal","XLS_FILE_FIRST_BYTES","NOT_A_ZIP_FILE_FIRST_BYTES"],"sources":["../../../source/xlsx/file/createFileTypeDetector.test.js"],"sourcesContent":["import { describe, it } from 'mocha'\r\nimport { expect } from 'chai'\r\n\r\nimport createFileTypeDetector, { XLSX_FILE_TYPE, XLS_FILE_TYPE } from './createFileTypeDetector.js'\r\nimport InvalidInputError from './InvalidInputError.js'\r\n\r\ndescribe('createFileTypeDetector', () => {\r\n\tit('should not throw when ZIP file signature is present', () => {\r\n\t\t// \"PK\\x03\\x04\" — a normal ZIP file signature.\r\n\t\tconst XLSX_FILE_FIRST_BYTES = [0x50, 0x4B, 0x03, 0x04]\r\n\t\tconst fileTypeDetector = createFileTypeDetector()\r\n\t\texpect(fileTypeDetector(XLSX_FILE_FIRST_BYTES[0])).to.be.undefined\r\n\t\texpect(fileTypeDetector(XLSX_FILE_FIRST_BYTES[1])).to.equal(XLSX_FILE_TYPE)\r\n\t\texpect(fileTypeDetector(XLSX_FILE_FIRST_BYTES[2])).to.equal(XLSX_FILE_TYPE)\r\n\t\texpect(fileTypeDetector(XLSX_FILE_FIRST_BYTES[3])).to.equal(XLSX_FILE_TYPE)\r\n\t})\r\n\r\n\tit('should throw when it detects a legacy binary `.xls` file (CFB signature)', () => {\r\n\t\tconst XLS_FILE_FIRST_BYTES = [0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1]\r\n\t\tconst fileTypeDetector = createFileTypeDetector()\r\n\t\texpect(fileTypeDetector(XLS_FILE_FIRST_BYTES[0])).to.be.undefined\r\n\t\texpect(fileTypeDetector(XLS_FILE_FIRST_BYTES[1])).to.be.undefined\r\n\t\texpect(fileTypeDetector(XLS_FILE_FIRST_BYTES[2])).to.be.undefined\r\n\t\texpect(fileTypeDetector(XLS_FILE_FIRST_BYTES[3])).to.equal(XLS_FILE_TYPE)\r\n\t\texpect(fileTypeDetector(XLS_FILE_FIRST_BYTES[4])).to.equal(XLS_FILE_TYPE)\r\n\t\texpect(fileTypeDetector(XLS_FILE_FIRST_BYTES[5])).to.equal(XLS_FILE_TYPE)\r\n\t\texpect(fileTypeDetector(XLS_FILE_FIRST_BYTES[6])).to.equal(XLS_FILE_TYPE)\r\n\t\texpect(fileTypeDetector(XLS_FILE_FIRST_BYTES[6])).to.equal(XLS_FILE_TYPE)\r\n\t})\r\n\r\n\tit('should throw when it encounters a non-ZIP file signature', () => {\r\n\t\tconst NOT_A_ZIP_FILE_FIRST_BYTES = [0x00, 0x01, 0x02, 0x03]\r\n\t\tconst fileTypeDetector = createFileTypeDetector()\r\n\t\texpect(fileTypeDetector(NOT_A_ZIP_FILE_FIRST_BYTES[0])).to.equal(-1)\r\n\t\texpect(fileTypeDetector(NOT_A_ZIP_FILE_FIRST_BYTES[1])).to.equal(-1)\r\n\t\texpect(fileTypeDetector(NOT_A_ZIP_FILE_FIRST_BYTES[2])).to.equal(-1)\r\n\t\texpect(fileTypeDetector(NOT_A_ZIP_FILE_FIRST_BYTES[3])).to.equal(-1)\r\n\t})\r\n})\r\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,EAAE,QAAQ,OAAO;AACpC,SAASC,MAAM,QAAQ,MAAM;AAE7B,OAAOC,sBAAsB,IAAIC,cAAc,EAAEC,aAAa,QAAQ,6BAA6B;AACnG,OAAOC,iBAAiB,MAAM,wBAAwB;AAEtDN,QAAQ,CAAC,wBAAwB,EAAE,YAAM;EACxCC,EAAE,CAAC,qDAAqD,EAAE,YAAM;IAC/D;IACA,IAAMM,qBAAqB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IACtD,IAAMC,gBAAgB,GAAGL,sBAAsB,CAAC,CAAC;IACjDD,MAAM,CAACM,gBAAgB,CAACD,qBAAqB,CAAC,CAAC,CAA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AAC,CAAC,CAAC,CAAC,CAAC,CAACJ,EAAE,CAACG,KAAK,CAACP,aAAa,CAAC;IACzEH,MAAM,CAACM,gBAAgB,CAACK,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAACJ,EAAE,CAACG,KAAK,CAACP,aAAa,CAAC;IACzEH,MAAM,CAACM,gBAAgB,CAACK,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAACJ,EAAE,CAACG,KAAK,CAACP,aAAa,CAAC;EAC1E,CAAC,CAAC;EAEFJ,EAAE,CAAC,0DAA0D,EAAE,YAAM;IACpE,IAAMa,0BAA0B,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC3D,IAAMN,gBAAgB,GAAGL,sBAAsB,CAAC,CAAC;IACjDD,MAAM,CAACM,gBAAgB,CAACM,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,CAACL,EAAE,CAACG,KAAK,CAAC,CAAC,CAAC,CAAC;IACpEV,MAAM,CAACM,gBAAgB,CAACM,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,CAACL,EAAE,CAACG,KAAK,CAAC,CAAC,CAAC,CAAC;IACpEV,MAAM,CAACM,gBAAgB,CAACM,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,CAACL,EAAE,CAACG,KAAK,CAAC,CAAC,CAAC,CAAC;IACpEV,MAAM,CAACM,gBAAgB,CAACM,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,CAACL,EAAE,CAACG,KAAK,CAAC,CAAC,CAAC,CAAC;EACrE,CAAC,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
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."); }
|
|
2
|
+
function _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); }
|
|
3
|
+
function _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; }
|
|
4
|
+
// This code was originally submitted by Etienne Prothon.
|
|
5
|
+
// https://gitlab.com/catamphetamine/read-excel-file/-/merge_requests/11
|
|
6
|
+
|
|
7
|
+
import InvalidInputError from './InvalidInputError.js';
|
|
8
|
+
import createFileTypeDetector, { XLS_FILE_TYPE } from './createFileTypeDetector.js';
|
|
9
|
+
export default function validateLeadingBytes(bytes) {
|
|
10
|
+
var fileTypeDetector = createFileTypeDetector();
|
|
11
|
+
for (var _iterator = _createForOfIteratorHelperLoose(bytes), _step; !(_step = _iterator()).done;) {
|
|
12
|
+
var _byte = _step.value;
|
|
13
|
+
if (validateByte(_byte, fileTypeDetector)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
noFileTypeCouldBeDetermined(bytes.length);
|
|
18
|
+
}
|
|
19
|
+
export function validateByte(_byte2, fileTypeDetector) {
|
|
20
|
+
var fileType = fileTypeDetector(_byte2);
|
|
21
|
+
if (fileType !== undefined) {
|
|
22
|
+
// If it has determined that the file type is `.xls`.
|
|
23
|
+
if (fileType === XLS_FILE_TYPE) {
|
|
24
|
+
throw new InvalidInputError('XLS_FILE_NOT_SUPPORTED');
|
|
25
|
+
}
|
|
26
|
+
// If it has determined that the file type is none of the known ones.
|
|
27
|
+
if (fileType < 0) {
|
|
28
|
+
throw new InvalidInputError('FILE_NOT_SUPPORTED');
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export function noFileTypeCouldBeDetermined(byteCount) {
|
|
34
|
+
// The file type couldn't be determined — not enough bytes.
|
|
35
|
+
throw new InvalidInputError(byteCount === 0 ? 'NO_DATA' : 'FILE_NOT_SUPPORTED');
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=validateLeadingBytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateLeadingBytes.js","names":["InvalidInputError","createFileTypeDetector","XLS_FILE_TYPE","validateLeadingBytes","bytes","fileTypeDetector","_iterator","_createForOfIteratorHelperLoose","_step","done","byte","value","validateByte","noFileTypeCouldBeDetermined","length","fileType","undefined","byteCount"],"sources":["../../../source/xlsx/file/validateLeadingBytes.js"],"sourcesContent":["// This code was originally submitted by Etienne Prothon.\r\n// https://gitlab.com/catamphetamine/read-excel-file/-/merge_requests/11\r\n\r\nimport InvalidInputError from './InvalidInputError.js'\r\nimport createFileTypeDetector, { XLS_FILE_TYPE } from './createFileTypeDetector.js'\r\n\r\nexport default function validateLeadingBytes(bytes) {\r\n\tconst fileTypeDetector = createFileTypeDetector()\r\n\r\n\tfor (const byte of bytes) {\r\n\t\tif (validateByte(byte, fileTypeDetector)) {\r\n\t\t\treturn\r\n\t\t}\r\n\t}\r\n\r\n\tnoFileTypeCouldBeDetermined(bytes.length)\r\n}\r\n\r\nexport function validateByte(byte, fileTypeDetector) {\r\n\tconst fileType = fileTypeDetector(byte)\r\n\tif (fileType !== undefined) {\r\n\t\t// If it has determined that the file type is `.xls`.\r\n\t\tif (fileType === XLS_FILE_TYPE) {\r\n\t\t\tthrow new InvalidInputError('XLS_FILE_NOT_SUPPORTED')\r\n\t\t}\r\n\t\t// If it has determined that the file type is none of the known ones.\r\n\t\tif (fileType < 0) {\r\n\t\t\tthrow new InvalidInputError('FILE_NOT_SUPPORTED')\r\n\t\t}\r\n\t\treturn true\r\n\t}\r\n}\r\n\r\nexport function noFileTypeCouldBeDetermined(byteCount) {\r\n\t// The file type couldn't be determined — not enough bytes.\r\n\tthrow new InvalidInputError(byteCount === 0 ? 'NO_DATA' : 'FILE_NOT_SUPPORTED')\r\n}"],"mappings":";;;AAAA;AACA;;AAEA,OAAOA,iBAAiB,MAAM,wBAAwB;AACtD,OAAOC,sBAAsB,IAAIC,aAAa,QAAQ,6BAA6B;AAEnF,eAAe,SAASC,oBAAoBA,CAACC,KAAK,EAAE;EACnD,IAAMC,gBAAgB,GAAGJ,sBAAsB,CAAC,CAAC;EAEjD,SAAAK,SAAA,GAAAC,+BAAA,CAAmBH,KAAK,GAAAI,KAAA,IAAAA,KAAA,GAAAF,SAAA,IAAAG,IAAA,GAAE;IAAA,IAAfC,KAAI,GAAAF,KAAA,CAAAG,KAAA;IACd,IAAIC,YAAY,CAACF,KAAI,EAAEL,gBAAgB,CAAC,EAAE;MACzC;IACD;EACD;EAEAQ,2BAA2B,CAACT,KAAK,CAACU,MAAM,CAAC;AAC1C;AAEA,OAAO,SAASF,YAAYA,CAACF,MAAI,EAAEL,gBAAgB,EAAE;EACpD,IAAMU,QAAQ,GAAGV,gBAAgB,CAACK,MAAI,CAAC;EACvC,IAAIK,QAAQ,KAAKC,SAAS,EAAE;IAC3B;IACA,IAAID,QAAQ,KAAKb,aAAa,EAAE;MAC/B,MAAM,IAAIF,iBAAiB,CAAC,wBAAwB,CAAC;IACtD;IACA;IACA,IAAIe,QAAQ,GAAG,CAAC,EAAE;MACjB,MAAM,IAAIf,iBAAiB,CAAC,oBAAoB,CAAC;IAClD;IACA,OAAO,IAAI;EACZ;AACD;AAEA,OAAO,SAASa,2BAA2BA,CAACI,SAAS,EAAE;EACtD;EACA,MAAM,IAAIjB,iBAAiB,CAACiB,SAAS,KAAK,CAAC,GAAG,SAAS,GAAG,oBAAoB,CAAC;AAChF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateLeadingBytes.test.js","names":["describe","it","expect","validateLeadingBytes","InvalidInputError","XLSX_FILE_FIRST_BYTES","to","not","XLS_FILE_FIRST_BYTES","and","satisfy","error","have","property","NOT_A_ZIP_FILE_FIRST_BYTES","slice"],"sources":["../../../source/xlsx/file/validateLeadingBytes.test.js"],"sourcesContent":["// This code was originally submitted by Etienne Prothon.\r\n// https://gitlab.com/catamphetamine/read-excel-file/-/merge_requests/11\r\n\r\nimport { describe, it } from 'mocha'\r\nimport { expect } from 'chai'\r\n\r\nimport validateLeadingBytes from './validateLeadingBytes.js'\r\n\r\nimport InvalidInputError from './InvalidInputError.js'\r\n\r\ndescribe('validateLeadingBytes', () => {\r\n\tit('should not throw when ZIP file signature is present', () => {\r\n\t\t// \"PK\\x03\\x04\" — a normal ZIP file signature.\r\n\t\tconst XLSX_FILE_FIRST_BYTES = [0x50, 0x4B, 0x03, 0x04]\r\n\t\texpect(() => validateLeadingBytes(XLSX_FILE_FIRST_BYTES)).to.not.throw()\r\n\t})\r\n\r\n\tit('should throw when it detects a legacy binary `.xls` file (CFB signature)', () => {\r\n\t\tconst XLS_FILE_FIRST_BYTES = [0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1]\r\n\t\texpect(() => validateLeadingBytes(XLS_FILE_FIRST_BYTES)).to.throw(InvalidInputError).and.satisfy((error) => {\r\n\t\t\texpect(error).to.have.property('name', 'InvalidInputError')\r\n\t\t\texpect(error).to.have.property('code', 'XLS_FILE_NOT_SUPPORTED')\r\n\t\t\t// Must return `true` for `satisfy()` to pass.\r\n\t\t\treturn true\r\n\t\t})\r\n\t})\r\n\r\n\tit('should throw when it encounters a non-ZIP file signature', () => {\r\n\t\tconst NOT_A_ZIP_FILE_FIRST_BYTES = [0x00, 0x01, 0x02, 0x03]\r\n\t\texpect(() => validateLeadingBytes(NOT_A_ZIP_FILE_FIRST_BYTES)).to.throw(InvalidInputError).and.satisfy((error) => {\r\n\t\t\texpect(error).to.have.property('name', 'InvalidInputError')\r\n\t\t\texpect(error).to.have.property('code', 'FILE_NOT_SUPPORTED')\r\n\t\t\t// Must return `true` for `satisfy()` to pass.\r\n\t\t\treturn true\r\n\t\t})\r\n\t})\r\n\r\n\tit('should throw when the input is shorter than the ZIP file signature', () => {\r\n\t\tconst XLSX_FILE_FIRST_BYTES = [0x50, 0x4B, 0x03, 0x04]\r\n\r\n\t\texpect(() => validateLeadingBytes(XLSX_FILE_FIRST_BYTES.slice(0, 0))).to.throw(InvalidInputError).and.satisfy((error) => {\r\n\t\t\texpect(error).to.have.property('name', 'InvalidInputError')\r\n\t\t\texpect(error).to.have.property('code', 'NO_DATA')\r\n\t\t\t// Must return `true` for `satisfy()` to pass.\r\n\t\t\treturn true\r\n\t\t})\r\n\r\n\t\texpect(() => validateLeadingBytes(XLSX_FILE_FIRST_BYTES.slice(0, 1))).to.throw(InvalidInputError).and.satisfy((error) => {\r\n\t\t\texpect(error).to.have.property('name', 'InvalidInputError')\r\n\t\t\texpect(error).to.have.property('code', 'FILE_NOT_SUPPORTED')\r\n\t\t\t// Must return `true` for `satisfy()` to pass.\r\n\t\t\treturn true\r\n\t\t})\r\n\r\n\t\texpect(() => validateLeadingBytes(XLSX_FILE_FIRST_BYTES.slice(0, 2))).to.not.throw()\r\n\t\texpect(() => validateLeadingBytes(XLSX_FILE_FIRST_BYTES.slice(0, 3))).to.not.throw()\r\n\t\texpect(() => validateLeadingBytes(XLSX_FILE_FIRST_BYTES.slice(0, 4))).to.not.throw()\r\n\t})\r\n})"],"mappings":"AAAA;AACA;;AAEA,SAASA,QAAQ,EAAEC,EAAE,QAAQ,OAAO;AACpC,SAASC,MAAM,QAAQ,MAAM;AAE7B,OAAOC,oBAAoB,MAAM,2BAA2B;AAE5D,OAAOC,iBAAiB,MAAM,wBAAwB;AAEtDJ,QAAQ,CAAC,sBAAsB,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BAAoB,CAACE,qBAAqB,CAACU,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAAA,EAAC,CAACT,EAAE,CAACC,GAAG,SAAM,CAAC,CAAC;IACpFL,MAAM,CAAC;MAAA,OAAMC,oBAAoB,CAACE,qBAAqB,CAACU,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAAA,EAAC,CAACT,EAAE,CAACC,GAAG,SAAM,CAAC,CAAC;IACpFL,MAAM,CAAC;MAAA,OAAMC,oBAAoB,CAACE,qBAAqB,CAACU,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAAA,EAAC,CAACT,EAAE,CAACC,GAAG,SAAM,CAAC,CAAC;EACrF,CAAC,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
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."); }
|
|
2
|
-
function _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); }
|
|
3
|
-
function _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; }
|
|
4
1
|
// On some date formats, there's a "[$-...]" prefix that locks the locale
|
|
5
2
|
// to be a specific one when formatting a date using this format.
|
|
6
3
|
//
|
|
@@ -13,7 +10,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
13
10
|
// * "[$-ru-RU]dd.mm.yyyy;@"
|
|
14
11
|
// * "[$-x-sysdate]dddd, mmmm dd, yyyy"
|
|
15
12
|
//
|
|
16
|
-
|
|
13
|
+
// This is exported only to be specified in `worker-f` dependencies.
|
|
14
|
+
//
|
|
15
|
+
export var DATE_FORMAT_SPECIFIC_LOCALE_PREFIX = /^\[\$-[^\]]+\]/;
|
|
17
16
|
|
|
18
17
|
// On some date formats, there's a ";@" suffix.
|
|
19
18
|
// It instructs the spreadsheet editor application to display any non-numeric
|
|
@@ -36,17 +35,18 @@ var DATE_FORMAT_SPECIFIC_LOCALE_PREFIX = /^\[\$-[^\]]+\]/;
|
|
|
36
35
|
// * "m/d/yyyy;@"
|
|
37
36
|
// * "[$-414]mmmm\ yyyy;@"
|
|
38
37
|
//
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
// This is exported only to be specified in `worker-f` dependencies.
|
|
39
|
+
//
|
|
40
|
+
export var DATE_FORMAT_ALLOW_ANY_OTHER_TEXT_SUFFIX = /;@$/;
|
|
41
|
+
|
|
42
|
+
// This is exported only to be specified in `worker-f` dependencies.
|
|
43
|
+
//
|
|
44
|
+
export var IS_DATE_FORMAT_CACHE = {};
|
|
41
45
|
export default function isDateFormatCached(template) {
|
|
42
|
-
if (template in
|
|
43
|
-
return
|
|
46
|
+
if (template in IS_DATE_FORMAT_CACHE) {
|
|
47
|
+
return IS_DATE_FORMAT_CACHE[template];
|
|
44
48
|
}
|
|
45
|
-
|
|
46
|
-
CACHE[template] = result;
|
|
47
|
-
return result;
|
|
48
|
-
}
|
|
49
|
-
function isDateFormat(template) {
|
|
49
|
+
|
|
50
50
|
// Date format tokens could be in upper case or in lower case.
|
|
51
51
|
// There seems to be no single standard.
|
|
52
52
|
// So the template is lowercased first.
|
|
@@ -64,27 +64,31 @@ function isDateFormat(template) {
|
|
|
64
64
|
// Extract all alphabetic parts from what's left from the template string.
|
|
65
65
|
// Example: "mm/dd/yyyy" → ["mm", "dd", "yyyy"]
|
|
66
66
|
var tokens = template.split(/\W+/);
|
|
67
|
-
|
|
67
|
+
var result = tokens.length === 0
|
|
68
68
|
// If no alphabetic parts are present in what's left from the template string
|
|
69
69
|
// then it could be any kind of template such as a generic numeric template
|
|
70
70
|
// such as "$#,##0.00" currency template or "0.0%" percentage template.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
? false
|
|
72
|
+
// If a non-date-format-specific alphabetic substring is found,
|
|
73
|
+
// then it might be not necessarily a date format.
|
|
74
|
+
// In order to make a certain guess, all tokens have to represent viable parts of a date format.
|
|
75
|
+
: tokens.every(function (token) {
|
|
76
|
+
return DATE_TEMPLATE_TOKENS.indexOf(token) >= 0;
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Cache the result
|
|
80
|
+
IS_DATE_FORMAT_CACHE[template] = result;
|
|
81
|
+
|
|
82
|
+
// Return the result
|
|
83
|
+
return result;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
// These tokens could be in upper case or in lower case.
|
|
86
87
|
// There seems to be no single standard, so using lower case.
|
|
87
|
-
|
|
88
|
+
//
|
|
89
|
+
// This is exported only to be specified in `worker-f` dependencies.
|
|
90
|
+
//
|
|
91
|
+
export var DATE_TEMPLATE_TOKENS = [
|
|
88
92
|
// Seconds (min two digits). Example: "05".
|
|
89
93
|
'ss',
|
|
90
94
|
// Minutes (min two digits). Example: "05". Could also be "Months". Weird.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isDateFormat.js","names":["DATE_FORMAT_SPECIFIC_LOCALE_PREFIX","DATE_FORMAT_ALLOW_ANY_OTHER_TEXT_SUFFIX","
|
|
1
|
+
{"version":3,"file":"isDateFormat.js","names":["DATE_FORMAT_SPECIFIC_LOCALE_PREFIX","DATE_FORMAT_ALLOW_ANY_OTHER_TEXT_SUFFIX","IS_DATE_FORMAT_CACHE","isDateFormatCached","template","toLowerCase","replace","tokens","split","result","length","every","token","DATE_TEMPLATE_TOKENS","indexOf"],"sources":["../../source/xlsx/isDateFormat.js"],"sourcesContent":["// On some date formats, there's a \"[$-...]\" prefix that locks the locale\r\n// to be a specific one when formatting a date using this format.\r\n//\r\n// https://stackoverflow.com/questions/4730152/what-indicates-an-office-open-xml-cell-contains-a-date-time-value\r\n//\r\n// Format examples:\r\n//\r\n// * \"[$-404]e/m/d\"\r\n// * \"[$-414]mmmm\\ yyyy;@\"\r\n// * \"[$-ru-RU]dd.mm.yyyy;@\"\r\n// * \"[$-x-sysdate]dddd, mmmm dd, yyyy\"\r\n//\r\n// This is exported only to be specified in `worker-f` dependencies.\r\n//\r\nexport const DATE_FORMAT_SPECIFIC_LOCALE_PREFIX = /^\\[\\$-[^\\]]+\\]/\r\n\r\n// On some date formats, there's a \";@\" suffix.\r\n// It instructs the spreadsheet editor application to display any non-numeric\r\n// value as is instead of hiding it or something like that.\r\n//\r\n// For example, if one inputs \"Some text\" instead of a date in such cell,\r\n// it will still show \"Some text\" instead of an empty cell, even though\r\n// the value is strictly-speaking invalid.\r\n//\r\n// Specifically, \";\" means \"anything before this applies only to a numeric value,\r\n// while anything after it applies to a text value\". And a follow-up \"@\" means\r\n// \"for a text value, just output it as is\".\r\n//\r\n// It's not really clear why would anyone add such a feature to a format.\r\n// Perhaps it feels more \"user-friendly\" towards a non-\"tech-savvy\" user\r\n// of a spreadsheet editor application.\r\n//\r\n// Format examples:\r\n//\r\n// * \"m/d/yyyy;@\"\r\n// * \"[$-414]mmmm\\ yyyy;@\"\r\n//\r\n// This is exported only to be specified in `worker-f` dependencies.\r\n//\r\nexport const DATE_FORMAT_ALLOW_ANY_OTHER_TEXT_SUFFIX = /;@$/\r\n\r\n// This is exported only to be specified in `worker-f` dependencies.\r\n//\r\nexport const IS_DATE_FORMAT_CACHE = {}\r\n\r\nexport default function isDateFormatCached(template) {\r\n\tif (template in IS_DATE_FORMAT_CACHE) {\r\n\t\treturn IS_DATE_FORMAT_CACHE[template]\r\n\t}\r\n\r\n // Date format tokens could be in upper case or in lower case.\r\n // There seems to be no single standard.\r\n // So the template is lowercased first.\r\n template = template.toLowerCase()\r\n\r\n // On some date formats, there's an \"[$-...]\" prefix.\r\n // It forces a specific locale to be used when formatting a date.\r\n template = template.replace(DATE_FORMAT_SPECIFIC_LOCALE_PREFIX, '')\r\n\r\n // On some date formats, there's an \";@\" suffix.\r\n // It's not clear why would anyone need it in a date format template.\r\n\t// Still, because it occurs there, it should be stripped.\r\n template = template.replace(DATE_FORMAT_ALLOW_ANY_OTHER_TEXT_SUFFIX, '')\r\n\r\n // Extract all alphabetic parts from what's left from the template string.\r\n // Example: \"mm/dd/yyyy\" → [\"mm\", \"dd\", \"yyyy\"]\r\n const tokens = template.split(/\\W+/)\r\n\r\n const result = tokens.length === 0\r\n // If no alphabetic parts are present in what's left from the template string\r\n // then it could be any kind of template such as a generic numeric template\r\n // such as \"$#,##0.00\" currency template or \"0.0%\" percentage template.\r\n ? false\r\n // If a non-date-format-specific alphabetic substring is found,\r\n // then it might be not necessarily a date format.\r\n // In order to make a certain guess, all tokens have to represent viable parts of a date format.\r\n : tokens.every(token => DATE_TEMPLATE_TOKENS.indexOf(token) >= 0)\r\n\r\n // Cache the result\r\n IS_DATE_FORMAT_CACHE[template] = result\r\n\r\n // Return the result\r\n return result\r\n}\r\n\r\n// These tokens could be in upper case or in lower case.\r\n// There seems to be no single standard, so using lower case.\r\n//\r\n// This is exported only to be specified in `worker-f` dependencies.\r\n//\r\nexport const DATE_TEMPLATE_TOKENS = [\r\n // Seconds (min two digits). Example: \"05\".\r\n 'ss',\r\n // Minutes (min two digits). Example: \"05\". Could also be \"Months\". Weird.\r\n 'mm',\r\n // Hours. Example: \"1\".\r\n 'h',\r\n // Hours (min two digits). Example: \"01\".\r\n 'hh',\r\n // \"AM\" part of \"AM/PM\". Lowercased just in case.\r\n 'am',\r\n // \"PM\" part of \"AM/PM\". Lowercased just in case.\r\n 'pm',\r\n // Day. Example: \"1\"\r\n 'd',\r\n // Day (min two digits). Example: \"01\"\r\n 'dd',\r\n // Month (numeric). Example: \"1\".\r\n 'm',\r\n // Month (numeric, min two digits). Example: \"01\". Could also be \"Minutes\". Weird.\r\n 'mm',\r\n // Month (shortened month name). Example: \"Jan\".\r\n 'mmm',\r\n // Month (full month name). Example: \"January\".\r\n 'mmmm',\r\n // Two-digit year. Example: \"20\".\r\n 'yy',\r\n // Full year. Example: \"2020\".\r\n 'yyyy',\r\n\r\n // I don't have any idea what \"e\" means.\r\n // It's used in \"built-in\" XLSX formats:\r\n // * 27 '[$-404]e/m/d';\r\n // * 36 '[$-404]e/m/d';\r\n // * 50 '[$-404]e/m/d';\r\n // * 57 '[$-404]e/m/d';\r\n 'e'\r\n]"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMA,kCAAkC,GAAG,gBAAgB;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,uCAAuC,GAAG,KAAK;;AAE5D;AACA;AACA,OAAO,IAAMC,oBAAoB,GAAG,CAAC,CAAC;AAEtC,eAAe,SAASC,kBAAkBA,CAACC,QAAQ,EAAE;EACpD,IAAIA,QAAQ,IAAIF,oBAAoB,EAAE;IACrC,OAAOA,oBAAoB,CAACE,QAAQ,CAAC;EACtC;;EAEC;EACA;EACA;EACAA,QAAQ,GAAGA,QAAQ,CAACC,WAAW,CAAC,CAAC;;EAEjC;EACA;EACAD,QAAQ,GAAGA,QAAQ,CAACE,OAAO,CAACN,kCAAkC,EAAE,EAAE,CAAC;;EAEnE;EACA;EACD;EACCI,QAAQ,GAAGA,QAAQ,CAACE,OAAO,CAACL,uCAAuC,EAAE,EAAE,CAAC;;EAExE;EACA;EACA,IAAMM,MAAM,GAAGH,QAAQ,CAACI,KAAK,CAAC,KAAK,CAAC;EAEpC,IAAMC,MAAM,GAAGF,MAAM,CAACG,MAAM,KAAK;EAC/B;EACA;EACA;EAAA,EACE;EACF;EACA;EACA;EAAA,EACEH,MAAM,CAACI,KAAK,CAAC,UAAAC,KAAK;IAAA,OAAIC,oBAAoB,CAACC,OAAO,CAACF,KAAK,CAAC,IAAI,CAAC;EAAA,EAAC;;EAEnE;EACAV,oBAAoB,CAACE,QAAQ,CAAC,GAAGK,MAAM;;EAEvC;EACA,OAAOA,MAAM;AACf;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMI,oBAAoB,GAAG;AAClC;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,GAAG;AACH;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,IAAI;AACJ;AACA,GAAG;AACH;AACA,IAAI;AACJ;AACA,GAAG;AACH;AACA,IAAI;AACJ;AACA,KAAK;AACL;AACA,MAAM;AACN;AACA,IAAI;AACJ;AACA,MAAM;AAEN;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,CACJ"}
|
|
@@ -5,27 +5,22 @@
|
|
|
5
5
|
// detected by looking at the value "format" and seeing if it's a date-specific one.
|
|
6
6
|
|
|
7
7
|
import isDateFormat from './isDateFormat.js';
|
|
8
|
-
export default function isDateFormatStyle(
|
|
9
|
-
if (
|
|
10
|
-
|
|
11
|
-
if (!style) {
|
|
12
|
-
throw new Error("Cell style not found: ".concat(styleId));
|
|
13
|
-
}
|
|
14
|
-
if (!style.numberFormat) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
if (
|
|
18
|
-
// Whether it's a "number format" that's conventionally used for storing date timestamps.
|
|
19
|
-
BUILT_IN_DATE_FORMAT_IDS.indexOf(style.numberFormat.id) >= 0 ||
|
|
20
|
-
// Whether it's a "number format" that uses a "formatting template"
|
|
21
|
-
// that the developer is certain is a date formatting template.
|
|
22
|
-
options.dateFormat && style.numberFormat.template === options.dateFormat ||
|
|
23
|
-
// Whether the "smart formatting template" feature is not disabled
|
|
24
|
-
// and it has detected that it's a date formatting template by looking at it.
|
|
25
|
-
options.smartDateParser !== false && style.numberFormat.template && isDateFormat(style.numberFormat.template)) {
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
8
|
+
export default function isDateFormatStyle(style, defaultDateFormat, shouldGuessDateFormatFromNumberFormatTemplate) {
|
|
9
|
+
if (!style.numberFormat) {
|
|
10
|
+
return false;
|
|
28
11
|
}
|
|
12
|
+
if (
|
|
13
|
+
// Whether it's a "number format" that's conventionally used for storing date timestamps.
|
|
14
|
+
BUILT_IN_DATE_FORMAT_IDS.indexOf(style.numberFormat.id) >= 0 ||
|
|
15
|
+
// Whether it's a "number format" that uses a "formatting template"
|
|
16
|
+
// that the developer is certain is a date formatting template.
|
|
17
|
+
defaultDateFormat && style.numberFormat.template === defaultDateFormat ||
|
|
18
|
+
// Whether the "smart formatting template" feature is not disabled
|
|
19
|
+
// and it has detected that it's a date formatting template by looking at it.
|
|
20
|
+
shouldGuessDateFormatFromNumberFormatTemplate && style.numberFormat.template && isDateFormat(style.numberFormat.template)) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
29
24
|
}
|
|
30
25
|
|
|
31
26
|
// Built-in formats have ID < 164.
|
|
@@ -169,8 +164,10 @@ var THAI_LOCALE_BUILT_IN_DATE_FORMAT_IDS = [71,
|
|
|
169
164
|
81 // d/m/bb
|
|
170
165
|
];
|
|
171
166
|
|
|
167
|
+
// This is exported only to be passed in `worker-f` dependencies.
|
|
168
|
+
//
|
|
172
169
|
// Start with language-agnostic date format IDs.
|
|
173
|
-
var BUILT_IN_DATE_FORMAT_IDS = LOCALE_INDEPENDENT_BUILT_IN_DATE_FORMAT_IDS.concat(
|
|
170
|
+
export var BUILT_IN_DATE_FORMAT_IDS = LOCALE_INDEPENDENT_BUILT_IN_DATE_FORMAT_IDS.concat(
|
|
174
171
|
// Add Mainland Chinese or Taiwanese date format IDs that haven't already been added.
|
|
175
172
|
MAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS).concat(
|
|
176
173
|
// Add Japanese or Korean date format IDs that haven't already been added.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isDateFormatStyle.js","names":["isDateFormat","isDateFormatStyle","
|
|
1
|
+
{"version":3,"file":"isDateFormatStyle.js","names":["isDateFormat","isDateFormatStyle","style","defaultDateFormat","shouldGuessDateFormatFromNumberFormatTemplate","numberFormat","BUILT_IN_DATE_FORMAT_IDS","indexOf","id","template","LOCALE_INDEPENDENT_BUILT_IN_DATE_FORMAT_IDS","MAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS","JAPANESE_OR_KOREAN_LOCALE_BUILT_IN_DATE_FORMAT_IDS","THAI_LOCALE_BUILT_IN_DATE_FORMAT_IDS","concat","filter","numberFormatId"],"sources":["../../source/xlsx/isDateFormatStyle.js"],"sourcesContent":["// XLSX does have \"d\" type for dates, but it's not commonly used.\r\n// Instead, it prefers using \"n\" type for storing dates as timestamps.\r\n//\r\n// Whether a numeric value is a number or a date timestamp, it sometimes could be\r\n// detected by looking at the value \"format\" and seeing if it's a date-specific one.\r\n\r\nimport isDateFormat from './isDateFormat.js'\r\n\r\nexport default function isDateFormatStyle(\r\n style,\r\n defaultDateFormat,\r\n shouldGuessDateFormatFromNumberFormatTemplate\r\n) {\r\n if (!style.numberFormat) {\r\n return false\r\n }\r\n if (\r\n // Whether it's a \"number format\" that's conventionally used for storing date timestamps.\r\n BUILT_IN_DATE_FORMAT_IDS.indexOf(style.numberFormat.id) >= 0 ||\r\n // Whether it's a \"number format\" that uses a \"formatting template\"\r\n // that the developer is certain is a date formatting template.\r\n (defaultDateFormat && style.numberFormat.template === defaultDateFormat) ||\r\n // Whether the \"smart formatting template\" feature is not disabled\r\n // and it has detected that it's a date formatting template by looking at it.\r\n (shouldGuessDateFormatFromNumberFormatTemplate && style.numberFormat.template && isDateFormat(style.numberFormat.template))\r\n ) {\r\n return true\r\n }\r\n return false\r\n}\r\n\r\n// Built-in formats have ID < 164.\r\n// Some of those formats are intended to use when displaying dates.\r\n//\r\n// Depending on the \"locale\" used by the spreadsheet viewing application,\r\n// different built-in format IDs might correspond to different templates.\r\n// https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.numberingformat?view=openxml-2.8.1\r\n//\r\n// Here's a list of \"locale\"-independent built-in format IDs that're known to represent dates.\r\n//\r\nconst LOCALE_INDEPENDENT_BUILT_IN_DATE_FORMAT_IDS = [\r\n 14, // mm-dd-yy\r\n 15, // d-mmm-yy\r\n 16, // d-mmm\r\n 17, // mmm-yy\r\n 18, // h:mm AM/PM\r\n 19, // h:mm:ss AM/PM\r\n 20, // h:mm\r\n 21, // h:mm:ss\r\n 22, // m/d/yy h:mm\r\n 45, // mm:ss\r\n 46, // [h]:mm:ss\r\n 47 // mmss.0\r\n]\r\n\r\n// \"zh-tw\" OR \"zh-cn\" locales.\r\n// Language glyphs (aka \"hieroglyphs\") are not replaced with their respective unicode values here.\r\nconst MAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS = [\r\n 27, // [$-404]e/m/d OR yyyy\"年\"m\"月\"\r\n 28, // [$-404]e\"年\"m\"月\"d\"日\" OR m\"月\"d\"日\"\r\n 29, // [$-404]e\"年\"m\"月\"d\"日\" OR m\"月\"d\"日\"\r\n 30, // m/d/yy OR m-d-yy\r\n 31, // yyyy\"年\"m\"月\"d\"日\" OR yyyy\"年\"m\"月\"d\"日\"\r\n 32, // hh\"時\"mm\"分\" OR h\"时\"mm\"分\"\r\n 33, // hh\"時\"mm\"分\"ss\"秒\" OR h\"时\"mm\"分\"ss\"秒\"\r\n 34, // 上午/下午hh\"時\"mm\"分\" OR 上午/下午h\"时\"mm\"分\"\r\n 35, // 上午/下午hh\"時\"mm\"分\"ss\"秒\" OR 上午/下午h\"时\"mm\"分\"ss\"秒\"\r\n 36, // [$-404]e/m/d OR yyyy\"年\"m\"月\"\r\n 50, // [$-404]e/m/d OR yyyy\"年\"m\"月\"\r\n 51, // [$-404]e\"年\"m\"月\"d\"日\" OR m\"月\"d\"日\"\r\n 52, // 上午/下午hh\"時\"mm\"分\" OR yyyy\"年\"m\"月\"\r\n 53, // 上午/下午hh\"時\"mm\"分\"ss\"秒\" OR m\"月\"d\"日\"\r\n 54, // [$-404]e\"年\"m\"月\"d\"日\" OR m\"月\"d\"日\"\r\n 55, // 上午/下午hh\"時\"mm\"分\" OR 上午/下午h\"时\"mm\"分\"\r\n 56, // 上午/下午hh\"時\"mm\"分\"ss\"秒\" OR 上午/下午h\"时\"mm\"分\"ss\"秒\"\r\n 57, // [$-404]e/m/d OR yyyy\"年\"m\"月\"\r\n 58 // [$-404]e\"年\"m\"月\"d\"日\" OR m\"月\"d\"日\"\r\n]\r\n\r\n// \"ja-jp\" OR \"ko-kr\" locales.\r\n// Language glyphs (aka \"hieroglyphs\") are not replaced with their respective unicode values here.\r\nconst JAPANESE_OR_KOREAN_LOCALE_BUILT_IN_DATE_FORMAT_IDS = [\r\n 27, // [$-411]ge.m.d OR yyyy\"年\" mm\"月\" dd\"日\"\r\n 28, // [$-411]ggge\"年\"m\"月\"d\"日\" OR mm-dd\r\n 29, // [$-411]ggge\"年\"m\"月\"d\"日\" OR mm-dd\r\n 30, // m/d/yy OR mm-dd-yy\r\n 31, // yyyy\"年\"m\"月\"d\"日\" OR yyyy\"년\" mm\"월\" dd\"일\"\r\n 32, // h\"時\"mm\"分\" OR h\"시\" mm\"분\"\r\n 33, // h\"時\"mm\"分\"ss\"秒\" OR h\"시\" mm\"분\" ss\"초\"\r\n 34, // yyyy\"年\"m\"月\" OR yyyy-mm-dd\r\n 35, // m\"月\"d\"日\" OR yyyy-mm-dd\r\n 36, // [$-411]ge.m.d OR yyyy\"年\" mm\"月\" dd\"日\"\r\n 50, // [$-411]ge.m.d OR yyyy\"年\" mm\"月\" dd\"日\"\r\n 51, // [$-411]ggge\"年\"m\"月\"d\"日\" OR mm-dd\r\n 52, // yyyy\"年\"m\"月\" OR yyyy-mm-dd\r\n 53, // m\"月\"d\"日\" OR yyyy-mm-dd\r\n 54, // [$-411]ggge\"年\"m\"月\"d\"日\" OR mm-dd\r\n 55, // yyyy\"年\"m\"月\" OR yyyy-mm-dd\r\n 56, // m\"月\"d\"日\" OR yyyy-mm-dd\r\n 57, // [$-411]ge.m.d OR yyyy\"年\" mm\"月\" dd\"日\"\r\n 58 // [$-411]ggge\"年\"m\"月\"d\"日\" OR mm-dd\r\n]\r\n\r\n// \"th-th\" locale.\r\n// Language glyphs (aka \"hieroglyphs\") are not replaced with their respective unicode values here.\r\nconst THAI_LOCALE_BUILT_IN_DATE_FORMAT_IDS = [\r\n 71, // ว/ด/ปปปป\r\n 72, // ว-ดดด-ปป\r\n 73, // ว-ดดด\r\n 74, // ดดด-ปป\r\n 75, // ช:นน\r\n 76, // ช:นน:ทท\r\n 77, // ว/ด/ปปปป ช:นน\r\n 78, // นน:ทท\r\n 79, // [ช]:นน:ทท\r\n 80, // นน:ทท.0\r\n 81 // d/m/bb\r\n]\r\n\r\n// This is exported only to be passed in `worker-f` dependencies.\r\n//\r\n// Start with language-agnostic date format IDs.\r\nexport const BUILT_IN_DATE_FORMAT_IDS = LOCALE_INDEPENDENT_BUILT_IN_DATE_FORMAT_IDS.concat(\r\n // Add Mainland Chinese or Taiwanese date format IDs that haven't already been added.\r\n MAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS\r\n).concat(\r\n // Add Japanese or Korean date format IDs that haven't already been added.\r\n JAPANESE_OR_KOREAN_LOCALE_BUILT_IN_DATE_FORMAT_IDS.filter(\r\n numberFormatId => MAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS.indexOf(numberFormatId) < 0\r\n )\r\n).concat(\r\n // Add Thai date format IDs that haven't already been added.\r\n THAI_LOCALE_BUILT_IN_DATE_FORMAT_IDS.filter(\r\n numberFormatId => MAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS.indexOf(numberFormatId) < 0\r\n ).filter(\r\n numberFormatId => JAPANESE_OR_KOREAN_LOCALE_BUILT_IN_DATE_FORMAT_IDS.indexOf(numberFormatId) < 0\r\n )\r\n)\r\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,YAAY,MAAM,mBAAmB;AAE5C,eAAe,SAASC,iBAAiBA,CACvCC,KAAK,EACLC,iBAAiB,EACjBC,6CAA6C,EAC7C;EACA,IAAI,CAACF,KAAK,CAACG,YAAY,EAAE;IACvB,OAAO,KAAK;EACd;EACA;EACE;EACAC,wBAAwB,CAACC,OAAO,CAACL,KAAK,CAACG,YAAY,CAACG,EAAE,CAAC,IAAI,CAAC;EAC5D;EACA;EACCL,iBAAiB,IAAID,KAAK,CAACG,YAAY,CAACI,QAAQ,KAAKN,iBAAkB;EACxE;EACA;EACCC,6CAA6C,IAAIF,KAAK,CAACG,YAAY,CAACI,QAAQ,IAAIT,YAAY,CAACE,KAAK,CAACG,YAAY,CAACI,QAAQ,CAAE,EACzH;IACF,OAAO,IAAI;EACb;EACA,OAAO,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,2CAA2C,GAAG,CAClD,EAAE;AAAE;AACJ,EAAE;AAAE;AACJ,EAAE;AAAE;AACJ,EAAE;AAAE;AACJ,EAAE;AAAE;AACJ,EAAE;AAAE;AACJ,EAAE;AAAE;AACJ,EAAE;AAAE;AACJ,EAAE;AAAE;AACJ,EAAE;AAAE;AACJ,EAAE;AAAE;AAC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