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