@laminapdf/wasm 0.0.0-stage → 0.2.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1635 @@
1
+ /* @ts-self-types="./lamina_pdf_extract.d.ts" */
2
+
3
+ /**
4
+ * Builds a new document: pages, navigation and metadata, then [`WasmBuilder::finish`]
5
+ * gives a [`WasmDocument`] (unsaved; its save is a full rewrite).
6
+ */
7
+ export class WasmBuilder {
8
+ __destroy_into_raw() {
9
+ const ptr = this.__wbg_ptr;
10
+ this.__wbg_ptr = 0;
11
+ WasmBuilderFinalization.unregister(this);
12
+ return ptr;
13
+ }
14
+ free() {
15
+ const ptr = this.__destroy_into_raw();
16
+ wasm.__wbg_wasmbuilder_free(ptr, 0);
17
+ }
18
+ /**
19
+ * Attaches a file (`/EmbeddedFiles`, the catalog's `/AF`): `name`, its bytes and its MIME
20
+ * type. The same name again replaces the file.
21
+ *
22
+ * # Errors
23
+ * `builder-finished`; `invalid-argument` (a date that isn't a PDF date); `unknown-option`.
24
+ * @param {string} name
25
+ * @param {Uint8Array} bytes
26
+ * @param {string} mime
27
+ * @param {AttachmentInit | undefined} options
28
+ */
29
+ attach(name, bytes, mime, options) {
30
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
31
+ const len0 = WASM_VECTOR_LEN;
32
+ const ptr1 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
33
+ const len1 = WASM_VECTOR_LEN;
34
+ const ptr2 = passStringToWasm0(mime, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
35
+ const len2 = WASM_VECTOR_LEN;
36
+ const ret = wasm.wasmbuilder_attach(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, options);
37
+ if (ret[1]) {
38
+ throw takeFromExternrefTable0(ret[0]);
39
+ }
40
+ }
41
+ /**
42
+ * Defines the named destination `name`: page `index` shown as `fit` (default: the page).
43
+ *
44
+ * # Errors
45
+ * `builder-finished`; `invalid-argument` for a bad `fit`.
46
+ * @param {string} name
47
+ * @param {number} index
48
+ * @param {FitInit | undefined} fit
49
+ */
50
+ destination(name, index, fit) {
51
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
52
+ const len0 = WASM_VECTOR_LEN;
53
+ const ret = wasm.wasmbuilder_destination(this.__wbg_ptr, ptr0, len0, index, fit);
54
+ if (ret[1]) {
55
+ throw takeFromExternrefTable0(ret[0]);
56
+ }
57
+ }
58
+ /**
59
+ * Writes the fonts, links, page tree, outline and metadata, and returns the document.
60
+ * The builder is finished afterwards, and so are its unfinished pages.
61
+ *
62
+ * # Errors
63
+ * `builder-finished`; `page-index-out-of-range`, `unknown-destination`,
64
+ * `invalid-page-labels`, `invalid-geometry`, `subset-failed`.
65
+ * @returns {WasmDocument}
66
+ */
67
+ finish() {
68
+ const ret = wasm.wasmbuilder_finish(this.__wbg_ptr);
69
+ if (ret[2]) {
70
+ throw takeFromExternrefTable0(ret[1]);
71
+ }
72
+ return WasmDocument.__wrap(ret[0]);
73
+ }
74
+ /**
75
+ * The natural language (`/Lang`), a BCP 47 tag.
76
+ *
77
+ * # Errors
78
+ * `builder-finished`.
79
+ * @param {string} lang
80
+ */
81
+ lang(lang) {
82
+ const ptr0 = passStringToWasm0(lang, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
83
+ const len0 = WASM_VECTOR_LEN;
84
+ const ret = wasm.wasmbuilder_lang(this.__wbg_ptr, ptr0, len0);
85
+ if (ret[1]) {
86
+ throw takeFromExternrefTable0(ret[0]);
87
+ }
88
+ }
89
+ /**
90
+ * The metadata, written as the Info dictionary and an XMP packet.
91
+ *
92
+ * # Errors
93
+ * `builder-finished`; `invalid-argument` (a date that isn't a PDF date).
94
+ * @param {MetadataInit} metadata
95
+ */
96
+ metadata(metadata) {
97
+ const ret = wasm.wasmbuilder_metadata(this.__wbg_ptr, metadata);
98
+ if (ret[1]) {
99
+ throw takeFromExternrefTable0(ret[0]);
100
+ }
101
+ }
102
+ /**
103
+ * A builder for a new, empty document.
104
+ *
105
+ * # Errors
106
+ * `invalid-argument` / `unknown-option` for bad options.
107
+ * @param {BuildOptionsInit | undefined} options
108
+ */
109
+ constructor(options) {
110
+ const ret = wasm.wasmbuilder_new(options);
111
+ if (ret[2]) {
112
+ throw takeFromExternrefTable0(ret[1]);
113
+ }
114
+ this.__wbg_ptr = ret[0];
115
+ WasmBuilderFinalization.register(this, this.__wbg_ptr, this);
116
+ return this;
117
+ }
118
+ /**
119
+ * Adds outline items (with their children); returns their IDs in pre-order.
120
+ *
121
+ * # Errors
122
+ * `builder-finished`; `invalid-argument`; `limit-exceeded`.
123
+ * @param {OutlineEntryInit[]} entries
124
+ * @returns {string[]}
125
+ */
126
+ outline(entries) {
127
+ const ret = wasm.wasmbuilder_outline(this.__wbg_ptr, entries);
128
+ if (ret[2]) {
129
+ throw takeFromExternrefTable0(ret[1]);
130
+ }
131
+ return takeFromExternrefTable0(ret[0]);
132
+ }
133
+ /**
134
+ * The page labels, ranges by first page (checked at [`WasmBuilder::finish`]).
135
+ *
136
+ * # Errors
137
+ * `builder-finished`; `invalid-argument`.
138
+ * @param {PageLabelInit[]} ranges
139
+ */
140
+ pageLabels(ranges) {
141
+ const ret = wasm.wasmbuilder_pageLabels(this.__wbg_ptr, ranges);
142
+ if (ret[1]) {
143
+ throw takeFromExternrefTable0(ret[0]);
144
+ }
145
+ }
146
+ /**
147
+ * A page of `width` × `height` points, written by [`WasmPageBuilder::finish`].
148
+ * @param {number} width
149
+ * @param {number} height
150
+ * @returns {WasmPageBuilder}
151
+ */
152
+ page(width, height) {
153
+ const ret = wasm.wasmbuilder_page(this.__wbg_ptr, width, height);
154
+ return WasmPageBuilder.__wrap(ret);
155
+ }
156
+ /**
157
+ * How viewers present the document when it opens.
158
+ *
159
+ * # Errors
160
+ * `builder-finished`; `invalid-argument`.
161
+ * @param {ViewerPreferencesInit} prefs
162
+ */
163
+ viewerPreferences(prefs) {
164
+ const ret = wasm.wasmbuilder_viewerPreferences(this.__wbg_ptr, prefs);
165
+ if (ret[1]) {
166
+ throw takeFromExternrefTable0(ret[0]);
167
+ }
168
+ }
169
+ }
170
+ if (Symbol.dispose) WasmBuilder.prototype[Symbol.dispose] = WasmBuilder.prototype.free;
171
+
172
+ /**
173
+ * An open PDF: read it, edit it with ops (with undo), save it. The binding of
174
+ * `laminapdf::Document`, method for method (F12).
175
+ */
176
+ export class WasmDocument {
177
+ static __wrap(ptr) {
178
+ const obj = Object.create(WasmDocument.prototype);
179
+ obj.__wbg_ptr = ptr;
180
+ WasmDocumentFinalization.register(obj, obj.__wbg_ptr, obj);
181
+ return obj;
182
+ }
183
+ __destroy_into_raw() {
184
+ const ptr = this.__wbg_ptr;
185
+ this.__wbg_ptr = 0;
186
+ WasmDocumentFinalization.unregister(this);
187
+ return ptr;
188
+ }
189
+ free() {
190
+ const ptr = this.__destroy_into_raw();
191
+ wasm.__wbg_wasmdocument_free(ptr, 0);
192
+ }
193
+ /**
194
+ * Applies an op log (`{ "v": 1, "ops": [ … ] }`) as one transaction.
195
+ *
196
+ * # Errors
197
+ * `invalid-op-log`, `unsupported-version`; as [`WasmDocument::apply`].
198
+ * @param {string} json
199
+ * @returns {EditedJs}
200
+ */
201
+ applyLog(json) {
202
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
203
+ const len0 = WASM_VECTOR_LEN;
204
+ const ret = wasm.wasmdocument_applyLog(this.__wbg_ptr, ptr0, len0);
205
+ if (ret[2]) {
206
+ throw takeFromExternrefTable0(ret[1]);
207
+ }
208
+ return takeFromExternrefTable0(ret[0]);
209
+ }
210
+ /**
211
+ * Applies `ops` (the op JSON of ADR 0006 §6) in order, as one transaction.
212
+ *
213
+ * # Errors
214
+ * `invalid-argument` / `unknown-option` for a value that isn't an op; the first op's
215
+ * error (nothing is applied).
216
+ * @param {Op[]} ops
217
+ * @returns {EditedJs}
218
+ */
219
+ apply(ops) {
220
+ const ret = wasm.wasmdocument_apply(this.__wbg_ptr, ops);
221
+ if (ret[2]) {
222
+ throw takeFromExternrefTable0(ret[1]);
223
+ }
224
+ return takeFromExternrefTable0(ret[0]);
225
+ }
226
+ /**
227
+ * Whether there are changes no save has written yet.
228
+ * @returns {boolean}
229
+ */
230
+ hasUnsavedChanges() {
231
+ const ret = wasm.wasmdocument_hasUnsavedChanges(this.__wbg_ptr);
232
+ return ret !== 0;
233
+ }
234
+ /**
235
+ * The Info dictionary's text entries.
236
+ *
237
+ * # Errors
238
+ * Reading errors.
239
+ * @returns {DocumentInfoJs}
240
+ */
241
+ info() {
242
+ const ret = wasm.wasmdocument_info(this.__wbg_ptr);
243
+ if (ret[2]) {
244
+ throw takeFromExternrefTable0(ret[1]);
245
+ }
246
+ return takeFromExternrefTable0(ret[0]);
247
+ }
248
+ /**
249
+ * Opens a document from its bytes.
250
+ *
251
+ * # Errors
252
+ * The §1 object: `not-pdf`, `password-required`, `wrong-password`, `limit-exceeded`, …;
253
+ * `invalid-argument` / `unknown-option` for bad options.
254
+ * @param {Uint8Array} bytes
255
+ * @param {OpenOptionsInit | undefined} options
256
+ * @returns {WasmDocument}
257
+ */
258
+ static openBytes(bytes, options) {
259
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
260
+ const len0 = WASM_VECTOR_LEN;
261
+ const ret = wasm.wasmdocument_openBytes(ptr0, len0, options);
262
+ if (ret[2]) {
263
+ throw takeFromExternrefTable0(ret[1]);
264
+ }
265
+ return WasmDocument.__wrap(ret[0]);
266
+ }
267
+ /**
268
+ * Opens a document over a sparse source whose bytes arrive later. Until the source holds
269
+ * what a call needs, the call throws `data-pending` with `data.ranges` (`[offset, length]`
270
+ * pairs): supply them and call again. Lazy reads on the document can do the same.
271
+ *
272
+ * # Errors
273
+ * As `openBytes`, and `data-pending`.
274
+ * @param {WasmSparseSource} source
275
+ * @param {OpenOptionsInit | undefined} options
276
+ * @returns {WasmDocument}
277
+ */
278
+ static openSource(source, options) {
279
+ _assertClass(source, WasmSparseSource);
280
+ const ret = wasm.wasmdocument_openSource(source.__wbg_ptr, options);
281
+ if (ret[2]) {
282
+ throw takeFromExternrefTable0(ret[1]);
283
+ }
284
+ return WasmDocument.__wrap(ret[0]);
285
+ }
286
+ /**
287
+ * A handle on the page with `id` (`p12.0`).
288
+ *
289
+ * # Errors
290
+ * `invalid-argument` for a malformed ID; `unknown-page`.
291
+ * @param {string} id
292
+ * @returns {WasmPage}
293
+ */
294
+ pageById(id) {
295
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
296
+ const len0 = WASM_VECTOR_LEN;
297
+ const ret = wasm.wasmdocument_pageById(this.__wbg_ptr, ptr0, len0);
298
+ if (ret[2]) {
299
+ throw takeFromExternrefTable0(ret[1]);
300
+ }
301
+ return WasmPage.__wrap(ret[0]);
302
+ }
303
+ /**
304
+ * The number of pages.
305
+ *
306
+ * # Errors
307
+ * Reading errors.
308
+ * @returns {number}
309
+ */
310
+ pageCount() {
311
+ const ret = wasm.wasmdocument_pageCount(this.__wbg_ptr);
312
+ if (ret[2]) {
313
+ throw takeFromExternrefTable0(ret[1]);
314
+ }
315
+ return ret[0] >>> 0;
316
+ }
317
+ /**
318
+ * Page `index`'s facts.
319
+ *
320
+ * # Errors
321
+ * `page-index-out-of-range`; reading errors.
322
+ * @param {number} index
323
+ * @returns {PageInfoJs}
324
+ */
325
+ pageInfo(index) {
326
+ const ret = wasm.wasmdocument_pageInfo(this.__wbg_ptr, index);
327
+ if (ret[2]) {
328
+ throw takeFromExternrefTable0(ret[1]);
329
+ }
330
+ return takeFromExternrefTable0(ret[0]);
331
+ }
332
+ /**
333
+ * Every page's facts, in order (one page-tree walk).
334
+ *
335
+ * # Errors
336
+ * Reading errors.
337
+ * @returns {PageInfoJs[]}
338
+ */
339
+ pageInfos() {
340
+ const ret = wasm.wasmdocument_pageInfos(this.__wbg_ptr);
341
+ if (ret[2]) {
342
+ throw takeFromExternrefTable0(ret[1]);
343
+ }
344
+ return takeFromExternrefTable0(ret[0]);
345
+ }
346
+ /**
347
+ * A handle on page `index` that follows the page by its ID (F2).
348
+ *
349
+ * # Errors
350
+ * `page-index-out-of-range`; reading errors.
351
+ * @param {number} index
352
+ * @returns {WasmPage}
353
+ */
354
+ page(index) {
355
+ const ret = wasm.wasmdocument_page(this.__wbg_ptr, index);
356
+ if (ret[2]) {
357
+ throw takeFromExternrefTable0(ret[1]);
358
+ }
359
+ return WasmPage.__wrap(ret[0]);
360
+ }
361
+ /**
362
+ * Rebases onto `bytes`, the output of a save whose rebase failed (`not-rebased`).
363
+ *
364
+ * # Errors
365
+ * `no-pending-save`; reading errors in `bytes`.
366
+ * @param {Uint8Array} bytes
367
+ */
368
+ rebase(bytes) {
369
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
370
+ const len0 = WASM_VECTOR_LEN;
371
+ const ret = wasm.wasmdocument_rebase(this.__wbg_ptr, ptr0, len0);
372
+ if (ret[1]) {
373
+ throw takeFromExternrefTable0(ret[0]);
374
+ }
375
+ }
376
+ /**
377
+ * Redoes the newest undone transaction; `undefined` when there is nothing to redo.
378
+ *
379
+ * # Errors
380
+ * As [`WasmDocument::undo`].
381
+ * @returns {UndoOutcomeJs | undefined}
382
+ */
383
+ redo() {
384
+ const ret = wasm.wasmdocument_redo(this.__wbg_ptr);
385
+ if (ret[2]) {
386
+ throw takeFromExternrefTable0(ret[1]);
387
+ }
388
+ return takeFromExternrefTable0(ret[0]);
389
+ }
390
+ /**
391
+ * A save as a job, stepped with a budget of work units (ADR 0028 §3, §4).
392
+ *
393
+ * # Errors
394
+ * `invalid-argument` / `unknown-option` for bad options.
395
+ * @param {SaveOptionsInit | undefined} options
396
+ * @returns {WasmSaveJob}
397
+ */
398
+ saveJob(options) {
399
+ const ret = wasm.wasmdocument_saveJob(this.__wbg_ptr, options);
400
+ if (ret[2]) {
401
+ throw takeFromExternrefTable0(ret[1]);
402
+ }
403
+ return WasmSaveJob.__wrap(ret[0]);
404
+ }
405
+ /**
406
+ * Saves and rebases onto the output, running to completion: `{ bytes, report }`.
407
+ *
408
+ * # Errors
409
+ * The save's errors (`would-invalidate-signatures`, `requires-rewrite`, …).
410
+ * @param {SaveOptionsInit | undefined} options
411
+ * @returns {{ bytes: Uint8Array<ArrayBuffer>; report: SaveReportJs }}
412
+ */
413
+ save(options) {
414
+ const ret = wasm.wasmdocument_save(this.__wbg_ptr, options);
415
+ if (ret[2]) {
416
+ throw takeFromExternrefTable0(ret[1]);
417
+ }
418
+ return takeFromExternrefTable0(ret[0]);
419
+ }
420
+ /**
421
+ * Undoes the newest transaction; `undefined` when there is nothing to undo.
422
+ *
423
+ * # Errors
424
+ * `nested-transaction`, `saved-not-rebased`; reading errors.
425
+ * @returns {UndoOutcomeJs | undefined}
426
+ */
427
+ undo() {
428
+ const ret = wasm.wasmdocument_undo(this.__wbg_ptr);
429
+ if (ret[2]) {
430
+ throw takeFromExternrefTable0(ret[1]);
431
+ }
432
+ return takeFromExternrefTable0(ret[0]);
433
+ }
434
+ /**
435
+ * A cursor over the warnings so far (build warnings first), each as the §1 object.
436
+ * @returns {WasmWarningCursor}
437
+ */
438
+ warnings() {
439
+ const ret = wasm.wasmdocument_warnings(this.__wbg_ptr);
440
+ return WasmWarningCursor.__wrap(ret);
441
+ }
442
+ }
443
+ if (Symbol.dispose) WasmDocument.prototype[Symbol.dispose] = WasmDocument.prototype.free;
444
+
445
+ /**
446
+ * An image to draw (decoded or passed through once, shared by every use).
447
+ */
448
+ export class WasmImage {
449
+ static __wrap(ptr) {
450
+ const obj = Object.create(WasmImage.prototype);
451
+ obj.__wbg_ptr = ptr;
452
+ WasmImageFinalization.register(obj, obj.__wbg_ptr, obj);
453
+ return obj;
454
+ }
455
+ __destroy_into_raw() {
456
+ const ptr = this.__wbg_ptr;
457
+ this.__wbg_ptr = 0;
458
+ WasmImageFinalization.unregister(this);
459
+ return ptr;
460
+ }
461
+ free() {
462
+ const ptr = this.__destroy_into_raw();
463
+ wasm.__wbg_wasmimage_free(ptr, 0);
464
+ }
465
+ /**
466
+ * Height in pixels.
467
+ * @returns {number}
468
+ */
469
+ get height() {
470
+ const ret = wasm.wasmimage_height(this.__wbg_ptr);
471
+ return ret >>> 0;
472
+ }
473
+ /**
474
+ * A JPEG, passed through (`DCTDecode`).
475
+ *
476
+ * # Errors
477
+ * `invalid-image`, `unsupported-image`.
478
+ * @param {Uint8Array} bytes
479
+ * @returns {WasmImage}
480
+ */
481
+ static jpeg(bytes) {
482
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
483
+ const len0 = WASM_VECTOR_LEN;
484
+ const ret = wasm.wasmimage_jpeg(ptr0, len0);
485
+ if (ret[2]) {
486
+ throw takeFromExternrefTable0(ret[1]);
487
+ }
488
+ return WasmImage.__wrap(ret[0]);
489
+ }
490
+ /**
491
+ * A PNG (alpha as an `/SMask`).
492
+ *
493
+ * # Errors
494
+ * `invalid-image`, `unsupported-image`, `image-too-large`.
495
+ * @param {Uint8Array} bytes
496
+ * @returns {WasmImage}
497
+ */
498
+ static png(bytes) {
499
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
500
+ const len0 = WASM_VECTOR_LEN;
501
+ const ret = wasm.wasmimage_png(ptr0, len0);
502
+ if (ret[2]) {
503
+ throw takeFromExternrefTable0(ret[1]);
504
+ }
505
+ return WasmImage.__wrap(ret[0]);
506
+ }
507
+ /**
508
+ * Raw 8-bit RGBA pixels, row by row.
509
+ *
510
+ * # Errors
511
+ * `invalid-image` when the length isn't `width × height × 4`.
512
+ * @param {number} width
513
+ * @param {number} height
514
+ * @param {Uint8Array} rgba
515
+ * @returns {WasmImage}
516
+ */
517
+ static rgba(width, height, rgba) {
518
+ const ptr0 = passArray8ToWasm0(rgba, wasm.__wbindgen_malloc);
519
+ const len0 = WASM_VECTOR_LEN;
520
+ const ret = wasm.wasmimage_rgba(width, height, ptr0, len0);
521
+ if (ret[2]) {
522
+ throw takeFromExternrefTable0(ret[1]);
523
+ }
524
+ return WasmImage.__wrap(ret[0]);
525
+ }
526
+ /**
527
+ * Width in pixels.
528
+ * @returns {number}
529
+ */
530
+ get width() {
531
+ const ret = wasm.wasmimage_width(this.__wbg_ptr);
532
+ return ret >>> 0;
533
+ }
534
+ }
535
+ if (Symbol.dispose) WasmImage.prototype[Symbol.dispose] = WasmImage.prototype.free;
536
+
537
+ /**
538
+ * A page of a [`WasmDocument`], held by its ID (F2): moving pages doesn't retarget it.
539
+ */
540
+ export class WasmPage {
541
+ static __wrap(ptr) {
542
+ const obj = Object.create(WasmPage.prototype);
543
+ obj.__wbg_ptr = ptr;
544
+ WasmPageFinalization.register(obj, obj.__wbg_ptr, obj);
545
+ return obj;
546
+ }
547
+ __destroy_into_raw() {
548
+ const ptr = this.__wbg_ptr;
549
+ this.__wbg_ptr = 0;
550
+ WasmPageFinalization.unregister(this);
551
+ return ptr;
552
+ }
553
+ free() {
554
+ const ptr = this.__destroy_into_raw();
555
+ wasm.__wbg_wasmpage_free(ptr, 0);
556
+ }
557
+ /**
558
+ * The page's stable ID (`p12.0`).
559
+ * @returns {string}
560
+ */
561
+ get id() {
562
+ let deferred1_0;
563
+ let deferred1_1;
564
+ try {
565
+ const ret = wasm.wasmpage_id(this.__wbg_ptr);
566
+ deferred1_0 = ret[0];
567
+ deferred1_1 = ret[1];
568
+ return getStringFromWasm0(ret[0], ret[1]);
569
+ } finally {
570
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
571
+ }
572
+ }
573
+ /**
574
+ * The page's current 0-based index.
575
+ *
576
+ * # Errors
577
+ * `unknown-page` when the page is gone; reading errors.
578
+ * @returns {number}
579
+ */
580
+ index() {
581
+ const ret = wasm.wasmpage_index(this.__wbg_ptr);
582
+ if (ret[2]) {
583
+ throw takeFromExternrefTable0(ret[1]);
584
+ }
585
+ return ret[0] >>> 0;
586
+ }
587
+ /**
588
+ * The page's facts now.
589
+ *
590
+ * # Errors
591
+ * As [`WasmPage::index`].
592
+ * @returns {PageInfoJs}
593
+ */
594
+ info() {
595
+ const ret = wasm.wasmpage_info(this.__wbg_ptr);
596
+ if (ret[2]) {
597
+ throw takeFromExternrefTable0(ret[1]);
598
+ }
599
+ return takeFromExternrefTable0(ret[0]);
600
+ }
601
+ /**
602
+ * The page's text: lines, runs, glyph quads and glyph text (B9c; the extract and text
603
+ * modules).
604
+ *
605
+ * # Errors
606
+ * `unknown-page` when the page is gone; `data-pending` and the reading errors;
607
+ * `unknown-option` / `invalid-argument` for bad options.
608
+ * @param {TextOptionsInit | undefined} options
609
+ * @returns {PageTextJs}
610
+ */
611
+ text(options) {
612
+ const ret = wasm.wasmpage_text(this.__wbg_ptr, options);
613
+ if (ret[2]) {
614
+ throw takeFromExternrefTable0(ret[1]);
615
+ }
616
+ return takeFromExternrefTable0(ret[0]);
617
+ }
618
+ }
619
+ if (Symbol.dispose) WasmPage.prototype[Symbol.dispose] = WasmPage.prototype.free;
620
+
621
+ /**
622
+ * One page being drawn, in page space (points from the top-left, y down; ADR 0027).
623
+ * Invalid geometry is reported by [`WasmPageBuilder::finish`] (`invalid-geometry`).
624
+ */
625
+ export class WasmPageBuilder {
626
+ static __wrap(ptr) {
627
+ const obj = Object.create(WasmPageBuilder.prototype);
628
+ obj.__wbg_ptr = ptr;
629
+ WasmPageBuilderFinalization.register(obj, obj.__wbg_ptr, obj);
630
+ return obj;
631
+ }
632
+ __destroy_into_raw() {
633
+ const ptr = this.__wbg_ptr;
634
+ this.__wbg_ptr = 0;
635
+ WasmPageBuilderFinalization.unregister(this);
636
+ return ptr;
637
+ }
638
+ free() {
639
+ const ptr = this.__destroy_into_raw();
640
+ wasm.__wbg_wasmpagebuilder_free(ptr, 0);
641
+ }
642
+ /**
643
+ * Opens an artifact until the matching `endTag`: `kind` is `layout`, `page`, `pagination`
644
+ * or `background`.
645
+ *
646
+ * # Errors
647
+ * `invalid-argument` for another kind.
648
+ * @param {string} kind
649
+ */
650
+ beginArtifact(kind) {
651
+ const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
652
+ const len0 = WASM_VECTOR_LEN;
653
+ const ret = wasm.wasmpagebuilder_beginArtifact(this.__wbg_ptr, ptr0, len0);
654
+ if (ret[1]) {
655
+ throw takeFromExternrefTable0(ret[0]);
656
+ }
657
+ }
658
+ /**
659
+ * Opens a structure element until the matching `endTag`: `kind` names a standard type
660
+ * (`Document`, `Part`, `Sect`, `H1`–`H6`, `P`, `L`, `LI`, `Lbl`, `LBody`, `Table`, `TR`,
661
+ * `TH`, `TD`, `Figure`, `Caption`, `Link`, `Span`, `Quote`, `Note`, `Code`), the role of
662
+ * `custom` when given; `/Alt`, `/ActualText`, `/Lang`, `/E`; `scope` is `row`, `column` or
663
+ * `both` when given.
664
+ *
665
+ * # Errors
666
+ * `invalid-argument` for an unknown `kind` or `scope`.
667
+ * @param {string} kind
668
+ * @param {string | null} [custom]
669
+ * @param {string | null} [alt]
670
+ * @param {string | null} [actualText]
671
+ * @param {string | null} [lang]
672
+ * @param {string | null} [expansion]
673
+ * @param {string | null} [scope]
674
+ */
675
+ beginTag(kind, custom, alt, actualText, lang, expansion, scope) {
676
+ const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
677
+ const len0 = WASM_VECTOR_LEN;
678
+ var ptr1 = isLikeNone(custom) ? 0 : passStringToWasm0(custom, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
679
+ var len1 = WASM_VECTOR_LEN;
680
+ var ptr2 = isLikeNone(alt) ? 0 : passStringToWasm0(alt, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
681
+ var len2 = WASM_VECTOR_LEN;
682
+ var ptr3 = isLikeNone(actualText) ? 0 : passStringToWasm0(actualText, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
683
+ var len3 = WASM_VECTOR_LEN;
684
+ var ptr4 = isLikeNone(lang) ? 0 : passStringToWasm0(lang, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
685
+ var len4 = WASM_VECTOR_LEN;
686
+ var ptr5 = isLikeNone(expansion) ? 0 : passStringToWasm0(expansion, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
687
+ var len5 = WASM_VECTOR_LEN;
688
+ var ptr6 = isLikeNone(scope) ? 0 : passStringToWasm0(scope, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
689
+ var len6 = WASM_VECTOR_LEN;
690
+ const ret = wasm.wasmpagebuilder_beginTag(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6);
691
+ if (ret[1]) {
692
+ throw takeFromExternrefTable0(ret[0]);
693
+ }
694
+ }
695
+ /**
696
+ * The blend mode, camelCase (`multiply`, `colorDodge`, …).
697
+ *
698
+ * # Errors
699
+ * `invalid-argument` for an unknown mode.
700
+ * @param {string} mode
701
+ */
702
+ blendMode(mode) {
703
+ const ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
704
+ const len0 = WASM_VECTOR_LEN;
705
+ const ret = wasm.wasmpagebuilder_blendMode(this.__wbg_ptr, ptr0, len0);
706
+ if (ret[1]) {
707
+ throw takeFromExternrefTable0(ret[0]);
708
+ }
709
+ }
710
+ /**
711
+ * Clips to `path` (with `rule`) until the next `restore`.
712
+ *
713
+ * # Errors
714
+ * As [`WasmPageBuilder::fill_path`].
715
+ * @param {Float64Array} path
716
+ * @param {string} rule
717
+ */
718
+ clipPath(path, rule) {
719
+ const ptr0 = passArrayF64ToWasm0(path, wasm.__wbindgen_malloc);
720
+ const len0 = WASM_VECTOR_LEN;
721
+ const ptr1 = passStringToWasm0(rule, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
722
+ const len1 = WASM_VECTOR_LEN;
723
+ const ret = wasm.wasmpagebuilder_clipPath(this.__wbg_ptr, ptr0, len0, ptr1, len1);
724
+ if (ret[1]) {
725
+ throw takeFromExternrefTable0(ret[0]);
726
+ }
727
+ }
728
+ /**
729
+ * Ends the innermost open element or artifact (none open: nothing happens).
730
+ *
731
+ * # Errors
732
+ * `builder-finished`.
733
+ */
734
+ endTag() {
735
+ const ret = wasm.wasmpagebuilder_endTag(this.__wbg_ptr);
736
+ if (ret[1]) {
737
+ throw takeFromExternrefTable0(ret[0]);
738
+ }
739
+ }
740
+ /**
741
+ * The fill colour as `#rrggbb` or `#rgb` (`DeviceRGB`).
742
+ *
743
+ * # Errors
744
+ * `invalid-color`.
745
+ * @param {string} hex
746
+ */
747
+ fillColorHex(hex) {
748
+ const ptr0 = passStringToWasm0(hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
749
+ const len0 = WASM_VECTOR_LEN;
750
+ const ret = wasm.wasmpagebuilder_fillColorHex(this.__wbg_ptr, ptr0, len0);
751
+ if (ret[1]) {
752
+ throw takeFromExternrefTable0(ret[0]);
753
+ }
754
+ }
755
+ /**
756
+ * The colour fills use: 1 (gray), 3 (RGB) or 4 (CMYK) components, 0 to 1.
757
+ *
758
+ * # Errors
759
+ * `invalid-argument` for another number of components.
760
+ * @param {Float64Array} components
761
+ */
762
+ fillColor(components) {
763
+ const ptr0 = passArrayF64ToWasm0(components, wasm.__wbindgen_malloc);
764
+ const len0 = WASM_VECTOR_LEN;
765
+ const ret = wasm.wasmpagebuilder_fillColor(this.__wbg_ptr, ptr0, len0);
766
+ if (ret[1]) {
767
+ throw takeFromExternrefTable0(ret[0]);
768
+ }
769
+ }
770
+ /**
771
+ * Fills `path` (the flat path encoding) with `rule` (`nonZero` or `evenOdd`).
772
+ *
773
+ * # Errors
774
+ * `invalid-argument` for a bad path or rule.
775
+ * @param {Float64Array} path
776
+ * @param {string} rule
777
+ */
778
+ fillPath(path, rule) {
779
+ const ptr0 = passArrayF64ToWasm0(path, wasm.__wbindgen_malloc);
780
+ const len0 = WASM_VECTOR_LEN;
781
+ const ptr1 = passStringToWasm0(rule, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
782
+ const len1 = WASM_VECTOR_LEN;
783
+ const ret = wasm.wasmpagebuilder_fillPath(this.__wbg_ptr, ptr0, len0, ptr1, len1);
784
+ if (ret[1]) {
785
+ throw takeFromExternrefTable0(ret[0]);
786
+ }
787
+ }
788
+ /**
789
+ * Fills `path` with `rule`, then strokes it with the current stroke style.
790
+ *
791
+ * # Errors
792
+ * As [`WasmPageBuilder::fill_path`].
793
+ * @param {Float64Array} path
794
+ * @param {string} rule
795
+ */
796
+ fillStrokePath(path, rule) {
797
+ const ptr0 = passArrayF64ToWasm0(path, wasm.__wbindgen_malloc);
798
+ const len0 = WASM_VECTOR_LEN;
799
+ const ptr1 = passStringToWasm0(rule, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
800
+ const len1 = WASM_VECTOR_LEN;
801
+ const ret = wasm.wasmpagebuilder_fillStrokePath(this.__wbg_ptr, ptr0, len0, ptr1, len1);
802
+ if (ret[1]) {
803
+ throw takeFromExternrefTable0(ret[0]);
804
+ }
805
+ }
806
+ /**
807
+ * Writes the page into its builder: content stream, resources and page dictionary.
808
+ * Returns its page ID. The page is finished afterwards: every later call on it fails
809
+ * with `builder-finished`.
810
+ *
811
+ * # Errors
812
+ * `builder-finished` (the page or its builder already finished); `invalid-geometry` for
813
+ * the first invalid value drawn; `unknown-font` for a font from another builder.
814
+ * @returns {string}
815
+ */
816
+ finish() {
817
+ let deferred2_0;
818
+ let deferred2_1;
819
+ try {
820
+ const ret = wasm.wasmpagebuilder_finish(this.__wbg_ptr);
821
+ var ptr1 = ret[0];
822
+ var len1 = ret[1];
823
+ if (ret[3]) {
824
+ ptr1 = 0; len1 = 0;
825
+ throw takeFromExternrefTable0(ret[2]);
826
+ }
827
+ deferred2_0 = ptr1;
828
+ deferred2_1 = len1;
829
+ return getStringFromWasm0(ptr1, len1);
830
+ } finally {
831
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
832
+ }
833
+ }
834
+ /**
835
+ * Draws `image` scaled into the rectangle.
836
+ *
837
+ * # Errors
838
+ * `builder-finished`.
839
+ * @param {WasmImage} image
840
+ * @param {number} x
841
+ * @param {number} y
842
+ * @param {number} width
843
+ * @param {number} height
844
+ */
845
+ image(image, x, y, width, height) {
846
+ _assertClass(image, WasmImage);
847
+ const ret = wasm.wasmpagebuilder_image(this.__wbg_ptr, image.__wbg_ptr, x, y, width, height);
848
+ if (ret[1]) {
849
+ throw takeFromExternrefTable0(ret[0]);
850
+ }
851
+ }
852
+ /**
853
+ * A link annotation over the rectangle, with `contents` as its alternate text.
854
+ *
855
+ * # Errors
856
+ * `invalid-argument` / `unknown-option` for a bad target.
857
+ * @param {number} x
858
+ * @param {number} y
859
+ * @param {number} width
860
+ * @param {number} height
861
+ * @param {LinkTargetInit} target
862
+ * @param {string | null} [contents]
863
+ */
864
+ link(x, y, width, height, target, contents) {
865
+ var ptr0 = isLikeNone(contents) ? 0 : passStringToWasm0(contents, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
866
+ var len0 = WASM_VECTOR_LEN;
867
+ const ret = wasm.wasmpagebuilder_link(this.__wbg_ptr, x, y, width, height, target, ptr0, len0);
868
+ if (ret[1]) {
869
+ throw takeFromExternrefTable0(ret[0]);
870
+ }
871
+ }
872
+ /**
873
+ * Fill and stroke opacity, 0 to 1 (an `ExtGState`).
874
+ *
875
+ * # Errors
876
+ * `builder-finished`.
877
+ * @param {number} fill
878
+ * @param {number} stroke
879
+ */
880
+ opacity(fill, stroke) {
881
+ const ret = wasm.wasmpagebuilder_opacity(this.__wbg_ptr, fill, stroke);
882
+ if (ret[1]) {
883
+ throw takeFromExternrefTable0(ret[0]);
884
+ }
885
+ }
886
+ /**
887
+ * Restores the graphics state (`Q`); one without a matching save is ignored.
888
+ *
889
+ * # Errors
890
+ * `builder-finished`.
891
+ */
892
+ restore() {
893
+ const ret = wasm.wasmpagebuilder_restore(this.__wbg_ptr);
894
+ if (ret[1]) {
895
+ throw takeFromExternrefTable0(ret[0]);
896
+ }
897
+ }
898
+ /**
899
+ * `/Rotate`: 0, 90, 180 or 270 degrees.
900
+ *
901
+ * # Errors
902
+ * `invalid-argument` for another angle.
903
+ * @param {number} degrees
904
+ */
905
+ rotate(degrees) {
906
+ const ret = wasm.wasmpagebuilder_rotate(this.__wbg_ptr, degrees);
907
+ if (ret[1]) {
908
+ throw takeFromExternrefTable0(ret[0]);
909
+ }
910
+ }
911
+ /**
912
+ * Saves the graphics state (`q`).
913
+ *
914
+ * # Errors
915
+ * `builder-finished` after [`WasmPageBuilder::finish`] (so does every drawing method).
916
+ */
917
+ save() {
918
+ const ret = wasm.wasmpagebuilder_save(this.__wbg_ptr);
919
+ if (ret[1]) {
920
+ throw takeFromExternrefTable0(ret[0]);
921
+ }
922
+ }
923
+ /**
924
+ * `/CropBox`, `/BleedBox`, `/TrimBox` or `/ArtBox` (`kind`: `crop`, `bleed`, `trim`,
925
+ * `art`), in the media box's page space.
926
+ *
927
+ * # Errors
928
+ * `invalid-argument` for another kind.
929
+ * @param {"crop" | "bleed" | "trim" | "art"} kind
930
+ * @param {number} x
931
+ * @param {number} y
932
+ * @param {number} width
933
+ * @param {number} height
934
+ */
935
+ setBox(kind, x, y, width, height) {
936
+ const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
937
+ const len0 = WASM_VECTOR_LEN;
938
+ const ret = wasm.wasmpagebuilder_setBox(this.__wbg_ptr, ptr0, len0, x, y, width, height);
939
+ if (ret[1]) {
940
+ throw takeFromExternrefTable0(ret[0]);
941
+ }
942
+ }
943
+ /**
944
+ * The stroke colour as `#rrggbb` or `#rgb`.
945
+ *
946
+ * # Errors
947
+ * `invalid-color`.
948
+ * @param {string} hex
949
+ */
950
+ strokeColorHex(hex) {
951
+ const ptr0 = passStringToWasm0(hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
952
+ const len0 = WASM_VECTOR_LEN;
953
+ const ret = wasm.wasmpagebuilder_strokeColorHex(this.__wbg_ptr, ptr0, len0);
954
+ if (ret[1]) {
955
+ throw takeFromExternrefTable0(ret[0]);
956
+ }
957
+ }
958
+ /**
959
+ * The colour strokes use (as [`WasmPageBuilder::fill_color`]).
960
+ *
961
+ * # Errors
962
+ * As [`WasmPageBuilder::fill_color`].
963
+ * @param {Float64Array} components
964
+ */
965
+ strokeColor(components) {
966
+ const ptr0 = passArrayF64ToWasm0(components, wasm.__wbindgen_malloc);
967
+ const len0 = WASM_VECTOR_LEN;
968
+ const ret = wasm.wasmpagebuilder_strokeColor(this.__wbg_ptr, ptr0, len0);
969
+ if (ret[1]) {
970
+ throw takeFromExternrefTable0(ret[0]);
971
+ }
972
+ }
973
+ /**
974
+ * Strokes `path` with the current stroke style.
975
+ *
976
+ * # Errors
977
+ * `invalid-argument` for a bad path.
978
+ * @param {Float64Array} path
979
+ */
980
+ strokePath(path) {
981
+ const ptr0 = passArrayF64ToWasm0(path, wasm.__wbindgen_malloc);
982
+ const len0 = WASM_VECTOR_LEN;
983
+ const ret = wasm.wasmpagebuilder_strokePath(this.__wbg_ptr, ptr0, len0);
984
+ if (ret[1]) {
985
+ throw takeFromExternrefTable0(ret[0]);
986
+ }
987
+ }
988
+ /**
989
+ * The style later strokes use: `width` (points), `cap` (`butt`, `round`, `square`),
990
+ * `join` (`miter`, `round`, `bevel`), the miter limit and a dash pattern (empty: solid).
991
+ *
992
+ * # Errors
993
+ * `invalid-argument` for an unknown cap or join.
994
+ * @param {number} width
995
+ * @param {string} cap
996
+ * @param {string} join
997
+ * @param {number} miterLimit
998
+ * @param {Float64Array} dash
999
+ * @param {number} dashPhase
1000
+ */
1001
+ strokeStyle(width, cap, join, miterLimit, dash, dashPhase) {
1002
+ const ptr0 = passStringToWasm0(cap, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1003
+ const len0 = WASM_VECTOR_LEN;
1004
+ const ptr1 = passStringToWasm0(join, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1005
+ const len1 = WASM_VECTOR_LEN;
1006
+ const ptr2 = passArrayF64ToWasm0(dash, wasm.__wbindgen_malloc);
1007
+ const len2 = WASM_VECTOR_LEN;
1008
+ const ret = wasm.wasmpagebuilder_strokeStyle(this.__wbg_ptr, width, ptr0, len0, ptr1, len1, miterLimit, ptr2, len2, dashPhase);
1009
+ if (ret[1]) {
1010
+ throw takeFromExternrefTable0(ret[0]);
1011
+ }
1012
+ }
1013
+ /**
1014
+ * Applies `[a, b, c, d, e, f]` (page space) to what is drawn next.
1015
+ *
1016
+ * # Errors
1017
+ * `invalid-argument` unless there are 6 numbers.
1018
+ * @param {Float64Array} m
1019
+ */
1020
+ transform(m) {
1021
+ const ptr0 = passArrayF64ToWasm0(m, wasm.__wbindgen_malloc);
1022
+ const len0 = WASM_VECTOR_LEN;
1023
+ const ret = wasm.wasmpagebuilder_transform(this.__wbg_ptr, ptr0, len0);
1024
+ if (ret[1]) {
1025
+ throw takeFromExternrefTable0(ret[0]);
1026
+ }
1027
+ }
1028
+ /**
1029
+ * `/UserUnit`, for pages larger than 14,400 units.
1030
+ * @param {number} unit
1031
+ */
1032
+ userUnit(unit) {
1033
+ wasm.wasmpagebuilder_userUnit(this.__wbg_ptr, unit);
1034
+ }
1035
+ }
1036
+ if (Symbol.dispose) WasmPageBuilder.prototype[Symbol.dispose] = WasmPageBuilder.prototype.free;
1037
+
1038
+ /**
1039
+ * A save in progress (F10). Each `step` checks that the document is unchanged since the
1040
+ * job was created (`document-changed`).
1041
+ */
1042
+ export class WasmSaveJob {
1043
+ static __wrap(ptr) {
1044
+ const obj = Object.create(WasmSaveJob.prototype);
1045
+ obj.__wbg_ptr = ptr;
1046
+ WasmSaveJobFinalization.register(obj, obj.__wbg_ptr, obj);
1047
+ return obj;
1048
+ }
1049
+ __destroy_into_raw() {
1050
+ const ptr = this.__wbg_ptr;
1051
+ this.__wbg_ptr = 0;
1052
+ WasmSaveJobFinalization.unregister(this);
1053
+ return ptr;
1054
+ }
1055
+ free() {
1056
+ const ptr = this.__destroy_into_raw();
1057
+ wasm.__wbg_wasmsavejob_free(ptr, 0);
1058
+ }
1059
+ /**
1060
+ * Stops the job: its next step fails with `cancelled`.
1061
+ */
1062
+ cancel() {
1063
+ wasm.wasmsavejob_cancel(this.__wbg_ptr);
1064
+ }
1065
+ /**
1066
+ * Runs at most `budget` work units: `{ state: "progress", done, total?, phase }` or
1067
+ * `{ state: "done", bytes, report }`.
1068
+ *
1069
+ * # Errors
1070
+ * `cancelled`, `document-changed`, `job-finished`, or the save's own errors.
1071
+ * @param {number} budget
1072
+ * @returns {({ state: "progress" } & ProgressJs) | { state: "done"; bytes: Uint8Array<ArrayBuffer>; report: SaveReportJs }}
1073
+ */
1074
+ step(budget) {
1075
+ const ret = wasm.wasmsavejob_step(this.__wbg_ptr, budget);
1076
+ if (ret[2]) {
1077
+ throw takeFromExternrefTable0(ret[1]);
1078
+ }
1079
+ return takeFromExternrefTable0(ret[0]);
1080
+ }
1081
+ }
1082
+ if (Symbol.dispose) WasmSaveJob.prototype[Symbol.dispose] = WasmSaveJob.prototype.free;
1083
+
1084
+ /**
1085
+ * A PDF of known size whose bytes arrive later: give it to `WasmDocument.openSource`, and
1086
+ * after a `data-pending` error `supply` the ranges in its `data.ranges` and call again.
1087
+ */
1088
+ export class WasmSparseSource {
1089
+ __destroy_into_raw() {
1090
+ const ptr = this.__wbg_ptr;
1091
+ this.__wbg_ptr = 0;
1092
+ WasmSparseSourceFinalization.unregister(this);
1093
+ return ptr;
1094
+ }
1095
+ free() {
1096
+ const ptr = this.__destroy_into_raw();
1097
+ wasm.__wbg_wasmsparsesource_free(ptr, 0);
1098
+ }
1099
+ /**
1100
+ * An empty source of `size` bytes holding at most `budget` bytes (no limit when omitted).
1101
+ *
1102
+ * # Errors
1103
+ * `invalid-argument` when a number isn't a whole number of bytes.
1104
+ * @param {number} size
1105
+ * @param {number | null} [budget]
1106
+ */
1107
+ constructor(size, budget) {
1108
+ const ret = wasm.wasmsparsesource_new(size, !isLikeNone(budget), isLikeNone(budget) ? 0 : budget);
1109
+ if (ret[2]) {
1110
+ throw takeFromExternrefTable0(ret[1]);
1111
+ }
1112
+ this.__wbg_ptr = ret[0];
1113
+ WasmSparseSourceFinalization.register(this, this.__wbg_ptr, this);
1114
+ return this;
1115
+ }
1116
+ /**
1117
+ * The source's size in bytes.
1118
+ * @returns {number}
1119
+ */
1120
+ get size() {
1121
+ const ret = wasm.wasmsparsesource_size(this.__wbg_ptr);
1122
+ return ret;
1123
+ }
1124
+ /**
1125
+ * Adds `bytes` at `offset` (bytes already held win over overlapping ones).
1126
+ *
1127
+ * # Errors
1128
+ * `invalid-argument` past the end; `source-budget-exceeded` over the budget.
1129
+ * @param {number} offset
1130
+ * @param {Uint8Array} bytes
1131
+ */
1132
+ supply(offset, bytes) {
1133
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
1134
+ const len0 = WASM_VECTOR_LEN;
1135
+ const ret = wasm.wasmsparsesource_supply(this.__wbg_ptr, offset, ptr0, len0);
1136
+ if (ret[1]) {
1137
+ throw takeFromExternrefTable0(ret[0]);
1138
+ }
1139
+ }
1140
+ /**
1141
+ * What to fetch for the ranges a `data-pending` asked for (flat `[start, end, …]`): each
1142
+ * widened to blocks of `block` bytes (0: as asked) plus `readahead`, merged, minus what is
1143
+ * held, in the same flat form. The planning step of `laminapdf-source`'s `retry`, so every
1144
+ * loop plans the same way.
1145
+ *
1146
+ * # Errors
1147
+ * `invalid-argument` for an odd length or a value that isn't a whole number of bytes.
1148
+ * @param {Float64Array} asked
1149
+ * @param {number} block
1150
+ * @param {number} readahead
1151
+ * @returns {Float64Array}
1152
+ */
1153
+ toFetch(asked, block, readahead) {
1154
+ const ptr0 = passArrayF64ToWasm0(asked, wasm.__wbindgen_malloc);
1155
+ const len0 = WASM_VECTOR_LEN;
1156
+ const ret = wasm.wasmsparsesource_toFetch(this.__wbg_ptr, ptr0, len0, block, readahead);
1157
+ if (ret[2]) {
1158
+ throw takeFromExternrefTable0(ret[1]);
1159
+ }
1160
+ return takeFromExternrefTable0(ret[0]);
1161
+ }
1162
+ }
1163
+ if (Symbol.dispose) WasmSparseSource.prototype[Symbol.dispose] = WasmSparseSource.prototype.free;
1164
+
1165
+ /**
1166
+ * The warnings of a document, read in batches (F8).
1167
+ */
1168
+ export class WasmWarningCursor {
1169
+ static __wrap(ptr) {
1170
+ const obj = Object.create(WasmWarningCursor.prototype);
1171
+ obj.__wbg_ptr = ptr;
1172
+ WasmWarningCursorFinalization.register(obj, obj.__wbg_ptr, obj);
1173
+ return obj;
1174
+ }
1175
+ __destroy_into_raw() {
1176
+ const ptr = this.__wbg_ptr;
1177
+ this.__wbg_ptr = 0;
1178
+ WasmWarningCursorFinalization.unregister(this);
1179
+ return ptr;
1180
+ }
1181
+ free() {
1182
+ const ptr = this.__destroy_into_raw();
1183
+ wasm.__wbg_wasmwarningcursor_free(ptr, 0);
1184
+ }
1185
+ /**
1186
+ * Up to `max` more warnings, each as the ADR 0026 §1 object; empty at the end.
1187
+ * @param {number} max
1188
+ * @returns {Diagnostic[]}
1189
+ */
1190
+ nextBatch(max) {
1191
+ const ret = wasm.wasmwarningcursor_nextBatch(this.__wbg_ptr, max);
1192
+ return ret;
1193
+ }
1194
+ /**
1195
+ * How many warnings are left.
1196
+ * @returns {number}
1197
+ */
1198
+ remaining() {
1199
+ const ret = wasm.wasmwarningcursor_remaining(this.__wbg_ptr);
1200
+ return ret >>> 0;
1201
+ }
1202
+ }
1203
+ if (Symbol.dispose) WasmWarningCursor.prototype[Symbol.dispose] = WasmWarningCursor.prototype.free;
1204
+
1205
+ /**
1206
+ * Whether this module is the text module (fonts, `text`, `textBox`).
1207
+ * @returns {boolean}
1208
+ */
1209
+ export function hasText() {
1210
+ const ret = wasm.hasText();
1211
+ return ret !== 0;
1212
+ }
1213
+
1214
+ /**
1215
+ * The crate version (`@laminapdf/wasm`'s).
1216
+ * @returns {string}
1217
+ */
1218
+ export function version() {
1219
+ let deferred1_0;
1220
+ let deferred1_1;
1221
+ try {
1222
+ const ret = wasm.version();
1223
+ deferred1_0 = ret[0];
1224
+ deferred1_1 = ret[1];
1225
+ return getStringFromWasm0(ret[0], ret[1]);
1226
+ } finally {
1227
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1228
+ }
1229
+ }
1230
+ function __wbg_get_imports() {
1231
+ const import0 = {
1232
+ __proto__: null,
1233
+ __wbg___wbindgen_is_null_e343b7d08827ba72: function(arg0) {
1234
+ const ret = arg0 === null;
1235
+ return ret;
1236
+ },
1237
+ __wbg___wbindgen_is_object_3c45d4f2dde4e749: function(arg0) {
1238
+ const val = arg0;
1239
+ const ret = typeof(val) === 'object' && val !== null;
1240
+ return ret;
1241
+ },
1242
+ __wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
1243
+ const ret = arg0 === undefined;
1244
+ return ret;
1245
+ },
1246
+ __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
1247
+ const obj = arg1;
1248
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1249
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1250
+ var len1 = WASM_VECTOR_LEN;
1251
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1252
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1253
+ },
1254
+ __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
1255
+ throw new Error(getStringFromWasm0(arg0, arg1));
1256
+ },
1257
+ __wbg_keys_440be172f17c0265: function(arg0) {
1258
+ const ret = Object.keys(arg0);
1259
+ return ret;
1260
+ },
1261
+ __wbg_new_617a8cdb8bb1130e: function() {
1262
+ const ret = new Object();
1263
+ return ret;
1264
+ },
1265
+ __wbg_new_from_slice_37a3c3a194266cb8: function(arg0, arg1) {
1266
+ const ret = new Uint32Array(getArrayU32FromWasm0(arg0, arg1));
1267
+ return ret;
1268
+ },
1269
+ __wbg_new_from_slice_9a868026ffa4208a: function(arg0, arg1) {
1270
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1271
+ return ret;
1272
+ },
1273
+ __wbg_new_from_slice_ca6ad97db1f4779a: function(arg0, arg1) {
1274
+ const ret = new Float32Array(getArrayF32FromWasm0(arg0, arg1));
1275
+ return ret;
1276
+ },
1277
+ __wbg_new_from_slice_f545fd22ddc142b8: function(arg0, arg1) {
1278
+ const ret = new Float64Array(getArrayF64FromWasm0(arg0, arg1));
1279
+ return ret;
1280
+ },
1281
+ __wbg_parse_0fc53dead14b3b42: function() { return handleError(function (arg0, arg1) {
1282
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
1283
+ return ret;
1284
+ }, arguments); },
1285
+ __wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
1286
+ const ret = Reflect.set(arg0, arg1, arg2);
1287
+ return ret;
1288
+ }, arguments); },
1289
+ __wbg_slice_6da4cdc5d543fcd0: function(arg0, arg1) {
1290
+ const ret = arg1.slice();
1291
+ const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_malloc);
1292
+ const len1 = WASM_VECTOR_LEN;
1293
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1294
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1295
+ },
1296
+ __wbg_stringify_52ff602c1cc4fbb6: function() { return handleError(function (arg0) {
1297
+ const ret = JSON.stringify(arg0);
1298
+ return ret;
1299
+ }, arguments); },
1300
+ __wbindgen_generic_0000000000000001: function(arg0) {
1301
+ // Cast intrinsic for `F64 -> Externref`.
1302
+ const ret = arg0;
1303
+ return ret;
1304
+ },
1305
+ __wbindgen_generic_0000000000000002: function(arg0, arg1) {
1306
+ // Cast intrinsic for `Ref(String) -> Externref`.
1307
+ const ret = getStringFromWasm0(arg0, arg1);
1308
+ return ret;
1309
+ },
1310
+ __wbindgen_init_externref_table: function() {
1311
+ const table = wasm.__wbindgen_externrefs;
1312
+ const offset = table.grow(4);
1313
+ table.set(0, undefined);
1314
+ table.set(offset + 0, undefined);
1315
+ table.set(offset + 1, null);
1316
+ table.set(offset + 2, true);
1317
+ table.set(offset + 3, false);
1318
+ },
1319
+ };
1320
+ return {
1321
+ __proto__: null,
1322
+ "./lamina_pdf_extract_bg.js": import0,
1323
+ };
1324
+ }
1325
+
1326
+ const WasmBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
1327
+ ? { register: () => {}, unregister: () => {} }
1328
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmbuilder_free(ptr, 1));
1329
+ const WasmDocumentFinalization = (typeof FinalizationRegistry === 'undefined')
1330
+ ? { register: () => {}, unregister: () => {} }
1331
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmdocument_free(ptr, 1));
1332
+ const WasmImageFinalization = (typeof FinalizationRegistry === 'undefined')
1333
+ ? { register: () => {}, unregister: () => {} }
1334
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmimage_free(ptr, 1));
1335
+ const WasmPageFinalization = (typeof FinalizationRegistry === 'undefined')
1336
+ ? { register: () => {}, unregister: () => {} }
1337
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmpage_free(ptr, 1));
1338
+ const WasmPageBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
1339
+ ? { register: () => {}, unregister: () => {} }
1340
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmpagebuilder_free(ptr, 1));
1341
+ const WasmSaveJobFinalization = (typeof FinalizationRegistry === 'undefined')
1342
+ ? { register: () => {}, unregister: () => {} }
1343
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmsavejob_free(ptr, 1));
1344
+ const WasmSparseSourceFinalization = (typeof FinalizationRegistry === 'undefined')
1345
+ ? { register: () => {}, unregister: () => {} }
1346
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmsparsesource_free(ptr, 1));
1347
+ const WasmWarningCursorFinalization = (typeof FinalizationRegistry === 'undefined')
1348
+ ? { register: () => {}, unregister: () => {} }
1349
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmwarningcursor_free(ptr, 1));
1350
+
1351
+ function addToExternrefTable0(obj) {
1352
+ const idx = wasm.__externref_table_alloc();
1353
+ wasm.__wbindgen_externrefs.set(idx, obj);
1354
+ return idx;
1355
+ }
1356
+
1357
+ function _assertClass(instance, klass) {
1358
+ if (!(instance instanceof klass)) {
1359
+ throw new Error(`expected instance of ${klass.name}`);
1360
+ }
1361
+ }
1362
+
1363
+ function getArrayF32FromWasm0(ptr, len) {
1364
+ ptr = ptr >>> 0;
1365
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
1366
+ }
1367
+
1368
+ function getArrayF64FromWasm0(ptr, len) {
1369
+ ptr = ptr >>> 0;
1370
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
1371
+ }
1372
+
1373
+ function getArrayU32FromWasm0(ptr, len) {
1374
+ ptr = ptr >>> 0;
1375
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
1376
+ }
1377
+
1378
+ function getArrayU8FromWasm0(ptr, len) {
1379
+ ptr = ptr >>> 0;
1380
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1381
+ }
1382
+
1383
+ let cachedDataViewMemory0 = null;
1384
+ function getDataViewMemory0() {
1385
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1386
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1387
+ }
1388
+ return cachedDataViewMemory0;
1389
+ }
1390
+
1391
+ let cachedFloat32ArrayMemory0 = null;
1392
+ function getFloat32ArrayMemory0() {
1393
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
1394
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
1395
+ }
1396
+ return cachedFloat32ArrayMemory0;
1397
+ }
1398
+
1399
+ let cachedFloat64ArrayMemory0 = null;
1400
+ function getFloat64ArrayMemory0() {
1401
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
1402
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
1403
+ }
1404
+ return cachedFloat64ArrayMemory0;
1405
+ }
1406
+
1407
+ function getStringFromWasm0(ptr, len) {
1408
+ return decodeText(ptr >>> 0, len);
1409
+ }
1410
+
1411
+ let cachedUint32ArrayMemory0 = null;
1412
+ function getUint32ArrayMemory0() {
1413
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
1414
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
1415
+ }
1416
+ return cachedUint32ArrayMemory0;
1417
+ }
1418
+
1419
+ let cachedUint8ArrayMemory0 = null;
1420
+ function getUint8ArrayMemory0() {
1421
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1422
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1423
+ }
1424
+ return cachedUint8ArrayMemory0;
1425
+ }
1426
+
1427
+ function handleError(f, args) {
1428
+ try {
1429
+ return f.apply(this, args);
1430
+ } catch (e) {
1431
+ const idx = addToExternrefTable0(e);
1432
+ wasm.__wbindgen_exn_store(idx);
1433
+ }
1434
+ }
1435
+
1436
+ function isLikeNone(x) {
1437
+ return x === undefined || x === null;
1438
+ }
1439
+
1440
+ function passArray8ToWasm0(arg, malloc) {
1441
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
1442
+ getUint8ArrayMemory0().set(arg, ptr / 1);
1443
+ WASM_VECTOR_LEN = arg.length;
1444
+ return ptr;
1445
+ }
1446
+
1447
+ function passArrayF64ToWasm0(arg, malloc) {
1448
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
1449
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
1450
+ WASM_VECTOR_LEN = arg.length;
1451
+ return ptr;
1452
+ }
1453
+
1454
+ function passArrayJsValueToWasm0(array, malloc) {
1455
+ const ptr = malloc(array.length * 4, 4) >>> 0;
1456
+ for (let i = 0; i < array.length; i++) {
1457
+ const add = addToExternrefTable0(array[i]);
1458
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
1459
+ }
1460
+ WASM_VECTOR_LEN = array.length;
1461
+ return ptr;
1462
+ }
1463
+
1464
+ function passStringToWasm0(arg, malloc, realloc) {
1465
+ if (realloc === undefined) {
1466
+ const buf = cachedTextEncoder.encode(arg);
1467
+ const ptr = malloc(buf.length, 1) >>> 0;
1468
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1469
+ WASM_VECTOR_LEN = buf.length;
1470
+ return ptr;
1471
+ }
1472
+
1473
+ let len = arg.length;
1474
+ let ptr = malloc(len, 1) >>> 0;
1475
+
1476
+ const mem = getUint8ArrayMemory0();
1477
+
1478
+ let offset = 0;
1479
+
1480
+ for (; offset < len; offset++) {
1481
+ const code = arg.charCodeAt(offset);
1482
+ if (code > 0x7F) break;
1483
+ mem[ptr + offset] = code;
1484
+ }
1485
+ if (offset !== len) {
1486
+ if (offset !== 0) {
1487
+ arg = arg.slice(offset);
1488
+ }
1489
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1490
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1491
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1492
+
1493
+ offset += ret.written;
1494
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1495
+ }
1496
+
1497
+ WASM_VECTOR_LEN = offset;
1498
+ return ptr;
1499
+ }
1500
+
1501
+ function takeFromExternrefTable0(idx) {
1502
+ const value = wasm.__wbindgen_externrefs.get(idx);
1503
+ wasm.__externref_table_dealloc(idx);
1504
+ return value;
1505
+ }
1506
+
1507
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1508
+ cachedTextDecoder.decode();
1509
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1510
+ let numBytesDecoded = 0;
1511
+ function decodeText(ptr, len) {
1512
+ numBytesDecoded += len;
1513
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1514
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1515
+ cachedTextDecoder.decode();
1516
+ numBytesDecoded = len;
1517
+ }
1518
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1519
+ }
1520
+
1521
+ const cachedTextEncoder = new TextEncoder();
1522
+
1523
+ if (!('encodeInto' in cachedTextEncoder)) {
1524
+ cachedTextEncoder.encodeInto = function (arg, view) {
1525
+ const buf = cachedTextEncoder.encode(arg);
1526
+ view.set(buf);
1527
+ return {
1528
+ read: arg.length,
1529
+ written: buf.length
1530
+ };
1531
+ };
1532
+ }
1533
+
1534
+ let WASM_VECTOR_LEN = 0;
1535
+
1536
+ let wasmModule, wasmInstance, wasm;
1537
+ function __wbg_finalize_init(instance, module) {
1538
+ wasmInstance = instance;
1539
+ wasm = instance.exports;
1540
+ wasmModule = module;
1541
+ cachedDataViewMemory0 = null;
1542
+ cachedFloat32ArrayMemory0 = null;
1543
+ cachedFloat64ArrayMemory0 = null;
1544
+ cachedUint32ArrayMemory0 = null;
1545
+ cachedUint8ArrayMemory0 = null;
1546
+ wasm.__wbindgen_start();
1547
+ return wasm;
1548
+ }
1549
+
1550
+ async function __wbg_load(module, imports) {
1551
+ if (typeof Response === 'function' && module instanceof Response) {
1552
+ if (!module.ok) {
1553
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
1554
+ }
1555
+
1556
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1557
+ try {
1558
+ return await WebAssembly.instantiateStreaming(module, imports);
1559
+ } catch (e) {
1560
+ const validResponse = expectedResponseType(module.type);
1561
+
1562
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1563
+ 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);
1564
+
1565
+ } else { throw e; }
1566
+ }
1567
+ }
1568
+
1569
+ const bytes = await module.arrayBuffer();
1570
+ return await WebAssembly.instantiate(bytes, imports);
1571
+ } else {
1572
+ const instance = await WebAssembly.instantiate(module, imports);
1573
+
1574
+ if (instance instanceof WebAssembly.Instance) {
1575
+ return { instance, module };
1576
+ } else {
1577
+ return instance;
1578
+ }
1579
+ }
1580
+
1581
+ function expectedResponseType(type) {
1582
+ switch (type) {
1583
+ case 'basic': case 'cors': case 'default': return true;
1584
+ }
1585
+ return false;
1586
+ }
1587
+ }
1588
+
1589
+ function initSync(module) {
1590
+ if (wasm !== undefined) return wasm;
1591
+
1592
+
1593
+ if (module !== undefined) {
1594
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1595
+ ({module} = module)
1596
+ } else {
1597
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1598
+ }
1599
+ }
1600
+
1601
+ const imports = __wbg_get_imports();
1602
+ if (!(module instanceof WebAssembly.Module)) {
1603
+ module = new WebAssembly.Module(module);
1604
+ }
1605
+ const instance = new WebAssembly.Instance(module, imports);
1606
+ return __wbg_finalize_init(instance, module);
1607
+ }
1608
+
1609
+ async function __wbg_init(module_or_path) {
1610
+ if (wasm !== undefined) return wasm;
1611
+
1612
+
1613
+ if (module_or_path !== undefined) {
1614
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1615
+ ({module_or_path} = module_or_path)
1616
+ } else {
1617
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1618
+ }
1619
+ }
1620
+
1621
+ if (module_or_path === undefined) {
1622
+ module_or_path = new URL('lamina_pdf_extract.wasm', import.meta.url);
1623
+ }
1624
+ const imports = __wbg_get_imports();
1625
+
1626
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1627
+ module_or_path = fetch(module_or_path);
1628
+ }
1629
+
1630
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1631
+
1632
+ return __wbg_finalize_init(instance, module);
1633
+ }
1634
+
1635
+ export { initSync, __wbg_init as default };