@nfdi4plants/arctrl 3.0.0-alpha.3 → 3.0.0-beta.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 (90) hide show
  1. package/README.md +17 -9
  2. package/dist/ts/cjs/ts/ARC.js +25 -17
  3. package/dist/ts/cjs/ts/Conversion.js +133 -86
  4. package/dist/ts/cjs/ts/Core/ArcTypes.js +1 -1
  5. package/dist/ts/cjs/ts/Core/Conversion.js +110 -43
  6. package/dist/ts/cjs/ts/Core/Helper/Collections.js +84 -1
  7. package/dist/ts/cjs/ts/Core/OntologyAnnotation.js +27 -23
  8. package/dist/ts/cjs/ts/Core/Table/ArcTable.js +234 -217
  9. package/dist/ts/cjs/ts/Core/Table/ArcTableAux.js +915 -235
  10. package/dist/ts/cjs/ts/Core/Table/ArcTables.js +12 -19
  11. package/dist/ts/cjs/ts/Core/Table/CompositeColumn.js +4 -2
  12. package/dist/ts/cjs/ts/FileSystem/DefaultGitattributes.js +1 -1
  13. package/dist/ts/cjs/ts/Json/Decode.js +105 -0
  14. package/dist/ts/cjs/ts/Json/Encode.js +42 -0
  15. package/dist/ts/cjs/ts/Json/StringTable.js +9 -2
  16. package/dist/ts/cjs/ts/Json/Table/ArcTable.js +100 -113
  17. package/dist/ts/cjs/ts/Json/Table/CellTable.js +2 -2
  18. package/dist/ts/cjs/ts/Json/Table/OATable.js +2 -2
  19. package/dist/ts/cjs/ts/JsonIO/Table/Compression.js +4 -11
  20. package/dist/ts/cjs/ts/ROCrate/Generic/LabProcess.js +1 -1
  21. package/dist/ts/cjs/ts/ROCrate/LDContext.js +92 -54
  22. package/dist/ts/cjs/ts/Spreadsheet/AnnotationTable/ArcTable.js +15 -4
  23. package/dist/ts/cjs/ts/Spreadsheet/AnnotationTable/CompositeColumn.js +77 -6
  24. package/dist/ts/cjs/ts/Spreadsheet/ArcInvestigation.js +31 -15
  25. package/dist/ts/cjs/ts/Spreadsheet/DataMapTable/DataMapHeader.js +1 -1
  26. package/dist/ts/cjs/ts/Spreadsheet/Metadata/SparseTable.js +2 -5
  27. package/dist/ts/esm/ts/ARC.js +28 -20
  28. package/dist/ts/esm/ts/Conversion.js +137 -90
  29. package/dist/ts/esm/ts/Core/ArcTypes.js +1 -1
  30. package/dist/ts/esm/ts/Core/Conversion.js +112 -45
  31. package/dist/ts/esm/ts/Core/Helper/Collections.js +73 -1
  32. package/dist/ts/esm/ts/Core/OntologyAnnotation.js +29 -25
  33. package/dist/ts/esm/ts/Core/Table/ArcTable.js +243 -226
  34. package/dist/ts/esm/ts/Core/Table/ArcTableAux.js +907 -246
  35. package/dist/ts/esm/ts/Core/Table/ArcTables.js +15 -22
  36. package/dist/ts/esm/ts/Core/Table/CompositeColumn.js +5 -3
  37. package/dist/ts/esm/ts/FileSystem/DefaultGitattributes.js +1 -1
  38. package/dist/ts/esm/ts/Json/Decode.js +105 -3
  39. package/dist/ts/esm/ts/Json/Encode.js +42 -2
  40. package/dist/ts/esm/ts/Json/StringTable.js +10 -3
  41. package/dist/ts/esm/ts/Json/Table/ArcTable.js +108 -121
  42. package/dist/ts/esm/ts/Json/Table/CellTable.js +2 -2
  43. package/dist/ts/esm/ts/Json/Table/OATable.js +2 -2
  44. package/dist/ts/esm/ts/JsonIO/Table/Compression.js +4 -11
  45. package/dist/ts/esm/ts/ROCrate/Generic/LabProcess.js +1 -1
  46. package/dist/ts/esm/ts/ROCrate/LDContext.js +106 -66
  47. package/dist/ts/esm/ts/Spreadsheet/AnnotationTable/ArcTable.js +17 -7
  48. package/dist/ts/esm/ts/Spreadsheet/AnnotationTable/CompositeColumn.js +78 -9
  49. package/dist/ts/esm/ts/Spreadsheet/ArcInvestigation.js +33 -17
  50. package/dist/ts/esm/ts/Spreadsheet/DataMapTable/DataMapHeader.js +1 -1
  51. package/dist/ts/esm/ts/Spreadsheet/Metadata/SparseTable.js +3 -6
  52. package/dist/ts/types/ts/ARC.d.ts +2 -2
  53. package/dist/ts/types/ts/ARC.d.ts.map +1 -1
  54. package/dist/ts/types/ts/Conversion.d.ts +17 -18
  55. package/dist/ts/types/ts/Conversion.d.ts.map +1 -1
  56. package/dist/ts/types/ts/Core/ArcTypes.d.ts +2 -0
  57. package/dist/ts/types/ts/Core/ArcTypes.d.ts.map +1 -1
  58. package/dist/ts/types/ts/Core/Conversion.d.ts +14 -15
  59. package/dist/ts/types/ts/Core/Conversion.d.ts.map +1 -1
  60. package/dist/ts/types/ts/Core/Helper/Collections.d.ts +11 -0
  61. package/dist/ts/types/ts/Core/Helper/Collections.d.ts.map +1 -1
  62. package/dist/ts/types/ts/Core/OntologyAnnotation.d.ts +9 -0
  63. package/dist/ts/types/ts/Core/OntologyAnnotation.d.ts.map +1 -1
  64. package/dist/ts/types/ts/Core/Table/ArcTable.d.ts +35 -28
  65. package/dist/ts/types/ts/Core/Table/ArcTable.d.ts.map +1 -1
  66. package/dist/ts/types/ts/Core/Table/ArcTableAux.d.ts +84 -33
  67. package/dist/ts/types/ts/Core/Table/ArcTableAux.d.ts.map +1 -1
  68. package/dist/ts/types/ts/Core/Table/ArcTables.d.ts.map +1 -1
  69. package/dist/ts/types/ts/Core/Table/CompositeColumn.d.ts.map +1 -1
  70. package/dist/ts/types/ts/FileSystem/DefaultGitattributes.d.ts +1 -1
  71. package/dist/ts/types/ts/FileSystem/DefaultGitattributes.d.ts.map +1 -1
  72. package/dist/ts/types/ts/Json/Decode.d.ts +6 -0
  73. package/dist/ts/types/ts/Json/Decode.d.ts.map +1 -1
  74. package/dist/ts/types/ts/Json/Encode.d.ts +2 -0
  75. package/dist/ts/types/ts/Json/Encode.d.ts.map +1 -1
  76. package/dist/ts/types/ts/Json/StringTable.d.ts.map +1 -1
  77. package/dist/ts/types/ts/Json/Table/ArcTable.d.ts +4 -3
  78. package/dist/ts/types/ts/Json/Table/ArcTable.d.ts.map +1 -1
  79. package/dist/ts/types/ts/Json/Table/CellTable.d.ts.map +1 -1
  80. package/dist/ts/types/ts/Json/Table/OATable.d.ts.map +1 -1
  81. package/dist/ts/types/ts/JsonIO/Table/Compression.d.ts.map +1 -1
  82. package/dist/ts/types/ts/ROCrate/LDContext.d.ts +3 -5
  83. package/dist/ts/types/ts/ROCrate/LDContext.d.ts.map +1 -1
  84. package/dist/ts/types/ts/Spreadsheet/AnnotationTable/ArcTable.d.ts +5 -0
  85. package/dist/ts/types/ts/Spreadsheet/AnnotationTable/ArcTable.d.ts.map +1 -1
  86. package/dist/ts/types/ts/Spreadsheet/AnnotationTable/CompositeColumn.d.ts +7 -0
  87. package/dist/ts/types/ts/Spreadsheet/AnnotationTable/CompositeColumn.d.ts.map +1 -1
  88. package/dist/ts/types/ts/Spreadsheet/ArcInvestigation.d.ts.map +1 -1
  89. package/dist/ts/types/ts/Spreadsheet/Metadata/SparseTable.d.ts.map +1 -1
  90. package/package.json +1 -1
@@ -1,42 +1,443 @@
1
- import { op_UnaryNegation_Int32 } from "@fable-org/fable-library-js/Int32.js";
2
- import { toList, head as head_1, toArray, filter, tryFindIndex, maxBy } from "@fable-org/fable-library-js/Seq.js";
3
- import { arrayHash, equalArrays, numberHash, disposeSafe, getEnumerator, compare, equals, safeHash, comparePrimitives } from "@fable-org/fable-library-js/Util.js";
4
1
  import { CompositeCell } from "./CompositeCell.js";
5
- import { addToDict, getItemFromDict } from "@fable-org/fable-library-js/MapUtil.js";
6
- import { value as value_2 } from "@fable-org/fable-library-js/Option.js";
7
- import { mapIndexed, pick, exists, ofSeq, empty, head, tail as tail_1, isEmpty, cons } from "@fable-org/fable-library-js/List.js";
8
- import { printf, toConsole } from "@fable-org/fable-library-js/String.js";
9
- import { List_tryPickAndRemove, Dictionary_tryFind } from "../Helper/Collections.js";
10
- import { max } from "@fable-org/fable-library-js/Double.js";
11
- import { setItem, item, map, iterateIndexed } from "@fable-org/fable-library-js/Array.js";
12
- import { tryFind, ofArray } from "@fable-org/fable-library-js/Map.js";
13
- import { Array_groupBy } from "@fable-org/fable-library-js/Seq2.js";
14
- import { FSharpSet__Contains, ofArray as ofArray_1 } from "@fable-org/fable-library-js/Set.js";
15
- import { toString } from "@fable-org/fable-library-js/Types.js";
2
+ import { op_UnaryNegation_Int32 } from "@fable-org/fable-library-js/Int32.js";
3
+ import { bind, value as value_3 } from "@fable-org/fable-library-js/Option.js";
4
+ import { compare, equals, toIterator, defaultOf, disposeSafe, getEnumerator, comparePrimitives, safeHash } from "@fable-org/fable-library-js/Util.js";
5
+ import { tryGetValue, getItemFromDict, addToDict } from "@fable-org/fable-library-js/MapUtil.js";
6
+ import { toString, FSharpRef, Union } from "@fable-org/fable-library-js/Types.js";
7
+ import { union_type, class_type, int32_type } from "@fable-org/fable-library-js/Reflection.js";
8
+ import { filter, tryFindIndex, map, empty, singleton, collect, delay, toList, isEmpty, max, iterateIndexed, item, length, iterate, maxBy } from "@fable-org/fable-library-js/Seq.js";
9
+ import { List_tryPickAndRemove, ResizeArray_iteri, ResizeArray_map, ResizeArray_create, ResizeArray_init } from "../Helper/Collections.js";
10
+ import { toConsole, printf, toFail } from "@fable-org/fable-library-js/String.js";
16
11
  import { rangeDouble } from "@fable-org/fable-library-js/Range.js";
17
- import { Dictionary } from "@fable-org/fable-library-js/MutableMap.js";
18
- export function getColumnCount(headers) {
19
- return headers.length;
12
+ import { mapIndexed, pick, exists, length as length_1, ofSeq, empty as empty_1, head, tail as tail_1, isEmpty as isEmpty_1, cons } from "@fable-org/fable-library-js/List.js";
13
+ import { max as max_1 } from "@fable-org/fable-library-js/Double.js";
14
+ import { setItem } from "@fable-org/fable-library-js/Array.js";
15
+ /**
16
+ * Get an empty cell fitting for related column header.
17
+ *
18
+ * `columCellOption` is used to decide between `CompositeCell.Term` or `CompositeCell.Unitized`. `columCellOption` can be any other cell in the same column, preferably the first one.
19
+ */
20
+ export function getEmptyCellForHeader(header, columCellOption) {
21
+ const matchValue = header.IsTermColumn;
22
+ if (matchValue) {
23
+ let matchResult;
24
+ if (columCellOption == null) {
25
+ matchResult = 0;
26
+ }
27
+ else {
28
+ switch (value_3(columCellOption).tag) {
29
+ case /* Term */ 0: {
30
+ matchResult = 0;
31
+ break;
32
+ }
33
+ case /* Unitized */ 2: {
34
+ matchResult = 1;
35
+ break;
36
+ }
37
+ default:
38
+ matchResult = 2;
39
+ }
40
+ }
41
+ switch (matchResult) {
42
+ case 0:
43
+ return CompositeCell.emptyTerm;
44
+ case 1:
45
+ return CompositeCell.emptyUnitized;
46
+ default:
47
+ throw new Error("[extendBodyCells] This should never happen, IsTermColumn header must be paired with either term or unitized cell.");
48
+ }
49
+ }
50
+ else {
51
+ return CompositeCell.emptyFreeText;
52
+ }
20
53
  }
21
- export function getRowCount(values) {
22
- if (values.size === 0) {
23
- return 0;
54
+ export function ensureCellHashInValueMap(value, valueMap) {
55
+ const hash = safeHash(value) | 0;
56
+ if (valueMap.has(hash)) {
57
+ return hash | 0;
24
58
  }
25
59
  else {
26
- return (1 + maxBy((tuple) => tuple[1], values.keys(), {
60
+ addToDict(valueMap, hash, value);
61
+ return hash | 0;
62
+ }
63
+ }
64
+ export function ColumnValueRefs_Constant(Item) {
65
+ return new ColumnValueRefs(0, [Item]);
66
+ }
67
+ export function ColumnValueRefs_Sparse(Item) {
68
+ return new ColumnValueRefs(1, [Item]);
69
+ }
70
+ export class ColumnValueRefs extends Union {
71
+ constructor(tag, fields) {
72
+ super();
73
+ this.tag = tag;
74
+ this.fields = fields;
75
+ }
76
+ cases() {
77
+ return ["Constant", "Sparse"];
78
+ }
79
+ }
80
+ export function ColumnValueRefs_$reflection() {
81
+ return union_type("ARCtrl.ArcTableAux.ColumnValueRefs", [], ColumnValueRefs, () => [[["Item", int32_type]], [["Item", class_type("System.Collections.Generic.Dictionary`2", [int32_type, int32_type])]]]);
82
+ }
83
+ export function ColumnValueRefs__get_RowCount(this$) {
84
+ if (this$.tag === /* Sparse */ 1) {
85
+ return maxBy((kv) => kv[0], this$.fields[0], {
27
86
  Compare: comparePrimitives,
28
- })[1]) | 0;
87
+ });
88
+ }
89
+ else {
90
+ return undefined;
91
+ }
92
+ }
93
+ export function ColumnValueRefs__Copy(this$) {
94
+ if (this$.tag === /* Sparse */ 1) {
95
+ const values = this$.fields[0];
96
+ const d = new Map([]);
97
+ iterate((v) => {
98
+ addToDict(d, v[0], v[1]);
99
+ }, values);
100
+ return ColumnValueRefs_Sparse(d);
101
+ }
102
+ else {
103
+ return ColumnValueRefs_Constant(this$.fields[0]);
104
+ }
105
+ }
106
+ export function ColumnValueRefs__ToSparse_Z524259A4(this$, rowCount) {
107
+ if (this$.tag === /* Sparse */ 1) {
108
+ return ColumnValueRefs_Sparse(this$.fields[0]);
109
+ }
110
+ else {
111
+ const valueHash = this$.fields[0] | 0;
112
+ const d = new Map([]);
113
+ for (let i = 0; i <= (rowCount - 1); i++) {
114
+ addToDict(d, i, valueHash);
115
+ }
116
+ return ColumnValueRefs_Sparse(d);
117
+ }
118
+ }
119
+ export function ColumnValueRefs__AsSparse(this$) {
120
+ if (this$.tag === /* Sparse */ 1) {
121
+ return this$.fields[0];
122
+ }
123
+ else {
124
+ const valueHash = this$.fields[0] | 0;
125
+ throw new Error("Cannot convert a constant column to sparse. Use ToSparse first.");
126
+ }
127
+ }
128
+ export function ColumnValueRefs__AsConstant(this$) {
129
+ if (this$.tag === /* Sparse */ 1) {
130
+ throw new Error("Cannot convert a sparse column to constant. Use ToSparse first.");
131
+ }
132
+ else {
133
+ return this$.fields[0] | 0;
29
134
  }
30
135
  }
31
- export function boxHashValues(colCount, values) {
32
- let hash = 0;
33
- const rowCount = getRowCount(values) | 0;
34
- for (let col = 0; col <= (colCount - 1); col++) {
35
- for (let row = 0; row <= (rowCount - 1); row++) {
36
- hash = ((((-1640531527 + safeHash(getItemFromDict(values, [col, row]))) + (hash << 6)) + (hash >> 2)) | 0);
136
+ export function ColumnValueRefs_fromCellColumn_14896151(column, previousRowCount, valueMap) {
137
+ const l = length(column) | 0;
138
+ const cells = new Map([]);
139
+ if (l === 0) {
140
+ return ColumnValueRefs_Sparse(cells);
141
+ }
142
+ else {
143
+ let current;
144
+ const hash = ensureCellHashInValueMap(item(0, column), valueMap) | 0;
145
+ if (l >= previousRowCount) {
146
+ current = ColumnValueRefs_Constant(hash);
37
147
  }
148
+ else {
149
+ addToDict(cells, 0, hash);
150
+ current = ColumnValueRefs_Sparse(cells);
151
+ }
152
+ iterateIndexed((i, cell) => {
153
+ const hash_1 = ensureCellHashInValueMap(cell, valueMap) | 0;
154
+ if (current.tag === /* Sparse */ 1) {
155
+ const cells_2 = current.fields[0];
156
+ cells_2.set(i, hash_1);
157
+ }
158
+ else if (current.fields[0] === hash_1) {
159
+ const cellHash_1 = current.fields[0] | 0;
160
+ }
161
+ else {
162
+ const cellHash_2 = current.fields[0] | 0;
163
+ const cells_1 = new Map([]);
164
+ for (let j = 0; j <= (i - 1); j++) {
165
+ cells_1.set(j, cellHash_2);
166
+ }
167
+ cells_1.set(i, hash_1);
168
+ current = ColumnValueRefs_Sparse(cells_1);
169
+ }
170
+ }, column);
171
+ return current;
172
+ }
173
+ }
174
+ export function ColumnValueRefs__ToCellColumn_Z2609C9DD(this$, valueMap, rowCount, header) {
175
+ if (this$.tag === /* Sparse */ 1) {
176
+ const values = this$.fields[0];
177
+ const defaultCell = (values.size === 0) ? getEmptyCellForHeader(header, undefined) : getEmptyCellForHeader(header, getItemFromDict(valueMap, getItemFromDict(values, max(values.keys(), {
178
+ Compare: comparePrimitives,
179
+ }) - 1)));
180
+ return ResizeArray_init(rowCount, (i_1) => (values.has(i_1) ? getItemFromDict(valueMap, getItemFromDict(values, i_1)) : defaultCell));
181
+ }
182
+ else {
183
+ return ResizeArray_create(rowCount, getItemFromDict(valueMap, this$.fields[0]));
38
184
  }
39
- return hash;
185
+ }
186
+ export class ArcTableValues {
187
+ constructor(cols, valueMap, rowCount) {
188
+ this._columns = cols;
189
+ this._valueMap = valueMap;
190
+ this._rowCount = (rowCount | 0);
191
+ }
192
+ get Columns() {
193
+ const this$ = this;
194
+ return this$._columns;
195
+ }
196
+ set Columns(columns) {
197
+ const this$ = this;
198
+ this$._columns = columns;
199
+ }
200
+ get ColumnCount() {
201
+ const this$ = this;
202
+ return (isEmpty(this$._columns) ? 0 : (1 + max(this$._columns.keys(), {
203
+ Compare: comparePrimitives,
204
+ }))) | 0;
205
+ }
206
+ get ValueMap() {
207
+ const this$ = this;
208
+ return this$._valueMap;
209
+ }
210
+ set ValueMap(valueMap) {
211
+ const this$ = this;
212
+ this$._valueMap = valueMap;
213
+ }
214
+ get RowCount() {
215
+ const this$ = this;
216
+ return this$._rowCount | 0;
217
+ }
218
+ set RowCount(rowCount) {
219
+ const this$ = this;
220
+ if ((rowCount > 0) && (rowCount < this$._rowCount)) {
221
+ let enumerator = getEnumerator(this$._columns);
222
+ try {
223
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
224
+ const matchValue = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]()[1];
225
+ if (matchValue.tag === /* Sparse */ 1) {
226
+ const values = matchValue.fields[0];
227
+ const enumerator_1 = getEnumerator(toList(values.keys()));
228
+ try {
229
+ while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
230
+ const key = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]() | 0;
231
+ if (key >= rowCount) {
232
+ values.delete(key);
233
+ }
234
+ }
235
+ }
236
+ finally {
237
+ disposeSafe(enumerator_1);
238
+ }
239
+ }
240
+ }
241
+ }
242
+ finally {
243
+ disposeSafe(enumerator);
244
+ }
245
+ }
246
+ this$._rowCount = (rowCount | 0);
247
+ }
248
+ static fromCellColumns(columns) {
249
+ const rowCount = ((columns.length === 0) ? 0 : max(ResizeArray_map((c) => c.length, columns), {
250
+ Compare: comparePrimitives,
251
+ })) | 0;
252
+ const valueMap = new Map([]);
253
+ const parsedColumns = new Map([]);
254
+ iterateIndexed((i, column) => {
255
+ addToDict(parsedColumns, i, ColumnValueRefs_fromCellColumn_14896151(column, rowCount, valueMap));
256
+ }, columns);
257
+ return new ArcTableValues(parsedColumns, valueMap, rowCount);
258
+ }
259
+ static fromRefColumns(columns, valueMap, rowCount) {
260
+ const parsedColumns = new Map([]);
261
+ iterateIndexed((i, column) => {
262
+ addToDict(parsedColumns, i, column);
263
+ }, columns);
264
+ return new ArcTableValues(parsedColumns, valueMap, rowCount);
265
+ }
266
+ static init() {
267
+ const valueMap = new Map([]);
268
+ return new ArcTableValues(new Map([]), valueMap, 0);
269
+ }
270
+ ToCellColumns(headers) {
271
+ const this$ = this;
272
+ return ResizeArray_init(headers.length, (i) => {
273
+ const header = headers[i];
274
+ return ColumnValueRefs__ToCellColumn_Z2609C9DD(getItemFromDict(this$._columns, i), this$._valueMap, this$._rowCount, header);
275
+ });
276
+ }
277
+ RescanValueMap() {
278
+ const this$ = this;
279
+ const newValueMap = new Map([]);
280
+ let enumerator = getEnumerator(this$._columns);
281
+ try {
282
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
283
+ const kv = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
284
+ const matchValue = kv[1];
285
+ if (matchValue.tag === /* Sparse */ 1) {
286
+ const values = matchValue.fields[0];
287
+ let enumerator_1 = getEnumerator(values);
288
+ try {
289
+ while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
290
+ const ckv = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]();
291
+ const hash_1 = ensureCellHashInValueMap(getItemFromDict(this$._valueMap, ckv[1]), newValueMap) | 0;
292
+ values.set(ckv[0], hash_1);
293
+ }
294
+ }
295
+ finally {
296
+ disposeSafe(enumerator_1);
297
+ }
298
+ }
299
+ else {
300
+ const valueHash = matchValue.fields[0] | 0;
301
+ const hash = ensureCellHashInValueMap(getItemFromDict(this$._valueMap, valueHash), newValueMap) | 0;
302
+ this$._columns.set(kv[0], ColumnValueRefs_Constant(hash));
303
+ }
304
+ }
305
+ }
306
+ finally {
307
+ disposeSafe(enumerator);
308
+ }
309
+ this$._valueMap = newValueMap;
310
+ }
311
+ Copy() {
312
+ const this$ = this;
313
+ const nextValueMap = new Map([]);
314
+ iterate((kv) => {
315
+ addToDict(nextValueMap, kv[0], kv[1].Copy());
316
+ }, this$._valueMap);
317
+ const nextColumns = new Map([]);
318
+ iterate((kv_1) => {
319
+ addToDict(nextColumns, kv_1[0], ColumnValueRefs__Copy(kv_1[1]));
320
+ }, this$._columns);
321
+ return new ArcTableValues(nextColumns, nextValueMap, this$._rowCount);
322
+ }
323
+ GetHashCode() {
324
+ const this$ = this;
325
+ let hash = 0;
326
+ for (let i = 0; i <= (this$.ColumnCount - 1); i++) {
327
+ let matchValue;
328
+ const dict = this$._columns;
329
+ let patternInput;
330
+ let outArg = defaultOf();
331
+ patternInput = [tryGetValue(dict, i, new FSharpRef(() => outArg, (v) => {
332
+ outArg = v;
333
+ })), outArg];
334
+ matchValue = (patternInput[0] ? patternInput[1] : undefined);
335
+ if (matchValue != null) {
336
+ if (value_3(matchValue).tag === /* Sparse */ 1) {
337
+ const values = value_3(matchValue).fields[0];
338
+ let enumerator = getEnumerator(values);
339
+ try {
340
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
341
+ const kv = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
342
+ hash = ((((-1640531527 + kv[0]) + (hash << 6)) + (hash >> 2)) | 0);
343
+ hash = ((((-1640531527 + kv[1]) + (hash << 6)) + (hash >> 2)) | 0);
344
+ }
345
+ }
346
+ finally {
347
+ disposeSafe(enumerator);
348
+ }
349
+ }
350
+ else {
351
+ const valueHash = value_3(matchValue).fields[0] | 0;
352
+ for (let i_1 = 0; i_1 <= (this$._rowCount - 1); i_1++) {
353
+ hash = ((((-1640531527 + i_1) + (hash << 6)) + (hash >> 2)) | 0);
354
+ hash = ((((-1640531527 + valueHash) + (hash << 6)) + (hash >> 2)) | 0);
355
+ }
356
+ }
357
+ }
358
+ }
359
+ return hash | 0;
360
+ }
361
+ Equals(other) {
362
+ let other_1;
363
+ const this$ = this;
364
+ return (other instanceof ArcTableValues) && ((other_1 = other, safeHash(this$) === safeHash(other_1)));
365
+ }
366
+ Item(crIndices) {
367
+ const this$ = this;
368
+ const row = crIndices[1] | 0;
369
+ const col = crIndices[0] | 0;
370
+ if (row > (this$.RowCount - 1)) {
371
+ const arg_1 = this$.RowCount | 0;
372
+ toFail(printf("Row index %d is out of bounds for ArcTableValues with row count %d."))(row)(arg_1);
373
+ }
374
+ if (col > (this$.ColumnCount - 1)) {
375
+ const arg_3 = this$.ColumnCount | 0;
376
+ toFail(printf("Column index %d is out of bounds for ArcTableValues with column count %d."))(col)(arg_3);
377
+ }
378
+ let matchValue;
379
+ const dict = this$._columns;
380
+ let patternInput;
381
+ let outArg = defaultOf();
382
+ patternInput = [tryGetValue(dict, col, new FSharpRef(() => outArg, (v) => {
383
+ outArg = v;
384
+ })), outArg];
385
+ matchValue = (patternInput[0] ? patternInput[1] : undefined);
386
+ if (matchValue != null) {
387
+ const colValueRefs = value_3(matchValue);
388
+ if (colValueRefs.tag === /* Sparse */ 1) {
389
+ const values = colValueRefs.fields[0];
390
+ return values.has(row) ? getItemFromDict(this$._valueMap, getItemFromDict(values, row)) : toFail(printf("Row value for index %d does not exist in column %d of ArcTableValues."))(row)(col);
391
+ }
392
+ else {
393
+ const valueHash = colValueRefs.fields[0] | 0;
394
+ return getItemFromDict(this$._valueMap, valueHash);
395
+ }
396
+ }
397
+ else {
398
+ return toFail(printf("Column %d does not exist in ArcTableValues."))(col);
399
+ }
400
+ }
401
+ GetEnumerator() {
402
+ const this$ = this;
403
+ return getEnumerator(delay(() => collect((colI) => {
404
+ let matchValue;
405
+ const dict = this$._columns;
406
+ let patternInput;
407
+ let outArg = defaultOf();
408
+ patternInput = [tryGetValue(dict, colI, new FSharpRef(() => outArg, (v) => {
409
+ outArg = v;
410
+ })), outArg];
411
+ matchValue = (patternInput[0] ? patternInput[1] : undefined);
412
+ if (matchValue != null) {
413
+ const matchValue_1 = value_3(matchValue);
414
+ if (matchValue_1.tag === /* Sparse */ 1) {
415
+ const values = matchValue_1.fields[0];
416
+ return collect((rowI_1) => (values.has(rowI_1) ? singleton([[colI, rowI_1], getItemFromDict(this$._valueMap, getItemFromDict(values, rowI_1))]) : empty()), rangeDouble(0, 1, this$._rowCount - 1));
417
+ }
418
+ else {
419
+ const valueHash = matchValue_1.fields[0] | 0;
420
+ return map((rowI) => [[colI, rowI], getItemFromDict(this$._valueMap, valueHash)], rangeDouble(0, 1, this$._rowCount - 1));
421
+ }
422
+ }
423
+ else {
424
+ return empty();
425
+ }
426
+ }, rangeDouble(0, 1, this$.ColumnCount - 1))));
427
+ }
428
+ [Symbol.iterator]() {
429
+ return toIterator(getEnumerator(this));
430
+ }
431
+ "System.Collections.IEnumerable.GetEnumerator"() {
432
+ const this$ = this;
433
+ return getEnumerator(this$);
434
+ }
435
+ }
436
+ export function ArcTableValues_$reflection() {
437
+ return class_type("ARCtrl.ArcTableAux.ArcTableValues", undefined, ArcTableValues);
438
+ }
439
+ export function ArcTableValues_$ctor_39436F7C(cols, valueMap, rowCount) {
440
+ return new ArcTableValues(cols, valueMap, rowCount);
40
441
  }
41
442
  export function $007CIsUniqueExistingHeader$007C_$007C(existingHeaders, input) {
42
443
  switch (input.tag) {
@@ -60,7 +461,7 @@ export function $007CIsUniqueExistingHeader$007C_$007C(existingHeaders, input) {
60
461
  export function tryFindDuplicateUnique(newHeader, existingHeaders) {
61
462
  const activePatternResult = $007CIsUniqueExistingHeader$007C_$007C(existingHeaders, newHeader);
62
463
  if (activePatternResult != null) {
63
- const index = value_2(activePatternResult) | 0;
464
+ const index = value_3(activePatternResult) | 0;
64
465
  return index;
65
466
  }
66
467
  else {
@@ -75,10 +476,10 @@ export function tryFindDuplicateUniqueInArray(existingHeaders) {
75
476
  loop: while (true) {
76
477
  const i = i_mut, duplicateList = duplicateList_mut, headerList = headerList_mut;
77
478
  let matchResult, header, tail;
78
- if (isEmpty(headerList)) {
479
+ if (isEmpty_1(headerList)) {
79
480
  matchResult = 0;
80
481
  }
81
- else if (isEmpty(tail_1(headerList))) {
482
+ else if (isEmpty_1(tail_1(headerList))) {
82
483
  matchResult = 0;
83
484
  }
84
485
  else {
@@ -95,7 +496,7 @@ export function tryFindDuplicateUniqueInArray(existingHeaders) {
95
496
  duplicateList_mut = ((hasDuplicate != null) ? cons({
96
497
  HeaderType: header,
97
498
  Index1: i,
98
- Index2: value_2(hasDuplicate),
499
+ Index2: value_3(hasDuplicate),
99
500
  }, duplicateList) : duplicateList);
100
501
  headerList_mut = tail;
101
502
  continue loop;
@@ -104,7 +505,7 @@ export function tryFindDuplicateUniqueInArray(existingHeaders) {
104
505
  break;
105
506
  }
106
507
  };
107
- return loop(0, empty(), ofSeq(filter((x) => !x.IsTermColumn, existingHeaders)));
508
+ return loop(0, empty_1(), ofSeq(filter((x) => !x.IsTermColumn, existingHeaders)));
108
509
  }
109
510
  /**
110
511
  * Checks if given column index is valid for given number of columns.
@@ -141,63 +542,261 @@ export function SanityChecks_validateRowIndex(index, rowCount, allowAppend) {
141
542
  export function SanityChecks_validateColumn(column) {
142
543
  column.Validate(true);
143
544
  }
144
- export function SanityChecks_validate(headers, values, raiseException) {
145
- let clo, clo_1;
545
+ export function SanityChecks_validateCellColumns(headers, columns, raiseException) {
546
+ let clo, clo_1, clo_2;
146
547
  let isValid = true;
147
- let en = getEnumerator(values);
148
- while (isValid && en["System.Collections.IEnumerator.MoveNext"]()) {
149
- let matchValue;
150
- let copyOfStruct = en["System.Collections.Generic.IEnumerator`1.get_Current"]();
151
- matchValue = copyOfStruct[0];
152
- let cell;
153
- let copyOfStruct_1 = en["System.Collections.Generic.IEnumerator`1.get_Current"]();
154
- cell = copyOfStruct_1[1];
155
- const header = headers[matchValue[0]];
156
- const headerIsData = header.IsDataColumn;
157
- const headerIsFreetext = !header.IsTermColumn && !header.IsDataColumn;
158
- const cellIsNotFreetext = !cell.isFreeText;
159
- if (headerIsData && (!cell.isData && cellIsNotFreetext)) {
160
- (raiseException ? ((message) => {
161
- throw new Error(message);
162
- }) : ((clo = toConsole(printf("%s")), (arg) => {
163
- clo(arg);
164
- })))(`Invalid combination of header \`${header}\` and cell \`${cell}\`. Data header should contain either Data or Freetext cells.`);
165
- isValid = false;
166
- }
167
- if (headerIsFreetext && cellIsNotFreetext) {
168
- (raiseException ? ((message_1) => {
169
- throw new Error(message_1);
170
- }) : ((clo_1 = toConsole(printf("%s")), (arg_1) => {
171
- clo_1(arg_1);
172
- })))(`Invalid combination of header \`${header}\` and cell \`${cell}\`. Freetext header should not contain non-freetext cells.`);
173
- isValid = false;
548
+ let en = getEnumerator(headers);
549
+ let colIndex = 0;
550
+ if ((headers.length !== columns.length) && (columns.length !== 0)) {
551
+ (raiseException ? ((message) => {
552
+ throw new Error(message);
553
+ }) : ((clo = toConsole(printf("%s")), (arg) => {
554
+ clo(arg);
555
+ })))(`Invalid table. Number of headers (${headers.length}) does not match number of columns (${columns.length}).`);
556
+ isValid = false;
557
+ }
558
+ while ((isValid && en["System.Collections.IEnumerator.MoveNext"]()) && (columns.length !== 0)) {
559
+ const header = en["System.Collections.Generic.IEnumerator`1.get_Current"]();
560
+ let colEn = getEnumerator(columns[colIndex]);
561
+ colIndex = ((colIndex + 1) | 0);
562
+ while (isValid && colEn["System.Collections.IEnumerator.MoveNext"]()) {
563
+ const cell = colEn["System.Collections.Generic.IEnumerator`1.get_Current"]();
564
+ const headerIsData = header.IsDataColumn;
565
+ const headerIsFreetext = !header.IsTermColumn && !header.IsDataColumn;
566
+ const cellIsNotFreetext = !cell.isFreeText;
567
+ if (headerIsData && (!cell.isData && cellIsNotFreetext)) {
568
+ (raiseException ? ((message_1) => {
569
+ throw new Error(message_1);
570
+ }) : ((clo_1 = toConsole(printf("%s")), (arg_1) => {
571
+ clo_1(arg_1);
572
+ })))(`Invalid combination of header \`${header}\` and cell \`${cell}\`. Data header should contain either Data or Freetext cells.`);
573
+ isValid = false;
574
+ }
575
+ if (headerIsFreetext && cellIsNotFreetext) {
576
+ (raiseException ? ((message_2) => {
577
+ throw new Error(message_2);
578
+ }) : ((clo_2 = toConsole(printf("%s")), (arg_2) => {
579
+ clo_2(arg_2);
580
+ })))(`Invalid combination of header \`${header}\` and cell \`${cell}\`. Freetext header should not contain non-freetext cells.`);
581
+ isValid = false;
582
+ }
583
+ }
584
+ }
585
+ return isValid;
586
+ }
587
+ export function SanityChecks_validateArcTableValues(headers, values, raiseException) {
588
+ let clo;
589
+ let isValid = true;
590
+ let colIndex = 0;
591
+ if ((headers.length !== values.ColumnCount) && (values.ColumnCount !== 0)) {
592
+ (raiseException ? ((message) => {
593
+ throw new Error(message);
594
+ }) : ((clo = toConsole(printf("%s")), (arg) => {
595
+ clo(arg);
596
+ })))(`Invalid table. Number of headers (${headers.length}) does not match number of columns (${values.ColumnCount}).`);
597
+ isValid = false;
598
+ }
599
+ if ((values.RowCount !== 0) && (values.ColumnCount !== 0)) {
600
+ while (isValid && (colIndex < values.ColumnCount)) {
601
+ const header = headers[colIndex];
602
+ let matchValue;
603
+ const key = colIndex | 0;
604
+ const dict = values.Columns;
605
+ let patternInput;
606
+ let outArg = defaultOf();
607
+ patternInput = [tryGetValue(dict, key, new FSharpRef(() => outArg, (v) => {
608
+ outArg = v;
609
+ })), outArg];
610
+ matchValue = (patternInput[0] ? patternInput[1] : undefined);
611
+ if (matchValue != null) {
612
+ if (value_3(matchValue).tag === /* Sparse */ 1) {
613
+ const column = value_3(matchValue).fields[0];
614
+ let enumerator = getEnumerator(column);
615
+ try {
616
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
617
+ const kv = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
618
+ const cell_1 = getItemFromDict(values.ValueMap, kv[1]);
619
+ if (!cell_1.ValidateAgainstHeader(header, raiseException)) {
620
+ isValid = false;
621
+ }
622
+ }
623
+ }
624
+ finally {
625
+ disposeSafe(enumerator);
626
+ }
627
+ }
628
+ else {
629
+ const hash = value_3(matchValue).fields[0] | 0;
630
+ const cell = getItemFromDict(values.ValueMap, hash);
631
+ if (!cell.ValidateAgainstHeader(header, raiseException)) {
632
+ isValid = false;
633
+ }
634
+ }
635
+ }
636
+ colIndex = ((colIndex + 1) | 0);
174
637
  }
175
638
  }
176
639
  return isValid;
177
640
  }
178
- export function Unchecked_tryGetCellAt(column, row, cells) {
179
- return Dictionary_tryFind([column, row], cells);
641
+ export function Unchecked_tryGetCellAt(column, row, values) {
642
+ let dict, patternInput, outArg;
643
+ return bind((col) => {
644
+ if (col.tag === /* Sparse */ 1) {
645
+ const vals = col.fields[0];
646
+ if (vals.has(row)) {
647
+ return getItemFromDict(values.ValueMap, getItemFromDict(vals, row));
648
+ }
649
+ else {
650
+ return undefined;
651
+ }
652
+ }
653
+ else {
654
+ const valueHash = col.fields[0] | 0;
655
+ return getItemFromDict(values.ValueMap, valueHash);
656
+ }
657
+ }, (dict = values.Columns, (patternInput = ((outArg = defaultOf(), [tryGetValue(dict, column, new FSharpRef(() => outArg, (v) => {
658
+ outArg = v;
659
+ })), outArg])), patternInput[0] ? patternInput[1] : undefined)));
660
+ }
661
+ export function Unchecked_getCellWithDefault(column, row, headers, values) {
662
+ if (headers.length <= column) {
663
+ const arg_1 = headers.length | 0;
664
+ toFail(printf("Column index %d is out of bounds for ArcTableValues with column count %d."))(column)(arg_1);
665
+ }
666
+ let matchValue;
667
+ const dict = values.Columns;
668
+ let patternInput;
669
+ let outArg = defaultOf();
670
+ patternInput = [tryGetValue(dict, column, new FSharpRef(() => outArg, (v) => {
671
+ outArg = v;
672
+ })), outArg];
673
+ matchValue = (patternInput[0] ? patternInput[1] : undefined);
674
+ if (matchValue == null) {
675
+ if (row < values.RowCount) {
676
+ return CompositeCell.emptyFreeText;
677
+ }
678
+ else {
679
+ return getEmptyCellForHeader(headers[column], undefined);
680
+ }
681
+ }
682
+ else {
683
+ const col = value_3(matchValue);
684
+ if (col.tag === /* Sparse */ 1) {
685
+ const vals = col.fields[0];
686
+ if (vals.has(row)) {
687
+ return getItemFromDict(values.ValueMap, getItemFromDict(vals, row));
688
+ }
689
+ else if (vals.size === 0) {
690
+ return getEmptyCellForHeader(headers[column], undefined);
691
+ }
692
+ else {
693
+ const header_1 = headers[column];
694
+ const maxI = max(vals.keys(), {
695
+ Compare: comparePrimitives,
696
+ }) | 0;
697
+ return getEmptyCellForHeader(header_1, getItemFromDict(values.ValueMap, getItemFromDict(vals, maxI)));
698
+ }
699
+ }
700
+ else {
701
+ const valueHash = col.fields[0] | 0;
702
+ return getItemFromDict(values.ValueMap, valueHash);
703
+ }
704
+ }
180
705
  }
181
706
  /**
182
707
  * Add or update a cell in the dictionary.
183
708
  */
184
- export function Unchecked_setCellAt(columnIndex, rowIndex, c, cells) {
185
- cells.set([columnIndex, rowIndex], c);
709
+ export function Unchecked_setCellAt(columnIndex, rowIndex, c, values) {
710
+ if ((rowIndex + 1) > values.RowCount) {
711
+ values.RowCount = ((rowIndex + 1) | 0);
712
+ }
713
+ let matchValue;
714
+ const dict = values.Columns;
715
+ let patternInput;
716
+ let outArg = defaultOf();
717
+ patternInput = [tryGetValue(dict, columnIndex, new FSharpRef(() => outArg, (v) => {
718
+ outArg = v;
719
+ })), outArg];
720
+ matchValue = (patternInput[0] ? patternInput[1] : undefined);
721
+ if (matchValue != null) {
722
+ const col = value_3(matchValue);
723
+ if (col.tag === /* Sparse */ 1) {
724
+ const vals = col.fields[0];
725
+ const key_1 = rowIndex | 0;
726
+ const value = ensureCellHashInValueMap(c, values.ValueMap) | 0;
727
+ const dict_1 = vals;
728
+ if (dict_1.has(key_1)) {
729
+ dict_1.set(key_1, value);
730
+ }
731
+ else {
732
+ addToDict(dict_1, key_1, value);
733
+ }
734
+ }
735
+ else {
736
+ const valueHash = col.fields[0] | 0;
737
+ const hash_2 = ensureCellHashInValueMap(c, values.ValueMap) | 0;
738
+ if (hash_2 === valueHash) {
739
+ }
740
+ else {
741
+ const d = new Map([]);
742
+ for (let i = 0; i <= (values.RowCount - 1); i++) {
743
+ if (i === rowIndex) {
744
+ addToDict(d, i, hash_2);
745
+ }
746
+ else {
747
+ addToDict(d, i, valueHash);
748
+ }
749
+ }
750
+ values.Columns.set(columnIndex, ColumnValueRefs_Sparse(d));
751
+ }
752
+ }
753
+ }
754
+ else if ((values.RowCount <= 1) && (rowIndex === 0)) {
755
+ const hash = ensureCellHashInValueMap(c, values.ValueMap) | 0;
756
+ addToDict(values.Columns, columnIndex, ColumnValueRefs_Constant(hash));
757
+ }
758
+ else {
759
+ const newColumn = new Map([]);
760
+ addToDict(newColumn, rowIndex, ensureCellHashInValueMap(c, values.ValueMap));
761
+ addToDict(values.Columns, columnIndex, ColumnValueRefs_Sparse(newColumn));
762
+ }
186
763
  }
187
- /**
188
- * Add a cell to the dictionary. If a cell already exists at the given position, it fails.
189
- */
190
- export function Unchecked_addCellAt(columnIndex, rowIndex, c, cells) {
191
- addToDict(cells, [columnIndex, rowIndex], c);
764
+ export function Unchecked_removeCellAt(columnIndex, rowIndex, values) {
765
+ let matchValue;
766
+ const dict = values.Columns;
767
+ let patternInput;
768
+ let outArg = defaultOf();
769
+ patternInput = [tryGetValue(dict, columnIndex, new FSharpRef(() => outArg, (v) => {
770
+ outArg = v;
771
+ })), outArg];
772
+ matchValue = (patternInput[0] ? patternInput[1] : undefined);
773
+ if (matchValue != null) {
774
+ const col = value_3(matchValue);
775
+ if (col.tag === /* Sparse */ 1) {
776
+ const vals = col.fields[0];
777
+ if (vals.has(rowIndex)) {
778
+ vals.delete(rowIndex);
779
+ if (vals.size === 0) {
780
+ values.Columns.delete(columnIndex);
781
+ }
782
+ }
783
+ }
784
+ else {
785
+ const valueHash = col.fields[0] | 0;
786
+ if ((rowIndex === 0) && (values.RowCount === 1)) {
787
+ values.Columns.delete(columnIndex);
788
+ }
789
+ }
790
+ }
192
791
  }
193
- export function Unchecked_moveCellTo(fromCol, fromRow, toCol, toRow, cells) {
194
- const matchValue = Dictionary_tryFind([fromCol, fromRow], cells);
792
+ export function Unchecked_moveCellTo(fromCol, fromRow, toCol, toRow, values) {
793
+ const matchValue = Unchecked_tryGetCellAt(fromCol, fromRow, values);
195
794
  if (matchValue == null) {
196
795
  }
197
796
  else {
198
- const c = value_2(matchValue);
199
- cells.delete([fromCol, fromRow]);
200
- const value_1 = Unchecked_setCellAt(toCol, toRow, c, cells);
797
+ const cell = value_3(matchValue);
798
+ Unchecked_removeCellAt(fromCol, fromRow, values);
799
+ Unchecked_setCellAt(toCol, toRow, cell, values);
201
800
  }
202
801
  }
203
802
  export function Unchecked_removeHeader(index, headers) {
@@ -206,203 +805,263 @@ export function Unchecked_removeHeader(index, headers) {
206
805
  /**
207
806
  * Remove cells of one Column, change index of cells with higher index to index - 1
208
807
  */
209
- export function Unchecked_removeColumnCells(index, cells) {
210
- let enumerator = getEnumerator(cells);
211
- try {
212
- while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
213
- const activePatternResult = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
214
- const c = activePatternResult[0][0] | 0;
215
- if (c === index) {
216
- cells.delete([c, activePatternResult[0][1]]);
217
- }
218
- }
219
- }
220
- finally {
221
- disposeSafe(enumerator);
222
- }
808
+ export function Unchecked_removeColumnCells(colIndex, values) {
809
+ values.Columns.delete(colIndex);
223
810
  }
224
811
  /**
225
812
  * Remove cells of one Column, change index of cells with higher index to index - 1
226
813
  */
227
- export function Unchecked_removeColumnCells_withIndexChange(index, columnCount, rowCount, cells) {
228
- for (let col = index; col <= (columnCount - 1); col++) {
229
- for (let row = 0; row <= (rowCount - 1); row++) {
230
- if (col === index) {
231
- cells.delete([col, row]);
814
+ export function Unchecked_removeColumnCells_withIndexChange(colIndex, columnCount, values) {
815
+ if (colIndex < (columnCount - 1)) {
816
+ const cols = new Map([]);
817
+ iterate((kv) => {
818
+ const cI = kv[0] | 0;
819
+ if (cI > colIndex) {
820
+ addToDict(cols, cI - 1, kv[1]);
232
821
  }
233
- else if (col > index) {
234
- Unchecked_moveCellTo(col, row, col - 1, row, cells);
822
+ else if (cI < colIndex) {
823
+ addToDict(cols, cI, kv[1]);
235
824
  }
236
- }
825
+ }, values.Columns);
826
+ values.Columns = cols;
237
827
  }
238
- }
239
- export function Unchecked_removeRowCells(rowIndex, cells) {
240
- let enumerator = getEnumerator(cells);
241
- try {
242
- while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
243
- const activePatternResult = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
244
- const r = activePatternResult[0][1] | 0;
245
- if (r === rowIndex) {
246
- cells.delete([activePatternResult[0][0], r]);
247
- }
248
- }
828
+ else {
829
+ const value = Unchecked_removeColumnCells(colIndex, values);
249
830
  }
250
- finally {
251
- disposeSafe(enumerator);
831
+ }
832
+ export function Unchecked_removeRowCells(rowIndex, columnCount, values) {
833
+ for (let c = 0; c <= (columnCount - 1); c++) {
834
+ Unchecked_removeCellAt(c, rowIndex, values);
252
835
  }
253
836
  }
254
837
  /**
255
838
  * Remove cells of one Row, change index of cells with higher index to index - 1
256
839
  */
257
- export function Unchecked_removeRowCells_withIndexChange(rowIndex, columnCount, rowCount, cells) {
258
- for (let row = rowIndex; row <= (rowCount - 1); row++) {
259
- for (let col = 0; col <= (columnCount - 1); col++) {
260
- if (row === rowIndex) {
261
- cells.delete([col, row]);
262
- }
263
- else if (row > rowIndex) {
264
- Unchecked_moveCellTo(col, row, col, row - 1, cells);
840
+ export function Unchecked_removeRowCells_withIndexChange(rowIndex, values) {
841
+ if ((rowIndex === 0) && (values.RowCount === 1)) {
842
+ values.RowCount = 0;
843
+ values.Columns = (new Map([]));
844
+ }
845
+ else {
846
+ iterate((kv) => {
847
+ const matchValue = kv[1];
848
+ if (matchValue.tag === /* Sparse */ 1) {
849
+ const vals = matchValue.fields[0];
850
+ if (rowIndex < (values.RowCount - 1)) {
851
+ const col = new Map([]);
852
+ iterate((kv_1) => {
853
+ const rI = kv_1[0] | 0;
854
+ if (rI > rowIndex) {
855
+ addToDict(col, rI - 1, kv_1[1]);
856
+ }
857
+ else if (rI < rowIndex) {
858
+ addToDict(col, rI, kv_1[1]);
859
+ }
860
+ }, vals);
861
+ values.Columns.set(kv[0], ColumnValueRefs_Sparse(col));
862
+ }
863
+ else {
864
+ vals.delete(rowIndex);
865
+ }
265
866
  }
266
- }
867
+ }, values.Columns);
868
+ values.RowCount = ((values.RowCount - 1) | 0);
267
869
  }
268
870
  }
269
871
  /**
270
- * Get an empty cell fitting for related column header.
271
- *
272
- * `columCellOption` is used to decide between `CompositeCell.Term` or `CompositeCell.Unitized`. `columCellOption` can be any other cell in the same column, preferably the first one.
872
+ * Remove cells of one Row, change index of cells with higher index to index - 1
273
873
  */
274
- export function Unchecked_getEmptyCellForHeader(header, columCellOption) {
275
- const matchValue = header.IsTermColumn;
276
- if (matchValue) {
277
- let matchResult;
278
- if (columCellOption == null) {
279
- matchResult = 0;
280
- }
281
- else {
282
- switch (value_2(columCellOption).tag) {
283
- case /* Term */ 0: {
284
- matchResult = 0;
285
- break;
874
+ export function Unchecked_removeRowRange_withIndexChange(rowStartIndex, rowEndIndex, values) {
875
+ if ((rowStartIndex === 0) && (values.RowCount === rowEndIndex)) {
876
+ values.RowCount = 0;
877
+ values.Columns = (new Map([]));
878
+ }
879
+ else {
880
+ iterate((kv) => {
881
+ const matchValue = kv[1];
882
+ if (matchValue.tag === /* Sparse */ 1) {
883
+ const vals = matchValue.fields[0];
884
+ const range = ((rowEndIndex - rowStartIndex) + 1) | 0;
885
+ if (rowEndIndex < (values.RowCount - 1)) {
886
+ const col = new Map([]);
887
+ iterate((kv_1) => {
888
+ const rI = kv_1[0] | 0;
889
+ if (rI > rowEndIndex) {
890
+ addToDict(col, rI - range, kv_1[1]);
891
+ }
892
+ else if (rI < rowStartIndex) {
893
+ addToDict(col, rI, kv_1[1]);
894
+ }
895
+ }, vals);
896
+ values.Columns.set(kv[0], ColumnValueRefs_Sparse(col));
286
897
  }
287
- case /* Unitized */ 2: {
288
- matchResult = 1;
289
- break;
898
+ else {
899
+ for (let rowIndex = rowStartIndex; rowIndex <= rowEndIndex; rowIndex++) {
900
+ vals.delete(rowIndex);
901
+ }
290
902
  }
291
- default:
292
- matchResult = 2;
293
903
  }
904
+ }, values.Columns);
905
+ values.RowCount = ((values.RowCount - ((rowEndIndex - rowStartIndex) + 1)) | 0);
906
+ }
907
+ }
908
+ export function Unchecked_moveColumnCellsTo(fromCol, toCol, values) {
909
+ let matchValue;
910
+ const dict = values.Columns;
911
+ let patternInput;
912
+ let outArg = defaultOf();
913
+ patternInput = [tryGetValue(dict, fromCol, new FSharpRef(() => outArg, (v) => {
914
+ outArg = v;
915
+ })), outArg];
916
+ matchValue = (patternInput[0] ? patternInput[1] : undefined);
917
+ if (matchValue != null) {
918
+ const col = value_3(matchValue);
919
+ Unchecked_removeColumnCells(fromCol, values);
920
+ const key_1 = toCol | 0;
921
+ const value = col;
922
+ const dict_1 = values.Columns;
923
+ if (dict_1.has(key_1)) {
924
+ dict_1.set(key_1, value);
294
925
  }
295
- switch (matchResult) {
296
- case 0:
297
- return CompositeCell.emptyTerm;
298
- case 1:
299
- return CompositeCell.emptyUnitized;
300
- default:
301
- throw new Error("[extendBodyCells] This should never happen, IsTermColumn header must be paired with either term or unitized cell.");
926
+ else {
927
+ addToDict(dict_1, key_1, value);
302
928
  }
303
929
  }
304
- else {
305
- return CompositeCell.emptyFreeText;
306
- }
307
930
  }
308
931
  /**
309
- *
932
+ * Add a new column to the ArcTableValues.
310
933
  */
311
- export function Unchecked_addColumn(newHeader, newCells, index, forceReplace, onlyHeaders, headers, values) {
934
+ export function Unchecked_addRefColumn(newHeader, newCol, rowCount, index, forceReplace, onlyHeaders, headers, values) {
312
935
  let numberOfNewColumns = 1;
313
936
  let index_1 = index;
314
937
  const hasDuplicateUnique = tryFindDuplicateUnique(newHeader, headers);
315
938
  if (!forceReplace && (hasDuplicateUnique != null)) {
316
- throw new Error(`Invalid new column \`${newHeader}\`. Table already contains header of the same type on index \`${value_2(hasDuplicateUnique)}\``);
939
+ throw new Error(`Invalid new column \`${newHeader}\`. Table already contains header of the same type on index \`${value_3(hasDuplicateUnique)}\``);
940
+ }
941
+ if (rowCount > values.RowCount) {
942
+ values.RowCount = (rowCount | 0);
943
+ let enumerator = getEnumerator(values.Columns);
944
+ try {
945
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
946
+ const kv = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
947
+ values.Columns.set(kv[0], ColumnValueRefs__ToSparse_Z524259A4(kv[1], values.RowCount));
948
+ }
949
+ }
950
+ finally {
951
+ disposeSafe(enumerator);
952
+ }
953
+ }
954
+ if ((((rowCount < values.RowCount) && (hasDuplicateUnique != null)) && forceReplace) && (values.Columns.size === 1)) {
955
+ values.RowCount = (rowCount | 0);
317
956
  }
318
957
  if (hasDuplicateUnique != null) {
319
958
  numberOfNewColumns = 0;
320
- index_1 = (value_2(hasDuplicateUnique) | 0);
959
+ index_1 = (value_3(hasDuplicateUnique) | 0);
321
960
  }
322
- const matchValue = getColumnCount(headers) | 0;
323
- const matchValue_1 = getRowCount(values) | 0;
961
+ const matchValue = headers.length | 0;
962
+ const matchValue_1 = values.RowCount | 0;
324
963
  const startColCount = matchValue | 0;
325
964
  if (hasDuplicateUnique != null) {
326
965
  Unchecked_removeHeader(index_1, headers);
327
966
  }
328
967
  headers.splice(index_1, 0, newHeader);
329
968
  if ((index_1 < startColCount) && (hasDuplicateUnique == null)) {
330
- const lastColumnIndex = max(startColCount - 1, 0) | 0;
969
+ const lastColumnIndex = max_1(startColCount - 1, 0) | 0;
331
970
  for (let columnIndex = lastColumnIndex; columnIndex >= index_1; columnIndex--) {
332
- for (let rowIndex = 0; rowIndex <= matchValue_1; rowIndex++) {
333
- Unchecked_moveCellTo(columnIndex, rowIndex, columnIndex + numberOfNewColumns, rowIndex, values);
334
- }
971
+ Unchecked_moveColumnCellsTo(columnIndex, columnIndex + numberOfNewColumns, values);
335
972
  }
336
973
  }
337
974
  if (!onlyHeaders) {
338
- if (hasDuplicateUnique != null) {
339
- Unchecked_removeColumnCells(index_1, values);
975
+ const key = index_1 | 0;
976
+ const value = newCol;
977
+ const dict = values.Columns;
978
+ if (dict.has(key)) {
979
+ dict.set(key, value);
980
+ }
981
+ else {
982
+ addToDict(dict, key, value);
340
983
  }
341
- const f = (index_1 >= startColCount) ? ((tupledArg) => ((values_1) => {
342
- const value = addToDict(values_1, [tupledArg[0], tupledArg[1]], tupledArg[2]);
343
- })) : ((tupledArg_1) => ((cells) => {
344
- Unchecked_setCellAt(tupledArg_1[0], tupledArg_1[1], tupledArg_1[2], cells);
345
- }));
346
- iterateIndexed((rowIndex_3, cell_1) => {
347
- f([index_1, rowIndex_3, cell_1])(values);
348
- }, newCells);
349
984
  }
350
985
  }
986
+ export function Unchecked_addColumn(newHeader, newCells, index, forceReplace, onlyHeaders, headers, values) {
987
+ Unchecked_addRefColumn(newHeader, ColumnValueRefs_fromCellColumn_14896151(newCells, values.RowCount, values.ValueMap), length(newCells), index, forceReplace, onlyHeaders, headers, values);
988
+ }
989
+ export function Unchecked_addColumnFill(newHeader, newCell, index, forceReplace, onlyHeaders, headers, values) {
990
+ Unchecked_addRefColumn(newHeader, ColumnValueRefs_Constant(ensureCellHashInValueMap(newCell, values.ValueMap)), 1, index, forceReplace, onlyHeaders, headers, values);
991
+ }
351
992
  export function Unchecked_fillMissingCells(headers, values) {
352
- let col;
353
- const rowCount = getRowCount(values) | 0;
354
- const columnCount = getColumnCount(headers) | 0;
355
- const columnKeyGroups = ofArray(Array_groupBy((tuple) => tuple[0], toArray(values.keys()), {
356
- Equals: (x, y) => (x === y),
357
- GetHashCode: numberHash,
358
- }), {
359
- Compare: comparePrimitives,
360
- });
361
- for (let columnIndex = 0; columnIndex <= (columnCount - 1); columnIndex++) {
362
- const header = headers[columnIndex];
363
- const matchValue = tryFind(columnIndex, columnKeyGroups);
364
- if (matchValue == null) {
365
- const defaultCell_1 = Unchecked_getEmptyCellForHeader(header, undefined);
366
- for (let rowIndex_1 = 0; rowIndex_1 <= (rowCount - 1); rowIndex_1++) {
367
- Unchecked_addCellAt(columnIndex, rowIndex_1, defaultCell_1.Copy(), values);
368
- }
369
- }
370
- else if ((col = value_2(matchValue), col.length === rowCount)) {
371
- const col_1 = value_2(matchValue);
372
- }
373
- else {
374
- const col_2 = value_2(matchValue);
375
- const defaultCell = Unchecked_getEmptyCellForHeader(header, getItemFromDict(values, head_1(col_2)));
376
- const rowKeys = ofArray_1(map((tuple_1) => tuple_1[1], col_2), {
377
- Compare: comparePrimitives,
378
- });
379
- for (let rowIndex = 0; rowIndex <= (rowCount - 1); rowIndex++) {
380
- if (!FSharpSet__Contains(rowKeys, rowIndex)) {
381
- Unchecked_addCellAt(columnIndex, rowIndex, defaultCell.Copy(), values);
993
+ let i_1;
994
+ if (values.RowCount === 0) {
995
+ }
996
+ else {
997
+ for (let i = 0; i <= (values.ColumnCount - 1); i++) {
998
+ let matchValue;
999
+ const dict = values.Columns;
1000
+ let patternInput;
1001
+ let outArg = defaultOf();
1002
+ patternInput = [tryGetValue(dict, i, new FSharpRef(() => outArg, (v) => {
1003
+ outArg = v;
1004
+ })), outArg];
1005
+ matchValue = (patternInput[0] ? patternInput[1] : undefined);
1006
+ if (matchValue != null) {
1007
+ if (value_3(matchValue).tag === /* Sparse */ 1) {
1008
+ const vals = value_3(matchValue).fields[0];
1009
+ if (vals.size < values.RowCount) {
1010
+ const header = headers[i];
1011
+ const defaultHash = ensureCellHashInValueMap((vals.size === 0) ? getEmptyCellForHeader(header, undefined) : ((i_1 = (max(vals.keys(), {
1012
+ Compare: comparePrimitives,
1013
+ }) | 0), getEmptyCellForHeader(header, getItemFromDict(values.ValueMap, getItemFromDict(vals, i_1))))), values.ValueMap) | 0;
1014
+ for (let j = vals.size; j <= (values.RowCount - 1); j++) {
1015
+ if (!vals.has(j)) {
1016
+ addToDict(vals, j, defaultHash);
1017
+ }
1018
+ }
1019
+ }
382
1020
  }
383
1021
  }
1022
+ else {
1023
+ const col = ColumnValueRefs_Constant(ensureCellHashInValueMap(getEmptyCellForHeader(headers[i], undefined), values.ValueMap));
1024
+ const value = addToDict(values.Columns, i, col);
1025
+ }
384
1026
  }
385
1027
  }
386
1028
  }
387
- /**
388
- * Increases the table size to the given new row count and fills the new rows with the last value of the column
389
- */
390
- export function Unchecked_extendToRowCount(rowCount, headers, values) {
391
- const columnCount = getColumnCount(headers) | 0;
392
- const previousRowCount = getRowCount(values) | 0;
393
- for (let columnIndex = 0; columnIndex <= (columnCount - 1); columnIndex++) {
394
- const lastValue = getItemFromDict(values, [columnIndex, previousRowCount - 1]);
395
- for (let rowIndex = previousRowCount - 1; rowIndex <= (rowCount - 1); rowIndex++) {
396
- Unchecked_setCellAt(columnIndex, rowIndex, lastValue, values);
1029
+ export function Unchecked_addEmptyRow(index, values) {
1030
+ if ((index < values.RowCount) && (values.ColumnCount !== 0)) {
1031
+ let enumerator = getEnumerator(values.Columns);
1032
+ try {
1033
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
1034
+ const matchValue = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]()[1];
1035
+ if (matchValue.tag === /* Sparse */ 1) {
1036
+ const dict = matchValue.fields[0];
1037
+ const maxIndex = max(dict.keys(), {
1038
+ Compare: comparePrimitives,
1039
+ }) | 0;
1040
+ for (let i = maxIndex; i >= ((index + 1) - 1); i--) {
1041
+ if (dict.has(i)) {
1042
+ const v = getItemFromDict(dict, i) | 0;
1043
+ dict.delete(i);
1044
+ addToDict(dict, i + 1, v);
1045
+ }
1046
+ }
1047
+ }
1048
+ else {
1049
+ const valueHash = matchValue.fields[0] | 0;
1050
+ }
1051
+ }
1052
+ }
1053
+ finally {
1054
+ disposeSafe(enumerator);
397
1055
  }
398
1056
  }
1057
+ values.RowCount = ((values.RowCount + 1) | 0);
399
1058
  }
400
1059
  export function Unchecked_addRow(index, newCells, headers, values) {
401
- const rowCount = getRowCount(values) | 0;
402
- const columnCount = getColumnCount(headers) | 0;
1060
+ const rowCount = values.RowCount | 0;
1061
+ const columnCount = values.ColumnCount | 0;
403
1062
  let increaseRowIndices;
404
1063
  if (index < rowCount) {
405
- const lastRowIndex = max(rowCount - 1, 0) | 0;
1064
+ const lastRowIndex = max_1(rowCount - 1, 0) | 0;
406
1065
  for (let rowIndex = lastRowIndex; rowIndex >= index; rowIndex--) {
407
1066
  for (let columnIndex = 0; columnIndex <= (columnCount - 1); columnIndex++) {
408
1067
  Unchecked_moveCellTo(columnIndex, rowIndex, columnIndex, rowIndex + 1, values);
@@ -412,17 +1071,17 @@ export function Unchecked_addRow(index, newCells, headers, values) {
412
1071
  else {
413
1072
  increaseRowIndices = undefined;
414
1073
  }
415
- const setNewCells = iterateIndexed((columnIndex_1, cell) => {
1074
+ const setNewCells = ResizeArray_iteri((columnIndex_1, cell) => {
416
1075
  Unchecked_setCellAt(columnIndex_1, index, cell, values);
417
1076
  }, newCells);
418
1077
  }
419
1078
  export function Unchecked_addRows(index, newRows, headers, values) {
420
- const rowCount = getRowCount(values) | 0;
421
- const columnCount = getColumnCount(headers) | 0;
1079
+ const rowCount = values.RowCount | 0;
1080
+ const columnCount = values.ColumnCount | 0;
422
1081
  const numNewRows = newRows.length | 0;
423
1082
  let increaseRowIndices;
424
1083
  if (index < rowCount) {
425
- const lastRowIndex = max(rowCount - 1, 0) | 0;
1084
+ const lastRowIndex = max_1(rowCount - 1, 0) | 0;
426
1085
  for (let rowIndex = lastRowIndex; rowIndex >= index; rowIndex--) {
427
1086
  for (let columnIndex = 0; columnIndex <= (columnCount - 1); columnIndex++) {
428
1087
  Unchecked_moveCellTo(columnIndex, rowIndex, columnIndex, rowIndex + numNewRows, values);
@@ -433,11 +1092,17 @@ export function Unchecked_addRows(index, newRows, headers, values) {
433
1092
  increaseRowIndices = undefined;
434
1093
  }
435
1094
  let currentRowIndex = index;
436
- for (let idx = 0; idx <= (newRows.length - 1); idx++) {
437
- const setNewCells = iterateIndexed((columnIndex_1, cell) => {
438
- Unchecked_setCellAt(columnIndex_1, currentRowIndex, cell, values);
439
- }, item(idx, newRows));
440
- currentRowIndex = ((currentRowIndex + 1) | 0);
1095
+ let enumerator = getEnumerator(newRows);
1096
+ try {
1097
+ while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
1098
+ const setNewCells = ResizeArray_iteri((columnIndex_1, cell) => {
1099
+ Unchecked_setCellAt(columnIndex_1, currentRowIndex, cell, values);
1100
+ }, enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]());
1101
+ currentRowIndex = ((currentRowIndex + 1) | 0);
1102
+ }
1103
+ }
1104
+ finally {
1105
+ disposeSafe(enumerator);
441
1106
  }
442
1107
  }
443
1108
  /**
@@ -451,7 +1116,7 @@ export function Unchecked_compositeHeaderMainColumnEqual(ch1, ch2) {
451
1116
  *
452
1117
  * This function moves the column from `fromCol` to `toCol` and shifts all columns in between accordingly
453
1118
  */
454
- export function Unchecked_moveColumnTo(rowCount, fromCol, toCol, headers, values) {
1119
+ export function Unchecked_moveColumnTo(fromCol, toCol, headers, values) {
455
1120
  const patternInput = (fromCol < toCol) ? [-1, fromCol + 1, toCol] : [1, fromCol - 1, toCol];
456
1121
  const shiftStart = patternInput[1] | 0;
457
1122
  const shiftEnd = patternInput[2] | 0;
@@ -468,20 +1133,18 @@ export function Unchecked_moveColumnTo(rowCount, fromCol, toCol, headers, values
468
1133
  disposeSafe(enumerator);
469
1134
  }
470
1135
  setItem(headers, toCol, header);
471
- for (let r = 0; r <= (rowCount - 1); r++) {
472
- const cell = getItemFromDict(values, [fromCol, r]);
473
- const enumerator_1 = getEnumerator(toList(rangeDouble(shiftStart, op_UnaryNegation_Int32(shift), shiftEnd)));
474
- try {
475
- while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
476
- const c_1 = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]() | 0;
477
- values.set([c_1 + shift, r], getItemFromDict(values, [c_1, r]));
478
- }
479
- }
480
- finally {
481
- disposeSafe(enumerator_1);
1136
+ const col = getItemFromDict(values.Columns, fromCol);
1137
+ const enumerator_1 = getEnumerator(toList(rangeDouble(shiftStart, op_UnaryNegation_Int32(shift), shiftEnd)));
1138
+ try {
1139
+ while (enumerator_1["System.Collections.IEnumerator.MoveNext"]()) {
1140
+ const c_1 = enumerator_1["System.Collections.Generic.IEnumerator`1.get_Current"]() | 0;
1141
+ values.Columns.set(c_1 + shift, getItemFromDict(values.Columns, c_1));
482
1142
  }
483
- values.set([toCol, r], cell);
484
1143
  }
1144
+ finally {
1145
+ disposeSafe(enumerator_1);
1146
+ }
1147
+ values.Columns.set(toCol, col);
485
1148
  }
486
1149
  /**
487
1150
  * From a list of rows consisting of headers and values, creates a list of combined headers and the values as a sparse matrix
@@ -494,25 +1157,23 @@ export function Unchecked_moveColumnTo(rowCount, fromCol, toCol, headers, values
494
1157
  */
495
1158
  export function Unchecked_alignByHeaders(keepOrder, rows) {
496
1159
  const headers = [];
497
- const values = new Dictionary([], {
498
- Equals: equalArrays,
499
- GetHashCode: arrayHash,
500
- });
1160
+ const values = ArcTableValues.init();
1161
+ values.RowCount = (length_1(rows) | 0);
501
1162
  const loop = (colI_mut, rows_2_mut) => {
502
1163
  loop: while (true) {
503
1164
  const colI = colI_mut, rows_2 = rows_2_mut;
504
- if (!exists((arg) => !isEmpty(arg), rows_2)) {
1165
+ if (!exists((arg) => !isEmpty_1(arg), rows_2)) {
505
1166
  return [headers, values];
506
1167
  }
507
1168
  else {
508
- const firstElem = pick((l) => (isEmpty(l) ? undefined : head(l)), rows_2)[0];
1169
+ const firstElem = pick((l) => (isEmpty_1(l) ? undefined : head(l)), rows_2)[0];
509
1170
  void (headers.push(firstElem));
510
1171
  colI_mut = (colI + 1);
511
1172
  rows_2_mut = mapIndexed((rowI, l_1) => {
512
1173
  if (keepOrder) {
513
- if (!isEmpty(l_1)) {
1174
+ if (!isEmpty_1(l_1)) {
514
1175
  if (Unchecked_compositeHeaderMainColumnEqual(head(l_1)[0], firstElem)) {
515
- addToDict(values, [colI, rowI], head(l_1)[1]);
1176
+ Unchecked_setCellAt(colI, rowI, head(l_1)[1], values);
516
1177
  return tail_1(l_1);
517
1178
  }
518
1179
  else {
@@ -520,7 +1181,7 @@ export function Unchecked_alignByHeaders(keepOrder, rows) {
520
1181
  }
521
1182
  }
522
1183
  else {
523
- return empty();
1184
+ return empty_1();
524
1185
  }
525
1186
  }
526
1187
  else {
@@ -538,7 +1199,7 @@ export function Unchecked_alignByHeaders(keepOrder, rows) {
538
1199
  return newL;
539
1200
  }
540
1201
  else {
541
- addToDict(values, [colI, rowI], value_2(firstMatch));
1202
+ Unchecked_setCellAt(colI, rowI, value_3(firstMatch), values);
542
1203
  return newL;
543
1204
  }
544
1205
  }