@sheetwrite/wasm 0.4.0 → 0.5.0

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.
@@ -0,0 +1,2185 @@
1
+ // Generated from wasm-bindgen glue; do not edit.
2
+ // The lazy published exports use only the module adopted by the first ready engine,
3
+ // so a later engine built from another module cannot retarget them.
4
+ let publishedModule;
5
+
6
+ export function adoptPublishedModule(module) {
7
+ publishedModule ??= module;
8
+ }
9
+
10
+ export function createInstance(lazy = false) {
11
+ let lazyWasm;
12
+ /* @ts-self-types="./sheetwrite_wasm.d.ts" */
13
+
14
+ /**
15
+ * Result of a single-cell read.
16
+ */
17
+ class CellOut {
18
+ static __wrap(ptr) {
19
+ const obj = Object.create(CellOut.prototype);
20
+ obj.__wbg_ptr = ptr;
21
+ CellOutFinalization.register(obj, obj.__wbg_ptr, obj);
22
+ return obj;
23
+ }
24
+ __destroy_into_raw() {
25
+ const ptr = this.__wbg_ptr;
26
+ this.__wbg_ptr = 0;
27
+ CellOutFinalization.unregister(this);
28
+ return ptr;
29
+ }
30
+ free() {
31
+ const ptr = this.__destroy_into_raw();
32
+ wasm.__wbg_cellout_free(ptr, 0);
33
+ }
34
+ /**
35
+ * @returns {number}
36
+ */
37
+ get kind() {
38
+ const ret = wasm.cellout_kind(this.__wbg_ptr);
39
+ return ret;
40
+ }
41
+ /**
42
+ * @returns {number}
43
+ */
44
+ get num() {
45
+ const ret = wasm.cellout_num(this.__wbg_ptr);
46
+ return ret;
47
+ }
48
+ /**
49
+ * @returns {string | undefined}
50
+ */
51
+ get string() {
52
+ const ret = wasm.cellout_string(this.__wbg_ptr);
53
+ let v1;
54
+ if (ret[0] !== 0) {
55
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
56
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
57
+ }
58
+ return v1;
59
+ }
60
+ /**
61
+ * @returns {number}
62
+ */
63
+ get style() {
64
+ const ret = wasm.cellout_style(this.__wbg_ptr);
65
+ return ret >>> 0;
66
+ }
67
+ }
68
+ if (Symbol.dispose) CellOut.prototype[Symbol.dispose] = CellOut.prototype.free;
69
+
70
+ /**
71
+ * Resolved values of a sparse coordinate batch, one entry per requested cell.
72
+ *
73
+ * Every list holds one entry per cell, in the requested order. Text is stored
74
+ * once: `text_index` names the cell's entry in `strings`, or `-1` when the cell
75
+ * has no text, exactly like [`CellOut::string`] reports it.
76
+ */
77
+ class CellSnapshot {
78
+ static __wrap(ptr) {
79
+ const obj = Object.create(CellSnapshot.prototype);
80
+ obj.__wbg_ptr = ptr;
81
+ CellSnapshotFinalization.register(obj, obj.__wbg_ptr, obj);
82
+ return obj;
83
+ }
84
+ __destroy_into_raw() {
85
+ const ptr = this.__wbg_ptr;
86
+ this.__wbg_ptr = 0;
87
+ CellSnapshotFinalization.unregister(this);
88
+ return ptr;
89
+ }
90
+ free() {
91
+ const ptr = this.__destroy_into_raw();
92
+ wasm.__wbg_cellsnapshot_free(ptr, 0);
93
+ }
94
+ /**
95
+ * @returns {Uint8Array}
96
+ */
97
+ get kinds() {
98
+ const ret = wasm.cellsnapshot_kinds(this.__wbg_ptr);
99
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
100
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
101
+ return v1;
102
+ }
103
+ /**
104
+ * @returns {Float64Array}
105
+ */
106
+ get numbers() {
107
+ const ret = wasm.cellsnapshot_numbers(this.__wbg_ptr);
108
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
109
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
110
+ return v1;
111
+ }
112
+ /**
113
+ * @returns {string[]}
114
+ */
115
+ get strings() {
116
+ const ret = wasm.cellsnapshot_strings(this.__wbg_ptr);
117
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
118
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
119
+ return v1;
120
+ }
121
+ /**
122
+ * @returns {Uint32Array}
123
+ */
124
+ get styles() {
125
+ const ret = wasm.cellsnapshot_styles(this.__wbg_ptr);
126
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
127
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
128
+ return v1;
129
+ }
130
+ /**
131
+ * Entry in [`Self::strings`] per cell, or `-1` for a cell without text.
132
+ * @returns {Int32Array}
133
+ */
134
+ get textIndex() {
135
+ const ret = wasm.cellsnapshot_textIndex(this.__wbg_ptr);
136
+ var v1 = getArrayI32FromWasm0(ret[0], ret[1]).slice();
137
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
138
+ return v1;
139
+ }
140
+ }
141
+ if (Symbol.dispose) CellSnapshot.prototype[Symbol.dispose] = CellSnapshot.prototype.free;
142
+
143
+ /**
144
+ * The workbook-wide store: every sheet, one string pool.
145
+ */
146
+ class CellStore {
147
+ static __wrap(ptr) {
148
+ const obj = Object.create(CellStore.prototype);
149
+ obj.__wbg_ptr = ptr;
150
+ CellStoreFinalization.register(obj, obj.__wbg_ptr, obj);
151
+ return obj;
152
+ }
153
+ __destroy_into_raw() {
154
+ const ptr = this.__wbg_ptr;
155
+ this.__wbg_ptr = 0;
156
+ CellStoreFinalization.unregister(this);
157
+ return ptr;
158
+ }
159
+ free() {
160
+ const ptr = this.__destroy_into_raw();
161
+ wasm.__wbg_cellstore_free(ptr, 0);
162
+ }
163
+ /**
164
+ * @param {bigint} revision
165
+ */
166
+ acknowledgeRevision(revision) {
167
+ wasm.cellstore_acknowledgeRevision(this.__wbg_ptr, revision);
168
+ }
169
+ /**
170
+ * Allocate a logical sheet whose cell chunks materialize on page load or edit.
171
+ * @param {number} n_cols
172
+ * @param {number} row_count
173
+ * @param {number} chunk_rows
174
+ * @param {number} byte_budget
175
+ * @param {number} max_dirty_cells
176
+ * @returns {number}
177
+ */
178
+ addPagedSheet(n_cols, row_count, chunk_rows, byte_budget, max_dirty_cells) {
179
+ const ret = wasm.cellstore_addPagedSheet(this.__wbg_ptr, n_cols, row_count, chunk_rows, byte_budget, max_dirty_cells);
180
+ return ret >>> 0;
181
+ }
182
+ /**
183
+ * @param {number} sheet
184
+ * @param {number} at
185
+ * @param {number} count
186
+ */
187
+ addRows(sheet, at, count) {
188
+ wasm.cellstore_addRows(this.__wbg_ptr, sheet, at, count);
189
+ }
190
+ /**
191
+ * Allocate a sheet grid and return its numeric handle.
192
+ * @param {number} n_cols
193
+ * @param {number} row_count
194
+ * @returns {number}
195
+ */
196
+ addSheet(n_cols, row_count) {
197
+ const ret = wasm.cellstore_addSheet(this.__wbg_ptr, n_cols, row_count);
198
+ return ret >>> 0;
199
+ }
200
+ /**
201
+ * Whether a source rectangle can replace its spill cells without cutting
202
+ * an installed spill away from its anchor. No owner window crosses WASM.
203
+ * @param {number} sheet
204
+ * @param {number} r0
205
+ * @param {number} c0
206
+ * @param {number} r1
207
+ * @param {number} c1
208
+ * @returns {boolean}
209
+ */
210
+ admitSourceRange(sheet, r0, c0, r1, c1) {
211
+ const ret = wasm.cellstore_admitSourceRange(this.__wbg_ptr, sheet, r0, c0, r1, c1);
212
+ return ret !== 0;
213
+ }
214
+ /**
215
+ * Column aggregate over numeric cells. op: 0 sum, 1 avg, 2 min, 3 max, 4 count.
216
+ * @param {number} sheet
217
+ * @param {number} col
218
+ * @param {number} op
219
+ * @returns {number}
220
+ */
221
+ aggregate(sheet, col, op) {
222
+ const ret = wasm.cellstore_aggregate(this.__wbg_ptr, sheet, col, op);
223
+ return ret;
224
+ }
225
+ /**
226
+ * @returns {bigint}
227
+ */
228
+ beginMutation() {
229
+ const ret = wasm.cellstore_beginMutation(this.__wbg_ptr);
230
+ return BigInt.asUintN(64, ret);
231
+ }
232
+ beginPageLoad() {
233
+ wasm.cellstore_beginPageLoad(this.__wbg_ptr);
234
+ }
235
+ /**
236
+ * @param {number} sheet
237
+ * @param {number} row
238
+ * @param {number} col
239
+ * @returns {boolean}
240
+ */
241
+ canDirtyCell(sheet, row, col) {
242
+ const ret = wasm.cellstore_canDirtyCell(this.__wbg_ptr, sheet, row, col);
243
+ return ret !== 0;
244
+ }
245
+ /**
246
+ * Capture a dense rectangle into an opaque store-local history resource.
247
+ * @param {number} sheet
248
+ * @param {number} r0
249
+ * @param {number} c0
250
+ * @param {number} rows
251
+ * @param {number} cols
252
+ * @returns {RangeSnapshot | undefined}
253
+ */
254
+ captureRange(sheet, r0, c0, rows, cols) {
255
+ const ret = wasm.cellstore_captureRange(this.__wbg_ptr, sheet, r0, c0, rows, cols);
256
+ return ret === 0 ? undefined : RangeSnapshot.__wrap(ret);
257
+ }
258
+ /**
259
+ * Capture only persisted references for one sheet. The explicit entry cap
260
+ * bounds allocation for host-side structural admission simulation.
261
+ * @param {number} sheet
262
+ * @param {number} max_entries
263
+ * @returns {SourceSnapshot | undefined}
264
+ */
265
+ captureReferences(sheet, max_entries) {
266
+ const ret = wasm.cellstore_captureReferences(this.__wbg_ptr, sheet, max_entries);
267
+ return ret === 0 ? undefined : SourceSnapshot.__wrap(ret);
268
+ }
269
+ /**
270
+ * Capture only persisted formula/reference sources in a rectangle. The
271
+ * returned opaque object is compact in source cardinality, not cell count.
272
+ * @param {number} sheet
273
+ * @param {number} r0
274
+ * @param {number} c0
275
+ * @param {number} rows
276
+ * @param {number} cols
277
+ * @returns {SourceSnapshot | undefined}
278
+ */
279
+ captureSources(sheet, r0, c0, rows, cols) {
280
+ const ret = wasm.cellstore_captureSources(this.__wbg_ptr, sheet, r0, c0, rows, cols);
281
+ return ret === 0 ? undefined : SourceSnapshot.__wrap(ret);
282
+ }
283
+ /**
284
+ * Capture persisted formula/reference sources and derived-spill identity
285
+ * for arbitrary row/column coordinates in one boundary crossing. Offsets
286
+ * follow the caller's row-major coordinate order.
287
+ * @param {number} sheet
288
+ * @param {Uint32Array} rows
289
+ * @param {Uint32Array} cols
290
+ * @returns {SourceSnapshot | undefined}
291
+ */
292
+ captureSourcesForRows(sheet, rows, cols) {
293
+ const ptr0 = passArray32ToWasm0(rows, wasm.__wbindgen_malloc);
294
+ const len0 = WASM_VECTOR_LEN;
295
+ const ptr1 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
296
+ const len1 = WASM_VECTOR_LEN;
297
+ const ret = wasm.cellstore_captureSourcesForRows(this.__wbg_ptr, sheet, ptr0, len0, ptr1, len1);
298
+ return ret === 0 ? undefined : SourceSnapshot.__wrap(ret);
299
+ }
300
+ /**
301
+ * Resolved values of a sparse coordinate list in one batched read.
302
+ *
303
+ * `rows` and `cols` are absolute coordinates and must have the same length;
304
+ * otherwise the result carries no cells. Every entry reads exactly like
305
+ * [`Self::get_cell`], so a batched capture reports the values a per-cell
306
+ * read would.
307
+ * @param {number} sheet
308
+ * @param {Uint32Array} rows
309
+ * @param {Uint32Array} cols
310
+ * @returns {CellSnapshot | undefined}
311
+ */
312
+ cellSnapshots(sheet, rows, cols) {
313
+ const ptr0 = passArray32ToWasm0(rows, wasm.__wbindgen_malloc);
314
+ const len0 = WASM_VECTOR_LEN;
315
+ const ptr1 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
316
+ const len1 = WASM_VECTOR_LEN;
317
+ const ret = wasm.cellstore_cellSnapshots(this.__wbg_ptr, sheet, ptr0, len0, ptr1, len1);
318
+ return ret === 0 ? undefined : CellSnapshot.__wrap(ret);
319
+ }
320
+ /**
321
+ * 0 unloaded, 1 loaded-empty, 2 loaded-value, 3 dirty local edit.
322
+ * @param {number} sheet
323
+ * @param {number} row
324
+ * @param {number} col
325
+ * @returns {number}
326
+ */
327
+ cellState(sheet, row, col) {
328
+ const ret = wasm.cellstore_cellState(this.__wbg_ptr, sheet, row, col);
329
+ return ret;
330
+ }
331
+ /**
332
+ * @param {number} sheet
333
+ * @param {number} row
334
+ * @param {number} col
335
+ * @param {number} style
336
+ */
337
+ clearCell(sheet, row, col, style) {
338
+ wasm.cellstore_clearCell(this.__wbg_ptr, sheet, row, col, style);
339
+ }
340
+ /**
341
+ * Clear a rectangle while independently controlling contents and style.
342
+ * @param {number} sheet
343
+ * @param {number} r0
344
+ * @param {number} c0
345
+ * @param {number} r1
346
+ * @param {number} c1
347
+ * @param {boolean} contents
348
+ * @param {boolean} style
349
+ * @returns {boolean}
350
+ */
351
+ clearRange(sheet, r0, c0, r1, c1, contents, style) {
352
+ const ret = wasm.cellstore_clearRange(this.__wbg_ptr, sheet, r0, c0, r1, c1, contents, style);
353
+ return ret !== 0;
354
+ }
355
+ /**
356
+ * @param {number} sheet
357
+ * @returns {number}
358
+ */
359
+ colCount(sheet) {
360
+ const ret = wasm.cellstore_colCount(this.__wbg_ptr, sheet);
361
+ return ret >>> 0;
362
+ }
363
+ /**
364
+ * @param {number} sheet
365
+ * @param {number} start_row
366
+ * @param {number} end_row
367
+ * @param {Uint32Array} cols
368
+ * @returns {boolean}
369
+ */
370
+ columnsFullyLoaded(sheet, start_row, end_row, cols) {
371
+ const ptr0 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
372
+ const len0 = WASM_VECTOR_LEN;
373
+ const ret = wasm.cellstore_columnsFullyLoaded(this.__wbg_ptr, sheet, start_row, end_row, ptr0, len0);
374
+ return ret !== 0;
375
+ }
376
+ /**
377
+ * Commit staged user or host sources. Admission metadata must be staged
378
+ * before this barrier; derived values and string roots are complete on return.
379
+ * Beginning a page load suppresses local dirty tracking until this commit.
380
+ */
381
+ commitSources() {
382
+ wasm.cellstore_commitSources(this.__wbg_ptr);
383
+ }
384
+ /**
385
+ * Reclaim unreachable text and release growth slack at a transaction barrier.
386
+ * Raw pool IDs must be discarded when `stringPoolEpoch` changes.
387
+ */
388
+ compactStringStorage() {
389
+ wasm.cellstore_compactStringStorage(this.__wbg_ptr);
390
+ }
391
+ /**
392
+ * Ctrl+Arrow destination: from `(row, col)` stepping by `(d_row, d_col)`
393
+ * (exactly one of them ±1), return the destination row (vertical moves) or
394
+ * column (horizontal moves), Google Sheets semantics:
395
+ *
396
+ * - current and adjacent cell non-empty → end of the contiguous non-empty
397
+ * run;
398
+ * - otherwise → the next non-empty cell in that direction;
399
+ * - nothing ahead → the sheet edge.
400
+ * @param {number} sheet
401
+ * @param {number} row
402
+ * @param {number} col
403
+ * @param {number} d_row
404
+ * @param {number} d_col
405
+ * @returns {number}
406
+ */
407
+ dataEdge(sheet, row, col, d_row, d_col) {
408
+ const ret = wasm.cellstore_dataEdge(this.__wbg_ptr, sheet, row, col, d_row, d_col);
409
+ return ret >>> 0;
410
+ }
411
+ /**
412
+ * @param {number} sheet
413
+ * @param {Uint32Array} order
414
+ * @param {number} row
415
+ * @param {number} col
416
+ * @param {number} d_row
417
+ * @param {number} d_col
418
+ * @returns {number}
419
+ */
420
+ dataEdgeOrdered(sheet, order, row, col, d_row, d_col) {
421
+ const ptr0 = passArray32ToWasm0(order, wasm.__wbindgen_malloc);
422
+ const len0 = WASM_VECTOR_LEN;
423
+ const ret = wasm.cellstore_dataEdgeOrdered(this.__wbg_ptr, sheet, ptr0, len0, row, col, d_row, d_col);
424
+ return ret >>> 0;
425
+ }
426
+ /**
427
+ * @param {number} sheet
428
+ * @param {number} row
429
+ * @param {number} col
430
+ * @returns {bigint}
431
+ */
432
+ dirtyRevision(sheet, row, col) {
433
+ const ret = wasm.cellstore_dirtyRevision(this.__wbg_ptr, sheet, row, col);
434
+ return BigInt.asUintN(64, ret);
435
+ }
436
+ /**
437
+ * @param {number} sheet
438
+ * @param {number} col
439
+ * @param {number} limit
440
+ * @returns {DistinctColumn}
441
+ */
442
+ distinctValues(sheet, col, limit) {
443
+ const ret = wasm.cellstore_distinctValues(this.__wbg_ptr, sheet, col, limit);
444
+ return DistinctColumn.__wrap(ret);
445
+ }
446
+ /**
447
+ * Export only live state, not allocator slack or a dependency-index cache.
448
+ * @returns {Uint8Array}
449
+ */
450
+ exportMemoryState() {
451
+ const ret = wasm.cellstore_exportMemoryState(this.__wbg_ptr);
452
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
453
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
454
+ return v1;
455
+ }
456
+ /**
457
+ * Data-row indices whose column text contains `needle` (case-insensitive).
458
+ * @param {number} sheet
459
+ * @param {number} col
460
+ * @param {string} needle
461
+ * @returns {Uint32Array}
462
+ */
463
+ filterRows(sheet, col, needle) {
464
+ const ptr0 = passStringToWasm0(needle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
465
+ const len0 = WASM_VECTOR_LEN;
466
+ const ret = wasm.cellstore_filterRows(this.__wbg_ptr, sheet, col, ptr0, len0);
467
+ var v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
468
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
469
+ return v2;
470
+ }
471
+ /**
472
+ * @param {number} sheet
473
+ * @param {Uint32Array} cols
474
+ * @param {Uint8Array} kinds
475
+ * @param {Uint8Array} flags
476
+ * @param {Float64Array} nums
477
+ * @param {Uint32Array} num_counts
478
+ * @param {Uint32Array} text_counts
479
+ * @param {Float64Array} value_nums
480
+ * @param {string[]} value_texts
481
+ * @returns {Uint32Array}
482
+ */
483
+ filterRowsMulti(sheet, cols, kinds, flags, nums, num_counts, text_counts, value_nums, value_texts) {
484
+ const ptr0 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
485
+ const len0 = WASM_VECTOR_LEN;
486
+ const ptr1 = passArray8ToWasm0(kinds, wasm.__wbindgen_malloc);
487
+ const len1 = WASM_VECTOR_LEN;
488
+ const ptr2 = passArray8ToWasm0(flags, wasm.__wbindgen_malloc);
489
+ const len2 = WASM_VECTOR_LEN;
490
+ const ptr3 = passArrayF64ToWasm0(nums, wasm.__wbindgen_malloc);
491
+ const len3 = WASM_VECTOR_LEN;
492
+ const ptr4 = passArray32ToWasm0(num_counts, wasm.__wbindgen_malloc);
493
+ const len4 = WASM_VECTOR_LEN;
494
+ const ptr5 = passArray32ToWasm0(text_counts, wasm.__wbindgen_malloc);
495
+ const len5 = WASM_VECTOR_LEN;
496
+ const ptr6 = passArrayF64ToWasm0(value_nums, wasm.__wbindgen_malloc);
497
+ const len6 = WASM_VECTOR_LEN;
498
+ const ptr7 = passArrayJsValueToWasm0(value_texts, wasm.__wbindgen_malloc);
499
+ const len7 = WASM_VECTOR_LEN;
500
+ const ret = wasm.cellstore_filterRowsMulti(this.__wbg_ptr, sheet, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7);
501
+ var v9 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
502
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
503
+ return v9;
504
+ }
505
+ /**
506
+ * Benchmark diagnostic: `[current matrix bytes, peak matrix bytes, allocations]`.
507
+ * @returns {Float64Array}
508
+ */
509
+ formulaMatrixResourceStats() {
510
+ const ret = wasm.cellstore_formulaMatrixResourceStats(this.__wbg_ptr);
511
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
512
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
513
+ return v1;
514
+ }
515
+ /**
516
+ * Same-sheet calculation prerequisites for `start_row..end_row` × `cols`,
517
+ * as flat `[row_start, row_end, col_start, col_end)` rectangles.
518
+ *
519
+ * The walk follows each read into the formula cells it reaches, so for
520
+ * `H = F - G` and `F = D - E` it reports `D`, `E`, `F`, and `G`.
521
+ * Spill children follow their anchor; attempted spill destinations are also
522
+ * prerequisites because admission must establish that source cells are empty.
523
+ * Reads of other sheets are skipped. `max_cells` bounds the walk: a read larger than
524
+ * the remaining budget is skipped, so one whole-column range cannot make a
525
+ * window demand the full column. Rectangles are disjoint and ascend by
526
+ * column, then by row.
527
+ * @param {number} sheet
528
+ * @param {number} start_row
529
+ * @param {number} end_row
530
+ * @param {Uint32Array} cols
531
+ * @param {number} max_cells
532
+ * @returns {Uint32Array}
533
+ */
534
+ formulaReadBands(sheet, start_row, end_row, cols, max_cells) {
535
+ const ptr0 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
536
+ const len0 = WASM_VECTOR_LEN;
537
+ const ret = wasm.cellstore_formulaReadBands(this.__wbg_ptr, sheet, start_row, end_row, ptr0, len0, max_cells);
538
+ var v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
539
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
540
+ return v2;
541
+ }
542
+ /**
543
+ * @param {number} sheet
544
+ * @param {number} row
545
+ * @param {number} col
546
+ * @returns {string | undefined}
547
+ */
548
+ formulaSource(sheet, row, col) {
549
+ const ret = wasm.cellstore_formulaSource(this.__wbg_ptr, sheet, row, col);
550
+ let v1;
551
+ if (ret[0] !== 0) {
552
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
553
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
554
+ }
555
+ return v1;
556
+ }
557
+ /**
558
+ * Single-cell read for interactions/tests — never the render hot path.
559
+ * @param {number} sheet
560
+ * @param {number} row
561
+ * @param {number} col
562
+ * @returns {CellOut}
563
+ */
564
+ getCell(sheet, row, col) {
565
+ const ret = wasm.cellstore_getCell(this.__wbg_ptr, sheet, row, col);
566
+ return CellOut.__wrap(ret);
567
+ }
568
+ /**
569
+ * One bulk read of a rectangular window for the renderer. Returns
570
+ * contiguous packed cell data (row-major over `rows x cols`) with pool IDs
571
+ * and window-local formula-error strings, avoiding per-cell boundary reads.
572
+ * @param {number} sheet
573
+ * @param {number} row_start
574
+ * @param {number} row_end
575
+ * @param {Uint32Array} cols
576
+ * @returns {WindowView}
577
+ */
578
+ getWindow(sheet, row_start, row_end, cols) {
579
+ const ptr0 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
580
+ const len0 = WASM_VECTOR_LEN;
581
+ const ret = wasm.cellstore_getWindow(this.__wbg_ptr, sheet, row_start, row_end, ptr0, len0);
582
+ return WindowView.__wrap(ret);
583
+ }
584
+ /**
585
+ * Bulk read of an explicit row list (sorted/filtered views) — same output
586
+ * shape as `get_window`, rows taken from `rows` rather than a range.
587
+ * @param {number} sheet
588
+ * @param {Uint32Array} rows
589
+ * @param {Uint32Array} cols
590
+ * @returns {WindowView}
591
+ */
592
+ getWindowRows(sheet, rows, cols) {
593
+ const ptr0 = passArray32ToWasm0(rows, wasm.__wbindgen_malloc);
594
+ const len0 = WASM_VECTOR_LEN;
595
+ const ptr1 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
596
+ const len1 = WASM_VECTOR_LEN;
597
+ const ret = wasm.cellstore_getWindowRows(this.__wbg_ptr, sheet, ptr0, len0, ptr1, len1);
598
+ return WindowView.__wrap(ret);
599
+ }
600
+ /**
601
+ * Hydrate one datasource page column while retaining local dirty cells and
602
+ * request-revision exceptions. `protected_offsets` is sorted and relative
603
+ * to `start_row`.
604
+ * @param {number} sheet
605
+ * @param {number} col
606
+ * @param {number} start_row
607
+ * @param {Float64Array} values
608
+ * @param {number} style
609
+ * @param {Uint32Array} protected_offsets
610
+ */
611
+ hydratePageNumbers(sheet, col, start_row, values, style, protected_offsets) {
612
+ const ptr0 = passArrayF64ToWasm0(values, wasm.__wbindgen_malloc);
613
+ const len0 = WASM_VECTOR_LEN;
614
+ const ptr1 = passArray32ToWasm0(protected_offsets, wasm.__wbindgen_malloc);
615
+ const len1 = WASM_VECTOR_LEN;
616
+ wasm.cellstore_hydratePageNumbers(this.__wbg_ptr, sheet, col, start_row, ptr0, len0, style, ptr1, len1);
617
+ }
618
+ /**
619
+ * Packed-string counterpart to [`CellStore::hydrate_page_numbers`].
620
+ * @param {number} sheet
621
+ * @param {number} col
622
+ * @param {number} start_row
623
+ * @param {string} buf
624
+ * @param {Uint32Array} utf16_lens
625
+ * @param {number} style
626
+ * @param {Uint32Array} protected_offsets
627
+ */
628
+ hydratePageStringsPacked(sheet, col, start_row, buf, utf16_lens, style, protected_offsets) {
629
+ const ptr0 = passStringToWasm0(buf, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
630
+ const len0 = WASM_VECTOR_LEN;
631
+ const ptr1 = passArray32ToWasm0(utf16_lens, wasm.__wbindgen_malloc);
632
+ const len1 = WASM_VECTOR_LEN;
633
+ const ptr2 = passArray32ToWasm0(protected_offsets, wasm.__wbindgen_malloc);
634
+ const len2 = WASM_VECTOR_LEN;
635
+ wasm.cellstore_hydratePageStringsPacked(this.__wbg_ptr, sheet, col, start_row, ptr0, len0, ptr1, len1, style, ptr2, len2);
636
+ }
637
+ /**
638
+ * Import into a fresh instance; failure never mutates the source store.
639
+ * @param {Uint8Array} bytes
640
+ * @returns {CellStore}
641
+ */
642
+ static importMemoryState(bytes) {
643
+ const ret = wasm.cellstore_importMemoryState(bytes);
644
+ return CellStore.__wrap(ret);
645
+ }
646
+ /**
647
+ * @param {Uint8Array} bytes
648
+ * @param {number} sheet
649
+ * @param {number} row_start
650
+ * @param {number} col_start
651
+ * @returns {RangeSnapshot}
652
+ */
653
+ importRangeMemoryState(bytes, sheet, row_start, col_start) {
654
+ const ret = wasm.cellstore_importRangeMemoryState(this.__wbg_ptr, bytes, sheet, row_start, col_start);
655
+ return RangeSnapshot.__wrap(ret);
656
+ }
657
+ /**
658
+ * @param {number} sheet
659
+ * @param {number} at
660
+ * @param {number} count
661
+ */
662
+ insertCols(sheet, at, count) {
663
+ wasm.cellstore_insertCols(this.__wbg_ptr, sheet, at, count);
664
+ }
665
+ /**
666
+ * @param {number} sheet
667
+ * @returns {boolean}
668
+ */
669
+ isFullyLoaded(sheet) {
670
+ const ret = wasm.cellstore_isFullyLoaded(this.__wbg_ptr, sheet);
671
+ return ret !== 0;
672
+ }
673
+ /**
674
+ * @param {number} sheet
675
+ * @returns {boolean}
676
+ */
677
+ isPaged(sheet) {
678
+ const ret = wasm.cellstore_isPaged(this.__wbg_ptr, sheet);
679
+ return ret !== 0;
680
+ }
681
+ /**
682
+ * @param {number} sheet
683
+ * @returns {boolean}
684
+ */
685
+ isSheetAlive(sheet) {
686
+ const ret = wasm.cellstore_isSheetAlive(this.__wbg_ptr, sheet);
687
+ return ret !== 0;
688
+ }
689
+ /**
690
+ * Loaded row runs of one column inside `start_row..end_row`, as flat
691
+ * `[start, end)` pairs in ascending, disjoint order.
692
+ *
693
+ * A row belongs to a run only when [`Self::columns_fully_loaded`] would
694
+ * report it loaded, so a caller can reconcile a whole column with one call
695
+ * instead of probing the band row by row. Rows outside the sheet and empty
696
+ * requests produce no pairs.
697
+ * @param {number} sheet
698
+ * @param {number} start_row
699
+ * @param {number} end_row
700
+ * @param {number} col
701
+ * @returns {Uint32Array}
702
+ */
703
+ loadedSpans(sheet, start_row, end_row, col) {
704
+ const ret = wasm.cellstore_loadedSpans(this.__wbg_ptr, sheet, start_row, end_row, col);
705
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
706
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
707
+ return v1;
708
+ }
709
+ /**
710
+ * @param {number} sheet
711
+ * @param {number} row
712
+ * @param {number} col
713
+ * @param {bigint} revision
714
+ * @returns {boolean}
715
+ */
716
+ markCellCleanRevision(sheet, row, col, revision) {
717
+ const ret = wasm.cellstore_markCellCleanRevision(this.__wbg_ptr, sheet, row, col, revision);
718
+ return ret !== 0;
719
+ }
720
+ /**
721
+ * @param {number} sheet
722
+ * @param {number} start_row
723
+ * @param {number} end_row
724
+ * @param {number} start_col
725
+ * @param {number} end_col
726
+ */
727
+ markRangeClean(sheet, start_row, end_row, start_col, end_col) {
728
+ wasm.cellstore_markRangeClean(this.__wbg_ptr, sheet, start_row, end_row, start_col, end_col);
729
+ }
730
+ /**
731
+ * @returns {Float64Array}
732
+ */
733
+ memoryStats() {
734
+ const ret = wasm.cellstore_memoryStats(this.__wbg_ptr);
735
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
736
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
737
+ return v1;
738
+ }
739
+ constructor() {
740
+ const ret = wasm.cellstore_new();
741
+ this.__wbg_ptr = ret;
742
+ CellStoreFinalization.register(this, this.__wbg_ptr, this);
743
+ return this;
744
+ }
745
+ /**
746
+ * @param {number} sheet
747
+ * @returns {Float64Array}
748
+ */
749
+ pagedDirtyCoordinates(sheet) {
750
+ const ret = wasm.cellstore_pagedDirtyCoordinates(this.__wbg_ptr, sheet);
751
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
752
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
753
+ return v1;
754
+ }
755
+ /**
756
+ * `[chunks, loaded cells, dirty cells, clean chunk bytes, fully loaded, dirty bytes]`.
757
+ * @param {number} sheet
758
+ * @returns {Float64Array}
759
+ */
760
+ pagedStats(sheet) {
761
+ const ret = wasm.cellstore_pagedStats(this.__wbg_ptr, sheet);
762
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
763
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
764
+ return v1;
765
+ }
766
+ /**
767
+ * Sparse persisted-cell records. Each record starts with
768
+ * `[row, col, kind, number, style, string_id, source_kind, source_length]`.
769
+ * Formula UTF-8 is packed into little-endian u32 words; references append
770
+ * one `[sheet, row, col]` triple. The allocation scales with serialized
771
+ * cells and source bytes, never the logical sheet rectangle.
772
+ * @param {number} sheet
773
+ * @returns {Float64Array}
774
+ */
775
+ persistedCellData(sheet) {
776
+ const ret = wasm.cellstore_persistedCellData(this.__wbg_ptr, sheet);
777
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
778
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
779
+ return v1;
780
+ }
781
+ /**
782
+ * Replaces caller-owned persistent pins; empty row ranges leave them unchanged.
783
+ * @param {number} sheet
784
+ * @param {number} start_row
785
+ * @param {number} end_row
786
+ * @param {Uint32Array} cols
787
+ */
788
+ pinRange(sheet, start_row, end_row, cols) {
789
+ const ptr0 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
790
+ const len0 = WASM_VECTOR_LEN;
791
+ wasm.cellstore_pinRange(this.__wbg_ptr, sheet, start_row, end_row, ptr0, len0);
792
+ }
793
+ /**
794
+ * Replaces transient read protection without changing explicit or viewport pins.
795
+ * Nonempty `rows` are backing row IDs; otherwise `[start_row, end_row)` is used.
796
+ * @param {number} sheet
797
+ * @param {number} start_row
798
+ * @param {number} end_row
799
+ * @param {Uint32Array} rows
800
+ * @param {Uint32Array} cols
801
+ */
802
+ pinReadWindow(sheet, start_row, end_row, rows, cols) {
803
+ const ptr0 = passArray32ToWasm0(rows, wasm.__wbindgen_malloc);
804
+ const len0 = WASM_VECTOR_LEN;
805
+ const ptr1 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
806
+ const len1 = WASM_VECTOR_LEN;
807
+ wasm.cellstore_pinReadWindow(this.__wbg_ptr, sheet, start_row, end_row, ptr0, len0, ptr1, len1);
808
+ }
809
+ /**
810
+ * Replaces viewport-owned protection independently of transient read pins.
811
+ * @param {number} sheet
812
+ * @param {Uint32Array} bands
813
+ */
814
+ pinViewportBands(sheet, bands) {
815
+ const ptr0 = passArray32ToWasm0(bands, wasm.__wbindgen_malloc);
816
+ const len0 = WASM_VECTOR_LEN;
817
+ wasm.cellstore_pinViewportBands(this.__wbg_ptr, sheet, ptr0, len0);
818
+ }
819
+ /**
820
+ * @param {Uint32Array} ids
821
+ * @returns {string[]}
822
+ */
823
+ poolStrings(ids) {
824
+ const ptr0 = passArray32ToWasm0(ids, wasm.__wbindgen_malloc);
825
+ const len0 = WASM_VECTOR_LEN;
826
+ const ret = wasm.cellstore_poolStrings(this.__wbg_ptr, ptr0, len0);
827
+ var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
828
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
829
+ return v2;
830
+ }
831
+ /**
832
+ * `[contains cache constructions, owned distinct strings]`.
833
+ * @returns {Float64Array}
834
+ */
835
+ queryResourceStats() {
836
+ const ret = wasm.cellstore_queryResourceStats(this.__wbg_ptr);
837
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
838
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
839
+ return v1;
840
+ }
841
+ /**
842
+ * @param {number} sheet
843
+ * @param {number} r0
844
+ * @param {number} c0
845
+ * @param {number} r1
846
+ * @param {number} c1
847
+ * @returns {boolean}
848
+ */
849
+ rangeFullyLoaded(sheet, r0, c0, r1, c1) {
850
+ const ret = wasm.cellstore_rangeFullyLoaded(this.__wbg_ptr, sheet, r0, c0, r1, c1);
851
+ return ret !== 0;
852
+ }
853
+ /**
854
+ * Unique style ids present in a rectangle; cost stays inside WASM.
855
+ * @param {number} sheet
856
+ * @param {number} r0
857
+ * @param {number} c0
858
+ * @param {number} r1
859
+ * @param {number} c1
860
+ * @returns {Uint32Array}
861
+ */
862
+ rangeStyleIds(sheet, r0, c0, r1, c1) {
863
+ const ret = wasm.cellstore_rangeStyleIds(this.__wbg_ptr, sheet, r0, c0, r1, c1);
864
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
865
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
866
+ return v1;
867
+ }
868
+ /**
869
+ * Recompute formulas affected by cells changed since the last call.
870
+ *
871
+ * The pass first grows the dirty cell set through formula read-sets to find
872
+ * all dependent formulas. It then evaluates only those formulas, using a
873
+ * per-pass memo table to reuse formula results across dependent reads.
874
+ * @param {number} sheet
875
+ */
876
+ recompute(sheet) {
877
+ wasm.cellstore_recompute(this.__wbg_ptr, sheet);
878
+ }
879
+ /**
880
+ * Explicit volatile barrier. `serial` is a UTC spreadsheet serial using
881
+ * the 1899-12-30 epoch; only TODAY/NOW formulas and their dependents dirty.
882
+ * @param {number} serial
883
+ * @returns {boolean}
884
+ */
885
+ recomputeVolatile(serial) {
886
+ const ret = wasm.cellstore_recomputeVolatile(this.__wbg_ptr, serial);
887
+ return ret !== 0;
888
+ }
889
+ /**
890
+ * @param {number} sheet
891
+ * @param {number} row
892
+ * @param {number} col
893
+ * @returns {Uint32Array | undefined}
894
+ */
895
+ referenceTarget(sheet, row, col) {
896
+ const ret = wasm.cellstore_referenceTarget(this.__wbg_ptr, sheet, row, col);
897
+ let v1;
898
+ if (ret[0] !== 0) {
899
+ v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
900
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
901
+ }
902
+ return v1;
903
+ }
904
+ /**
905
+ * Return packed `[source_sheet, source_row, source_col, ...]` references
906
+ * targeting one sheet, bounded before crossing into the host.
907
+ * @param {number} target_sheet
908
+ * @param {number} max_entries
909
+ * @returns {Uint32Array | undefined}
910
+ */
911
+ referencesTargeting(target_sheet, max_entries) {
912
+ const ret = wasm.cellstore_referencesTargeting(this.__wbg_ptr, target_sheet, max_entries);
913
+ let v1;
914
+ if (ret[0] !== 0) {
915
+ v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
916
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
917
+ }
918
+ return v1;
919
+ }
920
+ /**
921
+ * Remap styles over a rectangle using parallel old/new id tables.
922
+ * @param {number} sheet
923
+ * @param {number} r0
924
+ * @param {number} c0
925
+ * @param {number} r1
926
+ * @param {number} c1
927
+ * @param {Uint32Array} old_ids
928
+ * @param {Uint32Array} new_ids
929
+ * @returns {boolean}
930
+ */
931
+ remapRangeStyles(sheet, r0, c0, r1, c1, old_ids, new_ids) {
932
+ const ptr0 = passArray32ToWasm0(old_ids, wasm.__wbindgen_malloc);
933
+ const len0 = WASM_VECTOR_LEN;
934
+ const ptr1 = passArray32ToWasm0(new_ids, wasm.__wbindgen_malloc);
935
+ const len1 = WASM_VECTOR_LEN;
936
+ const ret = wasm.cellstore_remapRangeStyles(this.__wbg_ptr, sheet, r0, c0, r1, c1, ptr0, len0, ptr1, len1);
937
+ return ret !== 0;
938
+ }
939
+ /**
940
+ * @param {number} sheet
941
+ * @param {number} at
942
+ * @param {number} count
943
+ */
944
+ removeCols(sheet, at, count) {
945
+ wasm.cellstore_removeCols(this.__wbg_ptr, sheet, at, count);
946
+ }
947
+ /**
948
+ * @param {string} name
949
+ * @param {number} scope
950
+ * @returns {boolean}
951
+ */
952
+ removeNamedRange(name, scope) {
953
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
954
+ const len0 = WASM_VECTOR_LEN;
955
+ const ret = wasm.cellstore_removeNamedRange(this.__wbg_ptr, ptr0, len0, scope);
956
+ return ret !== 0;
957
+ }
958
+ /**
959
+ * @param {number} sheet
960
+ * @param {number} at
961
+ * @param {number} count
962
+ */
963
+ removeRows(sheet, at, count) {
964
+ wasm.cellstore_removeRows(this.__wbg_ptr, sheet, at, count);
965
+ }
966
+ /**
967
+ * Tombstone a stable sheet handle and invalidate every formula reference to it.
968
+ * @param {number} sheet
969
+ * @returns {boolean}
970
+ */
971
+ removeSheet(sheet) {
972
+ const ret = wasm.cellstore_removeSheet(this.__wbg_ptr, sheet);
973
+ return ret !== 0;
974
+ }
975
+ /**
976
+ * @param {string} id
977
+ * @returns {boolean}
978
+ */
979
+ removeTable(id) {
980
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
981
+ const len0 = WASM_VECTOR_LEN;
982
+ const ret = wasm.cellstore_removeTable(this.__wbg_ptr, ptr0, len0);
983
+ return ret !== 0;
984
+ }
985
+ /**
986
+ * Rename a live stable sheet handle and rewrite every resolved formula AST reference.
987
+ * @param {number} sheet
988
+ * @param {string} id
989
+ * @param {string} name
990
+ * @returns {boolean}
991
+ */
992
+ renameSheet(sheet, id, name) {
993
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
994
+ const len0 = WASM_VECTOR_LEN;
995
+ const ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
996
+ const len1 = WASM_VECTOR_LEN;
997
+ const ret = wasm.cellstore_renameSheet(this.__wbg_ptr, sheet, ptr0, len0, ptr1, len1);
998
+ return ret !== 0;
999
+ }
1000
+ resetFormulaMatrixResourceStats() {
1001
+ wasm.cellstore_resetFormulaMatrixResourceStats(this.__wbg_ptr);
1002
+ }
1003
+ resetQueryResourceStats() {
1004
+ wasm.cellstore_resetQueryResourceStats(this.__wbg_ptr);
1005
+ }
1006
+ /**
1007
+ * Restore a captured block at a destination of the same dimensions.
1008
+ * @param {number} sheet
1009
+ * @param {number} r0
1010
+ * @param {number} c0
1011
+ * @param {RangeSnapshot} snapshot
1012
+ * @returns {boolean}
1013
+ */
1014
+ restoreRange(sheet, r0, c0, snapshot) {
1015
+ _assertClass(snapshot, RangeSnapshot);
1016
+ const ret = wasm.cellstore_restoreRange(this.__wbg_ptr, sheet, r0, c0, snapshot.__wbg_ptr);
1017
+ return ret !== 0;
1018
+ }
1019
+ /**
1020
+ * @param {number} sheet
1021
+ * @returns {number}
1022
+ */
1023
+ rowCount(sheet) {
1024
+ const ret = wasm.cellstore_rowCount(this.__wbg_ptr, sheet);
1025
+ return ret >>> 0;
1026
+ }
1027
+ /**
1028
+ * Cell coordinates whose text matches `query`, as a flat `[row, col, ...]`
1029
+ * list. Scans the requested columns column-major (cache-local), then sorts
1030
+ * row-major so search navigation runs top-to-bottom, left-to-right.
1031
+ * @param {number} sheet
1032
+ * @param {Uint32Array} cols
1033
+ * @param {string} query
1034
+ * @param {boolean} case_insensitive
1035
+ * @param {boolean} whole_cell
1036
+ * @returns {Uint32Array}
1037
+ */
1038
+ search(sheet, cols, query, case_insensitive, whole_cell) {
1039
+ const ptr0 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
1040
+ const len0 = WASM_VECTOR_LEN;
1041
+ const ptr1 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1042
+ const len1 = WASM_VECTOR_LEN;
1043
+ const ret = wasm.cellstore_search(this.__wbg_ptr, sheet, ptr0, len0, ptr1, len1, case_insensitive, whole_cell);
1044
+ var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1045
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1046
+ return v3;
1047
+ }
1048
+ /**
1049
+ * Atomically write one row-major mixed literal/formula/reference block
1050
+ * whose text payload arrives packed instead of once per cell.
1051
+ *
1052
+ * `text_buf` holds the UTF-8 bytes of every `KIND_STRING` cell of `kinds`
1053
+ * in cell-offset order. `text_offsets` carries their byte boundaries: the
1054
+ * n-th string cell owns `text_offsets[n]..text_offsets[n + 1]`, and the
1055
+ * last entry equals the buffer length, so a block without strings passes an
1056
+ * empty buffer and `&[0]`. Literal strings are interned in cell-offset order;
1057
+ * source-owned text slots are consumed without interning. The compact
1058
+ * status is `0` success, `1` invalid shape/bounds, `2` invalid or duplicate
1059
+ * source metadata, and `3` paged dirty-capacity rejection.
1060
+ * @param {number} sheet
1061
+ * @param {number} start_row
1062
+ * @param {number} start_col
1063
+ * @param {number} rows
1064
+ * @param {number} cols
1065
+ * @param {Uint8Array} kinds
1066
+ * @param {Float64Array} numbers
1067
+ * @param {Uint8Array} text_buf
1068
+ * @param {Uint32Array} text_offsets
1069
+ * @param {Uint32Array} styles
1070
+ * @param {Uint32Array} formula_offsets
1071
+ * @param {string[]} formula_sources
1072
+ * @param {Uint32Array} reference_offsets
1073
+ * @param {Uint32Array} reference_targets
1074
+ * @returns {number}
1075
+ */
1076
+ setBlockPacked(sheet, start_row, start_col, rows, cols, kinds, numbers, text_buf, text_offsets, styles, formula_offsets, formula_sources, reference_offsets, reference_targets) {
1077
+ const ptr0 = passArray8ToWasm0(kinds, wasm.__wbindgen_malloc);
1078
+ const len0 = WASM_VECTOR_LEN;
1079
+ const ptr1 = passArrayF64ToWasm0(numbers, wasm.__wbindgen_malloc);
1080
+ const len1 = WASM_VECTOR_LEN;
1081
+ const ptr2 = passArray8ToWasm0(text_buf, wasm.__wbindgen_malloc);
1082
+ const len2 = WASM_VECTOR_LEN;
1083
+ const ptr3 = passArray32ToWasm0(text_offsets, wasm.__wbindgen_malloc);
1084
+ const len3 = WASM_VECTOR_LEN;
1085
+ const ptr4 = passArray32ToWasm0(styles, wasm.__wbindgen_malloc);
1086
+ const len4 = WASM_VECTOR_LEN;
1087
+ const ptr5 = passArray32ToWasm0(formula_offsets, wasm.__wbindgen_malloc);
1088
+ const len5 = WASM_VECTOR_LEN;
1089
+ const ptr6 = passArrayJsValueToWasm0(formula_sources, wasm.__wbindgen_malloc);
1090
+ const len6 = WASM_VECTOR_LEN;
1091
+ const ptr7 = passArray32ToWasm0(reference_offsets, wasm.__wbindgen_malloc);
1092
+ const len7 = WASM_VECTOR_LEN;
1093
+ const ptr8 = passArray32ToWasm0(reference_targets, wasm.__wbindgen_malloc);
1094
+ const len8 = WASM_VECTOR_LEN;
1095
+ const ret = wasm.cellstore_setBlockPacked(this.__wbg_ptr, sheet, start_row, start_col, rows, cols, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8);
1096
+ return ret >>> 0;
1097
+ }
1098
+ /**
1099
+ * @param {number} sheet
1100
+ * @param {number} row
1101
+ * @param {number} col
1102
+ * @param {boolean} value
1103
+ * @param {number} style
1104
+ */
1105
+ setBool(sheet, row, col, value, style) {
1106
+ wasm.cellstore_setBool(this.__wbg_ptr, sheet, row, col, value, style);
1107
+ }
1108
+ /**
1109
+ * Atomically write one column-major mixed literal/formula/reference block
1110
+ * whose text payload arrives packed.
1111
+ *
1112
+ * This is [`Self::set_block_packed`] with the flat input arrays in the
1113
+ * store's own column-major order: cell `(row, col)` sits at
1114
+ * `col * rows + row`, so a columnar import can fill them column by column.
1115
+ * Text packing, source metadata and every status code behave exactly as in
1116
+ * [`Self::set_block_packed`].
1117
+ * @param {number} sheet
1118
+ * @param {number} start_row
1119
+ * @param {number} start_col
1120
+ * @param {number} rows
1121
+ * @param {number} cols
1122
+ * @param {Uint8Array} kinds
1123
+ * @param {Float64Array} numbers
1124
+ * @param {Uint8Array} text_buf
1125
+ * @param {Uint32Array} text_offsets
1126
+ * @param {Uint32Array} styles
1127
+ * @param {Uint32Array} formula_offsets
1128
+ * @param {string[]} formula_sources
1129
+ * @param {Uint32Array} reference_offsets
1130
+ * @param {Uint32Array} reference_targets
1131
+ * @returns {number}
1132
+ */
1133
+ setColumnBlockPacked(sheet, start_row, start_col, rows, cols, kinds, numbers, text_buf, text_offsets, styles, formula_offsets, formula_sources, reference_offsets, reference_targets) {
1134
+ const ptr0 = passArray8ToWasm0(kinds, wasm.__wbindgen_malloc);
1135
+ const len0 = WASM_VECTOR_LEN;
1136
+ const ptr1 = passArrayF64ToWasm0(numbers, wasm.__wbindgen_malloc);
1137
+ const len1 = WASM_VECTOR_LEN;
1138
+ const ptr2 = passArray8ToWasm0(text_buf, wasm.__wbindgen_malloc);
1139
+ const len2 = WASM_VECTOR_LEN;
1140
+ const ptr3 = passArray32ToWasm0(text_offsets, wasm.__wbindgen_malloc);
1141
+ const len3 = WASM_VECTOR_LEN;
1142
+ const ptr4 = passArray32ToWasm0(styles, wasm.__wbindgen_malloc);
1143
+ const len4 = WASM_VECTOR_LEN;
1144
+ const ptr5 = passArray32ToWasm0(formula_offsets, wasm.__wbindgen_malloc);
1145
+ const len5 = WASM_VECTOR_LEN;
1146
+ const ptr6 = passArrayJsValueToWasm0(formula_sources, wasm.__wbindgen_malloc);
1147
+ const len6 = WASM_VECTOR_LEN;
1148
+ const ptr7 = passArray32ToWasm0(reference_offsets, wasm.__wbindgen_malloc);
1149
+ const len7 = WASM_VECTOR_LEN;
1150
+ const ptr8 = passArray32ToWasm0(reference_targets, wasm.__wbindgen_malloc);
1151
+ const len8 = WASM_VECTOR_LEN;
1152
+ const ret = wasm.cellstore_setColumnBlockPacked(this.__wbg_ptr, sheet, start_row, start_col, rows, cols, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8);
1153
+ return ret >>> 0;
1154
+ }
1155
+ /**
1156
+ * Bulk-load one column with numbers starting at `start_row`.
1157
+ * @param {number} sheet
1158
+ * @param {number} col
1159
+ * @param {number} start_row
1160
+ * @param {Float64Array} values
1161
+ * @param {number} style
1162
+ */
1163
+ setColumnNumbers(sheet, col, start_row, values, style) {
1164
+ const ptr0 = passArrayF64ToWasm0(values, wasm.__wbindgen_malloc);
1165
+ const len0 = WASM_VECTOR_LEN;
1166
+ wasm.cellstore_setColumnNumbers(this.__wbg_ptr, sheet, col, start_row, ptr0, len0, style);
1167
+ }
1168
+ /**
1169
+ * Bulk-load one column with strings starting at `start_row`.
1170
+ * @param {number} sheet
1171
+ * @param {number} col
1172
+ * @param {number} start_row
1173
+ * @param {string[]} values
1174
+ * @param {number} style
1175
+ */
1176
+ setColumnStrings(sheet, col, start_row, values, style) {
1177
+ const ptr0 = passArrayJsValueToWasm0(values, wasm.__wbindgen_malloc);
1178
+ const len0 = WASM_VECTOR_LEN;
1179
+ wasm.cellstore_setColumnStrings(this.__wbg_ptr, sheet, col, start_row, ptr0, len0, style);
1180
+ }
1181
+ /**
1182
+ * Bulk-load one column of strings from a single concatenated buffer plus
1183
+ * per-row lengths in UTF-16 code units (the JS `string.length` unit).
1184
+ * One boundary decode and one Rust allocation for the whole column,
1185
+ * instead of one per row — the dominant ingest cost for text columns.
1186
+ * @param {number} sheet
1187
+ * @param {number} col
1188
+ * @param {number} start_row
1189
+ * @param {string} buf
1190
+ * @param {Uint32Array} utf16_lens
1191
+ * @param {number} style
1192
+ */
1193
+ setColumnStringsPacked(sheet, col, start_row, buf, utf16_lens, style) {
1194
+ const ptr0 = passStringToWasm0(buf, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1195
+ const len0 = WASM_VECTOR_LEN;
1196
+ const ptr1 = passArray32ToWasm0(utf16_lens, wasm.__wbindgen_malloc);
1197
+ const len1 = WASM_VECTOR_LEN;
1198
+ wasm.cellstore_setColumnStringsPacked(this.__wbg_ptr, sheet, col, start_row, ptr0, len0, ptr1, len1, style);
1199
+ }
1200
+ /**
1201
+ * Replace a sheet's conditional-format rules. Packed columnar encoding,
1202
+ * one entry per rule: `kinds` 0 gt / 1 lt / 2 eqNum / 3 eqStr / 4 eqEmpty /
1203
+ * 5 contains / 6 boolean formula; `bounds` = normalized `[r0, c0, r1, c1]`
1204
+ * per rule; `nums` carries the numeric operand; `strs` the text/formula
1205
+ * operand; `flags` bit 0 = match-case for `contains`, bit 1 = stop-if-true.
1206
+ * Formula strings are parsed once here, never once per visible cell.
1207
+ * @param {number} sheet
1208
+ * @param {Uint8Array} kinds
1209
+ * @param {Uint32Array} bounds
1210
+ * @param {Float64Array} nums
1211
+ * @param {string[]} strs
1212
+ * @param {Uint8Array} flags
1213
+ */
1214
+ setConditionalRules(sheet, kinds, bounds, nums, strs, flags) {
1215
+ const ptr0 = passArray8ToWasm0(kinds, wasm.__wbindgen_malloc);
1216
+ const len0 = WASM_VECTOR_LEN;
1217
+ const ptr1 = passArray32ToWasm0(bounds, wasm.__wbindgen_malloc);
1218
+ const len1 = WASM_VECTOR_LEN;
1219
+ const ptr2 = passArrayF64ToWasm0(nums, wasm.__wbindgen_malloc);
1220
+ const len2 = WASM_VECTOR_LEN;
1221
+ const ptr3 = passArrayJsValueToWasm0(strs, wasm.__wbindgen_malloc);
1222
+ const len3 = WASM_VECTOR_LEN;
1223
+ const ptr4 = passArray8ToWasm0(flags, wasm.__wbindgen_malloc);
1224
+ const len4 = WASM_VECTOR_LEN;
1225
+ wasm.cellstore_setConditionalRules(this.__wbg_ptr, sheet, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
1226
+ }
1227
+ /**
1228
+ * Parse and store a formula at `(row, col)`.
1229
+ *
1230
+ * Setters only mark cells dirty; they do not recompute formulas. The host
1231
+ * calls `recompute(sheet)` once at the transaction barrier so a multi-cell
1232
+ * edit performs one dependency-scoped pass instead of one full-sheet pass
1233
+ * per setter. A successful parse returns the pre-write cached scalar; a
1234
+ * parse rejection returns `0.0`, and a rejected write returns `NaN`.
1235
+ *
1236
+ * The dependency index is invalidated only when the rewrite changes what
1237
+ * the formula reads or whether it produces an array. A constant-only edit
1238
+ * keeps the cached index, so its next recompute visits just the edited
1239
+ * formula and its dependents instead of every formula in the workbook.
1240
+ * @param {number} sheet
1241
+ * @param {number} row
1242
+ * @param {number} col
1243
+ * @param {string} src
1244
+ * @param {number} style
1245
+ * @returns {number}
1246
+ */
1247
+ setFormula(sheet, row, col, src, style) {
1248
+ const ptr0 = passStringToWasm0(src, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1249
+ const len0 = WASM_VECTOR_LEN;
1250
+ const ret = wasm.cellstore_setFormula(this.__wbg_ptr, sheet, row, col, ptr0, len0, style);
1251
+ return ret;
1252
+ }
1253
+ /**
1254
+ * @param {string} name
1255
+ * @param {number} scope
1256
+ * @param {number} sheet
1257
+ * @param {number} row_start
1258
+ * @param {number} col_start
1259
+ * @param {number} row_end
1260
+ * @param {number} col_end
1261
+ * @returns {boolean}
1262
+ */
1263
+ setNamedRange(name, scope, sheet, row_start, col_start, row_end, col_end) {
1264
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1265
+ const len0 = WASM_VECTOR_LEN;
1266
+ const ret = wasm.cellstore_setNamedRange(this.__wbg_ptr, ptr0, len0, scope, sheet, row_start, col_start, row_end, col_end);
1267
+ return ret !== 0;
1268
+ }
1269
+ /**
1270
+ * @param {number} sheet
1271
+ * @param {number} row
1272
+ * @param {number} col
1273
+ * @param {number} value
1274
+ * @param {number} style
1275
+ */
1276
+ setNumber(sheet, row, col, value, style) {
1277
+ wasm.cellstore_setNumber(this.__wbg_ptr, sheet, row, col, value, style);
1278
+ }
1279
+ /**
1280
+ * @param {number} sheet
1281
+ * @param {string} id
1282
+ * @param {string} name
1283
+ */
1284
+ setSheetName(sheet, id, name) {
1285
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1286
+ const len0 = WASM_VECTOR_LEN;
1287
+ const ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1288
+ const len1 = WASM_VECTOR_LEN;
1289
+ wasm.cellstore_setSheetName(this.__wbg_ptr, sheet, ptr0, len0, ptr1, len1);
1290
+ }
1291
+ /**
1292
+ * Write one sparse mixed transaction/page/snapshot block without
1293
+ * allocating by logical rectangle size. Inside `beginPageLoad`, dirty
1294
+ * paged cells are skipped; otherwise the whole sparse write is preflighted.
1295
+ * @param {number} sheet
1296
+ * @param {number} start_row
1297
+ * @param {number} start_col
1298
+ * @param {number} rows
1299
+ * @param {number} cols
1300
+ * @param {Uint32Array} offsets
1301
+ * @param {Uint8Array} kinds
1302
+ * @param {Float64Array} numbers
1303
+ * @param {string[]} texts
1304
+ * @param {Uint32Array} styles
1305
+ * @param {Uint32Array} formula_offsets
1306
+ * @param {string[]} formula_sources
1307
+ * @param {Uint32Array} reference_offsets
1308
+ * @param {Uint32Array} reference_targets
1309
+ * @returns {number}
1310
+ */
1311
+ setSparseBlock(sheet, start_row, start_col, rows, cols, offsets, kinds, numbers, texts, styles, formula_offsets, formula_sources, reference_offsets, reference_targets) {
1312
+ const ptr0 = passArray32ToWasm0(offsets, wasm.__wbindgen_malloc);
1313
+ const len0 = WASM_VECTOR_LEN;
1314
+ const ptr1 = passArray8ToWasm0(kinds, wasm.__wbindgen_malloc);
1315
+ const len1 = WASM_VECTOR_LEN;
1316
+ const ptr2 = passArrayF64ToWasm0(numbers, wasm.__wbindgen_malloc);
1317
+ const len2 = WASM_VECTOR_LEN;
1318
+ const ptr3 = passArrayJsValueToWasm0(texts, wasm.__wbindgen_malloc);
1319
+ const len3 = WASM_VECTOR_LEN;
1320
+ const ptr4 = passArray32ToWasm0(styles, wasm.__wbindgen_malloc);
1321
+ const len4 = WASM_VECTOR_LEN;
1322
+ const ptr5 = passArray32ToWasm0(formula_offsets, wasm.__wbindgen_malloc);
1323
+ const len5 = WASM_VECTOR_LEN;
1324
+ const ptr6 = passArrayJsValueToWasm0(formula_sources, wasm.__wbindgen_malloc);
1325
+ const len6 = WASM_VECTOR_LEN;
1326
+ const ptr7 = passArray32ToWasm0(reference_offsets, wasm.__wbindgen_malloc);
1327
+ const len7 = WASM_VECTOR_LEN;
1328
+ const ptr8 = passArray32ToWasm0(reference_targets, wasm.__wbindgen_malloc);
1329
+ const len8 = WASM_VECTOR_LEN;
1330
+ const ret = wasm.cellstore_setSparseBlock(this.__wbg_ptr, sheet, start_row, start_col, rows, cols, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6, ptr7, len7, ptr8, len8);
1331
+ return ret >>> 0;
1332
+ }
1333
+ /**
1334
+ * Replace the host-owned merge/protection collision ranges. Packed as
1335
+ * `[row_start, col_start, row_end, col_end, ...]`; invalid input fails
1336
+ * without weakening the old gate.
1337
+ * @param {number} sheet
1338
+ * @param {Uint32Array} bounds
1339
+ * @returns {boolean}
1340
+ */
1341
+ setSpillBlockers(sheet, bounds) {
1342
+ const ptr0 = passArray32ToWasm0(bounds, wasm.__wbindgen_malloc);
1343
+ const len0 = WASM_VECTOR_LEN;
1344
+ const ret = wasm.cellstore_setSpillBlockers(this.__wbg_ptr, sheet, ptr0, len0);
1345
+ return ret !== 0;
1346
+ }
1347
+ /**
1348
+ * @param {number} sheet
1349
+ * @param {number} row
1350
+ * @param {number} col
1351
+ * @param {string} value
1352
+ * @param {number} style
1353
+ */
1354
+ setString(sheet, row, col, value, style) {
1355
+ const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1356
+ const len0 = WASM_VECTOR_LEN;
1357
+ wasm.cellstore_setString(this.__wbg_ptr, sheet, row, col, ptr0, len0, style);
1358
+ }
1359
+ /**
1360
+ * @param {string} id
1361
+ * @param {string} name
1362
+ * @param {number} sheet
1363
+ * @param {number} row_start
1364
+ * @param {number} col_start
1365
+ * @param {number} row_end
1366
+ * @param {number} col_end
1367
+ * @param {boolean} header_row
1368
+ * @param {boolean} totals_row
1369
+ * @param {string[]} column_ids
1370
+ * @param {string[]} column_names
1371
+ * @returns {boolean}
1372
+ */
1373
+ setTable(id, name, sheet, row_start, col_start, row_end, col_end, header_row, totals_row, column_ids, column_names) {
1374
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1375
+ const len0 = WASM_VECTOR_LEN;
1376
+ const ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1377
+ const len1 = WASM_VECTOR_LEN;
1378
+ const ptr2 = passArrayJsValueToWasm0(column_ids, wasm.__wbindgen_malloc);
1379
+ const len2 = WASM_VECTOR_LEN;
1380
+ const ptr3 = passArrayJsValueToWasm0(column_names, wasm.__wbindgen_malloc);
1381
+ const len3 = WASM_VECTOR_LEN;
1382
+ const ret = wasm.cellstore_setTable(this.__wbg_ptr, ptr0, len0, ptr1, len1, sheet, row_start, col_start, row_end, col_end, header_row, totals_row, ptr2, len2, ptr3, len3);
1383
+ return ret !== 0;
1384
+ }
1385
+ /**
1386
+ * @param {RangeSnapshot} snapshot
1387
+ * @returns {Float64Array}
1388
+ */
1389
+ snapshotNumbers(snapshot) {
1390
+ _assertClass(snapshot, RangeSnapshot);
1391
+ const ret = wasm.cellstore_snapshotNumbers(this.__wbg_ptr, snapshot.__wbg_ptr);
1392
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1393
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1394
+ return v1;
1395
+ }
1396
+ /**
1397
+ * @param {RangeSnapshot} snapshot
1398
+ * @returns {string[]}
1399
+ */
1400
+ snapshotTexts(snapshot) {
1401
+ _assertClass(snapshot, RangeSnapshot);
1402
+ const ret = wasm.cellstore_snapshotTexts(this.__wbg_ptr, snapshot.__wbg_ptr);
1403
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1404
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1405
+ return v1;
1406
+ }
1407
+ /**
1408
+ * Stable row order sorted by a column. Returns a data-row permutation.
1409
+ * @param {number} sheet
1410
+ * @param {number} col
1411
+ * @param {boolean} ascending
1412
+ * @returns {Uint32Array}
1413
+ */
1414
+ sortRows(sheet, col, ascending) {
1415
+ const ret = wasm.cellstore_sortRows(this.__wbg_ptr, sheet, col, ascending);
1416
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1417
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1418
+ return v1;
1419
+ }
1420
+ /**
1421
+ * @param {number} sheet
1422
+ * @param {Uint32Array} cols
1423
+ * @param {Uint8Array} ascending
1424
+ * @param {Uint32Array} candidates
1425
+ * @returns {Uint32Array}
1426
+ */
1427
+ sortRowsMulti(sheet, cols, ascending, candidates) {
1428
+ const ptr0 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
1429
+ const len0 = WASM_VECTOR_LEN;
1430
+ const ptr1 = passArray8ToWasm0(ascending, wasm.__wbindgen_malloc);
1431
+ const len1 = WASM_VECTOR_LEN;
1432
+ const ptr2 = passArray32ToWasm0(candidates, wasm.__wbindgen_malloc);
1433
+ const len2 = WASM_VECTOR_LEN;
1434
+ const ret = wasm.cellstore_sortRowsMulti(this.__wbg_ptr, sheet, ptr0, len0, ptr1, len1, ptr2, len2);
1435
+ var v4 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1436
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1437
+ return v4;
1438
+ }
1439
+ /**
1440
+ * @param {number} sheet
1441
+ * @param {number} row
1442
+ * @param {number} col
1443
+ * @returns {number}
1444
+ */
1445
+ spillAnchorCol(sheet, row, col) {
1446
+ const ret = wasm.cellstore_spillAnchorCol(this.__wbg_ptr, sheet, row, col);
1447
+ return ret >>> 0;
1448
+ }
1449
+ /**
1450
+ * Stable spill owner coordinate, or `u32::MAX` when `cell` is not part of
1451
+ * a materialized spill.
1452
+ * @param {number} sheet
1453
+ * @param {number} row
1454
+ * @param {number} col
1455
+ * @returns {number}
1456
+ */
1457
+ spillAnchorRow(sheet, row, col) {
1458
+ const ret = wasm.cellstore_spillAnchorRow(this.__wbg_ptr, sheet, row, col);
1459
+ return ret >>> 0;
1460
+ }
1461
+ /**
1462
+ * Row-major mask aligned with render-window layout; `1` marks a derived
1463
+ * spill cell and deliberately excludes the anchor.
1464
+ * @param {number} sheet
1465
+ * @param {number} row_start
1466
+ * @param {number} row_end
1467
+ * @param {Uint32Array} cols
1468
+ * @returns {Uint8Array}
1469
+ */
1470
+ spillDerivedMask(sheet, row_start, row_end, cols) {
1471
+ const ptr0 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
1472
+ const len0 = WASM_VECTOR_LEN;
1473
+ const ret = wasm.cellstore_spillDerivedMask(this.__wbg_ptr, sheet, row_start, row_end, ptr0, len0);
1474
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1475
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1476
+ return v2;
1477
+ }
1478
+ /**
1479
+ * Packed row-major `[anchor_row, anchor_col, ...]` owner coordinates.
1480
+ * @param {number} sheet
1481
+ * @param {number} row_start
1482
+ * @param {number} row_end
1483
+ * @param {Uint32Array} cols
1484
+ * @returns {Uint32Array}
1485
+ */
1486
+ spillOwnerCoordinates(sheet, row_start, row_end, cols) {
1487
+ const ptr0 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
1488
+ const len0 = WASM_VECTOR_LEN;
1489
+ const ret = wasm.cellstore_spillOwnerCoordinates(this.__wbg_ptr, sheet, row_start, row_end, ptr0, len0);
1490
+ var v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1491
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1492
+ return v2;
1493
+ }
1494
+ /**
1495
+ * Raw string IDs are valid only within this epoch, including window IDs.
1496
+ * @returns {number}
1497
+ */
1498
+ stringPoolEpoch() {
1499
+ const ret = wasm.cellstore_stringPoolEpoch(this.__wbg_ptr);
1500
+ return ret >>> 0;
1501
+ }
1502
+ /**
1503
+ * Current style-dictionary id at a cell; `0` when out of bounds. Used by
1504
+ * the host to write derived (reference-shadow) values without disturbing
1505
+ * the cell's style.
1506
+ * @param {number} sheet
1507
+ * @param {number} row
1508
+ * @param {number} col
1509
+ * @returns {number}
1510
+ */
1511
+ styleIdAt(sheet, row, col) {
1512
+ const ret = wasm.cellstore_styleIdAt(this.__wbg_ptr, sheet, row, col);
1513
+ return ret >>> 0;
1514
+ }
1515
+ /**
1516
+ * @returns {number}
1517
+ */
1518
+ wasmCommittedBytes() {
1519
+ const ret = wasm.cellstore_wasmCommittedBytes(this.__wbg_ptr);
1520
+ return ret >>> 0;
1521
+ }
1522
+ }
1523
+ if (Symbol.dispose) CellStore.prototype[Symbol.dispose] = CellStore.prototype.free;
1524
+
1525
+ /**
1526
+ * Distinct-value scan result for one column: parallel kind/number/text
1527
+ * arrays whose buffers are surrendered once through the `take*` accessors.
1528
+ */
1529
+ class DistinctColumn {
1530
+ static __wrap(ptr) {
1531
+ const obj = Object.create(DistinctColumn.prototype);
1532
+ obj.__wbg_ptr = ptr;
1533
+ DistinctColumnFinalization.register(obj, obj.__wbg_ptr, obj);
1534
+ return obj;
1535
+ }
1536
+ __destroy_into_raw() {
1537
+ const ptr = this.__wbg_ptr;
1538
+ this.__wbg_ptr = 0;
1539
+ DistinctColumnFinalization.unregister(this);
1540
+ return ptr;
1541
+ }
1542
+ free() {
1543
+ const ptr = this.__destroy_into_raw();
1544
+ wasm.__wbg_distinctcolumn_free(ptr, 0);
1545
+ }
1546
+ /**
1547
+ * Surrenders the per-value kind tags (number/string/boolean codes); the
1548
+ * column keeps an empty buffer afterwards.
1549
+ * @returns {Uint8Array}
1550
+ */
1551
+ takeKinds() {
1552
+ const ret = wasm.distinctcolumn_takeKinds(this.__wbg_ptr);
1553
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1554
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1555
+ return v1;
1556
+ }
1557
+ /**
1558
+ * Surrenders the numeric values aligned with the `takeKinds` tags.
1559
+ * @returns {Float64Array}
1560
+ */
1561
+ takeNumbers() {
1562
+ const ret = wasm.distinctcolumn_takeNumbers(this.__wbg_ptr);
1563
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1564
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1565
+ return v1;
1566
+ }
1567
+ /**
1568
+ * Surrenders the distinct strings aligned with the `takeKinds` tags.
1569
+ * @returns {string[]}
1570
+ */
1571
+ takeTexts() {
1572
+ const ret = wasm.distinctcolumn_takeTexts(this.__wbg_ptr);
1573
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1574
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1575
+ return v1;
1576
+ }
1577
+ }
1578
+ if (Symbol.dispose) DistinctColumn.prototype[Symbol.dispose] = DistinctColumn.prototype.free;
1579
+
1580
+ /**
1581
+ * Opaque, store-local history payload for one dense rectangular cell block.
1582
+ *
1583
+ * The host may retain this object in undo history, but it is deliberately not
1584
+ * part of the serialized document protocol. A deduplicated local dictionary
1585
+ * owns captured text independently of the store's pool epoch.
1586
+ */
1587
+ class RangeSnapshot {
1588
+ static __wrap(ptr) {
1589
+ const obj = Object.create(RangeSnapshot.prototype);
1590
+ obj.__wbg_ptr = ptr;
1591
+ RangeSnapshotFinalization.register(obj, obj.__wbg_ptr, obj);
1592
+ return obj;
1593
+ }
1594
+ __destroy_into_raw() {
1595
+ const ptr = this.__wbg_ptr;
1596
+ this.__wbg_ptr = 0;
1597
+ RangeSnapshotFinalization.unregister(this);
1598
+ return ptr;
1599
+ }
1600
+ free() {
1601
+ const ptr = this.__destroy_into_raw();
1602
+ wasm.__wbg_rangesnapshot_free(ptr, 0);
1603
+ }
1604
+ /**
1605
+ * @returns {number}
1606
+ */
1607
+ byteLength() {
1608
+ const ret = wasm.rangesnapshot_byteLength(this.__wbg_ptr);
1609
+ return ret >>> 0;
1610
+ }
1611
+ /**
1612
+ * Transfer packed scalars and the local dictionary, never JS cell patches.
1613
+ * @param {number} sheet
1614
+ * @returns {Uint8Array}
1615
+ */
1616
+ exportMemoryState(sheet) {
1617
+ const ret = wasm.rangesnapshot_exportMemoryState(this.__wbg_ptr, sheet);
1618
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1619
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1620
+ return v1;
1621
+ }
1622
+ /**
1623
+ * @returns {Uint32Array}
1624
+ */
1625
+ formulaOffsets() {
1626
+ const ret = wasm.rangesnapshot_formulaOffsets(this.__wbg_ptr);
1627
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1628
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1629
+ return v1;
1630
+ }
1631
+ /**
1632
+ * @returns {string[]}
1633
+ */
1634
+ formulaSources() {
1635
+ const ret = wasm.rangesnapshot_formulaSources(this.__wbg_ptr);
1636
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1637
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1638
+ return v1;
1639
+ }
1640
+ /**
1641
+ * @returns {Uint8Array}
1642
+ */
1643
+ kinds() {
1644
+ const ret = wasm.rangesnapshot_kinds(this.__wbg_ptr);
1645
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1646
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1647
+ return v1;
1648
+ }
1649
+ /**
1650
+ * @returns {Uint32Array}
1651
+ */
1652
+ referenceOffsets() {
1653
+ const ret = wasm.rangesnapshot_referenceOffsets(this.__wbg_ptr);
1654
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1655
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1656
+ return v1;
1657
+ }
1658
+ /**
1659
+ * @returns {Uint32Array}
1660
+ */
1661
+ referenceTargets() {
1662
+ const ret = wasm.rangesnapshot_referenceTargets(this.__wbg_ptr);
1663
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1664
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1665
+ return v1;
1666
+ }
1667
+ /**
1668
+ * @returns {Uint32Array}
1669
+ */
1670
+ styleIds() {
1671
+ const ret = wasm.rangesnapshot_styleIds(this.__wbg_ptr);
1672
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1673
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1674
+ return v1;
1675
+ }
1676
+ }
1677
+ if (Symbol.dispose) RangeSnapshot.prototype[Symbol.dispose] = RangeSnapshot.prototype.free;
1678
+
1679
+ /**
1680
+ * Compact serializable projection of persisted derived-cell sources and spill
1681
+ * identity in one range. Offsets are row-major and sorted; reference targets
1682
+ * are packed `[sheet_handle, row, col]` triples.
1683
+ */
1684
+ class SourceSnapshot {
1685
+ static __wrap(ptr) {
1686
+ const obj = Object.create(SourceSnapshot.prototype);
1687
+ obj.__wbg_ptr = ptr;
1688
+ SourceSnapshotFinalization.register(obj, obj.__wbg_ptr, obj);
1689
+ return obj;
1690
+ }
1691
+ __destroy_into_raw() {
1692
+ const ptr = this.__wbg_ptr;
1693
+ this.__wbg_ptr = 0;
1694
+ SourceSnapshotFinalization.unregister(this);
1695
+ return ptr;
1696
+ }
1697
+ free() {
1698
+ const ptr = this.__destroy_into_raw();
1699
+ wasm.__wbg_sourcesnapshot_free(ptr, 0);
1700
+ }
1701
+ /**
1702
+ * @returns {number}
1703
+ */
1704
+ byteLength() {
1705
+ const ret = wasm.sourcesnapshot_byteLength(this.__wbg_ptr);
1706
+ return ret >>> 0;
1707
+ }
1708
+ /**
1709
+ * @returns {Uint32Array}
1710
+ */
1711
+ formulaOffsets() {
1712
+ const ret = wasm.sourcesnapshot_formulaOffsets(this.__wbg_ptr);
1713
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1714
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1715
+ return v1;
1716
+ }
1717
+ /**
1718
+ * @returns {string[]}
1719
+ */
1720
+ formulaSources() {
1721
+ const ret = wasm.sourcesnapshot_formulaSources(this.__wbg_ptr);
1722
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1723
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1724
+ return v1;
1725
+ }
1726
+ /**
1727
+ * @returns {Uint32Array}
1728
+ */
1729
+ referenceOffsets() {
1730
+ const ret = wasm.sourcesnapshot_referenceOffsets(this.__wbg_ptr);
1731
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1732
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1733
+ return v1;
1734
+ }
1735
+ /**
1736
+ * @returns {Uint32Array}
1737
+ */
1738
+ referenceTargets() {
1739
+ const ret = wasm.sourcesnapshot_referenceTargets(this.__wbg_ptr);
1740
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1741
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1742
+ return v1;
1743
+ }
1744
+ /**
1745
+ * @returns {Uint8Array}
1746
+ */
1747
+ spillDerived() {
1748
+ const ret = wasm.sourcesnapshot_spillDerived(this.__wbg_ptr);
1749
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1750
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1751
+ return v1;
1752
+ }
1753
+ }
1754
+ if (Symbol.dispose) SourceSnapshot.prototype[Symbol.dispose] = SourceSnapshot.prototype.free;
1755
+
1756
+ /**
1757
+ * A bulk window of resolved cells, row-major over `n_rows x n_cols`.
1758
+ */
1759
+ class WindowView {
1760
+ static __wrap(ptr) {
1761
+ const obj = Object.create(WindowView.prototype);
1762
+ obj.__wbg_ptr = ptr;
1763
+ WindowViewFinalization.register(obj, obj.__wbg_ptr, obj);
1764
+ return obj;
1765
+ }
1766
+ __destroy_into_raw() {
1767
+ const ptr = this.__wbg_ptr;
1768
+ this.__wbg_ptr = 0;
1769
+ WindowViewFinalization.unregister(this);
1770
+ return ptr;
1771
+ }
1772
+ free() {
1773
+ const ptr = this.__destroy_into_raw();
1774
+ wasm.__wbg_windowview_free(ptr, 0);
1775
+ }
1776
+ /**
1777
+ * @returns {number}
1778
+ */
1779
+ get nCols() {
1780
+ const ret = wasm.windowview_nCols(this.__wbg_ptr);
1781
+ return ret >>> 0;
1782
+ }
1783
+ /**
1784
+ * @returns {number}
1785
+ */
1786
+ get nRows() {
1787
+ const ret = wasm.windowview_nRows(this.__wbg_ptr);
1788
+ return ret >>> 0;
1789
+ }
1790
+ /**
1791
+ * @returns {number}
1792
+ */
1793
+ stringPoolEpoch() {
1794
+ const ret = wasm.windowview_stringPoolEpoch(this.__wbg_ptr);
1795
+ return ret >>> 0;
1796
+ }
1797
+ /**
1798
+ * Consume the complete fixed-width window payload. The returned
1799
+ * `Uint8Array` is copied by wasm-bindgen into JS-owned memory.
1800
+ * @returns {Uint8Array}
1801
+ */
1802
+ takePacked() {
1803
+ const ret = wasm.windowview_takePacked(this.__wbg_ptr);
1804
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1805
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1806
+ return v1;
1807
+ }
1808
+ /**
1809
+ * Consume formula-error sentinel strings referenced by the packed data.
1810
+ * @returns {string[]}
1811
+ */
1812
+ takeStrings() {
1813
+ const ret = wasm.windowview_takeStrings(this.__wbg_ptr);
1814
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1815
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1816
+ return v1;
1817
+ }
1818
+ }
1819
+ if (Symbol.dispose) WindowView.prototype[Symbol.dispose] = WindowView.prototype.free;
1820
+ function __wbg_get_imports() {
1821
+ const import0 = {
1822
+ __proto__: null,
1823
+ __wbg___wbindgen_string_get_71bb4348194e31f0: function(arg0, arg1) {
1824
+ const obj = arg1;
1825
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1826
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1827
+ var len1 = WASM_VECTOR_LEN;
1828
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1829
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1830
+ },
1831
+ __wbg___wbindgen_throw_ea4887a5f8f9a9db: function(arg0, arg1) {
1832
+ throw new Error(getStringFromWasm0(arg0, arg1));
1833
+ },
1834
+ __wbg_length_589238bdcf171f0e: function(arg0) {
1835
+ const ret = arg0.length;
1836
+ return ret;
1837
+ },
1838
+ __wbg_prototypesetcall_d721637c7ca66eb8: function(arg0, arg1, arg2) {
1839
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1840
+ },
1841
+ __wbg_subarray_b0e8ac4ed313fea8: function(arg0, arg1, arg2) {
1842
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
1843
+ return ret;
1844
+ },
1845
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1846
+ // Cast intrinsic for `Ref(String) -> Externref`.
1847
+ const ret = getStringFromWasm0(arg0, arg1);
1848
+ return ret;
1849
+ },
1850
+ __wbindgen_init_externref_table: function() {
1851
+ const table = wasm.__wbindgen_externrefs;
1852
+ const offset = table.grow(4);
1853
+ table.set(0, undefined);
1854
+ table.set(offset + 0, undefined);
1855
+ table.set(offset + 1, null);
1856
+ table.set(offset + 2, true);
1857
+ table.set(offset + 3, false);
1858
+ },
1859
+ };
1860
+ return {
1861
+ __proto__: null,
1862
+ "./sheetwrite_wasm_bg.js": import0,
1863
+ };
1864
+ }
1865
+
1866
+ const CellOutFinalization = (typeof FinalizationRegistry === 'undefined')
1867
+ ? { register: () => {}, unregister: () => {} }
1868
+ : new FinalizationRegistry(ptr => wasm?.__wbg_cellout_free(ptr, 1));
1869
+ const CellSnapshotFinalization = (typeof FinalizationRegistry === 'undefined')
1870
+ ? { register: () => {}, unregister: () => {} }
1871
+ : new FinalizationRegistry(ptr => wasm?.__wbg_cellsnapshot_free(ptr, 1));
1872
+ const CellStoreFinalization = (typeof FinalizationRegistry === 'undefined')
1873
+ ? { register: () => {}, unregister: () => {} }
1874
+ : new FinalizationRegistry(ptr => wasm?.__wbg_cellstore_free(ptr, 1));
1875
+ const DistinctColumnFinalization = (typeof FinalizationRegistry === 'undefined')
1876
+ ? { register: () => {}, unregister: () => {} }
1877
+ : new FinalizationRegistry(ptr => wasm?.__wbg_distinctcolumn_free(ptr, 1));
1878
+ const RangeSnapshotFinalization = (typeof FinalizationRegistry === 'undefined')
1879
+ ? { register: () => {}, unregister: () => {} }
1880
+ : new FinalizationRegistry(ptr => wasm?.__wbg_rangesnapshot_free(ptr, 1));
1881
+ const SourceSnapshotFinalization = (typeof FinalizationRegistry === 'undefined')
1882
+ ? { register: () => {}, unregister: () => {} }
1883
+ : new FinalizationRegistry(ptr => wasm?.__wbg_sourcesnapshot_free(ptr, 1));
1884
+ const WindowViewFinalization = (typeof FinalizationRegistry === 'undefined')
1885
+ ? { register: () => {}, unregister: () => {} }
1886
+ : new FinalizationRegistry(ptr => wasm?.__wbg_windowview_free(ptr, 1));
1887
+
1888
+ function addToExternrefTable0(obj) {
1889
+ const idx = wasm.__externref_table_alloc();
1890
+ wasm.__wbindgen_externrefs.set(idx, obj);
1891
+ return idx;
1892
+ }
1893
+
1894
+ function _assertClass(instance, klass) {
1895
+ if (!(instance instanceof klass)) {
1896
+ throw new Error(`expected instance of ${klass.name}`);
1897
+ }
1898
+ }
1899
+
1900
+ function getArrayF64FromWasm0(ptr, len) {
1901
+ ptr = ptr >>> 0;
1902
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
1903
+ }
1904
+
1905
+ function getArrayI32FromWasm0(ptr, len) {
1906
+ ptr = ptr >>> 0;
1907
+ return getInt32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
1908
+ }
1909
+
1910
+ function getArrayJsValueFromWasm0(ptr, len) {
1911
+ ptr = ptr >>> 0;
1912
+ const mem = getDataViewMemory0();
1913
+ const result = [];
1914
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
1915
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
1916
+ }
1917
+ wasm.__externref_drop_slice(ptr, len);
1918
+ return result;
1919
+ }
1920
+
1921
+ function getArrayU32FromWasm0(ptr, len) {
1922
+ ptr = ptr >>> 0;
1923
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
1924
+ }
1925
+
1926
+ function getArrayU8FromWasm0(ptr, len) {
1927
+ ptr = ptr >>> 0;
1928
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1929
+ }
1930
+
1931
+ let cachedDataViewMemory0 = null;
1932
+ function getDataViewMemory0() {
1933
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1934
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1935
+ }
1936
+ return cachedDataViewMemory0;
1937
+ }
1938
+
1939
+ let cachedFloat64ArrayMemory0 = null;
1940
+ function getFloat64ArrayMemory0() {
1941
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
1942
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
1943
+ }
1944
+ return cachedFloat64ArrayMemory0;
1945
+ }
1946
+
1947
+ let cachedInt32ArrayMemory0 = null;
1948
+ function getInt32ArrayMemory0() {
1949
+ if (cachedInt32ArrayMemory0 === null || cachedInt32ArrayMemory0.byteLength === 0) {
1950
+ cachedInt32ArrayMemory0 = new Int32Array(wasm.memory.buffer);
1951
+ }
1952
+ return cachedInt32ArrayMemory0;
1953
+ }
1954
+
1955
+ function getStringFromWasm0(ptr, len) {
1956
+ return decodeText(ptr >>> 0, len);
1957
+ }
1958
+
1959
+ let cachedUint32ArrayMemory0 = null;
1960
+ function getUint32ArrayMemory0() {
1961
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
1962
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
1963
+ }
1964
+ return cachedUint32ArrayMemory0;
1965
+ }
1966
+
1967
+ let cachedUint8ArrayMemory0 = null;
1968
+ function getUint8ArrayMemory0() {
1969
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1970
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1971
+ }
1972
+ return cachedUint8ArrayMemory0;
1973
+ }
1974
+
1975
+ function isLikeNone(x) {
1976
+ return x === undefined || x === null;
1977
+ }
1978
+
1979
+ function passArray32ToWasm0(arg, malloc) {
1980
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1981
+ getUint32ArrayMemory0().set(arg, ptr / 4);
1982
+ WASM_VECTOR_LEN = arg.length;
1983
+ return ptr;
1984
+ }
1985
+
1986
+ function passArray8ToWasm0(arg, malloc) {
1987
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
1988
+ getUint8ArrayMemory0().set(arg, ptr / 1);
1989
+ WASM_VECTOR_LEN = arg.length;
1990
+ return ptr;
1991
+ }
1992
+
1993
+ function passArrayF64ToWasm0(arg, malloc) {
1994
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
1995
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
1996
+ WASM_VECTOR_LEN = arg.length;
1997
+ return ptr;
1998
+ }
1999
+
2000
+ function passArrayJsValueToWasm0(array, malloc) {
2001
+ const ptr = malloc(array.length * 4, 4) >>> 0;
2002
+ for (let i = 0; i < array.length; i++) {
2003
+ const add = addToExternrefTable0(array[i]);
2004
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
2005
+ }
2006
+ WASM_VECTOR_LEN = array.length;
2007
+ return ptr;
2008
+ }
2009
+
2010
+ function passStringToWasm0(arg, malloc, realloc) {
2011
+ if (realloc === undefined) {
2012
+ const buf = cachedTextEncoder.encode(arg);
2013
+ const ptr = malloc(buf.length, 1) >>> 0;
2014
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
2015
+ WASM_VECTOR_LEN = buf.length;
2016
+ return ptr;
2017
+ }
2018
+
2019
+ let len = arg.length;
2020
+ let ptr = malloc(len, 1) >>> 0;
2021
+
2022
+ const mem = getUint8ArrayMemory0();
2023
+
2024
+ let offset = 0;
2025
+
2026
+ for (; offset < len; offset++) {
2027
+ const code = arg.charCodeAt(offset);
2028
+ if (code > 0x7F) break;
2029
+ mem[ptr + offset] = code;
2030
+ }
2031
+ if (offset !== len) {
2032
+ if (offset !== 0) {
2033
+ arg = arg.slice(offset);
2034
+ }
2035
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
2036
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
2037
+ const ret = cachedTextEncoder.encodeInto(arg, view);
2038
+
2039
+ offset += ret.written;
2040
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
2041
+ }
2042
+
2043
+ WASM_VECTOR_LEN = offset;
2044
+ return ptr;
2045
+ }
2046
+
2047
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2048
+ cachedTextDecoder.decode();
2049
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
2050
+ let numBytesDecoded = 0;
2051
+ function decodeText(ptr, len) {
2052
+ numBytesDecoded += len;
2053
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
2054
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2055
+ cachedTextDecoder.decode();
2056
+ numBytesDecoded = len;
2057
+ }
2058
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
2059
+ }
2060
+
2061
+ const cachedTextEncoder = new TextEncoder();
2062
+
2063
+ if (!('encodeInto' in cachedTextEncoder)) {
2064
+ cachedTextEncoder.encodeInto = function (arg, view) {
2065
+ const buf = cachedTextEncoder.encode(arg);
2066
+ view.set(buf);
2067
+ return {
2068
+ read: arg.length,
2069
+ written: buf.length
2070
+ };
2071
+ };
2072
+ }
2073
+
2074
+ let WASM_VECTOR_LEN = 0;
2075
+
2076
+ let wasmModule, wasmInstance, wasm;
2077
+ function __wbg_finalize_init(instance, module) {
2078
+ wasmInstance = instance;
2079
+ wasm = instance.exports;
2080
+ wasmModule = module;
2081
+ cachedDataViewMemory0 = null;
2082
+ cachedFloat64ArrayMemory0 = null;
2083
+ cachedInt32ArrayMemory0 = null;
2084
+ cachedUint32ArrayMemory0 = null;
2085
+ cachedUint8ArrayMemory0 = null;
2086
+ wasm.__wbindgen_start();
2087
+ return wasm;
2088
+ }
2089
+
2090
+ async function __wbg_load(module, imports) {
2091
+ if (typeof Response === 'function' && module instanceof Response) {
2092
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
2093
+ try {
2094
+ return await WebAssembly.instantiateStreaming(module, imports);
2095
+ } catch (e) {
2096
+ const validResponse = module.ok && expectedResponseType(module.type);
2097
+
2098
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
2099
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
2100
+
2101
+ } else { throw e; }
2102
+ }
2103
+ }
2104
+
2105
+ const bytes = await module.arrayBuffer();
2106
+ return await WebAssembly.instantiate(bytes, imports);
2107
+ } else {
2108
+ const instance = await WebAssembly.instantiate(module, imports);
2109
+
2110
+ if (instance instanceof WebAssembly.Instance) {
2111
+ return { instance, module };
2112
+ } else {
2113
+ return instance;
2114
+ }
2115
+ }
2116
+
2117
+ function expectedResponseType(type) {
2118
+ switch (type) {
2119
+ case 'basic': case 'cors': case 'default': return true;
2120
+ }
2121
+ return false;
2122
+ }
2123
+ }
2124
+
2125
+ function initSync(module) {
2126
+ if (wasm !== undefined && wasm !== lazyWasm) return wasm;
2127
+
2128
+
2129
+ if (module !== undefined) {
2130
+ if (Object.getPrototypeOf(module) === Object.prototype) {
2131
+ ({module} = module)
2132
+ } else {
2133
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
2134
+ }
2135
+ }
2136
+
2137
+ const imports = __wbg_get_imports();
2138
+ if (!(module instanceof WebAssembly.Module)) {
2139
+ module = new WebAssembly.Module(module);
2140
+ }
2141
+ const instance = new WebAssembly.Instance(module, imports);
2142
+ return __wbg_finalize_init(instance, module);
2143
+ }
2144
+
2145
+ async function __wbg_init(module_or_path) {
2146
+ if (wasm !== undefined && wasm !== lazyWasm) return wasm;
2147
+
2148
+
2149
+ if (module_or_path !== undefined) {
2150
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
2151
+ ({module_or_path} = module_or_path)
2152
+ } else {
2153
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
2154
+ }
2155
+ }
2156
+
2157
+ if (module_or_path === undefined) {
2158
+ module_or_path = new URL('sheetwrite_wasm_bg.wasm', import.meta.url);
2159
+ }
2160
+ const imports = __wbg_get_imports();
2161
+
2162
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
2163
+ module_or_path = fetch(module_or_path);
2164
+ }
2165
+
2166
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
2167
+
2168
+ return __wbg_finalize_init(instance, module);
2169
+ }
2170
+
2171
+
2172
+ if (lazy) {
2173
+ // Public singleton exports stay synchronous without a second eager instance.
2174
+ lazyWasm = new Proxy({}, {
2175
+ get(_target, key) {
2176
+ if (!publishedModule) throw new Error("Sheetwrite: await load() or initSheetwrite() first");
2177
+ wasm = undefined;
2178
+ return initSync({ module: publishedModule })[key];
2179
+ },
2180
+ });
2181
+ wasm = lazyWasm;
2182
+ }
2183
+
2184
+ return { CellOut, CellSnapshot, CellStore, DistinctColumn, RangeSnapshot, SourceSnapshot, WindowView, initSync, init: __wbg_init, getModule: () => { if (!wasmModule) throw new Error("Engine is not initialized or has been retired"); return wasmModule; }, getMemory: () => { if (!wasm) throw new Error("Engine is not initialized or has been retired"); return wasm.memory; }, retire: () => { wasm = undefined; wasmInstance = undefined; wasmModule = undefined; cachedDataViewMemory0 = null; cachedFloat64ArrayMemory0 = null; cachedInt32ArrayMemory0 = null; cachedUint32ArrayMemory0 = null; cachedUint8ArrayMemory0 = null; } };
2185
+ }