@repa/document-viewer 0.0.0-stage → 0.1.0-alpha.21

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,1216 @@
1
+ /* @ts-self-types="./document_viewer_wasm.d.ts" */
2
+
3
+ /**
4
+ * The generated viewer-only WASM boundary. Public JavaScript consumers use the
5
+ * typed package wrapper rather than receiving this class directly.
6
+ */
7
+ export class DocumentViewerEngine {
8
+ __destroy_into_raw() {
9
+ const ptr = this.__wbg_ptr;
10
+ this.__wbg_ptr = 0;
11
+ DocumentViewerEngineFinalization.unregister(this);
12
+ return ptr;
13
+ }
14
+ free() {
15
+ const ptr = this.__destroy_into_raw();
16
+ wasm.__wbg_documentviewerengine_free(ptr, 0);
17
+ }
18
+ /**
19
+ * Paint the exact canonical page into a supplied canvas. CSS sizing stays
20
+ * host-owned; this method controls only the backing bitmap and raster.
21
+ * @param {number} page_index
22
+ * @param {HTMLCanvasElement} canvas
23
+ * @param {number} css_scale
24
+ * @param {number} device_pixel_ratio
25
+ */
26
+ attach_page_canvas(page_index, canvas, css_scale, device_pixel_ratio) {
27
+ try {
28
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
29
+ wasm.documentviewerengine_attach_page_canvas(retptr, this.__wbg_ptr, page_index, addHeapObject(canvas), css_scale, device_pixel_ratio);
30
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
31
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
32
+ if (r1) {
33
+ throw takeObject(r0);
34
+ }
35
+ } finally {
36
+ wasm.__wbindgen_add_to_stack_pointer(16);
37
+ }
38
+ }
39
+ /**
40
+ * Begin the existing canonical click gesture contract: one click places a
41
+ * caret, two select a word, and three or more select a paragraph.
42
+ * @param {number} page_index
43
+ * @param {number} x_pt
44
+ * @param {number} y_pt
45
+ * @param {number} click_count
46
+ * @returns {string}
47
+ */
48
+ begin_pointer_gesture(page_index, x_pt, y_pt, click_count) {
49
+ let deferred2_0;
50
+ let deferred2_1;
51
+ try {
52
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
53
+ wasm.documentviewerengine_begin_pointer_gesture(retptr, this.__wbg_ptr, page_index, x_pt, y_pt, click_count);
54
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
55
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
56
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
57
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
58
+ var ptr1 = r0;
59
+ var len1 = r1;
60
+ if (r3) {
61
+ ptr1 = 0; len1 = 0;
62
+ throw takeObject(r2);
63
+ }
64
+ deferred2_0 = ptr1;
65
+ deferred2_1 = len1;
66
+ return getStringFromWasm0(ptr1, len1);
67
+ } finally {
68
+ wasm.__wbindgen_add_to_stack_pointer(16);
69
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
70
+ }
71
+ }
72
+ /**
73
+ * Begin a pointer-driven canonical selection at one page-space point.
74
+ * @param {number} page_index
75
+ * @param {number} x_pt
76
+ * @param {number} y_pt
77
+ * @returns {string}
78
+ */
79
+ begin_pointer_selection(page_index, x_pt, y_pt) {
80
+ let deferred2_0;
81
+ let deferred2_1;
82
+ try {
83
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
84
+ wasm.documentviewerengine_begin_pointer_selection(retptr, this.__wbg_ptr, page_index, x_pt, y_pt);
85
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
86
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
87
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
88
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
89
+ var ptr1 = r0;
90
+ var len1 = r1;
91
+ if (r3) {
92
+ ptr1 = 0; len1 = 0;
93
+ throw takeObject(r2);
94
+ }
95
+ deferred2_0 = ptr1;
96
+ deferred2_1 = len1;
97
+ return getStringFromWasm0(ptr1, len1);
98
+ } finally {
99
+ wasm.__wbindgen_add_to_stack_pointer(16);
100
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
101
+ }
102
+ }
103
+ clear_selection() {
104
+ wasm.documentviewerengine_clear_selection(this.__wbg_ptr);
105
+ }
106
+ /**
107
+ * Release all canonical document, layout, and font bytes immediately.
108
+ */
109
+ dispose() {
110
+ wasm.documentviewerengine_dispose(this.__wbg_ptr);
111
+ }
112
+ /**
113
+ * Extend the active pointer selection to another page-space point. The
114
+ * original anchor remains authoritative across runs, lines, paragraphs,
115
+ * tables, and page boundaries accepted by the canonical topology.
116
+ * @param {number} page_index
117
+ * @param {number} x_pt
118
+ * @param {number} y_pt
119
+ * @returns {string}
120
+ */
121
+ extend_pointer_selection(page_index, x_pt, y_pt) {
122
+ let deferred2_0;
123
+ let deferred2_1;
124
+ try {
125
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
126
+ wasm.documentviewerengine_extend_pointer_selection(retptr, this.__wbg_ptr, page_index, x_pt, y_pt);
127
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
128
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
129
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
130
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
131
+ var ptr1 = r0;
132
+ var len1 = r1;
133
+ if (r3) {
134
+ ptr1 = 0; len1 = 0;
135
+ throw takeObject(r2);
136
+ }
137
+ deferred2_0 = ptr1;
138
+ deferred2_1 = len1;
139
+ return getStringFromWasm0(ptr1, len1);
140
+ } finally {
141
+ wasm.__wbindgen_add_to_stack_pointer(16);
142
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
143
+ }
144
+ }
145
+ /**
146
+ * Combined semantic pointer target for browser hover and cursor policy.
147
+ * Browser pointer metadata remains outside WASM; this result owns only
148
+ * immutable document meaning at the supplied page-space point.
149
+ * @param {number} page_index
150
+ * @param {number} x_pt
151
+ * @param {number} y_pt
152
+ * @returns {string}
153
+ */
154
+ hit_test_pointer_target(page_index, x_pt, y_pt) {
155
+ let deferred2_0;
156
+ let deferred2_1;
157
+ try {
158
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
159
+ wasm.documentviewerengine_hit_test_pointer_target(retptr, this.__wbg_ptr, page_index, x_pt, y_pt);
160
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
161
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
162
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
163
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
164
+ var ptr1 = r0;
165
+ var len1 = r1;
166
+ if (r3) {
167
+ ptr1 = 0; len1 = 0;
168
+ throw takeObject(r2);
169
+ }
170
+ deferred2_0 = ptr1;
171
+ deferred2_1 = len1;
172
+ return getStringFromWasm0(ptr1, len1);
173
+ } finally {
174
+ wasm.__wbindgen_add_to_stack_pointer(16);
175
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
176
+ }
177
+ }
178
+ /**
179
+ * Semantic structures under one page-space point. Hosts can use the
180
+ * returned canonical ids to drive application-specific hover actions.
181
+ * @param {number} page_index
182
+ * @param {number} x_pt
183
+ * @param {number} y_pt
184
+ * @returns {string}
185
+ */
186
+ hit_test_structures(page_index, x_pt, y_pt) {
187
+ let deferred2_0;
188
+ let deferred2_1;
189
+ try {
190
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
191
+ wasm.documentviewerengine_hit_test_structures(retptr, this.__wbg_ptr, page_index, x_pt, y_pt);
192
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
193
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
194
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
195
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
196
+ var ptr1 = r0;
197
+ var len1 = r1;
198
+ if (r3) {
199
+ ptr1 = 0; len1 = 0;
200
+ throw takeObject(r2);
201
+ }
202
+ deferred2_0 = ptr1;
203
+ deferred2_1 = len1;
204
+ return getStringFromWasm0(ptr1, len1);
205
+ } finally {
206
+ wasm.__wbindgen_add_to_stack_pointer(16);
207
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
208
+ }
209
+ }
210
+ /**
211
+ * @param {Uint8Array} dsdx_bytes
212
+ * @param {Array<any>} font_files
213
+ * @returns {string}
214
+ */
215
+ load(dsdx_bytes, font_files) {
216
+ let deferred3_0;
217
+ let deferred3_1;
218
+ try {
219
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
220
+ const ptr0 = passArray8ToWasm0(dsdx_bytes, wasm.__wbindgen_export);
221
+ const len0 = WASM_VECTOR_LEN;
222
+ wasm.documentviewerengine_load(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(font_files));
223
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
224
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
225
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
226
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
227
+ var ptr2 = r0;
228
+ var len2 = r1;
229
+ if (r3) {
230
+ ptr2 = 0; len2 = 0;
231
+ throw takeObject(r2);
232
+ }
233
+ deferred3_0 = ptr2;
234
+ deferred3_1 = len2;
235
+ return getStringFromWasm0(ptr2, len2);
236
+ } finally {
237
+ wasm.__wbindgen_add_to_stack_pointer(16);
238
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
239
+ }
240
+ }
241
+ constructor() {
242
+ const ret = wasm.documentviewerengine_new();
243
+ this.__wbg_ptr = ret >>> 0;
244
+ DocumentViewerEngineFinalization.register(this, this.__wbg_ptr, this);
245
+ return this;
246
+ }
247
+ /**
248
+ * Restore an engine-produced semantic selection. A different package
249
+ * fingerprint fails closed and no existing selection is changed.
250
+ * @param {string} selection_json
251
+ * @returns {string}
252
+ */
253
+ restore_selection(selection_json) {
254
+ let deferred3_0;
255
+ let deferred3_1;
256
+ try {
257
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
258
+ const ptr0 = passStringToWasm0(selection_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
259
+ const len0 = WASM_VECTOR_LEN;
260
+ wasm.documentviewerengine_restore_selection(retptr, this.__wbg_ptr, ptr0, len0);
261
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
262
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
263
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
264
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
265
+ var ptr2 = r0;
266
+ var len2 = r1;
267
+ if (r3) {
268
+ ptr2 = 0; len2 = 0;
269
+ throw takeObject(r2);
270
+ }
271
+ deferred3_0 = ptr2;
272
+ deferred3_1 = len2;
273
+ return getStringFromWasm0(ptr2, len2);
274
+ } finally {
275
+ wasm.__wbindgen_add_to_stack_pointer(16);
276
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
277
+ }
278
+ }
279
+ /**
280
+ * Select application-supplied canonical ranges. Geometry and visible text
281
+ * are recomputed by the runtime and cannot be injected by the caller.
282
+ * @param {string} target_json
283
+ * @returns {string}
284
+ */
285
+ select_ranges(target_json) {
286
+ let deferred3_0;
287
+ let deferred3_1;
288
+ try {
289
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
290
+ const ptr0 = passStringToWasm0(target_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
291
+ const len0 = WASM_VECTOR_LEN;
292
+ wasm.documentviewerengine_select_ranges(retptr, this.__wbg_ptr, ptr0, len0);
293
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
294
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
295
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
296
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
297
+ var ptr2 = r0;
298
+ var len2 = r1;
299
+ if (r3) {
300
+ ptr2 = 0; len2 = 0;
301
+ throw takeObject(r2);
302
+ }
303
+ deferred3_0 = ptr2;
304
+ deferred3_1 = len2;
305
+ return getStringFromWasm0(ptr2, len2);
306
+ } finally {
307
+ wasm.__wbindgen_add_to_stack_pointer(16);
308
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
309
+ }
310
+ }
311
+ /**
312
+ * Current fingerprint-bound semantic selection and canonical geometry.
313
+ * @returns {string}
314
+ */
315
+ selection() {
316
+ let deferred2_0;
317
+ let deferred2_1;
318
+ try {
319
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
320
+ wasm.documentviewerengine_selection(retptr, this.__wbg_ptr);
321
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
322
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
323
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
324
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
325
+ var ptr1 = r0;
326
+ var len1 = r1;
327
+ if (r3) {
328
+ ptr1 = 0; len1 = 0;
329
+ throw takeObject(r2);
330
+ }
331
+ deferred2_0 = ptr1;
332
+ deferred2_1 = len1;
333
+ return getStringFromWasm0(ptr1, len1);
334
+ } finally {
335
+ wasm.__wbindgen_add_to_stack_pointer(16);
336
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
337
+ }
338
+ }
339
+ /**
340
+ * Every semantic structure intersected by the active canonical selection.
341
+ * @returns {string}
342
+ */
343
+ selection_structures() {
344
+ let deferred2_0;
345
+ let deferred2_1;
346
+ try {
347
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
348
+ wasm.documentviewerengine_selection_structures(retptr, this.__wbg_ptr);
349
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
350
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
351
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
352
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
353
+ var ptr1 = r0;
354
+ var len1 = r1;
355
+ if (r3) {
356
+ ptr1 = 0; len1 = 0;
357
+ throw takeObject(r2);
358
+ }
359
+ deferred2_0 = ptr1;
360
+ deferred2_1 = len1;
361
+ return getStringFromWasm0(ptr1, len1);
362
+ } finally {
363
+ wasm.__wbindgen_add_to_stack_pointer(16);
364
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
365
+ }
366
+ }
367
+ /**
368
+ * Current immutable document identity and canonical page geometry.
369
+ * @returns {string}
370
+ */
371
+ snapshot() {
372
+ let deferred2_0;
373
+ let deferred2_1;
374
+ try {
375
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
376
+ wasm.documentviewerengine_snapshot(retptr, this.__wbg_ptr);
377
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
378
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
379
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
380
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
381
+ var ptr1 = r0;
382
+ var len1 = r1;
383
+ if (r3) {
384
+ ptr1 = 0; len1 = 0;
385
+ throw takeObject(r2);
386
+ }
387
+ deferred2_0 = ptr1;
388
+ deferred2_1 = len1;
389
+ return getStringFromWasm0(ptr1, len1);
390
+ } finally {
391
+ wasm.__wbindgen_add_to_stack_pointer(16);
392
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
393
+ }
394
+ }
395
+ /**
396
+ * All canonical block, placeholder, table, row, and cell identities with
397
+ * occurrence-aware page-space geometry for this immutable snapshot.
398
+ * @returns {string}
399
+ */
400
+ structure_index() {
401
+ let deferred2_0;
402
+ let deferred2_1;
403
+ try {
404
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
405
+ wasm.documentviewerengine_structure_index(retptr, this.__wbg_ptr);
406
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
407
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
408
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
409
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
410
+ var ptr1 = r0;
411
+ var len1 = r1;
412
+ if (r3) {
413
+ ptr1 = 0; len1 = 0;
414
+ throw takeObject(r2);
415
+ }
416
+ deferred2_0 = ptr1;
417
+ deferred2_1 = len1;
418
+ return getStringFromWasm0(ptr1, len1);
419
+ } finally {
420
+ wasm.__wbindgen_add_to_stack_pointer(16);
421
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
422
+ }
423
+ }
424
+ }
425
+ if (Symbol.dispose) DocumentViewerEngine.prototype[Symbol.dispose] = DocumentViewerEngine.prototype.free;
426
+
427
+ /**
428
+ * Inspect a package before viewer load; saved choices remain accessible when
429
+ * its text cannot yet render. Uses the same native/editor inspection owner.
430
+ * @param {Uint8Array} dsdx_bytes
431
+ * @returns {string}
432
+ */
433
+ export function dsdx_font_inspection_json(dsdx_bytes) {
434
+ let deferred3_0;
435
+ let deferred3_1;
436
+ try {
437
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
438
+ const ptr0 = passArray8ToWasm0(dsdx_bytes, wasm.__wbindgen_export);
439
+ const len0 = WASM_VECTOR_LEN;
440
+ wasm.dsdx_font_inspection_json(retptr, ptr0, len0);
441
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
442
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
443
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
444
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
445
+ var ptr2 = r0;
446
+ var len2 = r1;
447
+ if (r3) {
448
+ ptr2 = 0; len2 = 0;
449
+ throw takeObject(r2);
450
+ }
451
+ deferred3_0 = ptr2;
452
+ deferred3_1 = len2;
453
+ return getStringFromWasm0(ptr2, len2);
454
+ } finally {
455
+ wasm.__wbindgen_add_to_stack_pointer(16);
456
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
457
+ }
458
+ }
459
+
460
+ /**
461
+ * Return the exact, sorted, content-addressed font files required by the
462
+ * authoritative closure embedded in DSDX bytes.
463
+ * @param {Uint8Array} dsdx_bytes
464
+ * @returns {string}
465
+ */
466
+ export function dsdx_font_requirements_json(dsdx_bytes) {
467
+ let deferred3_0;
468
+ let deferred3_1;
469
+ try {
470
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
471
+ const ptr0 = passArray8ToWasm0(dsdx_bytes, wasm.__wbindgen_export);
472
+ const len0 = WASM_VECTOR_LEN;
473
+ wasm.dsdx_font_requirements_json(retptr, ptr0, len0);
474
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
475
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
476
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
477
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
478
+ var ptr2 = r0;
479
+ var len2 = r1;
480
+ if (r3) {
481
+ ptr2 = 0; len2 = 0;
482
+ throw takeObject(r2);
483
+ }
484
+ deferred3_0 = ptr2;
485
+ deferred3_1 = len2;
486
+ return getStringFromWasm0(ptr2, len2);
487
+ } finally {
488
+ wasm.__wbindgen_add_to_stack_pointer(16);
489
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
490
+ }
491
+ }
492
+
493
+ /**
494
+ * The public viewer admits rendering only; it does not claim editor support.
495
+ * @returns {string}
496
+ */
497
+ export function engine_font_capabilities_json() {
498
+ let deferred1_0;
499
+ let deferred1_1;
500
+ try {
501
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
502
+ wasm.engine_font_capabilities_json(retptr);
503
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
504
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
505
+ deferred1_0 = r0;
506
+ deferred1_1 = r1;
507
+ return getStringFromWasm0(r0, r1);
508
+ } finally {
509
+ wasm.__wbindgen_add_to_stack_pointer(16);
510
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
511
+ }
512
+ }
513
+
514
+ function __wbg_get_imports() {
515
+ const import0 = {
516
+ __proto__: null,
517
+ __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
518
+ const ret = debugString(getObject(arg1));
519
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
520
+ const len1 = WASM_VECTOR_LEN;
521
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
522
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
523
+ },
524
+ __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
525
+ const ret = getObject(arg0) === undefined;
526
+ return ret;
527
+ },
528
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
529
+ throw new Error(getStringFromWasm0(arg0, arg1));
530
+ },
531
+ __wbg_addColorStop_3bd77f997fb1fa1c: function() { return handleError(function (arg0, arg1, arg2, arg3) {
532
+ getObject(arg0).addColorStop(arg1, getStringFromWasm0(arg2, arg3));
533
+ }, arguments); },
534
+ __wbg_beginPath_596efed55075dbc3: function(arg0) {
535
+ getObject(arg0).beginPath();
536
+ },
537
+ __wbg_bezierCurveTo_826b2559b4f343b4: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
538
+ getObject(arg0).bezierCurveTo(arg1, arg2, arg3, arg4, arg5, arg6);
539
+ },
540
+ __wbg_clearRect_ea4f3d34d76f4bc5: function(arg0, arg1, arg2, arg3, arg4) {
541
+ getObject(arg0).clearRect(arg1, arg2, arg3, arg4);
542
+ },
543
+ __wbg_clip_3112b0bb495d0e08: function(arg0) {
544
+ getObject(arg0).clip();
545
+ },
546
+ __wbg_clip_93e62d65aa70d4e1: function(arg0, arg1) {
547
+ getObject(arg0).clip(getObject(arg1));
548
+ },
549
+ __wbg_closePath_432bc907523c27ee: function(arg0) {
550
+ getObject(arg0).closePath();
551
+ },
552
+ __wbg_closePath_f96bcae0fc7087a9: function(arg0) {
553
+ getObject(arg0).closePath();
554
+ },
555
+ __wbg_complete_6f48c2606490357b: function(arg0) {
556
+ const ret = getObject(arg0).complete;
557
+ return ret;
558
+ },
559
+ __wbg_createElement_9b0aab265c549ded: function() { return handleError(function (arg0, arg1, arg2) {
560
+ const ret = getObject(arg0).createElement(getStringFromWasm0(arg1, arg2));
561
+ return addHeapObject(ret);
562
+ }, arguments); },
563
+ __wbg_createLinearGradient_824cc20f7bc01e49: function(arg0, arg1, arg2, arg3, arg4) {
564
+ const ret = getObject(arg0).createLinearGradient(arg1, arg2, arg3, arg4);
565
+ return addHeapObject(ret);
566
+ },
567
+ __wbg_createPattern_b0aed93f5025c193: function() { return handleError(function (arg0, arg1, arg2, arg3) {
568
+ const ret = getObject(arg0).createPattern(getObject(arg1), getStringFromWasm0(arg2, arg3));
569
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
570
+ }, arguments); },
571
+ __wbg_createRadialGradient_5d814c3de73f7596: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
572
+ const ret = getObject(arg0).createRadialGradient(arg1, arg2, arg3, arg4, arg5, arg6);
573
+ return addHeapObject(ret);
574
+ }, arguments); },
575
+ __wbg_document_c0320cd4183c6d9b: function(arg0) {
576
+ const ret = getObject(arg0).document;
577
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
578
+ },
579
+ __wbg_drawImage_09a18e68469e9b9b: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
580
+ getObject(arg0).drawImage(getObject(arg1), arg2, arg3, arg4, arg5);
581
+ }, arguments); },
582
+ __wbg_drawImage_1c35710881895649: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
583
+ getObject(arg0).drawImage(getObject(arg1), arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
584
+ }, arguments); },
585
+ __wbg_drawImage_91631f4ec3c9e0a8: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
586
+ getObject(arg0).drawImage(getObject(arg1), arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
587
+ }, arguments); },
588
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
589
+ let deferred0_0;
590
+ let deferred0_1;
591
+ try {
592
+ deferred0_0 = arg0;
593
+ deferred0_1 = arg1;
594
+ console.error(getStringFromWasm0(arg0, arg1));
595
+ } finally {
596
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
597
+ }
598
+ },
599
+ __wbg_fillRect_4e5596ca954226e7: function(arg0, arg1, arg2, arg3, arg4) {
600
+ getObject(arg0).fillRect(arg1, arg2, arg3, arg4);
601
+ },
602
+ __wbg_fill_c0bb5e0ec0d7fcf9: function(arg0) {
603
+ getObject(arg0).fill();
604
+ },
605
+ __wbg_fill_fce7fd6ab3af7ac4: function(arg0, arg1) {
606
+ getObject(arg0).fill(getObject(arg1));
607
+ },
608
+ __wbg_getContext_f04bf8f22dcb2d53: function() { return handleError(function (arg0, arg1, arg2) {
609
+ const ret = getObject(arg0).getContext(getStringFromWasm0(arg1, arg2));
610
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
611
+ }, arguments); },
612
+ __wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
613
+ const ret = getObject(arg0)[arg1 >>> 0];
614
+ return addHeapObject(ret);
615
+ },
616
+ __wbg_height_6568c4427c3b889d: function(arg0) {
617
+ const ret = getObject(arg0).height;
618
+ return ret;
619
+ },
620
+ __wbg_instanceof_CanvasRenderingContext2d_08b9d193c22fa886: function(arg0) {
621
+ let result;
622
+ try {
623
+ result = getObject(arg0) instanceof CanvasRenderingContext2D;
624
+ } catch (_) {
625
+ result = false;
626
+ }
627
+ const ret = result;
628
+ return ret;
629
+ },
630
+ __wbg_instanceof_HtmlCanvasElement_26125339f936be50: function(arg0) {
631
+ let result;
632
+ try {
633
+ result = getObject(arg0) instanceof HTMLCanvasElement;
634
+ } catch (_) {
635
+ result = false;
636
+ }
637
+ const ret = result;
638
+ return ret;
639
+ },
640
+ __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
641
+ let result;
642
+ try {
643
+ result = getObject(arg0) instanceof Uint8Array;
644
+ } catch (_) {
645
+ result = false;
646
+ }
647
+ const ret = result;
648
+ return ret;
649
+ },
650
+ __wbg_instanceof_Window_23e677d2c6843922: function(arg0) {
651
+ let result;
652
+ try {
653
+ result = getObject(arg0) instanceof Window;
654
+ } catch (_) {
655
+ result = false;
656
+ }
657
+ const ret = result;
658
+ return ret;
659
+ },
660
+ __wbg_length_b3416cf66a5452c8: function(arg0) {
661
+ const ret = getObject(arg0).length;
662
+ return ret;
663
+ },
664
+ __wbg_length_ea16607d7b61445b: function(arg0) {
665
+ const ret = getObject(arg0).length;
666
+ return ret;
667
+ },
668
+ __wbg_lineTo_8ea7db5b5d763030: function(arg0, arg1, arg2) {
669
+ getObject(arg0).lineTo(arg1, arg2);
670
+ },
671
+ __wbg_lineTo_ca88d7704bfef252: function(arg0, arg1, arg2) {
672
+ getObject(arg0).lineTo(arg1, arg2);
673
+ },
674
+ __wbg_moveTo_6d04ca2f71946754: function(arg0, arg1, arg2) {
675
+ getObject(arg0).moveTo(arg1, arg2);
676
+ },
677
+ __wbg_moveTo_c970259d1849d28b: function(arg0, arg1, arg2) {
678
+ getObject(arg0).moveTo(arg1, arg2);
679
+ },
680
+ __wbg_naturalHeight_5c7a16ef31d47f63: function(arg0) {
681
+ const ret = getObject(arg0).naturalHeight;
682
+ return ret;
683
+ },
684
+ __wbg_naturalWidth_c235f79e9e28f2cc: function(arg0) {
685
+ const ret = getObject(arg0).naturalWidth;
686
+ return ret;
687
+ },
688
+ __wbg_new_0b637bad3d58f611: function() { return handleError(function () {
689
+ const ret = new Image();
690
+ return addHeapObject(ret);
691
+ }, arguments); },
692
+ __wbg_new_227d7c05414eb861: function() {
693
+ const ret = new Error();
694
+ return addHeapObject(ret);
695
+ },
696
+ __wbg_new_5f486cdf45a04d78: function(arg0) {
697
+ const ret = new Uint8Array(getObject(arg0));
698
+ return addHeapObject(ret);
699
+ },
700
+ __wbg_new_6fb0c26e58806934: function() { return handleError(function () {
701
+ const ret = new Path2D();
702
+ return addHeapObject(ret);
703
+ }, arguments); },
704
+ __wbg_new_a70fbab9066b301f: function() {
705
+ const ret = new Array();
706
+ return addHeapObject(ret);
707
+ },
708
+ __wbg_new_with_u8_clamped_array_and_sh_5d9be5b17e50951c: function() { return handleError(function (arg0, arg1, arg2, arg3) {
709
+ const ret = new ImageData(getClampedArrayU8FromWasm0(arg0, arg1), arg2 >>> 0, arg3 >>> 0);
710
+ return addHeapObject(ret);
711
+ }, arguments); },
712
+ __wbg_now_c6d7a7d35f74f6f1: function(arg0) {
713
+ const ret = getObject(arg0).now();
714
+ return ret;
715
+ },
716
+ __wbg_performance_28be169151161678: function(arg0) {
717
+ const ret = getObject(arg0).performance;
718
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
719
+ },
720
+ __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
721
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
722
+ },
723
+ __wbg_push_e87b0e732085a946: function(arg0, arg1) {
724
+ const ret = getObject(arg0).push(getObject(arg1));
725
+ return ret;
726
+ },
727
+ __wbg_putImageData_1750176f4dd07174: function() { return handleError(function (arg0, arg1, arg2, arg3) {
728
+ getObject(arg0).putImageData(getObject(arg1), arg2, arg3);
729
+ }, arguments); },
730
+ __wbg_quadraticCurveTo_d1cd5f4ad95f4211: function(arg0, arg1, arg2, arg3, arg4) {
731
+ getObject(arg0).quadraticCurveTo(arg1, arg2, arg3, arg4);
732
+ },
733
+ __wbg_rect_9fb7070ab71d27aa: function(arg0, arg1, arg2, arg3, arg4) {
734
+ getObject(arg0).rect(arg1, arg2, arg3, arg4);
735
+ },
736
+ __wbg_restore_ec1ece47cce5dc64: function(arg0) {
737
+ getObject(arg0).restore();
738
+ },
739
+ __wbg_rotate_326ea70a87136df5: function() { return handleError(function (arg0, arg1) {
740
+ getObject(arg0).rotate(arg1);
741
+ }, arguments); },
742
+ __wbg_save_c4e64a4ec29f000f: function(arg0) {
743
+ getObject(arg0).save();
744
+ },
745
+ __wbg_scale_64e919c81a65aba9: function() { return handleError(function (arg0, arg1, arg2) {
746
+ getObject(arg0).scale(arg1, arg2);
747
+ }, arguments); },
748
+ __wbg_setLineDash_b22b8de6051bb23a: function() { return handleError(function (arg0, arg1) {
749
+ getObject(arg0).setLineDash(getObject(arg1));
750
+ }, arguments); },
751
+ __wbg_setTransform_ad844af0b72d0b8b: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
752
+ getObject(arg0).setTransform(arg1, arg2, arg3, arg4, arg5, arg6);
753
+ }, arguments); },
754
+ __wbg_set_7eaa4f96924fd6b3: function() { return handleError(function (arg0, arg1, arg2) {
755
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
756
+ return ret;
757
+ }, arguments); },
758
+ __wbg_set_fillStyle_a48824bb58eba9bd: function(arg0, arg1) {
759
+ getObject(arg0).fillStyle = getObject(arg1);
760
+ },
761
+ __wbg_set_fillStyle_d7183d6b3f457c41: function(arg0, arg1) {
762
+ getObject(arg0).fillStyle = getObject(arg1);
763
+ },
764
+ __wbg_set_globalAlpha_d51aa11e10f40cfc: function(arg0, arg1) {
765
+ getObject(arg0).globalAlpha = arg1;
766
+ },
767
+ __wbg_set_globalCompositeOperation_ba0da38482e6aa11: function() { return handleError(function (arg0, arg1, arg2) {
768
+ getObject(arg0).globalCompositeOperation = getStringFromWasm0(arg1, arg2);
769
+ }, arguments); },
770
+ __wbg_set_height_b6548a01bdcb689a: function(arg0, arg1) {
771
+ getObject(arg0).height = arg1 >>> 0;
772
+ },
773
+ __wbg_set_imageSmoothingEnabled_f9f883202f4f3d5e: function(arg0, arg1) {
774
+ getObject(arg0).imageSmoothingEnabled = arg1 !== 0;
775
+ },
776
+ __wbg_set_lineCap_1ecf6c7ca9319eb2: function(arg0, arg1, arg2) {
777
+ getObject(arg0).lineCap = getStringFromWasm0(arg1, arg2);
778
+ },
779
+ __wbg_set_lineDashOffset_3dc747fbfd1e7a15: function(arg0, arg1) {
780
+ getObject(arg0).lineDashOffset = arg1;
781
+ },
782
+ __wbg_set_lineJoin_2c56d0d6bec26d27: function(arg0, arg1, arg2) {
783
+ getObject(arg0).lineJoin = getStringFromWasm0(arg1, arg2);
784
+ },
785
+ __wbg_set_lineWidth_e38550ed429ec417: function(arg0, arg1) {
786
+ getObject(arg0).lineWidth = arg1;
787
+ },
788
+ __wbg_set_miterLimit_59600cb9df94059b: function(arg0, arg1) {
789
+ getObject(arg0).miterLimit = arg1;
790
+ },
791
+ __wbg_set_onload_cf3272b579514941: function(arg0, arg1) {
792
+ getObject(arg0).onload = getObject(arg1);
793
+ },
794
+ __wbg_set_src_f257a96103ac1ac6: function(arg0, arg1, arg2) {
795
+ getObject(arg0).src = getStringFromWasm0(arg1, arg2);
796
+ },
797
+ __wbg_set_strokeStyle_d7c73fc847bf5280: function(arg0, arg1) {
798
+ getObject(arg0).strokeStyle = getObject(arg1);
799
+ },
800
+ __wbg_set_width_c0fcaa2da53cd540: function(arg0, arg1) {
801
+ getObject(arg0).width = arg1 >>> 0;
802
+ },
803
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
804
+ const ret = getObject(arg1).stack;
805
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
806
+ const len1 = WASM_VECTOR_LEN;
807
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
808
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
809
+ },
810
+ __wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
811
+ const ret = typeof global === 'undefined' ? null : global;
812
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
813
+ },
814
+ __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913: function() {
815
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
816
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
817
+ },
818
+ __wbg_static_accessor_SELF_f207c857566db248: function() {
819
+ const ret = typeof self === 'undefined' ? null : self;
820
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
821
+ },
822
+ __wbg_static_accessor_WINDOW_bb9f1ba69d61b386: function() {
823
+ const ret = typeof window === 'undefined' ? null : window;
824
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
825
+ },
826
+ __wbg_stroke_affa71c0888c6f31: function(arg0) {
827
+ getObject(arg0).stroke();
828
+ },
829
+ __wbg_stroke_b57f10f9ac4c6c2a: function(arg0, arg1) {
830
+ getObject(arg0).stroke(getObject(arg1));
831
+ },
832
+ __wbg_translate_d7de7bdfdbc1ee9d: function() { return handleError(function (arg0, arg1, arg2) {
833
+ getObject(arg0).translate(arg1, arg2);
834
+ }, arguments); },
835
+ __wbg_width_4d6fc7fecd877217: function(arg0) {
836
+ const ret = getObject(arg0).width;
837
+ return ret;
838
+ },
839
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
840
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 702, function: Function { arguments: [], shim_idx: 703, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
841
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_4021, __wasm_bindgen_func_elem_4024);
842
+ return addHeapObject(ret);
843
+ },
844
+ __wbindgen_cast_0000000000000002: function(arg0) {
845
+ // Cast intrinsic for `F64 -> Externref`.
846
+ const ret = arg0;
847
+ return addHeapObject(ret);
848
+ },
849
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
850
+ // Cast intrinsic for `Ref(String) -> Externref`.
851
+ const ret = getStringFromWasm0(arg0, arg1);
852
+ return addHeapObject(ret);
853
+ },
854
+ __wbindgen_object_clone_ref: function(arg0) {
855
+ const ret = getObject(arg0);
856
+ return addHeapObject(ret);
857
+ },
858
+ __wbindgen_object_drop_ref: function(arg0) {
859
+ takeObject(arg0);
860
+ },
861
+ };
862
+ return {
863
+ __proto__: null,
864
+ "./document_viewer_wasm_bg.js": import0,
865
+ };
866
+ }
867
+
868
+ function __wasm_bindgen_func_elem_4024(arg0, arg1) {
869
+ wasm.__wasm_bindgen_func_elem_4024(arg0, arg1);
870
+ }
871
+
872
+ const DocumentViewerEngineFinalization = (typeof FinalizationRegistry === 'undefined')
873
+ ? { register: () => {}, unregister: () => {} }
874
+ : new FinalizationRegistry(ptr => wasm.__wbg_documentviewerengine_free(ptr >>> 0, 1));
875
+
876
+ function addHeapObject(obj) {
877
+ if (heap_next === heap.length) heap.push(heap.length + 1);
878
+ const idx = heap_next;
879
+ heap_next = heap[idx];
880
+
881
+ heap[idx] = obj;
882
+ return idx;
883
+ }
884
+
885
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
886
+ ? { register: () => {}, unregister: () => {} }
887
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
888
+
889
+ function debugString(val) {
890
+ // primitive types
891
+ const type = typeof val;
892
+ if (type == 'number' || type == 'boolean' || val == null) {
893
+ return `${val}`;
894
+ }
895
+ if (type == 'string') {
896
+ return `"${val}"`;
897
+ }
898
+ if (type == 'symbol') {
899
+ const description = val.description;
900
+ if (description == null) {
901
+ return 'Symbol';
902
+ } else {
903
+ return `Symbol(${description})`;
904
+ }
905
+ }
906
+ if (type == 'function') {
907
+ const name = val.name;
908
+ if (typeof name == 'string' && name.length > 0) {
909
+ return `Function(${name})`;
910
+ } else {
911
+ return 'Function';
912
+ }
913
+ }
914
+ // objects
915
+ if (Array.isArray(val)) {
916
+ const length = val.length;
917
+ let debug = '[';
918
+ if (length > 0) {
919
+ debug += debugString(val[0]);
920
+ }
921
+ for(let i = 1; i < length; i++) {
922
+ debug += ', ' + debugString(val[i]);
923
+ }
924
+ debug += ']';
925
+ return debug;
926
+ }
927
+ // Test for built-in
928
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
929
+ let className;
930
+ if (builtInMatches && builtInMatches.length > 1) {
931
+ className = builtInMatches[1];
932
+ } else {
933
+ // Failed to match the standard '[object ClassName]'
934
+ return toString.call(val);
935
+ }
936
+ if (className == 'Object') {
937
+ // we're a user defined class or Object
938
+ // JSON.stringify avoids problems with cycles, and is generally much
939
+ // easier than looping through ownProperties of `val`.
940
+ try {
941
+ return 'Object(' + JSON.stringify(val) + ')';
942
+ } catch (_) {
943
+ return 'Object';
944
+ }
945
+ }
946
+ // errors
947
+ if (val instanceof Error) {
948
+ return `${val.name}: ${val.message}\n${val.stack}`;
949
+ }
950
+ // TODO we could test for more things here, like `Set`s and `Map`s.
951
+ return className;
952
+ }
953
+
954
+ function dropObject(idx) {
955
+ if (idx < 1028) return;
956
+ heap[idx] = heap_next;
957
+ heap_next = idx;
958
+ }
959
+
960
+ function getArrayU8FromWasm0(ptr, len) {
961
+ ptr = ptr >>> 0;
962
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
963
+ }
964
+
965
+ function getClampedArrayU8FromWasm0(ptr, len) {
966
+ ptr = ptr >>> 0;
967
+ return getUint8ClampedArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
968
+ }
969
+
970
+ let cachedDataViewMemory0 = null;
971
+ function getDataViewMemory0() {
972
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
973
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
974
+ }
975
+ return cachedDataViewMemory0;
976
+ }
977
+
978
+ function getStringFromWasm0(ptr, len) {
979
+ ptr = ptr >>> 0;
980
+ return decodeText(ptr, len);
981
+ }
982
+
983
+ let cachedUint8ArrayMemory0 = null;
984
+ function getUint8ArrayMemory0() {
985
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
986
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
987
+ }
988
+ return cachedUint8ArrayMemory0;
989
+ }
990
+
991
+ let cachedUint8ClampedArrayMemory0 = null;
992
+ function getUint8ClampedArrayMemory0() {
993
+ if (cachedUint8ClampedArrayMemory0 === null || cachedUint8ClampedArrayMemory0.byteLength === 0) {
994
+ cachedUint8ClampedArrayMemory0 = new Uint8ClampedArray(wasm.memory.buffer);
995
+ }
996
+ return cachedUint8ClampedArrayMemory0;
997
+ }
998
+
999
+ function getObject(idx) { return heap[idx]; }
1000
+
1001
+ function handleError(f, args) {
1002
+ try {
1003
+ return f.apply(this, args);
1004
+ } catch (e) {
1005
+ wasm.__wbindgen_export3(addHeapObject(e));
1006
+ }
1007
+ }
1008
+
1009
+ let heap = new Array(1024).fill(undefined);
1010
+ heap.push(undefined, null, true, false);
1011
+
1012
+ let heap_next = heap.length;
1013
+
1014
+ function isLikeNone(x) {
1015
+ return x === undefined || x === null;
1016
+ }
1017
+
1018
+ function makeMutClosure(arg0, arg1, dtor, f) {
1019
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
1020
+ const real = (...args) => {
1021
+
1022
+ // First up with a closure we increment the internal reference
1023
+ // count. This ensures that the Rust closure environment won't
1024
+ // be deallocated while we're invoking it.
1025
+ state.cnt++;
1026
+ const a = state.a;
1027
+ state.a = 0;
1028
+ try {
1029
+ return f(a, state.b, ...args);
1030
+ } finally {
1031
+ state.a = a;
1032
+ real._wbg_cb_unref();
1033
+ }
1034
+ };
1035
+ real._wbg_cb_unref = () => {
1036
+ if (--state.cnt === 0) {
1037
+ state.dtor(state.a, state.b);
1038
+ state.a = 0;
1039
+ CLOSURE_DTORS.unregister(state);
1040
+ }
1041
+ };
1042
+ CLOSURE_DTORS.register(real, state, state);
1043
+ return real;
1044
+ }
1045
+
1046
+ function passArray8ToWasm0(arg, malloc) {
1047
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
1048
+ getUint8ArrayMemory0().set(arg, ptr / 1);
1049
+ WASM_VECTOR_LEN = arg.length;
1050
+ return ptr;
1051
+ }
1052
+
1053
+ function passStringToWasm0(arg, malloc, realloc) {
1054
+ if (realloc === undefined) {
1055
+ const buf = cachedTextEncoder.encode(arg);
1056
+ const ptr = malloc(buf.length, 1) >>> 0;
1057
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1058
+ WASM_VECTOR_LEN = buf.length;
1059
+ return ptr;
1060
+ }
1061
+
1062
+ let len = arg.length;
1063
+ let ptr = malloc(len, 1) >>> 0;
1064
+
1065
+ const mem = getUint8ArrayMemory0();
1066
+
1067
+ let offset = 0;
1068
+
1069
+ for (; offset < len; offset++) {
1070
+ const code = arg.charCodeAt(offset);
1071
+ if (code > 0x7F) break;
1072
+ mem[ptr + offset] = code;
1073
+ }
1074
+ if (offset !== len) {
1075
+ if (offset !== 0) {
1076
+ arg = arg.slice(offset);
1077
+ }
1078
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1079
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1080
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1081
+
1082
+ offset += ret.written;
1083
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1084
+ }
1085
+
1086
+ WASM_VECTOR_LEN = offset;
1087
+ return ptr;
1088
+ }
1089
+
1090
+ function takeObject(idx) {
1091
+ const ret = getObject(idx);
1092
+ dropObject(idx);
1093
+ return ret;
1094
+ }
1095
+
1096
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1097
+ cachedTextDecoder.decode();
1098
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1099
+ let numBytesDecoded = 0;
1100
+ function decodeText(ptr, len) {
1101
+ numBytesDecoded += len;
1102
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1103
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1104
+ cachedTextDecoder.decode();
1105
+ numBytesDecoded = len;
1106
+ }
1107
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1108
+ }
1109
+
1110
+ const cachedTextEncoder = new TextEncoder();
1111
+
1112
+ if (!('encodeInto' in cachedTextEncoder)) {
1113
+ cachedTextEncoder.encodeInto = function (arg, view) {
1114
+ const buf = cachedTextEncoder.encode(arg);
1115
+ view.set(buf);
1116
+ return {
1117
+ read: arg.length,
1118
+ written: buf.length
1119
+ };
1120
+ };
1121
+ }
1122
+
1123
+ let WASM_VECTOR_LEN = 0;
1124
+
1125
+ let wasmModule, wasm;
1126
+ function __wbg_finalize_init(instance, module) {
1127
+ wasm = instance.exports;
1128
+ wasmModule = module;
1129
+ cachedDataViewMemory0 = null;
1130
+ cachedUint8ArrayMemory0 = null;
1131
+ cachedUint8ClampedArrayMemory0 = null;
1132
+ return wasm;
1133
+ }
1134
+
1135
+ async function __wbg_load(module, imports) {
1136
+ if (typeof Response === 'function' && module instanceof Response) {
1137
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1138
+ try {
1139
+ return await WebAssembly.instantiateStreaming(module, imports);
1140
+ } catch (e) {
1141
+ const validResponse = module.ok && expectedResponseType(module.type);
1142
+
1143
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1144
+ 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);
1145
+
1146
+ } else { throw e; }
1147
+ }
1148
+ }
1149
+
1150
+ const bytes = await module.arrayBuffer();
1151
+ return await WebAssembly.instantiate(bytes, imports);
1152
+ } else {
1153
+ const instance = await WebAssembly.instantiate(module, imports);
1154
+
1155
+ if (instance instanceof WebAssembly.Instance) {
1156
+ return { instance, module };
1157
+ } else {
1158
+ return instance;
1159
+ }
1160
+ }
1161
+
1162
+ function expectedResponseType(type) {
1163
+ switch (type) {
1164
+ case 'basic': case 'cors': case 'default': return true;
1165
+ }
1166
+ return false;
1167
+ }
1168
+ }
1169
+
1170
+ function initSync(module) {
1171
+ if (wasm !== undefined) return wasm;
1172
+
1173
+
1174
+ if (module !== undefined) {
1175
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1176
+ ({module} = module)
1177
+ } else {
1178
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1179
+ }
1180
+ }
1181
+
1182
+ const imports = __wbg_get_imports();
1183
+ if (!(module instanceof WebAssembly.Module)) {
1184
+ module = new WebAssembly.Module(module);
1185
+ }
1186
+ const instance = new WebAssembly.Instance(module, imports);
1187
+ return __wbg_finalize_init(instance, module);
1188
+ }
1189
+
1190
+ async function __wbg_init(module_or_path) {
1191
+ if (wasm !== undefined) return wasm;
1192
+
1193
+
1194
+ if (module_or_path !== undefined) {
1195
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1196
+ ({module_or_path} = module_or_path)
1197
+ } else {
1198
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1199
+ }
1200
+ }
1201
+
1202
+ if (module_or_path === undefined) {
1203
+ module_or_path = new URL('document_viewer_wasm_bg.wasm', import.meta.url);
1204
+ }
1205
+ const imports = __wbg_get_imports();
1206
+
1207
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1208
+ module_or_path = fetch(module_or_path);
1209
+ }
1210
+
1211
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1212
+
1213
+ return __wbg_finalize_init(instance, module);
1214
+ }
1215
+
1216
+ export { initSync, __wbg_init as default };