@quillmark/wasm 0.46.0 → 0.48.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/node-esm/wasm.js CHANGED
@@ -1,17 +1,851 @@
1
+ /* @ts-self-types="./wasm.d.ts" */
1
2
 
2
- let imports = {};
3
- import * as import0 from './wasm_bg.js';
4
- imports['./wasm_bg.js'] = import0;
3
+ export class CompiledDocument {
4
+ static __wrap(ptr) {
5
+ ptr = ptr >>> 0;
6
+ const obj = Object.create(CompiledDocument.prototype);
7
+ obj.__wbg_ptr = ptr;
8
+ CompiledDocumentFinalization.register(obj, obj.__wbg_ptr, obj);
9
+ return obj;
10
+ }
11
+ __destroy_into_raw() {
12
+ const ptr = this.__wbg_ptr;
13
+ this.__wbg_ptr = 0;
14
+ CompiledDocumentFinalization.unregister(this);
15
+ return ptr;
16
+ }
17
+ free() {
18
+ const ptr = this.__destroy_into_raw();
19
+ wasm.__wbg_compileddocument_free(ptr, 0);
20
+ }
21
+ /**
22
+ * Number of pages in this compiled document.
23
+ * @returns {number}
24
+ */
25
+ get pageCount() {
26
+ const ret = wasm.compileddocument_pageCount(this.__wbg_ptr);
27
+ return ret >>> 0;
28
+ }
29
+ /**
30
+ * Render selected pages. `pages = null/undefined` renders all pages.
31
+ * @param {Uint32Array | null | undefined} pages
32
+ * @param {RenderPagesOptions} opts
33
+ * @returns {RenderResult}
34
+ */
35
+ renderPages(pages, opts) {
36
+ try {
37
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
38
+ var ptr0 = isLikeNone(pages) ? 0 : passArray32ToWasm0(pages, wasm.__wbindgen_export);
39
+ var len0 = WASM_VECTOR_LEN;
40
+ wasm.compileddocument_renderPages(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(opts));
41
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
42
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
43
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
44
+ if (r2) {
45
+ throw takeObject(r1);
46
+ }
47
+ return takeObject(r0);
48
+ } finally {
49
+ wasm.__wbindgen_add_to_stack_pointer(16);
50
+ }
51
+ }
52
+ }
53
+ if (Symbol.dispose) CompiledDocument.prototype[Symbol.dispose] = CompiledDocument.prototype.free;
5
54
 
6
- import { readFileSync } from 'node:fs';
55
+ /**
56
+ * Quillmark WASM Engine
57
+ *
58
+ * Create once, register Quills, render markdown. That's it.
59
+ */
60
+ export class Quillmark {
61
+ __destroy_into_raw() {
62
+ const ptr = this.__wbg_ptr;
63
+ this.__wbg_ptr = 0;
64
+ QuillmarkFinalization.unregister(this);
65
+ return ptr;
66
+ }
67
+ free() {
68
+ const ptr = this.__destroy_into_raw();
69
+ wasm.__wbg_quillmark_free(ptr, 0);
70
+ }
71
+ /**
72
+ * Compile a parsed document into an opaque compiled document handle.
73
+ * @param {ParsedDocument} parsed
74
+ * @param {CompileOptions | null} [opts]
75
+ * @returns {CompiledDocument}
76
+ */
77
+ compile(parsed, opts) {
78
+ try {
79
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
80
+ wasm.quillmark_compile(retptr, this.__wbg_ptr, addHeapObject(parsed), isLikeNone(opts) ? 0 : addHeapObject(opts));
81
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
82
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
83
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
84
+ if (r2) {
85
+ throw takeObject(r1);
86
+ }
87
+ return CompiledDocument.__wrap(r0);
88
+ } finally {
89
+ wasm.__wbindgen_add_to_stack_pointer(16);
90
+ }
91
+ }
92
+ /**
93
+ * Compile markdown to JSON data without rendering artifacts.
94
+ *
95
+ * This exposes the intermediate data structure that would be passed to the backend.
96
+ * Useful for debugging and validation.
97
+ * @param {string} markdown
98
+ * @returns {any}
99
+ */
100
+ compileData(markdown) {
101
+ try {
102
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
103
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
104
+ const len0 = WASM_VECTOR_LEN;
105
+ wasm.quillmark_compileData(retptr, this.__wbg_ptr, ptr0, len0);
106
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
107
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
108
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
109
+ if (r2) {
110
+ throw takeObject(r1);
111
+ }
112
+ return takeObject(r0);
113
+ } finally {
114
+ wasm.__wbindgen_add_to_stack_pointer(16);
115
+ }
116
+ }
117
+ /**
118
+ * Perform a dry run validation without backend compilation.
119
+ *
120
+ * Executes parsing, schema validation, and template composition to
121
+ * surface input errors quickly. Returns successfully on valid input,
122
+ * or throws an error with diagnostic payload on failure.
123
+ *
124
+ * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
125
+ *
126
+ * This is useful for fast feedback loops in LLM-driven document generation.
127
+ * @param {string} markdown
128
+ */
129
+ dryRun(markdown) {
130
+ try {
131
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
132
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
133
+ const len0 = WASM_VECTOR_LEN;
134
+ wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
135
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
136
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
137
+ if (r1) {
138
+ throw takeObject(r0);
139
+ }
140
+ } finally {
141
+ wasm.__wbindgen_add_to_stack_pointer(16);
142
+ }
143
+ }
144
+ /**
145
+ * Get shallow information about a registered Quill
146
+ *
147
+ * This returns metadata, backend info, field schemas, and supported formats
148
+ * that consumers need to configure render options for the next step.
149
+ * @param {string} name
150
+ * @returns {QuillInfo}
151
+ */
152
+ getQuillInfo(name) {
153
+ try {
154
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
155
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
156
+ const len0 = WASM_VECTOR_LEN;
157
+ wasm.quillmark_getQuillInfo(retptr, this.__wbg_ptr, ptr0, len0);
158
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
159
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
160
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
161
+ if (r2) {
162
+ throw takeObject(r1);
163
+ }
164
+ return takeObject(r0);
165
+ } finally {
166
+ wasm.__wbindgen_add_to_stack_pointer(16);
167
+ }
168
+ }
169
+ /**
170
+ * Get the AI-projected JSON schema of a Quill (strips UI metadata and CARDS)
171
+ *
172
+ * This returns the schema in a format suitable for feeding to LLMs or
173
+ * other consumers that don't need the UI configuration "x-ui" fields
174
+ * or the internal CARDS array structure.
175
+ * @param {string} name
176
+ * @returns {any}
177
+ */
178
+ getStrippedSchema(name) {
179
+ try {
180
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
181
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
182
+ const len0 = WASM_VECTOR_LEN;
183
+ wasm.quillmark_getStrippedSchema(retptr, this.__wbg_ptr, ptr0, len0);
184
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
185
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
186
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
187
+ if (r2) {
188
+ throw takeObject(r1);
189
+ }
190
+ return takeObject(r0);
191
+ } finally {
192
+ wasm.__wbindgen_add_to_stack_pointer(16);
193
+ }
194
+ }
195
+ /**
196
+ * List registered Quills with their exact versions
197
+ *
198
+ * Returns strings in the format "name@version" (e.g. "resume-template@2.1.0")
199
+ * @returns {string[]}
200
+ */
201
+ listQuills() {
202
+ try {
203
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
204
+ wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
205
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
206
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
207
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
208
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
209
+ return v1;
210
+ } finally {
211
+ wasm.__wbindgen_add_to_stack_pointer(16);
212
+ }
213
+ }
214
+ /**
215
+ * JavaScript constructor: `new Quillmark()`
216
+ */
217
+ constructor() {
218
+ const ret = wasm.quillmark_new();
219
+ this.__wbg_ptr = ret >>> 0;
220
+ QuillmarkFinalization.register(this, this.__wbg_ptr, this);
221
+ return this;
222
+ }
223
+ /**
224
+ * Parse markdown into a ParsedDocument
225
+ *
226
+ * This is the first step in the workflow. The returned ParsedDocument contains
227
+ * the parsed YAML frontmatter fields and the quill_ref (from QUILL field or "__default__").
228
+ * @param {string} markdown
229
+ * @returns {ParsedDocument}
230
+ */
231
+ static parseMarkdown(markdown) {
232
+ try {
233
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
234
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export, wasm.__wbindgen_export2);
235
+ const len0 = WASM_VECTOR_LEN;
236
+ wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
237
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
238
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
239
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
240
+ if (r2) {
241
+ throw takeObject(r1);
242
+ }
243
+ return takeObject(r0);
244
+ } finally {
245
+ wasm.__wbindgen_add_to_stack_pointer(16);
246
+ }
247
+ }
248
+ /**
249
+ * Register a Quill template bundle
250
+ *
251
+ * Accepts either a JSON string or a JsValue object representing the Quill file tree.
252
+ * Validation happens automatically on registration.
253
+ * @param {any} quill_json
254
+ * @returns {QuillInfo}
255
+ */
256
+ registerQuill(quill_json) {
257
+ try {
258
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
259
+ wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
260
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
261
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
262
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
263
+ if (r2) {
264
+ throw takeObject(r1);
265
+ }
266
+ return takeObject(r0);
267
+ } finally {
268
+ wasm.__wbindgen_add_to_stack_pointer(16);
269
+ }
270
+ }
271
+ /**
272
+ * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
273
+ *
274
+ * Note that the quill reference is optional to specify and can be inferred from the markdown content's frontmatter.
275
+ * Uses the Quill specified in options.quill_ref if provided,
276
+ * otherwise infers it from the ParsedDocument's quill_ref field.
277
+ * @param {ParsedDocument} parsed
278
+ * @param {RenderOptions} opts
279
+ * @returns {RenderResult}
280
+ */
281
+ render(parsed, opts) {
282
+ try {
283
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
284
+ wasm.quillmark_render(retptr, this.__wbg_ptr, addHeapObject(parsed), addHeapObject(opts));
285
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
286
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
287
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
288
+ if (r2) {
289
+ throw takeObject(r1);
290
+ }
291
+ return takeObject(r0);
292
+ } finally {
293
+ wasm.__wbindgen_add_to_stack_pointer(16);
294
+ }
295
+ }
296
+ /**
297
+ * Resolve a Quill reference to a registered Quill, or null if not available
298
+ *
299
+ * Accepts a quill reference string like "resume-template", "resume-template@2",
300
+ * or "resume-template@2.1.0". Returns QuillInfo if the engine can resolve it
301
+ * locally, or null if an external fetch is needed.
302
+ * @param {string} quill_ref
303
+ * @returns {any}
304
+ */
305
+ resolveQuill(quill_ref) {
306
+ const ptr0 = passStringToWasm0(quill_ref, wasm.__wbindgen_export, wasm.__wbindgen_export2);
307
+ const len0 = WASM_VECTOR_LEN;
308
+ const ret = wasm.quillmark_resolveQuill(this.__wbg_ptr, ptr0, len0);
309
+ return takeObject(ret);
310
+ }
311
+ /**
312
+ * Unregister a Quill by name or specific version
313
+ *
314
+ * If a base name is provided (e.g., "my-quill"), all versions of that quill are freed.
315
+ * If a versioned name is provided (e.g., "my-quill@2.1.0"), only that specific version is freed.
316
+ * Returns true if something was unregistered, false if not found.
317
+ * @param {string} name_or_ref
318
+ * @returns {boolean}
319
+ */
320
+ unregisterQuill(name_or_ref) {
321
+ const ptr0 = passStringToWasm0(name_or_ref, wasm.__wbindgen_export, wasm.__wbindgen_export2);
322
+ const len0 = WASM_VECTOR_LEN;
323
+ const ret = wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
324
+ return ret !== 0;
325
+ }
326
+ }
327
+ if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
328
+
329
+ /**
330
+ * Initialize the WASM module with panic hooks for better error messages
331
+ */
332
+ export function init() {
333
+ wasm.init();
334
+ }
335
+
336
+ function __wbg_get_imports() {
337
+ const import0 = {
338
+ __proto__: null,
339
+ __wbg_Error_2e59b1b37a9a34c3: function(arg0, arg1) {
340
+ const ret = Error(getStringFromWasm0(arg0, arg1));
341
+ return addHeapObject(ret);
342
+ },
343
+ __wbg_String_b51de6b05a10845b: function(arg0, arg1) {
344
+ const ret = String(getObject(arg1));
345
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
346
+ const len1 = WASM_VECTOR_LEN;
347
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
348
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
349
+ },
350
+ __wbg___wbindgen_bigint_get_as_i64_2c5082002e4826e2: function(arg0, arg1) {
351
+ const v = getObject(arg1);
352
+ const ret = typeof(v) === 'bigint' ? v : undefined;
353
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
354
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
355
+ },
356
+ __wbg___wbindgen_boolean_get_a86c216575a75c30: function(arg0) {
357
+ const v = getObject(arg0);
358
+ const ret = typeof(v) === 'boolean' ? v : undefined;
359
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
360
+ },
361
+ __wbg___wbindgen_debug_string_dd5d2d07ce9e6c57: function(arg0, arg1) {
362
+ const ret = debugString(getObject(arg1));
363
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
364
+ const len1 = WASM_VECTOR_LEN;
365
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
366
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
367
+ },
368
+ __wbg___wbindgen_in_4bd7a57e54337366: function(arg0, arg1) {
369
+ const ret = getObject(arg0) in getObject(arg1);
370
+ return ret;
371
+ },
372
+ __wbg___wbindgen_is_bigint_6c98f7e945dacdde: function(arg0) {
373
+ const ret = typeof(getObject(arg0)) === 'bigint';
374
+ return ret;
375
+ },
376
+ __wbg___wbindgen_is_function_49868bde5eb1e745: function(arg0) {
377
+ const ret = typeof(getObject(arg0)) === 'function';
378
+ return ret;
379
+ },
380
+ __wbg___wbindgen_is_object_40c5a80572e8f9d3: function(arg0) {
381
+ const val = getObject(arg0);
382
+ const ret = typeof(val) === 'object' && val !== null;
383
+ return ret;
384
+ },
385
+ __wbg___wbindgen_is_string_b29b5c5a8065ba1a: function(arg0) {
386
+ const ret = typeof(getObject(arg0)) === 'string';
387
+ return ret;
388
+ },
389
+ __wbg___wbindgen_is_undefined_c0cca72b82b86f4d: function(arg0) {
390
+ const ret = getObject(arg0) === undefined;
391
+ return ret;
392
+ },
393
+ __wbg___wbindgen_jsval_eq_7d430e744a913d26: function(arg0, arg1) {
394
+ const ret = getObject(arg0) === getObject(arg1);
395
+ return ret;
396
+ },
397
+ __wbg___wbindgen_jsval_loose_eq_3a72ae764d46d944: function(arg0, arg1) {
398
+ const ret = getObject(arg0) == getObject(arg1);
399
+ return ret;
400
+ },
401
+ __wbg___wbindgen_number_get_7579aab02a8a620c: function(arg0, arg1) {
402
+ const obj = getObject(arg1);
403
+ const ret = typeof(obj) === 'number' ? obj : undefined;
404
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
405
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
406
+ },
407
+ __wbg___wbindgen_string_get_914df97fcfa788f2: function(arg0, arg1) {
408
+ const obj = getObject(arg1);
409
+ const ret = typeof(obj) === 'string' ? obj : undefined;
410
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
411
+ var len1 = WASM_VECTOR_LEN;
412
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
413
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
414
+ },
415
+ __wbg___wbindgen_throw_81fc77679af83bc6: function(arg0, arg1) {
416
+ throw new Error(getStringFromWasm0(arg0, arg1));
417
+ },
418
+ __wbg_call_7f2987183bb62793: function() { return handleError(function (arg0, arg1) {
419
+ const ret = getObject(arg0).call(getObject(arg1));
420
+ return addHeapObject(ret);
421
+ }, arguments); },
422
+ __wbg_done_547d467e97529006: function(arg0) {
423
+ const ret = getObject(arg0).done;
424
+ return ret;
425
+ },
426
+ __wbg_entries_616b1a459b85be0b: function(arg0) {
427
+ const ret = Object.entries(getObject(arg0));
428
+ return addHeapObject(ret);
429
+ },
430
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
431
+ let deferred0_0;
432
+ let deferred0_1;
433
+ try {
434
+ deferred0_0 = arg0;
435
+ deferred0_1 = arg1;
436
+ console.error(getStringFromWasm0(arg0, arg1));
437
+ } finally {
438
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
439
+ }
440
+ },
441
+ __wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
442
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
443
+ }, arguments); },
444
+ __wbg_getTime_f6ac312467f7cf09: function(arg0) {
445
+ const ret = getObject(arg0).getTime();
446
+ return ret;
447
+ },
448
+ __wbg_getUTCDate_9b73619d33527a0e: function(arg0) {
449
+ const ret = getObject(arg0).getUTCDate();
450
+ return ret;
451
+ },
452
+ __wbg_getUTCFullYear_1c80c08b216993d4: function(arg0) {
453
+ const ret = getObject(arg0).getUTCFullYear();
454
+ return ret;
455
+ },
456
+ __wbg_getUTCMonth_ea2d5842542c5998: function(arg0) {
457
+ const ret = getObject(arg0).getUTCMonth();
458
+ return ret;
459
+ },
460
+ __wbg_get_4848e350b40afc16: function(arg0, arg1) {
461
+ const ret = getObject(arg0)[arg1 >>> 0];
462
+ return addHeapObject(ret);
463
+ },
464
+ __wbg_get_ed0642c4b9d31ddf: function() { return handleError(function (arg0, arg1) {
465
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
466
+ return addHeapObject(ret);
467
+ }, arguments); },
468
+ __wbg_get_unchecked_7d7babe32e9e6a54: function(arg0, arg1) {
469
+ const ret = getObject(arg0)[arg1 >>> 0];
470
+ return addHeapObject(ret);
471
+ },
472
+ __wbg_get_with_ref_key_f64427178466f623: function(arg0, arg1) {
473
+ const ret = getObject(arg0)[getObject(arg1)];
474
+ return addHeapObject(ret);
475
+ },
476
+ __wbg_instanceof_ArrayBuffer_ff7c1337a5e3b33a: function(arg0) {
477
+ let result;
478
+ try {
479
+ result = getObject(arg0) instanceof ArrayBuffer;
480
+ } catch (_) {
481
+ result = false;
482
+ }
483
+ const ret = result;
484
+ return ret;
485
+ },
486
+ __wbg_instanceof_Uint8Array_4b8da683deb25d72: function(arg0) {
487
+ let result;
488
+ try {
489
+ result = getObject(arg0) instanceof Uint8Array;
490
+ } catch (_) {
491
+ result = false;
492
+ }
493
+ const ret = result;
494
+ return ret;
495
+ },
496
+ __wbg_isArray_db61795ad004c139: function(arg0) {
497
+ const ret = Array.isArray(getObject(arg0));
498
+ return ret;
499
+ },
500
+ __wbg_isSafeInteger_ea83862ba994770c: function(arg0) {
501
+ const ret = Number.isSafeInteger(getObject(arg0));
502
+ return ret;
503
+ },
504
+ __wbg_iterator_de403ef31815a3e6: function() {
505
+ const ret = Symbol.iterator;
506
+ return addHeapObject(ret);
507
+ },
508
+ __wbg_length_0c32cb8543c8e4c8: function(arg0) {
509
+ const ret = getObject(arg0).length;
510
+ return ret;
511
+ },
512
+ __wbg_length_6e821edde497a532: function(arg0) {
513
+ const ret = getObject(arg0).length;
514
+ return ret;
515
+ },
516
+ __wbg_new_0_bfa2ef4bc447daa2: function() {
517
+ const ret = new Date();
518
+ return addHeapObject(ret);
519
+ },
520
+ __wbg_new_0f6d2ddfe083319b: function(arg0) {
521
+ const ret = new Date(getObject(arg0));
522
+ return addHeapObject(ret);
523
+ },
524
+ __wbg_new_227d7c05414eb861: function() {
525
+ const ret = new Error();
526
+ return addHeapObject(ret);
527
+ },
528
+ __wbg_new_4f9fafbb3909af72: function() {
529
+ const ret = new Object();
530
+ return addHeapObject(ret);
531
+ },
532
+ __wbg_new_99cabae501c0a8a0: function() {
533
+ const ret = new Map();
534
+ return addHeapObject(ret);
535
+ },
536
+ __wbg_new_a560378ea1240b14: function(arg0) {
537
+ const ret = new Uint8Array(getObject(arg0));
538
+ return addHeapObject(ret);
539
+ },
540
+ __wbg_new_f3c9df4f38f3f798: function() {
541
+ const ret = new Array();
542
+ return addHeapObject(ret);
543
+ },
544
+ __wbg_next_01132ed6134b8ef5: function(arg0) {
545
+ const ret = getObject(arg0).next;
546
+ return addHeapObject(ret);
547
+ },
548
+ __wbg_next_b3713ec761a9dbfd: function() { return handleError(function (arg0) {
549
+ const ret = getObject(arg0).next();
550
+ return addHeapObject(ret);
551
+ }, arguments); },
552
+ __wbg_now_88621c9c9a4f3ffc: function() {
553
+ const ret = Date.now();
554
+ return ret;
555
+ },
556
+ __wbg_parse_545d11396395fbbd: function() { return handleError(function (arg0, arg1) {
557
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
558
+ return addHeapObject(ret);
559
+ }, arguments); },
560
+ __wbg_prototypesetcall_3e05eb9545565046: function(arg0, arg1, arg2) {
561
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
562
+ },
563
+ __wbg_set_08463b1df38a7e29: function(arg0, arg1, arg2) {
564
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
565
+ return addHeapObject(ret);
566
+ },
567
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
568
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
569
+ },
570
+ __wbg_set_6c60b2e8ad0e9383: function(arg0, arg1, arg2) {
571
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
572
+ },
573
+ __wbg_set_f071dbb3bd088e0e: function(arg0, arg1, arg2) {
574
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
575
+ },
576
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
577
+ const ret = getObject(arg1).stack;
578
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
579
+ const len1 = WASM_VECTOR_LEN;
580
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
581
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
582
+ },
583
+ __wbg_stringify_a2c39d991e1bf91d: function() { return handleError(function (arg0) {
584
+ const ret = JSON.stringify(getObject(arg0));
585
+ return addHeapObject(ret);
586
+ }, arguments); },
587
+ __wbg_value_7f6052747ccf940f: function(arg0) {
588
+ const ret = getObject(arg0).value;
589
+ return addHeapObject(ret);
590
+ },
591
+ __wbindgen_cast_0000000000000001: function(arg0) {
592
+ // Cast intrinsic for `F64 -> Externref`.
593
+ const ret = arg0;
594
+ return addHeapObject(ret);
595
+ },
596
+ __wbindgen_cast_0000000000000002: function(arg0) {
597
+ // Cast intrinsic for `I64 -> Externref`.
598
+ const ret = arg0;
599
+ return addHeapObject(ret);
600
+ },
601
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
602
+ // Cast intrinsic for `Ref(String) -> Externref`.
603
+ const ret = getStringFromWasm0(arg0, arg1);
604
+ return addHeapObject(ret);
605
+ },
606
+ __wbindgen_cast_0000000000000004: function(arg0) {
607
+ // Cast intrinsic for `U64 -> Externref`.
608
+ const ret = BigInt.asUintN(64, arg0);
609
+ return addHeapObject(ret);
610
+ },
611
+ __wbindgen_object_clone_ref: function(arg0) {
612
+ const ret = getObject(arg0);
613
+ return addHeapObject(ret);
614
+ },
615
+ __wbindgen_object_drop_ref: function(arg0) {
616
+ takeObject(arg0);
617
+ },
618
+ };
619
+ return {
620
+ __proto__: null,
621
+ "./wasm_bg.js": import0,
622
+ };
623
+ }
624
+
625
+ const CompiledDocumentFinalization = (typeof FinalizationRegistry === 'undefined')
626
+ ? { register: () => {}, unregister: () => {} }
627
+ : new FinalizationRegistry(ptr => wasm.__wbg_compileddocument_free(ptr >>> 0, 1));
628
+ const QuillmarkFinalization = (typeof FinalizationRegistry === 'undefined')
629
+ ? { register: () => {}, unregister: () => {} }
630
+ : new FinalizationRegistry(ptr => wasm.__wbg_quillmark_free(ptr >>> 0, 1));
631
+
632
+ function addHeapObject(obj) {
633
+ if (heap_next === heap.length) heap.push(heap.length + 1);
634
+ const idx = heap_next;
635
+ heap_next = heap[idx];
636
+
637
+ heap[idx] = obj;
638
+ return idx;
639
+ }
640
+
641
+ function debugString(val) {
642
+ // primitive types
643
+ const type = typeof val;
644
+ if (type == 'number' || type == 'boolean' || val == null) {
645
+ return `${val}`;
646
+ }
647
+ if (type == 'string') {
648
+ return `"${val}"`;
649
+ }
650
+ if (type == 'symbol') {
651
+ const description = val.description;
652
+ if (description == null) {
653
+ return 'Symbol';
654
+ } else {
655
+ return `Symbol(${description})`;
656
+ }
657
+ }
658
+ if (type == 'function') {
659
+ const name = val.name;
660
+ if (typeof name == 'string' && name.length > 0) {
661
+ return `Function(${name})`;
662
+ } else {
663
+ return 'Function';
664
+ }
665
+ }
666
+ // objects
667
+ if (Array.isArray(val)) {
668
+ const length = val.length;
669
+ let debug = '[';
670
+ if (length > 0) {
671
+ debug += debugString(val[0]);
672
+ }
673
+ for(let i = 1; i < length; i++) {
674
+ debug += ', ' + debugString(val[i]);
675
+ }
676
+ debug += ']';
677
+ return debug;
678
+ }
679
+ // Test for built-in
680
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
681
+ let className;
682
+ if (builtInMatches && builtInMatches.length > 1) {
683
+ className = builtInMatches[1];
684
+ } else {
685
+ // Failed to match the standard '[object ClassName]'
686
+ return toString.call(val);
687
+ }
688
+ if (className == 'Object') {
689
+ // we're a user defined class or Object
690
+ // JSON.stringify avoids problems with cycles, and is generally much
691
+ // easier than looping through ownProperties of `val`.
692
+ try {
693
+ return 'Object(' + JSON.stringify(val) + ')';
694
+ } catch (_) {
695
+ return 'Object';
696
+ }
697
+ }
698
+ // errors
699
+ if (val instanceof Error) {
700
+ return `${val.name}: ${val.message}\n${val.stack}`;
701
+ }
702
+ // TODO we could test for more things here, like `Set`s and `Map`s.
703
+ return className;
704
+ }
705
+
706
+ function dropObject(idx) {
707
+ if (idx < 1028) return;
708
+ heap[idx] = heap_next;
709
+ heap_next = idx;
710
+ }
711
+
712
+ function getArrayJsValueFromWasm0(ptr, len) {
713
+ ptr = ptr >>> 0;
714
+ const mem = getDataViewMemory0();
715
+ const result = [];
716
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
717
+ result.push(takeObject(mem.getUint32(i, true)));
718
+ }
719
+ return result;
720
+ }
721
+
722
+ function getArrayU8FromWasm0(ptr, len) {
723
+ ptr = ptr >>> 0;
724
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
725
+ }
726
+
727
+ let cachedDataViewMemory0 = null;
728
+ function getDataViewMemory0() {
729
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
730
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
731
+ }
732
+ return cachedDataViewMemory0;
733
+ }
734
+
735
+ function getStringFromWasm0(ptr, len) {
736
+ ptr = ptr >>> 0;
737
+ return decodeText(ptr, len);
738
+ }
739
+
740
+ let cachedUint32ArrayMemory0 = null;
741
+ function getUint32ArrayMemory0() {
742
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
743
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
744
+ }
745
+ return cachedUint32ArrayMemory0;
746
+ }
747
+
748
+ let cachedUint8ArrayMemory0 = null;
749
+ function getUint8ArrayMemory0() {
750
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
751
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
752
+ }
753
+ return cachedUint8ArrayMemory0;
754
+ }
755
+
756
+ function getObject(idx) { return heap[idx]; }
757
+
758
+ function handleError(f, args) {
759
+ try {
760
+ return f.apply(this, args);
761
+ } catch (e) {
762
+ wasm.__wbindgen_export3(addHeapObject(e));
763
+ }
764
+ }
765
+
766
+ let heap = new Array(1024).fill(undefined);
767
+ heap.push(undefined, null, true, false);
768
+
769
+ let heap_next = heap.length;
7
770
 
771
+ function isLikeNone(x) {
772
+ return x === undefined || x === null;
773
+ }
774
+
775
+ function passArray32ToWasm0(arg, malloc) {
776
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
777
+ getUint32ArrayMemory0().set(arg, ptr / 4);
778
+ WASM_VECTOR_LEN = arg.length;
779
+ return ptr;
780
+ }
781
+
782
+ function passStringToWasm0(arg, malloc, realloc) {
783
+ if (realloc === undefined) {
784
+ const buf = cachedTextEncoder.encode(arg);
785
+ const ptr = malloc(buf.length, 1) >>> 0;
786
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
787
+ WASM_VECTOR_LEN = buf.length;
788
+ return ptr;
789
+ }
790
+
791
+ let len = arg.length;
792
+ let ptr = malloc(len, 1) >>> 0;
793
+
794
+ const mem = getUint8ArrayMemory0();
795
+
796
+ let offset = 0;
797
+
798
+ for (; offset < len; offset++) {
799
+ const code = arg.charCodeAt(offset);
800
+ if (code > 0x7F) break;
801
+ mem[ptr + offset] = code;
802
+ }
803
+ if (offset !== len) {
804
+ if (offset !== 0) {
805
+ arg = arg.slice(offset);
806
+ }
807
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
808
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
809
+ const ret = cachedTextEncoder.encodeInto(arg, view);
810
+
811
+ offset += ret.written;
812
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
813
+ }
814
+
815
+ WASM_VECTOR_LEN = offset;
816
+ return ptr;
817
+ }
818
+
819
+ function takeObject(idx) {
820
+ const ret = getObject(idx);
821
+ dropObject(idx);
822
+ return ret;
823
+ }
824
+
825
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
826
+ cachedTextDecoder.decode();
827
+ function decodeText(ptr, len) {
828
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
829
+ }
830
+
831
+ const cachedTextEncoder = new TextEncoder();
832
+
833
+ if (!('encodeInto' in cachedTextEncoder)) {
834
+ cachedTextEncoder.encodeInto = function (arg, view) {
835
+ const buf = cachedTextEncoder.encode(arg);
836
+ view.set(buf);
837
+ return {
838
+ read: arg.length,
839
+ written: buf.length
840
+ };
841
+ };
842
+ }
843
+
844
+ let WASM_VECTOR_LEN = 0;
845
+
846
+ import { readFileSync } from 'node:fs';
8
847
  const wasmUrl = new URL('wasm_bg.wasm', import.meta.url);
9
848
  const wasmBytes = readFileSync(wasmUrl);
10
849
  const wasmModule = new WebAssembly.Module(wasmBytes);
11
- const wasm = new WebAssembly.Instance(wasmModule, imports).exports;
12
- export { wasm as __wasm };
13
-
14
- imports["./wasm_bg.js"].__wbg_set_wasm(wasm, wasmModule);
850
+ let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
15
851
  wasm.__wbindgen_start();
16
-
17
- export * from "./wasm_bg.js";