@fossil-lang/wasm 0.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -0
- package/dist/index.d.ts +246 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +201 -0
- package/dist/index.js.map +1 -0
- package/dist/load.d.ts +30 -0
- package/dist/load.d.ts.map +1 -0
- package/dist/load.js +33 -0
- package/dist/load.js.map +1 -0
- package/package.json +49 -0
- package/pkg/fossil_wasm.d.ts +284 -0
- package/pkg/fossil_wasm.js +976 -0
- package/pkg/fossil_wasm_bg.wasm +0 -0
- package/pkg/fossil_wasm_bg.wasm.d.ts +27 -0
|
@@ -0,0 +1,976 @@
|
|
|
1
|
+
/* @ts-self-types="./fossil_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Opaque handle the JS side keys on. Plain `u32` newtype; NOT the Salsa
|
|
5
|
+
* interned id (which doesn't cross the JS boundary).
|
|
6
|
+
*
|
|
7
|
+
* `Copy + Clone + Eq + Hash` so it can be a `HashMap` key on the Rust
|
|
8
|
+
* side; `#[wasm_bindgen]` so JS can pass it back across the boundary.
|
|
9
|
+
*/
|
|
10
|
+
export class FileHandle {
|
|
11
|
+
static __wrap(ptr) {
|
|
12
|
+
const obj = Object.create(FileHandle.prototype);
|
|
13
|
+
obj.__wbg_ptr = ptr;
|
|
14
|
+
FileHandleFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
15
|
+
return obj;
|
|
16
|
+
}
|
|
17
|
+
__destroy_into_raw() {
|
|
18
|
+
const ptr = this.__wbg_ptr;
|
|
19
|
+
this.__wbg_ptr = 0;
|
|
20
|
+
FileHandleFinalization.unregister(this);
|
|
21
|
+
return ptr;
|
|
22
|
+
}
|
|
23
|
+
free() {
|
|
24
|
+
const ptr = this.__destroy_into_raw();
|
|
25
|
+
wasm.__wbg_filehandle_free(ptr, 0);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (Symbol.dispose) FileHandle.prototype[Symbol.dispose] = FileHandle.prototype.free;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* JS-facing handle for the Fossil compiler running inside a WASM module.
|
|
32
|
+
*
|
|
33
|
+
* One instance owns one [`WasmDb`] (Salsa store + injected [`WasmSystem`]
|
|
34
|
+
* + `Arc<OutputDescriptorKind>`). Hosts construct a single playground per
|
|
35
|
+
* browser tab / Node process and reuse it across all method calls to
|
|
36
|
+
* amortise the Salsa interning + memoisation overhead.
|
|
37
|
+
*/
|
|
38
|
+
export class FossilPlayground {
|
|
39
|
+
__destroy_into_raw() {
|
|
40
|
+
const ptr = this.__wbg_ptr;
|
|
41
|
+
this.__wbg_ptr = 0;
|
|
42
|
+
FossilPlaygroundFinalization.unregister(this);
|
|
43
|
+
return ptr;
|
|
44
|
+
}
|
|
45
|
+
free() {
|
|
46
|
+
const ptr = this.__destroy_into_raw();
|
|
47
|
+
wasm.__wbg_fossilplayground_free(ptr, 0);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Run `parse → def_map → typecheck_mapping` across every open file and
|
|
51
|
+
* return a flat JS array of `{ uri, range, severity, message }` rows
|
|
52
|
+
* keyed by file URI. The LSP Worker (07-03) republishes these grouped
|
|
53
|
+
* by URI as `textDocument/publishDiagnostics` notifications.
|
|
54
|
+
*
|
|
55
|
+
* `range` is the UTF-16 LSP range (via `fossil_ide::LineIndex` — the
|
|
56
|
+
* rust-analyzer model from 06-05). `severity` is the LSP integer
|
|
57
|
+
* constant (1 = error, 2 = warning, 3 = info). `message` carries any
|
|
58
|
+
* `suggestion_source` as a `\nhelp: ...` suffix (mirroring `fossil-lsp`
|
|
59
|
+
* `to_lsp_diagnostic` in 06-09).
|
|
60
|
+
*
|
|
61
|
+
* # Errors
|
|
62
|
+
*
|
|
63
|
+
* Returns a JS error only if the result fails to serialize to `JsValue`.
|
|
64
|
+
* @returns {any}
|
|
65
|
+
*/
|
|
66
|
+
check() {
|
|
67
|
+
const ret = wasm.fossilplayground_check(this.__wbg_ptr);
|
|
68
|
+
if (ret[2]) {
|
|
69
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
70
|
+
}
|
|
71
|
+
return takeFromExternrefTable0(ret[0]);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Return the stdlib classification manifest as a JS array of
|
|
75
|
+
* `{ name, wasm_class }` objects (STDL-07).
|
|
76
|
+
*
|
|
77
|
+
* `wasm_class` is the string `"pure_sql"` or `"native_udf_only"`. The
|
|
78
|
+
* playground reads this once at startup to render `native_udf_only`
|
|
79
|
+
* functions as disabled with a "native-only — unavailable in the browser"
|
|
80
|
+
* tooltip (SC#1 playground half). `DuckDB`-WASM cannot register the Rust
|
|
81
|
+
* UDFs those functions need (Pitfall 3), so the classification is the
|
|
82
|
+
* authority on what is runnable in-browser.
|
|
83
|
+
*
|
|
84
|
+
* This is pure read-only data projected from the `&'static`-ready
|
|
85
|
+
* `fossil_registry::FunctionRegistry` — no `DuckDB`, no native UDF code,
|
|
86
|
+
* WASM-clean.
|
|
87
|
+
*
|
|
88
|
+
* # Errors
|
|
89
|
+
*
|
|
90
|
+
* Returns a JS error only if the manifest fails to serialize to `JsValue`.
|
|
91
|
+
* @returns {any}
|
|
92
|
+
*/
|
|
93
|
+
classification() {
|
|
94
|
+
const ret = wasm.fossilplayground_classification(this.__wbg_ptr);
|
|
95
|
+
if (ret[2]) {
|
|
96
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
97
|
+
}
|
|
98
|
+
return takeFromExternrefTable0(ret[0]);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Close a file in the workspace. Idempotent in spirit but strict in
|
|
102
|
+
* signal: closing an unknown / already-closed handle is an error so
|
|
103
|
+
* JS-side bugs surface loudly (mirrors `ty_wasm`).
|
|
104
|
+
*
|
|
105
|
+
* # Errors
|
|
106
|
+
*
|
|
107
|
+
* Returns a JS error if `handle` was never opened or was already closed.
|
|
108
|
+
* @param {FileHandle} handle
|
|
109
|
+
*/
|
|
110
|
+
close_file(handle) {
|
|
111
|
+
_assertClass(handle, FileHandle);
|
|
112
|
+
var ptr0 = handle.__destroy_into_raw();
|
|
113
|
+
const ret = wasm.fossilplayground_close_file(this.__wbg_ptr, ptr0);
|
|
114
|
+
if (ret[1]) {
|
|
115
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Per-file diagnostic drain — the B3 follow-up accessor the LSP Worker
|
|
120
|
+
* (07-03) consumes for its per-file `publishDiagnostics` notifications.
|
|
121
|
+
* `check()` returns the workspace-wide flat array; `diagnostics_for`
|
|
122
|
+
* returns just one file's rows so 07-03 can dispatch one notification
|
|
123
|
+
* per affected URI without partitioning the workspace array on the JS
|
|
124
|
+
* side.
|
|
125
|
+
*
|
|
126
|
+
* # Errors
|
|
127
|
+
*
|
|
128
|
+
* Returns a JS error if `handle` is unknown, or if serialization fails.
|
|
129
|
+
* @param {FileHandle} handle
|
|
130
|
+
* @returns {any}
|
|
131
|
+
*/
|
|
132
|
+
diagnostics_for(handle) {
|
|
133
|
+
_assertClass(handle, FileHandle);
|
|
134
|
+
var ptr0 = handle.__destroy_into_raw();
|
|
135
|
+
const ret = wasm.fossilplayground_diagnostics_for(this.__wbg_ptr, ptr0);
|
|
136
|
+
if (ret[2]) {
|
|
137
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
138
|
+
}
|
|
139
|
+
return takeFromExternrefTable0(ret[0]);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Construct a new playground.
|
|
143
|
+
*
|
|
144
|
+
* Installs `console_error_panic_hook` (idempotent — RESEARCH.md
|
|
145
|
+
* Don't-Hand-Roll #8) so any panic inside compiler-core surfaces as a
|
|
146
|
+
* `console.error` stack trace in the host (browser `DevTools` or Node).
|
|
147
|
+
*/
|
|
148
|
+
constructor() {
|
|
149
|
+
const ret = wasm.fossilplayground_new();
|
|
150
|
+
this.__wbg_ptr = ret;
|
|
151
|
+
FossilPlaygroundFinalization.register(this, this.__wbg_ptr, this);
|
|
152
|
+
return this;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Open a file in the workspace. Returns a [`FileHandle`] the JS side
|
|
156
|
+
* keys subsequent `update_file` / `close_file` / `compile_file` calls
|
|
157
|
+
* on. `path` is the URI / virtual path the diagnostics carry back to
|
|
158
|
+
* the LSP client.
|
|
159
|
+
*
|
|
160
|
+
* Mirrors `ty_wasm::Workspace::open_file` (Astral). Interns a fresh
|
|
161
|
+
* [`fossil_base::SourceFile`] under the current Salsa revision.
|
|
162
|
+
*
|
|
163
|
+
* # Errors
|
|
164
|
+
*
|
|
165
|
+
* Returns a JS error only if the internal counter is exhausted
|
|
166
|
+
* (`u32::MAX` files — would require a runaway loop in JS, not a normal
|
|
167
|
+
* failure mode).
|
|
168
|
+
* @param {string} path
|
|
169
|
+
* @param {string} contents
|
|
170
|
+
* @returns {FileHandle}
|
|
171
|
+
*/
|
|
172
|
+
open_file(path, contents) {
|
|
173
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
174
|
+
const len0 = WASM_VECTOR_LEN;
|
|
175
|
+
const ptr1 = passStringToWasm0(contents, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
176
|
+
const len1 = WASM_VECTOR_LEN;
|
|
177
|
+
const ret = wasm.fossilplayground_open_file(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
178
|
+
if (ret[2]) {
|
|
179
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
180
|
+
}
|
|
181
|
+
return FileHandle.__wrap(ret[0]);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Register an [`fossil_descriptors_input::InferredDescriptor`] for a
|
|
185
|
+
* source binding name BEFORE invoking [`Self::compile`] /
|
|
186
|
+
* [`Self::compile_file`]. The Rust compiler reads from this registration
|
|
187
|
+
* during forward type propagation (Phase 3 CORE-05 rewired in plan
|
|
188
|
+
* 13-02).
|
|
189
|
+
*
|
|
190
|
+
* `descriptor_json` is the JSON serialisation of `InferredDescriptor`;
|
|
191
|
+
* the canonical shape is exposed in `packages/wasm/src/index.ts` as
|
|
192
|
+
* `InferredDescriptorJson`:
|
|
193
|
+
*
|
|
194
|
+
* ```json
|
|
195
|
+
* {
|
|
196
|
+
* "source_name": "users",
|
|
197
|
+
* "columns": [
|
|
198
|
+
* { "name": "id", "primitive": "Integer" },
|
|
199
|
+
* { "name": "name", "primitive": "String" }
|
|
200
|
+
* ],
|
|
201
|
+
* "content_hash": ""
|
|
202
|
+
* }
|
|
203
|
+
* ```
|
|
204
|
+
*
|
|
205
|
+
* Called by the browser-side playground orchestration AFTER running
|
|
206
|
+
* DuckDB-WASM `DESCRIBE read_csv_auto('<resolved-url>')` and BEFORE
|
|
207
|
+
* invoking `compile()` / `compile_file()`. Keyed by source-binding
|
|
208
|
+
* name (`"users"` for `users := io.csv("...")`), NOT by URL.
|
|
209
|
+
*
|
|
210
|
+
* Idempotent: re-registering with the same `source_name` OVERWRITES the
|
|
211
|
+
* previous entry — intentional, since the host may re-introspect when
|
|
212
|
+
* file content changes.
|
|
213
|
+
*
|
|
214
|
+
* # Errors
|
|
215
|
+
*
|
|
216
|
+
* - Malformed JSON / missing required fields → JS `Error` with the
|
|
217
|
+
* underlying `serde_json` message.
|
|
218
|
+
*
|
|
219
|
+
* Implementation: thin shim over the pure-Rust
|
|
220
|
+
* [`Self::register_inferred_descriptor_native`] helper.
|
|
221
|
+
* @param {string} descriptor_json
|
|
222
|
+
*/
|
|
223
|
+
registerInferredDescriptor(descriptor_json) {
|
|
224
|
+
const ptr0 = passStringToWasm0(descriptor_json, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
225
|
+
const len0 = WASM_VECTOR_LEN;
|
|
226
|
+
const ret = wasm.fossilplayground_registerInferredDescriptor(this.__wbg_ptr, ptr0, len0);
|
|
227
|
+
if (ret[1]) {
|
|
228
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Install a user-supplied `ShEx` schema as the active output descriptor.
|
|
233
|
+
* On parse failure the previously-installed descriptor is RETAINED (no
|
|
234
|
+
* half-applied state — a broken schema must never wedge the editor;
|
|
235
|
+
* same contract as `fossil-lsp`'s `load_sibling_shex` in 06-09).
|
|
236
|
+
*
|
|
237
|
+
* The schema is parsed via
|
|
238
|
+
* [`fossil_descriptors_output::ShExDescriptor::from_reader`] (no
|
|
239
|
+
* network access — Pitfall 1) and wrapped in
|
|
240
|
+
* [`OutputDescriptorKind::ShEx`]. The resulting `Arc` is swapped into
|
|
241
|
+
* the [`WasmDb`]'s descriptor slot atomically; future `fossil-ide`
|
|
242
|
+
* feature calls (hover, completion) reading
|
|
243
|
+
* [`HirDb::output_descriptor_kind`] see the new schema.
|
|
244
|
+
*
|
|
245
|
+
* # Errors
|
|
246
|
+
*
|
|
247
|
+
* Returns a JS error if the text is not a parseable `ShEx` schema.
|
|
248
|
+
* @param {string} text
|
|
249
|
+
*/
|
|
250
|
+
set_target_shex(text) {
|
|
251
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
252
|
+
const len0 = WASM_VECTOR_LEN;
|
|
253
|
+
const ret = wasm.fossilplayground_set_target_shex(this.__wbg_ptr, ptr0, len0);
|
|
254
|
+
if (ret[1]) {
|
|
255
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Apply an edit to an open file. Mutates the SAME `SourceFile` via the
|
|
260
|
+
* Salsa [`salsa::Setter`] (`set_text`) — this BUMPS THE REVISION, the
|
|
261
|
+
* real cancellation trigger (ADR-0022): any in-flight analysis from the
|
|
262
|
+
* previous keystroke observes the new revision at its next cooperative
|
|
263
|
+
* checkpoint. NO new `SourceFile` is interned — the Salsa input
|
|
264
|
+
* identity stays stable across the file's lifetime, so memoised
|
|
265
|
+
* downstream queries (`def_map`, `typecheck_mapping`) invalidate
|
|
266
|
+
* incrementally instead of falling off a cliff.
|
|
267
|
+
*
|
|
268
|
+
* # Errors
|
|
269
|
+
*
|
|
270
|
+
* Returns a JS error if `handle` was never opened or was already closed.
|
|
271
|
+
* @param {FileHandle} handle
|
|
272
|
+
* @param {string} contents
|
|
273
|
+
*/
|
|
274
|
+
update_file(handle, contents) {
|
|
275
|
+
_assertClass(handle, FileHandle);
|
|
276
|
+
var ptr0 = handle.__destroy_into_raw();
|
|
277
|
+
const ptr1 = passStringToWasm0(contents, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
278
|
+
const len1 = WASM_VECTOR_LEN;
|
|
279
|
+
const ret = wasm.fossilplayground_update_file(this.__wbg_ptr, ptr0, ptr1, len1);
|
|
280
|
+
if (ret[1]) {
|
|
281
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (Symbol.dispose) FossilPlayground.prototype[Symbol.dispose] = FossilPlayground.prototype.free;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* `JS`-facing re-export of the Phase-6 06-07 semantic-token legend.
|
|
289
|
+
*
|
|
290
|
+
* Returns `{ tokenTypes: string[], tokenModifiers: string[] }` — the exact
|
|
291
|
+
* LSP `SemanticTokensLegend` shape. `CodeMirror` (plan 08-08 +
|
|
292
|
+
* `packages/codemirror-fossil/src/tags.ts`) uses this to translate
|
|
293
|
+
* LSP `semanticTokens/full` response indices into highlight tag names.
|
|
294
|
+
*
|
|
295
|
+
* Delegates to [`fossil_ide::semantic_legend`] (the 06-07 authoritative
|
|
296
|
+
* definition) — NO duplicate legend definition lives here.
|
|
297
|
+
*
|
|
298
|
+
* # Errors
|
|
299
|
+
*
|
|
300
|
+
* Returns a JS error only if `serde_wasm_bindgen` fails (impossible in
|
|
301
|
+
* practice for the legend shape).
|
|
302
|
+
* @returns {any}
|
|
303
|
+
*/
|
|
304
|
+
export function semantic_legend() {
|
|
305
|
+
const ret = wasm.semantic_legend();
|
|
306
|
+
if (ret[2]) {
|
|
307
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
308
|
+
}
|
|
309
|
+
return takeFromExternrefTable0(ret[0]);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Worker entrypoint. Idempotent in spirit — calling twice replaces the
|
|
314
|
+
* previous `onmessage` handler (the leaked Closure from the first call
|
|
315
|
+
* stays alive but is no longer referenced by the global scope).
|
|
316
|
+
*
|
|
317
|
+
* Must be called from a `DedicatedWorker` global scope; returns a JS error
|
|
318
|
+
* otherwise (e.g. if called from the main thread).
|
|
319
|
+
*
|
|
320
|
+
* # Errors
|
|
321
|
+
*
|
|
322
|
+
* Returns a JS error when not running inside a `DedicatedWorker` scope.
|
|
323
|
+
*/
|
|
324
|
+
export function start_lsp_worker() {
|
|
325
|
+
const ret = wasm.start_lsp_worker();
|
|
326
|
+
if (ret[1]) {
|
|
327
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* `JS`-facing tokenize. Returns the same row stream as [`tokenize_native`],
|
|
333
|
+
* serialised via `serde_wasm_bindgen`. Consumed by
|
|
334
|
+
* `@fossil-lang/codemirror-fossil`'s `StreamParser` (plan 08-08).
|
|
335
|
+
*
|
|
336
|
+
* # Errors
|
|
337
|
+
*
|
|
338
|
+
* Returns a JS error only if `serde_wasm_bindgen` fails to serialise the
|
|
339
|
+
* row vector (effectively impossible for `Vec<{u32,u32,u32}>` — kept on the
|
|
340
|
+
* signature for forward compatibility if `TokenRow` ever grows non-trivial
|
|
341
|
+
* fields).
|
|
342
|
+
* @param {string} text
|
|
343
|
+
* @returns {any}
|
|
344
|
+
*/
|
|
345
|
+
export function tokenize(text) {
|
|
346
|
+
const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
347
|
+
const len0 = WASM_VECTOR_LEN;
|
|
348
|
+
const ret = wasm.tokenize(ptr0, len0);
|
|
349
|
+
if (ret[2]) {
|
|
350
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
351
|
+
}
|
|
352
|
+
return takeFromExternrefTable0(ret[0]);
|
|
353
|
+
}
|
|
354
|
+
function __wbg_get_imports() {
|
|
355
|
+
const import0 = {
|
|
356
|
+
__proto__: null,
|
|
357
|
+
__wbg_Error_3639a60ed15f87e7: function(arg0, arg1) {
|
|
358
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
359
|
+
return ret;
|
|
360
|
+
},
|
|
361
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
362
|
+
const ret = String(arg1);
|
|
363
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
364
|
+
const len1 = WASM_VECTOR_LEN;
|
|
365
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
366
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
367
|
+
},
|
|
368
|
+
__wbg___wbindgen_bigint_get_as_i64_3af6d4ca77193a4b: function(arg0, arg1) {
|
|
369
|
+
const v = arg1;
|
|
370
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
371
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
372
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
373
|
+
},
|
|
374
|
+
__wbg___wbindgen_boolean_get_c3dd5c39f1b5a12b: function(arg0) {
|
|
375
|
+
const v = arg0;
|
|
376
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
377
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
378
|
+
},
|
|
379
|
+
__wbg___wbindgen_debug_string_07cb72cfcc952e2b: function(arg0, arg1) {
|
|
380
|
+
const ret = debugString(arg1);
|
|
381
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
382
|
+
const len1 = WASM_VECTOR_LEN;
|
|
383
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
384
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
385
|
+
},
|
|
386
|
+
__wbg___wbindgen_in_2617fa76397620d3: function(arg0, arg1) {
|
|
387
|
+
const ret = arg0 in arg1;
|
|
388
|
+
return ret;
|
|
389
|
+
},
|
|
390
|
+
__wbg___wbindgen_is_bigint_d6a8167cac401b95: function(arg0) {
|
|
391
|
+
const ret = typeof(arg0) === 'bigint';
|
|
392
|
+
return ret;
|
|
393
|
+
},
|
|
394
|
+
__wbg___wbindgen_is_function_2f0fd7ceb86e64c5: function(arg0) {
|
|
395
|
+
const ret = typeof(arg0) === 'function';
|
|
396
|
+
return ret;
|
|
397
|
+
},
|
|
398
|
+
__wbg___wbindgen_is_object_5b22ff2418063a9c: function(arg0) {
|
|
399
|
+
const val = arg0;
|
|
400
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
401
|
+
return ret;
|
|
402
|
+
},
|
|
403
|
+
__wbg___wbindgen_is_string_eddc07a3efad52e6: function(arg0) {
|
|
404
|
+
const ret = typeof(arg0) === 'string';
|
|
405
|
+
return ret;
|
|
406
|
+
},
|
|
407
|
+
__wbg___wbindgen_is_undefined_244a92c34d3b6ec0: function(arg0) {
|
|
408
|
+
const ret = arg0 === undefined;
|
|
409
|
+
return ret;
|
|
410
|
+
},
|
|
411
|
+
__wbg___wbindgen_jsval_eq_403eaa3610500a25: function(arg0, arg1) {
|
|
412
|
+
const ret = arg0 === arg1;
|
|
413
|
+
return ret;
|
|
414
|
+
},
|
|
415
|
+
__wbg___wbindgen_jsval_loose_eq_1978f1e77b4bce62: function(arg0, arg1) {
|
|
416
|
+
const ret = arg0 == arg1;
|
|
417
|
+
return ret;
|
|
418
|
+
},
|
|
419
|
+
__wbg___wbindgen_number_get_dd6d69a6079f26f1: function(arg0, arg1) {
|
|
420
|
+
const obj = arg1;
|
|
421
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
422
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
423
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
424
|
+
},
|
|
425
|
+
__wbg___wbindgen_string_get_965592073e5d848c: function(arg0, arg1) {
|
|
426
|
+
const obj = arg1;
|
|
427
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
428
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
429
|
+
var len1 = WASM_VECTOR_LEN;
|
|
430
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
431
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
432
|
+
},
|
|
433
|
+
__wbg___wbindgen_throw_9c75d47bf9e7731e: function(arg0, arg1) {
|
|
434
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
435
|
+
},
|
|
436
|
+
__wbg_call_add9e5a76382e668: function() { return handleError(function (arg0, arg1) {
|
|
437
|
+
const ret = arg0.call(arg1);
|
|
438
|
+
return ret;
|
|
439
|
+
}, arguments); },
|
|
440
|
+
__wbg_data_4a14fad4c5f216c4: function(arg0) {
|
|
441
|
+
const ret = arg0.data;
|
|
442
|
+
return ret;
|
|
443
|
+
},
|
|
444
|
+
__wbg_done_b1afd6201ac045e0: function(arg0) {
|
|
445
|
+
const ret = arg0.done;
|
|
446
|
+
return ret;
|
|
447
|
+
},
|
|
448
|
+
__wbg_entries_bb9843ba73dc70d6: function(arg0) {
|
|
449
|
+
const ret = Object.entries(arg0);
|
|
450
|
+
return ret;
|
|
451
|
+
},
|
|
452
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
453
|
+
let deferred0_0;
|
|
454
|
+
let deferred0_1;
|
|
455
|
+
try {
|
|
456
|
+
deferred0_0 = arg0;
|
|
457
|
+
deferred0_1 = arg1;
|
|
458
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
459
|
+
} finally {
|
|
460
|
+
wasm.__wbindgen_free_command_export(deferred0_0, deferred0_1, 1);
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
__wbg_get_652f640b3b0b6e3e: function(arg0, arg1) {
|
|
464
|
+
const ret = arg0[arg1 >>> 0];
|
|
465
|
+
return ret;
|
|
466
|
+
},
|
|
467
|
+
__wbg_get_9cfea9b7bbf12a15: function() { return handleError(function (arg0, arg1) {
|
|
468
|
+
const ret = Reflect.get(arg0, arg1);
|
|
469
|
+
return ret;
|
|
470
|
+
}, arguments); },
|
|
471
|
+
__wbg_get_unchecked_be562b1421656321: function(arg0, arg1) {
|
|
472
|
+
const ret = arg0[arg1 >>> 0];
|
|
473
|
+
return ret;
|
|
474
|
+
},
|
|
475
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
476
|
+
const ret = arg0[arg1];
|
|
477
|
+
return ret;
|
|
478
|
+
},
|
|
479
|
+
__wbg_instanceof_ArrayBuffer_eab9f28fbec23477: function(arg0) {
|
|
480
|
+
let result;
|
|
481
|
+
try {
|
|
482
|
+
result = arg0 instanceof ArrayBuffer;
|
|
483
|
+
} catch (_) {
|
|
484
|
+
result = false;
|
|
485
|
+
}
|
|
486
|
+
const ret = result;
|
|
487
|
+
return ret;
|
|
488
|
+
},
|
|
489
|
+
__wbg_instanceof_DedicatedWorkerGlobalScope_32441a4d2ca5f2c4: function(arg0) {
|
|
490
|
+
let result;
|
|
491
|
+
try {
|
|
492
|
+
result = arg0 instanceof DedicatedWorkerGlobalScope;
|
|
493
|
+
} catch (_) {
|
|
494
|
+
result = false;
|
|
495
|
+
}
|
|
496
|
+
const ret = result;
|
|
497
|
+
return ret;
|
|
498
|
+
},
|
|
499
|
+
__wbg_instanceof_Map_10d4edf60fcf9327: function(arg0) {
|
|
500
|
+
let result;
|
|
501
|
+
try {
|
|
502
|
+
result = arg0 instanceof Map;
|
|
503
|
+
} catch (_) {
|
|
504
|
+
result = false;
|
|
505
|
+
}
|
|
506
|
+
const ret = result;
|
|
507
|
+
return ret;
|
|
508
|
+
},
|
|
509
|
+
__wbg_instanceof_Uint8Array_57d77acd50e4c44d: function(arg0) {
|
|
510
|
+
let result;
|
|
511
|
+
try {
|
|
512
|
+
result = arg0 instanceof Uint8Array;
|
|
513
|
+
} catch (_) {
|
|
514
|
+
result = false;
|
|
515
|
+
}
|
|
516
|
+
const ret = result;
|
|
517
|
+
return ret;
|
|
518
|
+
},
|
|
519
|
+
__wbg_isArray_c6c6ef8308995bcf: function(arg0) {
|
|
520
|
+
const ret = Array.isArray(arg0);
|
|
521
|
+
return ret;
|
|
522
|
+
},
|
|
523
|
+
__wbg_isSafeInteger_3c56c421a5b4cce4: function(arg0) {
|
|
524
|
+
const ret = Number.isSafeInteger(arg0);
|
|
525
|
+
return ret;
|
|
526
|
+
},
|
|
527
|
+
__wbg_iterator_9d68985a1d096fc2: function() {
|
|
528
|
+
const ret = Symbol.iterator;
|
|
529
|
+
return ret;
|
|
530
|
+
},
|
|
531
|
+
__wbg_length_0a6ce016dc1460b0: function(arg0) {
|
|
532
|
+
const ret = arg0.length;
|
|
533
|
+
return ret;
|
|
534
|
+
},
|
|
535
|
+
__wbg_length_ba3c032602efe310: function(arg0) {
|
|
536
|
+
const ret = arg0.length;
|
|
537
|
+
return ret;
|
|
538
|
+
},
|
|
539
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
540
|
+
const ret = new Error();
|
|
541
|
+
return ret;
|
|
542
|
+
},
|
|
543
|
+
__wbg_new_2fad8ca02fd00684: function() {
|
|
544
|
+
const ret = new Object();
|
|
545
|
+
return ret;
|
|
546
|
+
},
|
|
547
|
+
__wbg_new_3baa8d9866155c79: function() {
|
|
548
|
+
const ret = new Array();
|
|
549
|
+
return ret;
|
|
550
|
+
},
|
|
551
|
+
__wbg_new_46ae4e4ff2a07a64: function() {
|
|
552
|
+
const ret = new Map();
|
|
553
|
+
return ret;
|
|
554
|
+
},
|
|
555
|
+
__wbg_new_8454eee672b2ba6e: function(arg0) {
|
|
556
|
+
const ret = new Uint8Array(arg0);
|
|
557
|
+
return ret;
|
|
558
|
+
},
|
|
559
|
+
__wbg_next_261c3c48c6e309a5: function(arg0) {
|
|
560
|
+
const ret = arg0.next;
|
|
561
|
+
return ret;
|
|
562
|
+
},
|
|
563
|
+
__wbg_next_aacee310bcfe6461: function() { return handleError(function (arg0) {
|
|
564
|
+
const ret = arg0.next();
|
|
565
|
+
return ret;
|
|
566
|
+
}, arguments); },
|
|
567
|
+
__wbg_postMessage_ead2ef5ee8c7a94e: function() { return handleError(function (arg0, arg1) {
|
|
568
|
+
arg0.postMessage(arg1);
|
|
569
|
+
}, arguments); },
|
|
570
|
+
__wbg_prototypesetcall_fd4050e806e1d519: function(arg0, arg1, arg2) {
|
|
571
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
572
|
+
},
|
|
573
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
574
|
+
arg0[arg1] = arg2;
|
|
575
|
+
},
|
|
576
|
+
__wbg_set_82f7a370f604db70: function(arg0, arg1, arg2) {
|
|
577
|
+
const ret = arg0.set(arg1, arg2);
|
|
578
|
+
return ret;
|
|
579
|
+
},
|
|
580
|
+
__wbg_set_f614f6a0608d1d1d: function(arg0, arg1, arg2) {
|
|
581
|
+
arg0[arg1 >>> 0] = arg2;
|
|
582
|
+
},
|
|
583
|
+
__wbg_set_onmessage_2686976b9bf47e87: function(arg0, arg1) {
|
|
584
|
+
arg0.onmessage = arg1;
|
|
585
|
+
},
|
|
586
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
587
|
+
const ret = arg1.stack;
|
|
588
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc_command_export, wasm.__wbindgen_realloc_command_export);
|
|
589
|
+
const len1 = WASM_VECTOR_LEN;
|
|
590
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
591
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
592
|
+
},
|
|
593
|
+
__wbg_static_accessor_GLOBAL_THIS_1c7f1bd6c6941fdb: function() {
|
|
594
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
595
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
596
|
+
},
|
|
597
|
+
__wbg_static_accessor_GLOBAL_e039bc914f83e74e: function() {
|
|
598
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
599
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
600
|
+
},
|
|
601
|
+
__wbg_static_accessor_SELF_8bf8c48c28420ad5: function() {
|
|
602
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
603
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
604
|
+
},
|
|
605
|
+
__wbg_static_accessor_WINDOW_6aeee9b51652ee0f: function() {
|
|
606
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
607
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
608
|
+
},
|
|
609
|
+
__wbg_value_f852716acdeb3e82: function(arg0) {
|
|
610
|
+
const ret = arg0.value;
|
|
611
|
+
return ret;
|
|
612
|
+
},
|
|
613
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
614
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 9, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
615
|
+
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h4393dedb0066ad40);
|
|
616
|
+
return ret;
|
|
617
|
+
},
|
|
618
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
619
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
620
|
+
const ret = arg0;
|
|
621
|
+
return ret;
|
|
622
|
+
},
|
|
623
|
+
__wbindgen_cast_0000000000000003: function(arg0) {
|
|
624
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
625
|
+
const ret = arg0;
|
|
626
|
+
return ret;
|
|
627
|
+
},
|
|
628
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
629
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
630
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
631
|
+
return ret;
|
|
632
|
+
},
|
|
633
|
+
__wbindgen_cast_0000000000000005: function(arg0) {
|
|
634
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
635
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
636
|
+
return ret;
|
|
637
|
+
},
|
|
638
|
+
__wbindgen_init_externref_table: function() {
|
|
639
|
+
const table = wasm.__wbindgen_externrefs;
|
|
640
|
+
const offset = table.grow(4);
|
|
641
|
+
table.set(0, undefined);
|
|
642
|
+
table.set(offset + 0, undefined);
|
|
643
|
+
table.set(offset + 1, null);
|
|
644
|
+
table.set(offset + 2, true);
|
|
645
|
+
table.set(offset + 3, false);
|
|
646
|
+
},
|
|
647
|
+
};
|
|
648
|
+
return {
|
|
649
|
+
__proto__: null,
|
|
650
|
+
"./fossil_wasm_bg.js": import0,
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
function wasm_bindgen__convert__closures_____invoke__h4393dedb0066ad40(arg0, arg1, arg2) {
|
|
655
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h4393dedb0066ad40(arg0, arg1, arg2);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
const FileHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
659
|
+
? { register: () => {}, unregister: () => {} }
|
|
660
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_filehandle_free(ptr, 1));
|
|
661
|
+
const FossilPlaygroundFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
662
|
+
? { register: () => {}, unregister: () => {} }
|
|
663
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_fossilplayground_free(ptr, 1));
|
|
664
|
+
|
|
665
|
+
function addToExternrefTable0(obj) {
|
|
666
|
+
const idx = wasm.__externref_table_alloc_command_export();
|
|
667
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
668
|
+
return idx;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
function _assertClass(instance, klass) {
|
|
672
|
+
if (!(instance instanceof klass)) {
|
|
673
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
678
|
+
? { register: () => {}, unregister: () => {} }
|
|
679
|
+
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure_command_export(state.a, state.b));
|
|
680
|
+
|
|
681
|
+
function debugString(val) {
|
|
682
|
+
// primitive types
|
|
683
|
+
const type = typeof val;
|
|
684
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
685
|
+
return `${val}`;
|
|
686
|
+
}
|
|
687
|
+
if (type == 'string') {
|
|
688
|
+
return `"${val}"`;
|
|
689
|
+
}
|
|
690
|
+
if (type == 'symbol') {
|
|
691
|
+
const description = val.description;
|
|
692
|
+
if (description == null) {
|
|
693
|
+
return 'Symbol';
|
|
694
|
+
} else {
|
|
695
|
+
return `Symbol(${description})`;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
if (type == 'function') {
|
|
699
|
+
const name = val.name;
|
|
700
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
701
|
+
return `Function(${name})`;
|
|
702
|
+
} else {
|
|
703
|
+
return 'Function';
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
// objects
|
|
707
|
+
if (Array.isArray(val)) {
|
|
708
|
+
const length = val.length;
|
|
709
|
+
let debug = '[';
|
|
710
|
+
if (length > 0) {
|
|
711
|
+
debug += debugString(val[0]);
|
|
712
|
+
}
|
|
713
|
+
for(let i = 1; i < length; i++) {
|
|
714
|
+
debug += ', ' + debugString(val[i]);
|
|
715
|
+
}
|
|
716
|
+
debug += ']';
|
|
717
|
+
return debug;
|
|
718
|
+
}
|
|
719
|
+
// Test for built-in
|
|
720
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
721
|
+
let className;
|
|
722
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
723
|
+
className = builtInMatches[1];
|
|
724
|
+
} else {
|
|
725
|
+
// Failed to match the standard '[object ClassName]'
|
|
726
|
+
return toString.call(val);
|
|
727
|
+
}
|
|
728
|
+
if (className == 'Object') {
|
|
729
|
+
// we're a user defined class or Object
|
|
730
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
731
|
+
// easier than looping through ownProperties of `val`.
|
|
732
|
+
try {
|
|
733
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
734
|
+
} catch (_) {
|
|
735
|
+
return 'Object';
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
// errors
|
|
739
|
+
if (val instanceof Error) {
|
|
740
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
741
|
+
}
|
|
742
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
743
|
+
return className;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
747
|
+
ptr = ptr >>> 0;
|
|
748
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
let cachedDataViewMemory0 = null;
|
|
752
|
+
function getDataViewMemory0() {
|
|
753
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
754
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
755
|
+
}
|
|
756
|
+
return cachedDataViewMemory0;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
function getStringFromWasm0(ptr, len) {
|
|
760
|
+
return decodeText(ptr >>> 0, len);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
let cachedUint8ArrayMemory0 = null;
|
|
764
|
+
function getUint8ArrayMemory0() {
|
|
765
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
766
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
767
|
+
}
|
|
768
|
+
return cachedUint8ArrayMemory0;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
function handleError(f, args) {
|
|
772
|
+
try {
|
|
773
|
+
return f.apply(this, args);
|
|
774
|
+
} catch (e) {
|
|
775
|
+
const idx = addToExternrefTable0(e);
|
|
776
|
+
wasm.__wbindgen_exn_store_command_export(idx);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
function isLikeNone(x) {
|
|
781
|
+
return x === undefined || x === null;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
785
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
786
|
+
const real = (...args) => {
|
|
787
|
+
|
|
788
|
+
// First up with a closure we increment the internal reference
|
|
789
|
+
// count. This ensures that the Rust closure environment won't
|
|
790
|
+
// be deallocated while we're invoking it.
|
|
791
|
+
state.cnt++;
|
|
792
|
+
const a = state.a;
|
|
793
|
+
state.a = 0;
|
|
794
|
+
try {
|
|
795
|
+
return f(a, state.b, ...args);
|
|
796
|
+
} finally {
|
|
797
|
+
state.a = a;
|
|
798
|
+
real._wbg_cb_unref();
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
real._wbg_cb_unref = () => {
|
|
802
|
+
if (--state.cnt === 0) {
|
|
803
|
+
wasm.__wbindgen_destroy_closure_command_export(state.a, state.b);
|
|
804
|
+
state.a = 0;
|
|
805
|
+
CLOSURE_DTORS.unregister(state);
|
|
806
|
+
}
|
|
807
|
+
};
|
|
808
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
809
|
+
return real;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
813
|
+
if (realloc === undefined) {
|
|
814
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
815
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
816
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
817
|
+
WASM_VECTOR_LEN = buf.length;
|
|
818
|
+
return ptr;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
let len = arg.length;
|
|
822
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
823
|
+
|
|
824
|
+
const mem = getUint8ArrayMemory0();
|
|
825
|
+
|
|
826
|
+
let offset = 0;
|
|
827
|
+
|
|
828
|
+
for (; offset < len; offset++) {
|
|
829
|
+
const code = arg.charCodeAt(offset);
|
|
830
|
+
if (code > 0x7F) break;
|
|
831
|
+
mem[ptr + offset] = code;
|
|
832
|
+
}
|
|
833
|
+
if (offset !== len) {
|
|
834
|
+
if (offset !== 0) {
|
|
835
|
+
arg = arg.slice(offset);
|
|
836
|
+
}
|
|
837
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
838
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
839
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
840
|
+
|
|
841
|
+
offset += ret.written;
|
|
842
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
WASM_VECTOR_LEN = offset;
|
|
846
|
+
return ptr;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
function takeFromExternrefTable0(idx) {
|
|
850
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
851
|
+
wasm.__externref_table_dealloc_command_export(idx);
|
|
852
|
+
return value;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
856
|
+
cachedTextDecoder.decode();
|
|
857
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
858
|
+
let numBytesDecoded = 0;
|
|
859
|
+
function decodeText(ptr, len) {
|
|
860
|
+
numBytesDecoded += len;
|
|
861
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
862
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
863
|
+
cachedTextDecoder.decode();
|
|
864
|
+
numBytesDecoded = len;
|
|
865
|
+
}
|
|
866
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
const cachedTextEncoder = new TextEncoder();
|
|
870
|
+
|
|
871
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
872
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
873
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
874
|
+
view.set(buf);
|
|
875
|
+
return {
|
|
876
|
+
read: arg.length,
|
|
877
|
+
written: buf.length
|
|
878
|
+
};
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
let WASM_VECTOR_LEN = 0;
|
|
883
|
+
|
|
884
|
+
let wasmModule, wasmInstance, wasm;
|
|
885
|
+
function __wbg_finalize_init(instance, module) {
|
|
886
|
+
wasmInstance = instance;
|
|
887
|
+
wasm = instance.exports;
|
|
888
|
+
wasmModule = module;
|
|
889
|
+
cachedDataViewMemory0 = null;
|
|
890
|
+
cachedUint8ArrayMemory0 = null;
|
|
891
|
+
wasm.__wbindgen_start();
|
|
892
|
+
return wasm;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
async function __wbg_load(module, imports) {
|
|
896
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
897
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
898
|
+
try {
|
|
899
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
900
|
+
} catch (e) {
|
|
901
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
902
|
+
|
|
903
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
904
|
+
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);
|
|
905
|
+
|
|
906
|
+
} else { throw e; }
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
const bytes = await module.arrayBuffer();
|
|
911
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
912
|
+
} else {
|
|
913
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
914
|
+
|
|
915
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
916
|
+
return { instance, module };
|
|
917
|
+
} else {
|
|
918
|
+
return instance;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
function expectedResponseType(type) {
|
|
923
|
+
switch (type) {
|
|
924
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
925
|
+
}
|
|
926
|
+
return false;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
function initSync(module) {
|
|
931
|
+
if (wasm !== undefined) return wasm;
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
if (module !== undefined) {
|
|
935
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
936
|
+
({module} = module)
|
|
937
|
+
} else {
|
|
938
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
const imports = __wbg_get_imports();
|
|
943
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
944
|
+
module = new WebAssembly.Module(module);
|
|
945
|
+
}
|
|
946
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
947
|
+
return __wbg_finalize_init(instance, module);
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
async function __wbg_init(module_or_path) {
|
|
951
|
+
if (wasm !== undefined) return wasm;
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
if (module_or_path !== undefined) {
|
|
955
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
956
|
+
({module_or_path} = module_or_path)
|
|
957
|
+
} else {
|
|
958
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
if (module_or_path === undefined) {
|
|
963
|
+
module_or_path = new URL('fossil_wasm_bg.wasm', import.meta.url);
|
|
964
|
+
}
|
|
965
|
+
const imports = __wbg_get_imports();
|
|
966
|
+
|
|
967
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
968
|
+
module_or_path = fetch(module_or_path);
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
972
|
+
|
|
973
|
+
return __wbg_finalize_init(instance, module);
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
export { initSync, __wbg_init as default };
|