@kakemono/wasm 0.0.0-stage → 0.22.3
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/README.md +34 -2
- package/package.json +47 -4
- package/pkg/node/index.d.mts +171 -0
- package/pkg/node/index.mjs +4 -0
- package/pkg/node/kakemono_wasm.d.ts +169 -0
- package/pkg/node/kakemono_wasm.js +509 -0
- package/pkg/node/kakemono_wasm_bg.wasm +0 -0
- package/pkg/node/kakemono_wasm_bg.wasm.d.ts +31 -0
- package/pkg/node/package.json +1 -0
- package/pkg/web/kakemono_wasm.d.ts +225 -0
- package/pkg/web/kakemono_wasm.js +612 -0
- package/pkg/web/kakemono_wasm_bg.wasm +0 -0
- package/pkg/web/kakemono_wasm_bg.wasm.d.ts +31 -0
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
/* @ts-self-types="./kakemono_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A PDF, Word document, Excel workbook, EPUB book or web page, read and
|
|
5
|
+
* analysed once: every output written from it shares that analysis.
|
|
6
|
+
*/
|
|
7
|
+
export class Document {
|
|
8
|
+
static __wrap(ptr) {
|
|
9
|
+
const obj = Object.create(Document.prototype);
|
|
10
|
+
obj.__wbg_ptr = ptr;
|
|
11
|
+
DocumentFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
__destroy_into_raw() {
|
|
15
|
+
const ptr = this.__wbg_ptr;
|
|
16
|
+
this.__wbg_ptr = 0;
|
|
17
|
+
DocumentFinalization.unregister(this);
|
|
18
|
+
return ptr;
|
|
19
|
+
}
|
|
20
|
+
free() {
|
|
21
|
+
const ptr = this.__destroy_into_raw();
|
|
22
|
+
wasm.__wbg_document_free(ptr, 0);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The structure of the document (its blocks in reading order), as the
|
|
26
|
+
* command line's `--json` writes it.
|
|
27
|
+
* @returns {any}
|
|
28
|
+
*/
|
|
29
|
+
analyze() {
|
|
30
|
+
const ret = wasm.document_analyze(this.__wbg_ptr);
|
|
31
|
+
if (ret[2]) {
|
|
32
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
33
|
+
}
|
|
34
|
+
return takeFromExternrefTable0(ret[0]);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The input format: `'pdf'`, `'docx'`, `'doc'`, `'xlsx'`, `'epub'` or
|
|
38
|
+
* `'html'`.
|
|
39
|
+
* @returns {string}
|
|
40
|
+
*/
|
|
41
|
+
get format() {
|
|
42
|
+
let deferred1_0;
|
|
43
|
+
let deferred1_1;
|
|
44
|
+
try {
|
|
45
|
+
const ret = wasm.document_format(this.__wbg_ptr);
|
|
46
|
+
deferred1_0 = ret[0];
|
|
47
|
+
deferred1_1 = ret[1];
|
|
48
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
49
|
+
} finally {
|
|
50
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Reads and analyses the bytes of a document (a PDF, a Word document,
|
|
55
|
+
* an Excel workbook, an EPUB book or a web page).
|
|
56
|
+
* @param {Uint8Array | number[]} data
|
|
57
|
+
* @param {OpenOptions} opts
|
|
58
|
+
* @returns {Document}
|
|
59
|
+
*/
|
|
60
|
+
static fromBytes(data, opts) {
|
|
61
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
62
|
+
const len0 = WASM_VECTOR_LEN;
|
|
63
|
+
const ret = wasm.document_fromBytes(ptr0, len0, opts);
|
|
64
|
+
if (ret[2]) {
|
|
65
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
66
|
+
}
|
|
67
|
+
return Document.__wrap(ret[0]);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The number of pages of a PDF (0 for the formats that have none).
|
|
71
|
+
* @returns {number}
|
|
72
|
+
*/
|
|
73
|
+
get pageCount() {
|
|
74
|
+
const ret = wasm.document_pageCount(this.__wbg_ptr);
|
|
75
|
+
return ret >>> 0;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The title of the document, when it has one.
|
|
79
|
+
* @returns {string | undefined}
|
|
80
|
+
*/
|
|
81
|
+
get title() {
|
|
82
|
+
const ret = wasm.document_title(this.__wbg_ptr);
|
|
83
|
+
let v1;
|
|
84
|
+
if (ret[0] !== 0) {
|
|
85
|
+
v1 = getStringFromWasm0(ret[0], ret[1]);
|
|
86
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
87
|
+
}
|
|
88
|
+
return v1;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Chunks for retrieval (RAG), cut at sentence ends and headed by their
|
|
92
|
+
* section.
|
|
93
|
+
* @param {ChunkOptions} opts
|
|
94
|
+
* @returns {Chunk[]}
|
|
95
|
+
*/
|
|
96
|
+
toChunks(opts) {
|
|
97
|
+
const ret = wasm.document_toChunks(this.__wbg_ptr, opts);
|
|
98
|
+
if (ret[2]) {
|
|
99
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
100
|
+
}
|
|
101
|
+
return takeFromExternrefTable0(ret[0]);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A Word document (`.docx`).
|
|
105
|
+
* @param {DocxOptions} opts
|
|
106
|
+
* @returns {BinaryOutput}
|
|
107
|
+
*/
|
|
108
|
+
toDocx(opts) {
|
|
109
|
+
const ret = wasm.document_toDocx(this.__wbg_ptr, opts);
|
|
110
|
+
if (ret[2]) {
|
|
111
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
112
|
+
}
|
|
113
|
+
return takeFromExternrefTable0(ret[0]);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* An EPUB 3 book.
|
|
117
|
+
* @param {EpubOptions} opts
|
|
118
|
+
* @returns {BinaryOutput}
|
|
119
|
+
*/
|
|
120
|
+
toEpub(opts) {
|
|
121
|
+
const ret = wasm.document_toEpub(this.__wbg_ptr, opts);
|
|
122
|
+
if (ret[2]) {
|
|
123
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
124
|
+
}
|
|
125
|
+
return takeFromExternrefTable0(ret[0]);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* An HTML page; its pictures are inline unless `inlineImages` is false.
|
|
129
|
+
* @param {HtmlOptions} opts
|
|
130
|
+
* @returns {TextOutput}
|
|
131
|
+
*/
|
|
132
|
+
toHtml(opts) {
|
|
133
|
+
const ret = wasm.document_toHtml(this.__wbg_ptr, opts);
|
|
134
|
+
if (ret[2]) {
|
|
135
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
136
|
+
}
|
|
137
|
+
return takeFromExternrefTable0(ret[0]);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The editable JSON and its picture files.
|
|
141
|
+
* @param {JsonOptions} opts
|
|
142
|
+
* @returns {TextOutput}
|
|
143
|
+
*/
|
|
144
|
+
toJson(opts) {
|
|
145
|
+
const ret = wasm.document_toJson(this.__wbg_ptr, opts);
|
|
146
|
+
if (ret[2]) {
|
|
147
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
148
|
+
}
|
|
149
|
+
return takeFromExternrefTable0(ret[0]);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* LaTeX source and its picture files.
|
|
153
|
+
* @param {LatexOptions} opts
|
|
154
|
+
* @returns {TextOutput}
|
|
155
|
+
*/
|
|
156
|
+
toLatex(opts) {
|
|
157
|
+
const ret = wasm.document_toLatex(this.__wbg_ptr, opts);
|
|
158
|
+
if (ret[2]) {
|
|
159
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
160
|
+
}
|
|
161
|
+
return takeFromExternrefTable0(ret[0]);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Markdown and its picture files.
|
|
165
|
+
* @param {MarkdownOptions} opts
|
|
166
|
+
* @returns {TextOutput}
|
|
167
|
+
*/
|
|
168
|
+
toMarkdown(opts) {
|
|
169
|
+
const ret = wasm.document_toMarkdown(this.__wbg_ptr, opts);
|
|
170
|
+
if (ret[2]) {
|
|
171
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
172
|
+
}
|
|
173
|
+
return takeFromExternrefTable0(ret[0]);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* A Word document, workbook or EPUB book laid out in pages, as a PDF.
|
|
177
|
+
* @returns {BinaryOutput}
|
|
178
|
+
*/
|
|
179
|
+
toPdf() {
|
|
180
|
+
const ret = wasm.document_toPdf(this.__wbg_ptr);
|
|
181
|
+
if (ret[2]) {
|
|
182
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
183
|
+
}
|
|
184
|
+
return takeFromExternrefTable0(ret[0]);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Typst source and its picture files.
|
|
188
|
+
* @param {TypstOptions} opts
|
|
189
|
+
* @returns {TextOutput}
|
|
190
|
+
*/
|
|
191
|
+
toTypst(opts) {
|
|
192
|
+
const ret = wasm.document_toTypst(this.__wbg_ptr, opts);
|
|
193
|
+
if (ret[2]) {
|
|
194
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
195
|
+
}
|
|
196
|
+
return takeFromExternrefTable0(ret[0]);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* The warnings of applying `content`: blocks that kept their own text.
|
|
200
|
+
* @returns {string[]}
|
|
201
|
+
*/
|
|
202
|
+
get warnings() {
|
|
203
|
+
const ret = wasm.document_warnings(this.__wbg_ptr);
|
|
204
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
|
|
205
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
206
|
+
return v1;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (Symbol.dispose) Document.prototype[Symbol.dispose] = Document.prototype.free;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Adds a TrueType or OpenType font (or a collection) to those documents
|
|
213
|
+
* are laid out and SVG text drawn with: WebAssembly has no installed
|
|
214
|
+
* fonts, and laying out a Word document or a workbook as a PDF needs one.
|
|
215
|
+
* Returns its number of faces.
|
|
216
|
+
* @param {Uint8Array | number[]} data
|
|
217
|
+
* @returns {number}
|
|
218
|
+
*/
|
|
219
|
+
export function addFont(data) {
|
|
220
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
221
|
+
const len0 = WASM_VECTOR_LEN;
|
|
222
|
+
const ret = wasm.addFont(ptr0, len0);
|
|
223
|
+
if (ret[2]) {
|
|
224
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
225
|
+
}
|
|
226
|
+
return ret[0] >>> 0;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Logs a panic's message to `console.error` before the module aborts.
|
|
231
|
+
*/
|
|
232
|
+
export function start() {
|
|
233
|
+
wasm.start();
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* The version of kakemono.
|
|
238
|
+
* @returns {string}
|
|
239
|
+
*/
|
|
240
|
+
export function version() {
|
|
241
|
+
let deferred1_0;
|
|
242
|
+
let deferred1_1;
|
|
243
|
+
try {
|
|
244
|
+
const ret = wasm.version();
|
|
245
|
+
deferred1_0 = ret[0];
|
|
246
|
+
deferred1_1 = ret[1];
|
|
247
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
248
|
+
} finally {
|
|
249
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function __wbg_get_imports() {
|
|
253
|
+
const import0 = {
|
|
254
|
+
__proto__: null,
|
|
255
|
+
__wbg___wbindgen_is_null_c22311b1cc228e3a: function(arg0) {
|
|
256
|
+
const ret = arg0 === null;
|
|
257
|
+
return ret;
|
|
258
|
+
},
|
|
259
|
+
__wbg___wbindgen_is_object_8b968c3ab8e96595: function(arg0) {
|
|
260
|
+
const val = arg0;
|
|
261
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
262
|
+
return ret;
|
|
263
|
+
},
|
|
264
|
+
__wbg___wbindgen_is_undefined_be5b34249ff1fc15: function(arg0) {
|
|
265
|
+
const ret = arg0 === undefined;
|
|
266
|
+
return ret;
|
|
267
|
+
},
|
|
268
|
+
__wbg___wbindgen_string_get_7ce8eee7fd327545: function(arg0, arg1) {
|
|
269
|
+
const obj = arg1;
|
|
270
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
271
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
272
|
+
var len1 = WASM_VECTOR_LEN;
|
|
273
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
274
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
275
|
+
},
|
|
276
|
+
__wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
|
|
277
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
278
|
+
},
|
|
279
|
+
__wbg_assign_6b6bb30388088072: function(arg0, arg1) {
|
|
280
|
+
const ret = Object.assign(arg0, arg1);
|
|
281
|
+
return ret;
|
|
282
|
+
},
|
|
283
|
+
__wbg_error_757e9472f8410341: function(arg0, arg1) {
|
|
284
|
+
let deferred0_0;
|
|
285
|
+
let deferred0_1;
|
|
286
|
+
try {
|
|
287
|
+
deferred0_0 = arg0;
|
|
288
|
+
deferred0_1 = arg1;
|
|
289
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
290
|
+
} finally {
|
|
291
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
__wbg_get_2080c49015e35254: function() { return handleError(function (arg0, arg1) {
|
|
295
|
+
const ret = Reflect.get(arg0, arg1);
|
|
296
|
+
return ret;
|
|
297
|
+
}, arguments); },
|
|
298
|
+
__wbg_new_37eb45aaf5eeb820: function() {
|
|
299
|
+
const ret = new Array();
|
|
300
|
+
return ret;
|
|
301
|
+
},
|
|
302
|
+
__wbg_new_787b9fb330d55d78: function(arg0, arg1) {
|
|
303
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
304
|
+
return ret;
|
|
305
|
+
},
|
|
306
|
+
__wbg_new_bb74001155cb8ca8: function() {
|
|
307
|
+
const ret = new Error();
|
|
308
|
+
return ret;
|
|
309
|
+
},
|
|
310
|
+
__wbg_new_cd4348290afae586: function() {
|
|
311
|
+
const ret = new Object();
|
|
312
|
+
return ret;
|
|
313
|
+
},
|
|
314
|
+
__wbg_new_from_slice_b8daf545a41c6aa0: function(arg0, arg1) {
|
|
315
|
+
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
316
|
+
return ret;
|
|
317
|
+
},
|
|
318
|
+
__wbg_parse_c3f72b5a24f83c01: function() { return handleError(function (arg0, arg1) {
|
|
319
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
320
|
+
return ret;
|
|
321
|
+
}, arguments); },
|
|
322
|
+
__wbg_push_c9f4893fc209f768: function(arg0, arg1) {
|
|
323
|
+
const ret = arg0.push(arg1);
|
|
324
|
+
return ret;
|
|
325
|
+
},
|
|
326
|
+
__wbg_set_2793479888329cb6: function() { return handleError(function (arg0, arg1, arg2) {
|
|
327
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
328
|
+
return ret;
|
|
329
|
+
}, arguments); },
|
|
330
|
+
__wbg_set_name_822e3903f3184979: function(arg0, arg1, arg2) {
|
|
331
|
+
arg0.name = getStringFromWasm0(arg1, arg2);
|
|
332
|
+
},
|
|
333
|
+
__wbg_stack_575c4e0918581b9c: function(arg0, arg1) {
|
|
334
|
+
const ret = arg1.stack;
|
|
335
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
336
|
+
const len1 = WASM_VECTOR_LEN;
|
|
337
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
338
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
339
|
+
},
|
|
340
|
+
__wbg_stringify_0a0fbf2ef722380a: function() { return handleError(function (arg0) {
|
|
341
|
+
const ret = JSON.stringify(arg0);
|
|
342
|
+
return ret;
|
|
343
|
+
}, arguments); },
|
|
344
|
+
__wbindgen_generic_0000000000000001: function(arg0) {
|
|
345
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
346
|
+
const ret = arg0;
|
|
347
|
+
return ret;
|
|
348
|
+
},
|
|
349
|
+
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
350
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
351
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
352
|
+
return ret;
|
|
353
|
+
},
|
|
354
|
+
__wbindgen_init_externref_table: function() {
|
|
355
|
+
const table = wasm.__wbindgen_externrefs;
|
|
356
|
+
table.set(0, undefined);
|
|
357
|
+
table.set(1024, undefined);
|
|
358
|
+
table.set(1025, null);
|
|
359
|
+
table.set(1026, true);
|
|
360
|
+
table.set(1027, false);
|
|
361
|
+
},
|
|
362
|
+
};
|
|
363
|
+
return {
|
|
364
|
+
__proto__: null,
|
|
365
|
+
"./kakemono_wasm_bg.js": import0,
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
const DocumentFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
370
|
+
? { register: () => {}, unregister: () => {} }
|
|
371
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_document_free(ptr, 1));
|
|
372
|
+
|
|
373
|
+
function addToExternrefTable0(obj) {
|
|
374
|
+
const idx = wasm.__externref_table_alloc();
|
|
375
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
376
|
+
return idx;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
380
|
+
ptr = ptr >>> 0;
|
|
381
|
+
const mem = getDataViewMemory0();
|
|
382
|
+
const result = [];
|
|
383
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
384
|
+
result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
|
|
385
|
+
}
|
|
386
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
387
|
+
return result;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
391
|
+
ptr = ptr >>> 0;
|
|
392
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
let cachedDataViewMemory0 = null;
|
|
396
|
+
function getDataViewMemory0() {
|
|
397
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
398
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
399
|
+
}
|
|
400
|
+
return cachedDataViewMemory0;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
function getStringFromWasm0(ptr, len) {
|
|
404
|
+
ptr = ptr >>> 0;
|
|
405
|
+
return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
let cachedUint8ArrayMemory0 = null;
|
|
409
|
+
function getUint8ArrayMemory0() {
|
|
410
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
411
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
412
|
+
}
|
|
413
|
+
return cachedUint8ArrayMemory0;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function handleError(f, args) {
|
|
417
|
+
try {
|
|
418
|
+
return f.apply(this, args);
|
|
419
|
+
} catch (e) {
|
|
420
|
+
const idx = addToExternrefTable0(e);
|
|
421
|
+
wasm.__wbindgen_exn_store(idx);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function isLikeNone(x) {
|
|
426
|
+
return x === undefined || x === null;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
430
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
431
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
432
|
+
WASM_VECTOR_LEN = arg.length;
|
|
433
|
+
return ptr;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
437
|
+
if (realloc === undefined) {
|
|
438
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
439
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
440
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
441
|
+
WASM_VECTOR_LEN = buf.length;
|
|
442
|
+
return ptr;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
let len = arg.length;
|
|
446
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
447
|
+
|
|
448
|
+
const mem = getUint8ArrayMemory0();
|
|
449
|
+
|
|
450
|
+
let offset = 0;
|
|
451
|
+
|
|
452
|
+
for (; offset < len; offset++) {
|
|
453
|
+
const code = arg.charCodeAt(offset);
|
|
454
|
+
if (code > 0x7F) break;
|
|
455
|
+
mem[ptr + offset] = code;
|
|
456
|
+
}
|
|
457
|
+
if (offset !== len) {
|
|
458
|
+
if (offset !== 0) {
|
|
459
|
+
arg = arg.slice(offset);
|
|
460
|
+
}
|
|
461
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
462
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
463
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
464
|
+
|
|
465
|
+
offset += ret.written;
|
|
466
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
WASM_VECTOR_LEN = offset;
|
|
470
|
+
return ptr;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
function takeFromExternrefTable0(idx) {
|
|
474
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
475
|
+
wasm.__externref_table_dealloc(idx);
|
|
476
|
+
return value;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
480
|
+
cachedTextDecoder.decode();
|
|
481
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
482
|
+
let numBytesDecoded = 0;
|
|
483
|
+
function decodeText(bytes) {
|
|
484
|
+
numBytesDecoded += bytes.length;
|
|
485
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
486
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
487
|
+
cachedTextDecoder.decode();
|
|
488
|
+
numBytesDecoded = bytes.length;
|
|
489
|
+
}
|
|
490
|
+
return cachedTextDecoder.decode(bytes);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
const cachedTextEncoder = new TextEncoder();
|
|
494
|
+
|
|
495
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
496
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
497
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
498
|
+
view.set(buf);
|
|
499
|
+
return {
|
|
500
|
+
read: arg.length,
|
|
501
|
+
written: buf.length
|
|
502
|
+
};
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
let WASM_VECTOR_LEN = 0;
|
|
507
|
+
|
|
508
|
+
let wasmModule, wasmInstance, wasm;
|
|
509
|
+
function __wbg_finalize_init(instance, module) {
|
|
510
|
+
wasmInstance = instance;
|
|
511
|
+
wasm = instance.exports;
|
|
512
|
+
wasmModule = module;
|
|
513
|
+
cachedDataViewMemory0 = null;
|
|
514
|
+
cachedUint8ArrayMemory0 = null;
|
|
515
|
+
wasm.__wbindgen_start();
|
|
516
|
+
return wasm;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
async function __wbg_load(module, imports) {
|
|
520
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
521
|
+
if (!module.ok) {
|
|
522
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
526
|
+
try {
|
|
527
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
528
|
+
} catch (e) {
|
|
529
|
+
const validResponse = expectedResponseType(module.type);
|
|
530
|
+
|
|
531
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
532
|
+
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);
|
|
533
|
+
|
|
534
|
+
} else { throw e; }
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
const bytes = await module.arrayBuffer();
|
|
539
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
540
|
+
} else {
|
|
541
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
542
|
+
|
|
543
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
544
|
+
return { instance, module };
|
|
545
|
+
} else {
|
|
546
|
+
return instance;
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function expectedResponseType(type) {
|
|
551
|
+
switch (type) {
|
|
552
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
553
|
+
}
|
|
554
|
+
return false;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function initSync(module) {
|
|
559
|
+
if (wasm !== undefined) return wasm;
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
if (module !== undefined) {
|
|
563
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
564
|
+
({module} = module)
|
|
565
|
+
} else {
|
|
566
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
const imports = __wbg_get_imports();
|
|
571
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
572
|
+
module = new WebAssembly.Module(module);
|
|
573
|
+
}
|
|
574
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
575
|
+
return __wbg_finalize_init(instance, module);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
let __wbg_init_promise;
|
|
579
|
+
async function __wbg_init(module_or_path) {
|
|
580
|
+
if (wasm !== undefined) return wasm;
|
|
581
|
+
if (__wbg_init_promise === undefined) {
|
|
582
|
+
__wbg_init_promise = __wbg_init_once(module_or_path);
|
|
583
|
+
__wbg_init_promise.catch(() => { __wbg_init_promise = undefined; });
|
|
584
|
+
}
|
|
585
|
+
return __wbg_init_promise;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
async function __wbg_init_once(module_or_path) {
|
|
589
|
+
|
|
590
|
+
if (module_or_path !== undefined) {
|
|
591
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
592
|
+
({module_or_path} = module_or_path)
|
|
593
|
+
} else {
|
|
594
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
if (module_or_path === undefined) {
|
|
599
|
+
module_or_path = new URL('kakemono_wasm_bg.wasm', import.meta.url);
|
|
600
|
+
}
|
|
601
|
+
const imports = __wbg_get_imports();
|
|
602
|
+
|
|
603
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
604
|
+
module_or_path = fetch(module_or_path);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
608
|
+
|
|
609
|
+
return __wbg_finalize_init(instance, module);
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_document_free: (a: number, b: number) => void;
|
|
5
|
+
export const addFont: (a: number, b: number) => [number, number, number];
|
|
6
|
+
export const document_analyze: (a: number) => [number, number, number];
|
|
7
|
+
export const document_format: (a: number) => [number, number];
|
|
8
|
+
export const document_fromBytes: (a: number, b: number, c: any) => [number, number, number];
|
|
9
|
+
export const document_pageCount: (a: number) => number;
|
|
10
|
+
export const document_title: (a: number) => [number, number];
|
|
11
|
+
export const document_toChunks: (a: number, b: any) => [number, number, number];
|
|
12
|
+
export const document_toDocx: (a: number, b: any) => [number, number, number];
|
|
13
|
+
export const document_toEpub: (a: number, b: any) => [number, number, number];
|
|
14
|
+
export const document_toHtml: (a: number, b: any) => [number, number, number];
|
|
15
|
+
export const document_toJson: (a: number, b: any) => [number, number, number];
|
|
16
|
+
export const document_toLatex: (a: number, b: any) => [number, number, number];
|
|
17
|
+
export const document_toMarkdown: (a: number, b: any) => [number, number, number];
|
|
18
|
+
export const document_toPdf: (a: number) => [number, number, number];
|
|
19
|
+
export const document_toTypst: (a: number, b: any) => [number, number, number];
|
|
20
|
+
export const document_warnings: (a: number) => [number, number];
|
|
21
|
+
export const start: () => void;
|
|
22
|
+
export const version: () => [number, number];
|
|
23
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
24
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
25
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
26
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
27
|
+
export const __externref_table_alloc: () => number;
|
|
28
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
29
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
30
|
+
export const __externref_drop_slice: (a: number, b: number) => void;
|
|
31
|
+
export const __wbindgen_start: () => void;
|