@sheetwrite/wasm 0.1.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,1412 @@
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
+ * Allocate a logical sheet whose cell chunks materialize on page load or edit.
75
+ * @param {number} n_cols
76
+ * @param {number} row_count
77
+ * @param {number} chunk_rows
78
+ * @param {number} byte_budget
79
+ * @returns {number}
80
+ */
81
+ addPagedSheet(n_cols, row_count, chunk_rows, byte_budget) {
82
+ const ret = wasm.cellstore_addPagedSheet(this.__wbg_ptr, n_cols, row_count, chunk_rows, byte_budget);
83
+ return ret >>> 0;
84
+ }
85
+ /**
86
+ * @param {number} sheet
87
+ * @param {number} at
88
+ * @param {number} count
89
+ */
90
+ addRows(sheet, at, count) {
91
+ wasm.cellstore_addRows(this.__wbg_ptr, sheet, at, count);
92
+ }
93
+ /**
94
+ * Allocate a sheet grid and return its numeric handle.
95
+ * @param {number} n_cols
96
+ * @param {number} row_count
97
+ * @returns {number}
98
+ */
99
+ addSheet(n_cols, row_count) {
100
+ const ret = wasm.cellstore_addSheet(this.__wbg_ptr, n_cols, row_count);
101
+ return ret >>> 0;
102
+ }
103
+ /**
104
+ * Column aggregate over numeric cells. op: 0 sum, 1 avg, 2 min, 3 max, 4 count.
105
+ * @param {number} sheet
106
+ * @param {number} col
107
+ * @param {number} op
108
+ * @returns {number}
109
+ */
110
+ aggregate(sheet, col, op) {
111
+ const ret = wasm.cellstore_aggregate(this.__wbg_ptr, sheet, col, op);
112
+ return ret;
113
+ }
114
+ beginPageLoad() {
115
+ wasm.cellstore_beginPageLoad(this.__wbg_ptr);
116
+ }
117
+ /**
118
+ * Capture a dense rectangle into an opaque store-local history resource.
119
+ * @param {number} sheet
120
+ * @param {number} r0
121
+ * @param {number} c0
122
+ * @param {number} rows
123
+ * @param {number} cols
124
+ * @returns {RangeSnapshot | undefined}
125
+ */
126
+ captureRange(sheet, r0, c0, rows, cols) {
127
+ const ret = wasm.cellstore_captureRange(this.__wbg_ptr, sheet, r0, c0, rows, cols);
128
+ return ret === 0 ? undefined : RangeSnapshot.__wrap(ret);
129
+ }
130
+ /**
131
+ * 0 unloaded, 1 loaded-empty, 2 loaded-value, 3 dirty local edit.
132
+ * @param {number} sheet
133
+ * @param {number} row
134
+ * @param {number} col
135
+ * @returns {number}
136
+ */
137
+ cellState(sheet, row, col) {
138
+ const ret = wasm.cellstore_cellState(this.__wbg_ptr, sheet, row, col);
139
+ return ret;
140
+ }
141
+ /**
142
+ * @param {number} sheet
143
+ * @param {number} row
144
+ * @param {number} col
145
+ * @param {number} style
146
+ */
147
+ clearCell(sheet, row, col, style) {
148
+ wasm.cellstore_clearCell(this.__wbg_ptr, sheet, row, col, style);
149
+ }
150
+ /**
151
+ * Clear a rectangle while independently controlling contents and style.
152
+ * @param {number} sheet
153
+ * @param {number} r0
154
+ * @param {number} c0
155
+ * @param {number} r1
156
+ * @param {number} c1
157
+ * @param {boolean} contents
158
+ * @param {boolean} style
159
+ * @returns {boolean}
160
+ */
161
+ clearRange(sheet, r0, c0, r1, c1, contents, style) {
162
+ const ret = wasm.cellstore_clearRange(this.__wbg_ptr, sheet, r0, c0, r1, c1, contents, style);
163
+ return ret !== 0;
164
+ }
165
+ /**
166
+ * @param {number} sheet
167
+ * @returns {number}
168
+ */
169
+ colCount(sheet) {
170
+ const ret = wasm.cellstore_colCount(this.__wbg_ptr, sheet);
171
+ return ret >>> 0;
172
+ }
173
+ /**
174
+ * Ctrl+Arrow destination: from `(row, col)` stepping by `(d_row, d_col)`
175
+ * (exactly one of them ±1), return the destination row (vertical moves) or
176
+ * column (horizontal moves), Google Sheets semantics:
177
+ *
178
+ * - current and adjacent cell non-empty → end of the contiguous non-empty
179
+ * run;
180
+ * - otherwise → the next non-empty cell in that direction;
181
+ * - nothing ahead → the sheet edge.
182
+ * @param {number} sheet
183
+ * @param {number} row
184
+ * @param {number} col
185
+ * @param {number} d_row
186
+ * @param {number} d_col
187
+ * @returns {number}
188
+ */
189
+ dataEdge(sheet, row, col, d_row, d_col) {
190
+ const ret = wasm.cellstore_dataEdge(this.__wbg_ptr, sheet, row, col, d_row, d_col);
191
+ return ret >>> 0;
192
+ }
193
+ /**
194
+ * @param {number} sheet
195
+ * @param {Uint32Array} order
196
+ * @param {number} row
197
+ * @param {number} col
198
+ * @param {number} d_row
199
+ * @param {number} d_col
200
+ * @returns {number}
201
+ */
202
+ dataEdgeOrdered(sheet, order, row, col, d_row, d_col) {
203
+ const ptr0 = passArray32ToWasm0(order, wasm.__wbindgen_malloc);
204
+ const len0 = WASM_VECTOR_LEN;
205
+ const ret = wasm.cellstore_dataEdgeOrdered(this.__wbg_ptr, sheet, ptr0, len0, row, col, d_row, d_col);
206
+ return ret >>> 0;
207
+ }
208
+ /**
209
+ * @param {number} sheet
210
+ * @param {number} col
211
+ * @param {number} limit
212
+ * @returns {DistinctColumn}
213
+ */
214
+ distinctValues(sheet, col, limit) {
215
+ const ret = wasm.cellstore_distinctValues(this.__wbg_ptr, sheet, col, limit);
216
+ return DistinctColumn.__wrap(ret);
217
+ }
218
+ endPageLoad() {
219
+ wasm.cellstore_endPageLoad(this.__wbg_ptr);
220
+ }
221
+ /**
222
+ * Data-row indices whose column text contains `needle` (case-insensitive).
223
+ * @param {number} sheet
224
+ * @param {number} col
225
+ * @param {string} needle
226
+ * @returns {Uint32Array}
227
+ */
228
+ filterRows(sheet, col, needle) {
229
+ const ptr0 = passStringToWasm0(needle, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
230
+ const len0 = WASM_VECTOR_LEN;
231
+ const ret = wasm.cellstore_filterRows(this.__wbg_ptr, sheet, col, ptr0, len0);
232
+ var v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
233
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
234
+ return v2;
235
+ }
236
+ /**
237
+ * @param {number} sheet
238
+ * @param {Uint32Array} cols
239
+ * @param {Uint8Array} kinds
240
+ * @param {Uint8Array} flags
241
+ * @param {Float64Array} nums
242
+ * @param {Uint32Array} num_counts
243
+ * @param {Uint32Array} text_counts
244
+ * @param {Float64Array} value_nums
245
+ * @param {string[]} value_texts
246
+ * @returns {Uint32Array}
247
+ */
248
+ filterRowsMulti(sheet, cols, kinds, flags, nums, num_counts, text_counts, value_nums, value_texts) {
249
+ const ptr0 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
250
+ const len0 = WASM_VECTOR_LEN;
251
+ const ptr1 = passArray8ToWasm0(kinds, wasm.__wbindgen_malloc);
252
+ const len1 = WASM_VECTOR_LEN;
253
+ const ptr2 = passArray8ToWasm0(flags, wasm.__wbindgen_malloc);
254
+ const len2 = WASM_VECTOR_LEN;
255
+ const ptr3 = passArrayF64ToWasm0(nums, wasm.__wbindgen_malloc);
256
+ const len3 = WASM_VECTOR_LEN;
257
+ const ptr4 = passArray32ToWasm0(num_counts, wasm.__wbindgen_malloc);
258
+ const len4 = WASM_VECTOR_LEN;
259
+ const ptr5 = passArray32ToWasm0(text_counts, wasm.__wbindgen_malloc);
260
+ const len5 = WASM_VECTOR_LEN;
261
+ const ptr6 = passArrayF64ToWasm0(value_nums, wasm.__wbindgen_malloc);
262
+ const len6 = WASM_VECTOR_LEN;
263
+ const ptr7 = passArrayJsValueToWasm0(value_texts, wasm.__wbindgen_malloc);
264
+ const len7 = WASM_VECTOR_LEN;
265
+ 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);
266
+ var v9 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
267
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
268
+ return v9;
269
+ }
270
+ /**
271
+ * @param {number} sheet
272
+ * @param {number} row
273
+ * @param {number} col
274
+ * @returns {string | undefined}
275
+ */
276
+ formulaSource(sheet, row, col) {
277
+ const ret = wasm.cellstore_formulaSource(this.__wbg_ptr, sheet, row, col);
278
+ let v1;
279
+ if (ret[0] !== 0) {
280
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
281
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
282
+ }
283
+ return v1;
284
+ }
285
+ /**
286
+ * Single-cell read for interactions/tests — never the render hot path.
287
+ * @param {number} sheet
288
+ * @param {number} row
289
+ * @param {number} col
290
+ * @returns {CellOut}
291
+ */
292
+ getCell(sheet, row, col) {
293
+ const ret = wasm.cellstore_getCell(this.__wbg_ptr, sheet, row, col);
294
+ return CellOut.__wrap(ret);
295
+ }
296
+ /**
297
+ * One bulk read of a rectangular window for the renderer. Returns
298
+ * contiguous typed arrays (row-major over `rows x cols`) plus the unique
299
+ * strings referenced by the window, so the host paints without crossing
300
+ * the boundary per cell.
301
+ * @param {number} sheet
302
+ * @param {number} row_start
303
+ * @param {number} row_end
304
+ * @param {Uint32Array} cols
305
+ * @returns {WindowView}
306
+ */
307
+ getWindow(sheet, row_start, row_end, cols) {
308
+ const ptr0 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
309
+ const len0 = WASM_VECTOR_LEN;
310
+ const ret = wasm.cellstore_getWindow(this.__wbg_ptr, sheet, row_start, row_end, ptr0, len0);
311
+ return WindowView.__wrap(ret);
312
+ }
313
+ /**
314
+ * Bulk read of an explicit row list (sorted/filtered views) — same output
315
+ * shape as `get_window`, rows taken from `rows` rather than a range.
316
+ * @param {number} sheet
317
+ * @param {Uint32Array} rows
318
+ * @param {Uint32Array} cols
319
+ * @returns {WindowView}
320
+ */
321
+ getWindowRows(sheet, rows, cols) {
322
+ const ptr0 = passArray32ToWasm0(rows, wasm.__wbindgen_malloc);
323
+ const len0 = WASM_VECTOR_LEN;
324
+ const ptr1 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
325
+ const len1 = WASM_VECTOR_LEN;
326
+ const ret = wasm.cellstore_getWindowRows(this.__wbg_ptr, sheet, ptr0, len0, ptr1, len1);
327
+ return WindowView.__wrap(ret);
328
+ }
329
+ /**
330
+ * @param {number} sheet
331
+ * @param {number} at
332
+ * @param {number} count
333
+ */
334
+ insertCols(sheet, at, count) {
335
+ wasm.cellstore_insertCols(this.__wbg_ptr, sheet, at, count);
336
+ }
337
+ /**
338
+ * @param {number} sheet
339
+ * @returns {boolean}
340
+ */
341
+ isFullyLoaded(sheet) {
342
+ const ret = wasm.cellstore_isFullyLoaded(this.__wbg_ptr, sheet);
343
+ return ret !== 0;
344
+ }
345
+ /**
346
+ * @param {number} sheet
347
+ * @returns {boolean}
348
+ */
349
+ isPaged(sheet) {
350
+ const ret = wasm.cellstore_isPaged(this.__wbg_ptr, sheet);
351
+ return ret !== 0;
352
+ }
353
+ /**
354
+ * @param {number} sheet
355
+ * @returns {boolean}
356
+ */
357
+ isSheetAlive(sheet) {
358
+ const ret = wasm.cellstore_isSheetAlive(this.__wbg_ptr, sheet);
359
+ return ret !== 0;
360
+ }
361
+ /**
362
+ * @param {number} sheet
363
+ * @param {number} start_row
364
+ * @param {number} end_row
365
+ * @param {number} start_col
366
+ * @param {number} end_col
367
+ */
368
+ markRangeClean(sheet, start_row, end_row, start_col, end_col) {
369
+ wasm.cellstore_markRangeClean(this.__wbg_ptr, sheet, start_row, end_row, start_col, end_col);
370
+ }
371
+ constructor() {
372
+ const ret = wasm.cellstore_new();
373
+ this.__wbg_ptr = ret;
374
+ CellStoreFinalization.register(this, this.__wbg_ptr, this);
375
+ return this;
376
+ }
377
+ /**
378
+ * `[chunks, loaded cells, dirty cells, allocated bytes, fully loaded]`.
379
+ * @param {number} sheet
380
+ * @returns {Float64Array}
381
+ */
382
+ pagedStats(sheet) {
383
+ const ret = wasm.cellstore_pagedStats(this.__wbg_ptr, sheet);
384
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
385
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
386
+ return v1;
387
+ }
388
+ /**
389
+ * @param {number} sheet
390
+ * @param {number} start_row
391
+ * @param {number} end_row
392
+ * @param {Uint32Array} cols
393
+ */
394
+ pinRange(sheet, start_row, end_row, cols) {
395
+ const ptr0 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
396
+ const len0 = WASM_VECTOR_LEN;
397
+ wasm.cellstore_pinRange(this.__wbg_ptr, sheet, start_row, end_row, ptr0, len0);
398
+ }
399
+ /**
400
+ * @param {Uint32Array} ids
401
+ * @returns {string[]}
402
+ */
403
+ poolStrings(ids) {
404
+ const ptr0 = passArray32ToWasm0(ids, wasm.__wbindgen_malloc);
405
+ const len0 = WASM_VECTOR_LEN;
406
+ const ret = wasm.cellstore_poolStrings(this.__wbg_ptr, ptr0, len0);
407
+ var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
408
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
409
+ return v2;
410
+ }
411
+ /**
412
+ * `[contains cache constructions, owned distinct strings]`.
413
+ * @returns {Float64Array}
414
+ */
415
+ queryResourceStats() {
416
+ const ret = wasm.cellstore_queryResourceStats(this.__wbg_ptr);
417
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
418
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
419
+ return v1;
420
+ }
421
+ /**
422
+ * @param {number} sheet
423
+ * @param {number} r0
424
+ * @param {number} c0
425
+ * @param {number} r1
426
+ * @param {number} c1
427
+ * @returns {boolean}
428
+ */
429
+ rangeFullyLoaded(sheet, r0, c0, r1, c1) {
430
+ const ret = wasm.cellstore_rangeFullyLoaded(this.__wbg_ptr, sheet, r0, c0, r1, c1);
431
+ return ret !== 0;
432
+ }
433
+ /**
434
+ * Unique style ids present in a rectangle; cost stays inside WASM.
435
+ * @param {number} sheet
436
+ * @param {number} r0
437
+ * @param {number} c0
438
+ * @param {number} r1
439
+ * @param {number} c1
440
+ * @returns {Uint32Array}
441
+ */
442
+ rangeStyleIds(sheet, r0, c0, r1, c1) {
443
+ const ret = wasm.cellstore_rangeStyleIds(this.__wbg_ptr, sheet, r0, c0, r1, c1);
444
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
445
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
446
+ return v1;
447
+ }
448
+ /**
449
+ * Recompute formulas affected by cells changed since the last call.
450
+ *
451
+ * The pass first grows the dirty cell set through formula read-sets to find
452
+ * all dependent formulas. It then evaluates only those formulas, using a
453
+ * per-pass memo table so each formula cell is evaluated at most once even
454
+ * when many downstream formulas reference it.
455
+ * @param {number} sheet
456
+ */
457
+ recompute(sheet) {
458
+ wasm.cellstore_recompute(this.__wbg_ptr, sheet);
459
+ }
460
+ /**
461
+ * Explicit volatile barrier. `serial` is a UTC spreadsheet serial using
462
+ * the 1899-12-30 epoch; only TODAY/NOW formulas and their dependents dirty.
463
+ * @param {number} serial
464
+ * @returns {boolean}
465
+ */
466
+ recomputeVolatile(serial) {
467
+ const ret = wasm.cellstore_recomputeVolatile(this.__wbg_ptr, serial);
468
+ return ret !== 0;
469
+ }
470
+ /**
471
+ * Remap styles over a rectangle using parallel old/new id tables.
472
+ * @param {number} sheet
473
+ * @param {number} r0
474
+ * @param {number} c0
475
+ * @param {number} r1
476
+ * @param {number} c1
477
+ * @param {Uint32Array} old_ids
478
+ * @param {Uint32Array} new_ids
479
+ * @returns {boolean}
480
+ */
481
+ remapRangeStyles(sheet, r0, c0, r1, c1, old_ids, new_ids) {
482
+ const ptr0 = passArray32ToWasm0(old_ids, wasm.__wbindgen_malloc);
483
+ const len0 = WASM_VECTOR_LEN;
484
+ const ptr1 = passArray32ToWasm0(new_ids, wasm.__wbindgen_malloc);
485
+ const len1 = WASM_VECTOR_LEN;
486
+ const ret = wasm.cellstore_remapRangeStyles(this.__wbg_ptr, sheet, r0, c0, r1, c1, ptr0, len0, ptr1, len1);
487
+ return ret !== 0;
488
+ }
489
+ /**
490
+ * @param {number} sheet
491
+ * @param {number} at
492
+ * @param {number} count
493
+ */
494
+ removeCols(sheet, at, count) {
495
+ wasm.cellstore_removeCols(this.__wbg_ptr, sheet, at, count);
496
+ }
497
+ /**
498
+ * @param {string} name
499
+ * @param {number} scope
500
+ * @returns {boolean}
501
+ */
502
+ removeNamedRange(name, scope) {
503
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
504
+ const len0 = WASM_VECTOR_LEN;
505
+ const ret = wasm.cellstore_removeNamedRange(this.__wbg_ptr, ptr0, len0, scope);
506
+ return ret !== 0;
507
+ }
508
+ /**
509
+ * @param {number} sheet
510
+ * @param {number} at
511
+ * @param {number} count
512
+ */
513
+ removeRows(sheet, at, count) {
514
+ wasm.cellstore_removeRows(this.__wbg_ptr, sheet, at, count);
515
+ }
516
+ /**
517
+ * Tombstone a stable sheet handle and invalidate every formula reference to it.
518
+ * @param {number} sheet
519
+ * @returns {boolean}
520
+ */
521
+ removeSheet(sheet) {
522
+ const ret = wasm.cellstore_removeSheet(this.__wbg_ptr, sheet);
523
+ return ret !== 0;
524
+ }
525
+ /**
526
+ * Rename a live stable sheet handle and rewrite every resolved formula AST reference.
527
+ * @param {number} sheet
528
+ * @param {string} id
529
+ * @param {string} name
530
+ * @returns {boolean}
531
+ */
532
+ renameSheet(sheet, id, name) {
533
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
534
+ const len0 = WASM_VECTOR_LEN;
535
+ const ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
536
+ const len1 = WASM_VECTOR_LEN;
537
+ const ret = wasm.cellstore_renameSheet(this.__wbg_ptr, sheet, ptr0, len0, ptr1, len1);
538
+ return ret !== 0;
539
+ }
540
+ resetQueryResourceStats() {
541
+ wasm.cellstore_resetQueryResourceStats(this.__wbg_ptr);
542
+ }
543
+ /**
544
+ * Restore a captured block at a destination of the same dimensions.
545
+ * @param {number} sheet
546
+ * @param {number} r0
547
+ * @param {number} c0
548
+ * @param {RangeSnapshot} snapshot
549
+ * @returns {boolean}
550
+ */
551
+ restoreRange(sheet, r0, c0, snapshot) {
552
+ _assertClass(snapshot, RangeSnapshot);
553
+ const ret = wasm.cellstore_restoreRange(this.__wbg_ptr, sheet, r0, c0, snapshot.__wbg_ptr);
554
+ return ret !== 0;
555
+ }
556
+ /**
557
+ * @param {number} sheet
558
+ * @returns {number}
559
+ */
560
+ rowCount(sheet) {
561
+ const ret = wasm.cellstore_rowCount(this.__wbg_ptr, sheet);
562
+ return ret >>> 0;
563
+ }
564
+ /**
565
+ * Cell coordinates whose text matches `query`, as a flat `[row, col, ...]`
566
+ * list. Scans the requested columns column-major (cache-local), then sorts
567
+ * row-major so search navigation runs top-to-bottom, left-to-right.
568
+ * @param {number} sheet
569
+ * @param {Uint32Array} cols
570
+ * @param {string} query
571
+ * @param {boolean} case_insensitive
572
+ * @param {boolean} whole_cell
573
+ * @returns {Uint32Array}
574
+ */
575
+ search(sheet, cols, query, case_insensitive, whole_cell) {
576
+ const ptr0 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
577
+ const len0 = WASM_VECTOR_LEN;
578
+ const ptr1 = passStringToWasm0(query, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
579
+ const len1 = WASM_VECTOR_LEN;
580
+ const ret = wasm.cellstore_search(this.__wbg_ptr, sheet, ptr0, len0, ptr1, len1, case_insensitive, whole_cell);
581
+ var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
582
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
583
+ return v3;
584
+ }
585
+ /**
586
+ * Write one row-major typed block in a single boundary call. `kinds` uses
587
+ * 0 empty / 1 number / 2 string; formulas and references are sparse host
588
+ * exceptions applied after this literal bulk write.
589
+ * @param {number} sheet
590
+ * @param {number} start_row
591
+ * @param {number} start_col
592
+ * @param {number} rows
593
+ * @param {number} cols
594
+ * @param {Uint8Array} kinds
595
+ * @param {Float64Array} numbers
596
+ * @param {string[]} texts
597
+ * @param {Uint32Array} styles
598
+ * @returns {boolean}
599
+ */
600
+ setBlock(sheet, start_row, start_col, rows, cols, kinds, numbers, texts, styles) {
601
+ const ptr0 = passArray8ToWasm0(kinds, wasm.__wbindgen_malloc);
602
+ const len0 = WASM_VECTOR_LEN;
603
+ const ptr1 = passArrayF64ToWasm0(numbers, wasm.__wbindgen_malloc);
604
+ const len1 = WASM_VECTOR_LEN;
605
+ const ptr2 = passArrayJsValueToWasm0(texts, wasm.__wbindgen_malloc);
606
+ const len2 = WASM_VECTOR_LEN;
607
+ const ptr3 = passArray32ToWasm0(styles, wasm.__wbindgen_malloc);
608
+ const len3 = WASM_VECTOR_LEN;
609
+ const ret = wasm.cellstore_setBlock(this.__wbg_ptr, sheet, start_row, start_col, rows, cols, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
610
+ return ret !== 0;
611
+ }
612
+ /**
613
+ * @param {number} sheet
614
+ * @param {number} row
615
+ * @param {number} col
616
+ * @param {boolean} value
617
+ * @param {number} style
618
+ */
619
+ setBool(sheet, row, col, value, style) {
620
+ wasm.cellstore_setBool(this.__wbg_ptr, sheet, row, col, value, style);
621
+ }
622
+ /**
623
+ * Bulk-load one column with numbers starting at `start_row`.
624
+ * @param {number} sheet
625
+ * @param {number} col
626
+ * @param {number} start_row
627
+ * @param {Float64Array} values
628
+ * @param {number} style
629
+ */
630
+ setColumnNumbers(sheet, col, start_row, values, style) {
631
+ const ptr0 = passArrayF64ToWasm0(values, wasm.__wbindgen_malloc);
632
+ const len0 = WASM_VECTOR_LEN;
633
+ wasm.cellstore_setColumnNumbers(this.__wbg_ptr, sheet, col, start_row, ptr0, len0, style);
634
+ }
635
+ /**
636
+ * Bulk-load one column with strings starting at `start_row`.
637
+ * @param {number} sheet
638
+ * @param {number} col
639
+ * @param {number} start_row
640
+ * @param {string[]} values
641
+ * @param {number} style
642
+ */
643
+ setColumnStrings(sheet, col, start_row, values, style) {
644
+ const ptr0 = passArrayJsValueToWasm0(values, wasm.__wbindgen_malloc);
645
+ const len0 = WASM_VECTOR_LEN;
646
+ wasm.cellstore_setColumnStrings(this.__wbg_ptr, sheet, col, start_row, ptr0, len0, style);
647
+ }
648
+ /**
649
+ * Bulk-load one column of strings from a single concatenated buffer plus
650
+ * per-row lengths in UTF-16 code units (the JS `string.length` unit).
651
+ * One boundary decode and one Rust allocation for the whole column,
652
+ * instead of one per row — the dominant ingest cost for text columns.
653
+ * @param {number} sheet
654
+ * @param {number} col
655
+ * @param {number} start_row
656
+ * @param {string} buf
657
+ * @param {Uint32Array} utf16_lens
658
+ * @param {number} style
659
+ */
660
+ setColumnStringsPacked(sheet, col, start_row, buf, utf16_lens, style) {
661
+ const ptr0 = passStringToWasm0(buf, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
662
+ const len0 = WASM_VECTOR_LEN;
663
+ const ptr1 = passArray32ToWasm0(utf16_lens, wasm.__wbindgen_malloc);
664
+ const len1 = WASM_VECTOR_LEN;
665
+ wasm.cellstore_setColumnStringsPacked(this.__wbg_ptr, sheet, col, start_row, ptr0, len0, ptr1, len1, style);
666
+ }
667
+ /**
668
+ * Replace a sheet's conditional-format rules. Packed columnar encoding,
669
+ * one entry per rule: `kinds` 0 gt / 1 lt / 2 eqNum / 3 eqStr / 4 eqEmpty /
670
+ * 5 contains; `bounds` = normalized `[r0, c0, r1, c1]` per rule; `nums`
671
+ * carries the numeric operand; `strs` the text operand; `flags` bit 0 =
672
+ * match-case for `contains`. Case-insensitive needles are lowercased here
673
+ * once so the per-cell match never allocates.
674
+ * @param {number} sheet
675
+ * @param {Uint8Array} kinds
676
+ * @param {Uint32Array} bounds
677
+ * @param {Float64Array} nums
678
+ * @param {string[]} strs
679
+ * @param {Uint8Array} flags
680
+ */
681
+ setConditionalRules(sheet, kinds, bounds, nums, strs, flags) {
682
+ const ptr0 = passArray8ToWasm0(kinds, wasm.__wbindgen_malloc);
683
+ const len0 = WASM_VECTOR_LEN;
684
+ const ptr1 = passArray32ToWasm0(bounds, wasm.__wbindgen_malloc);
685
+ const len1 = WASM_VECTOR_LEN;
686
+ const ptr2 = passArrayF64ToWasm0(nums, wasm.__wbindgen_malloc);
687
+ const len2 = WASM_VECTOR_LEN;
688
+ const ptr3 = passArrayJsValueToWasm0(strs, wasm.__wbindgen_malloc);
689
+ const len3 = WASM_VECTOR_LEN;
690
+ const ptr4 = passArray8ToWasm0(flags, wasm.__wbindgen_malloc);
691
+ const len4 = WASM_VECTOR_LEN;
692
+ wasm.cellstore_setConditionalRules(this.__wbg_ptr, sheet, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
693
+ }
694
+ /**
695
+ * Parse and store an arithmetic formula at `(row, col)`.
696
+ *
697
+ * Setters only mark cells dirty; they do not recompute formulas. The host
698
+ * calls `recompute(sheet)` once at the transaction barrier so a multi-cell
699
+ * edit performs one dependency-scoped pass instead of one full-sheet pass
700
+ * per setter. The returned value is the previous cached value until that
701
+ * barrier recompute runs, and the store facade ignores it for batched edits.
702
+ * @param {number} sheet
703
+ * @param {number} row
704
+ * @param {number} col
705
+ * @param {string} src
706
+ * @param {number} style
707
+ * @returns {number}
708
+ */
709
+ setFormula(sheet, row, col, src, style) {
710
+ const ptr0 = passStringToWasm0(src, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
711
+ const len0 = WASM_VECTOR_LEN;
712
+ const ret = wasm.cellstore_setFormula(this.__wbg_ptr, sheet, row, col, ptr0, len0, style);
713
+ return ret;
714
+ }
715
+ /**
716
+ * @param {string} name
717
+ * @param {number} scope
718
+ * @param {number} sheet
719
+ * @param {number} row_start
720
+ * @param {number} col_start
721
+ * @param {number} row_end
722
+ * @param {number} col_end
723
+ * @returns {boolean}
724
+ */
725
+ setNamedRange(name, scope, sheet, row_start, col_start, row_end, col_end) {
726
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
727
+ const len0 = WASM_VECTOR_LEN;
728
+ const ret = wasm.cellstore_setNamedRange(this.__wbg_ptr, ptr0, len0, scope, sheet, row_start, col_start, row_end, col_end);
729
+ return ret !== 0;
730
+ }
731
+ /**
732
+ * @param {number} sheet
733
+ * @param {number} row
734
+ * @param {number} col
735
+ * @param {number} value
736
+ * @param {number} style
737
+ */
738
+ setNumber(sheet, row, col, value, style) {
739
+ wasm.cellstore_setNumber(this.__wbg_ptr, sheet, row, col, value, style);
740
+ }
741
+ /**
742
+ * @param {number} sheet
743
+ * @param {string} id
744
+ * @param {string} name
745
+ */
746
+ setSheetName(sheet, id, name) {
747
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
748
+ const len0 = WASM_VECTOR_LEN;
749
+ const ptr1 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
750
+ const len1 = WASM_VECTOR_LEN;
751
+ wasm.cellstore_setSheetName(this.__wbg_ptr, sheet, ptr0, len0, ptr1, len1);
752
+ }
753
+ /**
754
+ * @param {number} sheet
755
+ * @param {number} row
756
+ * @param {number} col
757
+ * @param {string} value
758
+ * @param {number} style
759
+ */
760
+ setString(sheet, row, col, value, style) {
761
+ const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
762
+ const len0 = WASM_VECTOR_LEN;
763
+ wasm.cellstore_setString(this.__wbg_ptr, sheet, row, col, ptr0, len0, style);
764
+ }
765
+ /**
766
+ * @param {RangeSnapshot} snapshot
767
+ * @returns {Float64Array}
768
+ */
769
+ snapshotNumbers(snapshot) {
770
+ _assertClass(snapshot, RangeSnapshot);
771
+ const ret = wasm.cellstore_snapshotNumbers(this.__wbg_ptr, snapshot.__wbg_ptr);
772
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
773
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
774
+ return v1;
775
+ }
776
+ /**
777
+ * @param {RangeSnapshot} snapshot
778
+ * @returns {string[]}
779
+ */
780
+ snapshotTexts(snapshot) {
781
+ _assertClass(snapshot, RangeSnapshot);
782
+ const ret = wasm.cellstore_snapshotTexts(this.__wbg_ptr, snapshot.__wbg_ptr);
783
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
784
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
785
+ return v1;
786
+ }
787
+ /**
788
+ * Stable row order sorted by a column. Returns a data-row permutation.
789
+ * @param {number} sheet
790
+ * @param {number} col
791
+ * @param {boolean} ascending
792
+ * @returns {Uint32Array}
793
+ */
794
+ sortRows(sheet, col, ascending) {
795
+ const ret = wasm.cellstore_sortRows(this.__wbg_ptr, sheet, col, ascending);
796
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
797
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
798
+ return v1;
799
+ }
800
+ /**
801
+ * @param {number} sheet
802
+ * @param {Uint32Array} cols
803
+ * @param {Uint8Array} ascending
804
+ * @param {Uint32Array} candidates
805
+ * @returns {Uint32Array}
806
+ */
807
+ sortRowsMulti(sheet, cols, ascending, candidates) {
808
+ const ptr0 = passArray32ToWasm0(cols, wasm.__wbindgen_malloc);
809
+ const len0 = WASM_VECTOR_LEN;
810
+ const ptr1 = passArray8ToWasm0(ascending, wasm.__wbindgen_malloc);
811
+ const len1 = WASM_VECTOR_LEN;
812
+ const ptr2 = passArray32ToWasm0(candidates, wasm.__wbindgen_malloc);
813
+ const len2 = WASM_VECTOR_LEN;
814
+ const ret = wasm.cellstore_sortRowsMulti(this.__wbg_ptr, sheet, ptr0, len0, ptr1, len1, ptr2, len2);
815
+ var v4 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
816
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
817
+ return v4;
818
+ }
819
+ /**
820
+ * Current style-dictionary id at a cell; `0` when out of bounds. Used by
821
+ * the host to write derived (reference-shadow) values without disturbing
822
+ * the cell's style.
823
+ * @param {number} sheet
824
+ * @param {number} row
825
+ * @param {number} col
826
+ * @returns {number}
827
+ */
828
+ styleIdAt(sheet, row, col) {
829
+ const ret = wasm.cellstore_styleIdAt(this.__wbg_ptr, sheet, row, col);
830
+ return ret >>> 0;
831
+ }
832
+ }
833
+ if (Symbol.dispose) CellStore.prototype[Symbol.dispose] = CellStore.prototype.free;
834
+
835
+ /**
836
+ * Distinct-value scan result for one column: parallel kind/number/text
837
+ * arrays whose buffers are surrendered once through the `take*` accessors.
838
+ */
839
+ export class DistinctColumn {
840
+ static __wrap(ptr) {
841
+ const obj = Object.create(DistinctColumn.prototype);
842
+ obj.__wbg_ptr = ptr;
843
+ DistinctColumnFinalization.register(obj, obj.__wbg_ptr, obj);
844
+ return obj;
845
+ }
846
+ __destroy_into_raw() {
847
+ const ptr = this.__wbg_ptr;
848
+ this.__wbg_ptr = 0;
849
+ DistinctColumnFinalization.unregister(this);
850
+ return ptr;
851
+ }
852
+ free() {
853
+ const ptr = this.__destroy_into_raw();
854
+ wasm.__wbg_distinctcolumn_free(ptr, 0);
855
+ }
856
+ /**
857
+ * Surrenders the per-value kind tags (number/string/boolean codes); the
858
+ * column keeps an empty buffer afterwards.
859
+ * @returns {Uint8Array}
860
+ */
861
+ takeKinds() {
862
+ const ret = wasm.distinctcolumn_takeKinds(this.__wbg_ptr);
863
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
864
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
865
+ return v1;
866
+ }
867
+ /**
868
+ * Surrenders the numeric values aligned with the `takeKinds` tags.
869
+ * @returns {Float64Array}
870
+ */
871
+ takeNumbers() {
872
+ const ret = wasm.distinctcolumn_takeNumbers(this.__wbg_ptr);
873
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
874
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
875
+ return v1;
876
+ }
877
+ /**
878
+ * Surrenders the distinct strings aligned with the `takeKinds` tags.
879
+ * @returns {string[]}
880
+ */
881
+ takeTexts() {
882
+ const ret = wasm.distinctcolumn_takeTexts(this.__wbg_ptr);
883
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
884
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
885
+ return v1;
886
+ }
887
+ }
888
+ if (Symbol.dispose) DistinctColumn.prototype[Symbol.dispose] = DistinctColumn.prototype.free;
889
+
890
+ /**
891
+ * Opaque, store-local history payload for one dense rectangular cell block.
892
+ *
893
+ * The host may retain this object in undo history, but it is deliberately not
894
+ * part of the serialized document protocol. String payloads remain interned in
895
+ * the owning `CellStore`, so snapshots must only be restored into that store.
896
+ */
897
+ export class RangeSnapshot {
898
+ static __wrap(ptr) {
899
+ const obj = Object.create(RangeSnapshot.prototype);
900
+ obj.__wbg_ptr = ptr;
901
+ RangeSnapshotFinalization.register(obj, obj.__wbg_ptr, obj);
902
+ return obj;
903
+ }
904
+ __destroy_into_raw() {
905
+ const ptr = this.__wbg_ptr;
906
+ this.__wbg_ptr = 0;
907
+ RangeSnapshotFinalization.unregister(this);
908
+ return ptr;
909
+ }
910
+ free() {
911
+ const ptr = this.__destroy_into_raw();
912
+ wasm.__wbg_rangesnapshot_free(ptr, 0);
913
+ }
914
+ /**
915
+ * @returns {number}
916
+ */
917
+ byteLength() {
918
+ const ret = wasm.rangesnapshot_byteLength(this.__wbg_ptr);
919
+ return ret >>> 0;
920
+ }
921
+ /**
922
+ * @returns {Uint32Array}
923
+ */
924
+ formulaOffsets() {
925
+ const ret = wasm.rangesnapshot_formulaOffsets(this.__wbg_ptr);
926
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
927
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
928
+ return v1;
929
+ }
930
+ /**
931
+ * @returns {string[]}
932
+ */
933
+ formulaSources() {
934
+ const ret = wasm.rangesnapshot_formulaSources(this.__wbg_ptr);
935
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
936
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
937
+ return v1;
938
+ }
939
+ /**
940
+ * @returns {Uint8Array}
941
+ */
942
+ kinds() {
943
+ const ret = wasm.rangesnapshot_kinds(this.__wbg_ptr);
944
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
945
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
946
+ return v1;
947
+ }
948
+ /**
949
+ * @returns {Uint32Array}
950
+ */
951
+ styleIds() {
952
+ const ret = wasm.rangesnapshot_styleIds(this.__wbg_ptr);
953
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
954
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
955
+ return v1;
956
+ }
957
+ }
958
+ if (Symbol.dispose) RangeSnapshot.prototype[Symbol.dispose] = RangeSnapshot.prototype.free;
959
+
960
+ /**
961
+ * A bulk window of resolved cells, row-major over `n_rows x n_cols`.
962
+ */
963
+ export class WindowView {
964
+ static __wrap(ptr) {
965
+ const obj = Object.create(WindowView.prototype);
966
+ obj.__wbg_ptr = ptr;
967
+ WindowViewFinalization.register(obj, obj.__wbg_ptr, obj);
968
+ return obj;
969
+ }
970
+ __destroy_into_raw() {
971
+ const ptr = this.__wbg_ptr;
972
+ this.__wbg_ptr = 0;
973
+ WindowViewFinalization.unregister(this);
974
+ return ptr;
975
+ }
976
+ free() {
977
+ const ptr = this.__destroy_into_raw();
978
+ wasm.__wbg_windowview_free(ptr, 0);
979
+ }
980
+ /**
981
+ * @returns {number}
982
+ */
983
+ get nCols() {
984
+ const ret = wasm.windowview_nCols(this.__wbg_ptr);
985
+ return ret >>> 0;
986
+ }
987
+ /**
988
+ * @returns {number}
989
+ */
990
+ get nRows() {
991
+ const ret = wasm.windowview_nRows(this.__wbg_ptr);
992
+ return ret >>> 0;
993
+ }
994
+ /**
995
+ * Consume and return per-cell conditional-format rule bitmasks; empty
996
+ * when the sheet has no rules.
997
+ * @returns {Uint32Array}
998
+ */
999
+ takeCondMatches() {
1000
+ const ret = wasm.windowview_takeCondMatches(this.__wbg_ptr);
1001
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1002
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1003
+ return v1;
1004
+ }
1005
+ /**
1006
+ * Consume and return the per-cell tag array: 0 empty, 1 number, 2 string.
1007
+ * @returns {Uint8Array}
1008
+ */
1009
+ takeKinds() {
1010
+ const ret = wasm.windowview_takeKinds(this.__wbg_ptr);
1011
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
1012
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1013
+ return v1;
1014
+ }
1015
+ /**
1016
+ * Consume and return per-cell numeric payloads (valid where kind == 1).
1017
+ * @returns {Float64Array}
1018
+ */
1019
+ takeNumbers() {
1020
+ const ret = wasm.windowview_takeNumbers(this.__wbg_ptr);
1021
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
1022
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
1023
+ return v1;
1024
+ }
1025
+ /**
1026
+ * Consume and return per-cell GLOBAL string-pool ids; `u32::MAX` means none.
1027
+ * @returns {Uint32Array}
1028
+ */
1029
+ takeStringIds() {
1030
+ const ret = wasm.windowview_takeStringIds(this.__wbg_ptr);
1031
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1032
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1033
+ return v1;
1034
+ }
1035
+ /**
1036
+ * Consume and return per-cell indices into `strings` (string cells only).
1037
+ * @returns {Int32Array}
1038
+ */
1039
+ takeStringIndex() {
1040
+ const ret = wasm.windowview_takeStringIndex(this.__wbg_ptr);
1041
+ var v1 = getArrayI32FromWasm0(ret[0], ret[1]).slice();
1042
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1043
+ return v1;
1044
+ }
1045
+ /**
1046
+ * Consume and return unique strings referenced by this window.
1047
+ * @returns {string[]}
1048
+ */
1049
+ takeStrings() {
1050
+ const ret = wasm.windowview_takeStrings(this.__wbg_ptr);
1051
+ var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
1052
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1053
+ return v1;
1054
+ }
1055
+ /**
1056
+ * Consume and return the unique global style-dictionary ids referenced by
1057
+ * this window, in local-index order; the host maps each to a `CellStyle`.
1058
+ * @returns {Uint32Array}
1059
+ */
1060
+ takeStyleDict() {
1061
+ const ret = wasm.windowview_takeStyleDict(this.__wbg_ptr);
1062
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1063
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1064
+ return v1;
1065
+ }
1066
+ /**
1067
+ * Consume and return per-cell WINDOW-LOCAL style indices into the dict.
1068
+ * @returns {Uint32Array}
1069
+ */
1070
+ takeStyleIndex() {
1071
+ const ret = wasm.windowview_takeStyleIndex(this.__wbg_ptr);
1072
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
1073
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
1074
+ return v1;
1075
+ }
1076
+ }
1077
+ if (Symbol.dispose) WindowView.prototype[Symbol.dispose] = WindowView.prototype.free;
1078
+ function __wbg_get_imports() {
1079
+ const import0 = {
1080
+ __proto__: null,
1081
+ __wbg___wbindgen_string_get_71bb4348194e31f0: function(arg0, arg1) {
1082
+ const obj = arg1;
1083
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1084
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1085
+ var len1 = WASM_VECTOR_LEN;
1086
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1087
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1088
+ },
1089
+ __wbg___wbindgen_throw_ea4887a5f8f9a9db: function(arg0, arg1) {
1090
+ throw new Error(getStringFromWasm0(arg0, arg1));
1091
+ },
1092
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
1093
+ // Cast intrinsic for `Ref(String) -> Externref`.
1094
+ const ret = getStringFromWasm0(arg0, arg1);
1095
+ return ret;
1096
+ },
1097
+ __wbindgen_init_externref_table: function() {
1098
+ const table = wasm.__wbindgen_externrefs;
1099
+ const offset = table.grow(4);
1100
+ table.set(0, undefined);
1101
+ table.set(offset + 0, undefined);
1102
+ table.set(offset + 1, null);
1103
+ table.set(offset + 2, true);
1104
+ table.set(offset + 3, false);
1105
+ },
1106
+ };
1107
+ return {
1108
+ __proto__: null,
1109
+ "./sheetwrite_wasm_bg.js": import0,
1110
+ };
1111
+ }
1112
+
1113
+ const CellOutFinalization = (typeof FinalizationRegistry === 'undefined')
1114
+ ? { register: () => {}, unregister: () => {} }
1115
+ : new FinalizationRegistry(ptr => wasm.__wbg_cellout_free(ptr, 1));
1116
+ const CellStoreFinalization = (typeof FinalizationRegistry === 'undefined')
1117
+ ? { register: () => {}, unregister: () => {} }
1118
+ : new FinalizationRegistry(ptr => wasm.__wbg_cellstore_free(ptr, 1));
1119
+ const DistinctColumnFinalization = (typeof FinalizationRegistry === 'undefined')
1120
+ ? { register: () => {}, unregister: () => {} }
1121
+ : new FinalizationRegistry(ptr => wasm.__wbg_distinctcolumn_free(ptr, 1));
1122
+ const RangeSnapshotFinalization = (typeof FinalizationRegistry === 'undefined')
1123
+ ? { register: () => {}, unregister: () => {} }
1124
+ : new FinalizationRegistry(ptr => wasm.__wbg_rangesnapshot_free(ptr, 1));
1125
+ const WindowViewFinalization = (typeof FinalizationRegistry === 'undefined')
1126
+ ? { register: () => {}, unregister: () => {} }
1127
+ : new FinalizationRegistry(ptr => wasm.__wbg_windowview_free(ptr, 1));
1128
+
1129
+ function addToExternrefTable0(obj) {
1130
+ const idx = wasm.__externref_table_alloc();
1131
+ wasm.__wbindgen_externrefs.set(idx, obj);
1132
+ return idx;
1133
+ }
1134
+
1135
+ function _assertClass(instance, klass) {
1136
+ if (!(instance instanceof klass)) {
1137
+ throw new Error(`expected instance of ${klass.name}`);
1138
+ }
1139
+ }
1140
+
1141
+ function getArrayF64FromWasm0(ptr, len) {
1142
+ ptr = ptr >>> 0;
1143
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
1144
+ }
1145
+
1146
+ function getArrayI32FromWasm0(ptr, len) {
1147
+ ptr = ptr >>> 0;
1148
+ return getInt32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
1149
+ }
1150
+
1151
+ function getArrayJsValueFromWasm0(ptr, len) {
1152
+ ptr = ptr >>> 0;
1153
+ const mem = getDataViewMemory0();
1154
+ const result = [];
1155
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
1156
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
1157
+ }
1158
+ wasm.__externref_drop_slice(ptr, len);
1159
+ return result;
1160
+ }
1161
+
1162
+ function getArrayU32FromWasm0(ptr, len) {
1163
+ ptr = ptr >>> 0;
1164
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
1165
+ }
1166
+
1167
+ function getArrayU8FromWasm0(ptr, len) {
1168
+ ptr = ptr >>> 0;
1169
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1170
+ }
1171
+
1172
+ let cachedDataViewMemory0 = null;
1173
+ function getDataViewMemory0() {
1174
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1175
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1176
+ }
1177
+ return cachedDataViewMemory0;
1178
+ }
1179
+
1180
+ let cachedFloat64ArrayMemory0 = null;
1181
+ function getFloat64ArrayMemory0() {
1182
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
1183
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
1184
+ }
1185
+ return cachedFloat64ArrayMemory0;
1186
+ }
1187
+
1188
+ let cachedInt32ArrayMemory0 = null;
1189
+ function getInt32ArrayMemory0() {
1190
+ if (cachedInt32ArrayMemory0 === null || cachedInt32ArrayMemory0.byteLength === 0) {
1191
+ cachedInt32ArrayMemory0 = new Int32Array(wasm.memory.buffer);
1192
+ }
1193
+ return cachedInt32ArrayMemory0;
1194
+ }
1195
+
1196
+ function getStringFromWasm0(ptr, len) {
1197
+ return decodeText(ptr >>> 0, len);
1198
+ }
1199
+
1200
+ let cachedUint32ArrayMemory0 = null;
1201
+ function getUint32ArrayMemory0() {
1202
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
1203
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
1204
+ }
1205
+ return cachedUint32ArrayMemory0;
1206
+ }
1207
+
1208
+ let cachedUint8ArrayMemory0 = null;
1209
+ function getUint8ArrayMemory0() {
1210
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1211
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1212
+ }
1213
+ return cachedUint8ArrayMemory0;
1214
+ }
1215
+
1216
+ function isLikeNone(x) {
1217
+ return x === undefined || x === null;
1218
+ }
1219
+
1220
+ function passArray32ToWasm0(arg, malloc) {
1221
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1222
+ getUint32ArrayMemory0().set(arg, ptr / 4);
1223
+ WASM_VECTOR_LEN = arg.length;
1224
+ return ptr;
1225
+ }
1226
+
1227
+ function passArray8ToWasm0(arg, malloc) {
1228
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
1229
+ getUint8ArrayMemory0().set(arg, ptr / 1);
1230
+ WASM_VECTOR_LEN = arg.length;
1231
+ return ptr;
1232
+ }
1233
+
1234
+ function passArrayF64ToWasm0(arg, malloc) {
1235
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
1236
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
1237
+ WASM_VECTOR_LEN = arg.length;
1238
+ return ptr;
1239
+ }
1240
+
1241
+ function passArrayJsValueToWasm0(array, malloc) {
1242
+ const ptr = malloc(array.length * 4, 4) >>> 0;
1243
+ for (let i = 0; i < array.length; i++) {
1244
+ const add = addToExternrefTable0(array[i]);
1245
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
1246
+ }
1247
+ WASM_VECTOR_LEN = array.length;
1248
+ return ptr;
1249
+ }
1250
+
1251
+ function passStringToWasm0(arg, malloc, realloc) {
1252
+ if (realloc === undefined) {
1253
+ const buf = cachedTextEncoder.encode(arg);
1254
+ const ptr = malloc(buf.length, 1) >>> 0;
1255
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1256
+ WASM_VECTOR_LEN = buf.length;
1257
+ return ptr;
1258
+ }
1259
+
1260
+ let len = arg.length;
1261
+ let ptr = malloc(len, 1) >>> 0;
1262
+
1263
+ const mem = getUint8ArrayMemory0();
1264
+
1265
+ let offset = 0;
1266
+
1267
+ for (; offset < len; offset++) {
1268
+ const code = arg.charCodeAt(offset);
1269
+ if (code > 0x7F) break;
1270
+ mem[ptr + offset] = code;
1271
+ }
1272
+ if (offset !== len) {
1273
+ if (offset !== 0) {
1274
+ arg = arg.slice(offset);
1275
+ }
1276
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1277
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1278
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1279
+
1280
+ offset += ret.written;
1281
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1282
+ }
1283
+
1284
+ WASM_VECTOR_LEN = offset;
1285
+ return ptr;
1286
+ }
1287
+
1288
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1289
+ cachedTextDecoder.decode();
1290
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1291
+ let numBytesDecoded = 0;
1292
+ function decodeText(ptr, len) {
1293
+ numBytesDecoded += len;
1294
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1295
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1296
+ cachedTextDecoder.decode();
1297
+ numBytesDecoded = len;
1298
+ }
1299
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1300
+ }
1301
+
1302
+ const cachedTextEncoder = new TextEncoder();
1303
+
1304
+ if (!('encodeInto' in cachedTextEncoder)) {
1305
+ cachedTextEncoder.encodeInto = function (arg, view) {
1306
+ const buf = cachedTextEncoder.encode(arg);
1307
+ view.set(buf);
1308
+ return {
1309
+ read: arg.length,
1310
+ written: buf.length
1311
+ };
1312
+ };
1313
+ }
1314
+
1315
+ let WASM_VECTOR_LEN = 0;
1316
+
1317
+ let wasmModule, wasmInstance, wasm;
1318
+ function __wbg_finalize_init(instance, module) {
1319
+ wasmInstance = instance;
1320
+ wasm = instance.exports;
1321
+ wasmModule = module;
1322
+ cachedDataViewMemory0 = null;
1323
+ cachedFloat64ArrayMemory0 = null;
1324
+ cachedInt32ArrayMemory0 = null;
1325
+ cachedUint32ArrayMemory0 = null;
1326
+ cachedUint8ArrayMemory0 = null;
1327
+ wasm.__wbindgen_start();
1328
+ return wasm;
1329
+ }
1330
+
1331
+ async function __wbg_load(module, imports) {
1332
+ if (typeof Response === 'function' && module instanceof Response) {
1333
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1334
+ try {
1335
+ return await WebAssembly.instantiateStreaming(module, imports);
1336
+ } catch (e) {
1337
+ const validResponse = module.ok && expectedResponseType(module.type);
1338
+
1339
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1340
+ 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);
1341
+
1342
+ } else { throw e; }
1343
+ }
1344
+ }
1345
+
1346
+ const bytes = await module.arrayBuffer();
1347
+ return await WebAssembly.instantiate(bytes, imports);
1348
+ } else {
1349
+ const instance = await WebAssembly.instantiate(module, imports);
1350
+
1351
+ if (instance instanceof WebAssembly.Instance) {
1352
+ return { instance, module };
1353
+ } else {
1354
+ return instance;
1355
+ }
1356
+ }
1357
+
1358
+ function expectedResponseType(type) {
1359
+ switch (type) {
1360
+ case 'basic': case 'cors': case 'default': return true;
1361
+ }
1362
+ return false;
1363
+ }
1364
+ }
1365
+
1366
+ function initSync(module) {
1367
+ if (wasm !== undefined) return wasm;
1368
+
1369
+
1370
+ if (module !== undefined) {
1371
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1372
+ ({module} = module)
1373
+ } else {
1374
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1375
+ }
1376
+ }
1377
+
1378
+ const imports = __wbg_get_imports();
1379
+ if (!(module instanceof WebAssembly.Module)) {
1380
+ module = new WebAssembly.Module(module);
1381
+ }
1382
+ const instance = new WebAssembly.Instance(module, imports);
1383
+ return __wbg_finalize_init(instance, module);
1384
+ }
1385
+
1386
+ async function __wbg_init(module_or_path) {
1387
+ if (wasm !== undefined) return wasm;
1388
+
1389
+
1390
+ if (module_or_path !== undefined) {
1391
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1392
+ ({module_or_path} = module_or_path)
1393
+ } else {
1394
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1395
+ }
1396
+ }
1397
+
1398
+ if (module_or_path === undefined) {
1399
+ module_or_path = new URL('sheetwrite_wasm_bg.wasm', import.meta.url);
1400
+ }
1401
+ const imports = __wbg_get_imports();
1402
+
1403
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1404
+ module_or_path = fetch(module_or_path);
1405
+ }
1406
+
1407
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1408
+
1409
+ return __wbg_finalize_init(instance, module);
1410
+ }
1411
+
1412
+ export { initSync, __wbg_init as default };