@quillmark/wasm 0.100.0 → 0.102.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/core/wasm.js CHANGED
@@ -1,9 +1,2472 @@
1
1
  /* @ts-self-types="./wasm.d.ts" */
2
- import * as wasm from "./wasm_bg.wasm";
3
- import { __wbg_set_wasm } from "./wasm_bg.js";
4
-
5
- __wbg_set_wasm(wasm);
6
- wasm.__wbindgen_start();
7
- export {
8
- Document, Quill, exportMarkdown, formatDocPath, importMarkdown, init, mapPos, parseDocPath, rebase
9
- } from "./wasm_bg.js";
2
+
3
+ /**
4
+ * Typed in-memory Quillmark document.
5
+ */
6
+ export class Document {
7
+ static __wrap(ptr) {
8
+ ptr = ptr >>> 0;
9
+ const obj = Object.create(Document.prototype);
10
+ obj.__wbg_ptr = ptr;
11
+ DocumentFinalization.register(obj, obj.__wbg_ptr, obj);
12
+ return obj;
13
+ }
14
+ __destroy_into_raw() {
15
+ const ptr = this.__wbg_ptr;
16
+ this.__wbg_ptr = 0;
17
+ DocumentFinalization.unregister(this);
18
+ return ptr;
19
+ }
20
+ free() {
21
+ const ptr = this.__destroy_into_raw();
22
+ wasm.__wbg_document_free(ptr, 0);
23
+ }
24
+ /**
25
+ * Build a composable card of `kind`, typed-commit `fields` onto it, set its
26
+ * body from optional markdown, and place it: the ABI under `writer.addCard`.
27
+ * `at` picks the position: absent appends, a number inserts at that index
28
+ * (`0..=cards.length`), so a positioned typed insert is one atomic call
29
+ * rather than `addCard` + `moveCard`. Fuses `makeCard` + typed commit +
30
+ * insertion transactionally: the card is committed in full before it joins
31
+ * the document, so a rejected field (or an invalid kind, body, or
32
+ * out-of-range `at`) leaves the document untouched. Field errors throw the
33
+ * same per-field diagnostic bundle as [`commitFields`](Self::commit_fields),
34
+ * including an `edit::unknown_field` per undeclared name; an invalid
35
+ * kind or body, or an out-of-range position, throws a single-entry bundle
36
+ * keyed `$kind` / `$body`.
37
+ * @param {Quill} quill
38
+ * @param {string} kind
39
+ * @param {Record<string, unknown>} [fields]
40
+ * @param {string} [body]
41
+ * @param {number} [at]
42
+ */
43
+ _addCard(quill, kind, fields, body, at) {
44
+ try {
45
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
46
+ _assertClass(quill, Quill);
47
+ const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
48
+ const len0 = WASM_VECTOR_LEN;
49
+ var ptr1 = isLikeNone(body) ? 0 : passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
50
+ var len1 = WASM_VECTOR_LEN;
51
+ wasm.document__addCard(retptr, this.__wbg_ptr, quill.__wbg_ptr, ptr0, len0, isLikeNone(fields) ? 0 : addHeapObject(fields), ptr1, len1, isLikeNone(at) ? 0x100000001 : (at) >>> 0);
52
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
53
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
54
+ if (r1) {
55
+ throw takeObject(r0);
56
+ }
57
+ } finally {
58
+ wasm.__wbindgen_add_to_stack_pointer(16);
59
+ }
60
+ }
61
+ /**
62
+ * Typed field write at `addr`, resolving the field's schema `type` from
63
+ * `quill`: the stable ABI under the runtime `writer.set` / `writer.card(i).set`.
64
+ * The one write verb for **every** field type (richtext, scalar, array,
65
+ * object); the schema carries the `inline` constraint, so no type token or
66
+ * flag is passed. A richtext-typed field stores the canonical content, so
67
+ * identity marks (anchors, island ids) and content-only marks (e.g.
68
+ * `underline`) live on it and survive compiles and the storage DTO. Values
69
+ * use the encoding the seam already speaks: a content object or markdown
70
+ * string for richtext, a scalar/array/object otherwise.
71
+ *
72
+ * A bare string is `Addr` shorthand for `{ field }`; `{ card, field }`
73
+ * targets a composable card (its `$kind` resolves the schema). A body
74
+ * address throws: a body has no field schema; write it with `writer.reviseBody`
75
+ * / `revise`. A field declared in the schema is strict-committed (a mismatch
76
+ * throws now, not at render); a name the schema does not declare throws
77
+ * `edit::unknown_field` rather than falling to the opaque store: on
78
+ * the typed path it is a typo. Use [`storeField`](Document::store_field) for
79
+ * opaque storage. Also throws `edit::field_coercion_failed` /
80
+ * `edit::field_decode` / `edit::field_not_inline`
81
+ * on a typed mismatch, `edit::invalid_field_name` on a malformed name,
82
+ * and `edit::index_out_of_range` on an out-of-range card.
83
+ *
84
+ * The `quill` handle is passed per call because a `Document` carries only a
85
+ * `$quill` reference, not the resolved schema.
86
+ * @param {Quill} quill
87
+ * @param {Addr | string} addr
88
+ * @param {any} value
89
+ */
90
+ _commitField(quill, addr, value) {
91
+ try {
92
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
93
+ _assertClass(quill, Quill);
94
+ wasm.document__commitField(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), addHeapObject(value));
95
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
96
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
97
+ if (r1) {
98
+ throw takeObject(r0);
99
+ }
100
+ } finally {
101
+ wasm.__wbindgen_add_to_stack_pointer(16);
102
+ }
103
+ }
104
+ /**
105
+ * Batched twin of [`commitField`](Document::commit_field): typed-commit
106
+ * several fields on the card `addr` targets atomically, resolving each
107
+ * field's schema `type` from `quill`. `addr` is a **card address**
108
+ * (`{ card }`, absent = main; a present `field` throws). All-or-nothing with
109
+ * the same per-field-diagnostic error contract as
110
+ * [`storeFields`](Document::store_fields): nothing is applied on error and
111
+ * the thrown error's `diagnostics` carry one entry per offending field,
112
+ * including an `edit::unknown_field` for any name the schema does not
113
+ * declare, so a whole-form submit sees every typo in one pass. Throws on an
114
+ * out-of-range card.
115
+ * @param {Quill} quill
116
+ * @param {CardAddr} addr
117
+ * @param {Record<string, unknown>} fields
118
+ */
119
+ _commitFields(quill, addr, fields) {
120
+ try {
121
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
122
+ _assertClass(quill, Quill);
123
+ wasm.document__commitFields(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), addHeapObject(fields));
124
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
125
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
126
+ if (r1) {
127
+ throw takeObject(r0);
128
+ }
129
+ } finally {
130
+ wasm.__wbindgen_add_to_stack_pointer(16);
131
+ }
132
+ }
133
+ /**
134
+ * Interpreted read at `addr`, resolving the field's declared `type` from
135
+ * `quill`: the stable ABI under the runtime `reader.get` / `reader.card(i).get`.
136
+ * The schema-plane twin of the quill-free [`getStored`](Self::get_stored): a `richtext`
137
+ * field returns its markdown projection, every other declared type its
138
+ * canonical value verbatim, so a consumer holding the quill reads by field
139
+ * meaning rather than by wire shape.
140
+ *
141
+ * A bare string is `Addr` shorthand for `{ field }`; `{ card, field }`
142
+ * targets a composable card (its `$kind` resolves the schema). Returns
143
+ * `undefined` for an **absent** field. An absent `addr.field` reads the body
144
+ * markdown: quill-free, mirroring [`bodyMarkdown`](Self::get_markdown), since
145
+ * a body's type is a format fact, not a schema fact. A name the schema does
146
+ * not declare throws `edit::unknown_field` (the authority `bodyMarkdown`
147
+ * lacks: there an unknown name reads back `undefined`); a `richtext` field
148
+ * holding a value that does not decode throws `edit::field_decode`;
149
+ * an out-of-range `addr.card` throws.
150
+ *
151
+ * The `quill` handle is passed per call because a `Document` carries only a
152
+ * `$quill` reference, not the resolved schema.
153
+ * @param {Quill} quill
154
+ * @param {Addr | string} addr
155
+ * @returns {unknown}
156
+ */
157
+ _readerGet(quill, addr) {
158
+ try {
159
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
160
+ _assertClass(quill, Quill);
161
+ wasm.document__readerGet(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr));
162
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
163
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
164
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
165
+ if (r2) {
166
+ throw takeObject(r1);
167
+ }
168
+ return takeObject(r0);
169
+ } finally {
170
+ wasm.__wbindgen_add_to_stack_pointer(16);
171
+ }
172
+ }
173
+ /**
174
+ * Interpreted **`Content`** read at `addr`: the stable ABI under the runtime
175
+ * `reader.getContent` / `reader.card(i).getContent`. The `Content` twin of
176
+ * [`reader.get`](Self::reader_get), which projects; this decodes the stored
177
+ * value through the codec the field's declared type names (`richtext` as
178
+ * markdown, `plaintext` as literal text) and returns the canonical `Content`.
179
+ *
180
+ * Total over the storage form: a committed field holds a content object and
181
+ * a parsed one holds the authored string, and both read back as a `Content`
182
+ * here, so a consumer mounting a content editor stops branching on how the
183
+ * document was built.
184
+ *
185
+ * A bare string is `Addr` shorthand for `{ field }`; `{ card, field }`
186
+ * targets a composable card. Returns `undefined` for an **absent** field. An
187
+ * absent `addr.field` reads the **body** `Content`, quill-free, mirroring
188
+ * [`getStored`](Self::get_stored). Throws `edit::unknown_field` for a name
189
+ * the schema does not declare, `edit::field_not_content` for a declared type
190
+ * that is not a content leaf (`array<richtext>` carries content and still has
191
+ * no one `Content`), `edit::field_decode` for a stored value
192
+ * that decodes under neither encoding, and `edit::index_out_of_range` for a
193
+ * bad `addr.card`.
194
+ * @param {Quill} quill
195
+ * @param {Addr | string} addr
196
+ * @returns {Content | undefined}
197
+ */
198
+ _readerGetContent(quill, addr) {
199
+ try {
200
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
201
+ _assertClass(quill, Quill);
202
+ wasm.document__readerGetContent(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr));
203
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
204
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
205
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
206
+ if (r2) {
207
+ throw takeObject(r1);
208
+ }
209
+ return takeObject(r0);
210
+ } finally {
211
+ wasm.__wbindgen_add_to_stack_pointer(16);
212
+ }
213
+ }
214
+ /**
215
+ * Revise the content field at `addr` from authored text, typed *and*
216
+ * anchor-preserving: the ABI under `writer.reviseField`. Resolves the
217
+ * field's schema from `quill` (main card, or the addressed card's `$kind`)
218
+ * and defers to [`TypedWriter::revise_field`](quillmark_core::TypedWriter::revise_field):
219
+ * surviving anchors rebase (as [`revise`](Self::revise)), then the diffed
220
+ * result is schema-conformed, so a `richtext(inline)` field rejects a
221
+ * multi-block result with `edit::field_not_inline`. Returns the
222
+ * text `Delta`.
223
+ *
224
+ * The codec is the declared type's: `richtext` diffs markdown, `plaintext`
225
+ * the literal text.
226
+ *
227
+ * `addr` must name a field (a bare string is `{ field }`); a body address
228
+ * throws (a body carries no field schema: use [`revise`](Self::revise)). A
229
+ * name the schema does not declare throws `edit::unknown_field`. Throws
230
+ * on an out-of-range card. Hidden from the `.d.ts`; the visible verb is
231
+ * `writer.reviseField` in the runtime layer.
232
+ * @param {Quill} quill
233
+ * @param {Addr | string} addr
234
+ * @param {string} text
235
+ * @returns {Delta}
236
+ */
237
+ _reviseField(quill, addr, text) {
238
+ try {
239
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
240
+ _assertClass(quill, Quill);
241
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
242
+ const len0 = WASM_VECTOR_LEN;
243
+ wasm.document__reviseField(retptr, this.__wbg_ptr, quill.__wbg_ptr, addHeapObject(addr), ptr0, len0);
244
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
245
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
246
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
247
+ if (r2) {
248
+ throw takeObject(r1);
249
+ }
250
+ return takeObject(r0);
251
+ } finally {
252
+ wasm.__wbindgen_add_to_stack_pointer(16);
253
+ }
254
+ }
255
+ /**
256
+ * **Apply** a committed content edit `bundle`
257
+ * (`{ delta?, islandOps?, lineOps?, markOps? }`) at `addr`, the editor
258
+ * splice: text delta first, then island ops, then line ops, then mark ops
259
+ * (mark ranges in final-text coordinates), each all-or-nothing. An absent
260
+ * `addr.field` targets the body, an absent `addr.card` the main card.
261
+ *
262
+ * The island channel keeps a table or image edit on the op path: it moves
263
+ * the island alone, so the anchors elsewhere in the field survive an edit
264
+ * `overwrite` would clear.
265
+ *
266
+ * Throws on an out-of-range card, a field that is not richtext, a malformed
267
+ * bundle, or an op that applies out of bounds (the value is unchanged on a
268
+ * failed apply).
269
+ * @param {Addr | string} addr
270
+ * @param {ChangeBundle} bundle
271
+ */
272
+ applyChange(addr, bundle) {
273
+ try {
274
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
275
+ wasm.document_applyChange(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(bundle));
276
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
277
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
278
+ if (r1) {
279
+ throw takeObject(r0);
280
+ }
281
+ } finally {
282
+ wasm.__wbindgen_add_to_stack_pointer(16);
283
+ }
284
+ }
285
+ /**
286
+ * Authoring-ergonomics header introducing a blueprint to an LLM/MCP
287
+ * consumer for the given `quillName`. Re-exposes core's canonical text for
288
+ * JS consumers; any surface that draws from the same core source stays
289
+ * uniform.
290
+ * @param {string} quill_name
291
+ * @returns {string}
292
+ */
293
+ static blueprintInstruction(quill_name) {
294
+ let deferred2_0;
295
+ let deferred2_1;
296
+ try {
297
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
298
+ const ptr0 = passStringToWasm0(quill_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
299
+ const len0 = WASM_VECTOR_LEN;
300
+ wasm.document_blueprintInstruction(retptr, ptr0, len0);
301
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
302
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
303
+ deferred2_0 = r0;
304
+ deferred2_1 = r1;
305
+ return getStringFromWasm0(r0, r1);
306
+ } finally {
307
+ wasm.__wbindgen_add_to_stack_pointer(16);
308
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
309
+ }
310
+ }
311
+ /**
312
+ * The **body** markdown projection (the main body, or a composable card's
313
+ * body (`{ card }`)) the on-demand, lossy export (content-only marks do not
314
+ * survive markdown). A body's type is a format fact, not a schema fact, so
315
+ * this read stays quill-free; a body is never absent.
316
+ *
317
+ * `addr` is an optional **card address** (`{ card }`, absent = main). A
318
+ * present `field` throws: a field's markdown is read through the
319
+ * schema-plane `quill.reader(doc).get(field)`, which interprets by declared
320
+ * type. An out-of-range `addr.card` throws.
321
+ * @param {CardAddr} [addr]
322
+ * @returns {string}
323
+ */
324
+ bodyMarkdown(addr) {
325
+ try {
326
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
327
+ wasm.document_bodyMarkdown(retptr, this.__wbg_ptr, addHeapObject(addr));
328
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
329
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
330
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
331
+ if (r2) {
332
+ throw takeObject(r1);
333
+ }
334
+ return takeObject(r0);
335
+ } finally {
336
+ wasm.__wbindgen_add_to_stack_pointer(16);
337
+ }
338
+ }
339
+ /**
340
+ * A single composable card by index: the whole `Card`, the card-indexed
341
+ * twin of the [`main`](Self::main) getter, so reading one card need not
342
+ * materialize every card via [`cards`](Self::cards). An out-of-range
343
+ * `index` throws `edit::index_out_of_range`, matching the card write
344
+ * verbs.
345
+ * @param {number} index
346
+ * @returns {Card}
347
+ */
348
+ card(index) {
349
+ try {
350
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
351
+ wasm.document_card(retptr, this.__wbg_ptr, index);
352
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
353
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
354
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
355
+ if (r2) {
356
+ throw takeObject(r1);
357
+ }
358
+ return takeObject(r0);
359
+ } finally {
360
+ wasm.__wbindgen_add_to_stack_pointer(16);
361
+ }
362
+ }
363
+ /**
364
+ * Number of composable cards (excludes the main card). O(1).
365
+ * @returns {number}
366
+ */
367
+ get cardCount() {
368
+ const ret = wasm.document_cardCount(this.__wbg_ptr);
369
+ return ret >>> 0;
370
+ }
371
+ /**
372
+ * @returns {Card[]}
373
+ */
374
+ get cards() {
375
+ try {
376
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
377
+ wasm.document_cards(retptr, this.__wbg_ptr);
378
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
379
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
380
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
381
+ if (r2) {
382
+ throw takeObject(r1);
383
+ }
384
+ return takeObject(r0);
385
+ } finally {
386
+ wasm.__wbindgen_add_to_stack_pointer(16);
387
+ }
388
+ }
389
+ /**
390
+ * @returns {Document}
391
+ */
392
+ clone() {
393
+ const ret = wasm.document_clone(this.__wbg_ptr);
394
+ return Document.__wrap(ret);
395
+ }
396
+ /**
397
+ * Storage version this build writes via [`toJson`](Document::to_json).
398
+ * Tracks the `Document` model version (not the running crate version):
399
+ * the tag advances only when the wire format changes, not on every release.
400
+ * @returns {string}
401
+ */
402
+ static currentStorageVersion() {
403
+ let deferred1_0;
404
+ let deferred1_1;
405
+ try {
406
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
407
+ wasm.document_currentStorageVersion(retptr);
408
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
409
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
410
+ deferred1_0 = r0;
411
+ deferred1_1 = r1;
412
+ return getStringFromWasm0(r0, r1);
413
+ } finally {
414
+ wasm.__wbindgen_add_to_stack_pointer(16);
415
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
416
+ }
417
+ }
418
+ /**
419
+ * Structural equality (parse-time `warnings` excluded). Use to debounce
420
+ * upstream prop updates instead of re-parsing on every keystroke.
421
+ * @param {Document} other
422
+ * @returns {boolean}
423
+ */
424
+ equals(other) {
425
+ _assertClass(other, Document);
426
+ const ret = wasm.document_equals(this.__wbg_ptr, other.__wbg_ptr);
427
+ return ret !== 0;
428
+ }
429
+ /**
430
+ * Render a Diagnostic as the canonical pretty-printed text (core's
431
+ * `Diagnostic::fmt_pretty`). Single source of truth so a Diagnostic looks
432
+ * identical no matter which consumer surfaces it.
433
+ * @param {Diagnostic} diag
434
+ * @returns {string}
435
+ */
436
+ static formatDiagnostic(diag) {
437
+ let deferred1_0;
438
+ let deferred1_1;
439
+ try {
440
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
441
+ wasm.document_formatDiagnostic(retptr, addHeapObject(diag));
442
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
443
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
444
+ deferred1_0 = r0;
445
+ deferred1_1 = r1;
446
+ return getStringFromWasm0(r0, r1);
447
+ } finally {
448
+ wasm.__wbindgen_add_to_stack_pointer(16);
449
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
450
+ }
451
+ }
452
+ /**
453
+ * Authoring-format rules for the card-yaml markdown surface. The canonical
454
+ * text is core's (`quillmark_core::document::FORMAT_RULES`), re-exposed
455
+ * here for JS consumers so it matches any other surface that draws from the
456
+ * same source. Read once at startup and cache; the value never changes
457
+ * between calls.
458
+ * @returns {string}
459
+ */
460
+ static formatRules() {
461
+ let deferred1_0;
462
+ let deferred1_1;
463
+ try {
464
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
465
+ wasm.document_formatRules(retptr);
466
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
467
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
468
+ deferred1_0 = r0;
469
+ deferred1_1 = r1;
470
+ return getStringFromWasm0(r0, r1);
471
+ } finally {
472
+ wasm.__wbindgen_add_to_stack_pointer(16);
473
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
474
+ }
475
+ }
476
+ /**
477
+ * Reconstruct a `Document` from a versioned storage DTO string produced
478
+ * by [`toJson`](Document::to_json). Unknown `schema` tags are rejected.
479
+ * The result carries no parse-time warnings (`.warnings` is always empty).
480
+ *
481
+ * Throws if `json` is not a valid storage DTO (malformed JSON, unknown
482
+ * `schema`, missing fields, or unparseable quill reference).
483
+ * @param {string} json
484
+ * @returns {Document}
485
+ */
486
+ static fromJson(json) {
487
+ try {
488
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
489
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
490
+ const len0 = WASM_VECTOR_LEN;
491
+ wasm.document_fromJson(retptr, ptr0, len0);
492
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
493
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
494
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
495
+ if (r2) {
496
+ throw takeObject(r1);
497
+ }
498
+ return Document.__wrap(r0);
499
+ } finally {
500
+ wasm.__wbindgen_add_to_stack_pointer(16);
501
+ }
502
+ }
503
+ /**
504
+ * Parse markdown into a typed Document. Throws on parse errors.
505
+ * @param {string} markdown
506
+ * @returns {Document}
507
+ */
508
+ static fromMarkdown(markdown) {
509
+ try {
510
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
511
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
512
+ const len0 = WASM_VECTOR_LEN;
513
+ wasm.document_fromMarkdown(retptr, ptr0, len0);
514
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
515
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
516
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
517
+ if (r2) {
518
+ throw takeObject(r1);
519
+ }
520
+ return Document.__wrap(r0);
521
+ } finally {
522
+ wasm.__wbindgen_add_to_stack_pointer(16);
523
+ }
524
+ }
525
+ /**
526
+ * The whole `$ext` map at `addr` (a card address, absent `card` = main), or
527
+ * `undefined` when the card carries none. The fine-grained `$ext` read:
528
+ * your own state without serializing the whole card. Throws on a present
529
+ * `field` (a card address takes only `card`) or an out-of-range card.
530
+ * @param {CardAddr} [addr]
531
+ * @returns {Record<string, unknown> | undefined}
532
+ */
533
+ getExt(addr) {
534
+ try {
535
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
536
+ wasm.document_getExt(retptr, this.__wbg_ptr, addHeapObject(addr));
537
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
538
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
539
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
540
+ if (r2) {
541
+ throw takeObject(r1);
542
+ }
543
+ return takeObject(r0);
544
+ } finally {
545
+ wasm.__wbindgen_add_to_stack_pointer(16);
546
+ }
547
+ }
548
+ /**
549
+ * The value stored under `$ext[ns]` at `addr` (a card address, absent `card`
550
+ * = main), or `undefined`. The namespace-scoped `$ext` read: your own slot
551
+ * without a whole-card serialize, and non-destructive (unlike
552
+ * `removeExtNamespace`). Throws on a present `field` or an out-of-range card.
553
+ * @param {CardAddr} addr
554
+ * @param {string} ns
555
+ * @returns {unknown}
556
+ */
557
+ getExtNamespace(addr, ns) {
558
+ try {
559
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
560
+ const ptr0 = passStringToWasm0(ns, wasm.__wbindgen_export, wasm.__wbindgen_export2);
561
+ const len0 = WASM_VECTOR_LEN;
562
+ wasm.document_getExtNamespace(retptr, this.__wbg_ptr, addHeapObject(addr), ptr0, len0);
563
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
564
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
565
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
566
+ if (r2) {
567
+ throw takeObject(r1);
568
+ }
569
+ return takeObject(r0);
570
+ } finally {
571
+ wasm.__wbindgen_add_to_stack_pointer(16);
572
+ }
573
+ }
574
+ /**
575
+ * Read the **verbatim stored value** at `addr`: the raw payload value of a
576
+ * field, or the **body content** when `addr.field` is absent. A bare
577
+ * string is `Addr` shorthand for `{ field }`. Reads are total over the field
578
+ * axis: an absent field is `undefined`; only an out-of-range `addr.card`
579
+ * throws `edit::index_out_of_range`. Needs no schema, so it lives on
580
+ * `Document`: the read echo of the verbatim `store*` write, distinct from
581
+ * the interpreted schema-plane [`reader.get`](Self::reader_get). For the
582
+ * markdown projection use [`bodyMarkdown`](Self::get_markdown) (body) or
583
+ * `reader.get` (a field's declared type).
584
+ *
585
+ * **A content field at rest has one stored form per codec**: a `richtext`
586
+ * field holds the canonical content object, a `plaintext` field its literal
587
+ * string. A document that came through the bound door (`quill.parse` /
588
+ * `quill.conform`) is at rest, so this read no longer depends on which lane
589
+ * built it. A document that came through the transport door
590
+ * (`Document.fromMarkdown`, a legacy stored row) may rest as authored until
591
+ * it is conformed, and this read reports what is there. For the `Content`
592
+ * either way, use the schema-plane `reader.getContent`, which decodes
593
+ * through the codec the field's declared type names.
594
+ * @param {Addr | string} addr
595
+ * @returns {unknown}
596
+ */
597
+ getStored(addr) {
598
+ try {
599
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
600
+ wasm.document_getStored(retptr, this.__wbg_ptr, addHeapObject(addr));
601
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
602
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
603
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
604
+ if (r2) {
605
+ throw takeObject(r1);
606
+ }
607
+ return takeObject(r0);
608
+ } finally {
609
+ wasm.__wbindgen_add_to_stack_pointer(16);
610
+ }
611
+ }
612
+ /**
613
+ * Insert a card, the single insertion verb: `at` absent appends, a number
614
+ * inserts at that index (must be in `0..=cards.length`). Accepts a
615
+ * `CardInput`: a card read back (`cards` / `removeCard` / `quill.seedCard`),
616
+ * a [`makeCard`](Document::make_card) result, or a bare `{ kind, body }`
617
+ * (every returned `Card` is a valid `CardInput`). Throws if `card.kind` is
618
+ * not a valid kind name, or if `at` is out of range.
619
+ * @param {CardInput} card
620
+ * @param {number} [at]
621
+ */
622
+ insertCard(card, at) {
623
+ try {
624
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
625
+ wasm.document_insertCard(retptr, this.__wbg_ptr, addHeapObject(card), isLikeNone(at) ? 0x100000001 : (at) >>> 0);
626
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
627
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
628
+ if (r1) {
629
+ throw takeObject(r0);
630
+ }
631
+ } finally {
632
+ wasm.__wbindgen_add_to_stack_pointer(16);
633
+ }
634
+ }
635
+ /**
636
+ * Whether the field at `addr` is marked `!must_fill`. A bare string is `Addr`
637
+ * shorthand for `{ field }`. `false` for an absent field (truthful: it isn't
638
+ * marked) and for a body address (a body is never a fill). Only an
639
+ * out-of-range `addr.card` throws.
640
+ * @param {Addr | string} addr
641
+ * @returns {boolean}
642
+ */
643
+ isFill(addr) {
644
+ try {
645
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
646
+ wasm.document_isFill(retptr, this.__wbg_ptr, addHeapObject(addr));
647
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
648
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
649
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
650
+ if (r2) {
651
+ throw takeObject(r1);
652
+ }
653
+ return r0 !== 0;
654
+ } finally {
655
+ wasm.__wbindgen_add_to_stack_pointer(16);
656
+ }
657
+ }
658
+ /**
659
+ * Replace this document's contents **in place** from a versioned storage
660
+ * DTO string: the mutating twin of the static
661
+ * [`fromJson`](Document::from_json) constructor. Parse-time `warnings` are
662
+ * cleared. Throws (leaving the document unchanged) on an invalid DTO.
663
+ *
664
+ * The cross-WASM-memory `Document` bridge: mutate a document on a
665
+ * backend-memory clone, then write the mutated state back into the caller's
666
+ * canonical document with this, the one way to update a live handle across
667
+ * the linear-memory seam without the caller re-binding its variable.
668
+ * @param {string} json
669
+ */
670
+ loadJson(json) {
671
+ try {
672
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
673
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
674
+ const len0 = WASM_VECTOR_LEN;
675
+ wasm.document_loadJson(retptr, this.__wbg_ptr, ptr0, len0);
676
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
677
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
678
+ if (r1) {
679
+ throw takeObject(r0);
680
+ }
681
+ } finally {
682
+ wasm.__wbindgen_add_to_stack_pointer(16);
683
+ }
684
+ }
685
+ /**
686
+ * The document's main (entry) card. Allocates and serializes on each
687
+ * call: cache locally if read in a hot loop.
688
+ * @returns {Card}
689
+ */
690
+ get main() {
691
+ try {
692
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
693
+ wasm.document_main(retptr, this.__wbg_ptr);
694
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
695
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
696
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
697
+ if (r2) {
698
+ throw takeObject(r1);
699
+ }
700
+ return takeObject(r0);
701
+ } finally {
702
+ wasm.__wbindgen_add_to_stack_pointer(16);
703
+ }
704
+ }
705
+ /**
706
+ * Build a fresh `Card` from a kind and a flat field map: the ergonomic
707
+ * constructor for `insertCard`. `fields` is an optional
708
+ * `Record<string, unknown>` (each entry becomes a card field, in
709
+ * insertion order); `body` defaults to `""`.
710
+ *
711
+ * Sugar, not a required step: `insertCard` takes any `Card` object, and
712
+ * `removeCard` returns one, so a card round-trips without passing through
713
+ * here.
714
+ *
715
+ * Checks only what a detached card can decide alone: field-name grammar
716
+ * and value depth. Kind validity is positional (`main` is right for the
717
+ * root, reserved for a composable card) so `insertCard` is its gate, and
718
+ * any kind string is accepted here.
719
+ * @param {string} kind
720
+ * @param {Record<string, unknown>} [fields]
721
+ * @param {string} [body]
722
+ * @returns {Card}
723
+ */
724
+ static makeCard(kind, fields, body) {
725
+ try {
726
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
727
+ const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
728
+ const len0 = WASM_VECTOR_LEN;
729
+ var ptr1 = isLikeNone(body) ? 0 : passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
730
+ var len1 = WASM_VECTOR_LEN;
731
+ wasm.document_makeCard(retptr, ptr0, len0, isLikeNone(fields) ? 0 : addHeapObject(fields), ptr1, len1);
732
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
733
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
734
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
735
+ if (r2) {
736
+ throw takeObject(r1);
737
+ }
738
+ return takeObject(r0);
739
+ } finally {
740
+ wasm.__wbindgen_add_to_stack_pointer(16);
741
+ }
742
+ }
743
+ /**
744
+ * Move the card at `from` to position `to`. `from == to` is a no-op.
745
+ * @param {number} from
746
+ * @param {number} to
747
+ */
748
+ moveCard(from, to) {
749
+ try {
750
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
751
+ wasm.document_moveCard(retptr, this.__wbg_ptr, from, to);
752
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
753
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
754
+ if (r1) {
755
+ throw takeObject(r0);
756
+ }
757
+ } finally {
758
+ wasm.__wbindgen_add_to_stack_pointer(16);
759
+ }
760
+ }
761
+ /**
762
+ * `new Document(quillRef)`, a blank document: a main card carrying only
763
+ * `$quill`, an empty body, and no composable cards. The programmatic
764
+ * blank canvas: absent fields resolve at render time (`default`, else
765
+ * type-empty zero), so nothing the caller did not set reaches the
766
+ * output. For an example-filled starter use `Quill.seedDocument()`.
767
+ * Throws on an invalid quill reference. Mirrors Python `Document(quill_ref)`.
768
+ * @param {string} quill_ref
769
+ */
770
+ constructor(quill_ref) {
771
+ try {
772
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
773
+ const ptr0 = passStringToWasm0(quill_ref, wasm.__wbindgen_export, wasm.__wbindgen_export2);
774
+ const len0 = WASM_VECTOR_LEN;
775
+ wasm.document_new(retptr, ptr0, len0);
776
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
777
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
778
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
779
+ if (r2) {
780
+ throw takeObject(r1);
781
+ }
782
+ this.__wbg_ptr = r0 >>> 0;
783
+ DocumentFinalization.register(this, this.__wbg_ptr, this);
784
+ return this;
785
+ } finally {
786
+ wasm.__wbindgen_add_to_stack_pointer(16);
787
+ }
788
+ }
789
+ /**
790
+ * **Overwrite** the content value at `addr`: **value semantics**, content
791
+ * only. Stores exactly `rt` (a canonical `Content` content object); the
792
+ * identity anchors of any previous value are gone. The bottom rung of the
793
+ * content lane's ladder by anchor fate: `overwrite` destroys,
794
+ * [`revise`](Document::revise) rebases,
795
+ * [`applyChange`](Document::apply_change) preserves. An absent `addr.field`
796
+ * targets the body, an absent `addr.card` the main card. Cold-importing
797
+ * markdown is spelled `overwrite(addr, importMarkdown(md))` at the call
798
+ * site, where the anchor loss is visible.
799
+ *
800
+ * Throws on an out-of-range card, a malformed field name, or an `rt` that is
801
+ * not a canonical content object.
802
+ * @param {Addr | string} addr
803
+ * @param {Content} rt
804
+ */
805
+ overwrite(addr, rt) {
806
+ try {
807
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
808
+ wasm.document_overwrite(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(rt));
809
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
810
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
811
+ if (r1) {
812
+ throw takeObject(r0);
813
+ }
814
+ } finally {
815
+ wasm.__wbindgen_add_to_stack_pointer(16);
816
+ }
817
+ }
818
+ /**
819
+ * @returns {string}
820
+ */
821
+ get quillRef() {
822
+ let deferred1_0;
823
+ let deferred1_1;
824
+ try {
825
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
826
+ wasm.document_quillRef(retptr, this.__wbg_ptr);
827
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
828
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
829
+ deferred1_0 = r0;
830
+ deferred1_1 = r1;
831
+ return getStringFromWasm0(r0, r1);
832
+ } finally {
833
+ wasm.__wbindgen_add_to_stack_pointer(16);
834
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
835
+ }
836
+ }
837
+ /**
838
+ * The canonical `$quill` reference grammar as author-facing text. Core is
839
+ * the single source of truth: drive schema `describe` and validation
840
+ * messages from this instead of re-stating the rule; it matches the
841
+ * `hint` on `parse::invalid_quill_reference`. Cache it; the value never
842
+ * changes.
843
+ * @returns {string}
844
+ */
845
+ static quillRefHint() {
846
+ let deferred1_0;
847
+ let deferred1_1;
848
+ try {
849
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
850
+ wasm.document_quillRefHint(retptr);
851
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
852
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
853
+ deferred1_0 = r0;
854
+ deferred1_1 = r1;
855
+ return getStringFromWasm0(r0, r1);
856
+ } finally {
857
+ wasm.__wbindgen_add_to_stack_pointer(16);
858
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
859
+ }
860
+ }
861
+ /**
862
+ * @param {number} index
863
+ * @returns {Card | undefined}
864
+ */
865
+ removeCard(index) {
866
+ try {
867
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
868
+ wasm.document_removeCard(retptr, this.__wbg_ptr, index);
869
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
870
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
871
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
872
+ if (r2) {
873
+ throw takeObject(r1);
874
+ }
875
+ return takeObject(r0);
876
+ } finally {
877
+ wasm.__wbindgen_add_to_stack_pointer(16);
878
+ }
879
+ }
880
+ /**
881
+ * Remove the `$ext` map on the card `addr` targets *entirely*, returning the
882
+ * previous map or `undefined`: a blunt escape hatch that discards every
883
+ * namespace at once (prefer `removeExtNamespace`). `addr` is a card address
884
+ * (absent = main). Throws on a present `field` or an out-of-range card.
885
+ * @param {CardAddr} [addr]
886
+ * @returns {Record<string, unknown> | undefined}
887
+ */
888
+ removeExt(addr) {
889
+ try {
890
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
891
+ wasm.document_removeExt(retptr, this.__wbg_ptr, addHeapObject(addr));
892
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
893
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
894
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
895
+ if (r2) {
896
+ throw takeObject(r1);
897
+ }
898
+ return takeObject(r0);
899
+ } finally {
900
+ wasm.__wbindgen_add_to_stack_pointer(16);
901
+ }
902
+ }
903
+ /**
904
+ * Remove `$ext[ns]` on the card `addr` targets, returning its value or
905
+ * `undefined`; drops `$ext` once empty. `addr` is a card address (absent =
906
+ * main). Preserves sibling namespaces. Throws on a present `field` or an
907
+ * out-of-range card.
908
+ * @param {CardAddr} addr
909
+ * @param {string} ns
910
+ * @returns {any}
911
+ */
912
+ removeExtNamespace(addr, ns) {
913
+ try {
914
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
915
+ const ptr0 = passStringToWasm0(ns, wasm.__wbindgen_export, wasm.__wbindgen_export2);
916
+ const len0 = WASM_VECTOR_LEN;
917
+ wasm.document_removeExtNamespace(retptr, this.__wbg_ptr, addHeapObject(addr), ptr0, len0);
918
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
919
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
920
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
921
+ if (r2) {
922
+ throw takeObject(r1);
923
+ }
924
+ return takeObject(r0);
925
+ } finally {
926
+ wasm.__wbindgen_add_to_stack_pointer(16);
927
+ }
928
+ }
929
+ /**
930
+ * Remove a field at `addr`, returning the removed value or `undefined`. A
931
+ * bare string is `Addr` shorthand for `{ field }`. One `remove` verb serves
932
+ * every write lane. A body address throws; throws on an out-of-range card or
933
+ * a malformed name.
934
+ * @param {Addr | string} addr
935
+ * @returns {any}
936
+ */
937
+ removeField(addr) {
938
+ try {
939
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
940
+ wasm.document_removeField(retptr, this.__wbg_ptr, addHeapObject(addr));
941
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
942
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
943
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
944
+ if (r2) {
945
+ throw takeObject(r1);
946
+ }
947
+ return takeObject(r0);
948
+ } finally {
949
+ wasm.__wbindgen_add_to_stack_pointer(16);
950
+ }
951
+ }
952
+ /**
953
+ * Remove `cardKind` from the main card's `$seed` map, returning its
954
+ * overlay or `undefined`; drops `$seed` entirely once empty. Sibling kinds
955
+ * survive. `$seed` is main-only, so this takes no address.
956
+ * @param {string} card_kind
957
+ * @returns {any}
958
+ */
959
+ removeSeedOverlay(card_kind) {
960
+ try {
961
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
962
+ const ptr0 = passStringToWasm0(card_kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
963
+ const len0 = WASM_VECTOR_LEN;
964
+ wasm.document_removeSeedOverlay(retptr, this.__wbg_ptr, ptr0, len0);
965
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
966
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
967
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
968
+ if (r2) {
969
+ throw takeObject(r1);
970
+ }
971
+ return takeObject(r0);
972
+ } finally {
973
+ wasm.__wbindgen_add_to_stack_pointer(16);
974
+ }
975
+ }
976
+ /**
977
+ * **Revise** the richtext value at `addr` from a markdown string: **edit
978
+ * semantics**, the default write path, returning the text `Delta`. Imports
979
+ * the markdown, diffs it against the current value, rebases surviving
980
+ * identity anchors, and returns the change an editor bridge maps its own
981
+ * positions through (`mapPos`). An absent `addr.field` targets the body, an
982
+ * absent `addr.card` the main card; an absent field cold-imports from empty.
983
+ *
984
+ * Throws on an out-of-range card, a malformed field name, a present
985
+ * non-content field value, or an over-nested markdown input.
986
+ * @param {Addr | string} addr
987
+ * @param {string} markdown
988
+ * @returns {Delta}
989
+ */
990
+ revise(addr, markdown) {
991
+ try {
992
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
993
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
994
+ const len0 = WASM_VECTOR_LEN;
995
+ wasm.document_revise(retptr, this.__wbg_ptr, addHeapObject(addr), ptr0, len0);
996
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
997
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
998
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
999
+ if (r2) {
1000
+ throw takeObject(r1);
1001
+ }
1002
+ return takeObject(r0);
1003
+ } finally {
1004
+ wasm.__wbindgen_add_to_stack_pointer(16);
1005
+ }
1006
+ }
1007
+ /**
1008
+ * The main card's `$seed` overlay object for `kind` (the `$seed[kind]`
1009
+ * entry), or `undefined` when absent. The cheap read that feeds
1010
+ * `quill.seedCard(kind, overlay)` without serializing the whole main card
1011
+ * via [`main`](Self::main) to fish out one key, and it keeps `seedCard`
1012
+ * pure: the quill still never reads the document.
1013
+ * @param {string} kind
1014
+ * @returns {Record<string, unknown> | undefined}
1015
+ */
1016
+ seedOverlay(kind) {
1017
+ try {
1018
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1019
+ const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1020
+ const len0 = WASM_VECTOR_LEN;
1021
+ wasm.document_seedOverlay(retptr, this.__wbg_ptr, ptr0, len0);
1022
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1023
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1024
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1025
+ if (r2) {
1026
+ throw takeObject(r1);
1027
+ }
1028
+ return takeObject(r0);
1029
+ } finally {
1030
+ wasm.__wbindgen_add_to_stack_pointer(16);
1031
+ }
1032
+ }
1033
+ /**
1034
+ * Replace the kind of the card at `index`. Payload and body are untouched;
1035
+ * schema-aware migration is the caller's responsibility.
1036
+ * Throws if `index` is out of range or `newKind` is invalid.
1037
+ * @param {number} index
1038
+ * @param {string} new_kind
1039
+ */
1040
+ setCardKind(index, new_kind) {
1041
+ try {
1042
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1043
+ const ptr0 = passStringToWasm0(new_kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1044
+ const len0 = WASM_VECTOR_LEN;
1045
+ wasm.document_setCardKind(retptr, this.__wbg_ptr, index, ptr0, len0);
1046
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1047
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1048
+ if (r1) {
1049
+ throw takeObject(r0);
1050
+ }
1051
+ } finally {
1052
+ wasm.__wbindgen_add_to_stack_pointer(16);
1053
+ }
1054
+ }
1055
+ /**
1056
+ * Replace the QUILL reference string. Throws if `ref_str` is invalid.
1057
+ * @param {string} ref_str
1058
+ */
1059
+ setQuillRef(ref_str) {
1060
+ try {
1061
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1062
+ const ptr0 = passStringToWasm0(ref_str, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1063
+ const len0 = WASM_VECTOR_LEN;
1064
+ wasm.document_setQuillRef(retptr, this.__wbg_ptr, ptr0, len0);
1065
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1066
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1067
+ if (r1) {
1068
+ throw takeObject(r0);
1069
+ }
1070
+ } finally {
1071
+ wasm.__wbindgen_add_to_stack_pointer(16);
1072
+ }
1073
+ }
1074
+ /**
1075
+ * Read the storage version tag from a raw storage DTO string without a
1076
+ * full parse, or `undefined`. Returns unknown future versions as-is:
1077
+ * useful to distinguish "build too old" from "payload corrupt" when
1078
+ * `fromJson` throws.
1079
+ *
1080
+ * The storage version, not a field schema ([`schema`](Quill::schema) is the
1081
+ * quill's field declarations). The JSON key is spelled `"schema"`: it is
1082
+ * the DTO's serde tag, and retagging it would break the version dispatch
1083
+ * it drives.
1084
+ * @param {string} json
1085
+ * @returns {string | undefined}
1086
+ */
1087
+ static storageVersionOf(json) {
1088
+ try {
1089
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1090
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1091
+ const len0 = WASM_VECTOR_LEN;
1092
+ wasm.document_storageVersionOf(retptr, ptr0, len0);
1093
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1094
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1095
+ let v2;
1096
+ if (r0 !== 0) {
1097
+ v2 = getStringFromWasm0(r0, r1).slice();
1098
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
1099
+ }
1100
+ return v2;
1101
+ } finally {
1102
+ wasm.__wbindgen_add_to_stack_pointer(16);
1103
+ }
1104
+ }
1105
+ /**
1106
+ * Replace the opaque `$ext` map on the card `addr` targets (a card address,
1107
+ * absent `card` = main). `value` must be a plain object. `$ext` carries
1108
+ * out-of-band consumer state and never reaches the rendered output; pass
1109
+ * `{}` for an explicit empty `$ext`. Quill-free and verbatim: an opaque
1110
+ * `store` verb. Throws on a present `field` or an out-of-range card.
1111
+ * @param {CardAddr} addr
1112
+ * @param {any} value
1113
+ */
1114
+ storeExt(addr, value) {
1115
+ try {
1116
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1117
+ wasm.document_storeExt(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(value));
1118
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1119
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1120
+ if (r1) {
1121
+ throw takeObject(r0);
1122
+ }
1123
+ } finally {
1124
+ wasm.__wbindgen_add_to_stack_pointer(16);
1125
+ }
1126
+ }
1127
+ /**
1128
+ * Merge `value` into `$ext[ns]` on the card `addr` targets, preserving
1129
+ * sibling namespaces: the recommended `$ext` write. `addr` is a card
1130
+ * address (absent = main). Quill-free and verbatim: an opaque `store` verb.
1131
+ * Throws on a present `field` or an out-of-range card.
1132
+ * @param {CardAddr} addr
1133
+ * @param {string} ns
1134
+ * @param {any} value
1135
+ */
1136
+ storeExtNamespace(addr, ns, value) {
1137
+ try {
1138
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1139
+ const ptr0 = passStringToWasm0(ns, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1140
+ const len0 = WASM_VECTOR_LEN;
1141
+ wasm.document_storeExtNamespace(retptr, this.__wbg_ptr, addHeapObject(addr), ptr0, len0, addHeapObject(value));
1142
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1143
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1144
+ if (r1) {
1145
+ throw takeObject(r0);
1146
+ }
1147
+ } finally {
1148
+ wasm.__wbindgen_add_to_stack_pointer(16);
1149
+ }
1150
+ }
1151
+ /**
1152
+ * Store a field verbatim at `addr`: the opaque store (**store** = verbatim,
1153
+ * coercion deferred to render; the typed write is
1154
+ * [`commitField`](Document::commit_field)). A bare string is `Addr`
1155
+ * shorthand for `{ field }`, so `doc.storeField("qty", 3)` reads as written;
1156
+ * `{ card: 2, field: "qty" }` targets a composable card. Clears any
1157
+ * `!must_fill` marker. A body address (no `field`) throws: a body is never
1158
+ * opaque; write it with `revise` / `overwrite` / `writer.reviseBody`. Throws on
1159
+ * an out-of-range card or a malformed name.
1160
+ * @param {Addr | string} addr
1161
+ * @param {any} value
1162
+ */
1163
+ storeField(addr, value) {
1164
+ try {
1165
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1166
+ wasm.document_storeField(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(value));
1167
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1168
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1169
+ if (r1) {
1170
+ throw takeObject(r0);
1171
+ }
1172
+ } finally {
1173
+ wasm.__wbindgen_add_to_stack_pointer(16);
1174
+ }
1175
+ }
1176
+ /**
1177
+ * Store several fields verbatim and atomically on the card `addr` targets:
1178
+ * the opaque store's batch. `addr` is a **card address** (`{ card }`, absent
1179
+ * = main); a present `field` throws. The batch verb takes the address first
1180
+ * and is never shape-overloaded, because `card` is a legal field name:
1181
+ * `storeFields({}, fields)` is the main card, `storeFields({ card: 2 },
1182
+ * fields)` a composable one, never ambiguous with "set field `card`".
1183
+ * Nothing is applied on error; the thrown error's `diagnostics` carry one
1184
+ * entry per offending field. Throws on an out-of-range card.
1185
+ * @param {CardAddr} addr
1186
+ * @param {Record<string, unknown>} fields
1187
+ */
1188
+ storeFields(addr, fields) {
1189
+ try {
1190
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1191
+ wasm.document_storeFields(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(fields));
1192
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1193
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1194
+ if (r1) {
1195
+ throw takeObject(r0);
1196
+ }
1197
+ } finally {
1198
+ wasm.__wbindgen_add_to_stack_pointer(16);
1199
+ }
1200
+ }
1201
+ /**
1202
+ * Store a field verbatim at `addr` and mark it `!must_fill`: the opaque
1203
+ * store's fill variant, card-capable (a bare string or `{ field }` for main,
1204
+ * `{ card, field }` for a composable card). A body address throws. Same
1205
+ * validation as [`storeField`](Document::store_field).
1206
+ * @param {Addr | string} addr
1207
+ * @param {any} value
1208
+ */
1209
+ storeFill(addr, value) {
1210
+ try {
1211
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1212
+ wasm.document_storeFill(retptr, this.__wbg_ptr, addHeapObject(addr), addHeapObject(value));
1213
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1214
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1215
+ if (r1) {
1216
+ throw takeObject(r0);
1217
+ }
1218
+ } finally {
1219
+ wasm.__wbindgen_add_to_stack_pointer(16);
1220
+ }
1221
+ }
1222
+ /**
1223
+ * Merge a card-kind's seed `overlay` into the **main** card's `$seed` map
1224
+ * under `cardKind`, preserving sibling kinds: `$seed` lives on the main
1225
+ * card by model, so this takes no address. Sets the starting values new
1226
+ * cards of that kind spawn with. Quill-free and verbatim: an opaque `store`
1227
+ * verb. Throws if `overlay` cannot be serialized or nests too deep.
1228
+ * @param {string} card_kind
1229
+ * @param {any} overlay
1230
+ */
1231
+ storeSeedOverlay(card_kind, overlay) {
1232
+ try {
1233
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1234
+ const ptr0 = passStringToWasm0(card_kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1235
+ const len0 = WASM_VECTOR_LEN;
1236
+ wasm.document_storeSeedOverlay(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(overlay));
1237
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1238
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1239
+ if (r1) {
1240
+ throw takeObject(r0);
1241
+ }
1242
+ } finally {
1243
+ wasm.__wbindgen_add_to_stack_pointer(16);
1244
+ }
1245
+ }
1246
+ /**
1247
+ * Serialize this document to a versioned storage DTO string.
1248
+ *
1249
+ * Prefer this over `toMarkdown` for persistence across restarts or crate
1250
+ * upgrades: the wire format is frozen per `schema` version. Parse-time
1251
+ * `warnings` are excluded from the DTO.
1252
+ *
1253
+ * Output is **byte-deterministic** within a `schema` version: equal
1254
+ * documents produce byte-equal output, safe for content-hash use cases.
1255
+ * @returns {string}
1256
+ */
1257
+ toJson() {
1258
+ let deferred1_0;
1259
+ let deferred1_1;
1260
+ try {
1261
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1262
+ wasm.document_toJson(retptr, this.__wbg_ptr);
1263
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1264
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1265
+ deferred1_0 = r0;
1266
+ deferred1_1 = r1;
1267
+ return getStringFromWasm0(r0, r1);
1268
+ } finally {
1269
+ wasm.__wbindgen_add_to_stack_pointer(16);
1270
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1271
+ }
1272
+ }
1273
+ /**
1274
+ * Emit canonical Quillmark Markdown. Round-trip safe: re-parsing the
1275
+ * result produces a `Document` equal to `self` by value and by type.
1276
+ * @returns {string}
1277
+ */
1278
+ toMarkdown() {
1279
+ let deferred1_0;
1280
+ let deferred1_1;
1281
+ try {
1282
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1283
+ wasm.document_toMarkdown(retptr, this.__wbg_ptr);
1284
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1285
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1286
+ deferred1_0 = r0;
1287
+ deferred1_1 = r1;
1288
+ return getStringFromWasm0(r0, r1);
1289
+ } finally {
1290
+ wasm.__wbindgen_add_to_stack_pointer(16);
1291
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1292
+ }
1293
+ }
1294
+ /**
1295
+ * Like [`fromJson`](Document::from_json) but returns `undefined` instead
1296
+ * of throwing when `json` is not a valid storage DTO: use to
1297
+ * discriminate format without exceptions as control flow.
1298
+ * `undefined` means "not a storage DTO"; `fromMarkdown` still throws on
1299
+ * genuinely malformed markdown.
1300
+ * @param {string} json
1301
+ * @returns {Document | undefined}
1302
+ */
1303
+ static tryFromJson(json) {
1304
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1305
+ const len0 = WASM_VECTOR_LEN;
1306
+ const ret = wasm.document_tryFromJson(ptr0, len0);
1307
+ return ret === 0 ? undefined : Document.__wrap(ret);
1308
+ }
1309
+ /**
1310
+ * The non-fatal diagnostics of the load that produced this document: parse
1311
+ * warnings, plus the `conform::*` warnings when it came through
1312
+ * `quill.parse`. Session state, not document value: `equals` and the
1313
+ * storage DTO exclude it, and `fromJson` / `loadJson` clear it.
1314
+ * @returns {Diagnostic[]}
1315
+ */
1316
+ get warnings() {
1317
+ try {
1318
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1319
+ wasm.document_warnings(retptr, this.__wbg_ptr);
1320
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1321
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1322
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1323
+ if (r2) {
1324
+ throw takeObject(r1);
1325
+ }
1326
+ return takeObject(r0);
1327
+ } finally {
1328
+ wasm.__wbindgen_add_to_stack_pointer(16);
1329
+ }
1330
+ }
1331
+ }
1332
+ if (Symbol.dispose) Document.prototype[Symbol.dispose] = Document.prototype.free;
1333
+
1334
+ export class Quill {
1335
+ static __wrap(ptr) {
1336
+ ptr = ptr >>> 0;
1337
+ const obj = Object.create(Quill.prototype);
1338
+ obj.__wbg_ptr = ptr;
1339
+ QuillFinalization.register(obj, obj.__wbg_ptr, obj);
1340
+ return obj;
1341
+ }
1342
+ __destroy_into_raw() {
1343
+ const ptr = this.__wbg_ptr;
1344
+ this.__wbg_ptr = 0;
1345
+ QuillFinalization.unregister(this);
1346
+ return ptr;
1347
+ }
1348
+ free() {
1349
+ const ptr = this.__destroy_into_raw();
1350
+ wasm.__wbg_quill_free(ptr, 0);
1351
+ }
1352
+ /**
1353
+ * The *declared* backend identifier (`config.backend`, e.g. `"typst"`).
1354
+ * Intent, not a resolved capability: capability (`supportedFormats` /
1355
+ * `supportsCanvas`) is read from the engine.
1356
+ * @returns {string}
1357
+ */
1358
+ get backendId() {
1359
+ let deferred1_0;
1360
+ let deferred1_1;
1361
+ try {
1362
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1363
+ wasm.quill_backendId(retptr, this.__wbg_ptr);
1364
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1365
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1366
+ deferred1_0 = r0;
1367
+ deferred1_1 = r1;
1368
+ return getStringFromWasm0(r0, r1);
1369
+ } finally {
1370
+ wasm.__wbindgen_add_to_stack_pointer(16);
1371
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1372
+ }
1373
+ }
1374
+ /**
1375
+ * @returns {string}
1376
+ */
1377
+ get blueprint() {
1378
+ let deferred1_0;
1379
+ let deferred1_1;
1380
+ try {
1381
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1382
+ wasm.quill_blueprint(retptr, this.__wbg_ptr);
1383
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1384
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1385
+ deferred1_0 = r0;
1386
+ deferred1_1 = r1;
1387
+ return getStringFromWasm0(r0, r1);
1388
+ } finally {
1389
+ wasm.__wbindgen_add_to_stack_pointer(16);
1390
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
1391
+ }
1392
+ }
1393
+ /**
1394
+ * Land `doc`'s declared content fields at their canonical rest **in
1395
+ * place**, returning the `conform::*` diagnostics for the values that would
1396
+ * not commit (an empty array when everything rested).
1397
+ *
1398
+ * The read-repair verb: a document that arrived through the transport door
1399
+ * (`fromMarkdown`, `fromJson`, a stored row) converges here, and is then
1400
+ * eligible for rewrite under its current schema tag. Idempotent, and a
1401
+ * no-op on an already-canonical document: an equal value is not rewritten,
1402
+ * so YAML comments and stored bytes survive.
1403
+ *
1404
+ * A `!must_fill` marker anywhere in a field's value skips that field (the
1405
+ * marker is the state), and a value the strict write refuses stays as
1406
+ * authored with a diagnostic. Throws when `doc` declares a different
1407
+ * `$quill`, before any mutation.
1408
+ * @param {Document} doc
1409
+ * @returns {Diagnostic[]}
1410
+ */
1411
+ conform(doc) {
1412
+ try {
1413
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1414
+ _assertClass(doc, Document);
1415
+ wasm.quill_conform(retptr, this.__wbg_ptr, doc.__wbg_ptr);
1416
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1417
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1418
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1419
+ if (r2) {
1420
+ throw takeObject(r1);
1421
+ }
1422
+ return takeObject(r0);
1423
+ } finally {
1424
+ wasm.__wbindgen_add_to_stack_pointer(16);
1425
+ }
1426
+ }
1427
+ /**
1428
+ * Build a quill from a file tree. Pure: no backend, no engine; the
1429
+ * declared backend is resolved later, at render time.
1430
+ *
1431
+ * Accepts either a `Map<string, Uint8Array>` or a plain object
1432
+ * (`Record<string, Uint8Array>`). Plain objects are walked via
1433
+ * `Object.entries` at the boundary; the Rust side sees a single
1434
+ * canonical shape.
1435
+ * @param {Map<string, Uint8Array>} tree
1436
+ * @returns {Quill}
1437
+ */
1438
+ static fromTree(tree) {
1439
+ try {
1440
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1441
+ wasm.quill_fromTree(retptr, addHeapObject(tree));
1442
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1443
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1444
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1445
+ if (r2) {
1446
+ throw takeObject(r1);
1447
+ }
1448
+ return Quill.__wrap(r0);
1449
+ } finally {
1450
+ wasm.__wbindgen_add_to_stack_pointer(16);
1451
+ }
1452
+ }
1453
+ /**
1454
+ * Identity snapshot of the `quill:` section of `Quill.yaml` plus any extra
1455
+ * `quill:` keys. Pure config: the backend's output formats are a
1456
+ * resolved-backend capability read from the engine
1457
+ * (`Quillmark.supportedFormats`), not part of this snapshot.
1458
+ * @returns {QuillMetadata}
1459
+ */
1460
+ get metadata() {
1461
+ try {
1462
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1463
+ wasm.quill_metadata(retptr, this.__wbg_ptr);
1464
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1465
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1466
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1467
+ if (r2) {
1468
+ throw takeObject(r1);
1469
+ }
1470
+ return takeObject(r0);
1471
+ } finally {
1472
+ wasm.__wbindgen_add_to_stack_pointer(16);
1473
+ }
1474
+ }
1475
+ /**
1476
+ * Parse `markdown` and conform it against this quill: the **primary
1477
+ * ingestion path**, and the bound twin of the schema-free
1478
+ * `Document.fromMarkdown`. The returned document rests at its canonical
1479
+ * form (a `richtext` field as a content object, a `plaintext` field as its
1480
+ * literal string), so `getStored` answers "content object or string?" by the
1481
+ * field's declared codec rather than by how the document was built.
1482
+ *
1483
+ * Parse warnings and the `conform::*` diagnostics both land on
1484
+ * `doc.warnings`. Throws on a parse failure, or when `markdown` declares a
1485
+ * `$quill` this quill does not answer to: nothing conforms under the wrong
1486
+ * schema. To open a document whose `$quill` is stale, use the transport
1487
+ * door (`Document.fromMarkdown`, `setQuillRef`, then `quill.conform`).
1488
+ * @param {string} markdown
1489
+ * @returns {Document}
1490
+ */
1491
+ parse(markdown) {
1492
+ try {
1493
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1494
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1495
+ const len0 = WASM_VECTOR_LEN;
1496
+ wasm.quill_parse(retptr, this.__wbg_ptr, ptr0, len0);
1497
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1498
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1499
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1500
+ if (r2) {
1501
+ throw takeObject(r1);
1502
+ }
1503
+ return Document.__wrap(r0);
1504
+ } finally {
1505
+ wasm.__wbindgen_add_to_stack_pointer(16);
1506
+ }
1507
+ }
1508
+ /**
1509
+ * The resolved-value view of `doc` against this quill's schema: for every
1510
+ * declared field the value the render projection would use and the
1511
+ * `FieldSource` rung it came from (`"authored" | "default" | "zero"`), in
1512
+ * one call. The card body is a `body` sibling on its card (row `name`
1513
+ * `"body"`), never a row in `fields`: `null` when the kind enables no body.
1514
+ *
1515
+ * Value and provenance only: completeness and errors stay `validate`'s
1516
+ * (a consumer merges it with its own diagnostic producers regardless), and
1517
+ * schema guidance reads from `Quill.schema`.
1518
+ * @param {Document} doc
1519
+ * @returns {Resolved}
1520
+ */
1521
+ resolve(doc) {
1522
+ try {
1523
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1524
+ _assertClass(doc, Document);
1525
+ wasm.quill_resolve(retptr, this.__wbg_ptr, doc.__wbg_ptr);
1526
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1527
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1528
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1529
+ if (r2) {
1530
+ throw takeObject(r1);
1531
+ }
1532
+ return takeObject(r0);
1533
+ } finally {
1534
+ wasm.__wbindgen_add_to_stack_pointer(16);
1535
+ }
1536
+ }
1537
+ /**
1538
+ * Document schema for the quill: the user-fillable fields plus their
1539
+ * `ui` hints (title / group / compact / multiline). The single
1540
+ * field-metadata surface: drives form editors and LLM/MCP consumers
1541
+ * alike. Key order in `fields`/`properties` is declaration order: the
1542
+ * ordering contract. Returns the `QuillSchema` shape.
1543
+ * @returns {QuillSchema}
1544
+ */
1545
+ get schema() {
1546
+ try {
1547
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1548
+ wasm.quill_schema(retptr, this.__wbg_ptr);
1549
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1550
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1551
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1552
+ if (r2) {
1553
+ throw takeObject(r1);
1554
+ }
1555
+ return takeObject(r0);
1556
+ } finally {
1557
+ wasm.__wbindgen_add_to_stack_pointer(16);
1558
+ }
1559
+ }
1560
+ /**
1561
+ * Seed a starter composable `Card` of the given kind (carries `$kind`),
1562
+ * layering an optional per-kind seed `overlay` over the schema-example
1563
+ * base (`overlay › example › absent`). Returns `undefined` if `cardKind`
1564
+ * is not declared in this quill's schema, else a `Card` that feeds
1565
+ * straight into `Document.insertCard`.
1566
+ *
1567
+ * Pass `document.seedOverlay(cardKind)` as `overlay` so a card added to a
1568
+ * template-derived document inherits its curated starting values; omit it
1569
+ * (or pass `undefined` / `null`) for the bare schema seed. `overlay` is a
1570
+ * plain object: this reads the document, it does not mutate it.
1571
+ * @param {string} card_kind
1572
+ * @param {Record<string, unknown> | undefined} overlay
1573
+ * @returns {Card | undefined}
1574
+ */
1575
+ seedCard(card_kind, overlay) {
1576
+ try {
1577
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1578
+ const ptr0 = passStringToWasm0(card_kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1579
+ const len0 = WASM_VECTOR_LEN;
1580
+ wasm.quill_seedCard(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(overlay));
1581
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1582
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1583
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1584
+ if (r2) {
1585
+ throw takeObject(r1);
1586
+ }
1587
+ return takeObject(r0);
1588
+ } finally {
1589
+ wasm.__wbindgen_add_to_stack_pointer(16);
1590
+ }
1591
+ }
1592
+ /**
1593
+ * Seed a starter `Document` from the schema, the main card plus one
1594
+ * instance of each composable card kind, each committing its fields'
1595
+ * `example:` values and leaving every other field absent (interpolated at
1596
+ * render: `default:`, else type-empty zero). Illustration-first: a field
1597
+ * with both an `example` and a `default` renders its example. See
1598
+ * `prose/canon/SCHEMAS.md` § "Document seeding".
1599
+ * @returns {Document}
1600
+ */
1601
+ seedDocument() {
1602
+ const ret = wasm.quill_seedDocument(this.__wbg_ptr);
1603
+ return Document.__wrap(ret);
1604
+ }
1605
+ /**
1606
+ * Seed a starter main `Card` (carries `$quill`) from the schema: the
1607
+ * `$kind: main` card of [`seedDocument`](Self::seed_document) in
1608
+ * isolation, committing each field's `example:` value. Returns the same
1609
+ * `Card` shape as the `Document.main` getter.
1610
+ * @returns {Card}
1611
+ */
1612
+ seedMain() {
1613
+ try {
1614
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1615
+ wasm.quill_seedMain(retptr, this.__wbg_ptr);
1616
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1617
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1618
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1619
+ if (r2) {
1620
+ throw takeObject(r1);
1621
+ }
1622
+ return takeObject(r0);
1623
+ } finally {
1624
+ wasm.__wbindgen_add_to_stack_pointer(16);
1625
+ }
1626
+ }
1627
+ /**
1628
+ * Flatten this quill back into its canonical file tree: the inverse of
1629
+ * [`fromTree`](Self::from_tree). Round-trips: `Quill.fromTree(q.toTree())`
1630
+ * reproduces an equivalent quill.
1631
+ *
1632
+ * This is how a quill crosses a WASM linear-memory boundary as data: a
1633
+ * `Quill` built in one build (e.g. the Typst-less `@quillmark/wasm/core`)
1634
+ * cannot be passed to an engine in another (separate linear memories), so
1635
+ * `@quillmark/wasm/runtime` re-feeds this tree to the backend build's
1636
+ * `Quill.fromTree` on demand. Keys are `"/"`-joined relative paths,
1637
+ * matching what `fromTree` accepts.
1638
+ * @returns {Map<string, Uint8Array>}
1639
+ */
1640
+ toTree() {
1641
+ const ret = wasm.quill_toTree(this.__wbg_ptr);
1642
+ return takeObject(ret);
1643
+ }
1644
+ /**
1645
+ * Validate `doc` against this quill's schema, returning every diagnostic
1646
+ * (an empty array when the document is valid).
1647
+ *
1648
+ * Forwards the canonical `validation::*` diagnostics (same `code`,
1649
+ * `path`, and `hint` the engine emits) including the non-fatal
1650
+ * `validation::must_fill` warning for each `!must_fill` marker left in
1651
+ * the document. Field values, defaults, and order are not part of this
1652
+ * surface: read them from the `Document` payload and `Quill.schema`
1653
+ * (schema key order is display order).
1654
+ * @param {Document} doc
1655
+ * @returns {Diagnostic[]}
1656
+ */
1657
+ validate(doc) {
1658
+ try {
1659
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1660
+ _assertClass(doc, Document);
1661
+ wasm.quill_validate(retptr, this.__wbg_ptr, doc.__wbg_ptr);
1662
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1663
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1664
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1665
+ if (r2) {
1666
+ throw takeObject(r1);
1667
+ }
1668
+ return takeObject(r0);
1669
+ } finally {
1670
+ wasm.__wbindgen_add_to_stack_pointer(16);
1671
+ }
1672
+ }
1673
+ }
1674
+ if (Symbol.dispose) Quill.prototype[Symbol.dispose] = Quill.prototype.free;
1675
+
1676
+ /**
1677
+ * Export a canonical `Content` content to its markdown projection: the pure
1678
+ * on-demand codec behind `exportMarkdown(card.body)`. Throws if `rt` is not a
1679
+ * canonical content.
1680
+ * @param {Content} rt
1681
+ * @returns {string}
1682
+ */
1683
+ export function exportMarkdown(rt) {
1684
+ let deferred2_0;
1685
+ let deferred2_1;
1686
+ try {
1687
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1688
+ wasm.exportMarkdown(retptr, addHeapObject(rt));
1689
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1690
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1691
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1692
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1693
+ var ptr1 = r0;
1694
+ var len1 = r1;
1695
+ if (r3) {
1696
+ ptr1 = 0; len1 = 0;
1697
+ throw takeObject(r2);
1698
+ }
1699
+ deferred2_0 = ptr1;
1700
+ deferred2_1 = len1;
1701
+ return getStringFromWasm0(ptr1, len1);
1702
+ } finally {
1703
+ wasm.__wbindgen_add_to_stack_pointer(16);
1704
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
1705
+ }
1706
+ }
1707
+
1708
+ /**
1709
+ * Serialize structured [`DocPathSeg`] segments back to the canonical path
1710
+ * string: the inverse of `parseDocPath`, for a consumer that builds a path
1711
+ * rather than reads one. Throws on a segment array the deserializer rejects,
1712
+ * and on an empty segment array (symmetric with `parseDocPath("")`, which
1713
+ * throws "empty path").
1714
+ * @param {DocPathSeg[]} segs
1715
+ * @returns {string}
1716
+ */
1717
+ export function formatDocPath(segs) {
1718
+ let deferred2_0;
1719
+ let deferred2_1;
1720
+ try {
1721
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1722
+ wasm.formatDocPath(retptr, addHeapObject(segs));
1723
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1724
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1725
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1726
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1727
+ var ptr1 = r0;
1728
+ var len1 = r1;
1729
+ if (r3) {
1730
+ ptr1 = 0; len1 = 0;
1731
+ throw takeObject(r2);
1732
+ }
1733
+ deferred2_0 = ptr1;
1734
+ deferred2_1 = len1;
1735
+ return getStringFromWasm0(ptr1, len1);
1736
+ } finally {
1737
+ wasm.__wbindgen_add_to_stack_pointer(16);
1738
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
1739
+ }
1740
+ }
1741
+
1742
+ /**
1743
+ * Import a markdown string to a canonical `Content` content: the pure,
1744
+ * document-free codec. Pair with `overwrite(addr, importMarkdown(md))` to spell
1745
+ * the cold (anchor-losing) write at the call site; prefer `revise` for edit
1746
+ * semantics. Throws on an over-nested input.
1747
+ * @param {string} markdown
1748
+ * @returns {Content}
1749
+ */
1750
+ export function importMarkdown(markdown) {
1751
+ try {
1752
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1753
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1754
+ const len0 = WASM_VECTOR_LEN;
1755
+ wasm.importMarkdown(retptr, ptr0, len0);
1756
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1757
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1758
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1759
+ if (r2) {
1760
+ throw takeObject(r1);
1761
+ }
1762
+ return takeObject(r0);
1763
+ } finally {
1764
+ wasm.__wbindgen_add_to_stack_pointer(16);
1765
+ }
1766
+ }
1767
+
1768
+ /**
1769
+ * Map a base content position (a USV index into `Content.text`, not a UTF-16
1770
+ * offset) through a `delta` to its new USV position: the pure position-mapping
1771
+ * codec an editor bridge composes to hold a caret stable across a `revise`.
1772
+ * `assoc` decides the side of a same-position insertion (`"after"` moves past
1773
+ * it). Throws on a malformed `delta`.
1774
+ * @param {Delta} delta
1775
+ * @param {number} pos
1776
+ * @param {Assoc} assoc
1777
+ * @returns {number}
1778
+ */
1779
+ export function mapPos(delta, pos, assoc) {
1780
+ try {
1781
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1782
+ wasm.mapPos(retptr, addHeapObject(delta), pos, addHeapObject(assoc));
1783
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1784
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1785
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1786
+ if (r2) {
1787
+ throw takeObject(r1);
1788
+ }
1789
+ return r0 >>> 0;
1790
+ } finally {
1791
+ wasm.__wbindgen_add_to_stack_pointer(16);
1792
+ }
1793
+ }
1794
+
1795
+ /**
1796
+ * Parse a canonical document-model `Diagnostic.path`
1797
+ * (`cards.<kind>[<i>].<field>`, `main.body`, `recipients[0].name`) into its
1798
+ * structured [`DocPathSeg`] segments: the exported inverse of the engine's
1799
+ * one path serializer, so a consumer routes on segments instead of regexing
1800
+ * the string. Throws on a malformed path.
1801
+ * @param {string} path
1802
+ * @returns {DocPathSeg[]}
1803
+ */
1804
+ export function parseDocPath(path) {
1805
+ try {
1806
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1807
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1808
+ const len0 = WASM_VECTOR_LEN;
1809
+ wasm.parseDocPath(retptr, ptr0, len0);
1810
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1811
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1812
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1813
+ if (r2) {
1814
+ throw takeObject(r1);
1815
+ }
1816
+ return takeObject(r0);
1817
+ } finally {
1818
+ wasm.__wbindgen_add_to_stack_pointer(16);
1819
+ }
1820
+ }
1821
+
1822
+ /**
1823
+ * Rebase `markdown` onto a `base` content, the pure, document-free twin of
1824
+ * `revise`: cold-import + `diff_import`, returning the new `content` and the
1825
+ * text `delta` (its offsets USV indices into `Content.text`, surviving anchors
1826
+ * rebased). Use it to compute a revise without a document in hand; `revise(addr,
1827
+ * md)` fuses this with the store for atomicity. Throws on an over-nested
1828
+ * markdown input or a non-content `base`.
1829
+ * @param {Content} base
1830
+ * @param {string} markdown
1831
+ * @returns {{ content: Content; delta: Delta }}
1832
+ */
1833
+ export function rebase(base, markdown) {
1834
+ try {
1835
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1836
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1837
+ const len0 = WASM_VECTOR_LEN;
1838
+ wasm.rebase(retptr, addHeapObject(base), ptr0, len0);
1839
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1840
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1841
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1842
+ if (r2) {
1843
+ throw takeObject(r1);
1844
+ }
1845
+ return takeObject(r0);
1846
+ } finally {
1847
+ wasm.__wbindgen_add_to_stack_pointer(16);
1848
+ }
1849
+ }
1850
+
1851
+ /**
1852
+ * Runs at instantiation (the wasm-bindgen start section): installs the panic
1853
+ * hook, so a Rust panic reaches the console as a stack trace rather than
1854
+ * `unreachable`.
1855
+ *
1856
+ * Not the package's `init`. That name belongs to the hand-written runtime,
1857
+ * which owns instantiation itself (`runtime/runtime.js`); this runs as part of
1858
+ * the instantiation it awaits.
1859
+ */
1860
+ export function start() {
1861
+ wasm.start();
1862
+ }
1863
+ function __wbg_get_imports() {
1864
+ const import0 = {
1865
+ __proto__: null,
1866
+ __wbg_Error_960c155d3d49e4c2: function(arg0, arg1) {
1867
+ const ret = Error(getStringFromWasm0(arg0, arg1));
1868
+ return addHeapObject(ret);
1869
+ },
1870
+ __wbg_Number_32bf70a599af1d4b: function(arg0) {
1871
+ const ret = Number(getObject(arg0));
1872
+ return ret;
1873
+ },
1874
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
1875
+ const ret = String(getObject(arg1));
1876
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1877
+ const len1 = WASM_VECTOR_LEN;
1878
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1879
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1880
+ },
1881
+ __wbg___wbindgen_bigint_get_as_i64_3d3aba5d616c6a51: function(arg0, arg1) {
1882
+ const v = getObject(arg1);
1883
+ const ret = typeof(v) === 'bigint' ? v : undefined;
1884
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1885
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1886
+ },
1887
+ __wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff: function(arg0) {
1888
+ const v = getObject(arg0);
1889
+ const ret = typeof(v) === 'boolean' ? v : undefined;
1890
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1891
+ },
1892
+ __wbg___wbindgen_debug_string_ab4b34d23d6778bd: function(arg0, arg1) {
1893
+ const ret = debugString(getObject(arg1));
1894
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1895
+ const len1 = WASM_VECTOR_LEN;
1896
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1897
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1898
+ },
1899
+ __wbg___wbindgen_in_a5d8b22e52b24dd1: function(arg0, arg1) {
1900
+ const ret = getObject(arg0) in getObject(arg1);
1901
+ return ret;
1902
+ },
1903
+ __wbg___wbindgen_is_bigint_ec25c7f91b4d9e93: function(arg0) {
1904
+ const ret = typeof(getObject(arg0)) === 'bigint';
1905
+ return ret;
1906
+ },
1907
+ __wbg___wbindgen_is_function_3baa9db1a987f47d: function(arg0) {
1908
+ const ret = typeof(getObject(arg0)) === 'function';
1909
+ return ret;
1910
+ },
1911
+ __wbg___wbindgen_is_null_52ff4ec04186736f: function(arg0) {
1912
+ const ret = getObject(arg0) === null;
1913
+ return ret;
1914
+ },
1915
+ __wbg___wbindgen_is_object_63322ec0cd6ea4ef: function(arg0) {
1916
+ const val = getObject(arg0);
1917
+ const ret = typeof(val) === 'object' && val !== null;
1918
+ return ret;
1919
+ },
1920
+ __wbg___wbindgen_is_string_6df3bf7ef1164ed3: function(arg0) {
1921
+ const ret = typeof(getObject(arg0)) === 'string';
1922
+ return ret;
1923
+ },
1924
+ __wbg___wbindgen_is_undefined_29a43b4d42920abd: function(arg0) {
1925
+ const ret = getObject(arg0) === undefined;
1926
+ return ret;
1927
+ },
1928
+ __wbg___wbindgen_jsval_eq_d3465d8a07697228: function(arg0, arg1) {
1929
+ const ret = getObject(arg0) === getObject(arg1);
1930
+ return ret;
1931
+ },
1932
+ __wbg___wbindgen_jsval_loose_eq_cac3565e89b4134c: function(arg0, arg1) {
1933
+ const ret = getObject(arg0) == getObject(arg1);
1934
+ return ret;
1935
+ },
1936
+ __wbg___wbindgen_number_get_c7f42aed0525c451: function(arg0, arg1) {
1937
+ const obj = getObject(arg1);
1938
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1939
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1940
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1941
+ },
1942
+ __wbg___wbindgen_string_get_7ed5322991caaec5: function(arg0, arg1) {
1943
+ const obj = getObject(arg1);
1944
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1945
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1946
+ var len1 = WASM_VECTOR_LEN;
1947
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1948
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1949
+ },
1950
+ __wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
1951
+ throw new Error(getStringFromWasm0(arg0, arg1));
1952
+ },
1953
+ __wbg_call_14b169f759b26747: function() { return handleError(function (arg0, arg1) {
1954
+ const ret = getObject(arg0).call(getObject(arg1));
1955
+ return addHeapObject(ret);
1956
+ }, arguments); },
1957
+ __wbg_done_9158f7cc8751ba32: function(arg0) {
1958
+ const ret = getObject(arg0).done;
1959
+ return ret;
1960
+ },
1961
+ __wbg_entries_2bf997cf82353e47: function(arg0) {
1962
+ const ret = getObject(arg0).entries();
1963
+ return addHeapObject(ret);
1964
+ },
1965
+ __wbg_entries_e0b73aa8571ddb56: function(arg0) {
1966
+ const ret = Object.entries(getObject(arg0));
1967
+ return addHeapObject(ret);
1968
+ },
1969
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
1970
+ let deferred0_0;
1971
+ let deferred0_1;
1972
+ try {
1973
+ deferred0_0 = arg0;
1974
+ deferred0_1 = arg1;
1975
+ console.error(getStringFromWasm0(arg0, arg1));
1976
+ } finally {
1977
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
1978
+ }
1979
+ },
1980
+ __wbg_from_0dbf29f09e7fb200: function(arg0) {
1981
+ const ret = Array.from(getObject(arg0));
1982
+ return addHeapObject(ret);
1983
+ },
1984
+ __wbg_get_1affdbdd5573b16a: function() { return handleError(function (arg0, arg1) {
1985
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
1986
+ return addHeapObject(ret);
1987
+ }, arguments); },
1988
+ __wbg_get_8360291721e2339f: function(arg0, arg1) {
1989
+ const ret = getObject(arg0)[arg1 >>> 0];
1990
+ return addHeapObject(ret);
1991
+ },
1992
+ __wbg_get_unchecked_17f53dad852b9588: function(arg0, arg1) {
1993
+ const ret = getObject(arg0)[arg1 >>> 0];
1994
+ return addHeapObject(ret);
1995
+ },
1996
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
1997
+ const ret = getObject(arg0)[getObject(arg1)];
1998
+ return addHeapObject(ret);
1999
+ },
2000
+ __wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3: function(arg0) {
2001
+ let result;
2002
+ try {
2003
+ result = getObject(arg0) instanceof ArrayBuffer;
2004
+ } catch (_) {
2005
+ result = false;
2006
+ }
2007
+ const ret = result;
2008
+ return ret;
2009
+ },
2010
+ __wbg_instanceof_Map_1b76fd4635be43eb: function(arg0) {
2011
+ let result;
2012
+ try {
2013
+ result = getObject(arg0) instanceof Map;
2014
+ } catch (_) {
2015
+ result = false;
2016
+ }
2017
+ const ret = result;
2018
+ return ret;
2019
+ },
2020
+ __wbg_instanceof_Object_7c99480a1cdfb911: function(arg0) {
2021
+ let result;
2022
+ try {
2023
+ result = getObject(arg0) instanceof Object;
2024
+ } catch (_) {
2025
+ result = false;
2026
+ }
2027
+ const ret = result;
2028
+ return ret;
2029
+ },
2030
+ __wbg_instanceof_Uint8Array_152ba1f289edcf3f: function(arg0) {
2031
+ let result;
2032
+ try {
2033
+ result = getObject(arg0) instanceof Uint8Array;
2034
+ } catch (_) {
2035
+ result = false;
2036
+ }
2037
+ const ret = result;
2038
+ return ret;
2039
+ },
2040
+ __wbg_isArray_c3109d14ffc06469: function(arg0) {
2041
+ const ret = Array.isArray(getObject(arg0));
2042
+ return ret;
2043
+ },
2044
+ __wbg_isSafeInteger_4fc213d1989d6d2a: function(arg0) {
2045
+ const ret = Number.isSafeInteger(getObject(arg0));
2046
+ return ret;
2047
+ },
2048
+ __wbg_iterator_013bc09ec998c2a7: function() {
2049
+ const ret = Symbol.iterator;
2050
+ return addHeapObject(ret);
2051
+ },
2052
+ __wbg_keys_2fd1bfdda7e278ca: function(arg0) {
2053
+ const ret = Object.keys(getObject(arg0));
2054
+ return addHeapObject(ret);
2055
+ },
2056
+ __wbg_length_3d4ecd04bd8d22f1: function(arg0) {
2057
+ const ret = getObject(arg0).length;
2058
+ return ret;
2059
+ },
2060
+ __wbg_length_9f1775224cf1d815: function(arg0) {
2061
+ const ret = getObject(arg0).length;
2062
+ return ret;
2063
+ },
2064
+ __wbg_new_0c7403db6e782f19: function(arg0) {
2065
+ const ret = new Uint8Array(getObject(arg0));
2066
+ return addHeapObject(ret);
2067
+ },
2068
+ __wbg_new_227d7c05414eb861: function() {
2069
+ const ret = new Error();
2070
+ return addHeapObject(ret);
2071
+ },
2072
+ __wbg_new_34d45cc8e36aaead: function() {
2073
+ const ret = new Map();
2074
+ return addHeapObject(ret);
2075
+ },
2076
+ __wbg_new_5e360d2ff7b9e1c3: function(arg0, arg1) {
2077
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
2078
+ return addHeapObject(ret);
2079
+ },
2080
+ __wbg_new_682678e2f47e32bc: function() {
2081
+ const ret = new Array();
2082
+ return addHeapObject(ret);
2083
+ },
2084
+ __wbg_new_aa8d0fa9762c29bd: function() {
2085
+ const ret = new Object();
2086
+ return addHeapObject(ret);
2087
+ },
2088
+ __wbg_new_from_slice_b5ea43e23f6008c0: function(arg0, arg1) {
2089
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
2090
+ return addHeapObject(ret);
2091
+ },
2092
+ __wbg_next_0340c4ae324393c3: function() { return handleError(function (arg0) {
2093
+ const ret = getObject(arg0).next();
2094
+ return addHeapObject(ret);
2095
+ }, arguments); },
2096
+ __wbg_next_7646edaa39458ef7: function(arg0) {
2097
+ const ret = getObject(arg0).next;
2098
+ return addHeapObject(ret);
2099
+ },
2100
+ __wbg_prototypesetcall_a6b02eb00b0f4ce2: function(arg0, arg1, arg2) {
2101
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
2102
+ },
2103
+ __wbg_set_022bee52d0b05b19: function() { return handleError(function (arg0, arg1, arg2) {
2104
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
2105
+ return ret;
2106
+ }, arguments); },
2107
+ __wbg_set_3bf1de9fab0cd644: function(arg0, arg1, arg2) {
2108
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
2109
+ },
2110
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
2111
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
2112
+ },
2113
+ __wbg_set_fde2cec06c23692b: function(arg0, arg1, arg2) {
2114
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2115
+ return addHeapObject(ret);
2116
+ },
2117
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
2118
+ const ret = getObject(arg1).stack;
2119
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2120
+ const len1 = WASM_VECTOR_LEN;
2121
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
2122
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
2123
+ },
2124
+ __wbg_value_ee3a06f4579184fa: function(arg0) {
2125
+ const ret = getObject(arg0).value;
2126
+ return addHeapObject(ret);
2127
+ },
2128
+ __wbg_values_1e6d547ce555ce44: function(arg0) {
2129
+ const ret = getObject(arg0).values();
2130
+ return addHeapObject(ret);
2131
+ },
2132
+ __wbg_values_301a77363cf6c773: function(arg0) {
2133
+ const ret = Object.values(getObject(arg0));
2134
+ return addHeapObject(ret);
2135
+ },
2136
+ __wbindgen_cast_0000000000000001: function(arg0) {
2137
+ // Cast intrinsic for `F64 -> Externref`.
2138
+ const ret = arg0;
2139
+ return addHeapObject(ret);
2140
+ },
2141
+ __wbindgen_cast_0000000000000002: function(arg0) {
2142
+ // Cast intrinsic for `I64 -> Externref`.
2143
+ const ret = arg0;
2144
+ return addHeapObject(ret);
2145
+ },
2146
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
2147
+ // Cast intrinsic for `Ref(String) -> Externref`.
2148
+ const ret = getStringFromWasm0(arg0, arg1);
2149
+ return addHeapObject(ret);
2150
+ },
2151
+ __wbindgen_cast_0000000000000004: function(arg0) {
2152
+ // Cast intrinsic for `U64 -> Externref`.
2153
+ const ret = BigInt.asUintN(64, arg0);
2154
+ return addHeapObject(ret);
2155
+ },
2156
+ __wbindgen_object_clone_ref: function(arg0) {
2157
+ const ret = getObject(arg0);
2158
+ return addHeapObject(ret);
2159
+ },
2160
+ __wbindgen_object_drop_ref: function(arg0) {
2161
+ takeObject(arg0);
2162
+ },
2163
+ };
2164
+ return {
2165
+ __proto__: null,
2166
+ "./wasm_bg.js": import0,
2167
+ };
2168
+ }
2169
+
2170
+ const DocumentFinalization = (typeof FinalizationRegistry === 'undefined')
2171
+ ? { register: () => {}, unregister: () => {} }
2172
+ : new FinalizationRegistry(ptr => wasm.__wbg_document_free(ptr >>> 0, 1));
2173
+ const QuillFinalization = (typeof FinalizationRegistry === 'undefined')
2174
+ ? { register: () => {}, unregister: () => {} }
2175
+ : new FinalizationRegistry(ptr => wasm.__wbg_quill_free(ptr >>> 0, 1));
2176
+
2177
+ function addHeapObject(obj) {
2178
+ if (heap_next === heap.length) heap.push(heap.length + 1);
2179
+ const idx = heap_next;
2180
+ heap_next = heap[idx];
2181
+
2182
+ heap[idx] = obj;
2183
+ return idx;
2184
+ }
2185
+
2186
+ function _assertClass(instance, klass) {
2187
+ if (!(instance instanceof klass)) {
2188
+ throw new Error(`expected instance of ${klass.name}`);
2189
+ }
2190
+ }
2191
+
2192
+ function debugString(val) {
2193
+ // primitive types
2194
+ const type = typeof val;
2195
+ if (type == 'number' || type == 'boolean' || val == null) {
2196
+ return `${val}`;
2197
+ }
2198
+ if (type == 'string') {
2199
+ return `"${val}"`;
2200
+ }
2201
+ if (type == 'symbol') {
2202
+ const description = val.description;
2203
+ if (description == null) {
2204
+ return 'Symbol';
2205
+ } else {
2206
+ return `Symbol(${description})`;
2207
+ }
2208
+ }
2209
+ if (type == 'function') {
2210
+ const name = val.name;
2211
+ if (typeof name == 'string' && name.length > 0) {
2212
+ return `Function(${name})`;
2213
+ } else {
2214
+ return 'Function';
2215
+ }
2216
+ }
2217
+ // objects
2218
+ if (Array.isArray(val)) {
2219
+ const length = val.length;
2220
+ let debug = '[';
2221
+ if (length > 0) {
2222
+ debug += debugString(val[0]);
2223
+ }
2224
+ for(let i = 1; i < length; i++) {
2225
+ debug += ', ' + debugString(val[i]);
2226
+ }
2227
+ debug += ']';
2228
+ return debug;
2229
+ }
2230
+ // Test for built-in
2231
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
2232
+ let className;
2233
+ if (builtInMatches && builtInMatches.length > 1) {
2234
+ className = builtInMatches[1];
2235
+ } else {
2236
+ // Failed to match the standard '[object ClassName]'
2237
+ return toString.call(val);
2238
+ }
2239
+ if (className == 'Object') {
2240
+ // we're a user defined class or Object
2241
+ // JSON.stringify avoids problems with cycles, and is generally much
2242
+ // easier than looping through ownProperties of `val`.
2243
+ try {
2244
+ return 'Object(' + JSON.stringify(val) + ')';
2245
+ } catch (_) {
2246
+ return 'Object';
2247
+ }
2248
+ }
2249
+ // errors
2250
+ if (val instanceof Error) {
2251
+ return `${val.name}: ${val.message}\n${val.stack}`;
2252
+ }
2253
+ // TODO we could test for more things here, like `Set`s and `Map`s.
2254
+ return className;
2255
+ }
2256
+
2257
+ function dropObject(idx) {
2258
+ if (idx < 1028) return;
2259
+ heap[idx] = heap_next;
2260
+ heap_next = idx;
2261
+ }
2262
+
2263
+ function getArrayU8FromWasm0(ptr, len) {
2264
+ ptr = ptr >>> 0;
2265
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
2266
+ }
2267
+
2268
+ let cachedDataViewMemory0 = null;
2269
+ function getDataViewMemory0() {
2270
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
2271
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
2272
+ }
2273
+ return cachedDataViewMemory0;
2274
+ }
2275
+
2276
+ function getStringFromWasm0(ptr, len) {
2277
+ ptr = ptr >>> 0;
2278
+ return decodeText(ptr, len);
2279
+ }
2280
+
2281
+ let cachedUint8ArrayMemory0 = null;
2282
+ function getUint8ArrayMemory0() {
2283
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
2284
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
2285
+ }
2286
+ return cachedUint8ArrayMemory0;
2287
+ }
2288
+
2289
+ function getObject(idx) { return heap[idx]; }
2290
+
2291
+ function handleError(f, args) {
2292
+ try {
2293
+ return f.apply(this, args);
2294
+ } catch (e) {
2295
+ wasm.__wbindgen_export3(addHeapObject(e));
2296
+ }
2297
+ }
2298
+
2299
+ let heap = new Array(1024).fill(undefined);
2300
+ heap.push(undefined, null, true, false);
2301
+
2302
+ let heap_next = heap.length;
2303
+
2304
+ function isLikeNone(x) {
2305
+ return x === undefined || x === null;
2306
+ }
2307
+
2308
+ function passStringToWasm0(arg, malloc, realloc) {
2309
+ if (realloc === undefined) {
2310
+ const buf = cachedTextEncoder.encode(arg);
2311
+ const ptr = malloc(buf.length, 1) >>> 0;
2312
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
2313
+ WASM_VECTOR_LEN = buf.length;
2314
+ return ptr;
2315
+ }
2316
+
2317
+ let len = arg.length;
2318
+ let ptr = malloc(len, 1) >>> 0;
2319
+
2320
+ const mem = getUint8ArrayMemory0();
2321
+
2322
+ let offset = 0;
2323
+
2324
+ for (; offset < len; offset++) {
2325
+ const code = arg.charCodeAt(offset);
2326
+ if (code > 0x7F) break;
2327
+ mem[ptr + offset] = code;
2328
+ }
2329
+ if (offset !== len) {
2330
+ if (offset !== 0) {
2331
+ arg = arg.slice(offset);
2332
+ }
2333
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
2334
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
2335
+ const ret = cachedTextEncoder.encodeInto(arg, view);
2336
+
2337
+ offset += ret.written;
2338
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
2339
+ }
2340
+
2341
+ WASM_VECTOR_LEN = offset;
2342
+ return ptr;
2343
+ }
2344
+
2345
+ function takeObject(idx) {
2346
+ const ret = getObject(idx);
2347
+ dropObject(idx);
2348
+ return ret;
2349
+ }
2350
+
2351
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2352
+ cachedTextDecoder.decode();
2353
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
2354
+ let numBytesDecoded = 0;
2355
+ function decodeText(ptr, len) {
2356
+ numBytesDecoded += len;
2357
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
2358
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
2359
+ cachedTextDecoder.decode();
2360
+ numBytesDecoded = len;
2361
+ }
2362
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
2363
+ }
2364
+
2365
+ const cachedTextEncoder = new TextEncoder();
2366
+
2367
+ if (!('encodeInto' in cachedTextEncoder)) {
2368
+ cachedTextEncoder.encodeInto = function (arg, view) {
2369
+ const buf = cachedTextEncoder.encode(arg);
2370
+ view.set(buf);
2371
+ return {
2372
+ read: arg.length,
2373
+ written: buf.length
2374
+ };
2375
+ };
2376
+ }
2377
+
2378
+ let WASM_VECTOR_LEN = 0;
2379
+
2380
+ import { uninitSentinel, UNINIT } from "../runtime/uninit.js";
2381
+ let wasmModule, wasm = uninitSentinel("@quillmark/wasm is not initialized. Call 'await init()' once at startup, before Quill, Document, Engine, or any other export is used.", "Add: import { init } from '@quillmark/wasm'; await init(); once, anywhere before first use. Extra calls are free.");
2382
+ function __wbg_finalize_init(instance, module) {
2383
+ wasm = instance.exports;
2384
+ wasmModule = module;
2385
+ cachedDataViewMemory0 = null;
2386
+ cachedUint8ArrayMemory0 = null;
2387
+ wasm.__wbindgen_start();
2388
+ return wasm;
2389
+ }
2390
+
2391
+ async function __wbg_load(module, imports) {
2392
+ if (typeof Response === 'function' && module instanceof Response) {
2393
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
2394
+ try {
2395
+ return await WebAssembly.instantiateStreaming(module, imports);
2396
+ } catch (e) {
2397
+ const validResponse = module.ok && expectedResponseType(module.type);
2398
+
2399
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
2400
+ 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);
2401
+
2402
+ } else { throw e; }
2403
+ }
2404
+ }
2405
+
2406
+ const bytes = await module.arrayBuffer();
2407
+ return await WebAssembly.instantiate(bytes, imports);
2408
+ } else {
2409
+ const instance = await WebAssembly.instantiate(module, imports);
2410
+
2411
+ if (instance instanceof WebAssembly.Instance) {
2412
+ return { instance, module };
2413
+ } else {
2414
+ return instance;
2415
+ }
2416
+ }
2417
+
2418
+ function expectedResponseType(type) {
2419
+ switch (type) {
2420
+ case 'basic': case 'cors': case 'default': return true;
2421
+ }
2422
+ return false;
2423
+ }
2424
+ }
2425
+
2426
+ function initSync(module) {
2427
+ if (wasm !== undefined && !wasm[UNINIT]) return wasm;
2428
+
2429
+
2430
+ if (module !== undefined) {
2431
+ if (Object.getPrototypeOf(module) === Object.prototype) {
2432
+ ({module} = module)
2433
+ } else {
2434
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
2435
+ }
2436
+ }
2437
+
2438
+ const imports = __wbg_get_imports();
2439
+ if (!(module instanceof WebAssembly.Module)) {
2440
+ module = new WebAssembly.Module(module);
2441
+ }
2442
+ const instance = new WebAssembly.Instance(module, imports);
2443
+ return __wbg_finalize_init(instance, module);
2444
+ }
2445
+
2446
+ async function __wbg_init(module_or_path) {
2447
+ if (wasm !== undefined && !wasm[UNINIT]) return wasm;
2448
+
2449
+
2450
+ if (module_or_path !== undefined) {
2451
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
2452
+ ({module_or_path} = module_or_path)
2453
+ } else {
2454
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
2455
+ }
2456
+ }
2457
+
2458
+ if (module_or_path === undefined) {
2459
+ module_or_path = new URL('wasm_bg.wasm', import.meta.url);
2460
+ }
2461
+ const imports = __wbg_get_imports();
2462
+
2463
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
2464
+ module_or_path = fetch(module_or_path);
2465
+ }
2466
+
2467
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
2468
+
2469
+ return __wbg_finalize_init(instance, module);
2470
+ }
2471
+
2472
+ export { initSync, __wbg_init as default };