@sheetxl/io-xlsx 0.8.0-beta.1 → 0.8.0-beta.11

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 (191) hide show
  1. package/browser/esm/BiDqExNXiY7ykk8E.mjs +2327 -0
  2. package/browser/esm/{Ctqql4O-3xj2K8vv.mjs → Bs0EzhdU8WgGfPzf.mjs} +193 -143
  3. package/browser/esm/CLWsOc6DO8l1G_LF.mjs +2213 -0
  4. package/browser/esm/{CLWzJJyoSrykkVLX.mjs → CZ9I80og75SDRjv0.mjs} +2 -2
  5. package/browser/esm/{Dz1Dp8DDJvhd09RR.mjs → CuAXx5i4uqTz-mMY.mjs} +1 -1
  6. package/browser/esm/Cv3R6fGatARKedSn.mjs +8635 -0
  7. package/browser/esm/{BkNXyG6NC-w5Xo92.mjs → CzFYJPxmLyKgEKF0.mjs} +28 -13
  8. package/browser/esm/DICL6ecj9BdJv8aX.mjs +104 -0
  9. package/browser/esm/DatIA9fZbEPjW4bh.mjs +5638 -0
  10. package/browser/esm/index.mjs +2 -3
  11. package/browser/esm/yveeVJ6hKDI5KDEz.mjs +4168 -0
  12. package/licenses/dependencies.txt +2 -2
  13. package/node/esm/B9Zn6H1RV07Ob377.mjs +2294 -0
  14. package/node/esm/Bpqm_PpGLpdjL47-.mjs +2368 -0
  15. package/node/esm/{fOnuUjpPCAzmuIXN.mjs → CAJxmJdobUbzpUz5.mjs} +2 -2
  16. package/node/esm/{CEV7nKotMpeRRnQC.mjs → CxlSbH7mmnEEsqmX.mjs} +1 -1
  17. package/node/esm/DD-yXSBzvDYy0TX5.mjs +5842 -0
  18. package/node/esm/DScqM1V4wPntNP6-.mjs +5235 -0
  19. package/node/esm/{CEAmv36xpTNgFwl_.mjs → fopiRR7OiVoEiF7B.mjs} +49 -35
  20. package/node/esm/index.mjs +77 -25
  21. package/node/esm/ipiyzn5Pfohw2afB.mjs +4271 -0
  22. package/package.json +7 -8
  23. package/types/src/AutoFilterRules.d.ts +94 -11
  24. package/types/src/ConditionalFormatRules.d.ts +5 -5
  25. package/types/src/DataValidationRules.d.ts +18 -2
  26. package/types/src/DefinedNameAttributes.d.ts +8 -0
  27. package/types/src/ExcelCalcStamp.d.ts +39 -0
  28. package/types/src/ExcelCompat.d.ts +209 -42
  29. package/types/src/ExcelReservedNames.d.ts +3 -4
  30. package/types/src/KnownFonts.d.ts +50 -0
  31. package/types/src/LegacyFormula.d.ts +41 -7
  32. package/types/src/OOXMLExtensions.d.ts +14 -2
  33. package/types/src/PageLayoutAttributes.d.ts +8 -0
  34. package/types/src/Plugin.d.ts +28 -5
  35. package/types/src/ProtectionAttributes.d.ts +38 -0
  36. package/types/src/SheetKinds.d.ts +57 -0
  37. package/types/src/SheetViewAttributes.d.ts +4 -0
  38. package/types/src/SortExtent.d.ts +16 -0
  39. package/types/src/SourcePackage.d.ts +31 -12
  40. package/types/src/Types.d.ts +28 -0
  41. package/types/src/XlsxHeader.d.ts +19 -0
  42. package/types/src/chart/ChartExXml.d.ts +38 -0
  43. package/types/src/chart/ChartPartXml.d.ts +47 -0
  44. package/types/src/chart/ChartSpaceXml.d.ts +36 -0
  45. package/types/src/chart/_XmlTree.d.ts +34 -0
  46. package/types/src/chart/_chartCodecs.d.ts +10 -0
  47. package/types/src/chart/_chartExCodecs.d.ts +7 -0
  48. package/types/src/chart/_chartExFold.d.ts +14 -0
  49. package/types/src/chart/_chartExMarkup.d.ts +236 -0
  50. package/types/src/chart/_chartExStyle.d.ts +22 -0
  51. package/types/src/chart/_codec.d.ts +78 -0
  52. package/types/src/chart/_drawingml.d.ts +10 -0
  53. package/types/src/chart/_xml.d.ts +70 -0
  54. package/types/src/reader/DocumentPropertiesRead.d.ts +16 -0
  55. package/types/src/reader/DummyFunctionUnwrap.d.ts +2 -2
  56. package/types/src/reader/HeaderStyles.d.ts +15 -0
  57. package/types/src/reader/HiddenFormulas.d.ts +16 -0
  58. package/types/src/reader/IsoDateCell.d.ts +20 -0
  59. package/types/src/reader/LibreOfficeDataTable.d.ts +11 -0
  60. package/types/src/reader/SlicerJoin.d.ts +24 -0
  61. package/types/src/reader/Warning.d.ts +29 -0
  62. package/types/src/reader/ZipReader.d.ts +1 -1
  63. package/types/src/reader/_SlicerRecord.d.ts +37 -0
  64. package/types/src/reader/dom/CustGeomUtils.d.ts +7 -0
  65. package/types/src/reader/dom/DOMTransformer.d.ts +2 -2
  66. package/types/src/reader/dom/ExecutionContext.d.ts +16 -3
  67. package/types/src/reader/dom/Types.d.ts +19 -3
  68. package/types/src/reader/domVisitors/AppPropertiesVisitor.d.ts +13 -1
  69. package/types/src/reader/domVisitors/AutoFilterVisitor.d.ts +16 -3
  70. package/types/src/reader/domVisitors/ColorContainerVisitor.d.ts +15 -2
  71. package/types/src/reader/domVisitors/CommentVisitor.d.ts +24 -2
  72. package/types/src/reader/domVisitors/CommentsVisitor.d.ts +2 -2
  73. package/types/src/reader/domVisitors/DrawingCxnSpVisitor.d.ts +1 -0
  74. package/types/src/reader/domVisitors/DrawingElementVisitor.d.ts +34 -1
  75. package/types/src/reader/domVisitors/DrawingGraphicFrameVisitor.d.ts +9 -0
  76. package/types/src/reader/domVisitors/DrawingGrpSpVisitor.d.ts +14 -2
  77. package/types/src/reader/domVisitors/DrawingPicVisitor.d.ts +30 -2
  78. package/types/src/reader/domVisitors/DrawingSpVisitor.d.ts +20 -1
  79. package/types/src/reader/domVisitors/DrawingVisitor.d.ts +10 -0
  80. package/types/src/reader/domVisitors/ExternalLinkVisitor.d.ts +21 -3
  81. package/types/src/reader/domVisitors/FmtSchemeVisitor.d.ts +4 -4
  82. package/types/src/reader/domVisitors/FontSchemeVisitor.d.ts +3 -2
  83. package/types/src/reader/domVisitors/FormControlPrVisitor.d.ts +9 -0
  84. package/types/src/reader/domVisitors/ObjectDefaultsVisitor.d.ts +11 -0
  85. package/types/src/reader/domVisitors/ShapeTextVisitor.d.ts +44 -0
  86. package/types/src/reader/domVisitors/SheetColorContainerVisitor.d.ts +3 -3
  87. package/types/src/reader/domVisitors/SheetStyleVisitor.d.ts +21 -6
  88. package/types/src/reader/domVisitors/SlicerCacheDefinitionVisitor.d.ts +7 -2
  89. package/types/src/reader/domVisitors/SlicersVisitor.d.ts +7 -3
  90. package/types/src/reader/domVisitors/SortStateVisitor.d.ts +2 -2
  91. package/types/src/reader/domVisitors/TextPropertiesVisitor.d.ts +13 -1
  92. package/types/src/reader/domVisitors/ThreadedCommentVisitor.d.ts +18 -1
  93. package/types/src/reader/domVisitors/ThreadedCommentsVisitor.d.ts +2 -2
  94. package/types/src/reader/domVisitors/WorkbookVisitor.d.ts +11 -1
  95. package/types/src/reader/domVisitors/_Dxfs.d.ts +10 -0
  96. package/types/src/reader/domVisitors/index.d.ts +6 -32
  97. package/types/src/reader/sax/LeanSaxParser.d.ts +58 -0
  98. package/types/src/reader/sax/SaxParser.d.ts +11 -1
  99. package/types/src/reader/sax/SaxVisitor.d.ts +3 -2
  100. package/types/src/reader/saxVisitors/ContentTypesVisitor.d.ts +9 -0
  101. package/types/src/reader/saxVisitors/SharedStringsVisitor.d.ts +46 -6
  102. package/types/src/reader/saxVisitors/WorksheetVisitor.d.ts +23 -11
  103. package/types/src/utils/DrawingMLText.d.ts +39 -0
  104. package/types/src/utils/FormControls.d.ts +170 -0
  105. package/types/src/utils/SharedNames.d.ts +13 -0
  106. package/types/src/utils/SpreadsheetFont.d.ts +38 -0
  107. package/types/src/utils/VmlNoteShapes.d.ts +128 -0
  108. package/types/src/utils/VmlNoteStyle.d.ts +44 -0
  109. package/types/src/utils/VmlPrefixes.d.ts +24 -0
  110. package/types/src/vba/VBAProject.d.ts +52 -4
  111. package/types/src/writer/builder/ContentTypes.d.ts +13 -0
  112. package/types/src/writer/builder/Emitter.d.ts +11 -6
  113. package/types/src/writer/builder/OpcXmlUtils.d.ts +2 -0
  114. package/types/src/writer/builder/PackageBuilder.d.ts +74 -22
  115. package/types/src/writer/builder/PartWriter.d.ts +5 -0
  116. package/types/src/writer/builder/RelationshipSet.d.ts +3 -0
  117. package/types/src/writer/builder/Types.d.ts +124 -38
  118. package/types/src/writer/builder/_Types.d.ts +17 -0
  119. package/types/src/writer/emitters/CommentsEmitter.d.ts +58 -0
  120. package/types/src/writer/emitters/DrawingEmitter.d.ts +2 -2
  121. package/types/src/writer/emitters/EmbeddedPartEmitter.d.ts +60 -0
  122. package/types/src/writer/emitters/ExternalLinkEmitter.d.ts +19 -0
  123. package/types/src/writer/emitters/LegacyDrawingEmitter.d.ts +18 -0
  124. package/types/src/writer/emitters/PersonsEmitter.d.ts +17 -0
  125. package/types/src/writer/emitters/PivotTableEmitter.d.ts +45 -0
  126. package/types/src/writer/emitters/PropsCoreEmitter.d.ts +7 -2
  127. package/types/src/writer/emitters/PropsCustomEmitter.d.ts +15 -0
  128. package/types/src/writer/emitters/SharedStringsEmitter.d.ts +6 -3
  129. package/types/src/writer/emitters/SlicerEmitter.d.ts +66 -0
  130. package/types/src/writer/emitters/StylesEmitter.d.ts +2 -2
  131. package/types/src/writer/emitters/TableEmitter.d.ts +14 -0
  132. package/types/src/writer/emitters/ThreadedCommentsEmitter.d.ts +27 -0
  133. package/types/src/writer/emitters/WorkbookEmitter.d.ts +21 -3
  134. package/types/src/writer/emitters/WorksheetEmitter.d.ts +4 -3
  135. package/types/src/writer/utils/AutoFilter.d.ts +3 -3
  136. package/types/src/writer/utils/CustGeomUtils.d.ts +5 -0
  137. package/types/src/writer/utils/DefaultRows.d.ts +38 -0
  138. package/types/src/writer/utils/DrawMLUtils.d.ts +57 -3
  139. package/types/src/writer/utils/DummyFunction.d.ts +0 -2
  140. package/types/src/writer/utils/DxfCollector.d.ts +14 -11
  141. package/types/src/writer/utils/HiddenFormulaXfs.d.ts +28 -0
  142. package/types/src/writer/utils/PrstGeomUtils.d.ts +6 -0
  143. package/types/src/writer/utils/SheetStyleLayout.d.ts +73 -0
  144. package/types/src/writer/utils/TextUtils.d.ts +26 -2
  145. package/types/src/writer/utils/UnsupportedFunctions.d.ts +2 -2
  146. package/browser/cjs/B6sirGz6w-Bm7Ofo.cjs +0 -1
  147. package/browser/cjs/B7_pDFYCVzt-3hUs.cjs +0 -1
  148. package/browser/cjs/BAtEL-5TLyoaPFDP.cjs +0 -2
  149. package/browser/cjs/Bg0e53JZa8vhmm5a.cjs +0 -1
  150. package/browser/cjs/CIpMN7SDVREKQUQE.cjs +0 -6
  151. package/browser/cjs/CK5FFUvet6FnIYO_.cjs +0 -5
  152. package/browser/cjs/D5Y4KQhKdukOkjvA.cjs +0 -2
  153. package/browser/cjs/DV6LeTEiiFUrZoxj.cjs +0 -1
  154. package/browser/cjs/DWkuoJSgvcXJTdN1.cjs +0 -1
  155. package/browser/cjs/Db8YjGM6TG34c8aT.cjs +0 -1
  156. package/browser/cjs/index.cjs +0 -1
  157. package/browser/cjs/xQ6-wbTw5UzZUM1Y.cjs +0 -1
  158. package/browser/esm/4BWLu134ABlCQEtM.mjs +0 -3655
  159. package/browser/esm/BzQ_lPzc8C4OTIGZ.mjs +0 -99
  160. package/browser/esm/CJknI8BYGSZr-4zS.mjs +0 -52
  161. package/browser/esm/Cok_fBIUCHDSrKw0.mjs +0 -2211
  162. package/browser/esm/D-m_kQLaewdwuXaF.mjs +0 -2685
  163. package/browser/esm/Dj7D2nVdAZ3TiUks.mjs +0 -4743
  164. package/browser/esm/ijQzHH-bvDfUHIi1.mjs +0 -24
  165. package/node/esm/CF1R5ovFsRNu--Rw.mjs +0 -3744
  166. package/node/esm/Ctcl4jN52INWpKWC.mjs +0 -2255
  167. package/node/esm/CvnRSooxEQdlJgMn.mjs +0 -2766
  168. package/node/esm/DQd0vxzTaPt2qSL-.mjs +0 -108
  169. package/node/esm/ssSlRCbCqxvZ9IX8.mjs +0 -2481
  170. package/types/src/legacyChart/OOXMLMappings.d.ts +0 -8
  171. package/types/src/legacyChart/OOXMLUtils.d.ts +0 -78
  172. package/types/src/legacyChart/ToOOXMLConverter.d.ts +0 -30
  173. package/types/src/reader/domVisitors/AxisVisitor.d.ts +0 -12
  174. package/types/src/reader/domVisitors/BarChartTypeVisitor.d.ts +0 -6
  175. package/types/src/reader/domVisitors/ChartSpaceVisitor.d.ts +0 -6
  176. package/types/src/reader/domVisitors/ChartTypeVisitor.d.ts +0 -7
  177. package/types/src/reader/domVisitors/ChartVisitor.d.ts +0 -7
  178. package/types/src/reader/domVisitors/DataLabelsVisitor.d.ts +0 -8
  179. package/types/src/reader/domVisitors/DataPointVisitor.d.ts +0 -6
  180. package/types/src/reader/domVisitors/HyperlinkVisitor.d.ts +0 -6
  181. package/types/src/reader/domVisitors/LayoutVisitor.d.ts +0 -5
  182. package/types/src/reader/domVisitors/LegendEntryVisitor.d.ts +0 -5
  183. package/types/src/reader/domVisitors/LegendVisitor.d.ts +0 -5
  184. package/types/src/reader/domVisitors/MarkerVisitor.d.ts +0 -5
  185. package/types/src/reader/domVisitors/NegativeShapeVisitor.d.ts +0 -6
  186. package/types/src/reader/domVisitors/PlotAreaVisitor.d.ts +0 -5
  187. package/types/src/reader/domVisitors/SeriesVisitor.d.ts +0 -8
  188. package/types/src/reader/domVisitors/TitleVisitor.d.ts +0 -9
  189. package/types/src/writer/emitters/ChartColorsEmitter.d.ts +0 -7
  190. package/types/src/writer/emitters/ChartEmitter.d.ts +0 -14
  191. package/types/src/writer/emitters/ChartStyleEmitter.d.ts +0 -46
@@ -1,5 +1,19 @@
1
1
  import { ITable, IRange } from '@sheetxl/sdk';
2
2
  import { Emitter, EmitContext } from '../builder';
3
+ /**
4
+ * Shared-states key under which the `table/@id` each table is written with is left, by table, for
5
+ * whatever names a table by that id (a slicer cache's `tableSlicerCache`).
6
+ *
7
+ * @remarks
8
+ * The id is minted when the sheet schedules the table part ({@link mintTableId}), not when the
9
+ * part emits: the workbook writes the slicer caches once every sheet has emitted, and a sheet's
10
+ * children may still be queued then.
11
+ */
12
+ export declare const SHARED_STATE_TABLE_IDS = "tableIds";
13
+ /** The ids the tables are written with, by table. */
14
+ export declare const tableIdsOf: (ctx: EmitContext) => Map<ITable, number>;
15
+ /** The `table/@id` a table is written with: unique in the package, minted once per table. */
16
+ export declare const mintTableId: (ctx: EmitContext, table: ITable) => number;
3
17
  export declare class TableEmitter extends Emitter<ModelHandle> {
4
18
  constructor();
5
19
  /** @inheritdoc IEmitter.emit */
@@ -0,0 +1,27 @@
1
+ import { Emitter, EmitContext } from '../builder';
2
+ import { CommentsPartHandle } from './CommentsEmitter';
3
+ /**
4
+ * Writes `xl/threadedComments/threadedComment{n}.xml`: every thread on the sheet, root first
5
+ * and then its replies, each a `<threadedComment>` joined by `parentId`.
6
+ *
7
+ * @remarks
8
+ * Only threads: a note has no place here. `done` is the root's; a reply's resolved state is
9
+ * its thread's. The text is plain, as the schema has it, with its mentions after it.
10
+ */
11
+ export declare class ThreadedCommentsEmitter extends Emitter<CommentsPartHandle> {
12
+ constructor();
13
+ /** @inheritdoc IEmitter.emit */
14
+ emit(handle: CommentsPartHandle, ctx: EmitContext): Promise<void>;
15
+ }
16
+ /**
17
+ * A `dT` as Excel writes one: UTC, hundredths of a second, no zone designator
18
+ * (`2026-09-28T19:25:03.54`). Excel reads a time with milliseconds and a `Z` as no time at all and
19
+ * shows the moment the file was opened instead.
20
+ */
21
+ export declare function excelDateTime(date: Date): string;
22
+ /**
23
+ * An id in the braces-and-uppercase form Excel writes; one that is not a GUID is written as it
24
+ * is, braced, since the schema asks for `ST_Guid` and a mismatch is a refused file either way.
25
+ */
26
+ export declare function asGuid(id: string): string;
27
+ //# sourceMappingURL=ThreadedCommentsEmitter.d.ts.map
@@ -1,11 +1,29 @@
1
1
  import { IWorkbook } from '@sheetxl/sdk';
2
2
  import { Emitter, EmitContext } from '../builder';
3
- /**
4
- * Emits the workbook.xml part.
5
- */
6
3
  export declare class WorkbookEmitter extends Emitter<IWorkbook> {
7
4
  constructor();
8
5
  /** @inheritdoc IEmitter.emit */
9
6
  emit(workbook: IWorkbook, ctx: EmitContext): Promise<void>;
10
7
  }
8
+ /** Shared-states key under which `XLSXWriter` leaves the source's `<fileVersion>` attributes. */
9
+ export declare const SHARED_STATE_FILE_VERSION = "fileVersion";
10
+ /** Shared-states key under which `XLSXWriter` leaves the source's `calcPr@calcId`, verbatim. */
11
+ export declare const SHARED_STATE_CALC_ID = "calcId";
12
+ /** Shared-states key under which `XLSXWriter` leaves the source's `xcalcf:calcFeatures` `<ext>`, verbatim. */
13
+ export declare const SHARED_STATE_CALC_FEATURES = "calcFeatures";
14
+ /**
15
+ * Shared-states key under which `XLSXWriter` leaves the source package's worksheet part path per
16
+ * `sheetId`. See {@link resolveSheetPaths}.
17
+ */
18
+ export declare const SHARED_STATE_SHEET_PARTS = "sheetParts";
19
+ /**
20
+ * Shared-states key under which `XLSXWriter` leaves whether the package being written can hold
21
+ * macros. See {@link writeOpaqueSheet}.
22
+ */
23
+ export declare const SHARED_STATE_MACRO_ENABLED = "macroEnabled";
24
+ /**
25
+ * Shared-states key under which `XLSXWriter` leaves the source package's external-link part paths,
26
+ * in `[n]` order. See {@link writeExternalReferences}.
27
+ */
28
+ export declare const SHARED_STATE_EXTERNAL_LINK_PARTS = "externalLinkParts";
11
29
  //# sourceMappingURL=WorkbookEmitter.d.ts.map
@@ -1,5 +1,6 @@
1
- import { ISheet } from '@sheetxl/sdk';
1
+ import { IWorksheet } from '@sheetxl/sdk';
2
2
  import { Emitter, EmitContext } from '../builder';
3
+ import { XlsxWorksheetJSON } from '../utils/SheetStyleLayout';
3
4
  export declare const WorksheetKind = "worksheet";
4
5
  /**
5
6
  * Emits the worksheet.xml part.
@@ -10,9 +11,9 @@ export declare class WorksheetEmitter extends Emitter<ModelHandle> {
10
11
  emit(handle: ModelHandle, ctx: EmitContext): Promise<void>;
11
12
  }
12
13
  type ModelHandle = {
13
- model: ISheet;
14
+ model: IWorksheet;
14
15
  isSelected: boolean;
15
- json: ISheet.JSON;
16
+ json: XlsxWorksheetJSON;
16
17
  };
17
18
  export {};
18
19
  //# sourceMappingURL=WorksheetEmitter.d.ts.map
@@ -1,6 +1,6 @@
1
- import { ICondition, IRange, ITable, ISort, ICellRange } from '@sheetxl/sdk';
1
+ import { ICondition, IRange, ITable, ISort, ICellRange, IFilter } from '@sheetxl/sdk';
2
2
  import { EmitContext, IXmlWriter } from '../builder';
3
- export declare const writeSortState: (ctx: EmitContext, xml: IXmlWriter, model: ITable, json: ISort.JSON, range: ICellRange, coords: IRange.Coords) => void;
3
+ export declare const writeSortState: (ctx: EmitContext, xml: IXmlWriter, model: ITable, json: ISort.JSON, range: ICellRange, coords: IRange.Coords, headerRows: number) => void;
4
4
  export declare const writeAutoFilter: (ctx: EmitContext, xml: IXmlWriter, model: ITable, json: ITable.JSON, isAutoTable?: boolean) => void;
5
5
  /** Writes one `customFilter`, taking its OOXML spelling from the border. */
6
6
  export declare const writeCustomFilter: (ctx: EmitContext, xml: IXmlWriter, condition: ICondition.JSON) => void;
@@ -12,5 +12,5 @@ export declare const writeCustomFilter: (ctx: EmitContext, xml: IXmlWriter, cond
12
12
  * TODO - Ensure we only write out valid OOXML support conditions
13
13
  * TODO - What to do with custom validations?
14
14
  */
15
- export declare const writeFilter: (ctx: EmitContext, xml: IXmlWriter, condition: ICondition.JSON) => void;
15
+ export declare const writeFilter: (ctx: EmitContext, xml: IXmlWriter, condition: ICondition.JSON, filter?: IFilter | null) => void;
16
16
  //# sourceMappingURL=AutoFilter.d.ts.map
@@ -0,0 +1,5 @@
1
+ import { IGeometry } from '@sheetxl/sdk';
2
+ import { IXmlWriter } from '../builder';
3
+ /** The `custGeom` element for a definition; the lists are written in the schema's order. */
4
+ export declare const writeCustGeom: (xml: IXmlWriter, def: IGeometry.Def) => void;
5
+ //# sourceMappingURL=CustGeomUtils.d.ts.map
@@ -0,0 +1,38 @@
1
+ import { ITypes } from '@sheetxl/sdk';
2
+ import { XlsxHeader, XlsxWorksheetJSON } from './SheetStyleLayout';
3
+ /** How the rows a sheet does not list are written (`sheetFormatPr`). */
4
+ export interface DefaultRows {
5
+ /** `defaultRowHeight`, in points. */
6
+ height: number;
7
+ /** `customHeight`: Excel uses `height` as is; otherwise it uses the Normal height plus the flags' pixels. */
8
+ custom: boolean;
9
+ /** `thickTop`: every row gives a pixel to a thick line above it. */
10
+ thickTop: boolean;
11
+ /** `thickBottom`: every row gives a pixel to a medium or thick line below it. */
12
+ thickBottom: boolean;
13
+ /** The row run written as the default instead of row by row, or `null` when there is none. */
14
+ run: ITypes.RunCoordValue<XlsxHeader> | null;
15
+ }
16
+ /**
17
+ * The row runs to write once `defaultRows.run` is the sheet's default: the other runs, and the rows
18
+ * no run lists, at the height they no longer get by default.
19
+ */
20
+ export declare const listedRowRuns: (rows: ITypes.RunCoordValue<XlsxHeader>[], defaultRun: ITypes.RunCoordValue<XlsxHeader>, unlistedHeight: number, maxRows: number) => ITypes.RunCoordValue<XlsxHeader>[];
21
+ /**
22
+ * How a sheet's unlisted rows are written: Excel's `sheetFormatPr` is its cache of the row height
23
+ * every row shares, so the height that covers most of the sheet is written once there rather than as
24
+ * a row element per row.
25
+ *
26
+ * @remarks
27
+ * Excel computes an unlisted row's height from the Normal font plus a pixel for each `thickTop`/
28
+ * `thickBottom` (`probe-sheet-thick-derive.ps1`); it moves the flags there only for a style on whole
29
+ * columns, and our export promotes a style on most of a column to one, so the default takes the flags
30
+ * of the run it replaces. A height those explain is written that way, so Excel keeps sizing the rows
31
+ * itself; any other is written as a custom height.
32
+ *
33
+ * @param normalHeight The Normal font's row height, in points.
34
+ * @param maxRows The sheet's row count.
35
+ * @returns `null` when the rows share no height but the Normal one.
36
+ */
37
+ export declare const resolveDefaultRows: (json: XlsxWorksheetJSON, normalHeight: number, maxRows: number) => DefaultRows | null;
38
+ //# sourceMappingURL=DefaultRows.d.ts.map
@@ -1,11 +1,19 @@
1
- import { IFill, IStroke, IEffect, IStyleCollection, ITheme } from '@sheetxl/sdk';
1
+ import { IFill, IStroke, IEffect, IHyperlink, IResource, IStyleCollection, ITheme } from '@sheetxl/sdk';
2
2
  import { EmitContext, IXmlWriter } from '../builder';
3
+ /**
4
+ * A `hlinkClick`/`hlinkHover` element for a hyperlink: its address becomes an external
5
+ * relationship of the part being written, as Excel does; a link with no address (an action
6
+ * alone) is written without one.
7
+ *
8
+ * @param tag `hlinkClick` under the DrawingML namespace, or `a:hlinkClick` where that is not the default.
9
+ */
10
+ export declare const writeHyperlinkElement: (ctx: EmitContext, xml: IXmlWriter, tag: string, link: IHyperlink.JSON | undefined) => void;
3
11
  /**
4
12
  * Writes fill definitions (patterns and gradients).
5
13
  */
6
- export declare function writeFill(ctx: EmitContext, xml: IXmlWriter, fill: IFill.NoneProperties | IFill.SolidProperties | IFill.PatternProperties | IFill.GradientProperties, styles: IStyleCollection, spreadsheetML?: boolean, // SpreadsheetML uses pattern fills but standard DrawML does not.
14
+ export declare function writeFill(ctx: EmitContext, xml: IXmlWriter, fill: IFill.NoneProperties | IFill.SolidProperties | IFill.PatternProperties | IFill.GradientProperties | IFill.ImageProperties | IFill.GroupProperties, styles: IStyleCollection, spreadsheetML?: boolean, // SpreadsheetML uses pattern fills but standard DrawML does not.
7
15
  isDxf?: boolean): void;
8
- export declare const writeLn: (ctx: EmitContext, xml: IXmlWriter, line: IStroke.JSON | Record<string, any>, styles: IStyleCollection) => void;
16
+ export declare const writeLn: (ctx: EmitContext, xml: IXmlWriter, line: IStroke.JSON | string | null | undefined, styles: IStyleCollection) => void;
9
17
  export declare const writeFillLnEffects: (ctx: EmitContext, styles: IStyleCollection, json: any, element?: string | undefined, includeEmptyEffects?: boolean) => void;
10
18
  /**
11
19
  * Writes an `<a:effectLst>` from a list of parsed effects (see `ColorContainerVisitor.getEffects`) —
@@ -13,6 +21,52 @@ export declare const writeFillLnEffects: (ctx: EmitContext, styles: IStyleCollec
13
21
  */
14
22
  export declare const writeEffects: (_ctx: EmitContext, xml: IXmlWriter, theme: ITheme, effects: IEffect.JSON[]) => void;
15
23
  export declare const RELATIONSHIP_TYPE_IMAGE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";
24
+ /**
25
+ * `ctx.getSharedStates()` key for the `/xl/media` images written so far, keyed by resource.
26
+ *
27
+ * @remarks
28
+ * Two emitters write image parts — `DrawingEmitter` (placed pictures) and `WorksheetEmitter`
29
+ * (the sheet background) — and they share this map so one resource used by both is stored once and
30
+ * both number into a single `image{n}` sequence.
31
+ */
32
+ export declare const IMAGES_WRITTEN_STATE = "imagesWritten";
33
+ /** An entry of the {@link IMAGES_WRITTEN_STATE} map: the bytes, their type, and the `image{n}` index. */
34
+ export type ImagePartParams = {
35
+ bytes: Uint8Array;
36
+ type: IResource.Type;
37
+ index: number;
38
+ };
39
+ /** How a part being written refers to an image: the relationship id, and whether it points outside the package. */
40
+ export interface ImagePartRef {
41
+ relId: string;
42
+ external: boolean;
43
+ }
44
+ /**
45
+ * Relates an image to the part being written and returns how to refer to it. An external image is
46
+ * a relationship to its URI; an embedded one is written to `/xl/media` once per package (the
47
+ * {@link IMAGES_WRITTEN_STATE} map) and related once per part, however many pictures and fills
48
+ * share the resource.
49
+ */
50
+ export declare const addImagePart: (ctx: EmitContext, resource: IResource) => Promise<ImagePartRef>;
51
+ /** How the part being written refers to an image already related with {@link addImagePart}, if it was. */
52
+ export declare const imagePartFor: (ctx: EmitContext, resource: IResource) => ImagePartRef | undefined;
53
+ /**
54
+ * The resource a JSON names by `resId`: the writer's map of the workbook's resources by the id
55
+ * its JSON cites them with, complete before any sheet part emits.
56
+ */
57
+ export declare const resourceById: (ctx: EmitContext, resId: number | undefined) => IResource | undefined;
58
+ /**
59
+ * Relates the image a shape's or a group's fill names before it is written: fills are written
60
+ * synchronously, the parts they cite are added asynchronously.
61
+ */
62
+ export declare const addImageFillParts: (ctx: EmitContext, json: {
63
+ fill?: IFill.JSON;
64
+ } | undefined) => Promise<void>;
65
+ /**
66
+ * The children of a `blipFill` — the `blip`, the source rectangle and the tile or stretch — in
67
+ * the writer's current default namespace. A `pic` writes them inside its own `xdr:blipFill`.
68
+ */
69
+ export declare const writeBlipFillChildren: (xml: IXmlWriter, fill: IFill.ImageProperties, ref: ImagePartRef) => void;
16
70
  export declare const EMU_PER_POINT: number;
17
71
  export declare const EMU_PER_PIXEL: number;
18
72
  export declare const DEFAULT_IMAGE_TYPE: {
@@ -21,8 +21,6 @@ import { Scalar, IWorkbook } from '@sheetxl/sdk';
21
21
  * The trade is real and worth stating: **the formula is dead in Excel.** It never recalculates, so
22
22
  * editing a precedent leaves a stale value with no visual cue. That is Google's trade too; the
23
23
  * alternative (emit bare, show `#NAME?`) loses the value instead. See CALC-ISSUES item 7.
24
- *
25
- * @see https://docs.grid.is/apiary/explain/gsdv/
26
24
  */
27
25
  /** Google's marker. Deliberately their exact spelling — see the note above. */
28
26
  export declare const DUMMY_FUNCTION = "__xludf.DUMMYFUNCTION";
@@ -1,22 +1,25 @@
1
- import { IStyle } from '@sheetxl/sdk';
1
+ import { ICellStyle } from '@sheetxl/sdk';
2
2
  /**
3
- * Accumulates conditional-format differential styles (dxfs) as worksheets emit, so the styles
4
- * part — written after the worksheets — can include them in `<dxfs>`.
3
+ * Accumulates the differential styles (dxfs) a worksheet and its parts cite — conditional formats,
4
+ * color filters, color sorts — so the styles part, written after the worksheets, can include them
5
+ * in `<dxfs>`.
5
6
  *
6
- * Index contract: conditional-format dxfs take `0..count-1`; the table-style dxfs the styles
7
- * emitter denormalizes are appended after and offset by {@link getCount}. This keeps the
8
- * `dxfId` written into worksheet XML final at worksheet-emit time.
7
+ * Index contract: collected dxfs take `0..count-1`; the table-style dxfs the styles emitter
8
+ * denormalizes are appended after and offset by {@link getCount}. This keeps the `dxfId` written
9
+ * into worksheet and table XML final at the time it is written.
9
10
  *
10
- * Shared via `EmitContext.getSharedStates()` under the `"cfDxfs"` key (see `MetadataCollector`
11
- * for the pattern).
11
+ * Shared via `EmitContext.getSharedStates()` under {@link DXFS_SHARED_STATE}; use
12
+ * {@link dxfCollectorOf} (see `MetadataCollector` for the pattern).
12
13
  */
13
14
  export declare class DxfCollector {
14
15
  private readonly _dxfs;
15
16
  private readonly _byKey;
16
17
  /** Returns the dxf index for the style, adding it if not yet collected. */
17
- add(style: IStyle.JSON): number;
18
- getDxfs(): readonly IStyle.JSON[];
18
+ add(style: ICellStyle.JSON): number;
19
+ getDxfs(): readonly ICellStyle.JSON[];
19
20
  getCount(): number;
20
21
  }
21
- export declare const CF_DXFS_SHARED_STATE = "cfDxfs";
22
+ export declare const DXFS_SHARED_STATE = "dxfs";
23
+ /** The write's collector, created on first use. */
24
+ export declare const dxfCollectorOf: (sharedStates: Map<string, any>) => DxfCollector;
22
25
  //# sourceMappingURL=DxfCollector.d.ts.map
@@ -0,0 +1,28 @@
1
+ import { IStyleCollection } from '@sheetxl/sdk';
2
+ export declare const HIDDEN_FORMULA_XFS_SHARED_STATE = "hiddenFormulaXfs";
3
+ /**
4
+ * The `hidden="1"` twins of cell xfs, for sheets whose protection hides formulas.
5
+ *
6
+ * xlsx has no sheet-level form of `IWorksheetProtection.showFormulas: false`; Excel only hides a formula
7
+ * whose format says `hidden="1"`. So a sheet that hides formulas writes every format it uses as a
8
+ * hidden variant, unless the format itself grants `showFormulas`. Variants are appended after the
9
+ * direct styles and shared by every sheet that asks for one. `cellXfs[0]` is never changed in place:
10
+ * it is workbook-wide, and protection is per sheet.
11
+ *
12
+ * Worksheets allocate while they emit; `StylesEmitter` writes the variants afterwards.
13
+ */
14
+ export declare class HiddenFormulaXfs {
15
+ private _json;
16
+ private _styles;
17
+ /** The cellXfs written for the direct styles; the variants start here. */
18
+ private _directCount;
19
+ private _variants;
20
+ private _sources;
21
+ constructor(json: IStyleCollection.JSON | undefined, styles: IStyleCollection);
22
+ /** The xf to write in place of `xf` on a sheet that hides formulas. */
23
+ getHiddenXf(xf: number): number;
24
+ /** The direct xf behind each variant, in variant order. */
25
+ getSources(): readonly number[];
26
+ private _isShown;
27
+ }
28
+ //# sourceMappingURL=HiddenFormulaXfs.d.ts.map
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The `prstGeom` element: a preset name plus its adjust values.
3
+ */
4
+ /** `[name, fmla]` pairs for an `avLst`, in a stable order. Values are integers in the file. */
5
+ export declare const adjustValueEntries: (adjustments: Record<string, number> | undefined | null) => [string, string][];
6
+ //# sourceMappingURL=PrstGeomUtils.d.ts.map
@@ -0,0 +1,73 @@
1
+ import { IRange, ICellStyle, ITypes, IWorkbook, IWorksheet } from '@sheetxl/sdk';
2
+ import { XlsxHeader } from '../../XlsxHeader';
3
+ export { type XlsxHeader };
4
+ /**
5
+ * A worksheet as the sheet part writes it: the model's JSON with whole-row and whole-column styles
6
+ * moved onto `rows`/`cols` and borders split so every cell of a range draws the same edges.
7
+ */
8
+ export interface XlsxWorksheetJSON extends Omit<IWorksheet.JSON, 'rows' | 'cols'> {
9
+ cols?: IRange.JSONReference<XlsxHeader>[];
10
+ rows?: IRange.JSONReference<XlsxHeader>[];
11
+ }
12
+ type StyledCells = [coords: IRange.Coords, styleId: number][];
13
+ /** Looks style JSON up by direct style id, and mints ids for new JSON. */
14
+ export interface StyleIdScope {
15
+ getElementJSON(id: number): ICellStyle.JSON;
16
+ getElementID(json: ICellStyle.JSON): number | null;
17
+ }
18
+ /**
19
+ * Direct style ids keyed by the style's JSON, the same way the SDK's persist scope keys them
20
+ * (`JSONStableStringify`, Normal at 0), so a style keeps one xf however often it is minted.
21
+ */
22
+ export declare class StyleIds implements StyleIdScope {
23
+ private _byKey;
24
+ readonly list: ICellStyle.JSON[];
25
+ constructor(normal: ICellStyle.JSON | null | undefined);
26
+ getElementJSON(id: number): ICellStyle.JSON;
27
+ getElementID(json: ICellStyle.JSON | null | undefined): number;
28
+ }
29
+ /**
30
+ * Lays out every worksheet's styles the way xlsx stores them, re-minting the workbook's direct styles
31
+ * in the order the sheets cite them.
32
+ *
33
+ * @remarks
34
+ * Replaces `json.styles.direct`. Cell xf indices are direct style ids, so the list is minted sheet by
35
+ * sheet and range by range, with each split piece in its range's place and each re-derived border
36
+ * after.
37
+ *
38
+ * @returns The sheet part's JSON for each worksheet, keyed by the model's JSON for it.
39
+ */
40
+ export declare function layoutWorkbookStyles(json: IWorkbook.JSON, sheets: readonly (IWorksheet | null)[]): Map<IWorksheet.JSON, XlsxWorksheetJSON>;
41
+ /**
42
+ * Breaks a bordered range into pieces whose every cell draws the same edges, which is all a cell xf
43
+ * can say.
44
+ *
45
+ * @remarks
46
+ * A range that reaches the grid's terminal row or column (a `<col style>` reads back as a
47
+ * full-height range) has no closing border at the boundary, so no end sliver is split off there: a
48
+ * style-only piece at the last row or column materializes real `<c>` records, and Excel then treats
49
+ * the whole grid as the used range.
50
+ */
51
+ export declare function splitStyleBordersIntoSame(coords: IRange.Coords, json: ICellStyle.JSON, entireCoords?: IRange.Coords): IRange.JSONReferenceTuple<ICellStyle.JSON>[];
52
+ export interface StyleRanges {
53
+ cols: ITypes.RunCoordValue<XlsxHeader>[];
54
+ rows: ITypes.RunCoordValue<XlsxHeader>[];
55
+ cells: StyledCells;
56
+ }
57
+ /**
58
+ * Moves styles that cover most of a row or column onto `<row s>` / `<col style>`, leaving the cells
59
+ * only what the headers do not already say.
60
+ *
61
+ * @remarks
62
+ * 1. A style whose cells cover more than half of a column (or row) and reach the grid's edge
63
+ * becomes that column's (or row's) style. A style the columns already carry across most of the
64
+ * sheet is not repeated on rows.
65
+ * 2. An overlap sweep then finds what each crossing of cells and headers still has to write.
66
+ *
67
+ * A style's border is relative to the range it is stored with (a row or column style's range is the
68
+ * whole row or column), so ids are not position-independent: wherever a range is written smaller
69
+ * than the entry it came from, its id is re-derived from the style's JSON through `ids`, and two
70
+ * entries sharing an id agree on a crossing only if they draw the same edges there.
71
+ */
72
+ export declare function promoteStylesToHeaders(styles: StyleRanges, entireCoords: IRange.Coords, ids: StyleIdScope): StyleRanges;
73
+ //# sourceMappingURL=SheetStyleLayout.d.ts.map
@@ -1,8 +1,32 @@
1
- import { IStyleCollection } from '@sheetxl/sdk';
1
+ import { IStyleCollection, IText, ITextFrame } from '@sheetxl/sdk';
2
2
  import { EmitContext } from '../builder';
3
- export declare const fromRunProps: (styles: IStyleCollection, runProps: Record<string, any>, // TODO - ITextRun
3
+ /**
4
+ * The attributes of an `rPr`/`defRPr`/`endParaRPr` from run properties. Keys the chart style
5
+ * tables state as raw attributes (`lang`, `kern` in points…) pass through, as do their `b`, `i`
6
+ * and `italic` spellings; the modeled keys ({@link IText.RunPropertiesJSON}) are converted.
7
+ */
8
+ export declare const fromRunProps: (styles: IStyleCollection, runProps: Record<string, any>, // IText.RunPropertiesJSON, or a chart style's raw attributes
4
9
  defaultAttribs?: Record<string, any>) => Record<string, any>;
10
+ /**
11
+ * An `rPr`, `defRPr` or `endParaRPr` with its children, in the schema's order: outline, fill,
12
+ * effects, highlight, fonts, hyperlink.
13
+ */
14
+ export declare const writeRunProperties: (ctx: EmitContext, styles: IStyleCollection, tag: string, props: IText.RunPropertiesJSON | undefined, defaultAttribs?: Record<string, any>) => void;
15
+ /**
16
+ * A `pPr`, `defPPr` or `lvlNpPr`: attributes, then spacing, bullet, tabs and the default run, in
17
+ * the schema's order.
18
+ */
19
+ export declare const writeParagraphProperties: (ctx: EmitContext, styles: IStyleCollection, tag: string, props: IText.ParagraphPropertiesJSON) => void;
20
+ /**
21
+ * A `txBody` from the modeled text. What the JSON leaves out is SheetXL's default; where
22
+ * DrawingML's differs (overflow, a run's size) the default is stated, so the file means the same.
23
+ */
5
24
  export declare const writeTxBody: (ctx: EmitContext, styles: IStyleCollection, jsonText: any) => void;
25
+ /**
26
+ * A text body's `bodyPr` and `lstStyle` without its paragraphs, as a theme's object default states
27
+ * them. Both are written, empty when there is no text.
28
+ */
29
+ export declare const writeBodyAndListStyle: (ctx: EmitContext, styles: IStyleCollection, text: ITextFrame.JSON | undefined) => void;
6
30
  export declare const writeDefaultRProperties: (ctx: EmitContext, styles: IStyleCollection, defRPr: Record<string, any>) => void;
7
31
  export declare const writeBodyProperties: (ctx: EmitContext, styles: IStyleCollection, bodyPr: Record<string, any> | undefined) => void;
8
32
  //# sourceMappingURL=TextUtils.d.ts.map
@@ -1,4 +1,4 @@
1
- import { ISheet, IRange } from '@sheetxl/sdk';
1
+ import { IWorksheet, IRange } from '@sheetxl/sdk';
2
2
  /**
3
3
  * Which formulas on a sheet call a function Excel does not have.
4
4
  *
@@ -15,5 +15,5 @@ export interface UnsupportedFunctions {
15
15
  /** Whether formula `index` calls anything in {@link names}. */
16
16
  affects(index: number): boolean;
17
17
  }
18
- export declare const collectUnsupportedFunctions: (sheet: ISheet, jsonFormulas: IRange.JSONReferenceTuple<string>[] | undefined) => Promise<UnsupportedFunctions>;
18
+ export declare const collectUnsupportedFunctions: (sheet: IWorksheet, jsonFormulas: IRange.JSONReferenceTuple<string>[] | undefined) => Promise<UnsupportedFunctions>;
19
19
  //# sourceMappingURL=UnsupportedFunctions.d.ts.map
@@ -1 +0,0 @@
1
- const e=require("./xQ6-wbTw5UzZUM1Y.cjs");let t=require("@sheetxl/utils");var n,r,i=class e{static{this.SIGNATURE=[208,207,17,224,161,177,26,225]}static{this.FATSECT=4294967293}static{this.DIFSECT=4294967292}static{this.ENDOFCHAIN=4294967294}static{this.FREESECT=4294967295}static{this.NOSTREAM=4294967295}static{this.SECTOR_SIZE=512}static{this.MINI_SECTOR_SIZE=64}static{this.MINI_CUTOFF=4096}static{this.DIR_ENTRY_SIZE=128}static{this.DIFAT_HEADER_COUNT=109}constructor(){this.sectors=[],this.fat=[]}static write(t){return new e()._build(t)}allocate(t){let n=e.SECTOR_SIZE,r=Math.max(1,Math.ceil(t.byteLength/n)),i=this.sectors.length;for(let a=0;a<r;a++){let o=new Uint8Array(n);o.set(t.subarray(a*n,Math.min((a+1)*n,t.byteLength))),this.sectors.push(o),this.fat.push(a===r-1?e.ENDOFCHAIN:i+a+1)}return i}_build(t){let{SECTOR_SIZE:n,MINI_SECTOR_SIZE:r,MINI_CUTOFF:i,ENDOFCHAIN:a,FREESECT:o,FATSECT:s,DIFSECT:c,NOSTREAM:l,DIR_ENTRY_SIZE:u,DIFAT_HEADER_COUNT:d}=e,f=[],p=0,m=t.map(e=>{if(e.data.byteLength>=i)return{entry:e,mini:!1,start:-1};let t=p,n=Math.max(1,Math.ceil(e.data.byteLength/r)),a=new Uint8Array(n*r);return a.set(e.data),f.push(a),p+=n,{entry:e,mini:!0,start:t}});for(let e of m)e.mini||(e.start=e.entry.data.byteLength===0?a:this.allocate(e.entry.data));let h=a,g=p*r;if(p>0){let e=new Uint8Array(g),t=0;for(let n of f)e.set(n,t),t+=n.byteLength;h=this.allocate(e)}let _=a,v=0;if(p>0){let e=n/4;v=Math.ceil(p/e);let t=new Uint8Array(v*n),i=new DataView(t.buffer);t.fill(255);let o=0;for(let e of m){if(!e.mini)continue;let t=Math.max(1,Math.ceil(e.entry.data.byteLength/r));for(let e=0;e<t;e++,o++)i.setUint32(4*o,e===t-1?a:o+1,!0)}_=this.allocate(t),v=Math.ceil(t.byteLength/n)}let y=[];y.push(this._directoryEntry({name:`Root Entry`,type:5,child:t.length>0?1:l,start:h===a?0:h,size:g}));let b=m.map((e,t)=>({place:e,index:t})).sort((e,t)=>{let n=e.place.entry.name,r=t.place.entry.name;return n.length===r.length?n.toUpperCase()<r.toUpperCase()?-1:+(n.toUpperCase()>r.toUpperCase()):n.length-r.length}),x=new Map;b.forEach((e,t)=>x.set(e.index,t+1)),m.forEach((e,t)=>{let n=x.get(t)-1,r=b[n+1];y.push(this._directoryEntry({name:e.entry.name,type:2,right:r?x.get(r.index):l,start:e.mini?e.start:e.start===a?0:e.start,size:e.entry.data.byteLength}))});let S=[y[0]];b.forEach(e=>S.push(y[e.index+1]));let C=n/u,w=Math.ceil(S.length/C),T=new Uint8Array(w*n);for(let e=0;e<w*C;e++){let t=S[e]??this._directoryEntry({name:``,type:0});T.set(t,e*u)}let E=this.allocate(T),D=n/4,O=D-1,k=this.sectors.length,A=1,j=0;for(let e=0;e<16;e++){let e=k+A+j,t=Math.max(1,Math.ceil(e/D)),n=t<=d?0:Math.ceil((t-d)/O);if(t===A&&n===j)break;A=t,j=n}let M=[],N=[];for(let e=0;e<A;e++)M.push(k+e);for(let e=0;e<j;e++)N.push(k+A+e);for(let e of M)this.fat[e]=s;for(let e of N)this.fat[e]=c;let P=new Uint8Array(A*n);P.fill(255);let F=new DataView(P.buffer);for(let e=0;e<this.fat.length;e++)F.setUint32(4*e,this.fat[e],!0);let I=new Uint8Array(n+(k+A+j)*n),L=new DataView(I.buffer);I.set(e.SIGNATURE,0),L.setUint16(24,62,!0),L.setUint16(26,3,!0),L.setUint16(28,65534,!0),L.setUint16(30,9,!0),L.setUint16(32,6,!0),L.setUint32(44,A,!0),L.setUint32(48,E,!0),L.setUint32(56,i,!0),L.setUint32(60,_,!0),L.setUint32(64,v,!0),L.setUint32(68,j>0?N[0]:a,!0),L.setUint32(72,j,!0);for(let e=0;e<d;e++)L.setUint32(76+4*e,e<A?M[e]:o,!0);for(let e=0;e<k;e++)I.set(this.sectors[e],n+e*n);I.set(P,n+M[0]*n);for(let e=0;e<j;e++){let t=n+N[e]*n;for(let n=0;n<O;n++){let r=d+e*O+n;L.setUint32(t+4*n,r<A?M[r]:o,!0)}L.setUint32(t+4*O,e===j-1?a:N[e+1],!0)}return I}_directoryEntry(t){let{NOSTREAM:n}=e,r=new Uint8Array(e.DIR_ENTRY_SIZE),i=new DataView(r.buffer),a=t.name;for(let e=0;e<a.length&&e<31;e++)i.setUint16(2*e,a.charCodeAt(e),!0);return i.setUint16(64,a.length>0?2*(Math.min(a.length,31)+1):0,!0),r[66]=t.type,r[67]=1,i.setUint32(68,t.left??n,!0),i.setUint32(72,t.right??n,!0),i.setUint32(76,t.child??n,!0),i.setUint32(116,t.start??0,!0),i.setUint32(120,t.size??0,!0),i.setUint32(124,0,!0),r}};(function(e){let t=e=>{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n},n=(e,t,n)=>{let r=((e,t)=>{let n=RegExp(`\\b${t}\\s*=\\s*"([^"]*)"`).exec(e);return n?n[1]:null})(e,t);if(r===null)throw Error(`Malformed encryption descriptor: <${n}> is missing '${t}'.`);return r},r=(e,r)=>({saltValue:t(n(e,`saltValue`,r)),blockSize:parseInt(n(e,`blockSize`,r),10),keyBits:parseInt(n(e,`keyBits`,r),10),hashSize:parseInt(n(e,`hashSize`,r),10),cipherAlgorithm:n(e,`cipherAlgorithm`,r),cipherChaining:n(e,`cipherChaining`,r),hashAlgorithm:n(e,`hashAlgorithm`,r)}),i=(e,t)=>{let n=RegExp(`<(?:\\w+:)?${t}\\b[^>]*>`).exec(e);return n?n[0]:null},a=e=>{let t=``;for(let n=0;n<e.byteLength;n++)t+=String.fromCharCode(e[n]);return btoa(t)};e.build=e=>{let t=`saltSize="${e.saltSize}" blockSize="${e.blockSize}" keyBits="${e.keyBits}" hashSize="${e.hashSize}" cipherAlgorithm="${e.cipherAlgorithm}" cipherChaining="${e.cipherChaining}" hashAlgorithm="${e.hashAlgorithm}"`,n=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r\n<encryption xmlns="http://schemas.microsoft.com/office/2006/encryption" xmlns:p="http://schemas.microsoft.com/office/2006/keyEncryptor/password" xmlns:c="http://schemas.microsoft.com/office/2006/keyEncryptor/certificate"><keyData ${t} saltValue="${a(e.keyDataSalt)}"/><dataIntegrity encryptedHmacKey="${a(e.encryptedHmacKey)}" encryptedHmacValue="${a(e.encryptedHmacValue)}"/><keyEncryptors><keyEncryptor uri="http://schemas.microsoft.com/office/2006/keyEncryptor/password"><p:encryptedKey spinCount="${e.spinCount}" ${t} saltValue="${a(e.encryptorSalt)}" encryptedVerifierHashInput="${a(e.encryptedVerifierHashInput)}" encryptedVerifierHashValue="${a(e.encryptedVerifierHashValue)}" encryptedKeyValue="${a(e.encryptedKeyValue)}"/></keyEncryptor></keyEncryptors></encryption>`,r=new TextEncoder().encode(n),i=new Uint8Array(8+r.byteLength),o=new DataView(i.buffer);return o.setUint16(0,4,!0),o.setUint16(2,4,!0),o.setUint32(4,64,!0),i.set(r,8),i},e.parse=e=>{if(e.byteLength<8)throw Error(`Malformed EncryptionInfo stream (too short).`);let a=new DataView(e.buffer,e.byteOffset,e.byteLength),o=a.getUint16(0,!0),s=a.getUint16(2,!0);if(o===4&&s===4){let a=new TextDecoder().decode(e.subarray(8)),o=i(a,`keyData`);if(!o)throw Error(`Malformed encryption descriptor: no <keyData>.`);let s=i(a,`encryptedKey`);if(!s)throw Error(`This file is encrypted with a scheme SheetXL cannot open (no password key encryptor).`);let c=i(a,`dataIntegrity`);return{scheme:`agile`,keyData:r(o,`keyData`),passwordKeyEncryptor:{...r(s,`encryptedKey`),spinCount:parseInt(n(s,`spinCount`,`encryptedKey`),10),encryptedVerifierHashInput:t(n(s,`encryptedVerifierHashInput`,`encryptedKey`)),encryptedVerifierHashValue:t(n(s,`encryptedVerifierHashValue`,`encryptedKey`)),encryptedKeyValue:t(n(s,`encryptedKeyValue`,`encryptedKey`))},dataIntegrity:c?{encryptedHmacKey:t(n(c,`encryptedHmacKey`,`dataIntegrity`)),encryptedHmacValue:t(n(c,`encryptedHmacValue`,`dataIntegrity`))}:null}}return{scheme:o===2?`rc4-cryptoapi`:s===2?`standard`:`rc4`,versionMajor:o,versionMinor:s}}})(n||={}),function(e){let t={verifierHashInput:new Uint8Array([254,167,210,118,59,75,158,121]),verifierHashValue:new Uint8Array([215,170,15,109,48,97,52,78]),keyValue:new Uint8Array([20,110,11,231,171,172,208,214]),hmacKey:new Uint8Array([95,178,173,1,12,185,225,246]),hmacValue:new Uint8Array([160,103,127,2,178,44,132,51])},n=async()=>globalThis.crypto,r=e=>{switch(e.toUpperCase().replace(/[^A-Z0-9]/g,``)){case`SHA1`:return`SHA-1`;case`SHA256`:return`SHA-256`;case`SHA384`:return`SHA-384`;case`SHA512`:return`SHA-512`;default:throw Error(`Unsupported encryption hash algorithm '${e}'.`)}},i=e=>{let t=new Uint8Array(e.byteLength);return t.set(e),t},a=(...e)=>{let t=0;for(let n of e)t+=n.byteLength;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.byteLength;return n},o=(e,t)=>{if(e.byteLength>=t)return i(e.subarray(0,t));let n=new Uint8Array(t).fill(54);return n.set(e),n},s=e=>{let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),t},c=async(e,t,...n)=>new Uint8Array(await e.subtle.digest(t,a(...n))),l=()=>typeof MessageChannel==`function`?new Promise(e=>{let t=new MessageChannel;t.port1.onmessage=()=>{t.port1.close(),t.port2.close(),e()},t.port2.postMessage(null)}):new Promise(e=>{setTimeout(e,0)}),u=async(e,t,n,r,i)=>{let a=new Uint8Array(2*t.length),o=new DataView(a.buffer);for(let e=0;e<t.length;e++)o.setUint16(2*e,t.charCodeAt(e),!0);let u=await c(e,r,n,a);for(let t=0;t<i;t++)u=await c(e,r,s(t),u),t%2048==0&&await l();return u},d=async(e,t,n,r,i)=>o(await c(e,r,t,n),i),f=async(e,t,n,r,i)=>o(await c(e,r,t,s(n)),i),p=async(e,t,n,r,i)=>o(await c(e,r,t,n),i),m=async(e,t,n,r)=>{let a=await e.subtle.importKey(`raw`,i(n),{name:`HMAC`,hash:{name:t}},!1,[`sign`]);return new Uint8Array(await e.subtle.sign(`HMAC`,a,i(r)))},h=async(e,t,n,r)=>{let o=i(r);if(o.byteLength===0)return o;if(o.byteLength%16!=0)throw Error(`Malformed encrypted payload (not block aligned).`);let s=await e.subtle.importKey(`raw`,t,{name:`AES-CBC`},!1,[`encrypt`,`decrypt`]),c=i(o.subarray(o.byteLength-16)),l=new Uint8Array(16).fill(16),u=new Uint8Array(await e.subtle.encrypt({name:`AES-CBC`,iv:c},s,l)).subarray(0,16),d=await e.subtle.decrypt({name:`AES-CBC`,iv:n},s,a(o,u));return new Uint8Array(d)};e.resolveSecretKey=async(e,a)=>{let s=e.passwordKeyEncryptor;if(!/^AES$/i.test(s.cipherAlgorithm)||!/CBC$/i.test(s.cipherChaining))throw Error(`Unsupported encryption cipher '${s.cipherAlgorithm}/${s.cipherChaining}'.`);let l=await n(),f=r(s.hashAlgorithm),p=s.keyBits/8,m=await u(l,a,s.saltValue,f,s.spinCount),g=o(s.saltValue,s.blockSize),_=await d(l,m,t.verifierHashInput,f,p),v=await h(l,_,g,s.encryptedVerifierHashInput),y=await d(l,m,t.verifierHashValue,f,p),b=await h(l,y,g,s.encryptedVerifierHashValue),x=await c(l,f,v),S=+(x.byteLength>b.byteLength);for(let e=0;e<b.byteLength;e++)S|=(e<x.byteLength?x[e]:0)^b[e];if(S!==0)return null;let C=await d(l,m,t.keyValue,f,p),w=await h(l,C,g,s.encryptedKeyValue);return i(w.subarray(0,e.keyData.keyBits/8))};let g=async(e,t,n,r)=>{let a=i(r);if(a.byteLength===0)return a;if(a.byteLength%16!=0)throw Error(`Malformed plaintext (not block aligned).`);let o=await e.subtle.importKey(`raw`,t,{name:`AES-CBC`},!1,[`encrypt`]),s=new Uint8Array(await e.subtle.encrypt({name:`AES-CBC`,iv:n},o,a));return i(s.subarray(0,a.byteLength))},_=(e,t)=>e%t===0?e:e+(t-e%t),v=4096;e.decryptPackage=async(e,t,i)=>{if(i.byteLength<8)throw Error(`Malformed EncryptedPackage stream (too short).`);let a=await n(),{keyData:o}=e,s=r(o.hashAlgorithm),c=new DataView(i.buffer,i.byteOffset,i.byteLength),l=c.getUint32(0,!0)+4294967296*c.getUint32(4,!0),u=i.subarray(8),d=new Uint8Array(Math.min(l,u.byteLength)),p=0;for(let e=0;e*v<u.byteLength;e++){let n=e*v,r=u.subarray(n,Math.min(n+v,u.byteLength)),i=r.byteLength%o.blockSize;if(i){let e=new Uint8Array(r.byteLength+o.blockSize-i);e.set(r),r=e}let c=await f(a,o.saltValue,e,s,o.blockSize),l=await h(a,t,c,r),m=Math.min(l.byteLength,d.byteLength-p);if(m<=0)break;d.set(l.subarray(0,m),p),p+=m}return d.subarray(0,p)},e.verifyIntegrity=async(e,i,a)=>{let o=e.dataIntegrity;if(!o)return!0;let s=await n(),{keyData:c}=e,l=r(c.hashAlgorithm),u=(await h(s,i,await p(s,c.saltValue,t.hmacKey,l,c.blockSize),o.encryptedHmacKey)).subarray(0,c.hashSize),d=(await h(s,i,await p(s,c.saltValue,t.hmacValue,l,c.blockSize),o.encryptedHmacValue)).subarray(0,c.hashSize),f=await m(s,l,u,a);if(f.byteLength<c.hashSize)return!1;let g=0;for(let e=0;e<c.hashSize;e++)g|=d[e]^f[e];return g===0};let y=e.DEFAULTS={hashAlgorithm:`SHA512`,cipherAlgorithm:`AES`,cipherChaining:`ChainingModeCBC`,saltSize:16,blockSize:16,keyBits:256,hashSize:64,spinCount:1e5};e.encrypt=async(e,i)=>{let a=await n(),s=r(y.hashAlgorithm),l=y.keyBits/8,h=e=>{let t=new Uint8Array(e);return a.getRandomValues(t),t},b=h(l),x=h(y.saltSize),S=h(y.saltSize),C=h(y.saltSize),w=await u(a,i,S,s,y.spinCount),T=o(S,y.blockSize),E=await d(a,w,t.verifierHashInput,s,l),D=await g(a,E,T,C),O=await c(a,s,C),k=await d(a,w,t.verifierHashValue,s,l),A=new Uint8Array(_(O.byteLength,y.blockSize));A.set(O);let j=await g(a,k,T,A),M=await d(a,w,t.keyValue,s,l),N=await g(a,M,T,b),P=e.byteLength,F=Math.max(1,Math.ceil(P/v)),I=new Uint8Array(_(P,y.blockSize)||y.blockSize);for(let t=0;t<F;t++){let n=t*v,r=e.subarray(n,Math.min(n+v,P)),i=new Uint8Array(_(r.byteLength,y.blockSize));i.set(r);let o=await f(a,x,t,s,y.blockSize);I.set(await g(a,b,o,i),n)}let L=new Uint8Array(8+I.byteLength),R=new DataView(L.buffer);R.setUint32(0,P>>>0,!0),R.setUint32(4,Math.floor(P/4294967296),!0),L.set(I,8);let z=h(y.hashSize),B=new Uint8Array(_(z.byteLength,y.blockSize));B.set(z);let V=await g(a,b,await p(a,x,t.hmacKey,s,y.blockSize),B),H=await m(a,s,z,L),U=new Uint8Array(_(H.byteLength,y.blockSize));return U.set(H),{keyDataSalt:x,encryptorSalt:S,encryptedVerifierHashInput:D,encryptedVerifierHashValue:j,encryptedKeyValue:N,encryptedHmacKey:V,encryptedHmacValue:await g(a,b,await p(a,x,t.hmacValue,s,y.blockSize),U),encryptedPackage:L}}}(r||={});var a=[208,207,17,224,161,177,26,225],o=`EncryptionInfo`,s=`EncryptedPackage`,c=t=>{if(!(e=>{if(e.byteLength<a.length)return!1;let t=new Uint8Array(e,0,a.length);for(let e=0;e<a.length;e++)if(t[e]!==a[e])return!1;return!0})(t))return null;let n;try{n=e.t.read(new Uint8Array(t))}catch{return null}let r=n.readStream(o),i=n.readStream(s);return r&&i?{info:r,encryptedPackage:i}:null},l={key:`offcrypto`,description:`Office Document Encryption`,detect:e=>c(e)!==null,async decode(e,i){let a=c(e);if(!a)throw Error(`Not an encrypted Office container.`);let o=n.parse(a.info);if(o.scheme!==`agile`)throw Error(`This file uses ${(e=>{switch(e){case`standard`:return`Standard ECMA-376 encryption (Office 2007)`;case`rc4-cryptoapi`:return`RC4 CryptoAPI encryption (Office 2002-2003)`;case`rc4`:return`RC4/XOR obfuscation (Office 97-2000)`;default:return e}})(o.scheme)}, which SheetXL cannot open yet. Re-save it from Excel to upgrade it to the current encryption.`);let s=await r.resolveSecretKey(o,i);if(!s)throw new t.InvalidPasswordError;if(o.dataIntegrity&&!await r.verifyIntegrity(o,s,a.encryptedPackage))throw Error(`This file failed its integrity check — it has been altered or is damaged since it was encrypted.`);let l=await r.decryptPackage(o,s,a.encryptedPackage);return l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength)},async encode(e,t){if(!t)throw Error(`A password is required to encrypt.`);let a=await r.encrypt(new Uint8Array(e),t),c=n.build({...r.DEFAULTS,keyDataSalt:a.keyDataSalt,encryptorSalt:a.encryptorSalt,encryptedVerifierHashInput:a.encryptedVerifierHashInput,encryptedVerifierHashValue:a.encryptedVerifierHashValue,encryptedKeyValue:a.encryptedKeyValue,encryptedHmacKey:a.encryptedHmacKey,encryptedHmacValue:a.encryptedHmacValue}),l=i.write([{name:o,data:c},{name:s,data:a.encryptedPackage}]);return l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength)}};exports.OffCryptoEncryption=l;
@@ -1 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(o,s,c)=>(c=o==null?{}:e(i(o)),((e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c,l=r(i),u=0,d=l.length;u<d;u++)c=l[u],a.call(e,c)||c===o||t(e,c,{get:(e=>i[e]).bind(null,c),enumerable:!(s=n(i,c))||s.enumerable});return e})(!s&&o&&o.__esModule?c:t(c,`default`,{value:o,enumerable:!0}),o));Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});