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.
Files changed (251) hide show
  1. package/CHANGELOG.md +6 -2
  2. package/README.md +32 -2
  3. package/browser/index.cjs +3 -0
  4. package/browser/index.d.ts +16 -0
  5. package/browser/index.js +4 -1
  6. package/bundle/read-excel-file.min.js +1 -1
  7. package/bundle/read-excel-file.min.js.map +1 -1
  8. package/commonjs/export/convertInputToNodeStream.js +0 -12
  9. package/commonjs/export/convertInputToNodeStream.js.map +1 -1
  10. package/commonjs/export/parseSheet.js +14 -7
  11. package/commonjs/export/parseSheet.js.map +1 -1
  12. package/commonjs/export/readSheetBrowser.js +3 -6
  13. package/commonjs/export/readSheetBrowser.js.map +1 -1
  14. package/commonjs/export/readSheetNode.js +3 -6
  15. package/commonjs/export/readSheetNode.js.map +1 -1
  16. package/commonjs/export/readSheetUniversal.js +2 -2
  17. package/commonjs/export/readSheetUniversal.js.map +1 -1
  18. package/commonjs/export/readSheetWebWorker.js +5 -5
  19. package/commonjs/export/readSheetWebWorker.js.map +1 -1
  20. package/commonjs/export/readXlsxFileBrowser.js +3 -6
  21. package/commonjs/export/readXlsxFileBrowser.js.map +1 -1
  22. package/commonjs/export/readXlsxFileNode.js +3 -6
  23. package/commonjs/export/readXlsxFileNode.js.map +1 -1
  24. package/commonjs/export/readXlsxFileUniversal.js +2 -2
  25. package/commonjs/export/readXlsxFileUniversal.js.map +1 -1
  26. package/commonjs/export/readXlsxFileWebWorker.js +5 -5
  27. package/commonjs/export/readXlsxFileWebWorker.js.map +1 -1
  28. package/commonjs/export/unpackXlsxFileBrowser.js +15 -4
  29. package/commonjs/export/unpackXlsxFileBrowser.js.map +1 -1
  30. package/commonjs/export/unpackXlsxFileBrowser.test.js.map +1 -0
  31. package/commonjs/export/unpackXlsxFileNode.js +32 -5
  32. package/commonjs/export/unpackXlsxFileNode.js.map +1 -1
  33. package/commonjs/export/unpackXlsxFileNode.test.js.map +1 -0
  34. package/commonjs/export/unpackXlsxFileUniversal.js +14 -3
  35. package/commonjs/export/unpackXlsxFileUniversal.js.map +1 -1
  36. package/commonjs/export/unpackXlsxFileUniversal.test.js.map +1 -0
  37. package/commonjs/parseSheetData/parseSheetData.js +9 -6
  38. package/commonjs/parseSheetData/parseSheetData.js.map +1 -1
  39. package/commonjs/utility/convertValuesFromUint8ArraysToStrings.js +100 -0
  40. package/commonjs/utility/convertValuesFromUint8ArraysToStrings.js.map +1 -0
  41. package/commonjs/xlsx/InvalidSpreadsheetError.js +55 -0
  42. package/commonjs/xlsx/InvalidSpreadsheetError.js.map +1 -0
  43. package/commonjs/xlsx/SheetNotFoundError.js +55 -0
  44. package/commonjs/xlsx/SheetNotFoundError.js.map +1 -0
  45. package/commonjs/xlsx/file/InputValidationStream.js +101 -0
  46. package/commonjs/xlsx/file/InputValidationStream.js.map +1 -0
  47. package/commonjs/xlsx/file/InputValidationStream.test.js.map +1 -0
  48. package/commonjs/xlsx/file/InvalidInputError.js +105 -0
  49. package/commonjs/xlsx/file/InvalidInputError.js.map +1 -0
  50. package/commonjs/xlsx/file/createFileTypeDetector.js +70 -0
  51. package/commonjs/xlsx/file/createFileTypeDetector.js.map +1 -0
  52. package/commonjs/xlsx/file/createFileTypeDetector.test.js.map +1 -0
  53. package/commonjs/xlsx/file/validateLeadingBytes.js +47 -0
  54. package/commonjs/xlsx/file/validateLeadingBytes.js.map +1 -0
  55. package/commonjs/xlsx/file/validateLeadingBytes.test.js.map +1 -0
  56. package/commonjs/xlsx/isDateFormat.js +32 -27
  57. package/commonjs/xlsx/isDateFormat.js.map +1 -1
  58. package/commonjs/xlsx/isDateFormatStyle.js +19 -21
  59. package/commonjs/xlsx/isDateFormatStyle.js.map +1 -1
  60. package/commonjs/xlsx/parseCell.js +252 -115
  61. package/commonjs/xlsx/parseCell.js.map +1 -1
  62. package/commonjs/xlsx/parseCellAddress.js +22 -18
  63. package/commonjs/xlsx/parseCellAddress.js.map +1 -1
  64. package/commonjs/xlsx/parseExcelDate.js +4 -124
  65. package/commonjs/xlsx/parseExcelDate.js.map +1 -1
  66. package/commonjs/xlsx/parseExcelDate.test.js.map +1 -1
  67. package/commonjs/xlsx/parseExcelTimestamp.js +139 -0
  68. package/commonjs/xlsx/parseExcelTimestamp.js.map +1 -0
  69. package/commonjs/xlsx/parseFilePaths.js +48 -47
  70. package/commonjs/xlsx/parseFilePaths.js.map +1 -1
  71. package/commonjs/xlsx/parseSharedStrings.js +91 -36
  72. package/commonjs/xlsx/parseSharedStrings.js.map +1 -1
  73. package/commonjs/xlsx/parseSheet.js +527 -69
  74. package/commonjs/xlsx/parseSheet.js.map +1 -1
  75. package/commonjs/xlsx/parseSpreadsheetContents.js +154 -83
  76. package/commonjs/xlsx/parseSpreadsheetContents.js.map +1 -1
  77. package/commonjs/xlsx/parseSpreadsheetInfo.js +60 -59
  78. package/commonjs/xlsx/parseSpreadsheetInfo.js.map +1 -1
  79. package/commonjs/xlsx/parseStyles.js +75 -75
  80. package/commonjs/xlsx/parseStyles.js.map +1 -1
  81. package/commonjs/xml/parseXml.js +112 -0
  82. package/commonjs/xml/parseXml.js.map +1 -0
  83. package/commonjs/xml/parseXml.test.js.map +1 -0
  84. package/commonjs/xml/parseXmlStream.js.map +1 -1
  85. package/commonjs/xml/parseXmlStream.sax.js +69 -28
  86. package/commonjs/xml/parseXmlStream.sax.js.map +1 -1
  87. package/commonjs/xml/parseXmlStream.saxen.js +66 -40
  88. package/commonjs/xml/parseXmlStream.saxen.js.map +1 -1
  89. package/commonjs/zip/UnzipError.js +55 -0
  90. package/commonjs/zip/UnzipError.js.map +1 -0
  91. package/commonjs/zip/unzipFromArrayBuffer.js +21 -1
  92. package/commonjs/zip/unzipFromArrayBuffer.js.map +1 -1
  93. package/commonjs/zip/unzipFromArrayBuffer.test.js.map +1 -0
  94. package/commonjs/zip/unzipFromStream.fflate.js +43 -35
  95. package/commonjs/zip/unzipFromStream.fflate.js.map +1 -1
  96. package/commonjs/zip/unzipFromStream.js +188 -6
  97. package/commonjs/zip/unzipFromStream.js.map +1 -1
  98. package/commonjs/zip/unzipFromStream.unzipper.js +19 -34
  99. package/commonjs/zip/unzipFromStream.unzipper.js.map +1 -1
  100. package/modules/export/convertInputToNodeStream.js +0 -12
  101. package/modules/export/convertInputToNodeStream.js.map +1 -1
  102. package/modules/export/parseSheet.js +13 -6
  103. package/modules/export/parseSheet.js.map +1 -1
  104. package/modules/export/readSheetBrowser.js +3 -5
  105. package/modules/export/readSheetBrowser.js.map +1 -1
  106. package/modules/export/readSheetNode.js +3 -5
  107. package/modules/export/readSheetNode.js.map +1 -1
  108. package/modules/export/readSheetUniversal.js +2 -2
  109. package/modules/export/readSheetUniversal.js.map +1 -1
  110. package/modules/export/readSheetWebWorker.js +7 -8
  111. package/modules/export/readSheetWebWorker.js.map +1 -1
  112. package/modules/export/readXlsxFileBrowser.js +3 -5
  113. package/modules/export/readXlsxFileBrowser.js.map +1 -1
  114. package/modules/export/readXlsxFileNode.js +3 -5
  115. package/modules/export/readXlsxFileNode.js.map +1 -1
  116. package/modules/export/readXlsxFileUniversal.js +2 -2
  117. package/modules/export/readXlsxFileUniversal.js.map +1 -1
  118. package/modules/export/readXlsxFileWebWorker.js +7 -8
  119. package/modules/export/readXlsxFileWebWorker.js.map +1 -1
  120. package/modules/export/unpackXlsxFileBrowser.js +15 -4
  121. package/modules/export/unpackXlsxFileBrowser.js.map +1 -1
  122. package/modules/export/unpackXlsxFileBrowser.test.js.map +1 -0
  123. package/modules/export/unpackXlsxFileNode.js +32 -5
  124. package/modules/export/unpackXlsxFileNode.js.map +1 -1
  125. package/modules/export/unpackXlsxFileNode.test.js.map +1 -0
  126. package/modules/export/unpackXlsxFileUniversal.js +14 -3
  127. package/modules/export/unpackXlsxFileUniversal.js.map +1 -1
  128. package/modules/export/unpackXlsxFileUniversal.test.js.map +1 -0
  129. package/modules/parseSheetData/parseSheetData.js +9 -6
  130. package/modules/parseSheetData/parseSheetData.js.map +1 -1
  131. package/modules/utility/convertValuesFromUint8ArraysToStrings.js +92 -0
  132. package/modules/utility/convertValuesFromUint8ArraysToStrings.js.map +1 -0
  133. package/modules/xlsx/InvalidSpreadsheetError.js +50 -0
  134. package/modules/xlsx/InvalidSpreadsheetError.js.map +1 -0
  135. package/modules/xlsx/SheetNotFoundError.js +50 -0
  136. package/modules/xlsx/SheetNotFoundError.js.map +1 -0
  137. package/modules/xlsx/file/InputValidationStream.js +96 -0
  138. package/modules/xlsx/file/InputValidationStream.js.map +1 -0
  139. package/modules/xlsx/file/InputValidationStream.test.js.map +1 -0
  140. package/modules/xlsx/file/InvalidInputError.js +100 -0
  141. package/modules/xlsx/file/InvalidInputError.js.map +1 -0
  142. package/modules/xlsx/file/createFileTypeDetector.js +63 -0
  143. package/modules/xlsx/file/createFileTypeDetector.js.map +1 -0
  144. package/modules/xlsx/file/createFileTypeDetector.test.js.map +1 -0
  145. package/modules/xlsx/file/validateLeadingBytes.js +37 -0
  146. package/modules/xlsx/file/validateLeadingBytes.js.map +1 -0
  147. package/modules/xlsx/file/validateLeadingBytes.test.js.map +1 -0
  148. package/modules/xlsx/isDateFormat.js +31 -27
  149. package/modules/xlsx/isDateFormat.js.map +1 -1
  150. package/modules/xlsx/isDateFormatStyle.js +18 -21
  151. package/modules/xlsx/isDateFormatStyle.js.map +1 -1
  152. package/modules/xlsx/parseCell.js +251 -111
  153. package/modules/xlsx/parseCell.js.map +1 -1
  154. package/modules/xlsx/parseCellAddress.js +21 -18
  155. package/modules/xlsx/parseCellAddress.js.map +1 -1
  156. package/modules/xlsx/parseExcelDate.js +4 -124
  157. package/modules/xlsx/parseExcelDate.js.map +1 -1
  158. package/modules/xlsx/parseExcelDate.test.js.map +1 -1
  159. package/modules/xlsx/parseExcelTimestamp.js +133 -0
  160. package/modules/xlsx/parseExcelTimestamp.js.map +1 -0
  161. package/modules/xlsx/parseFilePaths.js +48 -47
  162. package/modules/xlsx/parseFilePaths.js.map +1 -1
  163. package/modules/xlsx/parseSharedStrings.js +91 -37
  164. package/modules/xlsx/parseSharedStrings.js.map +1 -1
  165. package/modules/xlsx/parseSheet.js +526 -68
  166. package/modules/xlsx/parseSheet.js.map +1 -1
  167. package/modules/xlsx/parseSpreadsheetContents.js +153 -81
  168. package/modules/xlsx/parseSpreadsheetContents.js.map +1 -1
  169. package/modules/xlsx/parseSpreadsheetInfo.js +60 -59
  170. package/modules/xlsx/parseSpreadsheetInfo.js.map +1 -1
  171. package/modules/xlsx/parseStyles.js +75 -75
  172. package/modules/xlsx/parseStyles.js.map +1 -1
  173. package/modules/xml/parseXml.js +106 -0
  174. package/modules/xml/parseXml.js.map +1 -0
  175. package/modules/xml/parseXml.test.js.map +1 -0
  176. package/modules/xml/parseXmlStream.js +2 -0
  177. package/modules/xml/parseXmlStream.js.map +1 -1
  178. package/modules/xml/parseXmlStream.sax.js +69 -28
  179. package/modules/xml/parseXmlStream.sax.js.map +1 -1
  180. package/modules/xml/parseXmlStream.saxen.js +67 -40
  181. package/modules/xml/parseXmlStream.saxen.js.map +1 -1
  182. package/modules/zip/UnzipError.js +49 -0
  183. package/modules/zip/UnzipError.js.map +1 -0
  184. package/modules/zip/unzipFromArrayBuffer.js +21 -1
  185. package/modules/zip/unzipFromArrayBuffer.js.map +1 -1
  186. package/modules/zip/unzipFromArrayBuffer.test.js.map +1 -0
  187. package/modules/zip/unzipFromStream.fflate.js +41 -35
  188. package/modules/zip/unzipFromStream.fflate.js.map +1 -1
  189. package/modules/zip/unzipFromStream.js +124 -1
  190. package/modules/zip/unzipFromStream.js.map +1 -1
  191. package/modules/zip/unzipFromStream.unzipper.js +19 -35
  192. package/modules/zip/unzipFromStream.unzipper.js.map +1 -1
  193. package/node/index.cjs +3 -0
  194. package/node/index.d.ts +16 -0
  195. package/node/index.js +3 -0
  196. package/package.json +5 -3
  197. package/types/InvalidInputError.d.ts +16 -0
  198. package/types/InvalidSpreadsheetError.d.ts +4 -0
  199. package/types/SheetNotFoundError.d.ts +4 -0
  200. package/universal/index.cjs +3 -0
  201. package/universal/index.d.ts +16 -0
  202. package/universal/index.js +3 -0
  203. package/web-worker/index.cjs +3 -0
  204. package/web-worker/index.d.ts +16 -0
  205. package/web-worker/index.js +3 -0
  206. package/commonjs/export/convertValuesFromUint8ArraysToStrings.js +0 -23
  207. package/commonjs/export/convertValuesFromUint8ArraysToStrings.js.map +0 -1
  208. package/commonjs/xlsx/convertCellsToData2dArray.js +0 -84
  209. package/commonjs/xlsx/convertCellsToData2dArray.js.map +0 -1
  210. package/commonjs/xlsx/dropEmptyColumns.js +0 -40
  211. package/commonjs/xlsx/dropEmptyColumns.js.map +0 -1
  212. package/commonjs/xlsx/dropEmptyColumns.test.js.map +0 -1
  213. package/commonjs/xlsx/dropEmptyRows.js +0 -43
  214. package/commonjs/xlsx/dropEmptyRows.js.map +0 -1
  215. package/commonjs/xlsx/dropEmptyRows.test.js.map +0 -1
  216. package/commonjs/xlsx/parseCellValue.js +0 -189
  217. package/commonjs/xlsx/parseCellValue.js.map +0 -1
  218. package/commonjs/xlsx/parseNumber.js +0 -20
  219. package/commonjs/xlsx/parseNumber.js.map +0 -1
  220. package/commonjs/xlsx/parseSharedString.js +0 -64
  221. package/commonjs/xlsx/parseSharedString.js.map +0 -1
  222. package/commonjs/xlsx/parseSheetData.js +0 -68
  223. package/commonjs/xlsx/parseSheetData.js.map +0 -1
  224. package/commonjs/xlsx/reconstructSheetDimensionsFromSheetCells.js +0 -29
  225. package/commonjs/xlsx/reconstructSheetDimensionsFromSheetCells.js.map +0 -1
  226. package/commonjs/xml/parseXmlStream.saxen.code.js +0 -953
  227. package/commonjs/xml/parseXmlStream.saxen.code.js.map +0 -1
  228. package/commonjs/xml/parseXmlStream.test.js.map +0 -1
  229. package/modules/export/convertValuesFromUint8ArraysToStrings.js +0 -17
  230. package/modules/export/convertValuesFromUint8ArraysToStrings.js.map +0 -1
  231. package/modules/xlsx/convertCellsToData2dArray.js +0 -77
  232. package/modules/xlsx/convertCellsToData2dArray.js.map +0 -1
  233. package/modules/xlsx/dropEmptyColumns.js +0 -34
  234. package/modules/xlsx/dropEmptyColumns.js.map +0 -1
  235. package/modules/xlsx/dropEmptyColumns.test.js.map +0 -1
  236. package/modules/xlsx/dropEmptyRows.js +0 -37
  237. package/modules/xlsx/dropEmptyRows.js.map +0 -1
  238. package/modules/xlsx/dropEmptyRows.test.js.map +0 -1
  239. package/modules/xlsx/parseCellValue.js +0 -183
  240. package/modules/xlsx/parseCellValue.js.map +0 -1
  241. package/modules/xlsx/parseNumber.js +0 -14
  242. package/modules/xlsx/parseNumber.js.map +0 -1
  243. package/modules/xlsx/parseSharedString.js +0 -55
  244. package/modules/xlsx/parseSharedString.js.map +0 -1
  245. package/modules/xlsx/parseSheetData.js +0 -55
  246. package/modules/xlsx/parseSheetData.js.map +0 -1
  247. package/modules/xlsx/reconstructSheetDimensionsFromSheetCells.js +0 -23
  248. package/modules/xlsx/reconstructSheetDimensionsFromSheetCells.js.map +0 -1
  249. package/modules/xml/parseXmlStream.saxen.code.js +0 -947
  250. package/modules/xml/parseXmlStream.saxen.code.js.map +0 -1
  251. package/modules/xml/parseXmlStream.test.js.map +0 -1
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.BUILT_IN_DATE_FORMAT_IDS = void 0;
6
7
  exports["default"] = isDateFormatStyle;
7
8
  var _isDateFormat = _interopRequireDefault(require("./isDateFormat.js"));
8
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -12,27 +13,22 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
12
13
  // Whether a numeric value is a number or a date timestamp, it sometimes could be
13
14
  // detected by looking at the value "format" and seeing if it's a date-specific one.
14
15
 
15
- function isDateFormatStyle(styleId, styles, options) {
16
- if (styleId !== undefined) {
17
- var style = styles[styleId];
18
- if (!style) {
19
- throw new Error("Cell style not found: ".concat(styleId));
20
- }
21
- if (!style.numberFormat) {
22
- return false;
23
- }
24
- if (
25
- // Whether it's a "number format" that's conventionally used for storing date timestamps.
26
- BUILT_IN_DATE_FORMAT_IDS.indexOf(style.numberFormat.id) >= 0 ||
27
- // Whether it's a "number format" that uses a "formatting template"
28
- // that the developer is certain is a date formatting template.
29
- options.dateFormat && style.numberFormat.template === options.dateFormat ||
30
- // Whether the "smart formatting template" feature is not disabled
31
- // and it has detected that it's a date formatting template by looking at it.
32
- options.smartDateParser !== false && style.numberFormat.template && (0, _isDateFormat["default"])(style.numberFormat.template)) {
33
- return true;
34
- }
16
+ function isDateFormatStyle(style, defaultDateFormat, shouldGuessDateFormatFromNumberFormatTemplate) {
17
+ if (!style.numberFormat) {
18
+ return false;
35
19
  }
20
+ if (
21
+ // Whether it's a "number format" that's conventionally used for storing date timestamps.
22
+ BUILT_IN_DATE_FORMAT_IDS.indexOf(style.numberFormat.id) >= 0 ||
23
+ // Whether it's a "number format" that uses a "formatting template"
24
+ // that the developer is certain is a date formatting template.
25
+ defaultDateFormat && style.numberFormat.template === defaultDateFormat ||
26
+ // Whether the "smart formatting template" feature is not disabled
27
+ // and it has detected that it's a date formatting template by looking at it.
28
+ shouldGuessDateFormatFromNumberFormatTemplate && style.numberFormat.template && (0, _isDateFormat["default"])(style.numberFormat.template)) {
29
+ return true;
30
+ }
31
+ return false;
36
32
  }
37
33
 
38
34
  // Built-in formats have ID < 164.
@@ -176,8 +172,10 @@ var THAI_LOCALE_BUILT_IN_DATE_FORMAT_IDS = [71,
176
172
  81 // d/m/bb
177
173
  ];
178
174
 
175
+ // This is exported only to be passed in `worker-f` dependencies.
176
+ //
179
177
  // Start with language-agnostic date format IDs.
180
- var BUILT_IN_DATE_FORMAT_IDS = LOCALE_INDEPENDENT_BUILT_IN_DATE_FORMAT_IDS.concat(
178
+ var BUILT_IN_DATE_FORMAT_IDS = exports.BUILT_IN_DATE_FORMAT_IDS = LOCALE_INDEPENDENT_BUILT_IN_DATE_FORMAT_IDS.concat(
181
179
  // Add Mainland Chinese or Taiwanese date format IDs that haven't already been added.
182
180
  MAINLAND_CHINESE_OR_TAIWANESE_LOCALE_BUILT_IN_DATE_FORMAT_IDS).concat(
183
181
  // Add Japanese or Korean date format IDs that haven't already been added.
@@ -1 +1 @@
1
- {"version":3,"file":"isDateFormatStyle.js","names":["_isDateFormat","_interopRequireDefault","require","obj","__esModule","isDateFormatStyle","styleId","styles","options","undefined","style","Error","concat","numberFormat","BUILT_IN_DATE_FORMAT_IDS","indexOf","id","dateFormat","template","smartDateParser","isDateFormat","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","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(styleId, styles, options) {\r\n if (styleId !== undefined) {\r\n const style = styles[styleId]\r\n if (!style) {\r\n throw new Error(`Cell style not found: ${styleId}`)\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 (options.dateFormat && style.numberFormat.template === options.dateFormat) ||\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 (options.smartDateParser !== false && style.numberFormat.template && isDateFormat(style.numberFormat.template))\r\n ) {\r\n return true\r\n }\r\n }\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// Start with language-agnostic date format IDs.\r\nconst 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":";;;;;;AAMA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4C,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAN5C;AACA;AACA;AACA;AACA;;AAIe,SAASE,iBAAiBA,CAACC,OAAO,EAAEC,MAAM,EAAEC,OAAO,EAAE;EAClE,IAAIF,OAAO,KAAKG,SAAS,EAAE;IACzB,IAAMC,KAAK,GAAGH,MAAM,CAACD,OAAO,CAAC;IAC7B,IAAI,CAACI,KAAK,EAAE;MACV,MAAM,IAAIC,KAAK,0BAAAC,MAAA,CAA0BN,OAAO,CAAE,CAAC;IACrD;IACA,IAAI,CAACI,KAAK,CAACG,YAAY,EAAE;MACvB,OAAO,KAAK;IACd;IACA;IACE;IACAC,wBAAwB,CAACC,OAAO,CAACL,KAAK,CAACG,YAAY,CAACG,EAAE,CAAC,IAAI,CAAC;IAC5D;IACA;IACCR,OAAO,CAACS,UAAU,IAAIP,KAAK,CAACG,YAAY,CAACK,QAAQ,KAAKV,OAAO,CAACS,UAAW;IAC1E;IACA;IACCT,OAAO,CAACW,eAAe,KAAK,KAAK,IAAIT,KAAK,CAACG,YAAY,CAACK,QAAQ,IAAI,IAAAE,wBAAY,EAACV,KAAK,CAACG,YAAY,CAACK,QAAQ,CAAE,EAC9G;MACD,OAAO,IAAI;IACb;EACF;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMG,2CAA2C,GAAG,CAClD,EAAE;AAAE;AACJ,EAAE;AAAE;AACJ,EAAE;AAAE;AACJ,EAAE;AAAE;AACJ,EAAE;AAAE;A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6DACF,CAAC,CAACV,MAAM;AACN;AACAW,kDAAkD,CAACE,MAAM,CACvD,UAAAC,cAAc;EAAA,OAAIJ,6DAA6D,CAACP,OAAO,CAACW,cAAc,CAAC,GAAG,CAAC;AAAA,CAC7G,CACF,CAAC,CAACd,MAAM;AACN;AACAY,oCAAoC,CAACC,MAAM,CACzC,UAAAC,cAAc;EAAA,OAAIJ,6DAA6D,CAACP,OAAO,CAACW,cAAc,CAAC,GAAG,CAAC;AAAA,CAC7G,CAAC,CAACD,MAAM,CACN,UAAAC,cAAc;EAAA,OAAIH,kDAAkD,CAACR,OAAO,CAACW,cAAc,CAAC,GAAG,CAAC;AAAA,CAClG,CACF,CAAC"}
1
+ {"version":3,"file":"isDateFormatStyle.js","names":["_isDateFormat","_interopRequireDefault","require","obj","__esModule","isDateFormatStyle","style","defaultDateFormat","shouldGuessDateFormatFromNumberFormatTemplate","numberFormat","BUILT_IN_DATE_FORMAT_IDS","indexOf","id","template","isDateFormat","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","exports","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":";;;;;;;AAMA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA4C,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAN5C;AACA;AACA;AACA;AACA;;AAIe,SAASE,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,IAAI,IAAAC,wBAAY,EAACR,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,IAAME,2CAA2C,GAAG,CAClD,EAAE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AE;AAAA,CACL;;AAED;AACA;AACA;AACO,IAAMR,wBAAwB,GAAAS,OAAA,CAAAT,wBAAA,GAAGK,2CAA2C,CAACK,MAAM;AACxF;AACAJ,6DACF,CAAC,CAACI,MAAM;AACN;AACAH,kDAAkD,CAACI,MAAM,CACvD,UAAAC,cAAc;EAAA,OAAIN,6DAA6D,CAACL,OAAO,CAACW,cAAc,CAAC,GAAG,CAAC;AAAA,CAC7G,CACF,CAAC,CAACF,MAAM;AACN;AACAF,oCAAoC,CAACG,MAAM,CACzC,UAAAC,cAAc;EAAA,OAAIN,6DAA6D,CAACL,OAAO,CAACW,cAAc,CAAC,GAAG,CAAC;AAAA,CAC7G,CAAC,CAACD,MAAM,CACN,UAAAC,cAAc;EAAA,OAAIL,kDAAkD,CAACN,OAAO,CAACW,cAAc,CAAC,GAAG,CAAC;AAAA,CAClG,CACF,CAAC"}
@@ -3,13 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.createInitialStateInCell = createInitialStateInCell;
6
+ exports.EMPTY_CELL = void 0;
7
7
  exports["default"] = parseCell;
8
- exports.onCloseTagInCell = onCloseTagInCell;
9
- exports.onOpenTagInCell = onOpenTagInCell;
10
- exports.onTextInCell = onTextInCell;
11
- var _parseCellValue = _interopRequireDefault(require("./parseCellValue.js"));
12
- var _parseCellAddress3 = _interopRequireDefault(require("./parseCellAddress.js"));
8
+ var _parseExcelTimestamp = _interopRequireDefault(require("./parseExcelTimestamp.js"));
9
+ var _isDateFormatStyle = _interopRequireDefault(require("./isDateFormatStyle.js"));
13
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
14
11
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
12
  function _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."); }
@@ -17,116 +14,256 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
17
14
  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; }
18
15
  function _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; } }
19
16
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
- // Example of a `<c/>`ell element:
21
- //
22
- // <c>
23
- // <f>string</f> formula.
24
- // <v>string</v> formula pre-computed value.
25
- // <is>
26
- // <t>string</t> — an `inlineStr` string (rather than a "common string" from a dictionary).
27
- // <r>
28
- // <rPr>
29
- // ...
30
- // </rPr>
31
- // <t>string</t>
32
- // </r>
33
- // <rPh sb="1" eb="1">
34
- // <t>string</t>
35
- // </rPh>
36
- // <phoneticPr fontId="1"/>
37
- // </is>
38
- // <extLst>
39
- // <ext>
40
- // <!--any element-->
41
- // </ext>
42
- // </extLst>
43
- // </c>
44
- //
45
- function parseCell(attributes, value, inlineString, sharedStrings, styles, epoch1904, options) {
46
- var _parseCellAddress = (0, _parseCellAddress3["default"])(attributes.r),
47
- _parseCellAddress2 = _slicedToArray(_parseCellAddress, 2),
48
- row = _parseCellAddress2[0],
49
- column = _parseCellAddress2[1];
50
- var type = attributes.t;
51
- var styleId = attributes.s ? Number(attributes.s) : undefined;
52
- return {
53
- row: row,
54
- column: column,
55
- value: (0, _parseCellValue["default"])(value, type, {
56
- inlineString: inlineString,
57
- styleId: styleId,
58
- styles: styles,
59
- sharedStrings: sharedStrings,
60
- epoch1904: epoch1904,
61
- options: options
62
- })
63
- };
64
- }
65
- function createInitialStateInCell() {
66
- return {
67
- v: false,
68
- is: false,
69
- t: false,
70
- r: false,
71
- rPh: false,
72
- value: undefined,
73
- inlineString: undefined,
74
- attributes: undefined
75
- };
76
- }
77
- function onOpenTagInCell(tagName, attributes, state) {
78
- if (tagName === 'v') {
79
- state.v = true;
80
- } else if (tagName === 'is') {
81
- // The possible children of <is> are:
82
- // * <t> (Text): The standard child to hold plain, simple text.
83
- // * <r> (Rich Text Run): Used for applying different formatting styles (like bold or italic) to specific segments of text within a single cell.
84
- // * <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>.
85
- // * <phoneticPr> (Phonetic Properties): Defines formatting and settings for the phonetic text.
86
- state.is = true;
87
- state.inlineString = '';
88
- } else if (tagName === 't') {
89
- state.t = true;
90
- } else if (tagName === 'r') {
91
- // The possible children of <r/> are:
92
- // * <rPr> (Run Properties): The formatting properties for the text (font, size, color, bold, italic, etc.).
93
- // * <t> (Text): The actual text payload.
94
- // * <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>.
95
- state.r = true;
96
- } else if (tagName === 'rPh') {
97
- // The possible children of <rPh/> are:
98
- // * <t> (Text): Contains the actual phonetic text or reading (usually in Katakana for Japanese) that corresponds to the associated character string.
99
- state.rPh = true;
100
- }
101
- }
102
- function onCloseTagInCell(tagName, state) {
103
- if (tagName === 'v') {
104
- state.v = false;
105
- } else if (tagName === 'is') {
106
- state.is = false;
107
- } else if (tagName === 't') {
108
- state.t = false;
109
- } else if (tagName === 'r') {
110
- state.r = false;
111
- } else if (tagName === 'rPh') {
112
- state.rPh = false;
113
- }
114
- }
115
- function onTextInCell(text, state) {
116
- if (state.v) {
117
- state.value = text;
118
- } else if (state.is) {
119
- if (state.rPh) {
120
- // Ignore anything inside `<rPh/>` tags
121
- } else if (state.t) {
122
- if (state.r) {
123
- // An `<r/>` element could contain multiple `<t/>` elements,
124
- // the text content from all of which should be concatenated.
125
- state.inlineString += text;
126
- } else {
127
- state.inlineString = text;
17
+ // An empty cell has `null` value.
18
+ var EMPTY_CELL_VALUE = null;
19
+
20
+ // This variable represents a cell with a `null` value.
21
+ // It is exported only to be specified as a dependency when using `worker-f`.
22
+ var EMPTY_CELL = exports.EMPTY_CELL = [null, EMPTY_CELL_VALUE];
23
+
24
+ /**
25
+ * Parses a cell from the info extracted from XML.
26
+ * @param {string} [t] — `<c t/>` attribute value (cell type). One of: b (Boolean), e (Error), n (Number), d (Date), s (String).
27
+ * @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.
28
+ * @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.
29
+ * @param {string} [inlineString] — Inline string value.
30
+ * @param {any[]} parameters
31
+ * @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`.
32
+ */
33
+ function parseCell(t, s, v, inlineString, _ref) {
34
+ var _ref2 = _slicedToArray(_ref, 6),
35
+ sharedStrings = _ref2[0],
36
+ styles = _ref2[1],
37
+ epoch1904 = _ref2[2],
38
+ defaultDateFormat = _ref2[3],
39
+ dateTemplateParser = _ref2[4],
40
+ parseNumberCustom = _ref2[5];
41
+ // Available Excel cell types:
42
+ // https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md
43
+ //
44
+ // Some other document (seems to be old):
45
+ // http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/ST_CellType.html
46
+ //
47
+ // The default cell type is "n" (numeric), according to XLSX specification.
48
+ //
49
+ switch (t || 'n') {
50
+ // `t="str"` means that the cell value is calculated using a formula.
51
+ // The formula is defined as the text of a child `<f/>` element.
52
+ //
53
+ // It could optionally include a `<v/>` element whose text is the cached result
54
+ // of the calculation from the last time the file was saved in a spreadsheet editor application.
55
+ //
56
+ // An optional `<v/>` element holds a pre-computed result of the formula defined by `<f/>`.
57
+ //
58
+ // Example:
59
+ //
60
+ // <c r="B3" t="str">
61
+ // <f>CONCATENATE(C1,D1)</f>
62
+ // <v>C1ValueD1Value</v>
63
+ // </c>
64
+ //
65
+ // Here's a guide on formulas in XLSX files:
66
+ // https://github.com/MiniMax-AI/skills/blob/main/skills/minimax-xlsx/references/validate.md
67
+ //
68
+ case 'str':
69
+ // The `<v/>` element could be absent because it's not required to be pre-computed by the spec.
70
+ // In such case, `v` argument value would be `undefined`.
71
+ // Because this package can't include the whole formula calculation engine,
72
+ // it has to interpret this situation as an error.
73
+ if (v === undefined) {
74
+ return 'VALUE_MISSING';
75
+ }
76
+ // The `<v/>` element could be present but its text content could be empty
77
+ // because the formula returns an empty string.
78
+ // For example, a valid case of `v` argument value being an empty string `""` is when
79
+ // a formula in cell `A1` is `=CONCATENATE(B1,C1)` and both `B1` and `C1` cells are empty.
80
+ if (!v) {
81
+ return EMPTY_CELL;
82
+ }
83
+ return ['s', v];
84
+
85
+ // `t="inlineStr"` means that `<is/>` holds the string value.
86
+ //
87
+ // Inside a `<c t="inlineStr"/>`, the specification requires there to exist an `<is/>` element,
88
+ // and within that `<is/>` element it requires to exist a `<t/>` element.
89
+ //
90
+ // Example:
91
+ //
92
+ // <c r="A1" s="1" t="inlineStr">
93
+ // <is>
94
+ // <t>
95
+ // Test 123
96
+ // </t>
97
+ // </is>
98
+ // </c>
99
+ //
100
+ case 'inlineStr':
101
+ if (inlineString === undefined) {
102
+ return 'VALUE_MISSING';
103
+ }
104
+ return ['s', inlineString];
105
+
106
+ // `type="s"` means that the string value is stored in the Shared Strings Table.
107
+ // This way it attempts to compress the `.xlsx` file by reusing all string values
108
+ // in case they repeat throughout the spreadsheet.
109
+ //
110
+ // This optimization can't be used when writing an `.xlsx` file in a "streaming"
111
+ // fashion, i.e. when the entire spreadsheet data is not known in adavance
112
+ // at the start of writing the file.
113
+ // But it can be used in all other situations. And hence, it is used.
114
+ // So this is the most common cell type, actually.
115
+ //
116
+ // Example:
117
+ //
118
+ // <c r="A3" t="s">
119
+ // <v>3</v>
120
+ // </c>
121
+ //
122
+ case 's':
123
+ // If a cell has no value then there's no `<c/>` element for it.
124
+ // If a `<c/>` element exists then it's not empty.
125
+ // The `<v/>` element's text is a zero-based index in the "shared strings" dictionary.
126
+ if (!v) {
127
+ return 'VALUE_MISSING';
128
+ }
129
+ var sharedStringIndex = Number(v);
130
+ // The shared string index value could be:
131
+ // * not a number
132
+ // * a number but a fractional one
133
+ // * an integer that is out of bounds of the shared strings array
134
+ if (isNaN(sharedStringIndex) || sharedStrings[sharedStringIndex] === undefined) {
135
+ return 'VALUE_INVALID';
136
+ }
137
+ return ['s', sharedStrings[sharedStringIndex]];
138
+
139
+ // Boolean (TRUE/FALSE) values are stored as either "1" or "0" in cells of type "b".
140
+ //
141
+ // Example:
142
+ //
143
+ // <c r="A1" t="b">
144
+ // <v>1</v>
145
+ // </c>
146
+ //
147
+ case 'b':
148
+ if (!v) {
149
+ return 'VALUE_MISSING';
150
+ }
151
+ if (v === '1') {
152
+ return ['b', true];
153
+ }
154
+ if (v === '0') {
155
+ return ['b', false];
156
+ }
157
+ return 'VALUE_INVALID';
158
+
159
+ // If cell type is "e", the `<v/>` element's text is an error code string (required).
160
+ //
161
+ // Example:
162
+ //
163
+ // <c r="A1" t="e">
164
+ // <f>1/0</f>
165
+ // <v>#DIV/0!</v>
166
+ // </c>
167
+ //
168
+ case 'e':
169
+ // Examples of error codes:
170
+ //
171
+ // '#NULL!'
172
+ // '#DIV/0!'
173
+ // '#VALUE!'
174
+ // '#REF!'
175
+ // '#NAME!'
176
+ // '#NUM!'
177
+ // '#N/A'
178
+ // '#SPILL!'
179
+ //
180
+ // The description of each error could be read in the formulas guide:
181
+ // https://github.com/MiniMax-AI/skills/blob/main/skills/minimax-xlsx/references/validate.md
182
+ //
183
+ if (!v) {
184
+ return 'VALUE_MISSING';
185
+ }
186
+ return ['e', v];
187
+
188
+ // XLSX supports date cells of type "d", though it seems like it (almost?) never
189
+ // uses type "d" for storing dates, preferring type "n" and numeric timestamp instead.
190
+ // The value of a "d" cell is supposedly a string in "ISO 8601" format.
191
+ // I haven't seen an `.xlsx` file having such cells.
192
+ //
193
+ // Example:
194
+ //
195
+ // <c r="A1" s="1" t="d">
196
+ // <v>
197
+ // 2021-06-10T00:47:45.700Z
198
+ // </v>
199
+ // </c>
200
+ //
201
+ case 'd':
202
+ if (!v) {
203
+ return EMPTY_CELL;
204
+ }
205
+ var parsedDate = new Date(v);
206
+ if (isNaN(parsedDate.valueOf())) {
207
+ return 'VALUE_INVALID';
208
+ }
209
+ return ['d', parsedDate.getTime()];
210
+
211
+ // type "n" is used for numeric cells.
212
+ //
213
+ // An optional `s` attribute defines how this number should be formatted — 
214
+ // it should be a zero-based index of the style (XF record) in `styles.xml`.
215
+ //
216
+ // Example:
217
+ //
218
+ // <c r="A1" s="1" t="n">
219
+ // <v>123.45</v>
220
+ // </c>
221
+ //
222
+ case 'n':
223
+ // Numeric cell value is allowed to be missing in the XLSX specification
224
+ // because "n" is the default type of a cell, so it ends up representing empty cells too.
225
+ if (!v) {
226
+ return EMPTY_CELL;
227
+ }
228
+ // XLSX does support `type: "d"` cells for storing dates, but it's not commonly used.
229
+ // Instead, it prefers using `type: "n"` cells for storing dates as timestamps
230
+ // with a corresponding `s` formatting style.
231
+ if (s) {
232
+ var styleId = Number(s);
233
+ // The style ID value could be:
234
+ // * not a number
235
+ // * a number but a fractional one
236
+ // * an integer that is out of bounds of the styles array
237
+ if (isNaN(styleId) || styles[styleId] === undefined) {
238
+ return 'FORMAT_INVALID';
239
+ }
240
+ // Whether it's a date cell or just a numeric cell could only be determined
241
+ // by looking at the formatting style.
242
+ if ((0, _isDateFormatStyle["default"])(styles[styleId], defaultDateFormat, dateTemplateParser)) {
243
+ var timestamp = Number(v);
244
+ if (isNaN(timestamp)) {
245
+ return 'VALUE_INVALID';
246
+ }
247
+ // First, parse the "serial date" number from string.
248
+ // Then convert the "serial date" number to a date timestamp.
249
+ return ['d', (0, _parseExcelTimestamp["default"])(timestamp, epoch1904)];
250
+ }
251
+ }
252
+ // Return the cell value as a number,
253
+ // unless custom `parseNumber()` function was passed,
254
+ // in which case return the number as an unparsed string.
255
+ // Some people prefer passing a custom `parseNumber()` function
256
+ // to parse "big integers" without losing any precision.
257
+ if (parseNumberCustom) {
258
+ return ['n', v];
259
+ }
260
+ var number = Number(v);
261
+ if (isNaN(number)) {
262
+ return 'VALUE_INVALID';
128
263
  }
129
- }
264
+ return ['n', number];
265
+ default:
266
+ return 'TYPE_INVALID';
130
267
  }
131
268
  }
132
269
  //# sourceMappingURL=parseCell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"parseCell.js","names":["_parseCellValue","_interopRequireDefault","require","_parseCellAddress3","obj","__esModule","_slicedToArray","arr","i","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","o","minLen","_arrayLikeToArray","n","Object","prototype","toString","call","slice","constructor","name","Array","from","test","len","length","arr2","r","l","t","Symbol","iterator","e","u","a","f","next","done","push","value","isArray","parseCell","attributes","inlineString","sharedStrings","styles","epoch1904","options","_parseCellAddress","parseCellAddress","_parseCellAddress2","row","column","type","styleId","s","Number","undefined","parseCellValue","createInitialStateInCell","v","is","rPh","onOpenTagInCell","tagName","state","onCloseTagInCell","onTextInCell","text"],"sources":["../../source/xlsx/parseCell.js"],"sourcesContent":["import parseCellValue from './parseCellValue.js'\r\nimport parseCellAddress from './parseCellAddress.js'\r\n\r\n// Example of a `<c/>`ell element:\r\n//\r\n// <c>\r\n// <f>string</f> — formula.\r\n// <v>string</v> — formula pre-computed value.\r\n// <is>\r\n// <t>string</t> — an `inlineStr` string (rather than a \"common string\" from a dictionary).\r\n// <r>\r\n// <rPr>\r\n// ...\r\n// </rPr>\r\n// <t>string</t>\r\n// </r>\r\n// <rPh sb=\"1\" eb=\"1\">\r\n// <t>string</t>\r\n// </rPh>\r\n// <phoneticPr fontId=\"1\"/>\r\n// </is>\r\n// <extLst>\r\n// <ext>\r\n// <!--any element-->\r\n// </ext>\r\n// </extLst>\r\n// </c>\r\n//\r\nexport default function parseCell(\r\n attributes,\r\n value,\r\n inlineString,\r\n sharedStrings,\r\n styles,\r\n epoch1904,\r\n options\r\n) {\r\n const [row, column] = parseCellAddress(attributes.r)\r\n const type = attributes.t\r\n const styleId = attributes.s ? Number(attributes.s) : undefined\r\n\r\n return {\r\n row,\r\n column,\r\n value: parseCellValue(value, type, {\r\n inlineString,\r\n styleId,\r\n styles,\r\n sharedStrings,\r\n epoch1904,\r\n options\r\n })\r\n }\r\n}\r\n\r\nexport function createInitialStateInCell() {\r\n return {\r\n v: false,\r\n is: false,\r\n t: false,\r\n r: false,\r\n rPh: false,\r\n value: undefined,\r\n inlineString: undefined,\r\n attributes: undefined\r\n }\r\n}\r\n\r\nexport function onOpenTagInCell(tagName, attributes, state) {\r\n if (tagName === 'v') {\r\n state.v = true\r\n } else if (tagName === 'is') {\r\n // The possible children of <is> are:\r\n // * <t> (Text): The standard child to hold plain, simple text.\r\n // * <r> (Rich Text Run): Used for applying different formatting styles (like bold or italic) to specific segments of text within a single cell.\r\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>.\r\n // * <phoneticPr> (Phonetic Properties): Defines formatting and settings for the phonetic text.\r\n state.is = true\r\n state.inlineString = ''\r\n } else if (tagName === 't') {\r\n state.t = true\r\n } else if (tagName === 'r') {\r\n // The possible children of <r/> are:\r\n // * <rPr> (Run Properties): The formatting properties for the text (font, size, color, bold, italic, etc.).\r\n // * <t> (Text): The actual text payload.\r\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>.\r\n state.r = true\r\n } else if (tagName === 'rPh') {\r\n // The possible children of <rPh/> are:\r\n // * <t> (Text): Contains the actual phonetic text or reading (usually in Katakana for Japanese) that corresponds to the associated character string.\r\n state.rPh = true\r\n }\r\n}\r\n\r\nexport function onCloseTagInCell(tagName, state) {\r\n if (tagName === 'v') {\r\n state.v = false\r\n } else if (tagName === 'is') {\r\n state.is = false\r\n } else if (tagName === 't') {\r\n state.t = false\r\n } else if (tagName === 'r') {\r\n state.r = false\r\n } else if (tagName === 'rPh') {\r\n state.rPh = false\r\n }\r\n}\r\n\r\nexport function onTextInCell(text, state) {\r\n if (state.v) {\r\n state.value = text\r\n } else if (state.is) {\r\n if (state.rPh) {\r\n // Ignore anything inside `<rPh/>` tags\r\n } else if (state.t) {\r\n if (state.r) {\r\n // An `<r/>` element could contain multiple `<t/>` elements,\r\n // the text content from all of which should be concatenated.\r\n state.inlineString += text\r\n } else {\r\n state.inlineString = text\r\n }\r\n }\r\n }\r\n}\r\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAoD,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,gBAAAA,GAAA;AAAA,SAAAE,eAAAC,GAAA,EAAAC,CAAA,WAAAC,eAAA,CAAAF,GAAA,KAAAG,qBAAA,CAAAH,GAAA,EAAAC,CAAA,KAAAG,2BAAA,CAAAJ,GAAA,EAAAC,CAAA,KAAAI,gBAAA;AAAA,SAAAA,iBAAA,cAAAC,SAAA;AAAA,SAAAF,4BAAAG,CAAA,EAAAC,MAAA,SA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AAIqC,OAAO,KAAK,KAAK,EAAE;IAC5BC,KAAK,CAACH,GAAG,GAAG,KAAK;EACnB;AACF;AAEO,SAASK,YAAYA,CAACC,IAAI,EAAEH,KAAK,EAAE;EACxC,IAAIA,KAAK,CAACL,CAAC,EAAE;IACXK,KAAK,CAAC1B,KAAK,GAAG6B,IAAI;EACpB,CAAC,MAAM,IAAIH,KAAK,CAACJ,EAAE,EAAE;IACnB,IAAII,KAAK,CAACH,GAAG,EAAE;MACb;IAAA,CACD,MAAM,IAAIG,KAAK,CAACpC,CAAC,EAAE;MAClB,IAAIoC,KAAK,CAACtC,CAAC,EAAE;QACX;QACA;QACAsC,KAAK,CAACtB,YAAY,IAAIyB,IAAI;MAC5B,CAAC,MAAM;QACLH,KAAK,CAACtB,YAAY,GAAGyB,IAAI;MAC3B;IACF;EACF;AACF"}
1
+ {"version":3,"file":"parseCell.js","names":["_parseExcelTimestamp","_interopRequireDefault","require","_isDateFormatStyle","obj","__esModule","_slicedToArray","arr","i","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","o","minLen","_arrayLikeToArray","n","Object","prototype","toString","call","slice","constructor","name","Array","from","test","len","length","arr2","r","l","t","Symbol","iterator","e","u","a","f","next","done","push","value","isArray","EMPTY_CELL_VALUE","EMPTY_CELL","exports","parseCell","s","v","inlineString","_ref","_ref2","sharedStrings","styles","epoch1904","defaultDateFormat","dateTemplateParser","parseNumberCustom","undefined","sharedStringIndex","Number","isNaN","parsedDate","Date","valueOf","getTime","styleId","isDateFormatStyle","timestamp","parseExcelTimestamp","number"],"sources":["../../source/xlsx/parseCell.js"],"sourcesContent":["import parseExcelTimestamp from './parseExcelTimestamp.js'\r\nimport isDateFormatStyle from './isDateFormatStyle.js'\r\n\r\n// An empty cell has `null` value.\r\nconst EMPTY_CELL_VALUE = null\r\n\r\n// This variable represents a cell with a `null` value.\r\n// It is exported only to be specified as a dependency when using `worker-f`.\r\nexport const EMPTY_CELL = [null, EMPTY_CELL_VALUE]\r\n\r\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 */\r\nexport default function parseCell(\r\n t,\r\n s,\r\n v,\r\n inlineString,\r\n [\r\n sharedStrings,\r\n styles,\r\n epoch1904,\r\n defaultDateFormat,\r\n dateTemplateParser,\r\n parseNumberCustom\r\n ]\r\n) {\r\n // Available Excel cell types:\r\n // https://github.com/SheetJS/sheetjs/blob/19620da30be2a7d7b9801938a0b9b1fd3c4c4b00/docbits/52_datatype.md\r\n //\r\n // Some other document (seems to be old):\r\n // http://webapp.docx4java.org/OnlineDemo/ecma376/SpreadsheetML/ST_CellType.html\r\n //\r\n // The default cell type is \"n\" (numeric), according to XLSX specification.\r\n //\r\n switch (t || 'n') {\r\n // `t=\"str\"` means that the cell value is calculated using a formula.\r\n // The formula is defined as the text of a child `<f/>` element.\r\n //\r\n // It could optionally include a `<v/>` element whose text is the cached result\r\n // of the calculation from the last time the file was saved in a spreadsheet editor application.\r\n //\r\n // An optional `<v/>` element holds a pre-computed result of the formula defined by `<f/>`.\r\n //\r\n // Example:\r\n //\r\n // <c r=\"B3\" t=\"str\">\r\n // \t<f>CONCATENATE(C1,D1)</f>\r\n // \t<v>C1ValueD1Value</v>\r\n // </c>\r\n //\r\n // Here's a guide on formulas in XLSX files:\r\n // https://github.com/MiniMax-AI/skills/blob/main/skills/minimax-xlsx/references/validate.md\r\n //\r\n case 'str':\r\n // The `<v/>` element could be absent because it's not required to be pre-computed by the spec.\r\n // In such case, `v` argument value would be `undefined`.\r\n // Because this package can't include the whole formula calculation engine,\r\n // it has to interpret this situation as an error.\r\n if (v === undefined) {\r\n return 'VALUE_MISSING'\r\n }\r\n // The `<v/>` element could be present but its text content could be empty\r\n // because the formula returns an empty string.\r\n // For example, a valid case of `v` argument value being an empty string `\"\"` is when\r\n // a formula in cell `A1` is `=CONCATENATE(B1,C1)` and both `B1` and `C1` cells are empty.\r\n if (!v) {\r\n return EMPTY_CELL\r\n }\r\n return ['s', v]\r\n\r\n // `t=\"inlineStr\"` means that `<is/>` holds the string value.\r\n //\r\n // Inside a `<c t=\"inlineStr\"/>`, the specification requires there to exist an `<is/>` element,\r\n // and within that `<is/>` element it requires to exist a `<t/>` element.\r\n //\r\n // Example:\r\n //\r\n // <c r=\"A1\" s=\"1\" t=\"inlineStr\">\r\n // <is>\r\n // <t>\r\n // Test 123\r\n // </t>\r\n // </is>\r\n // </c>\r\n //\r\n case 'inlineStr':\r\n if (inlineString === undefined) {\r\n return 'VALUE_MISSING'\r\n }\r\n return ['s', inlineString]\r\n\r\n // `type=\"s\"` means that the string value is stored in the Shared Strings Table.\r\n // This way it attempts to compress the `.xlsx` file by reusing all string values\r\n // in case they repeat throughout the spreadsheet.\r\n //\r\n // This optimization can't be used when writing an `.xlsx` file in a \"streaming\"\r\n // fashion, i.e. when the entire spreadsheet data is not known in adavance\r\n // at the start of writing the file.\r\n // But it can be used in all other situations. And hence, it is used.\r\n // So this is the most common cell type, actually.\r\n //\r\n // Example:\r\n //\r\n // <c r=\"A3\" t=\"s\">\r\n // <v>3</v>\r\n // </c>\r\n //\r\n case 's':\r\n // If a cell has no value then there's no `<c/>` element for it.\r\n // If a `<c/>` element exists then it's not empty.\r\n // The `<v/>` element's text is a zero-based index in the \"shared strings\" dictionary.\r\n if (!v) {\r\n return 'VALUE_MISSING'\r\n }\r\n const sharedStringIndex = Number(v)\r\n // The shared string index value could be:\r\n // * not a number\r\n // * a number but a fractional one\r\n // * an integer that is out of bounds of the shared strings array\r\n if (isNaN(sharedStringIndex) || sharedStrings[sharedStringIndex] === undefined) {\r\n return 'VALUE_INVALID'\r\n }\r\n return ['s', sharedStrings[sharedStringIndex]]\r\n\r\n // Boolean (TRUE/FALSE) values are stored as either \"1\" or \"0\" in cells of type \"b\".\r\n //\r\n // Example:\r\n //\r\n // <c r=\"A1\" t=\"b\">\r\n // <v>1</v>\r\n // </c>\r\n //\r\n case 'b':\r\n if (!v) {\r\n return 'VALUE_MISSING'\r\n }\r\n if (v === '1') {\r\n return ['b', true]\r\n }\r\n if (v === '0') {\r\n return ['b', false]\r\n }\r\n return 'VALUE_INVALID'\r\n\r\n // If cell type is \"e\", the `<v/>` element's text is an error code string (required).\r\n //\r\n // Example:\r\n //\r\n // <c r=\"A1\" t=\"e\">\r\n // <f>1/0</f>\r\n // <v>#DIV/0!</v>\r\n // </c>\r\n //\r\n case 'e':\r\n // Examples of error codes:\r\n //\r\n // '#NULL!'\r\n // '#DIV/0!'\r\n // '#VALUE!'\r\n // '#REF!'\r\n // '#NAME!'\r\n // '#NUM!'\r\n // '#N/A'\r\n // '#SPILL!'\r\n //\r\n // The description of each error could be read in the formulas guide:\r\n // https://github.com/MiniMax-AI/skills/blob/main/skills/minimax-xlsx/references/validate.md\r\n //\r\n if (!v) {\r\n return 'VALUE_MISSING'\r\n }\r\n return ['e', v]\r\n\r\n // XLSX supports date cells of type \"d\", though it seems like it (almost?) never\r\n // uses type \"d\" for storing dates, preferring type \"n\" and numeric timestamp instead.\r\n // The value of a \"d\" cell is supposedly a string in \"ISO 8601\" format.\r\n // I haven't seen an `.xlsx` file having such cells.\r\n //\r\n // Example:\r\n //\r\n // <c r=\"A1\" s=\"1\" t=\"d\">\r\n // <v>\r\n // 2021-06-10T00:47:45.700Z\r\n // </v>\r\n // </c>\r\n //\r\n case 'd':\r\n if (!v) {\r\n return EMPTY_CELL\r\n }\r\n const parsedDate = new Date(v)\r\n if (isNaN(parsedDate.valueOf())) {\r\n return 'VALUE_INVALID'\r\n }\r\n return ['d', parsedDate.getTime()]\r\n\r\n // type \"n\" is used for numeric cells.\r\n //\r\n // An optional `s` attribute defines how this number should be formatted — \r\n // it should be a zero-based index of the style (XF record) in `styles.xml`.\r\n //\r\n // Example:\r\n //\r\n // <c r=\"A1\" s=\"1\" t=\"n\">\r\n // <v>123.45</v>\r\n // </c>\r\n //\r\n case 'n':\r\n // Numeric cell value is allowed to be missing in the XLSX specification\r\n // because \"n\" is the default type of a cell, so it ends up representing empty cells too.\r\n if (!v) {\r\n return EMPTY_CELL\r\n }\r\n // XLSX does support `type: \"d\"` cells for storing dates, but it's not commonly used.\r\n // Instead, it prefers using `type: \"n\"` cells for storing dates as timestamps\r\n // with a corresponding `s` formatting style.\r\n if (s) {\r\n const styleId = Number(s)\r\n // The style ID value could be:\r\n // * not a number\r\n // * a number but a fractional one\r\n // * an integer that is out of bounds of the styles array\r\n if (isNaN(styleId) || styles[styleId] === undefined) {\r\n return 'FORMAT_INVALID'\r\n }\r\n // Whether it's a date cell or just a numeric cell could only be determined\r\n // by looking at the formatting style.\r\n if (isDateFormatStyle(styles[styleId], defaultDateFormat, dateTemplateParser)) {\r\n const timestamp = Number(v)\r\n if (isNaN(timestamp)) {\r\n return 'VALUE_INVALID'\r\n }\r\n // First, parse the \"serial date\" number from string.\r\n // Then convert the \"serial date\" number to a date timestamp.\r\n return ['d', parseExcelTimestamp(timestamp, epoch1904)]\r\n }\r\n }\r\n // Return the cell value as a number,\r\n // unless custom `parseNumber()` function was passed,\r\n // in which case return the number as an unparsed string.\r\n // Some people prefer passing a custom `parseNumber()` function\r\n // to parse \"big integers\" without losing any precision.\r\n if (parseNumberCustom) {\r\n return ['n', v]\r\n }\r\n const number = Number(v)\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,KAAA;IACbE,MAAM,GAAAF,KAAA;IACNG,SAAS,GAAAH,KAAA;IACTI,iBAAiB,GAAAJ,KAAA;IACjBK,kBAAkB,GAAAL,KAAA;IAClBM,iBAAiB,GAAAN,KAAA;EAGnB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,QAAQpB,CAAC,IAAI,GAAG;IACd;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,KAAK,KAAK;MACR;MACA;MACA;MACA;MACA,IAAIiB,CAAC,KAAKU,SAAS,EAAE;QACnB,OAAO,eAAe;MACxB;MACA;MACA;MACA;MACA;MACA,IAAI,CAACV,CAAC,EAAE;QACN,OAAOJ,UAAU;MACnB;MACA,OAAO,CAAC,GAAG,EAAEI,CAAC,CAAC;;IAEjB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,KAAK,WAAW;MACd,IAAIC,YAAY,KAAKS,SAAS,EAAE;QAC9B,OAAO,eAAe;MACxB;MACA,OAAO,CAAC,GAAG,EAAET,YAAY,CAAC;;IAE5B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,KAAK,GAAG;MACN;MACA;MACA;MACA,IAAI,CAACD,CAAC,EAAE;QACN,OAAO,eAAe;MACxB;MACA,IAAMW,iBAAiB,GAAGC,MAAM,CAACZ,CAAC,CAAC;MACnC;MACA;MACA;MACA;MACA,IAAIa,KAAK,CAACF,iBAAiB,CAAC,IAAIP,aAAa,CAACO,iBAAiB,CAAC,KAAKD,SAAS,EAAE;QAC9E,OAAO,eAAe;MACxB;MACA,OAAO,CAAC,GAAG,EAAEN,aAAa,CAACO,iBAAiB,CAAC,CAAC;;IAEhD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,KAAK,GAAG;MACN,IAAI,CAACX,CAAC,EAAE;QACN,OAAO,eAA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