@einfach-excel/excel-wasm 0.0.0-stage → 0.2.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.
- package/LICENSE +21 -0
- package/README.md +33 -2
- package/full/README.md +269 -0
- package/full/einfach_wasm.d.ts +1081 -0
- package/full/einfach_wasm.js +3698 -0
- package/full/einfach_wasm_bg.wasm +0 -0
- package/full/einfach_wasm_bg.wasm.d.ts +223 -0
- package/full/package.json +16 -0
- package/lite/README.md +269 -0
- package/lite/einfach_wasm.d.ts +1081 -0
- package/lite/einfach_wasm.js +3698 -0
- package/lite/einfach_wasm_bg.wasm +0 -0
- package/lite/einfach_wasm_bg.wasm.d.ts +223 -0
- package/lite/package.json +16 -0
- package/package.json +54 -3
|
@@ -0,0 +1,3698 @@
|
|
|
1
|
+
/* @ts-self-types="./einfach_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WASM-exposed spreadsheet. Wraps the Rust Sheet.
|
|
5
|
+
*/
|
|
6
|
+
export class WasmSheet {
|
|
7
|
+
__destroy_into_raw() {
|
|
8
|
+
const ptr = this.__wbg_ptr;
|
|
9
|
+
this.__wbg_ptr = 0;
|
|
10
|
+
WasmSheetFinalization.unregister(this);
|
|
11
|
+
return ptr;
|
|
12
|
+
}
|
|
13
|
+
free() {
|
|
14
|
+
const ptr = this.__destroy_into_raw();
|
|
15
|
+
wasm.__wbg_wasmsheet_free(ptr, 0);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Debug-only panic injection — arms a one-shot flag so the next
|
|
19
|
+
* JsCallbackListener fire panics inside its microtask. After consumption
|
|
20
|
+
* the flag clears, so subsequent fires behave normally. Used by
|
|
21
|
+
* `regression.spec.ts` (Discovered #E.2) to verify console_error_panic_hook
|
|
22
|
+
* surfaces the panic to console.error AND the wasm instance keeps
|
|
23
|
+
* working for subsequent set_/get_ calls. Not part of the production
|
|
24
|
+
* API surface — naming with `__` prefix to flag.
|
|
25
|
+
*/
|
|
26
|
+
__debugPanicNextCallback() {
|
|
27
|
+
wasm.wasmsheet___debugPanicNextCallback(this.__wbg_ptr);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Set multiple cells at once (batch). Pass arrays of addresses and values.
|
|
31
|
+
* @param {string[]} addrs
|
|
32
|
+
* @param {Float64Array} values
|
|
33
|
+
*/
|
|
34
|
+
batch_set_numbers(addrs, values) {
|
|
35
|
+
const ptr0 = passArrayJsValueToWasm0(addrs, wasm.__wbindgen_malloc);
|
|
36
|
+
const len0 = WASM_VECTOR_LEN;
|
|
37
|
+
const ptr1 = passArrayF64ToWasm0(values, wasm.__wbindgen_malloc);
|
|
38
|
+
const len1 = WASM_VECTOR_LEN;
|
|
39
|
+
wasm.wasmsheet_batch_set_numbers(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Clear a cell to empty. Mirrors ISheet.clear_cell on the JS side.
|
|
43
|
+
* @param {string} addr
|
|
44
|
+
*/
|
|
45
|
+
clear_cell(addr) {
|
|
46
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
47
|
+
const len0 = WASM_VECTOR_LEN;
|
|
48
|
+
wasm.wasmsheet_clear_cell(this.__wbg_ptr, ptr0, len0);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Clear non-empty cells in a zero-based inclusive range. The core scans
|
|
52
|
+
* sparse entries only and coalesces dirty/subscriber propagation.
|
|
53
|
+
* @param {number} start_row
|
|
54
|
+
* @param {number} start_col
|
|
55
|
+
* @param {number} end_row
|
|
56
|
+
* @param {number} end_col
|
|
57
|
+
* @returns {number}
|
|
58
|
+
*/
|
|
59
|
+
clear_range(start_row, start_col, end_row, end_col) {
|
|
60
|
+
const ret = wasm.wasmsheet_clear_range(this.__wbg_ptr, start_row, start_col, end_row, end_col);
|
|
61
|
+
return ret >>> 0;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Number of formula records currently in the `Dirty` cache state.
|
|
65
|
+
* @returns {number}
|
|
66
|
+
*/
|
|
67
|
+
debug_dirty_count() {
|
|
68
|
+
const ret = wasm.wasmsheet_debug_dirty_count(this.__wbg_ptr);
|
|
69
|
+
return ret >>> 0;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Total formula evaluations performed since this sheet was created.
|
|
73
|
+
* @returns {number}
|
|
74
|
+
*/
|
|
75
|
+
debug_formula_eval_count() {
|
|
76
|
+
const ret = wasm.wasmsheet_debug_formula_eval_count(this.__wbg_ptr);
|
|
77
|
+
return ret >>> 0;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Number of formulas registered via `bulk_load` (cumulative).
|
|
81
|
+
* @returns {number}
|
|
82
|
+
*/
|
|
83
|
+
debug_imported_formula_count() {
|
|
84
|
+
const ret = wasm.wasmsheet_debug_imported_formula_count(this.__wbg_ptr);
|
|
85
|
+
return ret >>> 0;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Number of `CellAddress`es with at least one live listener.
|
|
89
|
+
* @returns {number}
|
|
90
|
+
*/
|
|
91
|
+
debug_live_subscription_count() {
|
|
92
|
+
const ret = wasm.wasmsheet_debug_live_subscription_count(this.__wbg_ptr);
|
|
93
|
+
return ret >>> 0;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Number of materialized Store geometry roots used by large range
|
|
97
|
+
* formulas. Small ranges depend on member facades and contribute zero.
|
|
98
|
+
* @returns {number}
|
|
99
|
+
*/
|
|
100
|
+
debug_range_dep_count() {
|
|
101
|
+
const ret = wasm.wasmsheet_debug_range_dep_count(this.__wbg_ptr);
|
|
102
|
+
return ret >>> 0;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* @param {number} at
|
|
106
|
+
* @param {number} count
|
|
107
|
+
*/
|
|
108
|
+
delete_col(at, count) {
|
|
109
|
+
wasm.wasmsheet_delete_col(this.__wbg_ptr, at, count);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* @param {number} at
|
|
113
|
+
* @param {number} count
|
|
114
|
+
*/
|
|
115
|
+
delete_row(at, count) {
|
|
116
|
+
wasm.wasmsheet_delete_row(this.__wbg_ptr, at, count);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Format a cell's value using its effective format. Numeric cells go
|
|
120
|
+
* through `CellFormat::format_number`; non-numeric cells fall back to
|
|
121
|
+
* the default display path.
|
|
122
|
+
*
|
|
123
|
+
* The error case is intercepted here rather than delegated.
|
|
124
|
+
* `Sheet::formatted_display` re-implements the display match instead of
|
|
125
|
+
* calling `value_to_display`, so it renders `Value::Error` through the
|
|
126
|
+
* engine-internal `Display` and would leak `#TYPE!` / `#ARGS!` — codes
|
|
127
|
+
* Excel does not have — into this legacy shell's cell text. A number
|
|
128
|
+
* format can never apply to an error, so short-circuiting the error arm is
|
|
129
|
+
* behaviour-identical apart from the token map. This is a bridge, not
|
|
130
|
+
* the fix: the durable one is for `Sheet::formatted_display` to route
|
|
131
|
+
* its `Value::Error` arm through `error_display_token` too, at which
|
|
132
|
+
* point this arm becomes redundant (and harmless).
|
|
133
|
+
* @param {string} addr
|
|
134
|
+
* @returns {string}
|
|
135
|
+
*/
|
|
136
|
+
formatted_display(addr) {
|
|
137
|
+
let deferred2_0;
|
|
138
|
+
let deferred2_1;
|
|
139
|
+
try {
|
|
140
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
141
|
+
const len0 = WASM_VECTOR_LEN;
|
|
142
|
+
const ret = wasm.wasmsheet_formatted_display(this.__wbg_ptr, ptr0, len0);
|
|
143
|
+
deferred2_0 = ret[0];
|
|
144
|
+
deferred2_1 = ret[1];
|
|
145
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
146
|
+
} finally {
|
|
147
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Get a cell's display value as a string.
|
|
152
|
+
* @param {string} addr
|
|
153
|
+
* @returns {string}
|
|
154
|
+
*/
|
|
155
|
+
get_display(addr) {
|
|
156
|
+
let deferred2_0;
|
|
157
|
+
let deferred2_1;
|
|
158
|
+
try {
|
|
159
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
160
|
+
const len0 = WASM_VECTOR_LEN;
|
|
161
|
+
const ret = wasm.wasmsheet_get_display(this.__wbg_ptr, ptr0, len0);
|
|
162
|
+
deferred2_0 = ret[0];
|
|
163
|
+
deferred2_1 = ret[1];
|
|
164
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
165
|
+
} finally {
|
|
166
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Read the effective format for a cell (base + first matching
|
|
171
|
+
* conditional rule override).
|
|
172
|
+
* @param {string} addr
|
|
173
|
+
* @returns {any}
|
|
174
|
+
*/
|
|
175
|
+
get_effective_format(addr) {
|
|
176
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
177
|
+
const len0 = WASM_VECTOR_LEN;
|
|
178
|
+
const ret = wasm.wasmsheet_get_effective_format(this.__wbg_ptr, ptr0, len0);
|
|
179
|
+
return ret;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Read the base format for a cell (no conditional rules applied).
|
|
183
|
+
* @param {string} addr
|
|
184
|
+
* @returns {any}
|
|
185
|
+
*/
|
|
186
|
+
get_format(addr) {
|
|
187
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
188
|
+
const len0 = WASM_VECTOR_LEN;
|
|
189
|
+
const ret = wasm.wasmsheet_get_format(this.__wbg_ptr, ptr0, len0);
|
|
190
|
+
return ret;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Return a cell's original formula text, or empty string for cells
|
|
194
|
+
* without a formula. Used by the formula bar / double-click edit so
|
|
195
|
+
* users edit `=A1*2` instead of the displayed result `20` (D.11).
|
|
196
|
+
* @param {string} addr
|
|
197
|
+
* @returns {string}
|
|
198
|
+
*/
|
|
199
|
+
get_formula(addr) {
|
|
200
|
+
let deferred2_0;
|
|
201
|
+
let deferred2_1;
|
|
202
|
+
try {
|
|
203
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
204
|
+
const len0 = WASM_VECTOR_LEN;
|
|
205
|
+
const ret = wasm.wasmsheet_get_formula(this.__wbg_ptr, ptr0, len0);
|
|
206
|
+
deferred2_0 = ret[0];
|
|
207
|
+
deferred2_1 = ret[1];
|
|
208
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
209
|
+
} finally {
|
|
210
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Get a cell's raw numeric value. Returns NaN if not a number.
|
|
215
|
+
* @param {string} addr
|
|
216
|
+
* @returns {number}
|
|
217
|
+
*/
|
|
218
|
+
get_number(addr) {
|
|
219
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
220
|
+
const len0 = WASM_VECTOR_LEN;
|
|
221
|
+
const ret = wasm.wasmsheet_get_number(this.__wbg_ptr, ptr0, len0);
|
|
222
|
+
return ret;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Get the type of a cell's value: "number", "text", "boolean", "null", "error"
|
|
226
|
+
* @param {string} addr
|
|
227
|
+
* @returns {string}
|
|
228
|
+
*/
|
|
229
|
+
get_type(addr) {
|
|
230
|
+
let deferred2_0;
|
|
231
|
+
let deferred2_1;
|
|
232
|
+
try {
|
|
233
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
234
|
+
const len0 = WASM_VECTOR_LEN;
|
|
235
|
+
const ret = wasm.wasmsheet_get_type(this.__wbg_ptr, ptr0, len0);
|
|
236
|
+
deferred2_0 = ret[0];
|
|
237
|
+
deferred2_1 = ret[1];
|
|
238
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
239
|
+
} finally {
|
|
240
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* @param {number} at
|
|
245
|
+
* @param {number} count
|
|
246
|
+
*/
|
|
247
|
+
insert_col(at, count) {
|
|
248
|
+
wasm.wasmsheet_insert_col(this.__wbg_ptr, at, count);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* @param {number} at
|
|
252
|
+
* @param {number} count
|
|
253
|
+
*/
|
|
254
|
+
insert_row(at, count) {
|
|
255
|
+
wasm.wasmsheet_insert_row(this.__wbg_ptr, at, count);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Check if a cell contains an error.
|
|
259
|
+
* @param {string} addr
|
|
260
|
+
* @returns {boolean}
|
|
261
|
+
*/
|
|
262
|
+
is_error(addr) {
|
|
263
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
264
|
+
const len0 = WASM_VECTOR_LEN;
|
|
265
|
+
const ret = wasm.wasmsheet_is_error(this.__wbg_ptr, ptr0, len0);
|
|
266
|
+
return ret !== 0;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Create a new empty spreadsheet.
|
|
270
|
+
*/
|
|
271
|
+
constructor() {
|
|
272
|
+
const ret = wasm.wasmsheet_new();
|
|
273
|
+
this.__wbg_ptr = ret >>> 0;
|
|
274
|
+
WasmSheetFinalization.register(this, this.__wbg_ptr, this);
|
|
275
|
+
return this;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Every non-empty address on this sheet, as `"A1"`-style strings.
|
|
279
|
+
* Empty cells are skipped; an address holding both a primitive slot
|
|
280
|
+
* and a formula appears once (formula dominates). Used by
|
|
281
|
+
* structural-undo to snapshot only what needs restoring — see
|
|
282
|
+
* `excel/solid-excel/docs/STRUCTURAL_UNDO.md`.
|
|
283
|
+
* @returns {string[]}
|
|
284
|
+
*/
|
|
285
|
+
non_empty_addrs() {
|
|
286
|
+
const ret = wasm.wasmsheet_non_empty_addrs(this.__wbg_ptr);
|
|
287
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
288
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
289
|
+
return v1;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* 按属性写入 cellStyle / rowStyle / columnStyle。
|
|
293
|
+
* @param {number} start_row
|
|
294
|
+
* @param {number} start_col
|
|
295
|
+
* @param {number} end_row
|
|
296
|
+
* @param {number} end_col
|
|
297
|
+
* @param {any} patch
|
|
298
|
+
* @param {string} scope
|
|
299
|
+
* @returns {number}
|
|
300
|
+
*/
|
|
301
|
+
patch_format_range(start_row, start_col, end_row, end_col, patch, scope) {
|
|
302
|
+
const ptr0 = passStringToWasm0(scope, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
303
|
+
const len0 = WASM_VECTOR_LEN;
|
|
304
|
+
const ret = wasm.wasmsheet_patch_format_range(this.__wbg_ptr, start_row, start_col, end_row, end_col, patch, ptr0, len0);
|
|
305
|
+
if (ret[2]) {
|
|
306
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
307
|
+
}
|
|
308
|
+
return ret[0] >>> 0;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Restore metadata produced by `snapshot_format_range`.
|
|
312
|
+
* @param {any} snapshot
|
|
313
|
+
* @returns {number}
|
|
314
|
+
*/
|
|
315
|
+
restore_format_snapshot(snapshot) {
|
|
316
|
+
const ret = wasm.wasmsheet_restore_format_snapshot(this.__wbg_ptr, snapshot);
|
|
317
|
+
if (ret[2]) {
|
|
318
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
319
|
+
}
|
|
320
|
+
return ret[0] >>> 0;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Set a cell to a boolean value.
|
|
324
|
+
* @param {string} addr
|
|
325
|
+
* @param {boolean} value
|
|
326
|
+
*/
|
|
327
|
+
set_boolean(addr, value) {
|
|
328
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
329
|
+
const len0 = WASM_VECTOR_LEN;
|
|
330
|
+
wasm.wasmsheet_set_boolean(this.__wbg_ptr, ptr0, len0, value);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Set a cell to an error value by its display code. Unknown codes fall
|
|
334
|
+
* back to #VALUE!, matching the generic invalid-value error.
|
|
335
|
+
* @param {string} addr
|
|
336
|
+
* @param {string} value
|
|
337
|
+
*/
|
|
338
|
+
set_error(addr, value) {
|
|
339
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
340
|
+
const len0 = WASM_VECTOR_LEN;
|
|
341
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
342
|
+
const len1 = WASM_VECTOR_LEN;
|
|
343
|
+
wasm.wasmsheet_set_error(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* @param {string} addr
|
|
347
|
+
* @param {any} fmt
|
|
348
|
+
*/
|
|
349
|
+
set_format(addr, fmt) {
|
|
350
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
351
|
+
const len0 = WASM_VECTOR_LEN;
|
|
352
|
+
const ret = wasm.wasmsheet_set_format(this.__wbg_ptr, ptr0, len0, fmt);
|
|
353
|
+
if (ret[1]) {
|
|
354
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* 兼容旧调用:把完整格式逐格写进 cellStyle。
|
|
359
|
+
* @param {number} start_row
|
|
360
|
+
* @param {number} start_col
|
|
361
|
+
* @param {number} end_row
|
|
362
|
+
* @param {number} end_col
|
|
363
|
+
* @param {any} fmt
|
|
364
|
+
* @returns {number}
|
|
365
|
+
*/
|
|
366
|
+
set_format_range(start_row, start_col, end_row, end_col, fmt) {
|
|
367
|
+
const ret = wasm.wasmsheet_set_format_range(this.__wbg_ptr, start_row, start_col, end_row, end_col, fmt);
|
|
368
|
+
if (ret[2]) {
|
|
369
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
370
|
+
}
|
|
371
|
+
return ret[0] >>> 0;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Set a cell's formula (e.g. "=A1+B1").
|
|
375
|
+
* Returns `true` if the formula parsed successfully, `false` if it was
|
|
376
|
+
* invalid (cell becomes `#VALUE!`) or would form a cycle (cell becomes `#CYCLE!`).
|
|
377
|
+
* @param {string} addr
|
|
378
|
+
* @param {string} formula
|
|
379
|
+
* @returns {boolean}
|
|
380
|
+
*/
|
|
381
|
+
set_formula(addr, formula) {
|
|
382
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
383
|
+
const len0 = WASM_VECTOR_LEN;
|
|
384
|
+
const ptr1 = passStringToWasm0(formula, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
385
|
+
const len1 = WASM_VECTOR_LEN;
|
|
386
|
+
const ret = wasm.wasmsheet_set_formula(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
387
|
+
return ret !== 0;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Set a cell to a numeric value. Subscribers fire automatically via the
|
|
391
|
+
* store's propagation pass — no manual fire_listeners needed (C.1+C.2).
|
|
392
|
+
* @param {string} addr
|
|
393
|
+
* @param {number} value
|
|
394
|
+
*/
|
|
395
|
+
set_number(addr, value) {
|
|
396
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
397
|
+
const len0 = WASM_VECTOR_LEN;
|
|
398
|
+
wasm.wasmsheet_set_number(this.__wbg_ptr, ptr0, len0, value);
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Set a cell to a text value.
|
|
402
|
+
* @param {string} addr
|
|
403
|
+
* @param {string} value
|
|
404
|
+
*/
|
|
405
|
+
set_text(addr, value) {
|
|
406
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
407
|
+
const len0 = WASM_VECTOR_LEN;
|
|
408
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
409
|
+
const len1 = WASM_VECTOR_LEN;
|
|
410
|
+
wasm.wasmsheet_set_text(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Snapshot sparse formatting metadata for undoing a later range-format
|
|
414
|
+
* edit. Does not read cell values or materialize empty cells.
|
|
415
|
+
* @param {number} start_row
|
|
416
|
+
* @param {number} start_col
|
|
417
|
+
* @param {number} end_row
|
|
418
|
+
* @param {number} end_col
|
|
419
|
+
* @returns {any}
|
|
420
|
+
*/
|
|
421
|
+
snapshot_format_range(start_row, start_col, end_row, end_col) {
|
|
422
|
+
const ret = wasm.wasmsheet_snapshot_format_range(this.__wbg_ptr, start_row, start_col, end_row, end_col);
|
|
423
|
+
if (ret[2]) {
|
|
424
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
425
|
+
}
|
|
426
|
+
return takeFromExternrefTable0(ret[0]);
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* If `addr` is a dynamic-array spill *anchor*, return the spill
|
|
430
|
+
* shape as a `[rows, cols]` `Uint32Array`. Returns `undefined` /
|
|
431
|
+
* `null` (`JsValue::null`) for plain cells, spilled-into cells,
|
|
432
|
+
* and `#SPILL!` anchors. The JS UI uses this to render the spill
|
|
433
|
+
* border around the anchor's bounding rectangle.
|
|
434
|
+
* @param {string} addr
|
|
435
|
+
* @returns {any}
|
|
436
|
+
*/
|
|
437
|
+
spillInfo(addr) {
|
|
438
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
439
|
+
const len0 = WASM_VECTOR_LEN;
|
|
440
|
+
const ret = wasm.wasmsheet_spillInfo(this.__wbg_ptr, ptr0, len0);
|
|
441
|
+
return ret;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Subscribe to changes on a cell. Returns an opaque u32 token to pass
|
|
445
|
+
* to `unsubscribe`. The callback fires whenever the cell's value
|
|
446
|
+
* changes — including transitively through formula dependencies (C.2).
|
|
447
|
+
* @param {string} addr
|
|
448
|
+
* @param {Function} callback
|
|
449
|
+
* @returns {number}
|
|
450
|
+
*/
|
|
451
|
+
subscribe(addr, callback) {
|
|
452
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
453
|
+
const len0 = WASM_VECTOR_LEN;
|
|
454
|
+
const ret = wasm.wasmsheet_subscribe(this.__wbg_ptr, ptr0, len0, callback);
|
|
455
|
+
return ret >>> 0;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Cancel a subscription previously returned from `subscribe`.
|
|
459
|
+
* Idempotent: unknown tokens are ignored.
|
|
460
|
+
* @param {number} token
|
|
461
|
+
*/
|
|
462
|
+
unsubscribe(token) {
|
|
463
|
+
wasm.wasmsheet_unsubscribe(this.__wbg_ptr, token);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
if (Symbol.dispose) WasmSheet.prototype[Symbol.dispose] = WasmSheet.prototype.free;
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* WASM-exposed workbook. Wraps the Rust Workbook so browser demos can
|
|
470
|
+
* evaluate formulas through workbook context, including cross-sheet refs.
|
|
471
|
+
*/
|
|
472
|
+
export class WasmWorkbook {
|
|
473
|
+
__destroy_into_raw() {
|
|
474
|
+
const ptr = this.__wbg_ptr;
|
|
475
|
+
this.__wbg_ptr = 0;
|
|
476
|
+
WasmWorkbookFinalization.unregister(this);
|
|
477
|
+
return ptr;
|
|
478
|
+
}
|
|
479
|
+
free() {
|
|
480
|
+
const ptr = this.__destroy_into_raw();
|
|
481
|
+
wasm.__wbg_wasmworkbook_free(ptr, 0);
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* @param {string} name
|
|
485
|
+
* @returns {number}
|
|
486
|
+
*/
|
|
487
|
+
add_sheet(name) {
|
|
488
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
489
|
+
const len0 = WASM_VECTOR_LEN;
|
|
490
|
+
const ret = wasm.wasmworkbook_add_sheet(this.__wbg_ptr, ptr0, len0);
|
|
491
|
+
return ret >>> 0;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* @param {any} targets
|
|
495
|
+
* @returns {any}
|
|
496
|
+
*/
|
|
497
|
+
aggregate_selection(targets) {
|
|
498
|
+
const ret = wasm.wasmworkbook_aggregate_selection(this.__wbg_ptr, targets);
|
|
499
|
+
if (ret[2]) {
|
|
500
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
501
|
+
}
|
|
502
|
+
return takeFromExternrefTable0(ret[0]);
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Apply `{ rules: ColumnFilterRule[] }` to `sheetIdx`: run the
|
|
506
|
+
* predicate ONCE and commit both the rules and the rows they hid.
|
|
507
|
+
*
|
|
508
|
+
* Returns `{ ok: true, hiddenRows, scannedRows, predicateCells }`, or
|
|
509
|
+
* `{ ok: false, code, message? }`. `code: "source-too-large"` is the
|
|
510
|
+
* engine-side twin of the adapter's `FILTER_SORT_SOURCE_TOO_LARGE` —
|
|
511
|
+
* the filter does NOT activate and nothing is truncated.
|
|
512
|
+
*
|
|
513
|
+
* Visibility is a SNAPSHOT taken here. Later cell edits do not move
|
|
514
|
+
* it; `reapplyFilter` is the refresh path.
|
|
515
|
+
* @param {number} sheet_idx
|
|
516
|
+
* @param {any} payload
|
|
517
|
+
* @returns {any}
|
|
518
|
+
*/
|
|
519
|
+
applyFilter(sheet_idx, payload) {
|
|
520
|
+
const ret = wasm.wasmworkbook_applyFilter(this.__wbg_ptr, sheet_idx, payload);
|
|
521
|
+
if (ret[2]) {
|
|
522
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
523
|
+
}
|
|
524
|
+
return takeFromExternrefTable0(ret[0]);
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Preflight and apply one native drag-fill atomically. The payload uses
|
|
528
|
+
* zero-based inclusive ranges. `infer` derives parameters from native
|
|
529
|
+
* samples; otherwise explicit detector witnesses remain strictly validated.
|
|
530
|
+
* @param {any} payload
|
|
531
|
+
* @returns {any}
|
|
532
|
+
*/
|
|
533
|
+
apply_auto_fill(payload) {
|
|
534
|
+
const ret = wasm.wasmworkbook_apply_auto_fill(this.__wbg_ptr, payload);
|
|
535
|
+
if (ret[2]) {
|
|
536
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
537
|
+
}
|
|
538
|
+
return takeFromExternrefTable0(ret[0]);
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* 浏览器只提供一次文字测量回调;Rust 遍历稀疏数据并在测量全部成功后写尺寸。
|
|
542
|
+
* @param {number} sheet
|
|
543
|
+
* @param {number} start_row
|
|
544
|
+
* @param {number} start_col
|
|
545
|
+
* @param {number} end_row
|
|
546
|
+
* @param {number} end_col
|
|
547
|
+
* @param {string} axis
|
|
548
|
+
* @param {number} default_row
|
|
549
|
+
* @param {number} default_col
|
|
550
|
+
* @param {Function} measure
|
|
551
|
+
* @returns {boolean}
|
|
552
|
+
*/
|
|
553
|
+
auto_fit_dimensions(sheet, start_row, start_col, end_row, end_col, axis, default_row, default_col, measure) {
|
|
554
|
+
const ptr0 = passStringToWasm0(axis, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
555
|
+
const len0 = WASM_VECTOR_LEN;
|
|
556
|
+
const ret = wasm.wasmworkbook_auto_fit_dimensions(this.__wbg_ptr, sheet, start_row, start_col, end_row, end_col, ptr0, len0, default_row, default_col, measure);
|
|
557
|
+
if (ret[2]) {
|
|
558
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
559
|
+
}
|
|
560
|
+
return ret[0] !== 0;
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* @param {any} cells
|
|
564
|
+
* @returns {any}
|
|
565
|
+
*/
|
|
566
|
+
bulkImportCellsInstrumented(cells) {
|
|
567
|
+
const ret = wasm.wasmworkbook_bulkImportCellsInstrumented(this.__wbg_ptr, cells);
|
|
568
|
+
if (ret[2]) {
|
|
569
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
570
|
+
}
|
|
571
|
+
return takeFromExternrefTable0(ret[0]);
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* @param {any} cells
|
|
575
|
+
* @returns {any}
|
|
576
|
+
*/
|
|
577
|
+
bulk_import_cells(cells) {
|
|
578
|
+
const ret = wasm.wasmworkbook_bulk_import_cells(this.__wbg_ptr, cells);
|
|
579
|
+
if (ret[2]) {
|
|
580
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
581
|
+
}
|
|
582
|
+
return takeFromExternrefTable0(ret[0]);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* @param {any} payload
|
|
586
|
+
* @returns {any}
|
|
587
|
+
*/
|
|
588
|
+
bulk_install_workbook(payload) {
|
|
589
|
+
const ret = wasm.wasmworkbook_bulk_install_workbook(this.__wbg_ptr, payload);
|
|
590
|
+
if (ret[2]) {
|
|
591
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
592
|
+
}
|
|
593
|
+
return takeFromExternrefTable0(ret[0]);
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* @param {number} sheet_idx
|
|
597
|
+
* @param {number} start_row
|
|
598
|
+
* @param {number} start_col
|
|
599
|
+
* @param {number} end_row
|
|
600
|
+
* @param {number} end_col
|
|
601
|
+
* @param {boolean} cut
|
|
602
|
+
* @returns {any}
|
|
603
|
+
*/
|
|
604
|
+
capture_clipboard(sheet_idx, start_row, start_col, end_row, end_col, cut) {
|
|
605
|
+
const ret = wasm.wasmworkbook_capture_clipboard(this.__wbg_ptr, sheet_idx, start_row, start_col, end_row, end_col, cut);
|
|
606
|
+
if (ret[2]) {
|
|
607
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
608
|
+
}
|
|
609
|
+
return takeFromExternrefTable0(ret[0]);
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* 格式刷使用独立快照槽;保持普通剪贴板既有导出签名。
|
|
613
|
+
* @param {number} sheet_idx
|
|
614
|
+
* @param {number} start_row
|
|
615
|
+
* @param {number} start_col
|
|
616
|
+
* @param {number} end_row
|
|
617
|
+
* @param {number} end_col
|
|
618
|
+
* @returns {any}
|
|
619
|
+
*/
|
|
620
|
+
capture_format_painter(sheet_idx, start_row, start_col, end_row, end_col) {
|
|
621
|
+
const ret = wasm.wasmworkbook_capture_format_painter(this.__wbg_ptr, sheet_idx, start_row, start_col, end_row, end_col);
|
|
622
|
+
if (ret[2]) {
|
|
623
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
624
|
+
}
|
|
625
|
+
return takeFromExternrefTable0(ret[0]);
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* @param {number} sheet
|
|
629
|
+
* @param {number} row
|
|
630
|
+
* @param {number} col
|
|
631
|
+
* @param {string} change_json
|
|
632
|
+
* @returns {boolean}
|
|
633
|
+
*/
|
|
634
|
+
change_comment(sheet, row, col, change_json) {
|
|
635
|
+
const ptr0 = passStringToWasm0(change_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
636
|
+
const len0 = WASM_VECTOR_LEN;
|
|
637
|
+
const ret = wasm.wasmworkbook_change_comment(this.__wbg_ptr, sheet, row, col, ptr0, len0);
|
|
638
|
+
if (ret[2]) {
|
|
639
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
640
|
+
}
|
|
641
|
+
return ret[0] !== 0;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* @param {number} sheet
|
|
645
|
+
* @param {string} action_json
|
|
646
|
+
* @returns {boolean}
|
|
647
|
+
*/
|
|
648
|
+
change_custom_formula(sheet, action_json) {
|
|
649
|
+
const ptr0 = passStringToWasm0(action_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
650
|
+
const len0 = WASM_VECTOR_LEN;
|
|
651
|
+
const ret = wasm.wasmworkbook_change_custom_formula(this.__wbg_ptr, sheet, ptr0, len0);
|
|
652
|
+
if (ret[2]) {
|
|
653
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
654
|
+
}
|
|
655
|
+
return ret[0] !== 0;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* 一个原生命令完成显示文字/链接修改及单条撤销记录。
|
|
659
|
+
* @param {number} sheet
|
|
660
|
+
* @param {number} row
|
|
661
|
+
* @param {number} col
|
|
662
|
+
* @param {string | null} [url]
|
|
663
|
+
* @param {string | null} [text]
|
|
664
|
+
* @returns {boolean}
|
|
665
|
+
*/
|
|
666
|
+
change_hyperlink(sheet, row, col, url, text) {
|
|
667
|
+
var ptr0 = isLikeNone(url) ? 0 : passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
668
|
+
var len0 = WASM_VECTOR_LEN;
|
|
669
|
+
var ptr1 = isLikeNone(text) ? 0 : passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
670
|
+
var len1 = WASM_VECTOR_LEN;
|
|
671
|
+
const ret = wasm.wasmworkbook_change_hyperlink(this.__wbg_ptr, sheet, row, col, ptr0, len0, ptr1, len1);
|
|
672
|
+
if (ret[2]) {
|
|
673
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
674
|
+
}
|
|
675
|
+
return ret[0] !== 0;
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* @param {number} sheet
|
|
679
|
+
* @param {any} action
|
|
680
|
+
* @returns {boolean}
|
|
681
|
+
*/
|
|
682
|
+
change_named_range(sheet, action) {
|
|
683
|
+
const ret = wasm.wasmworkbook_change_named_range(this.__wbg_ptr, sheet, action);
|
|
684
|
+
if (ret[2]) {
|
|
685
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
686
|
+
}
|
|
687
|
+
return ret[0] !== 0;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* @param {number} sheet
|
|
691
|
+
* @param {number} row
|
|
692
|
+
* @param {number} col
|
|
693
|
+
* @param {string | null} [text]
|
|
694
|
+
* @returns {boolean}
|
|
695
|
+
*/
|
|
696
|
+
change_note(sheet, row, col, text) {
|
|
697
|
+
var ptr0 = isLikeNone(text) ? 0 : passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
698
|
+
var len0 = WASM_VECTOR_LEN;
|
|
699
|
+
const ret = wasm.wasmworkbook_change_note(this.__wbg_ptr, sheet, row, col, ptr0, len0);
|
|
700
|
+
if (ret[2]) {
|
|
701
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
702
|
+
}
|
|
703
|
+
return ret[0] !== 0;
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* @param {number} sheet
|
|
707
|
+
* @param {string} axis
|
|
708
|
+
* @param {any} action
|
|
709
|
+
* @returns {boolean}
|
|
710
|
+
*/
|
|
711
|
+
change_outline(sheet, axis, action) {
|
|
712
|
+
const ptr0 = passStringToWasm0(axis, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
713
|
+
const len0 = WASM_VECTOR_LEN;
|
|
714
|
+
const ret = wasm.wasmworkbook_change_outline(this.__wbg_ptr, sheet, ptr0, len0, action);
|
|
715
|
+
if (ret[2]) {
|
|
716
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
717
|
+
}
|
|
718
|
+
return ret[0] !== 0;
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* @param {number} sheet
|
|
722
|
+
* @param {any} change
|
|
723
|
+
* @returns {boolean}
|
|
724
|
+
*/
|
|
725
|
+
change_protection(sheet, change) {
|
|
726
|
+
const ret = wasm.wasmworkbook_change_protection(this.__wbg_ptr, sheet, change);
|
|
727
|
+
if (ret[2]) {
|
|
728
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
729
|
+
}
|
|
730
|
+
return ret[0] !== 0;
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* @param {number} sheet
|
|
734
|
+
* @param {any} action
|
|
735
|
+
* @returns {boolean}
|
|
736
|
+
*/
|
|
737
|
+
change_table(sheet, action) {
|
|
738
|
+
const ret = wasm.wasmworkbook_change_table(this.__wbg_ptr, sheet, action);
|
|
739
|
+
if (ret[2]) {
|
|
740
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
741
|
+
}
|
|
742
|
+
return ret[0] !== 0;
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Clear a cell through the workbook. Local and cross-sheet formulas that
|
|
746
|
+
* read the cell re-derive through the shared Store graph.
|
|
747
|
+
* @param {number} sheet_idx
|
|
748
|
+
* @param {string} addr
|
|
749
|
+
*/
|
|
750
|
+
clearCellAt(sheet_idx, addr) {
|
|
751
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
752
|
+
const len0 = WASM_VECTOR_LEN;
|
|
753
|
+
wasm.wasmworkbook_clearCellAt(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Drop `sheetIdx`'s filter — rules and derived rows both. Scan-free.
|
|
757
|
+
* @param {number} sheet_idx
|
|
758
|
+
* @returns {any}
|
|
759
|
+
*/
|
|
760
|
+
clearFilter(sheet_idx) {
|
|
761
|
+
const ret = wasm.wasmworkbook_clearFilter(this.__wbg_ptr, sheet_idx);
|
|
762
|
+
if (ret[2]) {
|
|
763
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
764
|
+
}
|
|
765
|
+
return takeFromExternrefTable0(ret[0]);
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* @param {number} sheet_idx
|
|
769
|
+
* @param {string} addr
|
|
770
|
+
*/
|
|
771
|
+
clear_cell(sheet_idx, addr) {
|
|
772
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
773
|
+
const len0 = WASM_VECTOR_LEN;
|
|
774
|
+
wasm.wasmworkbook_clear_cell(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* @param {number} sheet_idx
|
|
778
|
+
* @param {number} start_row
|
|
779
|
+
* @param {number} start_col
|
|
780
|
+
* @param {number} end_row
|
|
781
|
+
* @param {number} end_col
|
|
782
|
+
* @returns {number}
|
|
783
|
+
*/
|
|
784
|
+
clear_range(sheet_idx, start_row, start_col, end_row, end_col) {
|
|
785
|
+
const ret = wasm.wasmworkbook_clear_range(this.__wbg_ptr, sheet_idx, start_row, start_col, end_row, end_col);
|
|
786
|
+
return ret >>> 0;
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* @param {any} request
|
|
790
|
+
* @returns {any}
|
|
791
|
+
*/
|
|
792
|
+
clear_selection(request) {
|
|
793
|
+
const ret = wasm.wasmworkbook_clear_selection(this.__wbg_ptr, request);
|
|
794
|
+
if (ret[2]) {
|
|
795
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
796
|
+
}
|
|
797
|
+
return takeFromExternrefTable0(ret[0]);
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Define a Table over `[start..=end]` on `sheet_idx`. `name` is
|
|
801
|
+
* `Some` to use an explicit (validated) name, or `None`/`undefined`
|
|
802
|
+
* to auto-generate `Table1`, `Table2`, …. Returns the final
|
|
803
|
+
* (canonical-cased) Table name.
|
|
804
|
+
* @param {number} sheet_idx
|
|
805
|
+
* @param {number} start_row
|
|
806
|
+
* @param {number} start_col
|
|
807
|
+
* @param {number} end_row
|
|
808
|
+
* @param {number} end_col
|
|
809
|
+
* @param {string | null} [name]
|
|
810
|
+
* @returns {string}
|
|
811
|
+
*/
|
|
812
|
+
createTable(sheet_idx, start_row, start_col, end_row, end_col, name) {
|
|
813
|
+
let deferred3_0;
|
|
814
|
+
let deferred3_1;
|
|
815
|
+
try {
|
|
816
|
+
var ptr0 = isLikeNone(name) ? 0 : passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
817
|
+
var len0 = WASM_VECTOR_LEN;
|
|
818
|
+
const ret = wasm.wasmworkbook_createTable(this.__wbg_ptr, sheet_idx, start_row, start_col, end_row, end_col, ptr0, len0);
|
|
819
|
+
var ptr2 = ret[0];
|
|
820
|
+
var len2 = ret[1];
|
|
821
|
+
if (ret[3]) {
|
|
822
|
+
ptr2 = 0; len2 = 0;
|
|
823
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
824
|
+
}
|
|
825
|
+
deferred3_0 = ptr2;
|
|
826
|
+
deferred3_1 = len2;
|
|
827
|
+
return getStringFromWasm0(ptr2, len2);
|
|
828
|
+
} finally {
|
|
829
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* Number of currently-registered custom formulas. Debug probe so
|
|
834
|
+
* JS tests can assert their register / unregister calls landed.
|
|
835
|
+
* @returns {number}
|
|
836
|
+
*/
|
|
837
|
+
customFormulaCount() {
|
|
838
|
+
const ret = wasm.wasmworkbook_customFormulaCount(this.__wbg_ptr);
|
|
839
|
+
return ret >>> 0;
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* List of registered custom-formula names (upper-cased). Stable
|
|
843
|
+
* alphabetical ordering not guaranteed — `HashMap::keys()` order.
|
|
844
|
+
* Used by hosts that want to render a "registered formulas"
|
|
845
|
+
* inspector. Returns a `JsValue::Array<String>`.
|
|
846
|
+
* @returns {any}
|
|
847
|
+
*/
|
|
848
|
+
customFormulaNames() {
|
|
849
|
+
const ret = wasm.wasmworkbook_customFormulaNames(this.__wbg_ptr);
|
|
850
|
+
return ret;
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Atom-delegation diagnostics aggregated across every sheet. This is a
|
|
854
|
+
* measurement-only debug surface; hydrated formula/static-range metadata
|
|
855
|
+
* is O(formula_count), while the legacy point-fanout fields stay zero.
|
|
856
|
+
*
|
|
857
|
+
* Returns a JS object with these fields (camelCase):
|
|
858
|
+
* - `totalFormulaCount` — sum of `formula_cells.len()` over sheets
|
|
859
|
+
* - `totalPointDepEdges` — always zero; Store owns point dependencies
|
|
860
|
+
* - `totalRangeDepEntries` — materialized Store geometry roots
|
|
861
|
+
* - `maxFanout` / `avgFanout` — always zero; no address fanout index
|
|
862
|
+
* - `rangeFormulaCount` — hydrated formulas with static range metadata
|
|
863
|
+
* @returns {any}
|
|
864
|
+
*/
|
|
865
|
+
debugDepGraphStats() {
|
|
866
|
+
const ret = wasm.wasmworkbook_debugDepGraphStats(this.__wbg_ptr);
|
|
867
|
+
if (ret[2]) {
|
|
868
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
869
|
+
}
|
|
870
|
+
return takeFromExternrefTable0(ret[0]);
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* @returns {Float64Array}
|
|
874
|
+
*/
|
|
875
|
+
debugLastBulkImportPhaseMs() {
|
|
876
|
+
const ret = wasm.wasmworkbook_debugLastBulkImportPhaseMs(this.__wbg_ptr);
|
|
877
|
+
var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
|
|
878
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
|
|
879
|
+
return v1;
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Number of cross-sheet dependent edges currently tracked on the
|
|
883
|
+
* workbook. Track L's e2e gates fan-out correctness through this
|
|
884
|
+
* probe.
|
|
885
|
+
*
|
|
886
|
+
* Delegates to `Workbook::debug_cross_sheet_reverse_edge_count` —
|
|
887
|
+
* counts entries in the workbook's cross-sheet reverse dep index.
|
|
888
|
+
* @returns {number}
|
|
889
|
+
*/
|
|
890
|
+
debug_cross_sheet_dependents_count() {
|
|
891
|
+
const ret = wasm.wasmworkbook_debug_cross_sheet_dependents_count(this.__wbg_ptr);
|
|
892
|
+
return ret >>> 0;
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* @param {number} sheet_idx
|
|
896
|
+
* @param {string} addr
|
|
897
|
+
* @returns {string}
|
|
898
|
+
*/
|
|
899
|
+
debug_formula_cache_state(sheet_idx, addr) {
|
|
900
|
+
let deferred2_0;
|
|
901
|
+
let deferred2_1;
|
|
902
|
+
try {
|
|
903
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
904
|
+
const len0 = WASM_VECTOR_LEN;
|
|
905
|
+
const ret = wasm.wasmworkbook_debug_formula_cache_state(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
906
|
+
deferred2_0 = ret[0];
|
|
907
|
+
deferred2_1 = ret[1];
|
|
908
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
909
|
+
} finally {
|
|
910
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Total formula records currently registered across all workbook sheets.
|
|
915
|
+
* This is a read-only aggregate, not a cell visit across sparse content.
|
|
916
|
+
* @returns {number}
|
|
917
|
+
*/
|
|
918
|
+
debug_formula_count() {
|
|
919
|
+
const ret = wasm.wasmworkbook_debug_formula_count(this.__wbg_ptr);
|
|
920
|
+
return ret >>> 0;
|
|
921
|
+
}
|
|
922
|
+
/**
|
|
923
|
+
* Total formula evaluations performed on one workbook sheet since
|
|
924
|
+
* creation. Used by worker-backed lazy import/read tests.
|
|
925
|
+
* @param {number} sheet_idx
|
|
926
|
+
* @returns {number}
|
|
927
|
+
*/
|
|
928
|
+
debug_formula_eval_count(sheet_idx) {
|
|
929
|
+
const ret = wasm.wasmworkbook_debug_formula_eval_count(this.__wbg_ptr, sheet_idx);
|
|
930
|
+
return ret >>> 0;
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Total formula evaluations performed across all workbook sheets since
|
|
934
|
+
* creation. Uses each sheet's `debug_formula_eval_count` without
|
|
935
|
+
* evaluating any formulas.
|
|
936
|
+
* @returns {number}
|
|
937
|
+
*/
|
|
938
|
+
debug_formula_eval_count_total() {
|
|
939
|
+
const ret = wasm.wasmworkbook_debug_formula_eval_count_total(this.__wbg_ptr);
|
|
940
|
+
return ret >>> 0;
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* Total number of live workbook subscription tokens currently held
|
|
944
|
+
* in the workbook bookkeeping map.
|
|
945
|
+
* @returns {number}
|
|
946
|
+
*/
|
|
947
|
+
debug_live_subscription_count() {
|
|
948
|
+
const ret = wasm.wasmworkbook_debug_live_subscription_count(this.__wbg_ptr);
|
|
949
|
+
return ret >>> 0;
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Number of formula records currently registered on one workbook sheet.
|
|
953
|
+
* Returns `0` for missing sheet indexes.
|
|
954
|
+
* @param {number} sheet_idx
|
|
955
|
+
* @returns {number}
|
|
956
|
+
*/
|
|
957
|
+
debug_sheet_formula_count(sheet_idx) {
|
|
958
|
+
const ret = wasm.wasmworkbook_debug_sheet_formula_count(this.__wbg_ptr, sheet_idx);
|
|
959
|
+
return ret >>> 0;
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Number of live `Sheet` listeners for a specific sheet. This
|
|
963
|
+
* includes only currently subscribed addresses and maps to the same
|
|
964
|
+
* contract as `Sheet::debug_live_subscription_count`.
|
|
965
|
+
* @param {number} sheet_idx
|
|
966
|
+
* @returns {number}
|
|
967
|
+
*/
|
|
968
|
+
debug_sheet_live_subscription_count(sheet_idx) {
|
|
969
|
+
const ret = wasm.wasmworkbook_debug_sheet_live_subscription_count(this.__wbg_ptr, sheet_idx);
|
|
970
|
+
return ret >>> 0;
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* @param {string} name
|
|
974
|
+
* @param {string} formula
|
|
975
|
+
*/
|
|
976
|
+
defineName(name, formula) {
|
|
977
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
978
|
+
const len0 = WASM_VECTOR_LEN;
|
|
979
|
+
const ptr1 = passStringToWasm0(formula, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
980
|
+
const len1 = WASM_VECTOR_LEN;
|
|
981
|
+
const ret = wasm.wasmworkbook_defineName(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
982
|
+
if (ret[1]) {
|
|
983
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Enumerate the workbook's defined names in canonical (user-typed)
|
|
988
|
+
* casing, sorted alphabetically by uppercased key. Useful for the
|
|
989
|
+
* W2 name-manager dialog so it doesn't need to subscribe to every
|
|
990
|
+
* `defineName` call individually.
|
|
991
|
+
* @returns {string[]}
|
|
992
|
+
*/
|
|
993
|
+
definedNames() {
|
|
994
|
+
const ret = wasm.wasmworkbook_definedNames(this.__wbg_ptr);
|
|
995
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
996
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
997
|
+
return v1;
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* 仅删除低层 Table 注册项;不改写引用公式,不等同于用户的“转换为区域”。
|
|
1001
|
+
* @param {string} name
|
|
1002
|
+
*/
|
|
1003
|
+
deleteTable(name) {
|
|
1004
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1005
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1006
|
+
const ret = wasm.wasmworkbook_deleteTable(this.__wbg_ptr, ptr0, len0);
|
|
1007
|
+
if (ret[1]) {
|
|
1008
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1012
|
+
* @param {number} sheet_idx
|
|
1013
|
+
* @param {number} at
|
|
1014
|
+
* @param {number} count
|
|
1015
|
+
*/
|
|
1016
|
+
delete_col(sheet_idx, at, count) {
|
|
1017
|
+
wasm.wasmworkbook_delete_col(this.__wbg_ptr, sheet_idx, at, count);
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* @param {number} sheet_idx
|
|
1021
|
+
* @param {number} at
|
|
1022
|
+
* @param {number} count
|
|
1023
|
+
*/
|
|
1024
|
+
delete_row(sheet_idx, at, count) {
|
|
1025
|
+
wasm.wasmworkbook_delete_row(this.__wbg_ptr, sheet_idx, at, count);
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Drain the async custom-formula request queue accumulated since the
|
|
1029
|
+
* last drain. Returns `Array<{ callId: number, name: string,
|
|
1030
|
+
* args: Array<number|string|boolean|null|any[][]> }>` — args marshal
|
|
1031
|
+
* with the same rules as sync callback invocation (ranges arrive as
|
|
1032
|
+
* 2-D row-major arrays). call_id is a u64 exposed as f64: safe below
|
|
1033
|
+
* 2^53 calls. Call after any mutation entry point; empty queue
|
|
1034
|
+
* returns an empty array at negligible cost.
|
|
1035
|
+
* @returns {any}
|
|
1036
|
+
*/
|
|
1037
|
+
drainAsyncCustomRequests() {
|
|
1038
|
+
const ret = wasm.wasmworkbook_drainAsyncCustomRequests(this.__wbg_ptr);
|
|
1039
|
+
return ret;
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* Checked user command; the optional index distinguishes rename from add.
|
|
1043
|
+
* @param {number | null | undefined} index
|
|
1044
|
+
* @param {string} name
|
|
1045
|
+
* @returns {number}
|
|
1046
|
+
*/
|
|
1047
|
+
edit_sheet(index, name) {
|
|
1048
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1049
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1050
|
+
const ret = wasm.wasmworkbook_edit_sheet(this.__wbg_ptr, isLikeNone(index) ? 0x100000001 : (index) >>> 0, ptr0, len0);
|
|
1051
|
+
if (ret[2]) {
|
|
1052
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1053
|
+
}
|
|
1054
|
+
return ret[0] >>> 0;
|
|
1055
|
+
}
|
|
1056
|
+
/**
|
|
1057
|
+
* 每次插删只产生一条历史;拒绝时数据、历史游标、剪贴板保持不变。
|
|
1058
|
+
* @param {number} sheet
|
|
1059
|
+
* @param {string} action
|
|
1060
|
+
* @param {number} at
|
|
1061
|
+
* @param {number} count
|
|
1062
|
+
* @returns {boolean}
|
|
1063
|
+
*/
|
|
1064
|
+
edit_structure(sheet, action, at, count) {
|
|
1065
|
+
const ptr0 = passStringToWasm0(action, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1066
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1067
|
+
const ret = wasm.wasmworkbook_edit_structure(this.__wbg_ptr, sheet, ptr0, len0, at, count);
|
|
1068
|
+
if (ret[2]) {
|
|
1069
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1070
|
+
}
|
|
1071
|
+
return ret[0] !== 0;
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* @param {any} request
|
|
1075
|
+
* @returns {any}
|
|
1076
|
+
*/
|
|
1077
|
+
filter_values(request) {
|
|
1078
|
+
const ret = wasm.wasmworkbook_filter_values(this.__wbg_ptr, request);
|
|
1079
|
+
if (ret[2]) {
|
|
1080
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1081
|
+
}
|
|
1082
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* @param {any} request
|
|
1086
|
+
* @returns {any}
|
|
1087
|
+
*/
|
|
1088
|
+
find_cells(request) {
|
|
1089
|
+
const ret = wasm.wasmworkbook_find_cells(this.__wbg_ptr, request);
|
|
1090
|
+
if (ret[2]) {
|
|
1091
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1092
|
+
}
|
|
1093
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* 双击填充只返回原生判定的末行,不把相邻列值传给 JS 再扫描。
|
|
1097
|
+
* @param {number} sheet
|
|
1098
|
+
* @param {any} source
|
|
1099
|
+
* @param {number} row_limit
|
|
1100
|
+
* @returns {number | undefined}
|
|
1101
|
+
*/
|
|
1102
|
+
find_fill_down_end(sheet, source, row_limit) {
|
|
1103
|
+
const ret = wasm.wasmworkbook_find_fill_down_end(this.__wbg_ptr, sheet, source, row_limit);
|
|
1104
|
+
if (ret[2]) {
|
|
1105
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1106
|
+
}
|
|
1107
|
+
return ret[0] === 0x100000001 ? undefined : ret[0];
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* 成功才提升临时快照;失败立即释放,不复制工作簿或新增历史。
|
|
1111
|
+
* @param {boolean} commit
|
|
1112
|
+
*/
|
|
1113
|
+
finish_clipboard_capture(commit) {
|
|
1114
|
+
wasm.wasmworkbook_finish_clipboard_capture(this.__wbg_ptr, commit);
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* 固定两个整数:[冻结行数, 冻结列数],零表示该轴不冻结。
|
|
1118
|
+
* @param {number} sheet
|
|
1119
|
+
* @returns {Uint32Array}
|
|
1120
|
+
*/
|
|
1121
|
+
frozen_panes(sheet) {
|
|
1122
|
+
const ret = wasm.wasmworkbook_frozen_panes(this.__wbg_ptr, sheet);
|
|
1123
|
+
if (ret[3]) {
|
|
1124
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1125
|
+
}
|
|
1126
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
1127
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1128
|
+
return v1;
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Read a cell's display string through the workbook eval path.
|
|
1132
|
+
* Convenience wrapper around `get_display(u32, ...)` with `usize`
|
|
1133
|
+
* for the Phase 3 canonical API shape. The `&mut self` receiver
|
|
1134
|
+
* future-proofs against `Workbook::get_cell` requiring a mutable
|
|
1135
|
+
* borrow once cache promotion lands on the workbook eval provider —
|
|
1136
|
+
* today it is read-only, but flipping the underlying signature
|
|
1137
|
+
* must not break the JS API.
|
|
1138
|
+
* @param {number} sheet_idx
|
|
1139
|
+
* @param {string} addr
|
|
1140
|
+
* @returns {string}
|
|
1141
|
+
*/
|
|
1142
|
+
getCellDisplay(sheet_idx, addr) {
|
|
1143
|
+
let deferred2_0;
|
|
1144
|
+
let deferred2_1;
|
|
1145
|
+
try {
|
|
1146
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1147
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1148
|
+
const ret = wasm.wasmworkbook_getCellDisplay(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
1149
|
+
deferred2_0 = ret[0];
|
|
1150
|
+
deferred2_1 = ret[1];
|
|
1151
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1152
|
+
} finally {
|
|
1153
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
/**
|
|
1157
|
+
* @param {number} sheet
|
|
1158
|
+
* @param {number} row
|
|
1159
|
+
* @param {number} col
|
|
1160
|
+
* @returns {any}
|
|
1161
|
+
*/
|
|
1162
|
+
getDataValidation(sheet, row, col) {
|
|
1163
|
+
const ret = wasm.wasmworkbook_getDataValidation(this.__wbg_ptr, sheet, row, col);
|
|
1164
|
+
if (ret[2]) {
|
|
1165
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1166
|
+
}
|
|
1167
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Read `sheetIdx`'s committed filter as
|
|
1171
|
+
* `{ rules: ColumnFilterRule[], hiddenRows: number[] }`.
|
|
1172
|
+
*
|
|
1173
|
+
* A WHOLE-SHEET read, deliberately not window-bounded: a host has to
|
|
1174
|
+
* know about hidden rows OUTSIDE the visible window to expand that
|
|
1175
|
+
* window correctly, so answering with a windowed subset would be
|
|
1176
|
+
* circular. Called on sheet activation and after a restore — never per
|
|
1177
|
+
* frame, per scroll, or per revision.
|
|
1178
|
+
* @param {number} sheet_idx
|
|
1179
|
+
* @returns {any}
|
|
1180
|
+
*/
|
|
1181
|
+
getFilter(sheet_idx) {
|
|
1182
|
+
const ret = wasm.wasmworkbook_getFilter(this.__wbg_ptr, sheet_idx);
|
|
1183
|
+
if (ret[2]) {
|
|
1184
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1185
|
+
}
|
|
1186
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
* @returns {any}
|
|
1190
|
+
*/
|
|
1191
|
+
getLastValidationFailure() {
|
|
1192
|
+
const ret = wasm.wasmworkbook_getLastValidationFailure(this.__wbg_ptr);
|
|
1193
|
+
if (ret[2]) {
|
|
1194
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1195
|
+
}
|
|
1196
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1197
|
+
}
|
|
1198
|
+
/**
|
|
1199
|
+
* @param {number} sheet
|
|
1200
|
+
* @returns {any}
|
|
1201
|
+
*/
|
|
1202
|
+
getPrintConfig(sheet) {
|
|
1203
|
+
const ret = wasm.wasmworkbook_getPrintConfig(this.__wbg_ptr, sheet);
|
|
1204
|
+
if (ret[2]) {
|
|
1205
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1206
|
+
}
|
|
1207
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1208
|
+
}
|
|
1209
|
+
/**
|
|
1210
|
+
* One Table as `TableJSON`, or `null` when no Table is registered under
|
|
1211
|
+
* `name` (case-insensitive).
|
|
1212
|
+
* @param {string} name
|
|
1213
|
+
* @returns {any}
|
|
1214
|
+
*/
|
|
1215
|
+
getTable(name) {
|
|
1216
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1217
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1218
|
+
const ret = wasm.wasmworkbook_getTable(this.__wbg_ptr, ptr0, len0);
|
|
1219
|
+
if (ret[2]) {
|
|
1220
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1221
|
+
}
|
|
1222
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* @param {number} sheet_idx
|
|
1226
|
+
* @param {string} addr
|
|
1227
|
+
* @returns {string}
|
|
1228
|
+
*/
|
|
1229
|
+
get_display(sheet_idx, addr) {
|
|
1230
|
+
let deferred2_0;
|
|
1231
|
+
let deferred2_1;
|
|
1232
|
+
try {
|
|
1233
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1234
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1235
|
+
const ret = wasm.wasmworkbook_get_display(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
1236
|
+
deferred2_0 = ret[0];
|
|
1237
|
+
deferred2_1 = ret[1];
|
|
1238
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1239
|
+
} finally {
|
|
1240
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
/**
|
|
1244
|
+
* @param {number} sheet_idx
|
|
1245
|
+
* @param {string} addr
|
|
1246
|
+
* @returns {string}
|
|
1247
|
+
*/
|
|
1248
|
+
get_formula(sheet_idx, addr) {
|
|
1249
|
+
let deferred2_0;
|
|
1250
|
+
let deferred2_1;
|
|
1251
|
+
try {
|
|
1252
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1253
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1254
|
+
const ret = wasm.wasmworkbook_get_formula(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
1255
|
+
deferred2_0 = ret[0];
|
|
1256
|
+
deferred2_1 = ret[1];
|
|
1257
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1258
|
+
} finally {
|
|
1259
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* @param {number} sheet_idx
|
|
1264
|
+
* @param {string} addr
|
|
1265
|
+
* @returns {number}
|
|
1266
|
+
*/
|
|
1267
|
+
get_number(sheet_idx, addr) {
|
|
1268
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1269
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1270
|
+
const ret = wasm.wasmworkbook_get_number(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
1271
|
+
return ret;
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* @param {number} sheet_idx
|
|
1275
|
+
* @param {string} addr
|
|
1276
|
+
* @returns {string}
|
|
1277
|
+
*/
|
|
1278
|
+
get_type(sheet_idx, addr) {
|
|
1279
|
+
let deferred2_0;
|
|
1280
|
+
let deferred2_1;
|
|
1281
|
+
try {
|
|
1282
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1283
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1284
|
+
const ret = wasm.wasmworkbook_get_type(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
1285
|
+
deferred2_0 = ret[0];
|
|
1286
|
+
deferred2_1 = ret[1];
|
|
1287
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1288
|
+
} finally {
|
|
1289
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
/**
|
|
1293
|
+
* Mark `rows` (0-based) manually hidden on `sheetIdx`, additively.
|
|
1294
|
+
* Returns whether anything changed. Out-of-range `sheetIdx` and rows
|
|
1295
|
+
* that were already hidden are silent `false`s; never throws.
|
|
1296
|
+
* @param {number} sheet_idx
|
|
1297
|
+
* @param {Uint32Array} rows
|
|
1298
|
+
* @returns {boolean}
|
|
1299
|
+
*/
|
|
1300
|
+
hideRows(sheet_idx, rows) {
|
|
1301
|
+
const ptr0 = passArray32ToWasm0(rows, wasm.__wbindgen_malloc);
|
|
1302
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1303
|
+
const ret = wasm.wasmworkbook_hideRows(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
1304
|
+
return ret !== 0;
|
|
1305
|
+
}
|
|
1306
|
+
/**
|
|
1307
|
+
* @param {string} direction
|
|
1308
|
+
* @returns {boolean}
|
|
1309
|
+
*/
|
|
1310
|
+
history_apply(direction) {
|
|
1311
|
+
const ptr0 = passStringToWasm0(direction, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1312
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1313
|
+
const ret = wasm.wasmworkbook_history_apply(this.__wbg_ptr, ptr0, len0);
|
|
1314
|
+
if (ret[2]) {
|
|
1315
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1316
|
+
}
|
|
1317
|
+
return ret[0] !== 0;
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* @param {number} sheet
|
|
1321
|
+
* @param {number} start_row
|
|
1322
|
+
* @param {number} start_col
|
|
1323
|
+
* @param {number} end_row
|
|
1324
|
+
* @param {number} end_col
|
|
1325
|
+
* @param {string} label
|
|
1326
|
+
* @param {boolean} content
|
|
1327
|
+
*/
|
|
1328
|
+
history_begin(sheet, start_row, start_col, end_row, end_col, label, content) {
|
|
1329
|
+
const ptr0 = passStringToWasm0(label, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1330
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1331
|
+
const ret = wasm.wasmworkbook_history_begin(this.__wbg_ptr, sheet, start_row, start_col, end_row, end_col, ptr0, len0, content);
|
|
1332
|
+
if (ret[1]) {
|
|
1333
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* @param {string} notice
|
|
1338
|
+
*/
|
|
1339
|
+
history_clear(notice) {
|
|
1340
|
+
const ptr0 = passStringToWasm0(notice, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1341
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1342
|
+
wasm.wasmworkbook_history_clear(this.__wbg_ptr, ptr0, len0);
|
|
1343
|
+
}
|
|
1344
|
+
/**
|
|
1345
|
+
* @param {boolean} success
|
|
1346
|
+
*/
|
|
1347
|
+
history_finish(success) {
|
|
1348
|
+
const ret = wasm.wasmworkbook_history_finish(this.__wbg_ptr, success);
|
|
1349
|
+
if (ret[1]) {
|
|
1350
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
/**
|
|
1354
|
+
* @returns {any}
|
|
1355
|
+
*/
|
|
1356
|
+
history_state() {
|
|
1357
|
+
const ret = wasm.wasmworkbook_history_state(this.__wbg_ptr);
|
|
1358
|
+
if (ret[2]) {
|
|
1359
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1360
|
+
}
|
|
1361
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* @returns {any}
|
|
1365
|
+
*/
|
|
1366
|
+
host_mutation_state() {
|
|
1367
|
+
const ret = wasm.wasmworkbook_host_mutation_state(this.__wbg_ptr);
|
|
1368
|
+
if (ret[2]) {
|
|
1369
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1370
|
+
}
|
|
1371
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1372
|
+
}
|
|
1373
|
+
/**
|
|
1374
|
+
* @param {any} targets
|
|
1375
|
+
* @returns {any}
|
|
1376
|
+
*/
|
|
1377
|
+
host_read_ranges(targets) {
|
|
1378
|
+
const ret = wasm.wasmworkbook_host_read_ranges(this.__wbg_ptr, targets);
|
|
1379
|
+
if (ret[2]) {
|
|
1380
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1381
|
+
}
|
|
1382
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* @param {any} cells
|
|
1386
|
+
* @returns {boolean}
|
|
1387
|
+
*/
|
|
1388
|
+
host_write_cells(cells) {
|
|
1389
|
+
const ret = wasm.wasmworkbook_host_write_cells(this.__wbg_ptr, cells);
|
|
1390
|
+
if (ret[2]) {
|
|
1391
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1392
|
+
}
|
|
1393
|
+
return ret[0] !== 0;
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* @param {number} sheet_idx
|
|
1397
|
+
* @param {number} at
|
|
1398
|
+
* @param {number} count
|
|
1399
|
+
*/
|
|
1400
|
+
insert_col(sheet_idx, at, count) {
|
|
1401
|
+
wasm.wasmworkbook_insert_col(this.__wbg_ptr, sheet_idx, at, count);
|
|
1402
|
+
}
|
|
1403
|
+
/**
|
|
1404
|
+
* @param {number} sheet_idx
|
|
1405
|
+
* @param {number} at
|
|
1406
|
+
* @param {number} count
|
|
1407
|
+
*/
|
|
1408
|
+
insert_row(sheet_idx, at, count) {
|
|
1409
|
+
wasm.wasmworkbook_insert_row(this.__wbg_ptr, sheet_idx, at, count);
|
|
1410
|
+
}
|
|
1411
|
+
/**
|
|
1412
|
+
* @param {number} sheet_idx
|
|
1413
|
+
* @param {string} addr
|
|
1414
|
+
* @returns {boolean}
|
|
1415
|
+
*/
|
|
1416
|
+
is_error(sheet_idx, addr) {
|
|
1417
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1418
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1419
|
+
const ret = wasm.wasmworkbook_is_error(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
1420
|
+
return ret !== 0;
|
|
1421
|
+
}
|
|
1422
|
+
/**
|
|
1423
|
+
* @param {number} sheet
|
|
1424
|
+
* @returns {any}
|
|
1425
|
+
*/
|
|
1426
|
+
listConditionalFormats(sheet) {
|
|
1427
|
+
const ret = wasm.wasmworkbook_listConditionalFormats(this.__wbg_ptr, sheet);
|
|
1428
|
+
if (ret[2]) {
|
|
1429
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1430
|
+
}
|
|
1431
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1432
|
+
}
|
|
1433
|
+
/**
|
|
1434
|
+
* The manually hidden rows on `sheetIdx` as a `number[]`, ascending.
|
|
1435
|
+
* Empty for an out-of-range sheet.
|
|
1436
|
+
* @param {number} sheet_idx
|
|
1437
|
+
* @returns {Uint32Array}
|
|
1438
|
+
*/
|
|
1439
|
+
listHiddenRows(sheet_idx) {
|
|
1440
|
+
const ret = wasm.wasmworkbook_listHiddenRows(this.__wbg_ptr, sheet_idx);
|
|
1441
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
1442
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1443
|
+
return v1;
|
|
1444
|
+
}
|
|
1445
|
+
/**
|
|
1446
|
+
* Every registered Table as `TableJSON[]`, alphabetical by uppercased
|
|
1447
|
+
* name (the engine's stable order).
|
|
1448
|
+
* @returns {any}
|
|
1449
|
+
*/
|
|
1450
|
+
listTables() {
|
|
1451
|
+
const ret = wasm.wasmworkbook_listTables(this.__wbg_ptr);
|
|
1452
|
+
if (ret[2]) {
|
|
1453
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1454
|
+
}
|
|
1455
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1456
|
+
}
|
|
1457
|
+
/**
|
|
1458
|
+
* @returns {any}
|
|
1459
|
+
*/
|
|
1460
|
+
list_named_ranges() {
|
|
1461
|
+
const ret = wasm.wasmworkbook_list_named_ranges(this.__wbg_ptr);
|
|
1462
|
+
if (ret[2]) {
|
|
1463
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1464
|
+
}
|
|
1465
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1466
|
+
}
|
|
1467
|
+
/**
|
|
1468
|
+
* List every address that has a primitive value or formula across
|
|
1469
|
+
* the workbook. This is metadata-only and does not evaluate formulas.
|
|
1470
|
+
* @returns {any}
|
|
1471
|
+
*/
|
|
1472
|
+
list_non_empty_cells() {
|
|
1473
|
+
const ret = wasm.wasmworkbook_list_non_empty_cells(this.__wbg_ptr);
|
|
1474
|
+
if (ret[2]) {
|
|
1475
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1476
|
+
}
|
|
1477
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1478
|
+
}
|
|
1479
|
+
/**
|
|
1480
|
+
* @param {any} request
|
|
1481
|
+
* @returns {any}
|
|
1482
|
+
*/
|
|
1483
|
+
locate_cells(request) {
|
|
1484
|
+
const ret = wasm.wasmworkbook_locate_cells(this.__wbg_ptr, request);
|
|
1485
|
+
if (ret[2]) {
|
|
1486
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1487
|
+
}
|
|
1488
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1489
|
+
}
|
|
1490
|
+
/**
|
|
1491
|
+
* 复制、启停与重排都由原生目录一次修改,一次进入历史。
|
|
1492
|
+
* @param {number} sheet
|
|
1493
|
+
* @param {any} request
|
|
1494
|
+
* @returns {any}
|
|
1495
|
+
*/
|
|
1496
|
+
manageConditionalFormatRule(sheet, request) {
|
|
1497
|
+
const ret = wasm.wasmworkbook_manageConditionalFormatRule(this.__wbg_ptr, sheet, request);
|
|
1498
|
+
if (ret[2]) {
|
|
1499
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1500
|
+
}
|
|
1501
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1502
|
+
}
|
|
1503
|
+
/**
|
|
1504
|
+
* @param {number} sheet
|
|
1505
|
+
* @param {number} start_row
|
|
1506
|
+
* @param {number} start_col
|
|
1507
|
+
* @param {number} end_row
|
|
1508
|
+
* @param {number} end_col
|
|
1509
|
+
* @param {string} action
|
|
1510
|
+
* @param {boolean} discard
|
|
1511
|
+
* @returns {boolean}
|
|
1512
|
+
*/
|
|
1513
|
+
merge_cells(sheet, start_row, start_col, end_row, end_col, action, discard) {
|
|
1514
|
+
const ptr0 = passStringToWasm0(action, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1515
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1516
|
+
const ret = wasm.wasmworkbook_merge_cells(this.__wbg_ptr, sheet, start_row, start_col, end_row, end_col, ptr0, len0, discard);
|
|
1517
|
+
if (ret[2]) {
|
|
1518
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1519
|
+
}
|
|
1520
|
+
return ret[0] !== 0;
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* 全表稀疏合并矩形,按 [起始行, 起始列, 结束行, 结束列] 连续编码。
|
|
1524
|
+
* 不裁成视口内的小矩形;键盘导航与屏幕外锚点仍使用真实边界。
|
|
1525
|
+
* @param {number} sheet
|
|
1526
|
+
* @returns {Uint32Array}
|
|
1527
|
+
*/
|
|
1528
|
+
merged_ranges(sheet) {
|
|
1529
|
+
const ret = wasm.wasmworkbook_merged_ranges(this.__wbg_ptr, sheet);
|
|
1530
|
+
if (ret[3]) {
|
|
1531
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1532
|
+
}
|
|
1533
|
+
var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
1534
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1535
|
+
return v1;
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1538
|
+
* @param {number} from
|
|
1539
|
+
* @param {number} to
|
|
1540
|
+
* @returns {boolean}
|
|
1541
|
+
*/
|
|
1542
|
+
move_sheet(from, to) {
|
|
1543
|
+
const ret = wasm.wasmworkbook_move_sheet(this.__wbg_ptr, from, to);
|
|
1544
|
+
return ret !== 0;
|
|
1545
|
+
}
|
|
1546
|
+
constructor() {
|
|
1547
|
+
const ret = wasm.wasmworkbook_new();
|
|
1548
|
+
this.__wbg_ptr = ret >>> 0;
|
|
1549
|
+
WasmWorkbookFinalization.register(this, this.__wbg_ptr, this);
|
|
1550
|
+
return this;
|
|
1551
|
+
}
|
|
1552
|
+
/**
|
|
1553
|
+
* 内部快照或外部 TSV 二选一。剪切只有成功落地后才消费快照。
|
|
1554
|
+
* @param {number} sheet_idx
|
|
1555
|
+
* @param {number} row
|
|
1556
|
+
* @param {number} col
|
|
1557
|
+
* @param {string} text
|
|
1558
|
+
* @param {boolean} internal
|
|
1559
|
+
* @param {any} policy
|
|
1560
|
+
* @returns {Uint32Array}
|
|
1561
|
+
*/
|
|
1562
|
+
paste_clipboard(sheet_idx, row, col, text, internal, policy) {
|
|
1563
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1564
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1565
|
+
const ret = wasm.wasmworkbook_paste_clipboard(this.__wbg_ptr, sheet_idx, row, col, ptr0, len0, internal, policy);
|
|
1566
|
+
if (ret[3]) {
|
|
1567
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1568
|
+
}
|
|
1569
|
+
var v2 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
1570
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1571
|
+
return v2;
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* 按属性写入 cellStyle / rowStyle / columnStyle。
|
|
1575
|
+
* @param {number} sheet_idx
|
|
1576
|
+
* @param {number} start_row
|
|
1577
|
+
* @param {number} start_col
|
|
1578
|
+
* @param {number} end_row
|
|
1579
|
+
* @param {number} end_col
|
|
1580
|
+
* @param {any} patch
|
|
1581
|
+
* @param {string} scope
|
|
1582
|
+
* @returns {number}
|
|
1583
|
+
*/
|
|
1584
|
+
patch_format_range(sheet_idx, start_row, start_col, end_row, end_col, patch, scope) {
|
|
1585
|
+
const ptr0 = passStringToWasm0(scope, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1586
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1587
|
+
const ret = wasm.wasmworkbook_patch_format_range(this.__wbg_ptr, sheet_idx, start_row, start_col, end_row, end_col, patch, ptr0, len0);
|
|
1588
|
+
if (ret[2]) {
|
|
1589
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1590
|
+
}
|
|
1591
|
+
return ret[0] >>> 0;
|
|
1592
|
+
}
|
|
1593
|
+
/**
|
|
1594
|
+
* @param {any} request
|
|
1595
|
+
* @returns {any}
|
|
1596
|
+
*/
|
|
1597
|
+
patch_format_selection(request) {
|
|
1598
|
+
const ret = wasm.wasmworkbook_patch_format_selection(this.__wbg_ptr, request);
|
|
1599
|
+
if (ret[2]) {
|
|
1600
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1601
|
+
}
|
|
1602
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1603
|
+
}
|
|
1604
|
+
/**
|
|
1605
|
+
* 范围位置在 Rust 内计算;调用方用既有格式事务保存一次撤销。
|
|
1606
|
+
* @param {number} sheet_idx
|
|
1607
|
+
* @param {number} start_row
|
|
1608
|
+
* @param {number} start_col
|
|
1609
|
+
* @param {number} end_row
|
|
1610
|
+
* @param {number} end_col
|
|
1611
|
+
* @param {any} input
|
|
1612
|
+
* @returns {number}
|
|
1613
|
+
*/
|
|
1614
|
+
patch_range_borders(sheet_idx, start_row, start_col, end_row, end_col, input) {
|
|
1615
|
+
const ret = wasm.wasmworkbook_patch_range_borders(this.__wbg_ptr, sheet_idx, start_row, start_col, end_row, end_col, input);
|
|
1616
|
+
if (ret[2]) {
|
|
1617
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1618
|
+
}
|
|
1619
|
+
return ret[0] >>> 0;
|
|
1620
|
+
}
|
|
1621
|
+
/**
|
|
1622
|
+
* 浏览器剪贴板写入可能失败,先暂存,不改变正式快照。
|
|
1623
|
+
* @param {number} sheet_idx
|
|
1624
|
+
* @param {number} start_row
|
|
1625
|
+
* @param {number} start_col
|
|
1626
|
+
* @param {number} end_row
|
|
1627
|
+
* @param {number} end_col
|
|
1628
|
+
* @param {boolean} cut
|
|
1629
|
+
* @returns {any}
|
|
1630
|
+
*/
|
|
1631
|
+
prepare_clipboard(sheet_idx, start_row, start_col, end_row, end_col, cut) {
|
|
1632
|
+
const ret = wasm.wasmworkbook_prepare_clipboard(this.__wbg_ptr, sheet_idx, start_row, start_col, end_row, end_col, cut);
|
|
1633
|
+
if (ret[2]) {
|
|
1634
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1635
|
+
}
|
|
1636
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1637
|
+
}
|
|
1638
|
+
/**
|
|
1639
|
+
* @param {number} sheet_idx
|
|
1640
|
+
* @param {string} addr
|
|
1641
|
+
* @param {any} format
|
|
1642
|
+
* @returns {string}
|
|
1643
|
+
*/
|
|
1644
|
+
preview_number_format(sheet_idx, addr, format) {
|
|
1645
|
+
let deferred3_0;
|
|
1646
|
+
let deferred3_1;
|
|
1647
|
+
try {
|
|
1648
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1649
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1650
|
+
const ret = wasm.wasmworkbook_preview_number_format(this.__wbg_ptr, sheet_idx, ptr0, len0, format);
|
|
1651
|
+
var ptr2 = ret[0];
|
|
1652
|
+
var len2 = ret[1];
|
|
1653
|
+
if (ret[3]) {
|
|
1654
|
+
ptr2 = 0; len2 = 0;
|
|
1655
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1656
|
+
}
|
|
1657
|
+
deferred3_0 = ptr2;
|
|
1658
|
+
deferred3_1 = len2;
|
|
1659
|
+
return getStringFromWasm0(ptr2, len2);
|
|
1660
|
+
} finally {
|
|
1661
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
1662
|
+
}
|
|
1663
|
+
}
|
|
1664
|
+
/**
|
|
1665
|
+
* @param {any} request
|
|
1666
|
+
* @returns {any}
|
|
1667
|
+
*/
|
|
1668
|
+
preview_remove_duplicates(request) {
|
|
1669
|
+
const ret = wasm.wasmworkbook_preview_remove_duplicates(this.__wbg_ptr, request);
|
|
1670
|
+
if (ret[2]) {
|
|
1671
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1672
|
+
}
|
|
1673
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1674
|
+
}
|
|
1675
|
+
/**
|
|
1676
|
+
* @param {any} request
|
|
1677
|
+
* @returns {any}
|
|
1678
|
+
*/
|
|
1679
|
+
preview_text_columns(request) {
|
|
1680
|
+
const ret = wasm.wasmworkbook_preview_text_columns(this.__wbg_ptr, request);
|
|
1681
|
+
if (ret[2]) {
|
|
1682
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1683
|
+
}
|
|
1684
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* @param {number} sheet
|
|
1688
|
+
* @param {number} row
|
|
1689
|
+
* @param {number} col
|
|
1690
|
+
* @returns {string}
|
|
1691
|
+
*/
|
|
1692
|
+
read_comment(sheet, row, col) {
|
|
1693
|
+
let deferred2_0;
|
|
1694
|
+
let deferred2_1;
|
|
1695
|
+
try {
|
|
1696
|
+
const ret = wasm.wasmworkbook_read_comment(this.__wbg_ptr, sheet, row, col);
|
|
1697
|
+
var ptr1 = ret[0];
|
|
1698
|
+
var len1 = ret[1];
|
|
1699
|
+
if (ret[3]) {
|
|
1700
|
+
ptr1 = 0; len1 = 0;
|
|
1701
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1702
|
+
}
|
|
1703
|
+
deferred2_0 = ptr1;
|
|
1704
|
+
deferred2_1 = len1;
|
|
1705
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1706
|
+
} finally {
|
|
1707
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
/**
|
|
1711
|
+
* @returns {string}
|
|
1712
|
+
*/
|
|
1713
|
+
read_custom_formulas() {
|
|
1714
|
+
let deferred2_0;
|
|
1715
|
+
let deferred2_1;
|
|
1716
|
+
try {
|
|
1717
|
+
const ret = wasm.wasmworkbook_read_custom_formulas(this.__wbg_ptr);
|
|
1718
|
+
var ptr1 = ret[0];
|
|
1719
|
+
var len1 = ret[1];
|
|
1720
|
+
if (ret[3]) {
|
|
1721
|
+
ptr1 = 0; len1 = 0;
|
|
1722
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1723
|
+
}
|
|
1724
|
+
deferred2_0 = ptr1;
|
|
1725
|
+
deferred2_1 = len1;
|
|
1726
|
+
return getStringFromWasm0(ptr1, len1);
|
|
1727
|
+
} finally {
|
|
1728
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
1729
|
+
}
|
|
1730
|
+
}
|
|
1731
|
+
/**
|
|
1732
|
+
* @param {number} sheet
|
|
1733
|
+
* @param {number} row
|
|
1734
|
+
* @param {number} col
|
|
1735
|
+
* @returns {string | undefined}
|
|
1736
|
+
*/
|
|
1737
|
+
read_note(sheet, row, col) {
|
|
1738
|
+
const ret = wasm.wasmworkbook_read_note(this.__wbg_ptr, sheet, row, col);
|
|
1739
|
+
if (ret[3]) {
|
|
1740
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
1741
|
+
}
|
|
1742
|
+
let v1;
|
|
1743
|
+
if (ret[0] !== 0) {
|
|
1744
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
1745
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1746
|
+
}
|
|
1747
|
+
return v1;
|
|
1748
|
+
}
|
|
1749
|
+
/**
|
|
1750
|
+
* @param {number} sheet
|
|
1751
|
+
* @returns {any}
|
|
1752
|
+
*/
|
|
1753
|
+
read_protection(sheet) {
|
|
1754
|
+
const ret = wasm.wasmworkbook_read_protection(this.__wbg_ptr, sheet);
|
|
1755
|
+
if (ret[2]) {
|
|
1756
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1757
|
+
}
|
|
1758
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1759
|
+
}
|
|
1760
|
+
/**
|
|
1761
|
+
* Read non-empty cells in a zero-based inclusive range. This is an
|
|
1762
|
+
* explicit read/export path, so formula cells in the range may be
|
|
1763
|
+
* evaluated and promoted to clean cache state.
|
|
1764
|
+
* @param {number} sheet_idx
|
|
1765
|
+
* @param {number} start_row
|
|
1766
|
+
* @param {number} start_col
|
|
1767
|
+
* @param {number} end_row
|
|
1768
|
+
* @param {number} end_col
|
|
1769
|
+
* @returns {any}
|
|
1770
|
+
*/
|
|
1771
|
+
read_sparse_range(sheet_idx, start_row, start_col, end_row, end_col) {
|
|
1772
|
+
const ret = wasm.wasmworkbook_read_sparse_range(this.__wbg_ptr, sheet_idx, start_row, start_col, end_row, end_col);
|
|
1773
|
+
if (ret[2]) {
|
|
1774
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1775
|
+
}
|
|
1776
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1777
|
+
}
|
|
1778
|
+
/**
|
|
1779
|
+
* `Data -> Reapply` (Excel `Ctrl+Alt+L`): re-run `sheetIdx`'s ALREADY
|
|
1780
|
+
* COMMITTED rules against current cell values. Carries no rules of its
|
|
1781
|
+
* own, so it can never change WHAT is filtered — only which rows
|
|
1782
|
+
* currently satisfy it.
|
|
1783
|
+
* @param {number} sheet_idx
|
|
1784
|
+
* @returns {any}
|
|
1785
|
+
*/
|
|
1786
|
+
reapplyFilter(sheet_idx) {
|
|
1787
|
+
const ret = wasm.wasmworkbook_reapplyFilter(this.__wbg_ptr, sheet_idx);
|
|
1788
|
+
if (ret[2]) {
|
|
1789
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1790
|
+
}
|
|
1791
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1792
|
+
}
|
|
1793
|
+
/**
|
|
1794
|
+
* @param {number | null} [sheet]
|
|
1795
|
+
* @returns {number}
|
|
1796
|
+
*/
|
|
1797
|
+
recalculate(sheet) {
|
|
1798
|
+
const ret = wasm.wasmworkbook_recalculate(this.__wbg_ptr, isLikeNone(sheet) ? 0x100000001 : (sheet) >>> 0);
|
|
1799
|
+
if (ret[2]) {
|
|
1800
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1801
|
+
}
|
|
1802
|
+
return ret[0] >>> 0;
|
|
1803
|
+
}
|
|
1804
|
+
/**
|
|
1805
|
+
* @param {string} name
|
|
1806
|
+
* @param {Function} callback
|
|
1807
|
+
*/
|
|
1808
|
+
registerCustomFormula(name, callback) {
|
|
1809
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1810
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1811
|
+
wasm.wasmworkbook_registerCustomFormula(this.__wbg_ptr, ptr0, len0, callback);
|
|
1812
|
+
}
|
|
1813
|
+
/**
|
|
1814
|
+
* Register `name` as an ASYNC custom formula. Name-only: the JS
|
|
1815
|
+
* callback stays in the worker's local map and never crosses into
|
|
1816
|
+
* wasm. During evaluation the engine memoizes per (name, args),
|
|
1817
|
+
* holds the cell at `#BUSY!`, and enqueues a pending request; the
|
|
1818
|
+
* host drains with `drainAsyncCustomRequests`, awaits the callback,
|
|
1819
|
+
* and settles with `resolveAsyncCustomCall`. Registering over an
|
|
1820
|
+
* existing name (sync or async) replaces it and publishes the
|
|
1821
|
+
* registry root like `registerCustomFormula`.
|
|
1822
|
+
* @param {string} name
|
|
1823
|
+
*/
|
|
1824
|
+
registerCustomFormulaAsync(name) {
|
|
1825
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1826
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1827
|
+
wasm.wasmworkbook_registerCustomFormulaAsync(this.__wbg_ptr, ptr0, len0);
|
|
1828
|
+
}
|
|
1829
|
+
/**
|
|
1830
|
+
* @param {number} sheet
|
|
1831
|
+
* @param {any} request
|
|
1832
|
+
* @returns {any}
|
|
1833
|
+
*/
|
|
1834
|
+
removeConditionalFormatRule(sheet, request) {
|
|
1835
|
+
const ret = wasm.wasmworkbook_removeConditionalFormatRule(this.__wbg_ptr, sheet, request);
|
|
1836
|
+
if (ret[2]) {
|
|
1837
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1838
|
+
}
|
|
1839
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1840
|
+
}
|
|
1841
|
+
/**
|
|
1842
|
+
* @param {any} request
|
|
1843
|
+
* @returns {any}
|
|
1844
|
+
*/
|
|
1845
|
+
remove_duplicates(request) {
|
|
1846
|
+
const ret = wasm.wasmworkbook_remove_duplicates(this.__wbg_ptr, request);
|
|
1847
|
+
if (ret[2]) {
|
|
1848
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1849
|
+
}
|
|
1850
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1851
|
+
}
|
|
1852
|
+
/**
|
|
1853
|
+
* @param {number} idx
|
|
1854
|
+
* @returns {boolean}
|
|
1855
|
+
*/
|
|
1856
|
+
remove_sheet(idx) {
|
|
1857
|
+
const ret = wasm.wasmworkbook_remove_sheet(this.__wbg_ptr, idx);
|
|
1858
|
+
return ret !== 0;
|
|
1859
|
+
}
|
|
1860
|
+
/**
|
|
1861
|
+
* Rename a Table, rewriting every referencing formula's text.
|
|
1862
|
+
* @param {string} name
|
|
1863
|
+
* @param {string} new_name
|
|
1864
|
+
*/
|
|
1865
|
+
renameTable(name, new_name) {
|
|
1866
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1867
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1868
|
+
const ptr1 = passStringToWasm0(new_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1869
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1870
|
+
const ret = wasm.wasmworkbook_renameTable(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1871
|
+
if (ret[1]) {
|
|
1872
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
/**
|
|
1876
|
+
* Rename one column of a Table, rewriting every referencing formula.
|
|
1877
|
+
* @param {string} name
|
|
1878
|
+
* @param {string} old_column
|
|
1879
|
+
* @param {string} new_column
|
|
1880
|
+
*/
|
|
1881
|
+
renameTableColumn(name, old_column, new_column) {
|
|
1882
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1883
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1884
|
+
const ptr1 = passStringToWasm0(old_column, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1885
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1886
|
+
const ptr2 = passStringToWasm0(new_column, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1887
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1888
|
+
const ret = wasm.wasmworkbook_renameTableColumn(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1889
|
+
if (ret[1]) {
|
|
1890
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
/**
|
|
1894
|
+
* @param {number} idx
|
|
1895
|
+
* @param {string} name
|
|
1896
|
+
* @returns {boolean}
|
|
1897
|
+
*/
|
|
1898
|
+
rename_sheet(idx, name) {
|
|
1899
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1900
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1901
|
+
const ret = wasm.wasmworkbook_rename_sheet(this.__wbg_ptr, idx, ptr0, len0);
|
|
1902
|
+
return ret !== 0;
|
|
1903
|
+
}
|
|
1904
|
+
/**
|
|
1905
|
+
* @param {any} request
|
|
1906
|
+
* @returns {any}
|
|
1907
|
+
*/
|
|
1908
|
+
replace_by_query(request) {
|
|
1909
|
+
const ret = wasm.wasmworkbook_replace_by_query(this.__wbg_ptr, request);
|
|
1910
|
+
if (ret[2]) {
|
|
1911
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1912
|
+
}
|
|
1913
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1914
|
+
}
|
|
1915
|
+
/**
|
|
1916
|
+
* 一次命令修改选区涉及的行/列,尺寸不写入 cellStyle。
|
|
1917
|
+
* @param {number} sheet_idx
|
|
1918
|
+
* @param {number} start_row
|
|
1919
|
+
* @param {number} start_col
|
|
1920
|
+
* @param {number} end_row
|
|
1921
|
+
* @param {number} end_col
|
|
1922
|
+
* @param {string} axis
|
|
1923
|
+
* @param {number} pixels
|
|
1924
|
+
*/
|
|
1925
|
+
resize_range(sheet_idx, start_row, start_col, end_row, end_col, axis, pixels) {
|
|
1926
|
+
const ptr0 = passStringToWasm0(axis, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1927
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1928
|
+
const ret = wasm.wasmworkbook_resize_range(this.__wbg_ptr, sheet_idx, start_row, start_col, end_row, end_col, ptr0, len0, pixels);
|
|
1929
|
+
if (ret[1]) {
|
|
1930
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
/**
|
|
1934
|
+
* Settle an async custom-formula call. `value` marshals with the
|
|
1935
|
+
* same rules as a sync callback's return (`js_to_value`): scalars,
|
|
1936
|
+
* error tokens / `{ error }` objects; `#BUSY!` demotes to `#VALUE!`.
|
|
1937
|
+
* The worker maps callback throw/reject to `{ error: "#VALUE!" }`
|
|
1938
|
+
* and calls this same entry — there is no separate reject API.
|
|
1939
|
+
* Returns `false` when the call is unknown or stale (registry
|
|
1940
|
+
* changed while the Promise was in flight); the value is dropped.
|
|
1941
|
+
* Explicit `{ json: scalar_or_rectangular_array }` successes preserve
|
|
1942
|
+
* JSON strings literally; existing `{ error }` objects take precedence.
|
|
1943
|
+
* @param {number} call_id
|
|
1944
|
+
* @param {any} value
|
|
1945
|
+
* @returns {boolean}
|
|
1946
|
+
*/
|
|
1947
|
+
resolveAsyncCustomCall(call_id, value) {
|
|
1948
|
+
const ret = wasm.wasmworkbook_resolveAsyncCustomCall(this.__wbg_ptr, call_id, value);
|
|
1949
|
+
return ret !== 0;
|
|
1950
|
+
}
|
|
1951
|
+
/**
|
|
1952
|
+
* Replace every sheet's filter state with a `snapshotFilters` payload,
|
|
1953
|
+
* returning how many sheets ended up with a filter. Restoring an empty
|
|
1954
|
+
* `filters` array CLEARS everything — that is the point of REPLACE, not
|
|
1955
|
+
* a no-op. Entries for sheets that no longer exist are dropped
|
|
1956
|
+
* silently, and no predicate is re-run.
|
|
1957
|
+
* @param {any} value
|
|
1958
|
+
* @returns {number}
|
|
1959
|
+
*/
|
|
1960
|
+
restoreFilters(value) {
|
|
1961
|
+
const ret = wasm.wasmworkbook_restoreFilters(this.__wbg_ptr, value);
|
|
1962
|
+
if (ret[2]) {
|
|
1963
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1964
|
+
}
|
|
1965
|
+
return ret[0] >>> 0;
|
|
1966
|
+
}
|
|
1967
|
+
/**
|
|
1968
|
+
* Replace every sheet's manually hidden rows with a `snapshotHidden`
|
|
1969
|
+
* payload, returning how many sheets ended up with at least one hidden
|
|
1970
|
+
* row. Restoring an empty `hidden` array CLEARS everything — that is the
|
|
1971
|
+
* point of REPLACE, not a no-op. Entries for sheets that no longer exist
|
|
1972
|
+
* are dropped silently. A restore that reproduces the current state
|
|
1973
|
+
* fires no epoch and costs no recompute.
|
|
1974
|
+
* @param {any} value
|
|
1975
|
+
* @returns {number}
|
|
1976
|
+
*/
|
|
1977
|
+
restoreHidden(value) {
|
|
1978
|
+
const ret = wasm.wasmworkbook_restoreHidden(this.__wbg_ptr, value);
|
|
1979
|
+
if (ret[2]) {
|
|
1980
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1981
|
+
}
|
|
1982
|
+
return ret[0] >>> 0;
|
|
1983
|
+
}
|
|
1984
|
+
/**
|
|
1985
|
+
* Replace the whole Table registry with a `snapshotTables` payload,
|
|
1986
|
+
* returning the number of Tables now registered.
|
|
1987
|
+
*
|
|
1988
|
+
* **REPLACE, not additive** (unlike `restoreSparse`): Tables created
|
|
1989
|
+
* after the snapshot are dropped and Tables deleted since are revived,
|
|
1990
|
+
* which is what makes a Table-definition undo symmetric. Restoring an
|
|
1991
|
+
* empty `tables` array therefore CLEARS the registry — it is not a
|
|
1992
|
+
* no-op.
|
|
1993
|
+
*
|
|
1994
|
+
* All-or-nothing: the payload is fully validated (cap 256, name shape,
|
|
1995
|
+
* the §4.2 name mutex against current defined names, same-sheet range
|
|
1996
|
+
* overlap, column-count vs range width) before anything is swapped, so a
|
|
1997
|
+
* rejection leaves the live registry untouched. Errors are the stable
|
|
1998
|
+
* `table_error_to_js` strings plus `"unsupported-snapshot-version"` and
|
|
1999
|
+
* parse messages for a malformed envelope. Only cell values/formulas are
|
|
2000
|
+
* left alone — the registry is a view over them.
|
|
2001
|
+
*
|
|
2002
|
+
* A restore that changes the registry bumps the tables epoch, so
|
|
2003
|
+
* `=SUM(Table1[Qty])` and friends re-derive against the restored
|
|
2004
|
+
* geometry; a restore that reproduces the current registry exactly
|
|
2005
|
+
* skips the bump.
|
|
2006
|
+
* @param {any} value
|
|
2007
|
+
* @returns {number}
|
|
2008
|
+
*/
|
|
2009
|
+
restoreTables(value) {
|
|
2010
|
+
const ret = wasm.wasmworkbook_restoreTables(this.__wbg_ptr, value);
|
|
2011
|
+
if (ret[2]) {
|
|
2012
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2013
|
+
}
|
|
2014
|
+
return ret[0] >>> 0;
|
|
2015
|
+
}
|
|
2016
|
+
/**
|
|
2017
|
+
* Restore a formatting snapshot produced by `snapshot_format_range`.
|
|
2018
|
+
* @param {any} snapshot
|
|
2019
|
+
* @returns {number}
|
|
2020
|
+
*/
|
|
2021
|
+
restore_format_snapshot(snapshot) {
|
|
2022
|
+
const ret = wasm.wasmworkbook_restore_format_snapshot(this.__wbg_ptr, snapshot);
|
|
2023
|
+
if (ret[2]) {
|
|
2024
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2025
|
+
}
|
|
2026
|
+
return ret[0] >>> 0;
|
|
2027
|
+
}
|
|
2028
|
+
/**
|
|
2029
|
+
* Restore a persistence-v1 sparse envelope into this workbook.
|
|
2030
|
+
*
|
|
2031
|
+
* Returns simple restore stats for quick assertions.
|
|
2032
|
+
* @param {any} value
|
|
2033
|
+
* @returns {any}
|
|
2034
|
+
*/
|
|
2035
|
+
restore_persistence_v1(value) {
|
|
2036
|
+
const ret = wasm.wasmworkbook_restore_persistence_v1(this.__wbg_ptr, value);
|
|
2037
|
+
if (ret[2]) {
|
|
2038
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2039
|
+
}
|
|
2040
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2041
|
+
}
|
|
2042
|
+
/**
|
|
2043
|
+
* Restore sparse cell records produced by `snapshot_sparse` or
|
|
2044
|
+
* `snapshot_range_sparse`. Uses workbook bulk-load so formulas are
|
|
2045
|
+
* reinstalled dirty and are not evaluated during restore.
|
|
2046
|
+
*
|
|
2047
|
+
* **Contract: ADDITIVE merge onto the live workbook** (audit B-7).
|
|
2048
|
+
* There is no teardown and no subscription reset — records are
|
|
2049
|
+
* applied on top of whatever the workbook already holds, and a
|
|
2050
|
+
* `"null"`-kind record explicitly clears its cell. The legacy
|
|
2051
|
+
* sheet-store relies on this for large-range-clear undo: it
|
|
2052
|
+
* snapshots only the range's non-empty cells, clears, and undoes
|
|
2053
|
+
* by restoring that sparse snapshot onto the live workbook.
|
|
2054
|
+
*
|
|
2055
|
+
* W2.3 (audit B-1) verdict: because of this additive contract,
|
|
2056
|
+
* `restore_sparse` deliberately STAYS on the legacy per-cell
|
|
2057
|
+
* `WorkbookLoader` path — the storage-primary
|
|
2058
|
+
* `install_workbook_bulk` is a full-sheet REPLACE and would
|
|
2059
|
+
* silently destroy unrelated live content. Routing it would need
|
|
2060
|
+
* the additive install variant Phase 6.4 deferred. The fresh-shell
|
|
2061
|
+
* restore (`restore_persistence_v1`) IS routed storage-primary.
|
|
2062
|
+
* @param {any} cells
|
|
2063
|
+
* @returns {number}
|
|
2064
|
+
*/
|
|
2065
|
+
restore_sparse(cells) {
|
|
2066
|
+
const ret = wasm.wasmworkbook_restore_sparse(this.__wbg_ptr, cells);
|
|
2067
|
+
if (ret[2]) {
|
|
2068
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2069
|
+
}
|
|
2070
|
+
return ret[0] >>> 0;
|
|
2071
|
+
}
|
|
2072
|
+
/**
|
|
2073
|
+
* @param {number} sheet
|
|
2074
|
+
* @param {string} addr
|
|
2075
|
+
* @param {string} input
|
|
2076
|
+
* @param {boolean} expand_tables
|
|
2077
|
+
*/
|
|
2078
|
+
setCellInputConfirmed(sheet, addr, input, expand_tables) {
|
|
2079
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2080
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2081
|
+
const ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2082
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2083
|
+
const ret = wasm.wasmworkbook_setCellInputConfirmed(this.__wbg_ptr, sheet, ptr0, len0, ptr1, len1, expand_tables);
|
|
2084
|
+
if (ret[1]) {
|
|
2085
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
/**
|
|
2089
|
+
* @param {number} sheet
|
|
2090
|
+
* @param {any} request
|
|
2091
|
+
* @returns {any}
|
|
2092
|
+
*/
|
|
2093
|
+
setConditionalFormatRule(sheet, request) {
|
|
2094
|
+
const ret = wasm.wasmworkbook_setConditionalFormatRule(this.__wbg_ptr, sheet, request);
|
|
2095
|
+
if (ret[2]) {
|
|
2096
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2097
|
+
}
|
|
2098
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2099
|
+
}
|
|
2100
|
+
/**
|
|
2101
|
+
* @param {number} sheet
|
|
2102
|
+
* @param {number} start_row
|
|
2103
|
+
* @param {number} start_col
|
|
2104
|
+
* @param {number} end_row
|
|
2105
|
+
* @param {number} end_col
|
|
2106
|
+
* @param {any} rule
|
|
2107
|
+
*/
|
|
2108
|
+
setDataValidation(sheet, start_row, start_col, end_row, end_col, rule) {
|
|
2109
|
+
const ret = wasm.wasmworkbook_setDataValidation(this.__wbg_ptr, sheet, start_row, start_col, end_row, end_col, rule);
|
|
2110
|
+
if (ret[1]) {
|
|
2111
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
/**
|
|
2115
|
+
* Push the host's per-sheet FILTER-hidden row set as read-only evaluation
|
|
2116
|
+
* input (`design-filter-hidden-rows` §6.5). Additive twin of
|
|
2117
|
+
* `setEvalHiddenRows` — that method is unchanged — carrying the source
|
|
2118
|
+
* distinction Excel's two SUBTOTAL layers need: `SUBTOTAL(1-11)` excludes
|
|
2119
|
+
* THIS set but includes manually hidden rows, `SUBTOTAL(101-111)` excludes
|
|
2120
|
+
* both. Same shape and contract as `setEvalHiddenRows`: `rows` is a
|
|
2121
|
+
* `number[]` of 0-based row indices, full-replace, empty array clears,
|
|
2122
|
+
* out-of-range `sheet_idx` is a silent no-op, never throws.
|
|
2123
|
+
* @param {number} sheet_idx
|
|
2124
|
+
* @param {Uint32Array} rows
|
|
2125
|
+
*/
|
|
2126
|
+
setEvalFilterHiddenRows(sheet_idx, rows) {
|
|
2127
|
+
const ptr0 = passArray32ToWasm0(rows, wasm.__wbindgen_malloc);
|
|
2128
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2129
|
+
wasm.wasmworkbook_setEvalFilterHiddenRows(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
2130
|
+
}
|
|
2131
|
+
/**
|
|
2132
|
+
* @param {number} sheet_idx
|
|
2133
|
+
* @param {Uint32Array} rows
|
|
2134
|
+
*/
|
|
2135
|
+
setEvalHiddenRows(sheet_idx, rows) {
|
|
2136
|
+
const ptr0 = passArray32ToWasm0(rows, wasm.__wbindgen_malloc);
|
|
2137
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2138
|
+
wasm.wasmworkbook_setEvalHiddenRows(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
2139
|
+
}
|
|
2140
|
+
/**
|
|
2141
|
+
* Set a cell's formula through the workbook. Returns `true` if the
|
|
2142
|
+
* formula parsed and installed cleanly, `false` if parse failed
|
|
2143
|
+
* (cell becomes `#VALUE!`) or a cycle was detected (cell becomes
|
|
2144
|
+
* `#CYCLE!`).
|
|
2145
|
+
*
|
|
2146
|
+
* The legacy `set_formula(sheet_idx: u32, ...)` routes through the same
|
|
2147
|
+
* workbook method. This `usize`-typed alias is retained for generated
|
|
2148
|
+
* bindings and worker callers.
|
|
2149
|
+
* @param {number} sheet_idx
|
|
2150
|
+
* @param {string} addr
|
|
2151
|
+
* @param {string} src
|
|
2152
|
+
* @returns {boolean}
|
|
2153
|
+
*/
|
|
2154
|
+
setFormulaAt(sheet_idx, addr, src) {
|
|
2155
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2156
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2157
|
+
const ptr1 = passStringToWasm0(src, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2158
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2159
|
+
const ret = wasm.wasmworkbook_setFormulaAt(this.__wbg_ptr, sheet_idx, ptr0, len0, ptr1, len1);
|
|
2160
|
+
return ret !== 0;
|
|
2161
|
+
}
|
|
2162
|
+
/**
|
|
2163
|
+
* @param {number} sheet
|
|
2164
|
+
* @param {any} config
|
|
2165
|
+
* @returns {any}
|
|
2166
|
+
*/
|
|
2167
|
+
setPrintConfig(sheet, config) {
|
|
2168
|
+
const ret = wasm.wasmworkbook_setPrintConfig(this.__wbg_ptr, sheet, config);
|
|
2169
|
+
if (ret[2]) {
|
|
2170
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2171
|
+
}
|
|
2172
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2173
|
+
}
|
|
2174
|
+
/**
|
|
2175
|
+
* Set one totals-row column's aggregate (design doc #32 §7). `func` is a
|
|
2176
|
+
* camelCase id: `"none"` (clears the cell) / `"average"` / `"count"`
|
|
2177
|
+
* (COUNTA) / `"countNums"` (COUNT) / `"max"` / `"min"` / `"sum"` /
|
|
2178
|
+
* `"stdDev"` / `"var"`. Non-`none` ids write `=SUBTOTAL(1xx, Table[Col])`
|
|
2179
|
+
* with the 101-111 hidden-excluding code. Requires the totals row to be
|
|
2180
|
+
* enabled first (`"no-totals-row"` otherwise); unknown `func` yields
|
|
2181
|
+
* `"invalid-totals-function"`.
|
|
2182
|
+
* @param {string} name
|
|
2183
|
+
* @param {string} column
|
|
2184
|
+
* @param {string} func
|
|
2185
|
+
*/
|
|
2186
|
+
setTableTotalFunction(name, column, func) {
|
|
2187
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2188
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2189
|
+
const ptr1 = passStringToWasm0(column, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2190
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2191
|
+
const ptr2 = passStringToWasm0(func, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2192
|
+
const len2 = WASM_VECTOR_LEN;
|
|
2193
|
+
const ret = wasm.wasmworkbook_setTableTotalFunction(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
2194
|
+
if (ret[1]) {
|
|
2195
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
/**
|
|
2199
|
+
* @param {string} name
|
|
2200
|
+
* @param {boolean} enabled
|
|
2201
|
+
*/
|
|
2202
|
+
setTableTotalsRow(name, enabled) {
|
|
2203
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2204
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2205
|
+
const ret = wasm.wasmworkbook_setTableTotalsRow(this.__wbg_ptr, ptr0, len0, enabled);
|
|
2206
|
+
if (ret[1]) {
|
|
2207
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
/**
|
|
2211
|
+
* @param {number} sheet_idx
|
|
2212
|
+
* @param {string} addr
|
|
2213
|
+
* @param {boolean} value
|
|
2214
|
+
*/
|
|
2215
|
+
set_boolean(sheet_idx, addr, value) {
|
|
2216
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2217
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2218
|
+
wasm.wasmworkbook_set_boolean(this.__wbg_ptr, sheet_idx, ptr0, len0, value);
|
|
2219
|
+
}
|
|
2220
|
+
/**
|
|
2221
|
+
* Set a cell to a boolean value through the workbook. Cross-sheet aware.
|
|
2222
|
+
* @param {number} sheet_idx
|
|
2223
|
+
* @param {string} addr
|
|
2224
|
+
* @param {boolean} value
|
|
2225
|
+
*/
|
|
2226
|
+
set_cell_boolean(sheet_idx, addr, value) {
|
|
2227
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2228
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2229
|
+
wasm.wasmworkbook_set_cell_boolean(this.__wbg_ptr, sheet_idx, ptr0, len0, value);
|
|
2230
|
+
}
|
|
2231
|
+
/**
|
|
2232
|
+
* Set a cell to an error value through the workbook. Cross-sheet aware.
|
|
2233
|
+
* @param {number} sheet_idx
|
|
2234
|
+
* @param {string} addr
|
|
2235
|
+
* @param {string} value
|
|
2236
|
+
*/
|
|
2237
|
+
set_cell_error(sheet_idx, addr, value) {
|
|
2238
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2239
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2240
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2241
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2242
|
+
wasm.wasmworkbook_set_cell_error(this.__wbg_ptr, sheet_idx, ptr0, len0, ptr1, len1);
|
|
2243
|
+
}
|
|
2244
|
+
/**
|
|
2245
|
+
* 原始编辑与单条历史一起交给 Rust;表头输入复用列名原子操作。
|
|
2246
|
+
* @param {number} sheet_idx
|
|
2247
|
+
* @param {string} addr
|
|
2248
|
+
* @param {string} input
|
|
2249
|
+
*/
|
|
2250
|
+
set_cell_input(sheet_idx, addr, input) {
|
|
2251
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2252
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2253
|
+
const ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2254
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2255
|
+
const ret = wasm.wasmworkbook_set_cell_input(this.__wbg_ptr, sheet_idx, ptr0, len0, ptr1, len1);
|
|
2256
|
+
if (ret[1]) {
|
|
2257
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2260
|
+
/**
|
|
2261
|
+
* 保护表可关闭自动扩展;保留原输入 API 的签名,仍只执行一次原生写入。
|
|
2262
|
+
* @param {number} sheet_idx
|
|
2263
|
+
* @param {string} addr
|
|
2264
|
+
* @param {string} input
|
|
2265
|
+
* @param {boolean} expand_tables
|
|
2266
|
+
*/
|
|
2267
|
+
set_cell_input_with_table_expansion(sheet_idx, addr, input, expand_tables) {
|
|
2268
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2269
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2270
|
+
const ptr1 = passStringToWasm0(input, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2271
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2272
|
+
const ret = wasm.wasmworkbook_set_cell_input_with_table_expansion(this.__wbg_ptr, sheet_idx, ptr0, len0, ptr1, len1, expand_tables);
|
|
2273
|
+
if (ret[1]) {
|
|
2274
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
/**
|
|
2278
|
+
* @param {number} sheet_idx
|
|
2279
|
+
* @param {string} addr
|
|
2280
|
+
* @param {number} value
|
|
2281
|
+
*/
|
|
2282
|
+
set_cell_number(sheet_idx, addr, value) {
|
|
2283
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2284
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2285
|
+
wasm.wasmworkbook_set_cell_number(this.__wbg_ptr, sheet_idx, ptr0, len0, value);
|
|
2286
|
+
}
|
|
2287
|
+
/**
|
|
2288
|
+
* Set a cell to a text value through the workbook. Cross-sheet aware.
|
|
2289
|
+
* @param {number} sheet_idx
|
|
2290
|
+
* @param {string} addr
|
|
2291
|
+
* @param {string} value
|
|
2292
|
+
*/
|
|
2293
|
+
set_cell_text(sheet_idx, addr, value) {
|
|
2294
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2295
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2296
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2297
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2298
|
+
wasm.wasmworkbook_set_cell_text(this.__wbg_ptr, sheet_idx, ptr0, len0, ptr1, len1);
|
|
2299
|
+
}
|
|
2300
|
+
/**
|
|
2301
|
+
* Persist a sparse column-width fact on a workbook sheet. Empty columns are
|
|
2302
|
+
* not materialized; this only updates sheet metadata.
|
|
2303
|
+
* @param {number} sheet_idx
|
|
2304
|
+
* @param {number} col_index
|
|
2305
|
+
* @param {number} width_px
|
|
2306
|
+
* @returns {boolean}
|
|
2307
|
+
*/
|
|
2308
|
+
set_col_width(sheet_idx, col_index, width_px) {
|
|
2309
|
+
const ret = wasm.wasmworkbook_set_col_width(this.__wbg_ptr, sheet_idx, col_index, width_px);
|
|
2310
|
+
return ret !== 0;
|
|
2311
|
+
}
|
|
2312
|
+
/**
|
|
2313
|
+
* @param {number} sheet_idx
|
|
2314
|
+
* @param {string} addr
|
|
2315
|
+
* @param {string} value
|
|
2316
|
+
*/
|
|
2317
|
+
set_error(sheet_idx, addr, value) {
|
|
2318
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2319
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2320
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2321
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2322
|
+
wasm.wasmworkbook_set_error(this.__wbg_ptr, sheet_idx, ptr0, len0, ptr1, len1);
|
|
2323
|
+
}
|
|
2324
|
+
/**
|
|
2325
|
+
* 兼容旧调用:把完整格式逐格写进 cellStyle。
|
|
2326
|
+
* @param {number} sheet_idx
|
|
2327
|
+
* @param {number} start_row
|
|
2328
|
+
* @param {number} start_col
|
|
2329
|
+
* @param {number} end_row
|
|
2330
|
+
* @param {number} end_col
|
|
2331
|
+
* @param {any} fmt
|
|
2332
|
+
* @returns {number}
|
|
2333
|
+
*/
|
|
2334
|
+
set_format_range(sheet_idx, start_row, start_col, end_row, end_col, fmt) {
|
|
2335
|
+
const ret = wasm.wasmworkbook_set_format_range(this.__wbg_ptr, sheet_idx, start_row, start_col, end_row, end_col, fmt);
|
|
2336
|
+
if (ret[2]) {
|
|
2337
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2338
|
+
}
|
|
2339
|
+
return ret[0] >>> 0;
|
|
2340
|
+
}
|
|
2341
|
+
/**
|
|
2342
|
+
* @param {number} sheet_idx
|
|
2343
|
+
* @param {string} addr
|
|
2344
|
+
* @param {string} formula
|
|
2345
|
+
* @returns {boolean}
|
|
2346
|
+
*/
|
|
2347
|
+
set_formula(sheet_idx, addr, formula) {
|
|
2348
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2349
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2350
|
+
const ptr1 = passStringToWasm0(formula, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2351
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2352
|
+
const ret = wasm.wasmworkbook_set_formula(this.__wbg_ptr, sheet_idx, ptr0, len0, ptr1, len1);
|
|
2353
|
+
return ret !== 0;
|
|
2354
|
+
}
|
|
2355
|
+
/**
|
|
2356
|
+
* @param {number} sheet
|
|
2357
|
+
* @param {number} rows
|
|
2358
|
+
* @param {number} cols
|
|
2359
|
+
* @returns {boolean}
|
|
2360
|
+
*/
|
|
2361
|
+
set_frozen_panes(sheet, rows, cols) {
|
|
2362
|
+
const ret = wasm.wasmworkbook_set_frozen_panes(this.__wbg_ptr, sheet, rows, cols);
|
|
2363
|
+
if (ret[2]) {
|
|
2364
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2365
|
+
}
|
|
2366
|
+
return ret[0] !== 0;
|
|
2367
|
+
}
|
|
2368
|
+
/**
|
|
2369
|
+
* @param {number} sheet_idx
|
|
2370
|
+
* @param {string} addr
|
|
2371
|
+
* @param {number} value
|
|
2372
|
+
*/
|
|
2373
|
+
set_number(sheet_idx, addr, value) {
|
|
2374
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2375
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2376
|
+
wasm.wasmworkbook_set_number(this.__wbg_ptr, sheet_idx, ptr0, len0, value);
|
|
2377
|
+
}
|
|
2378
|
+
/**
|
|
2379
|
+
* @param {number} sheet_idx
|
|
2380
|
+
* @param {number} row_index
|
|
2381
|
+
* @param {number} height_px
|
|
2382
|
+
* @returns {boolean}
|
|
2383
|
+
*/
|
|
2384
|
+
set_row_height(sheet_idx, row_index, height_px) {
|
|
2385
|
+
const ret = wasm.wasmworkbook_set_row_height(this.__wbg_ptr, sheet_idx, row_index, height_px);
|
|
2386
|
+
return ret !== 0;
|
|
2387
|
+
}
|
|
2388
|
+
/**
|
|
2389
|
+
* @param {number} sheet_idx
|
|
2390
|
+
* @param {string} addr
|
|
2391
|
+
* @param {string} value
|
|
2392
|
+
*/
|
|
2393
|
+
set_text(sheet_idx, addr, value) {
|
|
2394
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2395
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2396
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2397
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2398
|
+
wasm.wasmworkbook_set_text(this.__wbg_ptr, sheet_idx, ptr0, len0, ptr1, len1);
|
|
2399
|
+
}
|
|
2400
|
+
/**
|
|
2401
|
+
* 一次确认只产生一条原生历史;取消隐藏使用原范围,全表范围即恢复全部。
|
|
2402
|
+
* @param {number} sheet
|
|
2403
|
+
* @param {number} start_row
|
|
2404
|
+
* @param {number} start_col
|
|
2405
|
+
* @param {number} end_row
|
|
2406
|
+
* @param {number} end_col
|
|
2407
|
+
* @param {string} action
|
|
2408
|
+
* @returns {boolean}
|
|
2409
|
+
*/
|
|
2410
|
+
set_visibility(sheet, start_row, start_col, end_row, end_col, action) {
|
|
2411
|
+
const ptr0 = passStringToWasm0(action, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2412
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2413
|
+
const ret = wasm.wasmworkbook_set_visibility(this.__wbg_ptr, sheet, start_row, start_col, end_row, end_col, ptr0, len0);
|
|
2414
|
+
if (ret[2]) {
|
|
2415
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2416
|
+
}
|
|
2417
|
+
return ret[0] !== 0;
|
|
2418
|
+
}
|
|
2419
|
+
/**
|
|
2420
|
+
* @returns {number}
|
|
2421
|
+
*/
|
|
2422
|
+
sheet_count() {
|
|
2423
|
+
const ret = wasm.wasmworkbook_sheet_count(this.__wbg_ptr);
|
|
2424
|
+
return ret >>> 0;
|
|
2425
|
+
}
|
|
2426
|
+
/**
|
|
2427
|
+
* Opaque native identity; String avoids JavaScript's integer precision limit.
|
|
2428
|
+
* @param {number} idx
|
|
2429
|
+
* @returns {string}
|
|
2430
|
+
*/
|
|
2431
|
+
sheet_key(idx) {
|
|
2432
|
+
let deferred1_0;
|
|
2433
|
+
let deferred1_1;
|
|
2434
|
+
try {
|
|
2435
|
+
const ret = wasm.wasmworkbook_sheet_key(this.__wbg_ptr, idx);
|
|
2436
|
+
deferred1_0 = ret[0];
|
|
2437
|
+
deferred1_1 = ret[1];
|
|
2438
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2439
|
+
} finally {
|
|
2440
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
/**
|
|
2444
|
+
* @param {number} idx
|
|
2445
|
+
* @returns {string}
|
|
2446
|
+
*/
|
|
2447
|
+
sheet_name(idx) {
|
|
2448
|
+
let deferred1_0;
|
|
2449
|
+
let deferred1_1;
|
|
2450
|
+
try {
|
|
2451
|
+
const ret = wasm.wasmworkbook_sheet_name(this.__wbg_ptr, idx);
|
|
2452
|
+
deferred1_0 = ret[0];
|
|
2453
|
+
deferred1_1 = ret[1];
|
|
2454
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
2455
|
+
} finally {
|
|
2456
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
/**
|
|
2460
|
+
* 包括屏幕外索引,几何定位不依赖当前挂载的单元格。
|
|
2461
|
+
* @param {number} sheet
|
|
2462
|
+
* @returns {any}
|
|
2463
|
+
*/
|
|
2464
|
+
sheet_visibility(sheet) {
|
|
2465
|
+
const ret = wasm.wasmworkbook_sheet_visibility(this.__wbg_ptr, sheet);
|
|
2466
|
+
if (ret[2]) {
|
|
2467
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2468
|
+
}
|
|
2469
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2470
|
+
}
|
|
2471
|
+
/**
|
|
2472
|
+
* Snapshot display/type/error/formula for a single cell with one
|
|
2473
|
+
* workbook read. Worker hydration uses this to avoid evaluating a dirty
|
|
2474
|
+
* formula once for display, again for type, and again for error state.
|
|
2475
|
+
* @param {number} sheet_idx
|
|
2476
|
+
* @param {string} addr
|
|
2477
|
+
* @returns {any}
|
|
2478
|
+
*/
|
|
2479
|
+
snapshotCell(sheet_idx, addr) {
|
|
2480
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2481
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2482
|
+
const ret = wasm.wasmworkbook_snapshotCell(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
2483
|
+
if (ret[2]) {
|
|
2484
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2485
|
+
}
|
|
2486
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2487
|
+
}
|
|
2488
|
+
/**
|
|
2489
|
+
* Capture every sheet's filter state as an undo before-image. Twin of
|
|
2490
|
+
* `snapshotHidden`: pure read, no epoch bump, whole-workbook REPLACE on
|
|
2491
|
+
* the way back through `restoreFilters`. Sheets with no filter are
|
|
2492
|
+
* omitted.
|
|
2493
|
+
* @returns {any}
|
|
2494
|
+
*/
|
|
2495
|
+
snapshotFilters() {
|
|
2496
|
+
const ret = wasm.wasmworkbook_snapshotFilters(this.__wbg_ptr);
|
|
2497
|
+
if (ret[2]) {
|
|
2498
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2499
|
+
}
|
|
2500
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2501
|
+
}
|
|
2502
|
+
/**
|
|
2503
|
+
* Capture every sheet's manually hidden rows as an undo before-image.
|
|
2504
|
+
* Twin of `snapshotTables`: pure read, no epoch bump, whole-workbook
|
|
2505
|
+
* REPLACE on the way back through `restoreHidden`. Sheets with nothing
|
|
2506
|
+
* hidden are omitted.
|
|
2507
|
+
* @returns {any}
|
|
2508
|
+
*/
|
|
2509
|
+
snapshotHidden() {
|
|
2510
|
+
const ret = wasm.wasmworkbook_snapshotHidden(this.__wbg_ptr);
|
|
2511
|
+
if (ret[2]) {
|
|
2512
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2513
|
+
}
|
|
2514
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2515
|
+
}
|
|
2516
|
+
/**
|
|
2517
|
+
* Capture the whole Excel Table registry as an undo before-image
|
|
2518
|
+
* (design doc #32 §11/§12). Returns
|
|
2519
|
+
* `{ version: 1, tables: TableJSON[] }` — the same per-Table shape
|
|
2520
|
+
* `listTables` emits, wrapped in a versioned envelope.
|
|
2521
|
+
*
|
|
2522
|
+
* 此低层快照只包含注册元数据,不包含表头与公式;交互撤销使用 Rust 原生历史,
|
|
2523
|
+
* 不能由宿主把这个快照当成完整 Table 操作。Pure read — no epoch bump.
|
|
2524
|
+
* @returns {any}
|
|
2525
|
+
*/
|
|
2526
|
+
snapshotTables() {
|
|
2527
|
+
const ret = wasm.wasmworkbook_snapshotTables(this.__wbg_ptr);
|
|
2528
|
+
if (ret[2]) {
|
|
2529
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2530
|
+
}
|
|
2531
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2532
|
+
}
|
|
2533
|
+
/**
|
|
2534
|
+
* 显示专用快照含条件高亮;基础 snapshot_format_range 继续服务复制和持久化。
|
|
2535
|
+
* @param {number} sheet
|
|
2536
|
+
* @param {number} start_row
|
|
2537
|
+
* @param {number} start_col
|
|
2538
|
+
* @param {number} end_row
|
|
2539
|
+
* @param {number} end_col
|
|
2540
|
+
* @returns {any}
|
|
2541
|
+
*/
|
|
2542
|
+
snapshot_display_format_range(sheet, start_row, start_col, end_row, end_col) {
|
|
2543
|
+
const ret = wasm.wasmworkbook_snapshot_display_format_range(this.__wbg_ptr, sheet, start_row, start_col, end_row, end_col);
|
|
2544
|
+
if (ret[2]) {
|
|
2545
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2546
|
+
}
|
|
2547
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2548
|
+
}
|
|
2549
|
+
/**
|
|
2550
|
+
* Snapshot sparse formatting metadata for a workbook sheet. The
|
|
2551
|
+
* snapshot is metadata-only and safe for lazy formula caches.
|
|
2552
|
+
* @param {number} sheet_idx
|
|
2553
|
+
* @param {number} start_row
|
|
2554
|
+
* @param {number} start_col
|
|
2555
|
+
* @param {number} end_row
|
|
2556
|
+
* @param {number} end_col
|
|
2557
|
+
* @returns {any}
|
|
2558
|
+
*/
|
|
2559
|
+
snapshot_format_range(sheet_idx, start_row, start_col, end_row, end_col) {
|
|
2560
|
+
const ret = wasm.wasmworkbook_snapshot_format_range(this.__wbg_ptr, sheet_idx, start_row, start_col, end_row, end_col);
|
|
2561
|
+
if (ret[2]) {
|
|
2562
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2563
|
+
}
|
|
2564
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2565
|
+
}
|
|
2566
|
+
/**
|
|
2567
|
+
* Snapshot workbook state as persistence-v1 sparse envelope.
|
|
2568
|
+
*
|
|
2569
|
+
* Format metadata includes range-format and in-range cell formats from each
|
|
2570
|
+
* sheet snapshot, but does not serialize any dense grid materialization.
|
|
2571
|
+
* Formula cells are serialized using their source (`=...`), preserving lazy
|
|
2572
|
+
* evaluation contracts during restore.
|
|
2573
|
+
* @returns {any}
|
|
2574
|
+
*/
|
|
2575
|
+
snapshot_persistence_v1() {
|
|
2576
|
+
const ret = wasm.wasmworkbook_snapshot_persistence_v1(this.__wbg_ptr);
|
|
2577
|
+
if (ret[2]) {
|
|
2578
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2579
|
+
}
|
|
2580
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2581
|
+
}
|
|
2582
|
+
/**
|
|
2583
|
+
* Snapshot non-empty cells in a zero-based inclusive range without
|
|
2584
|
+
* reading formula values. Formula cells serialize their source and stay
|
|
2585
|
+
* dirty/uncomputed, so this is safe for large-range undo.
|
|
2586
|
+
* @param {number} sheet_idx
|
|
2587
|
+
* @param {number} start_row
|
|
2588
|
+
* @param {number} start_col
|
|
2589
|
+
* @param {number} end_row
|
|
2590
|
+
* @param {number} end_col
|
|
2591
|
+
* @returns {any}
|
|
2592
|
+
*/
|
|
2593
|
+
snapshot_range_sparse(sheet_idx, start_row, start_col, end_row, end_col) {
|
|
2594
|
+
const ret = wasm.wasmworkbook_snapshot_range_sparse(this.__wbg_ptr, sheet_idx, start_row, start_col, end_row, end_col);
|
|
2595
|
+
if (ret[2]) {
|
|
2596
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2597
|
+
}
|
|
2598
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2599
|
+
}
|
|
2600
|
+
/**
|
|
2601
|
+
* Snapshot sparse workbook contents without reading formula values.
|
|
2602
|
+
*
|
|
2603
|
+
* Formula cells serialize their source (`kind: "formula"`) and do
|
|
2604
|
+
* not call the eval path, so dirty formula caches stay dirty.
|
|
2605
|
+
* @returns {any}
|
|
2606
|
+
*/
|
|
2607
|
+
snapshot_sparse() {
|
|
2608
|
+
const ret = wasm.wasmworkbook_snapshot_sparse(this.__wbg_ptr);
|
|
2609
|
+
if (ret[2]) {
|
|
2610
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2611
|
+
}
|
|
2612
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2613
|
+
}
|
|
2614
|
+
/**
|
|
2615
|
+
* Snapshot row/column size metadata for the requested visible window.
|
|
2616
|
+
* @param {number} sheet_idx
|
|
2617
|
+
* @param {number} start_row
|
|
2618
|
+
* @param {number} start_col
|
|
2619
|
+
* @param {number} end_row
|
|
2620
|
+
* @param {number} end_col
|
|
2621
|
+
* @returns {any}
|
|
2622
|
+
*/
|
|
2623
|
+
snapshot_viewport_sizes(sheet_idx, start_row, start_col, end_row, end_col) {
|
|
2624
|
+
const ret = wasm.wasmworkbook_snapshot_viewport_sizes(this.__wbg_ptr, sheet_idx, start_row, start_col, end_row, end_col);
|
|
2625
|
+
if (ret[2]) {
|
|
2626
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2627
|
+
}
|
|
2628
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2629
|
+
}
|
|
2630
|
+
/**
|
|
2631
|
+
* Physically sort a range (design-engine-sort S2). Payload:
|
|
2632
|
+
* `{ range, keys: [{ col, direction, caseSensitive }], excludedRows }`
|
|
2633
|
+
* where `range` is an A1 string or a zero-based bounds object. Returns
|
|
2634
|
+
* the `SortRangeReport` witness on success and a structured
|
|
2635
|
+
* `{ ok: false, code, anchor?, message? }` object for every rejection —
|
|
2636
|
+
* engine gates (`invalid-range`, `empty-keys`, `key-out-of-range`,
|
|
2637
|
+
* `spill-in-range`) and payload-parse failures (`invalid-payload`).
|
|
2638
|
+
* The `Err` arm is reserved for a catastrophic report serialization.
|
|
2639
|
+
* @param {number} sheet_idx
|
|
2640
|
+
* @param {any} payload
|
|
2641
|
+
* @returns {any}
|
|
2642
|
+
*/
|
|
2643
|
+
sortRange(sheet_idx, payload) {
|
|
2644
|
+
const ret = wasm.wasmworkbook_sortRange(this.__wbg_ptr, sheet_idx, payload);
|
|
2645
|
+
if (ret[2]) {
|
|
2646
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2647
|
+
}
|
|
2648
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2649
|
+
}
|
|
2650
|
+
/**
|
|
2651
|
+
* @param {number} sheet_idx
|
|
2652
|
+
* @param {string} addr
|
|
2653
|
+
* @returns {any}
|
|
2654
|
+
*/
|
|
2655
|
+
spillAnchor(sheet_idx, addr) {
|
|
2656
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2657
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2658
|
+
const ret = wasm.wasmworkbook_spillAnchor(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
2659
|
+
return ret;
|
|
2660
|
+
}
|
|
2661
|
+
/**
|
|
2662
|
+
* 碰撞态(`#SPILL!`)锚点是被哪一格挡住的 —— 返回 `"B3"` 形式的地址字符串,
|
|
2663
|
+
* 答不出时 `null`。UI 拿它给用户一句「把 B3 清掉就好了」,这是 `#SPILL!`
|
|
2664
|
+
* 唯一缺的那条线索(`spillInfo` 对碰撞态锚点恒回 `null`,因为它一格都没装上)。
|
|
2665
|
+
*
|
|
2666
|
+
* 答不出的三种情形在 JS 侧不区分,因为处理方式一样 —— 不说话:`addr` 不是碰撞态
|
|
2667
|
+
* 锚点、碰撞原因是矩形跑出表边(没有哪一格该被指责)、矩形大到超出扫描上限。
|
|
2668
|
+
* 语义与上限的完整说明见 `sheet_spill_blocker.rs`。
|
|
2669
|
+
* @param {number} sheet_idx
|
|
2670
|
+
* @param {string} addr
|
|
2671
|
+
* @returns {any}
|
|
2672
|
+
*/
|
|
2673
|
+
spillBlocker(sheet_idx, addr) {
|
|
2674
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2675
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2676
|
+
const ret = wasm.wasmworkbook_spillBlocker(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
2677
|
+
return ret;
|
|
2678
|
+
}
|
|
2679
|
+
/**
|
|
2680
|
+
* Workbook variant of `WasmSheet::spill_info`. See that method for
|
|
2681
|
+
* JS-side semantics. Returns `null` for an unknown sheet index.
|
|
2682
|
+
* @param {number} sheet_idx
|
|
2683
|
+
* @param {string} addr
|
|
2684
|
+
* @returns {any}
|
|
2685
|
+
*/
|
|
2686
|
+
spillInfo(sheet_idx, addr) {
|
|
2687
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2688
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2689
|
+
const ret = wasm.wasmworkbook_spillInfo(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
2690
|
+
return ret;
|
|
2691
|
+
}
|
|
2692
|
+
/**
|
|
2693
|
+
* @param {any} request
|
|
2694
|
+
* @param {boolean} overwrite
|
|
2695
|
+
* @returns {any}
|
|
2696
|
+
*/
|
|
2697
|
+
split_text_columns(request, overwrite) {
|
|
2698
|
+
const ret = wasm.wasmworkbook_split_text_columns(this.__wbg_ptr, request, overwrite);
|
|
2699
|
+
if (ret[2]) {
|
|
2700
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2701
|
+
}
|
|
2702
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2703
|
+
}
|
|
2704
|
+
/**
|
|
2705
|
+
* Subscribe to a cell at `sheet_name!addr`. Returns an opaque
|
|
2706
|
+
* `u32` token; pass it back to `unsubscribe_cell` to cancel.
|
|
2707
|
+
*
|
|
2708
|
+
* The callback subscribes to the sheet's stable cell facade. Local and
|
|
2709
|
+
* cross-sheet dependencies both settle through the workbook-scoped Store;
|
|
2710
|
+
* this map only owns the opaque token and sheet-remap lifecycle.
|
|
2711
|
+
* @param {string} sheet_name
|
|
2712
|
+
* @param {string} addr
|
|
2713
|
+
* @param {Function} cb
|
|
2714
|
+
* @returns {number}
|
|
2715
|
+
*/
|
|
2716
|
+
subscribe_cell(sheet_name, addr, cb) {
|
|
2717
|
+
const ptr0 = passStringToWasm0(sheet_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2718
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2719
|
+
const ptr1 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2720
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2721
|
+
const ret = wasm.wasmworkbook_subscribe_cell(this.__wbg_ptr, ptr0, len0, ptr1, len1, cb);
|
|
2722
|
+
return ret >>> 0;
|
|
2723
|
+
}
|
|
2724
|
+
/**
|
|
2725
|
+
* 只读建议:不写入内容、不增加历史,用户确认仍走 set_cell_input。
|
|
2726
|
+
* @param {any} request
|
|
2727
|
+
* @returns {any}
|
|
2728
|
+
*/
|
|
2729
|
+
suggest_quick_formula(request) {
|
|
2730
|
+
const ret = wasm.wasmworkbook_suggest_quick_formula(this.__wbg_ptr, request);
|
|
2731
|
+
if (ret[2]) {
|
|
2732
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2733
|
+
}
|
|
2734
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2735
|
+
}
|
|
2736
|
+
/**
|
|
2737
|
+
* @param {number} sheet_idx
|
|
2738
|
+
* @param {string} addr
|
|
2739
|
+
* @returns {any}
|
|
2740
|
+
*/
|
|
2741
|
+
tryClearCellAt(sheet_idx, addr) {
|
|
2742
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2743
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2744
|
+
const ret = wasm.wasmworkbook_tryClearCellAt(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
2745
|
+
if (ret[2]) {
|
|
2746
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2747
|
+
}
|
|
2748
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2749
|
+
}
|
|
2750
|
+
/**
|
|
2751
|
+
* @param {number} sheet_idx
|
|
2752
|
+
* @param {string} addr
|
|
2753
|
+
* @param {boolean} value
|
|
2754
|
+
* @returns {any}
|
|
2755
|
+
*/
|
|
2756
|
+
trySetCellBoolean(sheet_idx, addr, value) {
|
|
2757
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2758
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2759
|
+
const ret = wasm.wasmworkbook_trySetCellBoolean(this.__wbg_ptr, sheet_idx, ptr0, len0, value);
|
|
2760
|
+
if (ret[2]) {
|
|
2761
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2762
|
+
}
|
|
2763
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2764
|
+
}
|
|
2765
|
+
/**
|
|
2766
|
+
* @param {number} sheet_idx
|
|
2767
|
+
* @param {string} addr
|
|
2768
|
+
* @param {string} value
|
|
2769
|
+
* @returns {any}
|
|
2770
|
+
*/
|
|
2771
|
+
trySetCellError(sheet_idx, addr, value) {
|
|
2772
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2773
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2774
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2775
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2776
|
+
const ret = wasm.wasmworkbook_trySetCellError(this.__wbg_ptr, sheet_idx, ptr0, len0, ptr1, len1);
|
|
2777
|
+
if (ret[2]) {
|
|
2778
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2779
|
+
}
|
|
2780
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2781
|
+
}
|
|
2782
|
+
/**
|
|
2783
|
+
* @param {number} sheet_idx
|
|
2784
|
+
* @param {string} addr
|
|
2785
|
+
* @param {number} value
|
|
2786
|
+
* @returns {any}
|
|
2787
|
+
*/
|
|
2788
|
+
trySetCellNumber(sheet_idx, addr, value) {
|
|
2789
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2790
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2791
|
+
const ret = wasm.wasmworkbook_trySetCellNumber(this.__wbg_ptr, sheet_idx, ptr0, len0, value);
|
|
2792
|
+
if (ret[2]) {
|
|
2793
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2794
|
+
}
|
|
2795
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2796
|
+
}
|
|
2797
|
+
/**
|
|
2798
|
+
* @param {number} sheet_idx
|
|
2799
|
+
* @param {string} addr
|
|
2800
|
+
* @param {string} value
|
|
2801
|
+
* @returns {any}
|
|
2802
|
+
*/
|
|
2803
|
+
trySetCellText(sheet_idx, addr, value) {
|
|
2804
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2805
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2806
|
+
const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2807
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2808
|
+
const ret = wasm.wasmworkbook_trySetCellText(this.__wbg_ptr, sheet_idx, ptr0, len0, ptr1, len1);
|
|
2809
|
+
if (ret[2]) {
|
|
2810
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2811
|
+
}
|
|
2812
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2813
|
+
}
|
|
2814
|
+
/**
|
|
2815
|
+
* Returns the formula install outcome plus an optional spill-write
|
|
2816
|
+
* rejection. JS shape:
|
|
2817
|
+
* { ok: true, installed: true } | { ok: true, installed: false }
|
|
2818
|
+
* | { ok: false, code: 'spill-write', anchor: 'A1' }
|
|
2819
|
+
* `installed: false` corresponds to parse failure (`#VALUE!`) or
|
|
2820
|
+
* cycle detection (`#CYCLE!`) — the cell value already reflects
|
|
2821
|
+
* that, and the caller can pick it up via a follow-up snapshot.
|
|
2822
|
+
* @param {number} sheet_idx
|
|
2823
|
+
* @param {string} addr
|
|
2824
|
+
* @param {string} src
|
|
2825
|
+
* @returns {any}
|
|
2826
|
+
*/
|
|
2827
|
+
trySetFormulaAt(sheet_idx, addr, src) {
|
|
2828
|
+
const ptr0 = passStringToWasm0(addr, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2829
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2830
|
+
const ptr1 = passStringToWasm0(src, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2831
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2832
|
+
const ret = wasm.wasmworkbook_trySetFormulaAt(this.__wbg_ptr, sheet_idx, ptr0, len0, ptr1, len1);
|
|
2833
|
+
if (ret[2]) {
|
|
2834
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2835
|
+
}
|
|
2836
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2837
|
+
}
|
|
2838
|
+
/**
|
|
2839
|
+
* Remove a previously-registered name. Returns `true` if an entry
|
|
2840
|
+
* was removed; `false` if no entry existed. Publishing the name-version
|
|
2841
|
+
* root makes dependent formula-inner atoms re-derive to `#NAME?` (or any
|
|
2842
|
+
* newly-shadowing definition).
|
|
2843
|
+
* @param {string} name
|
|
2844
|
+
* @returns {boolean}
|
|
2845
|
+
*/
|
|
2846
|
+
undefineName(name) {
|
|
2847
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2848
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2849
|
+
const ret = wasm.wasmworkbook_undefineName(this.__wbg_ptr, ptr0, len0);
|
|
2850
|
+
return ret !== 0;
|
|
2851
|
+
}
|
|
2852
|
+
/**
|
|
2853
|
+
* Un-hide `rows` (0-based) on `sheetIdx`. Rows that were not hidden are
|
|
2854
|
+
* ignored. Returns whether anything changed; never throws.
|
|
2855
|
+
* @param {number} sheet_idx
|
|
2856
|
+
* @param {Uint32Array} rows
|
|
2857
|
+
* @returns {boolean}
|
|
2858
|
+
*/
|
|
2859
|
+
unhideRows(sheet_idx, rows) {
|
|
2860
|
+
const ptr0 = passArray32ToWasm0(rows, wasm.__wbindgen_malloc);
|
|
2861
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2862
|
+
const ret = wasm.wasmworkbook_unhideRows(this.__wbg_ptr, sheet_idx, ptr0, len0);
|
|
2863
|
+
return ret !== 0;
|
|
2864
|
+
}
|
|
2865
|
+
/**
|
|
2866
|
+
* Remove a previously-registered custom formula. Returns `true` if
|
|
2867
|
+
* an entry was removed; `false` if no entry existed. The registry Store
|
|
2868
|
+
* root is published only when removal succeeds, so materialized formulas
|
|
2869
|
+
* that consulted it re-derive and may surface `#NAME?`.
|
|
2870
|
+
* @param {string} name
|
|
2871
|
+
* @returns {boolean}
|
|
2872
|
+
*/
|
|
2873
|
+
unregisterCustomFormula(name) {
|
|
2874
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2875
|
+
const len0 = WASM_VECTOR_LEN;
|
|
2876
|
+
const ret = wasm.wasmworkbook_unregisterCustomFormula(this.__wbg_ptr, ptr0, len0);
|
|
2877
|
+
return ret !== 0;
|
|
2878
|
+
}
|
|
2879
|
+
/**
|
|
2880
|
+
* Cancel a subscription previously returned from `subscribe_cell`.
|
|
2881
|
+
* Idempotent: unknown / stale tokens are silently ignored.
|
|
2882
|
+
* @param {number} token
|
|
2883
|
+
*/
|
|
2884
|
+
unsubscribe_cell(token) {
|
|
2885
|
+
wasm.wasmworkbook_unsubscribe_cell(this.__wbg_ptr, token);
|
|
2886
|
+
}
|
|
2887
|
+
}
|
|
2888
|
+
if (Symbol.dispose) WasmWorkbook.prototype[Symbol.dispose] = WasmWorkbook.prototype.free;
|
|
2889
|
+
|
|
2890
|
+
/**
|
|
2891
|
+
* @returns {any}
|
|
2892
|
+
*/
|
|
2893
|
+
export function function_catalog() {
|
|
2894
|
+
const ret = wasm.function_catalog();
|
|
2895
|
+
if (ret[2]) {
|
|
2896
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2897
|
+
}
|
|
2898
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
function __wbg_get_imports() {
|
|
2902
|
+
const import0 = {
|
|
2903
|
+
__proto__: null,
|
|
2904
|
+
__wbg_Error_2e59b1b37a9a34c3: function(arg0, arg1) {
|
|
2905
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
2906
|
+
return ret;
|
|
2907
|
+
},
|
|
2908
|
+
__wbg_Number_e6ffdb596c888833: function(arg0) {
|
|
2909
|
+
const ret = Number(arg0);
|
|
2910
|
+
return ret;
|
|
2911
|
+
},
|
|
2912
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
2913
|
+
const ret = String(arg1);
|
|
2914
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2915
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2916
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
2917
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
2918
|
+
},
|
|
2919
|
+
__wbg___wbindgen_bigint_get_as_i64_2c5082002e4826e2: function(arg0, arg1) {
|
|
2920
|
+
const v = arg1;
|
|
2921
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
2922
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
2923
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
2924
|
+
},
|
|
2925
|
+
__wbg___wbindgen_boolean_get_a86c216575a75c30: function(arg0) {
|
|
2926
|
+
const v = arg0;
|
|
2927
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
2928
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
2929
|
+
},
|
|
2930
|
+
__wbg___wbindgen_debug_string_dd5d2d07ce9e6c57: function(arg0, arg1) {
|
|
2931
|
+
const ret = debugString(arg1);
|
|
2932
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2933
|
+
const len1 = WASM_VECTOR_LEN;
|
|
2934
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
2935
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
2936
|
+
},
|
|
2937
|
+
__wbg___wbindgen_in_4bd7a57e54337366: function(arg0, arg1) {
|
|
2938
|
+
const ret = arg0 in arg1;
|
|
2939
|
+
return ret;
|
|
2940
|
+
},
|
|
2941
|
+
__wbg___wbindgen_is_bigint_6c98f7e945dacdde: function(arg0) {
|
|
2942
|
+
const ret = typeof(arg0) === 'bigint';
|
|
2943
|
+
return ret;
|
|
2944
|
+
},
|
|
2945
|
+
__wbg___wbindgen_is_function_49868bde5eb1e745: function(arg0) {
|
|
2946
|
+
const ret = typeof(arg0) === 'function';
|
|
2947
|
+
return ret;
|
|
2948
|
+
},
|
|
2949
|
+
__wbg___wbindgen_is_null_344c8750a8525473: function(arg0) {
|
|
2950
|
+
const ret = arg0 === null;
|
|
2951
|
+
return ret;
|
|
2952
|
+
},
|
|
2953
|
+
__wbg___wbindgen_is_object_40c5a80572e8f9d3: function(arg0) {
|
|
2954
|
+
const val = arg0;
|
|
2955
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
2956
|
+
return ret;
|
|
2957
|
+
},
|
|
2958
|
+
__wbg___wbindgen_is_string_b29b5c5a8065ba1a: function(arg0) {
|
|
2959
|
+
const ret = typeof(arg0) === 'string';
|
|
2960
|
+
return ret;
|
|
2961
|
+
},
|
|
2962
|
+
__wbg___wbindgen_is_undefined_c0cca72b82b86f4d: function(arg0) {
|
|
2963
|
+
const ret = arg0 === undefined;
|
|
2964
|
+
return ret;
|
|
2965
|
+
},
|
|
2966
|
+
__wbg___wbindgen_jsval_eq_7d430e744a913d26: function(arg0, arg1) {
|
|
2967
|
+
const ret = arg0 === arg1;
|
|
2968
|
+
return ret;
|
|
2969
|
+
},
|
|
2970
|
+
__wbg___wbindgen_jsval_loose_eq_3a72ae764d46d944: function(arg0, arg1) {
|
|
2971
|
+
const ret = arg0 == arg1;
|
|
2972
|
+
return ret;
|
|
2973
|
+
},
|
|
2974
|
+
__wbg___wbindgen_number_get_7579aab02a8a620c: function(arg0, arg1) {
|
|
2975
|
+
const obj = arg1;
|
|
2976
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
2977
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
2978
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
2979
|
+
},
|
|
2980
|
+
__wbg___wbindgen_string_get_914df97fcfa788f2: function(arg0, arg1) {
|
|
2981
|
+
const obj = arg1;
|
|
2982
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
2983
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
2984
|
+
var len1 = WASM_VECTOR_LEN;
|
|
2985
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
2986
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
2987
|
+
},
|
|
2988
|
+
__wbg___wbindgen_throw_81fc77679af83bc6: function(arg0, arg1) {
|
|
2989
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
2990
|
+
},
|
|
2991
|
+
__wbg__wbg_cb_unref_3c3b4f651835fbcb: function(arg0) {
|
|
2992
|
+
arg0._wbg_cb_unref();
|
|
2993
|
+
},
|
|
2994
|
+
__wbg_call_368fa9c372d473ba: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
2995
|
+
const ret = arg0.call(arg1, arg2, arg3);
|
|
2996
|
+
return ret;
|
|
2997
|
+
}, arguments); },
|
|
2998
|
+
__wbg_call_7f2987183bb62793: function() { return handleError(function (arg0, arg1) {
|
|
2999
|
+
const ret = arg0.call(arg1);
|
|
3000
|
+
return ret;
|
|
3001
|
+
}, arguments); },
|
|
3002
|
+
__wbg_call_d578befcc3145dee: function() { return handleError(function (arg0, arg1, arg2) {
|
|
3003
|
+
const ret = arg0.call(arg1, arg2);
|
|
3004
|
+
return ret;
|
|
3005
|
+
}, arguments); },
|
|
3006
|
+
__wbg_codePointAt_944099a761b59b26: function(arg0, arg1) {
|
|
3007
|
+
const ret = arg0.codePointAt(arg1 >>> 0);
|
|
3008
|
+
return ret;
|
|
3009
|
+
},
|
|
3010
|
+
__wbg_crypto_38df2bab126b63dc: function(arg0) {
|
|
3011
|
+
const ret = arg0.crypto;
|
|
3012
|
+
return ret;
|
|
3013
|
+
},
|
|
3014
|
+
__wbg_done_547d467e97529006: function(arg0) {
|
|
3015
|
+
const ret = arg0.done;
|
|
3016
|
+
return ret;
|
|
3017
|
+
},
|
|
3018
|
+
__wbg_entries_616b1a459b85be0b: function(arg0) {
|
|
3019
|
+
const ret = Object.entries(arg0);
|
|
3020
|
+
return ret;
|
|
3021
|
+
},
|
|
3022
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
3023
|
+
let deferred0_0;
|
|
3024
|
+
let deferred0_1;
|
|
3025
|
+
try {
|
|
3026
|
+
deferred0_0 = arg0;
|
|
3027
|
+
deferred0_1 = arg1;
|
|
3028
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
3029
|
+
} finally {
|
|
3030
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
3031
|
+
}
|
|
3032
|
+
},
|
|
3033
|
+
__wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
|
|
3034
|
+
arg0.getRandomValues(arg1);
|
|
3035
|
+
}, arguments); },
|
|
3036
|
+
__wbg_getTime_f6ac312467f7cf09: function(arg0) {
|
|
3037
|
+
const ret = arg0.getTime();
|
|
3038
|
+
return ret;
|
|
3039
|
+
},
|
|
3040
|
+
__wbg_getTimezoneOffset_ac5be603b21a5797: function(arg0) {
|
|
3041
|
+
const ret = arg0.getTimezoneOffset();
|
|
3042
|
+
return ret;
|
|
3043
|
+
},
|
|
3044
|
+
__wbg_get_4848e350b40afc16: function(arg0, arg1) {
|
|
3045
|
+
const ret = arg0[arg1 >>> 0];
|
|
3046
|
+
return ret;
|
|
3047
|
+
},
|
|
3048
|
+
__wbg_get_ed0642c4b9d31ddf: function() { return handleError(function (arg0, arg1) {
|
|
3049
|
+
const ret = Reflect.get(arg0, arg1);
|
|
3050
|
+
return ret;
|
|
3051
|
+
}, arguments); },
|
|
3052
|
+
__wbg_get_f96702c6245e4ef9: function() { return handleError(function (arg0, arg1) {
|
|
3053
|
+
const ret = Reflect.get(arg0, arg1);
|
|
3054
|
+
return ret;
|
|
3055
|
+
}, arguments); },
|
|
3056
|
+
__wbg_get_unchecked_7d7babe32e9e6a54: function(arg0, arg1) {
|
|
3057
|
+
const ret = arg0[arg1 >>> 0];
|
|
3058
|
+
return ret;
|
|
3059
|
+
},
|
|
3060
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
3061
|
+
const ret = arg0[arg1];
|
|
3062
|
+
return ret;
|
|
3063
|
+
},
|
|
3064
|
+
__wbg_hasOwnProperty_ab99d709c7d2c3f6: function(arg0, arg1) {
|
|
3065
|
+
const ret = arg0.hasOwnProperty(arg1);
|
|
3066
|
+
return ret;
|
|
3067
|
+
},
|
|
3068
|
+
__wbg_instanceof_ArrayBuffer_ff7c1337a5e3b33a: function(arg0) {
|
|
3069
|
+
let result;
|
|
3070
|
+
try {
|
|
3071
|
+
result = arg0 instanceof ArrayBuffer;
|
|
3072
|
+
} catch (_) {
|
|
3073
|
+
result = false;
|
|
3074
|
+
}
|
|
3075
|
+
const ret = result;
|
|
3076
|
+
return ret;
|
|
3077
|
+
},
|
|
3078
|
+
__wbg_instanceof_Error_e3390d6805733dad: function(arg0) {
|
|
3079
|
+
let result;
|
|
3080
|
+
try {
|
|
3081
|
+
result = arg0 instanceof Error;
|
|
3082
|
+
} catch (_) {
|
|
3083
|
+
result = false;
|
|
3084
|
+
}
|
|
3085
|
+
const ret = result;
|
|
3086
|
+
return ret;
|
|
3087
|
+
},
|
|
3088
|
+
__wbg_instanceof_Map_a10a2795ef4bfe97: function(arg0) {
|
|
3089
|
+
let result;
|
|
3090
|
+
try {
|
|
3091
|
+
result = arg0 instanceof Map;
|
|
3092
|
+
} catch (_) {
|
|
3093
|
+
result = false;
|
|
3094
|
+
}
|
|
3095
|
+
const ret = result;
|
|
3096
|
+
return ret;
|
|
3097
|
+
},
|
|
3098
|
+
__wbg_instanceof_Uint8Array_4b8da683deb25d72: function(arg0) {
|
|
3099
|
+
let result;
|
|
3100
|
+
try {
|
|
3101
|
+
result = arg0 instanceof Uint8Array;
|
|
3102
|
+
} catch (_) {
|
|
3103
|
+
result = false;
|
|
3104
|
+
}
|
|
3105
|
+
const ret = result;
|
|
3106
|
+
return ret;
|
|
3107
|
+
},
|
|
3108
|
+
__wbg_isArray_db61795ad004c139: function(arg0) {
|
|
3109
|
+
const ret = Array.isArray(arg0);
|
|
3110
|
+
return ret;
|
|
3111
|
+
},
|
|
3112
|
+
__wbg_isSafeInteger_ea83862ba994770c: function(arg0) {
|
|
3113
|
+
const ret = Number.isSafeInteger(arg0);
|
|
3114
|
+
return ret;
|
|
3115
|
+
},
|
|
3116
|
+
__wbg_iterator_de403ef31815a3e6: function() {
|
|
3117
|
+
const ret = Symbol.iterator;
|
|
3118
|
+
return ret;
|
|
3119
|
+
},
|
|
3120
|
+
__wbg_length_0c32cb8543c8e4c8: function(arg0) {
|
|
3121
|
+
const ret = arg0.length;
|
|
3122
|
+
return ret;
|
|
3123
|
+
},
|
|
3124
|
+
__wbg_length_1e701798fdcaa3b4: function(arg0) {
|
|
3125
|
+
const ret = arg0.length;
|
|
3126
|
+
return ret;
|
|
3127
|
+
},
|
|
3128
|
+
__wbg_length_269224948362b9bf: function(arg0) {
|
|
3129
|
+
const ret = arg0.length;
|
|
3130
|
+
return ret;
|
|
3131
|
+
},
|
|
3132
|
+
__wbg_length_6e821edde497a532: function(arg0) {
|
|
3133
|
+
const ret = arg0.length;
|
|
3134
|
+
return ret;
|
|
3135
|
+
},
|
|
3136
|
+
__wbg_message_7367f8c7d0fa1589: function(arg0) {
|
|
3137
|
+
const ret = arg0.message;
|
|
3138
|
+
return ret;
|
|
3139
|
+
},
|
|
3140
|
+
__wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
|
|
3141
|
+
const ret = arg0.msCrypto;
|
|
3142
|
+
return ret;
|
|
3143
|
+
},
|
|
3144
|
+
__wbg_new_0_bfa2ef4bc447daa2: function() {
|
|
3145
|
+
const ret = new Date();
|
|
3146
|
+
return ret;
|
|
3147
|
+
},
|
|
3148
|
+
__wbg_new_0f6d2ddfe083319b: function(arg0) {
|
|
3149
|
+
const ret = new Date(arg0);
|
|
3150
|
+
return ret;
|
|
3151
|
+
},
|
|
3152
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
3153
|
+
const ret = new Error();
|
|
3154
|
+
return ret;
|
|
3155
|
+
},
|
|
3156
|
+
__wbg_new_4f9fafbb3909af72: function() {
|
|
3157
|
+
const ret = new Object();
|
|
3158
|
+
return ret;
|
|
3159
|
+
},
|
|
3160
|
+
__wbg_new_99cabae501c0a8a0: function() {
|
|
3161
|
+
const ret = new Map();
|
|
3162
|
+
return ret;
|
|
3163
|
+
},
|
|
3164
|
+
__wbg_new_a560378ea1240b14: function(arg0) {
|
|
3165
|
+
const ret = new Uint8Array(arg0);
|
|
3166
|
+
return ret;
|
|
3167
|
+
},
|
|
3168
|
+
__wbg_new_e3b04b4d53d1b593: function(arg0, arg1) {
|
|
3169
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
3170
|
+
return ret;
|
|
3171
|
+
},
|
|
3172
|
+
__wbg_new_f3c9df4f38f3f798: function() {
|
|
3173
|
+
const ret = new Array();
|
|
3174
|
+
return ret;
|
|
3175
|
+
},
|
|
3176
|
+
__wbg_new_with_length_41a22191b9bdfd66: function(arg0) {
|
|
3177
|
+
const ret = new Uint32Array(arg0 >>> 0);
|
|
3178
|
+
return ret;
|
|
3179
|
+
},
|
|
3180
|
+
__wbg_new_with_length_9cedd08484b73942: function(arg0) {
|
|
3181
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
3182
|
+
return ret;
|
|
3183
|
+
},
|
|
3184
|
+
__wbg_next_01132ed6134b8ef5: function(arg0) {
|
|
3185
|
+
const ret = arg0.next;
|
|
3186
|
+
return ret;
|
|
3187
|
+
},
|
|
3188
|
+
__wbg_next_b3713ec761a9dbfd: function() { return handleError(function (arg0) {
|
|
3189
|
+
const ret = arg0.next();
|
|
3190
|
+
return ret;
|
|
3191
|
+
}, arguments); },
|
|
3192
|
+
__wbg_node_84ea875411254db1: function(arg0) {
|
|
3193
|
+
const ret = arg0.node;
|
|
3194
|
+
return ret;
|
|
3195
|
+
},
|
|
3196
|
+
__wbg_now_88621c9c9a4f3ffc: function() {
|
|
3197
|
+
const ret = Date.now();
|
|
3198
|
+
return ret;
|
|
3199
|
+
},
|
|
3200
|
+
__wbg_process_44c7a14e11e9f69e: function(arg0) {
|
|
3201
|
+
const ret = arg0.process;
|
|
3202
|
+
return ret;
|
|
3203
|
+
},
|
|
3204
|
+
__wbg_prototypesetcall_3e05eb9545565046: function(arg0, arg1, arg2) {
|
|
3205
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
3206
|
+
},
|
|
3207
|
+
__wbg_push_6bdbc990be5ac37b: function(arg0, arg1) {
|
|
3208
|
+
const ret = arg0.push(arg1);
|
|
3209
|
+
return ret;
|
|
3210
|
+
},
|
|
3211
|
+
__wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
|
|
3212
|
+
arg0.randomFillSync(arg1);
|
|
3213
|
+
}, arguments); },
|
|
3214
|
+
__wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
|
|
3215
|
+
const ret = module.require;
|
|
3216
|
+
return ret;
|
|
3217
|
+
}, arguments); },
|
|
3218
|
+
__wbg_set_08463b1df38a7e29: function(arg0, arg1, arg2) {
|
|
3219
|
+
const ret = arg0.set(arg1, arg2);
|
|
3220
|
+
return ret;
|
|
3221
|
+
},
|
|
3222
|
+
__wbg_set_448126769bf7c181: function(arg0, arg1, arg2) {
|
|
3223
|
+
arg0.set(getArrayU32FromWasm0(arg1, arg2));
|
|
3224
|
+
},
|
|
3225
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
3226
|
+
arg0[arg1] = arg2;
|
|
3227
|
+
},
|
|
3228
|
+
__wbg_set_6c60b2e8ad0e9383: function(arg0, arg1, arg2) {
|
|
3229
|
+
arg0[arg1 >>> 0] = arg2;
|
|
3230
|
+
},
|
|
3231
|
+
__wbg_set_8ee2d34facb8466e: function() { return handleError(function (arg0, arg1, arg2) {
|
|
3232
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
3233
|
+
return ret;
|
|
3234
|
+
}, arguments); },
|
|
3235
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
3236
|
+
const ret = arg1.stack;
|
|
3237
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3238
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3239
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
3240
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
3241
|
+
},
|
|
3242
|
+
__wbg_static_accessor_GLOBAL_THIS_a1248013d790bf5f: function() {
|
|
3243
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
3244
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
3245
|
+
},
|
|
3246
|
+
__wbg_static_accessor_GLOBAL_f2e0f995a21329ff: function() {
|
|
3247
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
3248
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
3249
|
+
},
|
|
3250
|
+
__wbg_static_accessor_SELF_24f78b6d23f286ea: function() {
|
|
3251
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
3252
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
3253
|
+
},
|
|
3254
|
+
__wbg_static_accessor_WINDOW_59fd959c540fe405: function() {
|
|
3255
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
3256
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
3257
|
+
},
|
|
3258
|
+
__wbg_subarray_0f98d3fb634508ad: function(arg0, arg1, arg2) {
|
|
3259
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
3260
|
+
return ret;
|
|
3261
|
+
},
|
|
3262
|
+
__wbg_value_7f6052747ccf940f: function(arg0) {
|
|
3263
|
+
const ret = arg0.value;
|
|
3264
|
+
return ret;
|
|
3265
|
+
},
|
|
3266
|
+
__wbg_versions_276b2795b1c6a219: function(arg0) {
|
|
3267
|
+
const ret = arg0.versions;
|
|
3268
|
+
return ret;
|
|
3269
|
+
},
|
|
3270
|
+
__wbg_warn_2b0a27f629a4bb1e: function(arg0) {
|
|
3271
|
+
console.warn(arg0);
|
|
3272
|
+
},
|
|
3273
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
3274
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 250, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
3275
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_5b6c97e6ee3f690b___convert__closures_____invoke_______true_);
|
|
3276
|
+
return ret;
|
|
3277
|
+
},
|
|
3278
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
3279
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
3280
|
+
const ret = arg0;
|
|
3281
|
+
return ret;
|
|
3282
|
+
},
|
|
3283
|
+
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
3284
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
3285
|
+
const ret = arg0;
|
|
3286
|
+
return ret;
|
|
3287
|
+
},
|
|
3288
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
3289
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
3290
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
3291
|
+
return ret;
|
|
3292
|
+
},
|
|
3293
|
+
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
3294
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
3295
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
3296
|
+
return ret;
|
|
3297
|
+
},
|
|
3298
|
+
__wbindgen_cast_0000000000000006: function(arg0) {
|
|
3299
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
3300
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
3301
|
+
return ret;
|
|
3302
|
+
},
|
|
3303
|
+
__wbindgen_init_externref_table: function() {
|
|
3304
|
+
const table = wasm.__wbindgen_externrefs;
|
|
3305
|
+
const offset = table.grow(4);
|
|
3306
|
+
table.set(0, undefined);
|
|
3307
|
+
table.set(offset + 0, undefined);
|
|
3308
|
+
table.set(offset + 1, null);
|
|
3309
|
+
table.set(offset + 2, true);
|
|
3310
|
+
table.set(offset + 3, false);
|
|
3311
|
+
},
|
|
3312
|
+
};
|
|
3313
|
+
return {
|
|
3314
|
+
__proto__: null,
|
|
3315
|
+
"./einfach_wasm_bg.js": import0,
|
|
3316
|
+
};
|
|
3317
|
+
}
|
|
3318
|
+
|
|
3319
|
+
function wasm_bindgen_5b6c97e6ee3f690b___convert__closures_____invoke_______true_(arg0, arg1) {
|
|
3320
|
+
wasm.wasm_bindgen_5b6c97e6ee3f690b___convert__closures_____invoke_______true_(arg0, arg1);
|
|
3321
|
+
}
|
|
3322
|
+
|
|
3323
|
+
const WasmSheetFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3324
|
+
? { register: () => {}, unregister: () => {} }
|
|
3325
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmsheet_free(ptr >>> 0, 1));
|
|
3326
|
+
const WasmWorkbookFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3327
|
+
? { register: () => {}, unregister: () => {} }
|
|
3328
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmworkbook_free(ptr >>> 0, 1));
|
|
3329
|
+
|
|
3330
|
+
function addToExternrefTable0(obj) {
|
|
3331
|
+
const idx = wasm.__externref_table_alloc();
|
|
3332
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
3333
|
+
return idx;
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
3337
|
+
? { register: () => {}, unregister: () => {} }
|
|
3338
|
+
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
|
|
3339
|
+
|
|
3340
|
+
function debugString(val) {
|
|
3341
|
+
// primitive types
|
|
3342
|
+
const type = typeof val;
|
|
3343
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
3344
|
+
return `${val}`;
|
|
3345
|
+
}
|
|
3346
|
+
if (type == 'string') {
|
|
3347
|
+
return `"${val}"`;
|
|
3348
|
+
}
|
|
3349
|
+
if (type == 'symbol') {
|
|
3350
|
+
const description = val.description;
|
|
3351
|
+
if (description == null) {
|
|
3352
|
+
return 'Symbol';
|
|
3353
|
+
} else {
|
|
3354
|
+
return `Symbol(${description})`;
|
|
3355
|
+
}
|
|
3356
|
+
}
|
|
3357
|
+
if (type == 'function') {
|
|
3358
|
+
const name = val.name;
|
|
3359
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
3360
|
+
return `Function(${name})`;
|
|
3361
|
+
} else {
|
|
3362
|
+
return 'Function';
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
// objects
|
|
3366
|
+
if (Array.isArray(val)) {
|
|
3367
|
+
const length = val.length;
|
|
3368
|
+
let debug = '[';
|
|
3369
|
+
if (length > 0) {
|
|
3370
|
+
debug += debugString(val[0]);
|
|
3371
|
+
}
|
|
3372
|
+
for(let i = 1; i < length; i++) {
|
|
3373
|
+
debug += ', ' + debugString(val[i]);
|
|
3374
|
+
}
|
|
3375
|
+
debug += ']';
|
|
3376
|
+
return debug;
|
|
3377
|
+
}
|
|
3378
|
+
// Test for built-in
|
|
3379
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
3380
|
+
let className;
|
|
3381
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
3382
|
+
className = builtInMatches[1];
|
|
3383
|
+
} else {
|
|
3384
|
+
// Failed to match the standard '[object ClassName]'
|
|
3385
|
+
return toString.call(val);
|
|
3386
|
+
}
|
|
3387
|
+
if (className == 'Object') {
|
|
3388
|
+
// we're a user defined class or Object
|
|
3389
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
3390
|
+
// easier than looping through ownProperties of `val`.
|
|
3391
|
+
try {
|
|
3392
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
3393
|
+
} catch (_) {
|
|
3394
|
+
return 'Object';
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
3397
|
+
// errors
|
|
3398
|
+
if (val instanceof Error) {
|
|
3399
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
3400
|
+
}
|
|
3401
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
3402
|
+
return className;
|
|
3403
|
+
}
|
|
3404
|
+
|
|
3405
|
+
function getArrayF64FromWasm0(ptr, len) {
|
|
3406
|
+
ptr = ptr >>> 0;
|
|
3407
|
+
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
3408
|
+
}
|
|
3409
|
+
|
|
3410
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
3411
|
+
ptr = ptr >>> 0;
|
|
3412
|
+
const mem = getDataViewMemory0();
|
|
3413
|
+
const result = [];
|
|
3414
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
3415
|
+
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
3416
|
+
}
|
|
3417
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
3418
|
+
return result;
|
|
3419
|
+
}
|
|
3420
|
+
|
|
3421
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
3422
|
+
ptr = ptr >>> 0;
|
|
3423
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3426
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
3427
|
+
ptr = ptr >>> 0;
|
|
3428
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
let cachedDataViewMemory0 = null;
|
|
3432
|
+
function getDataViewMemory0() {
|
|
3433
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
3434
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
3435
|
+
}
|
|
3436
|
+
return cachedDataViewMemory0;
|
|
3437
|
+
}
|
|
3438
|
+
|
|
3439
|
+
let cachedFloat64ArrayMemory0 = null;
|
|
3440
|
+
function getFloat64ArrayMemory0() {
|
|
3441
|
+
if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
|
|
3442
|
+
cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
|
|
3443
|
+
}
|
|
3444
|
+
return cachedFloat64ArrayMemory0;
|
|
3445
|
+
}
|
|
3446
|
+
|
|
3447
|
+
function getStringFromWasm0(ptr, len) {
|
|
3448
|
+
ptr = ptr >>> 0;
|
|
3449
|
+
return decodeText(ptr, len);
|
|
3450
|
+
}
|
|
3451
|
+
|
|
3452
|
+
let cachedUint32ArrayMemory0 = null;
|
|
3453
|
+
function getUint32ArrayMemory0() {
|
|
3454
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
3455
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
3456
|
+
}
|
|
3457
|
+
return cachedUint32ArrayMemory0;
|
|
3458
|
+
}
|
|
3459
|
+
|
|
3460
|
+
let cachedUint8ArrayMemory0 = null;
|
|
3461
|
+
function getUint8ArrayMemory0() {
|
|
3462
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
3463
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
3464
|
+
}
|
|
3465
|
+
return cachedUint8ArrayMemory0;
|
|
3466
|
+
}
|
|
3467
|
+
|
|
3468
|
+
function handleError(f, args) {
|
|
3469
|
+
try {
|
|
3470
|
+
return f.apply(this, args);
|
|
3471
|
+
} catch (e) {
|
|
3472
|
+
const idx = addToExternrefTable0(e);
|
|
3473
|
+
wasm.__wbindgen_exn_store(idx);
|
|
3474
|
+
}
|
|
3475
|
+
}
|
|
3476
|
+
|
|
3477
|
+
function isLikeNone(x) {
|
|
3478
|
+
return x === undefined || x === null;
|
|
3479
|
+
}
|
|
3480
|
+
|
|
3481
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
3482
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
3483
|
+
const real = (...args) => {
|
|
3484
|
+
|
|
3485
|
+
// First up with a closure we increment the internal reference
|
|
3486
|
+
// count. This ensures that the Rust closure environment won't
|
|
3487
|
+
// be deallocated while we're invoking it.
|
|
3488
|
+
state.cnt++;
|
|
3489
|
+
const a = state.a;
|
|
3490
|
+
state.a = 0;
|
|
3491
|
+
try {
|
|
3492
|
+
return f(a, state.b, ...args);
|
|
3493
|
+
} finally {
|
|
3494
|
+
state.a = a;
|
|
3495
|
+
real._wbg_cb_unref();
|
|
3496
|
+
}
|
|
3497
|
+
};
|
|
3498
|
+
real._wbg_cb_unref = () => {
|
|
3499
|
+
if (--state.cnt === 0) {
|
|
3500
|
+
wasm.__wbindgen_destroy_closure(state.a, state.b);
|
|
3501
|
+
state.a = 0;
|
|
3502
|
+
CLOSURE_DTORS.unregister(state);
|
|
3503
|
+
}
|
|
3504
|
+
};
|
|
3505
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
3506
|
+
return real;
|
|
3507
|
+
}
|
|
3508
|
+
|
|
3509
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
3510
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
3511
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
3512
|
+
WASM_VECTOR_LEN = arg.length;
|
|
3513
|
+
return ptr;
|
|
3514
|
+
}
|
|
3515
|
+
|
|
3516
|
+
function passArrayF64ToWasm0(arg, malloc) {
|
|
3517
|
+
const ptr = malloc(arg.length * 8, 8) >>> 0;
|
|
3518
|
+
getFloat64ArrayMemory0().set(arg, ptr / 8);
|
|
3519
|
+
WASM_VECTOR_LEN = arg.length;
|
|
3520
|
+
return ptr;
|
|
3521
|
+
}
|
|
3522
|
+
|
|
3523
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
3524
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
3525
|
+
for (let i = 0; i < array.length; i++) {
|
|
3526
|
+
const add = addToExternrefTable0(array[i]);
|
|
3527
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
3528
|
+
}
|
|
3529
|
+
WASM_VECTOR_LEN = array.length;
|
|
3530
|
+
return ptr;
|
|
3531
|
+
}
|
|
3532
|
+
|
|
3533
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
3534
|
+
if (realloc === undefined) {
|
|
3535
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
3536
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
3537
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
3538
|
+
WASM_VECTOR_LEN = buf.length;
|
|
3539
|
+
return ptr;
|
|
3540
|
+
}
|
|
3541
|
+
|
|
3542
|
+
let len = arg.length;
|
|
3543
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
3544
|
+
|
|
3545
|
+
const mem = getUint8ArrayMemory0();
|
|
3546
|
+
|
|
3547
|
+
let offset = 0;
|
|
3548
|
+
|
|
3549
|
+
for (; offset < len; offset++) {
|
|
3550
|
+
const code = arg.charCodeAt(offset);
|
|
3551
|
+
if (code > 0x7F) break;
|
|
3552
|
+
mem[ptr + offset] = code;
|
|
3553
|
+
}
|
|
3554
|
+
if (offset !== len) {
|
|
3555
|
+
if (offset !== 0) {
|
|
3556
|
+
arg = arg.slice(offset);
|
|
3557
|
+
}
|
|
3558
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
3559
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
3560
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
3561
|
+
|
|
3562
|
+
offset += ret.written;
|
|
3563
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
3564
|
+
}
|
|
3565
|
+
|
|
3566
|
+
WASM_VECTOR_LEN = offset;
|
|
3567
|
+
return ptr;
|
|
3568
|
+
}
|
|
3569
|
+
|
|
3570
|
+
function takeFromExternrefTable0(idx) {
|
|
3571
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
3572
|
+
wasm.__externref_table_dealloc(idx);
|
|
3573
|
+
return value;
|
|
3574
|
+
}
|
|
3575
|
+
|
|
3576
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
3577
|
+
cachedTextDecoder.decode();
|
|
3578
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
3579
|
+
let numBytesDecoded = 0;
|
|
3580
|
+
function decodeText(ptr, len) {
|
|
3581
|
+
numBytesDecoded += len;
|
|
3582
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
3583
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
3584
|
+
cachedTextDecoder.decode();
|
|
3585
|
+
numBytesDecoded = len;
|
|
3586
|
+
}
|
|
3587
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
3588
|
+
}
|
|
3589
|
+
|
|
3590
|
+
const cachedTextEncoder = new TextEncoder();
|
|
3591
|
+
|
|
3592
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
3593
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
3594
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
3595
|
+
view.set(buf);
|
|
3596
|
+
return {
|
|
3597
|
+
read: arg.length,
|
|
3598
|
+
written: buf.length
|
|
3599
|
+
};
|
|
3600
|
+
};
|
|
3601
|
+
}
|
|
3602
|
+
|
|
3603
|
+
let WASM_VECTOR_LEN = 0;
|
|
3604
|
+
|
|
3605
|
+
let wasmModule, wasm;
|
|
3606
|
+
function __wbg_finalize_init(instance, module) {
|
|
3607
|
+
wasm = instance.exports;
|
|
3608
|
+
wasmModule = module;
|
|
3609
|
+
cachedDataViewMemory0 = null;
|
|
3610
|
+
cachedFloat64ArrayMemory0 = null;
|
|
3611
|
+
cachedUint32ArrayMemory0 = null;
|
|
3612
|
+
cachedUint8ArrayMemory0 = null;
|
|
3613
|
+
wasm.__wbindgen_start();
|
|
3614
|
+
return wasm;
|
|
3615
|
+
}
|
|
3616
|
+
|
|
3617
|
+
async function __wbg_load(module, imports) {
|
|
3618
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
3619
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
3620
|
+
try {
|
|
3621
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
3622
|
+
} catch (e) {
|
|
3623
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
3624
|
+
|
|
3625
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
3626
|
+
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);
|
|
3627
|
+
|
|
3628
|
+
} else { throw e; }
|
|
3629
|
+
}
|
|
3630
|
+
}
|
|
3631
|
+
|
|
3632
|
+
const bytes = await module.arrayBuffer();
|
|
3633
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
3634
|
+
} else {
|
|
3635
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
3636
|
+
|
|
3637
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
3638
|
+
return { instance, module };
|
|
3639
|
+
} else {
|
|
3640
|
+
return instance;
|
|
3641
|
+
}
|
|
3642
|
+
}
|
|
3643
|
+
|
|
3644
|
+
function expectedResponseType(type) {
|
|
3645
|
+
switch (type) {
|
|
3646
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
3647
|
+
}
|
|
3648
|
+
return false;
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3651
|
+
|
|
3652
|
+
function initSync(module) {
|
|
3653
|
+
if (wasm !== undefined) return wasm;
|
|
3654
|
+
|
|
3655
|
+
|
|
3656
|
+
if (module !== undefined) {
|
|
3657
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
3658
|
+
({module} = module)
|
|
3659
|
+
} else {
|
|
3660
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
3661
|
+
}
|
|
3662
|
+
}
|
|
3663
|
+
|
|
3664
|
+
const imports = __wbg_get_imports();
|
|
3665
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
3666
|
+
module = new WebAssembly.Module(module);
|
|
3667
|
+
}
|
|
3668
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
3669
|
+
return __wbg_finalize_init(instance, module);
|
|
3670
|
+
}
|
|
3671
|
+
|
|
3672
|
+
async function __wbg_init(module_or_path) {
|
|
3673
|
+
if (wasm !== undefined) return wasm;
|
|
3674
|
+
|
|
3675
|
+
|
|
3676
|
+
if (module_or_path !== undefined) {
|
|
3677
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
3678
|
+
({module_or_path} = module_or_path)
|
|
3679
|
+
} else {
|
|
3680
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
3681
|
+
}
|
|
3682
|
+
}
|
|
3683
|
+
|
|
3684
|
+
if (module_or_path === undefined) {
|
|
3685
|
+
module_or_path = new URL('einfach_wasm_bg.wasm', import.meta.url);
|
|
3686
|
+
}
|
|
3687
|
+
const imports = __wbg_get_imports();
|
|
3688
|
+
|
|
3689
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
3690
|
+
module_or_path = fetch(module_or_path);
|
|
3691
|
+
}
|
|
3692
|
+
|
|
3693
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
3694
|
+
|
|
3695
|
+
return __wbg_finalize_init(instance, module);
|
|
3696
|
+
}
|
|
3697
|
+
|
|
3698
|
+
export { initSync, __wbg_init as default };
|