@laminapdf/wasm 0.2.0-alpha.2 → 0.2.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lamina_pdf_base.d.ts +16 -4
- package/dist/lamina_pdf_base.js +227 -85
- package/dist/lamina_pdf_base.wasm +0 -0
- package/dist/lamina_pdf_extract.d.ts +416 -10
- package/dist/lamina_pdf_extract.js +421 -90
- package/dist/lamina_pdf_extract.wasm +0 -0
- package/dist/lamina_pdf_render_hayro.wasm +0 -0
- package/dist/lamina_pdf_text.d.ts +429 -11
- package/dist/lamina_pdf_text.js +442 -99
- package/dist/lamina_pdf_text.wasm +0 -0
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ export class WasmBuilder {
|
|
|
14
14
|
free() {
|
|
15
15
|
const ptr = this.__destroy_into_raw();
|
|
16
16
|
wasm.__wbg_wasmbuilder_free(ptr, 0);
|
|
17
|
+
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* Attaches a file (`/EmbeddedFiles`, the catalog's `/AF`): `name`, its bytes and its MIME
|
|
@@ -33,7 +34,8 @@ export class WasmBuilder {
|
|
|
33
34
|
const len1 = WASM_VECTOR_LEN;
|
|
34
35
|
const ptr2 = passStringToWasm0(mime, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
35
36
|
const len2 = WASM_VECTOR_LEN;
|
|
36
|
-
|
|
37
|
+
let ret;
|
|
38
|
+
ret = wasm.wasmbuilder_attach(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, options);
|
|
37
39
|
if (ret[1]) {
|
|
38
40
|
throw takeFromExternrefTable0(ret[0]);
|
|
39
41
|
}
|
|
@@ -50,7 +52,8 @@ export class WasmBuilder {
|
|
|
50
52
|
destination(name, index, fit) {
|
|
51
53
|
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
52
54
|
const len0 = WASM_VECTOR_LEN;
|
|
53
|
-
|
|
55
|
+
let ret;
|
|
56
|
+
ret = wasm.wasmbuilder_destination(this.__wbg_ptr, ptr0, len0, index, fit);
|
|
54
57
|
if (ret[1]) {
|
|
55
58
|
throw takeFromExternrefTable0(ret[0]);
|
|
56
59
|
}
|
|
@@ -65,7 +68,8 @@ export class WasmBuilder {
|
|
|
65
68
|
* @returns {WasmDocument}
|
|
66
69
|
*/
|
|
67
70
|
finish() {
|
|
68
|
-
|
|
71
|
+
let ret;
|
|
72
|
+
ret = wasm.wasmbuilder_finish(this.__wbg_ptr);
|
|
69
73
|
if (ret[2]) {
|
|
70
74
|
throw takeFromExternrefTable0(ret[1]);
|
|
71
75
|
}
|
|
@@ -81,7 +85,8 @@ export class WasmBuilder {
|
|
|
81
85
|
lang(lang) {
|
|
82
86
|
const ptr0 = passStringToWasm0(lang, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
83
87
|
const len0 = WASM_VECTOR_LEN;
|
|
84
|
-
|
|
88
|
+
let ret;
|
|
89
|
+
ret = wasm.wasmbuilder_lang(this.__wbg_ptr, ptr0, len0);
|
|
85
90
|
if (ret[1]) {
|
|
86
91
|
throw takeFromExternrefTable0(ret[0]);
|
|
87
92
|
}
|
|
@@ -94,7 +99,8 @@ export class WasmBuilder {
|
|
|
94
99
|
* @param {MetadataInit} metadata
|
|
95
100
|
*/
|
|
96
101
|
metadata(metadata) {
|
|
97
|
-
|
|
102
|
+
let ret;
|
|
103
|
+
ret = wasm.wasmbuilder_metadata(this.__wbg_ptr, metadata);
|
|
98
104
|
if (ret[1]) {
|
|
99
105
|
throw takeFromExternrefTable0(ret[0]);
|
|
100
106
|
}
|
|
@@ -107,12 +113,14 @@ export class WasmBuilder {
|
|
|
107
113
|
* @param {BuildOptionsInit | undefined} options
|
|
108
114
|
*/
|
|
109
115
|
constructor(options) {
|
|
110
|
-
|
|
116
|
+
let ret;
|
|
117
|
+
ret = wasm.wasmbuilder_new(options);
|
|
111
118
|
if (ret[2]) {
|
|
112
119
|
throw takeFromExternrefTable0(ret[1]);
|
|
113
120
|
}
|
|
114
121
|
this.__wbg_ptr = ret[0];
|
|
115
|
-
|
|
122
|
+
Object.defineProperty(this, '__wbg_inst', { value: __wbg_instance_id, writable: true });
|
|
123
|
+
WasmBuilderFinalization.register(this, { ptr: ret[0], instance: __wbg_instance_id }, this);
|
|
116
124
|
return this;
|
|
117
125
|
}
|
|
118
126
|
/**
|
|
@@ -124,7 +132,8 @@ export class WasmBuilder {
|
|
|
124
132
|
* @returns {string[]}
|
|
125
133
|
*/
|
|
126
134
|
outline(entries) {
|
|
127
|
-
|
|
135
|
+
let ret;
|
|
136
|
+
ret = wasm.wasmbuilder_outline(this.__wbg_ptr, entries);
|
|
128
137
|
if (ret[2]) {
|
|
129
138
|
throw takeFromExternrefTable0(ret[1]);
|
|
130
139
|
}
|
|
@@ -138,7 +147,8 @@ export class WasmBuilder {
|
|
|
138
147
|
* @param {PageLabelInit[]} ranges
|
|
139
148
|
*/
|
|
140
149
|
pageLabels(ranges) {
|
|
141
|
-
|
|
150
|
+
let ret;
|
|
151
|
+
ret = wasm.wasmbuilder_pageLabels(this.__wbg_ptr, ranges);
|
|
142
152
|
if (ret[1]) {
|
|
143
153
|
throw takeFromExternrefTable0(ret[0]);
|
|
144
154
|
}
|
|
@@ -150,7 +160,8 @@ export class WasmBuilder {
|
|
|
150
160
|
* @returns {WasmPageBuilder}
|
|
151
161
|
*/
|
|
152
162
|
page(width, height) {
|
|
153
|
-
|
|
163
|
+
let ret;
|
|
164
|
+
ret = wasm.wasmbuilder_page(this.__wbg_ptr, width, height);
|
|
154
165
|
return WasmPageBuilder.__wrap(ret);
|
|
155
166
|
}
|
|
156
167
|
/**
|
|
@@ -161,7 +172,8 @@ export class WasmBuilder {
|
|
|
161
172
|
* @param {ViewerPreferencesInit} prefs
|
|
162
173
|
*/
|
|
163
174
|
viewerPreferences(prefs) {
|
|
164
|
-
|
|
175
|
+
let ret;
|
|
176
|
+
ret = wasm.wasmbuilder_viewerPreferences(this.__wbg_ptr, prefs);
|
|
165
177
|
if (ret[1]) {
|
|
166
178
|
throw takeFromExternrefTable0(ret[0]);
|
|
167
179
|
}
|
|
@@ -177,7 +189,9 @@ export class WasmDocument {
|
|
|
177
189
|
static __wrap(ptr) {
|
|
178
190
|
const obj = Object.create(WasmDocument.prototype);
|
|
179
191
|
obj.__wbg_ptr = ptr;
|
|
180
|
-
|
|
192
|
+
Object.defineProperty(obj, '__wbg_inst', { value: __wbg_instance_id, writable: true });
|
|
193
|
+
|
|
194
|
+
WasmDocumentFinalization.register(obj, { ptr, instance: __wbg_instance_id }, obj);
|
|
181
195
|
return obj;
|
|
182
196
|
}
|
|
183
197
|
__destroy_into_raw() {
|
|
@@ -189,6 +203,7 @@ export class WasmDocument {
|
|
|
189
203
|
free() {
|
|
190
204
|
const ptr = this.__destroy_into_raw();
|
|
191
205
|
wasm.__wbg_wasmdocument_free(ptr, 0);
|
|
206
|
+
|
|
192
207
|
}
|
|
193
208
|
/**
|
|
194
209
|
* Applies an op log (`{ "v": 1, "ops": [ … ] }`) as one transaction.
|
|
@@ -201,7 +216,8 @@ export class WasmDocument {
|
|
|
201
216
|
applyLog(json) {
|
|
202
217
|
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
203
218
|
const len0 = WASM_VECTOR_LEN;
|
|
204
|
-
|
|
219
|
+
let ret;
|
|
220
|
+
ret = wasm.wasmdocument_applyLog(this.__wbg_ptr, ptr0, len0);
|
|
205
221
|
if (ret[2]) {
|
|
206
222
|
throw takeFromExternrefTable0(ret[1]);
|
|
207
223
|
}
|
|
@@ -217,18 +233,68 @@ export class WasmDocument {
|
|
|
217
233
|
* @returns {EditedJs}
|
|
218
234
|
*/
|
|
219
235
|
apply(ops) {
|
|
220
|
-
|
|
236
|
+
let ret;
|
|
237
|
+
ret = wasm.wasmdocument_apply(this.__wbg_ptr, ops);
|
|
221
238
|
if (ret[2]) {
|
|
222
239
|
throw takeFromExternrefTable0(ret[1]);
|
|
223
240
|
}
|
|
224
241
|
return takeFromExternrefTable0(ret[0]);
|
|
225
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* An extraction stepped a page at a time, whose models the host runs: each step returns
|
|
245
|
+
* its progress, with the result it waits for under `request` (render that page at `dpi`,
|
|
246
|
+
* run the model, hand the result to `provide`), and once every page is done, the output in
|
|
247
|
+
* `options.format` (the extract and text modules).
|
|
248
|
+
*
|
|
249
|
+
* # Errors
|
|
250
|
+
* As `extract`, for the options and the pages asked for.
|
|
251
|
+
* @param {ExtractInit} options
|
|
252
|
+
* @returns {WasmExtractJob}
|
|
253
|
+
*/
|
|
254
|
+
extractJob(options) {
|
|
255
|
+
let ret;
|
|
256
|
+
ret = wasm.wasmdocument_extractJob(this.__wbg_ptr, options);
|
|
257
|
+
if (ret[2]) {
|
|
258
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
259
|
+
}
|
|
260
|
+
return WasmExtractJob.__wrap(ret[0]);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* The document's text for retrieval and LLMs, as one string: Markdown, plain text, the
|
|
264
|
+
* `laminapdf.extract/1` JSON, or the chunks as a JSON array (the extract and text modules).
|
|
265
|
+
*
|
|
266
|
+
* # Errors
|
|
267
|
+
* `page-index-out-of-range` for a page in `pages` past the end; `data-pending` and the
|
|
268
|
+
* reading errors; `unknown-option` / `invalid-argument` for bad options.
|
|
269
|
+
* @param {ExtractInit} options
|
|
270
|
+
* @returns {string}
|
|
271
|
+
*/
|
|
272
|
+
extract(options) {
|
|
273
|
+
let deferred2_0;
|
|
274
|
+
let deferred2_1;
|
|
275
|
+
try {
|
|
276
|
+
let ret;
|
|
277
|
+
ret = wasm.wasmdocument_extract(this.__wbg_ptr, options);
|
|
278
|
+
var ptr1 = ret[0];
|
|
279
|
+
var len1 = ret[1];
|
|
280
|
+
if (ret[3]) {
|
|
281
|
+
ptr1 = 0; len1 = 0;
|
|
282
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
283
|
+
}
|
|
284
|
+
deferred2_0 = ptr1;
|
|
285
|
+
deferred2_1 = len1;
|
|
286
|
+
return getStringFromWasm0(ptr1, len1);
|
|
287
|
+
} finally {
|
|
288
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
226
291
|
/**
|
|
227
292
|
* Whether there are changes no save has written yet.
|
|
228
293
|
* @returns {boolean}
|
|
229
294
|
*/
|
|
230
295
|
hasUnsavedChanges() {
|
|
231
|
-
|
|
296
|
+
let ret;
|
|
297
|
+
ret = wasm.wasmdocument_hasUnsavedChanges(this.__wbg_ptr);
|
|
232
298
|
return ret !== 0;
|
|
233
299
|
}
|
|
234
300
|
/**
|
|
@@ -239,7 +305,42 @@ export class WasmDocument {
|
|
|
239
305
|
* @returns {DocumentInfoJs}
|
|
240
306
|
*/
|
|
241
307
|
info() {
|
|
242
|
-
|
|
308
|
+
let ret;
|
|
309
|
+
ret = wasm.wasmdocument_info(this.__wbg_ptr);
|
|
310
|
+
if (ret[2]) {
|
|
311
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
312
|
+
}
|
|
313
|
+
return takeFromExternrefTable0(ret[0]);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Whether the document says it is tagged (`/MarkInfo /Marked true`; the extract and text modules).
|
|
317
|
+
*
|
|
318
|
+
* # Errors
|
|
319
|
+
* Reading errors.
|
|
320
|
+
* @returns {boolean}
|
|
321
|
+
*/
|
|
322
|
+
isTagged() {
|
|
323
|
+
let ret;
|
|
324
|
+
ret = wasm.wasmdocument_isTagged(this.__wbg_ptr);
|
|
325
|
+
if (ret[2]) {
|
|
326
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
327
|
+
}
|
|
328
|
+
return ret[0] !== 0;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* The named destination `name`, or `undefined` when the document has none by that name or
|
|
332
|
+
* it names no page here (the extract and text modules).
|
|
333
|
+
*
|
|
334
|
+
* # Errors
|
|
335
|
+
* `data-pending` and the reading errors.
|
|
336
|
+
* @param {string} name
|
|
337
|
+
* @returns {TargetJs | undefined}
|
|
338
|
+
*/
|
|
339
|
+
namedDestination(name) {
|
|
340
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
341
|
+
const len0 = WASM_VECTOR_LEN;
|
|
342
|
+
let ret;
|
|
343
|
+
ret = wasm.wasmdocument_namedDestination(this.__wbg_ptr, ptr0, len0);
|
|
243
344
|
if (ret[2]) {
|
|
244
345
|
throw takeFromExternrefTable0(ret[1]);
|
|
245
346
|
}
|
|
@@ -258,7 +359,8 @@ export class WasmDocument {
|
|
|
258
359
|
static openBytes(bytes, options) {
|
|
259
360
|
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
260
361
|
const len0 = WASM_VECTOR_LEN;
|
|
261
|
-
|
|
362
|
+
let ret;
|
|
363
|
+
ret = wasm.wasmdocument_openBytes(ptr0, len0, options);
|
|
262
364
|
if (ret[2]) {
|
|
263
365
|
throw takeFromExternrefTable0(ret[1]);
|
|
264
366
|
}
|
|
@@ -277,12 +379,29 @@ export class WasmDocument {
|
|
|
277
379
|
*/
|
|
278
380
|
static openSource(source, options) {
|
|
279
381
|
_assertClass(source, WasmSparseSource);
|
|
280
|
-
|
|
382
|
+
let ret;
|
|
383
|
+
ret = wasm.wasmdocument_openSource(source.__wbg_ptr, options);
|
|
281
384
|
if (ret[2]) {
|
|
282
385
|
throw takeFromExternrefTable0(ret[1]);
|
|
283
386
|
}
|
|
284
387
|
return WasmDocument.__wrap(ret[0]);
|
|
285
388
|
}
|
|
389
|
+
/**
|
|
390
|
+
* The outline's top-level items, each with its children; empty without an outline (the
|
|
391
|
+
* extract and text modules).
|
|
392
|
+
*
|
|
393
|
+
* # Errors
|
|
394
|
+
* `data-pending` and the reading errors.
|
|
395
|
+
* @returns {OutlineNodeJs[]}
|
|
396
|
+
*/
|
|
397
|
+
outline() {
|
|
398
|
+
let ret;
|
|
399
|
+
ret = wasm.wasmdocument_outline(this.__wbg_ptr);
|
|
400
|
+
if (ret[2]) {
|
|
401
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
402
|
+
}
|
|
403
|
+
return takeFromExternrefTable0(ret[0]);
|
|
404
|
+
}
|
|
286
405
|
/**
|
|
287
406
|
* A handle on the page with `id` (`p12.0`).
|
|
288
407
|
*
|
|
@@ -294,7 +413,8 @@ export class WasmDocument {
|
|
|
294
413
|
pageById(id) {
|
|
295
414
|
const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
296
415
|
const len0 = WASM_VECTOR_LEN;
|
|
297
|
-
|
|
416
|
+
let ret;
|
|
417
|
+
ret = wasm.wasmdocument_pageById(this.__wbg_ptr, ptr0, len0);
|
|
298
418
|
if (ret[2]) {
|
|
299
419
|
throw takeFromExternrefTable0(ret[1]);
|
|
300
420
|
}
|
|
@@ -308,7 +428,8 @@ export class WasmDocument {
|
|
|
308
428
|
* @returns {number}
|
|
309
429
|
*/
|
|
310
430
|
pageCount() {
|
|
311
|
-
|
|
431
|
+
let ret;
|
|
432
|
+
ret = wasm.wasmdocument_pageCount(this.__wbg_ptr);
|
|
312
433
|
if (ret[2]) {
|
|
313
434
|
throw takeFromExternrefTable0(ret[1]);
|
|
314
435
|
}
|
|
@@ -323,7 +444,8 @@ export class WasmDocument {
|
|
|
323
444
|
* @returns {PageInfoJs}
|
|
324
445
|
*/
|
|
325
446
|
pageInfo(index) {
|
|
326
|
-
|
|
447
|
+
let ret;
|
|
448
|
+
ret = wasm.wasmdocument_pageInfo(this.__wbg_ptr, index);
|
|
327
449
|
if (ret[2]) {
|
|
328
450
|
throw takeFromExternrefTable0(ret[1]);
|
|
329
451
|
}
|
|
@@ -337,7 +459,8 @@ export class WasmDocument {
|
|
|
337
459
|
* @returns {PageInfoJs[]}
|
|
338
460
|
*/
|
|
339
461
|
pageInfos() {
|
|
340
|
-
|
|
462
|
+
let ret;
|
|
463
|
+
ret = wasm.wasmdocument_pageInfos(this.__wbg_ptr);
|
|
341
464
|
if (ret[2]) {
|
|
342
465
|
throw takeFromExternrefTable0(ret[1]);
|
|
343
466
|
}
|
|
@@ -352,7 +475,8 @@ export class WasmDocument {
|
|
|
352
475
|
* @returns {WasmPage}
|
|
353
476
|
*/
|
|
354
477
|
page(index) {
|
|
355
|
-
|
|
478
|
+
let ret;
|
|
479
|
+
ret = wasm.wasmdocument_page(this.__wbg_ptr, index);
|
|
356
480
|
if (ret[2]) {
|
|
357
481
|
throw takeFromExternrefTable0(ret[1]);
|
|
358
482
|
}
|
|
@@ -368,7 +492,8 @@ export class WasmDocument {
|
|
|
368
492
|
rebase(bytes) {
|
|
369
493
|
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
370
494
|
const len0 = WASM_VECTOR_LEN;
|
|
371
|
-
|
|
495
|
+
let ret;
|
|
496
|
+
ret = wasm.wasmdocument_rebase(this.__wbg_ptr, ptr0, len0);
|
|
372
497
|
if (ret[1]) {
|
|
373
498
|
throw takeFromExternrefTable0(ret[0]);
|
|
374
499
|
}
|
|
@@ -381,7 +506,8 @@ export class WasmDocument {
|
|
|
381
506
|
* @returns {UndoOutcomeJs | undefined}
|
|
382
507
|
*/
|
|
383
508
|
redo() {
|
|
384
|
-
|
|
509
|
+
let ret;
|
|
510
|
+
ret = wasm.wasmdocument_redo(this.__wbg_ptr);
|
|
385
511
|
if (ret[2]) {
|
|
386
512
|
throw takeFromExternrefTable0(ret[1]);
|
|
387
513
|
}
|
|
@@ -396,7 +522,8 @@ export class WasmDocument {
|
|
|
396
522
|
* @returns {WasmSaveJob}
|
|
397
523
|
*/
|
|
398
524
|
saveJob(options) {
|
|
399
|
-
|
|
525
|
+
let ret;
|
|
526
|
+
ret = wasm.wasmdocument_saveJob(this.__wbg_ptr, options);
|
|
400
527
|
if (ret[2]) {
|
|
401
528
|
throw takeFromExternrefTable0(ret[1]);
|
|
402
529
|
}
|
|
@@ -411,7 +538,24 @@ export class WasmDocument {
|
|
|
411
538
|
* @returns {{ bytes: Uint8Array<ArrayBuffer>; report: SaveReportJs }}
|
|
412
539
|
*/
|
|
413
540
|
save(options) {
|
|
414
|
-
|
|
541
|
+
let ret;
|
|
542
|
+
ret = wasm.wasmdocument_save(this.__wbg_ptr, options);
|
|
543
|
+
if (ret[2]) {
|
|
544
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
545
|
+
}
|
|
546
|
+
return takeFromExternrefTable0(ret[0]);
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* The structure tree's top-level elements in reading order, or `undefined` without one (the
|
|
550
|
+
* extract and text modules, beside `WasmPage.text`, whose runs it links by MCID).
|
|
551
|
+
*
|
|
552
|
+
* # Errors
|
|
553
|
+
* Reading errors.
|
|
554
|
+
* @returns {StructureNodeJs[] | undefined}
|
|
555
|
+
*/
|
|
556
|
+
structureTree() {
|
|
557
|
+
let ret;
|
|
558
|
+
ret = wasm.wasmdocument_structureTree(this.__wbg_ptr);
|
|
415
559
|
if (ret[2]) {
|
|
416
560
|
throw takeFromExternrefTable0(ret[1]);
|
|
417
561
|
}
|
|
@@ -425,7 +569,8 @@ export class WasmDocument {
|
|
|
425
569
|
* @returns {UndoOutcomeJs | undefined}
|
|
426
570
|
*/
|
|
427
571
|
undo() {
|
|
428
|
-
|
|
572
|
+
let ret;
|
|
573
|
+
ret = wasm.wasmdocument_undo(this.__wbg_ptr);
|
|
429
574
|
if (ret[2]) {
|
|
430
575
|
throw takeFromExternrefTable0(ret[1]);
|
|
431
576
|
}
|
|
@@ -436,12 +581,80 @@ export class WasmDocument {
|
|
|
436
581
|
* @returns {WasmWarningCursor}
|
|
437
582
|
*/
|
|
438
583
|
warnings() {
|
|
439
|
-
|
|
584
|
+
let ret;
|
|
585
|
+
ret = wasm.wasmdocument_warnings(this.__wbg_ptr);
|
|
440
586
|
return WasmWarningCursor.__wrap(ret);
|
|
441
587
|
}
|
|
442
588
|
}
|
|
443
589
|
if (Symbol.dispose) WasmDocument.prototype[Symbol.dispose] = WasmDocument.prototype.free;
|
|
444
590
|
|
|
591
|
+
/**
|
|
592
|
+
* An extraction in progress, from `WasmDocument.extractJob`; it holds its document weakly.
|
|
593
|
+
*/
|
|
594
|
+
export class WasmExtractJob {
|
|
595
|
+
static __wrap(ptr) {
|
|
596
|
+
const obj = Object.create(WasmExtractJob.prototype);
|
|
597
|
+
obj.__wbg_ptr = ptr;
|
|
598
|
+
Object.defineProperty(obj, '__wbg_inst', { value: __wbg_instance_id, writable: true });
|
|
599
|
+
|
|
600
|
+
WasmExtractJobFinalization.register(obj, { ptr, instance: __wbg_instance_id }, obj);
|
|
601
|
+
return obj;
|
|
602
|
+
}
|
|
603
|
+
__destroy_into_raw() {
|
|
604
|
+
const ptr = this.__wbg_ptr;
|
|
605
|
+
this.__wbg_ptr = 0;
|
|
606
|
+
WasmExtractJobFinalization.unregister(this);
|
|
607
|
+
return ptr;
|
|
608
|
+
}
|
|
609
|
+
free() {
|
|
610
|
+
const ptr = this.__destroy_into_raw();
|
|
611
|
+
wasm.__wbg_wasmextractjob_free(ptr, 0);
|
|
612
|
+
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Stops the job: its next step fails with `cancelled`.
|
|
616
|
+
*/
|
|
617
|
+
cancel() {
|
|
618
|
+
wasm.wasmextractjob_cancel(this.__wbg_ptr);
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Hands the job the result of its open request: `{ kind: "layout", regions }` or
|
|
622
|
+
* `{ kind: "ocr", words }`, boxes as `[x, y, width, height]` in top-left points.
|
|
623
|
+
*
|
|
624
|
+
* # Errors
|
|
625
|
+
* `model-result-unexpected` when nothing was asked for or `result` is the other kind;
|
|
626
|
+
* `invalid-argument` / `unknown-option` for a malformed result.
|
|
627
|
+
* @param {ModelResultInit} result
|
|
628
|
+
*/
|
|
629
|
+
provide(result) {
|
|
630
|
+
let ret;
|
|
631
|
+
ret = wasm.wasmextractjob_provide(this.__wbg_ptr, result);
|
|
632
|
+
if (ret[1]) {
|
|
633
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Extracts up to `budget` pages: `{ state: "progress", done, total, phase, request? }` or
|
|
638
|
+
* `{ state: "done", output }`, the output in the job's format. While `request` is set, a
|
|
639
|
+
* step does nothing until `provide` answers it.
|
|
640
|
+
*
|
|
641
|
+
* # Errors
|
|
642
|
+
* `cancelled`, `document-changed`, `job-finished`, `disposed` when the document is freed,
|
|
643
|
+
* and the reading errors.
|
|
644
|
+
* @param {number} budget
|
|
645
|
+
* @returns {({ state: "progress" } & ExtractProgressJs) | { state: "done"; output: string }}
|
|
646
|
+
*/
|
|
647
|
+
step(budget) {
|
|
648
|
+
let ret;
|
|
649
|
+
ret = wasm.wasmextractjob_step(this.__wbg_ptr, budget);
|
|
650
|
+
if (ret[2]) {
|
|
651
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
652
|
+
}
|
|
653
|
+
return takeFromExternrefTable0(ret[0]);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
if (Symbol.dispose) WasmExtractJob.prototype[Symbol.dispose] = WasmExtractJob.prototype.free;
|
|
657
|
+
|
|
445
658
|
/**
|
|
446
659
|
* An image to draw (decoded or passed through once, shared by every use).
|
|
447
660
|
*/
|
|
@@ -449,7 +662,9 @@ export class WasmImage {
|
|
|
449
662
|
static __wrap(ptr) {
|
|
450
663
|
const obj = Object.create(WasmImage.prototype);
|
|
451
664
|
obj.__wbg_ptr = ptr;
|
|
452
|
-
|
|
665
|
+
Object.defineProperty(obj, '__wbg_inst', { value: __wbg_instance_id, writable: true });
|
|
666
|
+
|
|
667
|
+
WasmImageFinalization.register(obj, { ptr, instance: __wbg_instance_id }, obj);
|
|
453
668
|
return obj;
|
|
454
669
|
}
|
|
455
670
|
__destroy_into_raw() {
|
|
@@ -461,13 +676,15 @@ export class WasmImage {
|
|
|
461
676
|
free() {
|
|
462
677
|
const ptr = this.__destroy_into_raw();
|
|
463
678
|
wasm.__wbg_wasmimage_free(ptr, 0);
|
|
679
|
+
|
|
464
680
|
}
|
|
465
681
|
/**
|
|
466
682
|
* Height in pixels.
|
|
467
683
|
* @returns {number}
|
|
468
684
|
*/
|
|
469
685
|
get height() {
|
|
470
|
-
|
|
686
|
+
let ret;
|
|
687
|
+
ret = wasm.wasmimage_height(this.__wbg_ptr);
|
|
471
688
|
return ret >>> 0;
|
|
472
689
|
}
|
|
473
690
|
/**
|
|
@@ -481,7 +698,8 @@ export class WasmImage {
|
|
|
481
698
|
static jpeg(bytes) {
|
|
482
699
|
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
483
700
|
const len0 = WASM_VECTOR_LEN;
|
|
484
|
-
|
|
701
|
+
let ret;
|
|
702
|
+
ret = wasm.wasmimage_jpeg(ptr0, len0);
|
|
485
703
|
if (ret[2]) {
|
|
486
704
|
throw takeFromExternrefTable0(ret[1]);
|
|
487
705
|
}
|
|
@@ -498,7 +716,8 @@ export class WasmImage {
|
|
|
498
716
|
static png(bytes) {
|
|
499
717
|
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
500
718
|
const len0 = WASM_VECTOR_LEN;
|
|
501
|
-
|
|
719
|
+
let ret;
|
|
720
|
+
ret = wasm.wasmimage_png(ptr0, len0);
|
|
502
721
|
if (ret[2]) {
|
|
503
722
|
throw takeFromExternrefTable0(ret[1]);
|
|
504
723
|
}
|
|
@@ -517,7 +736,8 @@ export class WasmImage {
|
|
|
517
736
|
static rgba(width, height, rgba) {
|
|
518
737
|
const ptr0 = passArray8ToWasm0(rgba, wasm.__wbindgen_malloc);
|
|
519
738
|
const len0 = WASM_VECTOR_LEN;
|
|
520
|
-
|
|
739
|
+
let ret;
|
|
740
|
+
ret = wasm.wasmimage_rgba(width, height, ptr0, len0);
|
|
521
741
|
if (ret[2]) {
|
|
522
742
|
throw takeFromExternrefTable0(ret[1]);
|
|
523
743
|
}
|
|
@@ -528,7 +748,8 @@ export class WasmImage {
|
|
|
528
748
|
* @returns {number}
|
|
529
749
|
*/
|
|
530
750
|
get width() {
|
|
531
|
-
|
|
751
|
+
let ret;
|
|
752
|
+
ret = wasm.wasmimage_width(this.__wbg_ptr);
|
|
532
753
|
return ret >>> 0;
|
|
533
754
|
}
|
|
534
755
|
}
|
|
@@ -541,7 +762,9 @@ export class WasmPage {
|
|
|
541
762
|
static __wrap(ptr) {
|
|
542
763
|
const obj = Object.create(WasmPage.prototype);
|
|
543
764
|
obj.__wbg_ptr = ptr;
|
|
544
|
-
|
|
765
|
+
Object.defineProperty(obj, '__wbg_inst', { value: __wbg_instance_id, writable: true });
|
|
766
|
+
|
|
767
|
+
WasmPageFinalization.register(obj, { ptr, instance: __wbg_instance_id }, obj);
|
|
545
768
|
return obj;
|
|
546
769
|
}
|
|
547
770
|
__destroy_into_raw() {
|
|
@@ -553,6 +776,7 @@ export class WasmPage {
|
|
|
553
776
|
free() {
|
|
554
777
|
const ptr = this.__destroy_into_raw();
|
|
555
778
|
wasm.__wbg_wasmpage_free(ptr, 0);
|
|
779
|
+
|
|
556
780
|
}
|
|
557
781
|
/**
|
|
558
782
|
* The page's stable ID (`p12.0`).
|
|
@@ -562,7 +786,8 @@ export class WasmPage {
|
|
|
562
786
|
let deferred1_0;
|
|
563
787
|
let deferred1_1;
|
|
564
788
|
try {
|
|
565
|
-
|
|
789
|
+
let ret;
|
|
790
|
+
ret = wasm.wasmpage_id(this.__wbg_ptr);
|
|
566
791
|
deferred1_0 = ret[0];
|
|
567
792
|
deferred1_1 = ret[1];
|
|
568
793
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -574,11 +799,13 @@ export class WasmPage {
|
|
|
574
799
|
* The page's current 0-based index.
|
|
575
800
|
*
|
|
576
801
|
* # Errors
|
|
577
|
-
* `unknown-page` when the page is gone; reading
|
|
802
|
+
* `unknown-page` when the page is gone; `disposed` when its document is freed; reading
|
|
803
|
+
* errors.
|
|
578
804
|
* @returns {number}
|
|
579
805
|
*/
|
|
580
806
|
index() {
|
|
581
|
-
|
|
807
|
+
let ret;
|
|
808
|
+
ret = wasm.wasmpage_index(this.__wbg_ptr);
|
|
582
809
|
if (ret[2]) {
|
|
583
810
|
throw takeFromExternrefTable0(ret[1]);
|
|
584
811
|
}
|
|
@@ -592,24 +819,26 @@ export class WasmPage {
|
|
|
592
819
|
* @returns {PageInfoJs}
|
|
593
820
|
*/
|
|
594
821
|
info() {
|
|
595
|
-
|
|
822
|
+
let ret;
|
|
823
|
+
ret = wasm.wasmpage_info(this.__wbg_ptr);
|
|
596
824
|
if (ret[2]) {
|
|
597
825
|
throw takeFromExternrefTable0(ret[1]);
|
|
598
826
|
}
|
|
599
827
|
return takeFromExternrefTable0(ret[0]);
|
|
600
828
|
}
|
|
601
829
|
/**
|
|
602
|
-
* The page's text: lines, runs, glyph quads and glyph text (
|
|
603
|
-
* modules).
|
|
830
|
+
* The page's text: lines, runs, glyph quads and glyph text (the extract and text modules).
|
|
604
831
|
*
|
|
605
832
|
* # Errors
|
|
606
|
-
* `unknown-page` when the page is gone; `
|
|
607
|
-
* `unknown-option` / `invalid-argument` for bad
|
|
833
|
+
* `unknown-page` when the page is gone; `disposed` when its document is freed;
|
|
834
|
+
* `data-pending` and the reading errors; `unknown-option` / `invalid-argument` for bad
|
|
835
|
+
* options.
|
|
608
836
|
* @param {TextOptionsInit | undefined} options
|
|
609
837
|
* @returns {PageTextJs}
|
|
610
838
|
*/
|
|
611
839
|
text(options) {
|
|
612
|
-
|
|
840
|
+
let ret;
|
|
841
|
+
ret = wasm.wasmpage_text(this.__wbg_ptr, options);
|
|
613
842
|
if (ret[2]) {
|
|
614
843
|
throw takeFromExternrefTable0(ret[1]);
|
|
615
844
|
}
|
|
@@ -626,7 +855,9 @@ export class WasmPageBuilder {
|
|
|
626
855
|
static __wrap(ptr) {
|
|
627
856
|
const obj = Object.create(WasmPageBuilder.prototype);
|
|
628
857
|
obj.__wbg_ptr = ptr;
|
|
629
|
-
|
|
858
|
+
Object.defineProperty(obj, '__wbg_inst', { value: __wbg_instance_id, writable: true });
|
|
859
|
+
|
|
860
|
+
WasmPageBuilderFinalization.register(obj, { ptr, instance: __wbg_instance_id }, obj);
|
|
630
861
|
return obj;
|
|
631
862
|
}
|
|
632
863
|
__destroy_into_raw() {
|
|
@@ -638,10 +869,12 @@ export class WasmPageBuilder {
|
|
|
638
869
|
free() {
|
|
639
870
|
const ptr = this.__destroy_into_raw();
|
|
640
871
|
wasm.__wbg_wasmpagebuilder_free(ptr, 0);
|
|
872
|
+
|
|
641
873
|
}
|
|
642
874
|
/**
|
|
643
875
|
* Opens an artifact until the matching `endTag`: `kind` is `layout`, `page`, `pagination`
|
|
644
|
-
* or `background
|
|
876
|
+
* or `background`, or a pagination artifact that says what it is: `header` (attached to the
|
|
877
|
+
* top edge), `footer` (the bottom) or `watermark`.
|
|
645
878
|
*
|
|
646
879
|
* # Errors
|
|
647
880
|
* `invalid-argument` for another kind.
|
|
@@ -650,7 +883,8 @@ export class WasmPageBuilder {
|
|
|
650
883
|
beginArtifact(kind) {
|
|
651
884
|
const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
652
885
|
const len0 = WASM_VECTOR_LEN;
|
|
653
|
-
|
|
886
|
+
let ret;
|
|
887
|
+
ret = wasm.wasmpagebuilder_beginArtifact(this.__wbg_ptr, ptr0, len0);
|
|
654
888
|
if (ret[1]) {
|
|
655
889
|
throw takeFromExternrefTable0(ret[0]);
|
|
656
890
|
}
|
|
@@ -687,7 +921,8 @@ export class WasmPageBuilder {
|
|
|
687
921
|
var len5 = WASM_VECTOR_LEN;
|
|
688
922
|
var ptr6 = isLikeNone(scope) ? 0 : passStringToWasm0(scope, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
689
923
|
var len6 = WASM_VECTOR_LEN;
|
|
690
|
-
|
|
924
|
+
let ret;
|
|
925
|
+
ret = wasm.wasmpagebuilder_beginTag(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, ptr5, len5, ptr6, len6);
|
|
691
926
|
if (ret[1]) {
|
|
692
927
|
throw takeFromExternrefTable0(ret[0]);
|
|
693
928
|
}
|
|
@@ -702,7 +937,8 @@ export class WasmPageBuilder {
|
|
|
702
937
|
blendMode(mode) {
|
|
703
938
|
const ptr0 = passStringToWasm0(mode, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
704
939
|
const len0 = WASM_VECTOR_LEN;
|
|
705
|
-
|
|
940
|
+
let ret;
|
|
941
|
+
ret = wasm.wasmpagebuilder_blendMode(this.__wbg_ptr, ptr0, len0);
|
|
706
942
|
if (ret[1]) {
|
|
707
943
|
throw takeFromExternrefTable0(ret[0]);
|
|
708
944
|
}
|
|
@@ -720,7 +956,8 @@ export class WasmPageBuilder {
|
|
|
720
956
|
const len0 = WASM_VECTOR_LEN;
|
|
721
957
|
const ptr1 = passStringToWasm0(rule, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
722
958
|
const len1 = WASM_VECTOR_LEN;
|
|
723
|
-
|
|
959
|
+
let ret;
|
|
960
|
+
ret = wasm.wasmpagebuilder_clipPath(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
724
961
|
if (ret[1]) {
|
|
725
962
|
throw takeFromExternrefTable0(ret[0]);
|
|
726
963
|
}
|
|
@@ -732,7 +969,8 @@ export class WasmPageBuilder {
|
|
|
732
969
|
* `builder-finished`.
|
|
733
970
|
*/
|
|
734
971
|
endTag() {
|
|
735
|
-
|
|
972
|
+
let ret;
|
|
973
|
+
ret = wasm.wasmpagebuilder_endTag(this.__wbg_ptr);
|
|
736
974
|
if (ret[1]) {
|
|
737
975
|
throw takeFromExternrefTable0(ret[0]);
|
|
738
976
|
}
|
|
@@ -747,7 +985,8 @@ export class WasmPageBuilder {
|
|
|
747
985
|
fillColorHex(hex) {
|
|
748
986
|
const ptr0 = passStringToWasm0(hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
749
987
|
const len0 = WASM_VECTOR_LEN;
|
|
750
|
-
|
|
988
|
+
let ret;
|
|
989
|
+
ret = wasm.wasmpagebuilder_fillColorHex(this.__wbg_ptr, ptr0, len0);
|
|
751
990
|
if (ret[1]) {
|
|
752
991
|
throw takeFromExternrefTable0(ret[0]);
|
|
753
992
|
}
|
|
@@ -762,7 +1001,8 @@ export class WasmPageBuilder {
|
|
|
762
1001
|
fillColor(components) {
|
|
763
1002
|
const ptr0 = passArrayF64ToWasm0(components, wasm.__wbindgen_malloc);
|
|
764
1003
|
const len0 = WASM_VECTOR_LEN;
|
|
765
|
-
|
|
1004
|
+
let ret;
|
|
1005
|
+
ret = wasm.wasmpagebuilder_fillColor(this.__wbg_ptr, ptr0, len0);
|
|
766
1006
|
if (ret[1]) {
|
|
767
1007
|
throw takeFromExternrefTable0(ret[0]);
|
|
768
1008
|
}
|
|
@@ -780,7 +1020,8 @@ export class WasmPageBuilder {
|
|
|
780
1020
|
const len0 = WASM_VECTOR_LEN;
|
|
781
1021
|
const ptr1 = passStringToWasm0(rule, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
782
1022
|
const len1 = WASM_VECTOR_LEN;
|
|
783
|
-
|
|
1023
|
+
let ret;
|
|
1024
|
+
ret = wasm.wasmpagebuilder_fillPath(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
784
1025
|
if (ret[1]) {
|
|
785
1026
|
throw takeFromExternrefTable0(ret[0]);
|
|
786
1027
|
}
|
|
@@ -798,7 +1039,8 @@ export class WasmPageBuilder {
|
|
|
798
1039
|
const len0 = WASM_VECTOR_LEN;
|
|
799
1040
|
const ptr1 = passStringToWasm0(rule, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
800
1041
|
const len1 = WASM_VECTOR_LEN;
|
|
801
|
-
|
|
1042
|
+
let ret;
|
|
1043
|
+
ret = wasm.wasmpagebuilder_fillStrokePath(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
802
1044
|
if (ret[1]) {
|
|
803
1045
|
throw takeFromExternrefTable0(ret[0]);
|
|
804
1046
|
}
|
|
@@ -817,7 +1059,8 @@ export class WasmPageBuilder {
|
|
|
817
1059
|
let deferred2_0;
|
|
818
1060
|
let deferred2_1;
|
|
819
1061
|
try {
|
|
820
|
-
|
|
1062
|
+
let ret;
|
|
1063
|
+
ret = wasm.wasmpagebuilder_finish(this.__wbg_ptr);
|
|
821
1064
|
var ptr1 = ret[0];
|
|
822
1065
|
var len1 = ret[1];
|
|
823
1066
|
if (ret[3]) {
|
|
@@ -844,7 +1087,8 @@ export class WasmPageBuilder {
|
|
|
844
1087
|
*/
|
|
845
1088
|
image(image, x, y, width, height) {
|
|
846
1089
|
_assertClass(image, WasmImage);
|
|
847
|
-
|
|
1090
|
+
let ret;
|
|
1091
|
+
ret = wasm.wasmpagebuilder_image(this.__wbg_ptr, image.__wbg_ptr, x, y, width, height);
|
|
848
1092
|
if (ret[1]) {
|
|
849
1093
|
throw takeFromExternrefTable0(ret[0]);
|
|
850
1094
|
}
|
|
@@ -864,7 +1108,8 @@ export class WasmPageBuilder {
|
|
|
864
1108
|
link(x, y, width, height, target, contents) {
|
|
865
1109
|
var ptr0 = isLikeNone(contents) ? 0 : passStringToWasm0(contents, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
866
1110
|
var len0 = WASM_VECTOR_LEN;
|
|
867
|
-
|
|
1111
|
+
let ret;
|
|
1112
|
+
ret = wasm.wasmpagebuilder_link(this.__wbg_ptr, x, y, width, height, target, ptr0, len0);
|
|
868
1113
|
if (ret[1]) {
|
|
869
1114
|
throw takeFromExternrefTable0(ret[0]);
|
|
870
1115
|
}
|
|
@@ -878,7 +1123,8 @@ export class WasmPageBuilder {
|
|
|
878
1123
|
* @param {number} stroke
|
|
879
1124
|
*/
|
|
880
1125
|
opacity(fill, stroke) {
|
|
881
|
-
|
|
1126
|
+
let ret;
|
|
1127
|
+
ret = wasm.wasmpagebuilder_opacity(this.__wbg_ptr, fill, stroke);
|
|
882
1128
|
if (ret[1]) {
|
|
883
1129
|
throw takeFromExternrefTable0(ret[0]);
|
|
884
1130
|
}
|
|
@@ -890,7 +1136,8 @@ export class WasmPageBuilder {
|
|
|
890
1136
|
* `builder-finished`.
|
|
891
1137
|
*/
|
|
892
1138
|
restore() {
|
|
893
|
-
|
|
1139
|
+
let ret;
|
|
1140
|
+
ret = wasm.wasmpagebuilder_restore(this.__wbg_ptr);
|
|
894
1141
|
if (ret[1]) {
|
|
895
1142
|
throw takeFromExternrefTable0(ret[0]);
|
|
896
1143
|
}
|
|
@@ -903,7 +1150,8 @@ export class WasmPageBuilder {
|
|
|
903
1150
|
* @param {number} degrees
|
|
904
1151
|
*/
|
|
905
1152
|
rotate(degrees) {
|
|
906
|
-
|
|
1153
|
+
let ret;
|
|
1154
|
+
ret = wasm.wasmpagebuilder_rotate(this.__wbg_ptr, degrees);
|
|
907
1155
|
if (ret[1]) {
|
|
908
1156
|
throw takeFromExternrefTable0(ret[0]);
|
|
909
1157
|
}
|
|
@@ -915,7 +1163,8 @@ export class WasmPageBuilder {
|
|
|
915
1163
|
* `builder-finished` after [`WasmPageBuilder::finish`] (so does every drawing method).
|
|
916
1164
|
*/
|
|
917
1165
|
save() {
|
|
918
|
-
|
|
1166
|
+
let ret;
|
|
1167
|
+
ret = wasm.wasmpagebuilder_save(this.__wbg_ptr);
|
|
919
1168
|
if (ret[1]) {
|
|
920
1169
|
throw takeFromExternrefTable0(ret[0]);
|
|
921
1170
|
}
|
|
@@ -935,7 +1184,8 @@ export class WasmPageBuilder {
|
|
|
935
1184
|
setBox(kind, x, y, width, height) {
|
|
936
1185
|
const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
937
1186
|
const len0 = WASM_VECTOR_LEN;
|
|
938
|
-
|
|
1187
|
+
let ret;
|
|
1188
|
+
ret = wasm.wasmpagebuilder_setBox(this.__wbg_ptr, ptr0, len0, x, y, width, height);
|
|
939
1189
|
if (ret[1]) {
|
|
940
1190
|
throw takeFromExternrefTable0(ret[0]);
|
|
941
1191
|
}
|
|
@@ -950,7 +1200,8 @@ export class WasmPageBuilder {
|
|
|
950
1200
|
strokeColorHex(hex) {
|
|
951
1201
|
const ptr0 = passStringToWasm0(hex, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
952
1202
|
const len0 = WASM_VECTOR_LEN;
|
|
953
|
-
|
|
1203
|
+
let ret;
|
|
1204
|
+
ret = wasm.wasmpagebuilder_strokeColorHex(this.__wbg_ptr, ptr0, len0);
|
|
954
1205
|
if (ret[1]) {
|
|
955
1206
|
throw takeFromExternrefTable0(ret[0]);
|
|
956
1207
|
}
|
|
@@ -965,7 +1216,8 @@ export class WasmPageBuilder {
|
|
|
965
1216
|
strokeColor(components) {
|
|
966
1217
|
const ptr0 = passArrayF64ToWasm0(components, wasm.__wbindgen_malloc);
|
|
967
1218
|
const len0 = WASM_VECTOR_LEN;
|
|
968
|
-
|
|
1219
|
+
let ret;
|
|
1220
|
+
ret = wasm.wasmpagebuilder_strokeColor(this.__wbg_ptr, ptr0, len0);
|
|
969
1221
|
if (ret[1]) {
|
|
970
1222
|
throw takeFromExternrefTable0(ret[0]);
|
|
971
1223
|
}
|
|
@@ -980,7 +1232,8 @@ export class WasmPageBuilder {
|
|
|
980
1232
|
strokePath(path) {
|
|
981
1233
|
const ptr0 = passArrayF64ToWasm0(path, wasm.__wbindgen_malloc);
|
|
982
1234
|
const len0 = WASM_VECTOR_LEN;
|
|
983
|
-
|
|
1235
|
+
let ret;
|
|
1236
|
+
ret = wasm.wasmpagebuilder_strokePath(this.__wbg_ptr, ptr0, len0);
|
|
984
1237
|
if (ret[1]) {
|
|
985
1238
|
throw takeFromExternrefTable0(ret[0]);
|
|
986
1239
|
}
|
|
@@ -1005,7 +1258,8 @@ export class WasmPageBuilder {
|
|
|
1005
1258
|
const len1 = WASM_VECTOR_LEN;
|
|
1006
1259
|
const ptr2 = passArrayF64ToWasm0(dash, wasm.__wbindgen_malloc);
|
|
1007
1260
|
const len2 = WASM_VECTOR_LEN;
|
|
1008
|
-
|
|
1261
|
+
let ret;
|
|
1262
|
+
ret = wasm.wasmpagebuilder_strokeStyle(this.__wbg_ptr, width, ptr0, len0, ptr1, len1, miterLimit, ptr2, len2, dashPhase);
|
|
1009
1263
|
if (ret[1]) {
|
|
1010
1264
|
throw takeFromExternrefTable0(ret[0]);
|
|
1011
1265
|
}
|
|
@@ -1020,7 +1274,8 @@ export class WasmPageBuilder {
|
|
|
1020
1274
|
transform(m) {
|
|
1021
1275
|
const ptr0 = passArrayF64ToWasm0(m, wasm.__wbindgen_malloc);
|
|
1022
1276
|
const len0 = WASM_VECTOR_LEN;
|
|
1023
|
-
|
|
1277
|
+
let ret;
|
|
1278
|
+
ret = wasm.wasmpagebuilder_transform(this.__wbg_ptr, ptr0, len0);
|
|
1024
1279
|
if (ret[1]) {
|
|
1025
1280
|
throw takeFromExternrefTable0(ret[0]);
|
|
1026
1281
|
}
|
|
@@ -1043,7 +1298,9 @@ export class WasmSaveJob {
|
|
|
1043
1298
|
static __wrap(ptr) {
|
|
1044
1299
|
const obj = Object.create(WasmSaveJob.prototype);
|
|
1045
1300
|
obj.__wbg_ptr = ptr;
|
|
1046
|
-
|
|
1301
|
+
Object.defineProperty(obj, '__wbg_inst', { value: __wbg_instance_id, writable: true });
|
|
1302
|
+
|
|
1303
|
+
WasmSaveJobFinalization.register(obj, { ptr, instance: __wbg_instance_id }, obj);
|
|
1047
1304
|
return obj;
|
|
1048
1305
|
}
|
|
1049
1306
|
__destroy_into_raw() {
|
|
@@ -1055,6 +1312,7 @@ export class WasmSaveJob {
|
|
|
1055
1312
|
free() {
|
|
1056
1313
|
const ptr = this.__destroy_into_raw();
|
|
1057
1314
|
wasm.__wbg_wasmsavejob_free(ptr, 0);
|
|
1315
|
+
|
|
1058
1316
|
}
|
|
1059
1317
|
/**
|
|
1060
1318
|
* Stops the job: its next step fails with `cancelled`.
|
|
@@ -1067,12 +1325,14 @@ export class WasmSaveJob {
|
|
|
1067
1325
|
* `{ state: "done", bytes, report }`.
|
|
1068
1326
|
*
|
|
1069
1327
|
* # Errors
|
|
1070
|
-
* `cancelled`, `document-changed`, `job-finished`,
|
|
1328
|
+
* `cancelled`, `document-changed`, `job-finished`, `disposed` when the document is freed,
|
|
1329
|
+
* or the save's own errors.
|
|
1071
1330
|
* @param {number} budget
|
|
1072
1331
|
* @returns {({ state: "progress" } & ProgressJs) | { state: "done"; bytes: Uint8Array<ArrayBuffer>; report: SaveReportJs }}
|
|
1073
1332
|
*/
|
|
1074
1333
|
step(budget) {
|
|
1075
|
-
|
|
1334
|
+
let ret;
|
|
1335
|
+
ret = wasm.wasmsavejob_step(this.__wbg_ptr, budget);
|
|
1076
1336
|
if (ret[2]) {
|
|
1077
1337
|
throw takeFromExternrefTable0(ret[1]);
|
|
1078
1338
|
}
|
|
@@ -1095,6 +1355,7 @@ export class WasmSparseSource {
|
|
|
1095
1355
|
free() {
|
|
1096
1356
|
const ptr = this.__destroy_into_raw();
|
|
1097
1357
|
wasm.__wbg_wasmsparsesource_free(ptr, 0);
|
|
1358
|
+
|
|
1098
1359
|
}
|
|
1099
1360
|
/**
|
|
1100
1361
|
* An empty source of `size` bytes holding at most `budget` bytes (no limit when omitted).
|
|
@@ -1105,12 +1366,14 @@ export class WasmSparseSource {
|
|
|
1105
1366
|
* @param {number | null} [budget]
|
|
1106
1367
|
*/
|
|
1107
1368
|
constructor(size, budget) {
|
|
1108
|
-
|
|
1369
|
+
let ret;
|
|
1370
|
+
ret = wasm.wasmsparsesource_new(size, !isLikeNone(budget), isLikeNone(budget) ? 0 : budget);
|
|
1109
1371
|
if (ret[2]) {
|
|
1110
1372
|
throw takeFromExternrefTable0(ret[1]);
|
|
1111
1373
|
}
|
|
1112
1374
|
this.__wbg_ptr = ret[0];
|
|
1113
|
-
|
|
1375
|
+
Object.defineProperty(this, '__wbg_inst', { value: __wbg_instance_id, writable: true });
|
|
1376
|
+
WasmSparseSourceFinalization.register(this, { ptr: ret[0], instance: __wbg_instance_id }, this);
|
|
1114
1377
|
return this;
|
|
1115
1378
|
}
|
|
1116
1379
|
/**
|
|
@@ -1118,7 +1381,8 @@ export class WasmSparseSource {
|
|
|
1118
1381
|
* @returns {number}
|
|
1119
1382
|
*/
|
|
1120
1383
|
get size() {
|
|
1121
|
-
|
|
1384
|
+
let ret;
|
|
1385
|
+
ret = wasm.wasmsparsesource_size(this.__wbg_ptr);
|
|
1122
1386
|
return ret;
|
|
1123
1387
|
}
|
|
1124
1388
|
/**
|
|
@@ -1132,7 +1396,8 @@ export class WasmSparseSource {
|
|
|
1132
1396
|
supply(offset, bytes) {
|
|
1133
1397
|
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1134
1398
|
const len0 = WASM_VECTOR_LEN;
|
|
1135
|
-
|
|
1399
|
+
let ret;
|
|
1400
|
+
ret = wasm.wasmsparsesource_supply(this.__wbg_ptr, offset, ptr0, len0);
|
|
1136
1401
|
if (ret[1]) {
|
|
1137
1402
|
throw takeFromExternrefTable0(ret[0]);
|
|
1138
1403
|
}
|
|
@@ -1153,7 +1418,8 @@ export class WasmSparseSource {
|
|
|
1153
1418
|
toFetch(asked, block, readahead) {
|
|
1154
1419
|
const ptr0 = passArrayF64ToWasm0(asked, wasm.__wbindgen_malloc);
|
|
1155
1420
|
const len0 = WASM_VECTOR_LEN;
|
|
1156
|
-
|
|
1421
|
+
let ret;
|
|
1422
|
+
ret = wasm.wasmsparsesource_toFetch(this.__wbg_ptr, ptr0, len0, block, readahead);
|
|
1157
1423
|
if (ret[2]) {
|
|
1158
1424
|
throw takeFromExternrefTable0(ret[1]);
|
|
1159
1425
|
}
|
|
@@ -1169,7 +1435,9 @@ export class WasmWarningCursor {
|
|
|
1169
1435
|
static __wrap(ptr) {
|
|
1170
1436
|
const obj = Object.create(WasmWarningCursor.prototype);
|
|
1171
1437
|
obj.__wbg_ptr = ptr;
|
|
1172
|
-
|
|
1438
|
+
Object.defineProperty(obj, '__wbg_inst', { value: __wbg_instance_id, writable: true });
|
|
1439
|
+
|
|
1440
|
+
WasmWarningCursorFinalization.register(obj, { ptr, instance: __wbg_instance_id }, obj);
|
|
1173
1441
|
return obj;
|
|
1174
1442
|
}
|
|
1175
1443
|
__destroy_into_raw() {
|
|
@@ -1181,6 +1449,7 @@ export class WasmWarningCursor {
|
|
|
1181
1449
|
free() {
|
|
1182
1450
|
const ptr = this.__destroy_into_raw();
|
|
1183
1451
|
wasm.__wbg_wasmwarningcursor_free(ptr, 0);
|
|
1452
|
+
|
|
1184
1453
|
}
|
|
1185
1454
|
/**
|
|
1186
1455
|
* Up to `max` more warnings, each as the ADR 0026 §1 object; empty at the end.
|
|
@@ -1188,7 +1457,8 @@ export class WasmWarningCursor {
|
|
|
1188
1457
|
* @returns {Diagnostic[]}
|
|
1189
1458
|
*/
|
|
1190
1459
|
nextBatch(max) {
|
|
1191
|
-
|
|
1460
|
+
let ret;
|
|
1461
|
+
ret = wasm.wasmwarningcursor_nextBatch(this.__wbg_ptr, max);
|
|
1192
1462
|
return ret;
|
|
1193
1463
|
}
|
|
1194
1464
|
/**
|
|
@@ -1196,18 +1466,46 @@ export class WasmWarningCursor {
|
|
|
1196
1466
|
* @returns {number}
|
|
1197
1467
|
*/
|
|
1198
1468
|
remaining() {
|
|
1199
|
-
|
|
1469
|
+
let ret;
|
|
1470
|
+
ret = wasm.wasmwarningcursor_remaining(this.__wbg_ptr);
|
|
1200
1471
|
return ret >>> 0;
|
|
1201
1472
|
}
|
|
1202
1473
|
}
|
|
1203
1474
|
if (Symbol.dispose) WasmWarningCursor.prototype[Symbol.dispose] = WasmWarningCursor.prototype.free;
|
|
1204
1475
|
|
|
1476
|
+
export function __wbg_reset_state () {
|
|
1477
|
+
__wbg_instance_id++;
|
|
1478
|
+
cachedDataViewMemory0 = null;
|
|
1479
|
+
cachedFloat32ArrayMemory0 = null;
|
|
1480
|
+
cachedFloat64ArrayMemory0 = null;
|
|
1481
|
+
cachedUint32ArrayMemory0 = null;
|
|
1482
|
+
cachedUint8ArrayMemory0 = null;
|
|
1483
|
+
if (typeof numBytesDecoded !== 'undefined') numBytesDecoded = 0;
|
|
1484
|
+
if (typeof WASM_VECTOR_LEN !== 'undefined') WASM_VECTOR_LEN = 0;
|
|
1485
|
+
__wbg_reinit_scheduled = false;
|
|
1486
|
+
wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
1487
|
+
wasm = wasmInstance.exports;
|
|
1488
|
+
wasm.__wbindgen_start();
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
/**
|
|
1492
|
+
* Whether the most recent allocation failed: after a trap, `true` means the module ran out of
|
|
1493
|
+
* memory.
|
|
1494
|
+
* @returns {boolean}
|
|
1495
|
+
*/
|
|
1496
|
+
export function allocationFailed() {
|
|
1497
|
+
let ret;
|
|
1498
|
+
ret = wasm.allocationFailed();
|
|
1499
|
+
return ret !== 0;
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1205
1502
|
/**
|
|
1206
1503
|
* Whether this module is the text module (fonts, `text`, `textBox`).
|
|
1207
1504
|
* @returns {boolean}
|
|
1208
1505
|
*/
|
|
1209
1506
|
export function hasText() {
|
|
1210
|
-
|
|
1507
|
+
let ret;
|
|
1508
|
+
ret = wasm.hasText();
|
|
1211
1509
|
return ret !== 0;
|
|
1212
1510
|
}
|
|
1213
1511
|
|
|
@@ -1219,7 +1517,8 @@ export function version() {
|
|
|
1219
1517
|
let deferred1_0;
|
|
1220
1518
|
let deferred1_1;
|
|
1221
1519
|
try {
|
|
1222
|
-
|
|
1520
|
+
let ret;
|
|
1521
|
+
ret = wasm.version();
|
|
1223
1522
|
deferred1_0 = ret[0];
|
|
1224
1523
|
deferred1_1 = ret[1];
|
|
1225
1524
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -1323,30 +1622,60 @@ function __wbg_get_imports() {
|
|
|
1323
1622
|
};
|
|
1324
1623
|
}
|
|
1325
1624
|
|
|
1625
|
+
function __wbg_call_guard() {
|
|
1626
|
+
if (__wbg_reinit_scheduled) {
|
|
1627
|
+
__wbg_reset_state();
|
|
1628
|
+
return;
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
|
|
1633
|
+
let __wbg_instance_id = 0;
|
|
1326
1634
|
const WasmBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1327
1635
|
? { register: () => {}, unregister: () => {} }
|
|
1328
|
-
: new FinalizationRegistry(
|
|
1636
|
+
: new FinalizationRegistry(({ ptr, instance }) => {
|
|
1637
|
+
if (instance === __wbg_instance_id) wasm.__wbg_wasmbuilder_free(ptr, 1);
|
|
1638
|
+
});
|
|
1329
1639
|
const WasmDocumentFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1330
1640
|
? { register: () => {}, unregister: () => {} }
|
|
1331
|
-
: new FinalizationRegistry(
|
|
1641
|
+
: new FinalizationRegistry(({ ptr, instance }) => {
|
|
1642
|
+
if (instance === __wbg_instance_id) wasm.__wbg_wasmdocument_free(ptr, 1);
|
|
1643
|
+
});
|
|
1644
|
+
const WasmExtractJobFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1645
|
+
? { register: () => {}, unregister: () => {} }
|
|
1646
|
+
: new FinalizationRegistry(({ ptr, instance }) => {
|
|
1647
|
+
if (instance === __wbg_instance_id) wasm.__wbg_wasmextractjob_free(ptr, 1);
|
|
1648
|
+
});
|
|
1332
1649
|
const WasmImageFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1333
1650
|
? { register: () => {}, unregister: () => {} }
|
|
1334
|
-
: new FinalizationRegistry(
|
|
1651
|
+
: new FinalizationRegistry(({ ptr, instance }) => {
|
|
1652
|
+
if (instance === __wbg_instance_id) wasm.__wbg_wasmimage_free(ptr, 1);
|
|
1653
|
+
});
|
|
1335
1654
|
const WasmPageFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1336
1655
|
? { register: () => {}, unregister: () => {} }
|
|
1337
|
-
: new FinalizationRegistry(
|
|
1656
|
+
: new FinalizationRegistry(({ ptr, instance }) => {
|
|
1657
|
+
if (instance === __wbg_instance_id) wasm.__wbg_wasmpage_free(ptr, 1);
|
|
1658
|
+
});
|
|
1338
1659
|
const WasmPageBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1339
1660
|
? { register: () => {}, unregister: () => {} }
|
|
1340
|
-
: new FinalizationRegistry(
|
|
1661
|
+
: new FinalizationRegistry(({ ptr, instance }) => {
|
|
1662
|
+
if (instance === __wbg_instance_id) wasm.__wbg_wasmpagebuilder_free(ptr, 1);
|
|
1663
|
+
});
|
|
1341
1664
|
const WasmSaveJobFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1342
1665
|
? { register: () => {}, unregister: () => {} }
|
|
1343
|
-
: new FinalizationRegistry(
|
|
1666
|
+
: new FinalizationRegistry(({ ptr, instance }) => {
|
|
1667
|
+
if (instance === __wbg_instance_id) wasm.__wbg_wasmsavejob_free(ptr, 1);
|
|
1668
|
+
});
|
|
1344
1669
|
const WasmSparseSourceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1345
1670
|
? { register: () => {}, unregister: () => {} }
|
|
1346
|
-
: new FinalizationRegistry(
|
|
1671
|
+
: new FinalizationRegistry(({ ptr, instance }) => {
|
|
1672
|
+
if (instance === __wbg_instance_id) wasm.__wbg_wasmsparsesource_free(ptr, 1);
|
|
1673
|
+
});
|
|
1347
1674
|
const WasmWarningCursorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1348
1675
|
? { register: () => {}, unregister: () => {} }
|
|
1349
|
-
: new FinalizationRegistry(
|
|
1676
|
+
: new FinalizationRegistry(({ ptr, instance }) => {
|
|
1677
|
+
if (instance === __wbg_instance_id) wasm.__wbg_wasmwarningcursor_free(ptr, 1);
|
|
1678
|
+
});
|
|
1350
1679
|
|
|
1351
1680
|
function addToExternrefTable0(obj) {
|
|
1352
1681
|
const idx = wasm.__externref_table_alloc();
|
|
@@ -1498,6 +1827,8 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
1498
1827
|
return ptr;
|
|
1499
1828
|
}
|
|
1500
1829
|
|
|
1830
|
+
let __wbg_reinit_scheduled = false;
|
|
1831
|
+
|
|
1501
1832
|
function takeFromExternrefTable0(idx) {
|
|
1502
1833
|
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
1503
1834
|
wasm.__externref_table_dealloc(idx);
|