microsoft-graph 2.21.0 → 2.22.1

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 (74) hide show
  1. package/.vscode/settings.json +2 -1
  2. package/dist/cjs/models/{Source.d.ts → DataSource.d.ts} +6 -6
  3. package/dist/cjs/models/DataSource.d.ts.map +1 -0
  4. package/dist/cjs/models/DataSourceDecoder.d.ts +4 -0
  5. package/dist/cjs/models/DataSourceDecoder.d.ts.map +1 -0
  6. package/dist/cjs/models/DataSourceEncoder.d.ts +4 -0
  7. package/dist/cjs/models/DataSourceEncoder.d.ts.map +1 -0
  8. package/dist/cjs/models/DataSourceIndex.d.ts +4 -0
  9. package/dist/cjs/models/DataSourceIndex.d.ts.map +1 -0
  10. package/dist/cjs/models/DataSourceRow.d.ts +4 -0
  11. package/dist/cjs/models/DataSourceRow.d.ts.map +1 -0
  12. package/dist/cjs/models/DataSourceRow.js +2 -0
  13. package/dist/cjs/models/Item.d.ts +2 -2
  14. package/dist/cjs/models/Item.d.ts.map +1 -1
  15. package/dist/cjs/models/RangeOperationCallback.d.ts +3 -0
  16. package/dist/cjs/models/RangeOperationCallback.d.ts.map +1 -0
  17. package/dist/cjs/models/RangeOperationCallback.js +2 -0
  18. package/dist/cjs/services/addressManipulation.d.ts +33 -0
  19. package/dist/cjs/services/addressManipulation.d.ts.map +1 -1
  20. package/dist/cjs/services/addressManipulation.js +74 -0
  21. package/dist/cjs/services/dataSource.d.ts +1 -0
  22. package/dist/cjs/services/dataSource.d.ts.map +1 -0
  23. package/dist/cjs/services/dataSource.js +196 -0
  24. package/dist/esm/models/{Source.d.ts → DataSource.d.ts} +6 -6
  25. package/dist/esm/models/DataSource.d.ts.map +1 -0
  26. package/dist/esm/models/DataSourceDecoder.d.ts +4 -0
  27. package/dist/esm/models/DataSourceDecoder.d.ts.map +1 -0
  28. package/dist/esm/models/DataSourceEncoder.d.ts +4 -0
  29. package/dist/esm/models/DataSourceEncoder.d.ts.map +1 -0
  30. package/dist/esm/models/DataSourceIndex.d.ts +4 -0
  31. package/dist/esm/models/DataSourceIndex.d.ts.map +1 -0
  32. package/dist/esm/models/DataSourceRow.d.ts +4 -0
  33. package/dist/esm/models/DataSourceRow.d.ts.map +1 -0
  34. package/dist/esm/models/DataSourceRow.js +1 -0
  35. package/dist/esm/models/Item.d.ts +2 -2
  36. package/dist/esm/models/Item.d.ts.map +1 -1
  37. package/dist/esm/models/RangeOperationCallback.d.ts +3 -0
  38. package/dist/esm/models/RangeOperationCallback.d.ts.map +1 -0
  39. package/dist/esm/models/RangeOperationCallback.js +1 -0
  40. package/dist/esm/services/addressManipulation.d.ts +33 -0
  41. package/dist/esm/services/addressManipulation.d.ts.map +1 -1
  42. package/dist/esm/services/addressManipulation.js +72 -0
  43. package/dist/esm/services/dataSource.d.ts +2 -0
  44. package/dist/esm/services/dataSource.d.ts.map +1 -0
  45. package/dist/esm/services/dataSource.js +196 -0
  46. package/package.json +176 -126
  47. package/dist/cjs/models/Source.d.ts.map +0 -1
  48. package/dist/cjs/models/SourceDecoder.d.ts +0 -4
  49. package/dist/cjs/models/SourceDecoder.d.ts.map +0 -1
  50. package/dist/cjs/models/SourceEncoder.d.ts +0 -4
  51. package/dist/cjs/models/SourceEncoder.d.ts.map +0 -1
  52. package/dist/cjs/models/SourceRow.d.ts +0 -4
  53. package/dist/cjs/models/SourceRow.d.ts.map +0 -1
  54. package/dist/cjs/services/source.d.ts +0 -1
  55. package/dist/cjs/services/source.d.ts.map +0 -1
  56. package/dist/cjs/services/source.js +0 -178
  57. package/dist/esm/models/Source.d.ts.map +0 -1
  58. package/dist/esm/models/SourceDecoder.d.ts +0 -4
  59. package/dist/esm/models/SourceDecoder.d.ts.map +0 -1
  60. package/dist/esm/models/SourceEncoder.d.ts +0 -4
  61. package/dist/esm/models/SourceEncoder.d.ts.map +0 -1
  62. package/dist/esm/models/SourceRow.d.ts +0 -4
  63. package/dist/esm/models/SourceRow.d.ts.map +0 -1
  64. package/dist/esm/services/source.d.ts +0 -2
  65. package/dist/esm/services/source.d.ts.map +0 -1
  66. package/dist/esm/services/source.js +0 -178
  67. /package/dist/cjs/models/{Source.js → DataSource.js} +0 -0
  68. /package/dist/cjs/models/{SourceDecoder.js → DataSourceDecoder.js} +0 -0
  69. /package/dist/cjs/models/{SourceEncoder.js → DataSourceEncoder.js} +0 -0
  70. /package/dist/cjs/models/{SourceRow.js → DataSourceIndex.js} +0 -0
  71. /package/dist/esm/models/{Source.js → DataSource.js} +0 -0
  72. /package/dist/esm/models/{SourceDecoder.js → DataSourceDecoder.js} +0 -0
  73. /package/dist/esm/models/{SourceEncoder.js → DataSourceEncoder.js} +0 -0
  74. /package/dist/esm/models/{SourceRow.js → DataSourceIndex.js} +0 -0
@@ -12,6 +12,7 @@
12
12
  "Entra",
13
13
  "FSAI",
14
14
  "msgraph",
15
- "sourcedoc"
15
+ "sourcedoc",
16
+ "subaddress"
16
17
  ],
17
18
  }
@@ -1,15 +1,15 @@
1
1
  import type { ColumnName } from "./ColumnName.ts";
2
+ import type { DataSourceDecoder } from "./DataSourceDecoder.ts";
3
+ import type { DataSourceEncoder } from "./DataSourceEncoder.ts";
2
4
  import type { Item } from "./Item.ts";
3
5
  import type { RecordBase } from "./RecordBase.ts";
4
- import type { SourceDecoder } from "./SourceDecoder.ts";
5
- import type { SourceEncoder } from "./SourceEncoder.ts";
6
6
  import type { WorkbookRangeRef } from "./WorkbookRangeRef.ts";
7
- export type Source<T extends RecordBase> = {
7
+ export type DataSource<T extends RecordBase> = {
8
8
  rangeRef: WorkbookRangeRef;
9
9
  head: ColumnName[];
10
10
  coding: {
11
- decode: SourceDecoder<T>;
12
- encode: SourceEncoder<T>;
11
+ decode: DataSourceDecoder<T>;
12
+ encode: DataSourceEncoder<T> | null;
13
13
  };
14
14
  } & AsyncIterable<Item<T>>;
15
- //# sourceMappingURL=Source.d.ts.map
15
+ //# sourceMappingURL=DataSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSource.d.ts","sourceRoot":"","sources":["../../../src/models/DataSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI;IAC9C,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,MAAM,EAAE;QACP,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAC7B,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;KACpC,CAAC;CACF,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { DataSourceRow } from "./DataSourceRow.ts";
2
+ import type { RecordBase } from "./RecordBase.ts";
3
+ export type DataSourceDecoder<T extends RecordBase> = (row: DataSourceRow) => T;
4
+ //# sourceMappingURL=DataSourceDecoder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSourceDecoder.d.ts","sourceRoot":"","sources":["../../../src/models/DataSourceDecoder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,GAAG,EAAE,aAAa,KAAK,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { DataSourceRow } from "./DataSourceRow.ts";
2
+ import type { RecordBase } from "./RecordBase.ts";
3
+ export type DataSourceEncoder<T extends RecordBase> = (record: T) => DataSourceRow;
4
+ //# sourceMappingURL=DataSourceEncoder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSourceEncoder.d.ts","sourceRoot":"","sources":["../../../src/models/DataSourceEncoder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type DataSourceIndex = number & {
2
+ __brand: "Index";
3
+ };
4
+ //# sourceMappingURL=DataSourceIndex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSourceIndex.d.ts","sourceRoot":"","sources":["../../../src/models/DataSourceIndex.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG;IACtC,OAAO,EAAE,OAAO,CAAC;CACjB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Cell } from "./Cell.ts";
2
+ import type { ColumnName } from "./ColumnName.ts";
3
+ export type DataSourceRow = Record<ColumnName, Cell>;
4
+ //# sourceMappingURL=DataSourceRow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSourceRow.d.ts","sourceRoot":"","sources":["../../../src/models/DataSourceRow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +1,8 @@
1
- import type { RowOffset } from "../models/RowOffset.ts";
1
+ import type { DataSourceIndex } from "./DataSourceIndex.ts";
2
2
  import type { RecordBase } from "./RecordBase.ts";
3
3
  import type { RowNumber } from "./RowNumber.ts";
4
4
  export type Item<T extends RecordBase> = {
5
- rowOffset: RowOffset;
5
+ index: DataSourceIndex;
6
6
  rowNumber: RowNumber;
7
7
  record: T;
8
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../src/models/Item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,UAAU,IAAI;IACxC,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,CAAC,CAAC;CACV,CAAC"}
1
+ {"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../src/models/Item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,UAAU,IAAI;IACxC,KAAK,EAAE,eAAe,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,CAAC,CAAC;CACV,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { WorkbookRangeRef } from "../models/WorkbookRangeRef.ts";
2
+ export type RangeOperationCallback = (rangeRef: WorkbookRangeRef) => Promise<void>;
3
+ //# sourceMappingURL=RangeOperationCallback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RangeOperationCallback.d.ts","sourceRoot":"","sources":["../../../src/models/RangeOperationCallback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,MAAM,sBAAsB,GAAG,CAAC,QAAQ,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,5 @@
1
1
  import type { Address, CellAddress, ColumnAddress, RowAddress } from "../models/Address.ts";
2
+ import type { WorkbookRangeRef } from "../models/WorkbookRangeRef.ts";
2
3
  export type AddressComponents = {
3
4
  startColumn: ColumnAddress;
4
5
  endColumn: ColumnAddress;
@@ -128,4 +129,36 @@ export declare function countAddressRows(address: Address): number;
128
129
  * @returns The number of columns in the address.
129
130
  */
130
131
  export declare function countAddressColumns(address: Address): number;
132
+ /**
133
+ * Extracts a subrange from a spreadsheet-style A1 range (e.g., "A1:D10"),
134
+ * allowing skip and take semantics on both rows and columns.
135
+ *
136
+ * Supports negative values for `skipRows` and `skipCols` to count from the end.
137
+ * Supports negative values for `takeRows` and `takeCols` to exclude from the end after skipping.
138
+ *
139
+ * @param address - The original range in A1 notation (e.g., "A1:D10").
140
+ * @param skipRows - Number of rows to skip. If negative, skips that many rows from the end. Default is 0.
141
+ * @param takeRows - Number of rows to take after skipping. If negative, excludes that many rows from the end of the remaining rows. Default is Infinity.
142
+ * @param skipCols - Number of columns to skip. If negative, skips that many columns from the end. Default is 0.
143
+ * @param takeCols - Number of columns to take after skipping. If negative, excludes that many columns from the end of the remaining columns. Default is Infinity.
144
+ * @returns A new A1-style range representing the sliced subrange (e.g., "B2:C5").
145
+ *
146
+ * @example
147
+ * subaddress("A1:D10", -1, 1); // Last row: "A10:D10"
148
+ * subaddress("A1:D10", -2, 1); // Second last row: "A9:D9"
149
+ * subaddress("A1:D10", 0, -1); // All but last row: "A1:D9"
150
+ * subaddress("A1:D10", 0, Infinity, -2, 1); // Second last column: "C1:C10"
151
+ */
152
+ export declare function subaddress(address: Address, skipRows?: number, takeRows?: number, skipCols?: number, takeCols?: number): Address;
153
+ /**
154
+ * Extracts a subrange from a WorkbookRangeRef using skip/take semantics.
155
+ * @param rangeRef Range reference to extract the sub-range from.
156
+ * @param skipRows Number of rows to skip. If negative, skips from the end. Default 0.
157
+ * @param takeRows Number of rows to take after skipping. If negative, excludes from the end. Default Infinity.
158
+ * @param skipCols Number of columns to skip. If negative, skips from the end. Default 0.
159
+ * @param takeCols Number of columns to take after skipping. If negative, excludes from the end. Default Infinity.
160
+ * @returns Extracted sub-range reference.
161
+ * @throws InvalidArgumentError if the requested rows or columns exceed the available range.
162
+ */
163
+ export declare function subrange(rangeRef: WorkbookRangeRef, skipRows?: number, takeRows?: number, skipCols?: number, takeCols?: number): WorkbookRangeRef;
131
164
  //# sourceMappingURL=addressManipulation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"addressManipulation.d.ts","sourceRoot":"","sources":["../../../src/services/addressManipulation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAoB,aAAa,EAAsB,UAAU,EAAmB,MAAM,sBAAsB,CAAC;AAmBnJ,MAAM,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,aAAa,CAAC;IAC3B,SAAS,EAAE,aAAa,CAAC;IACzB,QAAQ,EAAE,UAAU,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,UAAQ,GAAG,OAAO,CAE9E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAcpE;AA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,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,SAAI,EAAE,QAAQ,SAA2B,EAAE,QAAQ,SAAI,EAAE,QAAQ,SAA2B,GAAG,gBAAgB,CAM3K"}
@@ -22,9 +22,12 @@ exports.isAllColumnsAddress = isAllColumnsAddress;
22
22
  exports.isAllRowsAddress = isAllRowsAddress;
23
23
  exports.countAddressRows = countAddressRows;
24
24
  exports.countAddressColumns = countAddressColumns;
25
+ exports.subaddress = subaddress;
26
+ exports.subrange = subrange;
25
27
  const InvalidArgumentError_ts_1 = __importDefault(require("../errors/InvalidArgumentError.js"));
26
28
  const UnsupportedAddressTypeError_ts_1 = __importDefault(require("../errors/UnsupportedAddressTypeError.js"));
27
29
  const addressOffset_ts_1 = require("./addressOffset.js");
30
+ const cartesianAddress_ts_1 = require("./cartesianAddress.js");
28
31
  const firstColumn = "A";
29
32
  const lastColumn = "XFD";
30
33
  const firstRow = "1";
@@ -276,6 +279,77 @@ function countAddressColumns(address) {
276
279
  const components = decomposeAddress(address);
277
280
  return (0, addressOffset_ts_1.columnAddressToOffset)(components.endColumn) - (0, addressOffset_ts_1.columnAddressToOffset)(components.startColumn) + 1;
278
281
  }
282
+ /**
283
+ * Extracts a subrange from a spreadsheet-style A1 range (e.g., "A1:D10"),
284
+ * allowing skip and take semantics on both rows and columns.
285
+ *
286
+ * Supports negative values for `skipRows` and `skipCols` to count from the end.
287
+ * Supports negative values for `takeRows` and `takeCols` to exclude from the end after skipping.
288
+ *
289
+ * @param address - The original range in A1 notation (e.g., "A1:D10").
290
+ * @param skipRows - Number of rows to skip. If negative, skips that many rows from the end. Default is 0.
291
+ * @param takeRows - Number of rows to take after skipping. If negative, excludes that many rows from the end of the remaining rows. Default is Infinity.
292
+ * @param skipCols - Number of columns to skip. If negative, skips that many columns from the end. Default is 0.
293
+ * @param takeCols - Number of columns to take after skipping. If negative, excludes that many columns from the end of the remaining columns. Default is Infinity.
294
+ * @returns A new A1-style range representing the sliced subrange (e.g., "B2:C5").
295
+ *
296
+ * @example
297
+ * subaddress("A1:D10", -1, 1); // Last row: "A10:D10"
298
+ * subaddress("A1:D10", -2, 1); // Second last row: "A9:D9"
299
+ * subaddress("A1:D10", 0, -1); // All but last row: "A1:D9"
300
+ * subaddress("A1:D10", 0, Infinity, -2, 1); // Second last column: "C1:C10"
301
+ */
302
+ function subaddress(address, skipRows = 0, takeRows = Number.POSITIVE_INFINITY, skipCols = 0, takeCols = Number.POSITIVE_INFINITY) {
303
+ const { ax, bx, ay, by } = (0, cartesianAddress_ts_1.addressToCartesian)(address);
304
+ const [startRow, endRow] = slice(ay, by, skipRows, takeRows);
305
+ const [startCol, endCol] = slice(ax, bx, skipCols, takeCols);
306
+ if (startRow < ay || endRow > by || startRow > endRow || startCol < ax || endCol > bx || startCol > endCol) {
307
+ throw new InvalidArgumentError_ts_1.default(`Requested subaddress is out of bounds: rows [${startRow + 1},${endRow + 1}], cols [${startCol + 1},${endCol + 1}] in range.`);
308
+ }
309
+ return (0, cartesianAddress_ts_1.cartesianToAddress)({
310
+ ay: startRow,
311
+ by: endRow,
312
+ ax: startCol,
313
+ bx: endCol,
314
+ });
315
+ function slice(start, end, skip, take) {
316
+ let s = start;
317
+ let e = end;
318
+ if (skip > 0) {
319
+ s = start + skip;
320
+ }
321
+ else if (skip < 0) {
322
+ s = end + skip + 1;
323
+ }
324
+ if (!Number.isFinite(take)) {
325
+ // do nothing
326
+ }
327
+ else if (take >= 0) {
328
+ e = s + take - 1;
329
+ }
330
+ else if (take < 0) {
331
+ e += take;
332
+ }
333
+ return [s, e];
334
+ }
335
+ }
336
+ /**
337
+ * Extracts a subrange from a WorkbookRangeRef using skip/take semantics.
338
+ * @param rangeRef Range reference to extract the sub-range from.
339
+ * @param skipRows Number of rows to skip. If negative, skips from the end. Default 0.
340
+ * @param takeRows Number of rows to take after skipping. If negative, excludes from the end. Default Infinity.
341
+ * @param skipCols Number of columns to skip. If negative, skips from the end. Default 0.
342
+ * @param takeCols Number of columns to take after skipping. If negative, excludes from the end. Default Infinity.
343
+ * @returns Extracted sub-range reference.
344
+ * @throws InvalidArgumentError if the requested rows or columns exceed the available range.
345
+ */
346
+ function subrange(rangeRef, skipRows = 0, takeRows = Number.POSITIVE_INFINITY, skipCols = 0, takeCols = Number.POSITIVE_INFINITY) {
347
+ const address = subaddress(rangeRef.address, skipRows, takeRows, skipCols, takeCols);
348
+ return {
349
+ ...rangeRef,
350
+ address,
351
+ };
352
+ }
279
353
  function isSingleRow(components) {
280
354
  return components.startRow === components.endRow;
281
355
  }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=dataSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataSource.d.ts","sourceRoot":"","sources":["../../../src/services/dataSource.ts"],"names":[],"mappings":""}
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ // import InvalidArgumentError from "../errors/InvalidArgumentError.ts";
3
+ // import InvalidOperationError from "../errors/InvalidOperationError.ts";
4
+ // import NeverError from "../errors/NeverError.ts";
5
+ // import type { Cell } from "../models/Cell.ts";
6
+ // import type { ColumnName } from "../models/ColumnName.ts";
7
+ // import type { ColumnOffset } from "../models/ColumnOffset.ts";
8
+ // import type { DataSource } from "../models/DataSource.ts";
9
+ // import type { DataSourceDecoder } from "../models/DataSourceDecoder.ts";
10
+ // import type { DataSourceEncoder } from "../models/DataSourceEncoder.ts";
11
+ // import type { DataSourceIndex } from "../models/DataSourceIndex.ts";
12
+ // import type { DataSourceRow } from "../models/DataSourceRow.ts";
13
+ // import type { Item } from "../models/Item.ts";
14
+ // import type { RangeOperationCallback } from "../models/RangeOperationCallback.ts";
15
+ // import type { RecordBase } from "../models/RecordBase.ts";
16
+ // import type { RowNumber } from "../models/RowNumber.ts";
17
+ // import type { RowOffset } from "../models/RowOffset.ts";
18
+ // import type { WorkbookRangeRef } from "../models/WorkbookRangeRef.ts";
19
+ // import type { WorkbookWorksheetRef } from "../models/WorkbookWorksheetRef.ts";
20
+ // import deleteWorkbookRange from "../operations/workbookRange/deleteWorkbookRange.ts";
21
+ // import insertWorkbookCells from "../operations/workbookRange/insertWorkbookCells.ts";
22
+ // import updateWorkbookRange from "../operations/workbookRange/updateWorkbookRange.ts";
23
+ // import readWorkbookRows from "../tasks/readWorkbookRows.ts";
24
+ // import { countAddressColumns, countAddressRows } from "./addressManipulation.ts";
25
+ // import { rowOffsetToAddress } from "./addressOffset.ts";
26
+ // import { addressToCartesian, cartesianToAddress } from "./cartesianAddress.ts";
27
+ // import { createWorkbookRangeRef } from "./workbookRange.ts";
28
+ // /**
29
+ // * Define a range and create a data source on it. From there you can read, update, create, insert and delete items with a given encoding and decoding strategy.
30
+ // * @param parentRef
31
+ // * @param decode
32
+ // * @param encode
33
+ // * @returns
34
+ // */
35
+ // export async function defineDataSource<T extends RecordBase>(parentRef: WorkbookWorksheetRef | WorkbookRangeRef, decode: DataSourceDecoder<T>, encode: DataSourceEncoder<T> | null = null): Promise<DataSource<T>> {
36
+ // const rangeRef = "address" in parentRef ? parentRef : createWorkbookRangeRef(parentRef, "A1");
37
+ // const source: DataSource<T> = {
38
+ // rangeRef,
39
+ // coding: {
40
+ // decode,
41
+ // encode,
42
+ // },
43
+ // head: [],
44
+ // async *[Symbol.asyncIterator](): AsyncGenerator<Item<T>> {
45
+ // const { ay } = addressToCartesian(this.rangeRef.address);
46
+ // let hasHead = false;
47
+ // let index = 0 as DataSourceIndex;
48
+ // for await (const row of readWorkbookRows(source.rangeRef)) {
49
+ // if (!hasHead) {
50
+ // source.head = row.map((cell) => cell.text as unknown as ColumnName);
51
+ // hasHead = true;
52
+ // continue;
53
+ // }
54
+ // const record = rowToRecord<T>(row, source);
55
+ // const rowNumber = indexToRowNumber(ay, index);
56
+ // yield {
57
+ // index,
58
+ // rowNumber,
59
+ // record,
60
+ // };
61
+ // index++;
62
+ // }
63
+ // },
64
+ // };
65
+ // return source;
66
+ // }
67
+ // export async function initializeDataSource<T extends RecordBase>(source: DataSource<T>, empty: T, formatHeader: RangeOperationCallback | null = null): Promise<void> {
68
+ // if (!isEmpty(source)) {
69
+ // throw new InvalidOperationError("Cannot initialize source with non-empty range.");
70
+ // }
71
+ // const { ax, ay } = addressToCartesian(source.rangeRef.address);
72
+ // const address = cartesianToAddress({
73
+ // ax,
74
+ // bx: (ax + source.head.length - 1) as ColumnOffset,
75
+ // ay,
76
+ // by: ay,
77
+ // });
78
+ // await insertWorkbookCells(source.rangeRef, address, "Right");
79
+ // source.rangeRef = createWorkbookRangeRef(source.rangeRef, address);
80
+ // source.head = Object.keys(empty) as ColumnName[];
81
+ // await updateWorkbookRange(source.rangeRef, {
82
+ // values: [source.head],
83
+ // });
84
+ // if (formatHeader) {
85
+ // await formatHeader(source.rangeRef);
86
+ // }
87
+ // }
88
+ // export async function readAllItems<T extends RecordBase>(source: DataSource<T>): Promise<Item<T>[]> {
89
+ // const result: Item<T>[] = [];
90
+ // for await (const item of source) {
91
+ // result.push(item);
92
+ // }
93
+ // return result;
94
+ // }
95
+ // export async function createItem<T extends RecordBase>(source: DataSource<T>, record: T, after: DataSourceIndex | null = null): Promise<Item<T>> {
96
+ // if (isEmpty(source)) {
97
+ // throw new InvalidOperationError("Source not initialized.");
98
+ // }
99
+ // const { ax, bx, ay, by } = addressToCartesian(source.rangeRef.address);
100
+ // const index = after ?? offsetToIndex(by);
101
+ // const rowNumber = indexToRowNumber(ay, index);
102
+ // const rowOffset = indexToOffset(ay, index);
103
+ // if (rowOffset <= ay || rowOffset > by) {
104
+ // throw new InvalidArgumentError(`'after' is out of range. Range is from ${offsetToIndex(ay)} to ${offsetToIndex(by)}, but 'after' index is ${offsetToIndex(rowOffset)}.`);
105
+ // }
106
+ // source.rangeRef.address = cartesianToAddress({
107
+ // ax,
108
+ // bx,
109
+ // ay,
110
+ // by: (by + 1) as RowOffset,
111
+ // });
112
+ // await insertWorkbookCells(source.rangeRef, rowOffsetToAddress(indexToOffset(ay, index)), "Down");
113
+ // await updateItem<T>(source, index, record);
114
+ // return {
115
+ // index,
116
+ // rowNumber,
117
+ // record,
118
+ // };
119
+ // }
120
+ // function indexToOffset(rowOffset: RowOffset, index: DataSourceIndex): RowOffset {
121
+ // return (rowOffset + index + 1) as RowOffset; // +1 to account for the header row
122
+ // }
123
+ // function indexToRowNumber(rowOffset: RowOffset, index: DataSourceIndex): RowNumber {
124
+ // return (rowOffset + index + 2) as RowNumber; // +1 to account for the header row, +1 to convert to 1-based index
125
+ // }
126
+ // function offsetToIndex(rowOffset: RowOffset): DataSourceIndex {
127
+ // return (rowOffset - 1) as DataSourceIndex; // -1 to convert from 1-based index to 0-based index
128
+ // }
129
+ // export async function updateItem<T extends RecordBase>(source: DataSource<T>, index: DataSourceIndex, record: T): Promise<void> {
130
+ // if (isEmpty(source)) {
131
+ // throw new InvalidOperationError("Source not initialized.");
132
+ // }
133
+ // const row = recordToRow(record, source);
134
+ // const { ax, bx, ay, by } = addressToCartesian(source.rangeRef.address);
135
+ // const rowOffset = indexToOffset(ay, index);
136
+ // if (rowOffset <= ay || rowOffset > by) {
137
+ // throw new InvalidArgumentError(`'after' is out of range. Range is from ${offsetToIndex(ay)} to ${offsetToIndex(by)}, but 'after' index is ${offsetToIndex(rowOffset)}.`);
138
+ // }
139
+ // const rangeRef = createWorkbookRangeRef(
140
+ // source.rangeRef,
141
+ // cartesianToAddress({
142
+ // ax,
143
+ // bx,
144
+ // ay: (ay + index) as RowOffset,
145
+ // by: (ay + index) as RowOffset,
146
+ // }),
147
+ // );
148
+ // await updateWorkbookRange(rangeRef, {
149
+ // values: [row.map((x) => x.value)],
150
+ // text: [row.map((x) => x.text)],
151
+ // numberFormat: [row.map((x) => x.numberFormat)],
152
+ // });
153
+ // }
154
+ // export async function deleteItem<T extends RecordBase>(source: DataSource<T>, index: DataSourceIndex): Promise<void> {
155
+ // if (isEmpty(source)) {
156
+ // throw new InvalidOperationError("Source not initialized.");
157
+ // }
158
+ // const { ax, bx, ay, by } = addressToCartesian(source.rangeRef.address);
159
+ // source.rangeRef.address = cartesianToAddress({
160
+ // ax,
161
+ // bx,
162
+ // ay,
163
+ // by: (by - 1) as RowOffset,
164
+ // });
165
+ // const rangeRef = createWorkbookRangeRef(source.rangeRef, rowOffsetToAddress(indexToOffset(ay, index)));
166
+ // await deleteWorkbookRange(rangeRef, "Up");
167
+ // }
168
+ // function rowToRecord<T extends RecordBase>(row: Cell[], source: DataSource<T>): T {
169
+ // const sourceRow = source.head.reduce((acc, heading, columnIndex) => {
170
+ // const cell = row[columnIndex];
171
+ // if (!cell) {
172
+ // throw new NeverError(`Cell at index ${columnIndex} is undefined`);
173
+ // }
174
+ // acc[heading] = cell;
175
+ // return acc;
176
+ // }, {} as DataSourceRow);
177
+ // const record = source.coding.decode(sourceRow);
178
+ // return record;
179
+ // }
180
+ // function recordToRow<T extends RecordBase>(record: T, source: DataSource<T>): Cell[] {
181
+ // if (!source.coding.encode) {
182
+ // throw new InvalidOperationError("Data source does not have an encoder defined.");
183
+ // }
184
+ // const sourceRow = source.coding.encode(record);
185
+ // const row = source.head.map((heading) => {
186
+ // const cell = sourceRow[heading];
187
+ // if (cell === undefined) {
188
+ // throw new NeverError(`Cell at index ${heading} is undefined`);
189
+ // }
190
+ // return cell;
191
+ // });
192
+ // return row;
193
+ // }
194
+ // function isEmpty<T extends RecordBase>(source: DataSource<T>) {
195
+ // return countAddressRows(source.rangeRef.address) <= 1 && countAddressColumns(source.rangeRef.address) <= 1; // TODO: It is possible that a data source has a single heading with no records
196
+ // }
@@ -1,15 +1,15 @@
1
1
  import type { ColumnName } from "./ColumnName.ts";
2
+ import type { DataSourceDecoder } from "./DataSourceDecoder.ts";
3
+ import type { DataSourceEncoder } from "./DataSourceEncoder.ts";
2
4
  import type { Item } from "./Item.ts";
3
5
  import type { RecordBase } from "./RecordBase.ts";
4
- import type { SourceDecoder } from "./SourceDecoder.ts";
5
- import type { SourceEncoder } from "./SourceEncoder.ts";
6
6
  import type { WorkbookRangeRef } from "./WorkbookRangeRef.ts";
7
- export type Source<T extends RecordBase> = {
7
+ export type DataSource<T extends RecordBase> = {
8
8
  rangeRef: WorkbookRangeRef;
9
9
  head: ColumnName[];
10
10
  coding: {
11
- decode: SourceDecoder<T>;
12
- encode: SourceEncoder<T>;
11
+ decode: DataSourceDecoder<T>;
12
+ encode: DataSourceEncoder<T> | null;
13
13
  };
14
14
  } & AsyncIterable<Item<T>>;
15
- //# sourceMappingURL=Source.d.ts.map
15
+ //# sourceMappingURL=DataSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSource.d.ts","sourceRoot":"","sources":["../../../src/models/DataSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI;IAC9C,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,MAAM,EAAE;QACP,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC;QAC7B,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;KACpC,CAAC;CACF,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { DataSourceRow } from "./DataSourceRow.ts";
2
+ import type { RecordBase } from "./RecordBase.ts";
3
+ export type DataSourceDecoder<T extends RecordBase> = (row: DataSourceRow) => T;
4
+ //# sourceMappingURL=DataSourceDecoder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSourceDecoder.d.ts","sourceRoot":"","sources":["../../../src/models/DataSourceDecoder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,GAAG,EAAE,aAAa,KAAK,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { DataSourceRow } from "./DataSourceRow.ts";
2
+ import type { RecordBase } from "./RecordBase.ts";
3
+ export type DataSourceEncoder<T extends RecordBase> = (record: T) => DataSourceRow;
4
+ //# sourceMappingURL=DataSourceEncoder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSourceEncoder.d.ts","sourceRoot":"","sources":["../../../src/models/DataSourceEncoder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type DataSourceIndex = number & {
2
+ __brand: "Index";
3
+ };
4
+ //# sourceMappingURL=DataSourceIndex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSourceIndex.d.ts","sourceRoot":"","sources":["../../../src/models/DataSourceIndex.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG;IACtC,OAAO,EAAE,OAAO,CAAC;CACjB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Cell } from "./Cell.ts";
2
+ import type { ColumnName } from "./ColumnName.ts";
3
+ export type DataSourceRow = Record<ColumnName, Cell>;
4
+ //# sourceMappingURL=DataSourceRow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSourceRow.d.ts","sourceRoot":"","sources":["../../../src/models/DataSourceRow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,8 @@
1
- import type { RowOffset } from "../models/RowOffset.ts";
1
+ import type { DataSourceIndex } from "./DataSourceIndex.ts";
2
2
  import type { RecordBase } from "./RecordBase.ts";
3
3
  import type { RowNumber } from "./RowNumber.ts";
4
4
  export type Item<T extends RecordBase> = {
5
- rowOffset: RowOffset;
5
+ index: DataSourceIndex;
6
6
  rowNumber: RowNumber;
7
7
  record: T;
8
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../src/models/Item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,UAAU,IAAI;IACxC,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,CAAC,CAAC;CACV,CAAC"}
1
+ {"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../src/models/Item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,UAAU,IAAI;IACxC,KAAK,EAAE,eAAe,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,CAAC,CAAC;CACV,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { WorkbookRangeRef } from "../models/WorkbookRangeRef.ts";
2
+ export type RangeOperationCallback = (rangeRef: WorkbookRangeRef) => Promise<void>;
3
+ //# sourceMappingURL=RangeOperationCallback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RangeOperationCallback.d.ts","sourceRoot":"","sources":["../../../src/models/RangeOperationCallback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,MAAM,sBAAsB,GAAG,CAAC,QAAQ,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  import type { Address, CellAddress, ColumnAddress, RowAddress } from "../models/Address.ts";
2
+ import type { WorkbookRangeRef } from "../models/WorkbookRangeRef.ts";
2
3
  export type AddressComponents = {
3
4
  startColumn: ColumnAddress;
4
5
  endColumn: ColumnAddress;
@@ -128,4 +129,36 @@ export declare function countAddressRows(address: Address): number;
128
129
  * @returns The number of columns in the address.
129
130
  */
130
131
  export declare function countAddressColumns(address: Address): number;
132
+ /**
133
+ * Extracts a subrange from a spreadsheet-style A1 range (e.g., "A1:D10"),
134
+ * allowing skip and take semantics on both rows and columns.
135
+ *
136
+ * Supports negative values for `skipRows` and `skipCols` to count from the end.
137
+ * Supports negative values for `takeRows` and `takeCols` to exclude from the end after skipping.
138
+ *
139
+ * @param address - The original range in A1 notation (e.g., "A1:D10").
140
+ * @param skipRows - Number of rows to skip. If negative, skips that many rows from the end. Default is 0.
141
+ * @param takeRows - Number of rows to take after skipping. If negative, excludes that many rows from the end of the remaining rows. Default is Infinity.
142
+ * @param skipCols - Number of columns to skip. If negative, skips that many columns from the end. Default is 0.
143
+ * @param takeCols - Number of columns to take after skipping. If negative, excludes that many columns from the end of the remaining columns. Default is Infinity.
144
+ * @returns A new A1-style range representing the sliced subrange (e.g., "B2:C5").
145
+ *
146
+ * @example
147
+ * subaddress("A1:D10", -1, 1); // Last row: "A10:D10"
148
+ * subaddress("A1:D10", -2, 1); // Second last row: "A9:D9"
149
+ * subaddress("A1:D10", 0, -1); // All but last row: "A1:D9"
150
+ * subaddress("A1:D10", 0, Infinity, -2, 1); // Second last column: "C1:C10"
151
+ */
152
+ export declare function subaddress(address: Address, skipRows?: number, takeRows?: number, skipCols?: number, takeCols?: number): Address;
153
+ /**
154
+ * Extracts a subrange from a WorkbookRangeRef using skip/take semantics.
155
+ * @param rangeRef Range reference to extract the sub-range from.
156
+ * @param skipRows Number of rows to skip. If negative, skips from the end. Default 0.
157
+ * @param takeRows Number of rows to take after skipping. If negative, excludes from the end. Default Infinity.
158
+ * @param skipCols Number of columns to skip. If negative, skips from the end. Default 0.
159
+ * @param takeCols Number of columns to take after skipping. If negative, excludes from the end. Default Infinity.
160
+ * @returns Extracted sub-range reference.
161
+ * @throws InvalidArgumentError if the requested rows or columns exceed the available range.
162
+ */
163
+ export declare function subrange(rangeRef: WorkbookRangeRef, skipRows?: number, takeRows?: number, skipCols?: number, takeCols?: number): WorkbookRangeRef;
131
164
  //# sourceMappingURL=addressManipulation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"addressManipulation.d.ts","sourceRoot":"","sources":["../../../src/services/addressManipulation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAoB,aAAa,EAAsB,UAAU,EAAmB,MAAM,sBAAsB,CAAC;AAmBnJ,MAAM,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,aAAa,CAAC;IAC3B,SAAS,EAAE,aAAa,CAAC;IACzB,QAAQ,EAAE,UAAU,CAAC;I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