@kreuzberg/wasm 4.0.0-rc.25 → 4.0.0-rc.27
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/index.js +1 -1
- package/dist/pkg/LICENSE +7 -0
- package/dist/pkg/README.md +742 -0
- package/dist/pkg/kreuzberg_wasm.d.ts +770 -0
- package/dist/pkg/kreuzberg_wasm.js +1904 -0
- package/dist/pkg/kreuzberg_wasm_bg.js +1871 -0
- package/dist/pkg/kreuzberg_wasm_bg.wasm +0 -0
- package/dist/pkg/kreuzberg_wasm_bg.wasm.d.ts +51 -0
- package/dist/pkg/package.json +27 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1871 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
export function __wbg_set_wasm(val) {
|
|
3
|
+
wasm = val;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
function addToExternrefTable0(obj) {
|
|
7
|
+
const idx = wasm.__externref_table_alloc();
|
|
8
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
9
|
+
return idx;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
13
|
+
? { register: () => {}, unregister: () => {} }
|
|
14
|
+
: new FinalizationRegistry(state => state.dtor(state.a, state.b));
|
|
15
|
+
|
|
16
|
+
function debugString(val) {
|
|
17
|
+
// primitive types
|
|
18
|
+
const type = typeof val;
|
|
19
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
20
|
+
return `${val}`;
|
|
21
|
+
}
|
|
22
|
+
if (type == 'string') {
|
|
23
|
+
return `"${val}"`;
|
|
24
|
+
}
|
|
25
|
+
if (type == 'symbol') {
|
|
26
|
+
const description = val.description;
|
|
27
|
+
if (description == null) {
|
|
28
|
+
return 'Symbol';
|
|
29
|
+
} else {
|
|
30
|
+
return `Symbol(${description})`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (type == 'function') {
|
|
34
|
+
const name = val.name;
|
|
35
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
36
|
+
return `Function(${name})`;
|
|
37
|
+
} else {
|
|
38
|
+
return 'Function';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// objects
|
|
42
|
+
if (Array.isArray(val)) {
|
|
43
|
+
const length = val.length;
|
|
44
|
+
let debug = '[';
|
|
45
|
+
if (length > 0) {
|
|
46
|
+
debug += debugString(val[0]);
|
|
47
|
+
}
|
|
48
|
+
for(let i = 1; i < length; i++) {
|
|
49
|
+
debug += ', ' + debugString(val[i]);
|
|
50
|
+
}
|
|
51
|
+
debug += ']';
|
|
52
|
+
return debug;
|
|
53
|
+
}
|
|
54
|
+
// Test for built-in
|
|
55
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
56
|
+
let className;
|
|
57
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
58
|
+
className = builtInMatches[1];
|
|
59
|
+
} else {
|
|
60
|
+
// Failed to match the standard '[object ClassName]'
|
|
61
|
+
return toString.call(val);
|
|
62
|
+
}
|
|
63
|
+
if (className == 'Object') {
|
|
64
|
+
// we're a user defined class or Object
|
|
65
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
66
|
+
// easier than looping through ownProperties of `val`.
|
|
67
|
+
try {
|
|
68
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
69
|
+
} catch (_) {
|
|
70
|
+
return 'Object';
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// errors
|
|
74
|
+
if (val instanceof Error) {
|
|
75
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
76
|
+
}
|
|
77
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
78
|
+
return className;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
82
|
+
ptr = ptr >>> 0;
|
|
83
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function getCachedStringFromWasm0(ptr, len) {
|
|
87
|
+
if (ptr === 0) {
|
|
88
|
+
return getFromExternrefTable0(len);
|
|
89
|
+
} else {
|
|
90
|
+
return getStringFromWasm0(ptr, len);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
let cachedDataViewMemory0 = null;
|
|
95
|
+
function getDataViewMemory0() {
|
|
96
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
97
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
98
|
+
}
|
|
99
|
+
return cachedDataViewMemory0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function getFromExternrefTable0(idx) { return wasm.__wbindgen_externrefs.get(idx); }
|
|
103
|
+
|
|
104
|
+
function getStringFromWasm0(ptr, len) {
|
|
105
|
+
ptr = ptr >>> 0;
|
|
106
|
+
return decodeText(ptr, len);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
let cachedUint8ArrayMemory0 = null;
|
|
110
|
+
function getUint8ArrayMemory0() {
|
|
111
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
112
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
113
|
+
}
|
|
114
|
+
return cachedUint8ArrayMemory0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function handleError(f, args) {
|
|
118
|
+
try {
|
|
119
|
+
return f.apply(this, args);
|
|
120
|
+
} catch (e) {
|
|
121
|
+
const idx = addToExternrefTable0(e);
|
|
122
|
+
wasm.__wbindgen_exn_store(idx);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function isLikeNone(x) {
|
|
127
|
+
return x === undefined || x === null;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
131
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
132
|
+
const real = (...args) => {
|
|
133
|
+
|
|
134
|
+
// First up with a closure we increment the internal reference
|
|
135
|
+
// count. This ensures that the Rust closure environment won't
|
|
136
|
+
// be deallocated while we're invoking it.
|
|
137
|
+
state.cnt++;
|
|
138
|
+
const a = state.a;
|
|
139
|
+
state.a = 0;
|
|
140
|
+
try {
|
|
141
|
+
return f(a, state.b, ...args);
|
|
142
|
+
} finally {
|
|
143
|
+
state.a = a;
|
|
144
|
+
real._wbg_cb_unref();
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
real._wbg_cb_unref = () => {
|
|
148
|
+
if (--state.cnt === 0) {
|
|
149
|
+
state.dtor(state.a, state.b);
|
|
150
|
+
state.a = 0;
|
|
151
|
+
CLOSURE_DTORS.unregister(state);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
155
|
+
return real;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
159
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
160
|
+
for (let i = 0; i < array.length; i++) {
|
|
161
|
+
const add = addToExternrefTable0(array[i]);
|
|
162
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
163
|
+
}
|
|
164
|
+
WASM_VECTOR_LEN = array.length;
|
|
165
|
+
return ptr;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
169
|
+
if (realloc === undefined) {
|
|
170
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
171
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
172
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
173
|
+
WASM_VECTOR_LEN = buf.length;
|
|
174
|
+
return ptr;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
let len = arg.length;
|
|
178
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
179
|
+
|
|
180
|
+
const mem = getUint8ArrayMemory0();
|
|
181
|
+
|
|
182
|
+
let offset = 0;
|
|
183
|
+
|
|
184
|
+
for (; offset < len; offset++) {
|
|
185
|
+
const code = arg.charCodeAt(offset);
|
|
186
|
+
if (code > 0x7F) break;
|
|
187
|
+
mem[ptr + offset] = code;
|
|
188
|
+
}
|
|
189
|
+
if (offset !== len) {
|
|
190
|
+
if (offset !== 0) {
|
|
191
|
+
arg = arg.slice(offset);
|
|
192
|
+
}
|
|
193
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
194
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
195
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
196
|
+
|
|
197
|
+
offset += ret.written;
|
|
198
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
WASM_VECTOR_LEN = offset;
|
|
202
|
+
return ptr;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function takeFromExternrefTable0(idx) {
|
|
206
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
207
|
+
wasm.__externref_table_dealloc(idx);
|
|
208
|
+
return value;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
212
|
+
cachedTextDecoder.decode();
|
|
213
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
214
|
+
let numBytesDecoded = 0;
|
|
215
|
+
function decodeText(ptr, len) {
|
|
216
|
+
numBytesDecoded += len;
|
|
217
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
218
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
219
|
+
cachedTextDecoder.decode();
|
|
220
|
+
numBytesDecoded = len;
|
|
221
|
+
}
|
|
222
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const cachedTextEncoder = new TextEncoder();
|
|
226
|
+
|
|
227
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
228
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
229
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
230
|
+
view.set(buf);
|
|
231
|
+
return {
|
|
232
|
+
read: arg.length,
|
|
233
|
+
written: buf.length
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
let WASM_VECTOR_LEN = 0;
|
|
239
|
+
|
|
240
|
+
function wasm_bindgen_68ee60ea9ccb8413___convert__closures_____invoke___wasm_bindgen_68ee60ea9ccb8413___JsValue_____(arg0, arg1, arg2) {
|
|
241
|
+
wasm.wasm_bindgen_68ee60ea9ccb8413___convert__closures_____invoke___wasm_bindgen_68ee60ea9ccb8413___JsValue_____(arg0, arg1, arg2);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function wasm_bindgen_68ee60ea9ccb8413___convert__closures_____invoke___wasm_bindgen_68ee60ea9ccb8413___JsValue__wasm_bindgen_68ee60ea9ccb8413___JsValue_____(arg0, arg1, arg2, arg3) {
|
|
245
|
+
wasm.wasm_bindgen_68ee60ea9ccb8413___convert__closures_____invoke___wasm_bindgen_68ee60ea9ccb8413___JsValue__wasm_bindgen_68ee60ea9ccb8413___JsValue_____(arg0, arg1, arg2, arg3);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
const ModuleInfoFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
249
|
+
? { register: () => {}, unregister: () => {} }
|
|
250
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_moduleinfo_free(ptr >>> 0, 1));
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Get information about the WASM module
|
|
254
|
+
*/
|
|
255
|
+
export class ModuleInfo {
|
|
256
|
+
static __wrap(ptr) {
|
|
257
|
+
ptr = ptr >>> 0;
|
|
258
|
+
const obj = Object.create(ModuleInfo.prototype);
|
|
259
|
+
obj.__wbg_ptr = ptr;
|
|
260
|
+
ModuleInfoFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
261
|
+
return obj;
|
|
262
|
+
}
|
|
263
|
+
__destroy_into_raw() {
|
|
264
|
+
const ptr = this.__wbg_ptr;
|
|
265
|
+
this.__wbg_ptr = 0;
|
|
266
|
+
ModuleInfoFinalization.unregister(this);
|
|
267
|
+
return ptr;
|
|
268
|
+
}
|
|
269
|
+
free() {
|
|
270
|
+
const ptr = this.__destroy_into_raw();
|
|
271
|
+
wasm.__wbg_moduleinfo_free(ptr, 0);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Get the module name
|
|
275
|
+
* @returns {string}
|
|
276
|
+
*/
|
|
277
|
+
name() {
|
|
278
|
+
const ret = wasm.moduleinfo_name(this.__wbg_ptr);
|
|
279
|
+
var v1 = getCachedStringFromWasm0(ret[0], ret[1]);
|
|
280
|
+
if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
|
|
281
|
+
return v1;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Get the module version
|
|
285
|
+
* @returns {string}
|
|
286
|
+
*/
|
|
287
|
+
version() {
|
|
288
|
+
const ret = wasm.moduleinfo_version(this.__wbg_ptr);
|
|
289
|
+
var v1 = getCachedStringFromWasm0(ret[0], ret[1]);
|
|
290
|
+
if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
|
|
291
|
+
return v1;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (Symbol.dispose) ModuleInfo.prototype[Symbol.dispose] = ModuleInfo.prototype.free;
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Batch extract from multiple byte arrays (asynchronous).
|
|
298
|
+
*
|
|
299
|
+
* Asynchronously processes multiple document byte arrays in parallel.
|
|
300
|
+
* Non-blocking alternative to `batchExtractBytesSync`.
|
|
301
|
+
*
|
|
302
|
+
* # JavaScript Parameters
|
|
303
|
+
*
|
|
304
|
+
* * `dataList: Uint8Array[]` - Array of document bytes
|
|
305
|
+
* * `mimeTypes: string[]` - Array of MIME types (must match dataList length)
|
|
306
|
+
* * `config?: object` - Optional extraction configuration (applied to all)
|
|
307
|
+
*
|
|
308
|
+
* # Returns
|
|
309
|
+
*
|
|
310
|
+
* `Promise<object[]>` - Promise resolving to array of ExtractionResults
|
|
311
|
+
*
|
|
312
|
+
* # Throws
|
|
313
|
+
*
|
|
314
|
+
* Rejects if dataList and mimeTypes lengths don't match.
|
|
315
|
+
*
|
|
316
|
+
* # Example
|
|
317
|
+
*
|
|
318
|
+
* ```javascript
|
|
319
|
+
* import { batchExtractBytes } from '@kreuzberg/wasm';
|
|
320
|
+
*
|
|
321
|
+
* const responses = await Promise.all([
|
|
322
|
+
* fetch('doc1.pdf'),
|
|
323
|
+
* fetch('doc2.docx')
|
|
324
|
+
* ]);
|
|
325
|
+
*
|
|
326
|
+
* const buffers = await Promise.all(
|
|
327
|
+
* responses.map(r => r.arrayBuffer().then(b => new Uint8Array(b)))
|
|
328
|
+
* );
|
|
329
|
+
*
|
|
330
|
+
* const results = await batchExtractBytes(
|
|
331
|
+
* buffers,
|
|
332
|
+
* ['application/pdf', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
|
|
333
|
+
* null
|
|
334
|
+
* );
|
|
335
|
+
* ```
|
|
336
|
+
* @param {Uint8Array[]} data_list
|
|
337
|
+
* @param {string[]} mime_types
|
|
338
|
+
* @param {any | null} [config]
|
|
339
|
+
* @returns {Promise<any>}
|
|
340
|
+
*/
|
|
341
|
+
export function batchExtractBytes(data_list, mime_types, config) {
|
|
342
|
+
const ptr0 = passArrayJsValueToWasm0(data_list, wasm.__wbindgen_malloc);
|
|
343
|
+
const len0 = WASM_VECTOR_LEN;
|
|
344
|
+
const ptr1 = passArrayJsValueToWasm0(mime_types, wasm.__wbindgen_malloc);
|
|
345
|
+
const len1 = WASM_VECTOR_LEN;
|
|
346
|
+
const ret = wasm.batchExtractBytes(ptr0, len0, ptr1, len1, isLikeNone(config) ? 0 : addToExternrefTable0(config));
|
|
347
|
+
return ret;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Batch extract from multiple byte arrays (synchronous).
|
|
352
|
+
*
|
|
353
|
+
* Processes multiple document byte arrays in parallel. All documents use the
|
|
354
|
+
* same extraction configuration.
|
|
355
|
+
*
|
|
356
|
+
* # JavaScript Parameters
|
|
357
|
+
*
|
|
358
|
+
* * `dataList: Uint8Array[]` - Array of document bytes
|
|
359
|
+
* * `mimeTypes: string[]` - Array of MIME types (must match dataList length)
|
|
360
|
+
* * `config?: object` - Optional extraction configuration (applied to all)
|
|
361
|
+
*
|
|
362
|
+
* # Returns
|
|
363
|
+
*
|
|
364
|
+
* `object[]` - Array of ExtractionResults in the same order as inputs
|
|
365
|
+
*
|
|
366
|
+
* # Throws
|
|
367
|
+
*
|
|
368
|
+
* Throws if dataList and mimeTypes lengths don't match.
|
|
369
|
+
*
|
|
370
|
+
* # Example
|
|
371
|
+
*
|
|
372
|
+
* ```javascript
|
|
373
|
+
* import { batchExtractBytesSync } from '@kreuzberg/wasm';
|
|
374
|
+
*
|
|
375
|
+
* const buffers = [buffer1, buffer2, buffer3];
|
|
376
|
+
* const mimeTypes = ['application/pdf', 'text/plain', 'image/png'];
|
|
377
|
+
* const results = batchExtractBytesSync(buffers, mimeTypes, null);
|
|
378
|
+
*
|
|
379
|
+
* results.forEach((result, i) => {
|
|
380
|
+
* console.log(`Document ${i}: ${result.content.substring(0, 50)}...`);
|
|
381
|
+
* });
|
|
382
|
+
* ```
|
|
383
|
+
* @param {Uint8Array[]} data_list
|
|
384
|
+
* @param {string[]} mime_types
|
|
385
|
+
* @param {any | null} [config]
|
|
386
|
+
* @returns {any}
|
|
387
|
+
*/
|
|
388
|
+
export function batchExtractBytesSync(data_list, mime_types, config) {
|
|
389
|
+
const ptr0 = passArrayJsValueToWasm0(data_list, wasm.__wbindgen_malloc);
|
|
390
|
+
const len0 = WASM_VECTOR_LEN;
|
|
391
|
+
const ptr1 = passArrayJsValueToWasm0(mime_types, wasm.__wbindgen_malloc);
|
|
392
|
+
const len1 = WASM_VECTOR_LEN;
|
|
393
|
+
const ret = wasm.batchExtractBytesSync(ptr0, len0, ptr1, len1, isLikeNone(config) ? 0 : addToExternrefTable0(config));
|
|
394
|
+
if (ret[2]) {
|
|
395
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
396
|
+
}
|
|
397
|
+
return takeFromExternrefTable0(ret[0]);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Batch extract from multiple Files or Blobs (asynchronous).
|
|
402
|
+
*
|
|
403
|
+
* Processes multiple web File or Blob objects in parallel using the FileReader API.
|
|
404
|
+
* Only available in browser environments.
|
|
405
|
+
*
|
|
406
|
+
* # JavaScript Parameters
|
|
407
|
+
*
|
|
408
|
+
* * `files: (File | Blob)[]` - Array of files or blobs to extract
|
|
409
|
+
* * `config?: object` - Optional extraction configuration (applied to all)
|
|
410
|
+
*
|
|
411
|
+
* # Returns
|
|
412
|
+
*
|
|
413
|
+
* `Promise<object[]>` - Promise resolving to array of ExtractionResults
|
|
414
|
+
*
|
|
415
|
+
* # Example
|
|
416
|
+
*
|
|
417
|
+
* ```javascript
|
|
418
|
+
* import { batchExtractFiles } from '@kreuzberg/wasm';
|
|
419
|
+
*
|
|
420
|
+
* // From file input with multiple files
|
|
421
|
+
* const fileInput = document.getElementById('file-input');
|
|
422
|
+
* const files = Array.from(fileInput.files);
|
|
423
|
+
*
|
|
424
|
+
* const results = await batchExtractFiles(files, null);
|
|
425
|
+
* console.log(`Processed ${results.length} files`);
|
|
426
|
+
* ```
|
|
427
|
+
* @param {File[]} files
|
|
428
|
+
* @param {any | null} [config]
|
|
429
|
+
* @returns {Promise<any>}
|
|
430
|
+
*/
|
|
431
|
+
export function batchExtractFiles(files, config) {
|
|
432
|
+
const ptr0 = passArrayJsValueToWasm0(files, wasm.__wbindgen_malloc);
|
|
433
|
+
const len0 = WASM_VECTOR_LEN;
|
|
434
|
+
const ret = wasm.batchExtractFiles(ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
|
|
435
|
+
return ret;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Batch extract from multiple files (synchronous) - NOT AVAILABLE IN WASM.
|
|
440
|
+
*
|
|
441
|
+
* File system operations are not available in WebAssembly environments.
|
|
442
|
+
* Use `batchExtractBytesSync` or `batchExtractBytes` instead.
|
|
443
|
+
*
|
|
444
|
+
* # Throws
|
|
445
|
+
*
|
|
446
|
+
* Always throws: "File operations are not available in WASM. Use batchExtractBytesSync or batchExtractBytes instead."
|
|
447
|
+
* @returns {any}
|
|
448
|
+
*/
|
|
449
|
+
export function batchExtractFilesSync() {
|
|
450
|
+
const ret = wasm.batchExtractFilesSync();
|
|
451
|
+
if (ret[2]) {
|
|
452
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
453
|
+
}
|
|
454
|
+
return takeFromExternrefTable0(ret[0]);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Clear all registered OCR backends.
|
|
459
|
+
*
|
|
460
|
+
* # Returns
|
|
461
|
+
*
|
|
462
|
+
* Ok if clearing succeeds, Err if an error occurs.
|
|
463
|
+
*
|
|
464
|
+
* # Example
|
|
465
|
+
*
|
|
466
|
+
* ```javascript
|
|
467
|
+
* clearOcrBackends();
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
470
|
+
export function clear_ocr_backends() {
|
|
471
|
+
const ret = wasm.clear_ocr_backends();
|
|
472
|
+
if (ret[1]) {
|
|
473
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Clear all registered post-processors.
|
|
479
|
+
*
|
|
480
|
+
* # Returns
|
|
481
|
+
*
|
|
482
|
+
* Ok if clearing succeeds, Err if an error occurs.
|
|
483
|
+
*
|
|
484
|
+
* # Example
|
|
485
|
+
*
|
|
486
|
+
* ```javascript
|
|
487
|
+
* clearPostProcessors();
|
|
488
|
+
* ```
|
|
489
|
+
*/
|
|
490
|
+
export function clear_post_processors() {
|
|
491
|
+
const ret = wasm.clear_post_processors();
|
|
492
|
+
if (ret[1]) {
|
|
493
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Clear all registered validators.
|
|
499
|
+
*
|
|
500
|
+
* # Returns
|
|
501
|
+
*
|
|
502
|
+
* Ok if clearing succeeds, Err if an error occurs.
|
|
503
|
+
*
|
|
504
|
+
* # Example
|
|
505
|
+
*
|
|
506
|
+
* ```javascript
|
|
507
|
+
* clearValidators();
|
|
508
|
+
* ```
|
|
509
|
+
*/
|
|
510
|
+
export function clear_validators() {
|
|
511
|
+
const ret = wasm.clear_validators();
|
|
512
|
+
if (ret[1]) {
|
|
513
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Detect MIME type from raw file bytes.
|
|
519
|
+
*
|
|
520
|
+
* Uses magic byte signatures and content analysis to detect the MIME type of
|
|
521
|
+
* a document from its binary content. Falls back to text detection if binary
|
|
522
|
+
* detection fails.
|
|
523
|
+
*
|
|
524
|
+
* # JavaScript Parameters
|
|
525
|
+
*
|
|
526
|
+
* * `data: Uint8Array` - The raw file bytes
|
|
527
|
+
*
|
|
528
|
+
* # Returns
|
|
529
|
+
*
|
|
530
|
+
* `string` - The detected MIME type (e.g., "application/pdf", "image/png")
|
|
531
|
+
*
|
|
532
|
+
* # Throws
|
|
533
|
+
*
|
|
534
|
+
* Throws an error if MIME type cannot be determined from the content.
|
|
535
|
+
*
|
|
536
|
+
* # Example
|
|
537
|
+
*
|
|
538
|
+
* ```javascript
|
|
539
|
+
* import { detectMimeFromBytes } from '@kreuzberg/wasm';
|
|
540
|
+
* import { readFileSync } from 'fs';
|
|
541
|
+
*
|
|
542
|
+
* const pdfBytes = readFileSync('document.pdf');
|
|
543
|
+
* const mimeType = detectMimeFromBytes(new Uint8Array(pdfBytes));
|
|
544
|
+
* console.log(mimeType); // "application/pdf"
|
|
545
|
+
* ```
|
|
546
|
+
* @param {Uint8Array} data
|
|
547
|
+
* @returns {string}
|
|
548
|
+
*/
|
|
549
|
+
export function detectMimeFromBytes(data) {
|
|
550
|
+
const ret = wasm.detectMimeFromBytes(data);
|
|
551
|
+
if (ret[3]) {
|
|
552
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
553
|
+
}
|
|
554
|
+
var v1 = getCachedStringFromWasm0(ret[0], ret[1]);
|
|
555
|
+
if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
|
|
556
|
+
return v1;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Discover configuration file in the project hierarchy.
|
|
561
|
+
*
|
|
562
|
+
* In WebAssembly environments, configuration discovery is not available because
|
|
563
|
+
* there is no file system access. This function always returns an error with a
|
|
564
|
+
* descriptive message directing users to use `loadConfigFromString()` instead.
|
|
565
|
+
*
|
|
566
|
+
* # JavaScript Parameters
|
|
567
|
+
*
|
|
568
|
+
* None
|
|
569
|
+
*
|
|
570
|
+
* # Returns
|
|
571
|
+
*
|
|
572
|
+
* Never returns successfully.
|
|
573
|
+
*
|
|
574
|
+
* # Throws
|
|
575
|
+
*
|
|
576
|
+
* Always throws an error with message:
|
|
577
|
+
* "discoverConfig is not available in WebAssembly (no file system access). Use loadConfigFromString() instead."
|
|
578
|
+
*
|
|
579
|
+
* # Example
|
|
580
|
+
*
|
|
581
|
+
* ```javascript
|
|
582
|
+
* import { discoverConfig } from '@kreuzberg/wasm';
|
|
583
|
+
*
|
|
584
|
+
* try {
|
|
585
|
+
* const config = discoverConfig();
|
|
586
|
+
* } catch (e) {
|
|
587
|
+
* console.error(e.message);
|
|
588
|
+
* // "discoverConfig is not available in WebAssembly (no file system access).
|
|
589
|
+
* // Use loadConfigFromString() instead."
|
|
590
|
+
* }
|
|
591
|
+
* ```
|
|
592
|
+
* @returns {any}
|
|
593
|
+
*/
|
|
594
|
+
export function discoverConfig() {
|
|
595
|
+
const ret = wasm.discoverConfig();
|
|
596
|
+
if (ret[2]) {
|
|
597
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
598
|
+
}
|
|
599
|
+
return takeFromExternrefTable0(ret[0]);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Extract content from a byte array (asynchronous).
|
|
604
|
+
*
|
|
605
|
+
* Asynchronously extracts text, tables, images, and metadata from a document.
|
|
606
|
+
* Non-blocking alternative to `extractBytesSync` suitable for large documents
|
|
607
|
+
* or browser environments.
|
|
608
|
+
*
|
|
609
|
+
* # JavaScript Parameters
|
|
610
|
+
*
|
|
611
|
+
* * `data: Uint8Array` - The document bytes to extract
|
|
612
|
+
* * `mimeType: string` - MIME type of the data (e.g., "application/pdf")
|
|
613
|
+
* * `config?: object` - Optional extraction configuration
|
|
614
|
+
*
|
|
615
|
+
* # Returns
|
|
616
|
+
*
|
|
617
|
+
* `Promise<object>` - Promise resolving to ExtractionResult
|
|
618
|
+
*
|
|
619
|
+
* # Throws
|
|
620
|
+
*
|
|
621
|
+
* Rejects if data is malformed or MIME type is unsupported.
|
|
622
|
+
*
|
|
623
|
+
* # Example
|
|
624
|
+
*
|
|
625
|
+
* ```javascript
|
|
626
|
+
* import { extractBytes } from '@kreuzberg/wasm';
|
|
627
|
+
*
|
|
628
|
+
* // Fetch from URL
|
|
629
|
+
* const response = await fetch('document.pdf');
|
|
630
|
+
* const arrayBuffer = await response.arrayBuffer();
|
|
631
|
+
* const data = new Uint8Array(arrayBuffer);
|
|
632
|
+
*
|
|
633
|
+
* const result = await extractBytes(data, 'application/pdf', null);
|
|
634
|
+
* console.log(result.content.substring(0, 100));
|
|
635
|
+
* ```
|
|
636
|
+
* @param {Uint8Array} data
|
|
637
|
+
* @param {string} mime_type
|
|
638
|
+
* @param {any | null} [config]
|
|
639
|
+
* @returns {Promise<any>}
|
|
640
|
+
*/
|
|
641
|
+
export function extractBytes(data, mime_type, config) {
|
|
642
|
+
const ptr0 = passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
643
|
+
const len0 = WASM_VECTOR_LEN;
|
|
644
|
+
const ret = wasm.extractBytes(data, ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
|
|
645
|
+
return ret;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Extract content from a byte array (synchronous).
|
|
650
|
+
*
|
|
651
|
+
* Extracts text, tables, images, and metadata from a document represented as bytes.
|
|
652
|
+
* This is a synchronous, blocking operation suitable for smaller documents or when
|
|
653
|
+
* async execution is not available.
|
|
654
|
+
*
|
|
655
|
+
* # JavaScript Parameters
|
|
656
|
+
*
|
|
657
|
+
* * `data: Uint8Array` - The document bytes to extract
|
|
658
|
+
* * `mimeType: string` - MIME type of the data (e.g., "application/pdf", "image/png")
|
|
659
|
+
* * `config?: object` - Optional extraction configuration
|
|
660
|
+
*
|
|
661
|
+
* # Returns
|
|
662
|
+
*
|
|
663
|
+
* `object` - ExtractionResult with extracted content and metadata
|
|
664
|
+
*
|
|
665
|
+
* # Throws
|
|
666
|
+
*
|
|
667
|
+
* Throws an error if data is malformed or MIME type is unsupported.
|
|
668
|
+
*
|
|
669
|
+
* # Example
|
|
670
|
+
*
|
|
671
|
+
* ```javascript
|
|
672
|
+
* import { extractBytesSync } from '@kreuzberg/wasm';
|
|
673
|
+
* import { readFileSync } from 'fs';
|
|
674
|
+
*
|
|
675
|
+
* const buffer = readFileSync('document.pdf');
|
|
676
|
+
* const data = new Uint8Array(buffer);
|
|
677
|
+
* const result = extractBytesSync(data, 'application/pdf', null);
|
|
678
|
+
* console.log(result.content);
|
|
679
|
+
* ```
|
|
680
|
+
* @param {Uint8Array} data
|
|
681
|
+
* @param {string} mime_type
|
|
682
|
+
* @param {any | null} [config]
|
|
683
|
+
* @returns {any}
|
|
684
|
+
*/
|
|
685
|
+
export function extractBytesSync(data, mime_type, config) {
|
|
686
|
+
const ptr0 = passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
687
|
+
const len0 = WASM_VECTOR_LEN;
|
|
688
|
+
const ret = wasm.extractBytesSync(data, ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
|
|
689
|
+
if (ret[2]) {
|
|
690
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
691
|
+
}
|
|
692
|
+
return takeFromExternrefTable0(ret[0]);
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Extract content from a web File or Blob (asynchronous).
|
|
697
|
+
*
|
|
698
|
+
* Extracts content from a web File (from `<input type="file">`) or Blob object
|
|
699
|
+
* using the FileReader API. Only available in browser environments.
|
|
700
|
+
*
|
|
701
|
+
* # JavaScript Parameters
|
|
702
|
+
*
|
|
703
|
+
* * `file: File | Blob` - The file or blob to extract
|
|
704
|
+
* * `mimeType?: string` - Optional MIME type hint (auto-detected if omitted)
|
|
705
|
+
* * `config?: object` - Optional extraction configuration
|
|
706
|
+
*
|
|
707
|
+
* # Returns
|
|
708
|
+
*
|
|
709
|
+
* `Promise<object>` - Promise resolving to ExtractionResult
|
|
710
|
+
*
|
|
711
|
+
* # Throws
|
|
712
|
+
*
|
|
713
|
+
* Rejects if file cannot be read or is malformed.
|
|
714
|
+
*
|
|
715
|
+
* # Example
|
|
716
|
+
*
|
|
717
|
+
* ```javascript
|
|
718
|
+
* import { extractFile } from '@kreuzberg/wasm';
|
|
719
|
+
*
|
|
720
|
+
* // From file input
|
|
721
|
+
* const fileInput = document.getElementById('file-input');
|
|
722
|
+
* const file = fileInput.files[0];
|
|
723
|
+
*
|
|
724
|
+
* const result = await extractFile(file, null, null);
|
|
725
|
+
* console.log(`Extracted ${result.content.length} characters`);
|
|
726
|
+
* ```
|
|
727
|
+
* @param {File} file
|
|
728
|
+
* @param {string | null} [mime_type]
|
|
729
|
+
* @param {any | null} [config]
|
|
730
|
+
* @returns {Promise<any>}
|
|
731
|
+
*/
|
|
732
|
+
export function extractFile(file, mime_type, config) {
|
|
733
|
+
var ptr0 = isLikeNone(mime_type) ? 0 : passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
734
|
+
var len0 = WASM_VECTOR_LEN;
|
|
735
|
+
const ret = wasm.extractFile(file, ptr0, len0, isLikeNone(config) ? 0 : addToExternrefTable0(config));
|
|
736
|
+
return ret;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Extract content from a file (synchronous) - NOT AVAILABLE IN WASM.
|
|
741
|
+
*
|
|
742
|
+
* File system operations are not available in WebAssembly environments.
|
|
743
|
+
* Use `extractBytesSync` or `extractBytes` instead.
|
|
744
|
+
*
|
|
745
|
+
* # Throws
|
|
746
|
+
*
|
|
747
|
+
* Always throws: "File operations are not available in WASM. Use extractBytesSync or extractBytes instead."
|
|
748
|
+
* @returns {any}
|
|
749
|
+
*/
|
|
750
|
+
export function extractFileSync() {
|
|
751
|
+
const ret = wasm.extractFileSync();
|
|
752
|
+
if (ret[2]) {
|
|
753
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
754
|
+
}
|
|
755
|
+
return takeFromExternrefTable0(ret[0]);
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Get file extensions for a given MIME type.
|
|
760
|
+
*
|
|
761
|
+
* Looks up all known file extensions that correspond to the specified MIME type.
|
|
762
|
+
* Returns a JavaScript Array of extension strings (without leading dots).
|
|
763
|
+
*
|
|
764
|
+
* # JavaScript Parameters
|
|
765
|
+
*
|
|
766
|
+
* * `mimeType: string` - The MIME type to look up (e.g., "application/pdf")
|
|
767
|
+
*
|
|
768
|
+
* # Returns
|
|
769
|
+
*
|
|
770
|
+
* `string[]` - Array of file extensions for the MIME type
|
|
771
|
+
*
|
|
772
|
+
* # Throws
|
|
773
|
+
*
|
|
774
|
+
* Throws an error if the MIME type is not recognized.
|
|
775
|
+
*
|
|
776
|
+
* # Example
|
|
777
|
+
*
|
|
778
|
+
* ```javascript
|
|
779
|
+
* import { getExtensionsForMime } from '@kreuzberg/wasm';
|
|
780
|
+
*
|
|
781
|
+
* const pdfExts = getExtensionsForMime('application/pdf');
|
|
782
|
+
* console.log(pdfExts); // ["pdf"]
|
|
783
|
+
*
|
|
784
|
+
* const jpegExts = getExtensionsForMime('image/jpeg');
|
|
785
|
+
* console.log(jpegExts); // ["jpg", "jpeg"]
|
|
786
|
+
* ```
|
|
787
|
+
* @param {string} mime_type
|
|
788
|
+
* @returns {Array<any>}
|
|
789
|
+
*/
|
|
790
|
+
export function getExtensionsForMime(mime_type) {
|
|
791
|
+
const ptr0 = passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
792
|
+
const len0 = WASM_VECTOR_LEN;
|
|
793
|
+
const ret = wasm.getExtensionsForMime(ptr0, len0);
|
|
794
|
+
if (ret[2]) {
|
|
795
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
796
|
+
}
|
|
797
|
+
return takeFromExternrefTable0(ret[0]);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Get MIME type from file extension.
|
|
802
|
+
*
|
|
803
|
+
* Looks up the MIME type associated with a given file extension.
|
|
804
|
+
* Returns None if the extension is not recognized.
|
|
805
|
+
*
|
|
806
|
+
* # JavaScript Parameters
|
|
807
|
+
*
|
|
808
|
+
* * `extension: string` - The file extension (with or without leading dot)
|
|
809
|
+
*
|
|
810
|
+
* # Returns
|
|
811
|
+
*
|
|
812
|
+
* `string | null` - The MIME type if found, null otherwise
|
|
813
|
+
*
|
|
814
|
+
* # Example
|
|
815
|
+
*
|
|
816
|
+
* ```javascript
|
|
817
|
+
* import { getMimeFromExtension } from '@kreuzberg/wasm';
|
|
818
|
+
*
|
|
819
|
+
* const pdfMime = getMimeFromExtension('pdf');
|
|
820
|
+
* console.log(pdfMime); // "application/pdf"
|
|
821
|
+
*
|
|
822
|
+
* const docMime = getMimeFromExtension('docx');
|
|
823
|
+
* console.log(docMime); // "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
|
824
|
+
*
|
|
825
|
+
* const unknownMime = getMimeFromExtension('unknown');
|
|
826
|
+
* console.log(unknownMime); // null
|
|
827
|
+
* ```
|
|
828
|
+
* @param {string} extension
|
|
829
|
+
* @returns {string}
|
|
830
|
+
*/
|
|
831
|
+
export function getMimeFromExtension(extension) {
|
|
832
|
+
const ptr0 = passStringToWasm0(extension, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
833
|
+
const len0 = WASM_VECTOR_LEN;
|
|
834
|
+
const ret = wasm.getMimeFromExtension(ptr0, len0);
|
|
835
|
+
var v2 = getCachedStringFromWasm0(ret[0], ret[1]);
|
|
836
|
+
if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
|
|
837
|
+
return v2;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* Get module information
|
|
842
|
+
* @returns {ModuleInfo}
|
|
843
|
+
*/
|
|
844
|
+
export function get_module_info() {
|
|
845
|
+
const ret = wasm.get_module_info();
|
|
846
|
+
return ModuleInfo.__wrap(ret);
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Initialize the WASM module
|
|
851
|
+
* This function should be called once at application startup
|
|
852
|
+
*/
|
|
853
|
+
export function init() {
|
|
854
|
+
wasm.init();
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* @param {number} _num_threads
|
|
859
|
+
* @returns {Promise<any>}
|
|
860
|
+
*/
|
|
861
|
+
export function initThreadPool(_num_threads) {
|
|
862
|
+
const ret = wasm.initThreadPool(_num_threads);
|
|
863
|
+
return ret;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* Helper function to initialize the thread pool with error handling
|
|
868
|
+
* Accepts the number of threads to use for the thread pool.
|
|
869
|
+
* Returns true if initialization succeeded, false for graceful degradation.
|
|
870
|
+
*
|
|
871
|
+
* This function wraps init_thread_pool with panic handling to ensure graceful
|
|
872
|
+
* degradation if thread pool initialization fails. The application will continue
|
|
873
|
+
* to work in single-threaded mode if the thread pool cannot be initialized.
|
|
874
|
+
* @param {number} num_threads
|
|
875
|
+
* @returns {boolean}
|
|
876
|
+
*/
|
|
877
|
+
export function init_thread_pool_safe(num_threads) {
|
|
878
|
+
const ret = wasm.init_thread_pool_safe(num_threads);
|
|
879
|
+
return ret !== 0;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* Establishes a binding between an external Pdfium WASM module and `pdfium-render`'s WASM module.
|
|
884
|
+
* This function should be called from Javascript once the external Pdfium WASM module has been loaded
|
|
885
|
+
* into the browser. It is essential that this function is called _before_ initializing
|
|
886
|
+
* `pdfium-render` from within Rust code. For an example, see:
|
|
887
|
+
* <https://github.com/ajrcarey/pdfium-render/blob/master/examples/index.html>
|
|
888
|
+
* @param {any} pdfium_wasm_module
|
|
889
|
+
* @param {any} local_wasm_module
|
|
890
|
+
* @param {boolean} debug
|
|
891
|
+
* @returns {boolean}
|
|
892
|
+
*/
|
|
893
|
+
export function initialize_pdfium_render(pdfium_wasm_module, local_wasm_module, debug) {
|
|
894
|
+
const ret = wasm.initialize_pdfium_render(pdfium_wasm_module, local_wasm_module, debug);
|
|
895
|
+
return ret !== 0;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
/**
|
|
899
|
+
* List all registered OCR backend names.
|
|
900
|
+
*
|
|
901
|
+
* # Returns
|
|
902
|
+
*
|
|
903
|
+
* Array of OCR backend names, or Err if an error occurs.
|
|
904
|
+
*
|
|
905
|
+
* # Example
|
|
906
|
+
*
|
|
907
|
+
* ```javascript
|
|
908
|
+
* const backends = listOcrBackends();
|
|
909
|
+
* console.log(backends); // ["tesseract", "custom-ocr", ...]
|
|
910
|
+
* ```
|
|
911
|
+
* @returns {Array<any>}
|
|
912
|
+
*/
|
|
913
|
+
export function list_ocr_backends() {
|
|
914
|
+
const ret = wasm.list_ocr_backends();
|
|
915
|
+
if (ret[2]) {
|
|
916
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
917
|
+
}
|
|
918
|
+
return takeFromExternrefTable0(ret[0]);
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* List all registered post-processor names.
|
|
923
|
+
*
|
|
924
|
+
* # Returns
|
|
925
|
+
*
|
|
926
|
+
* Array of post-processor names, or Err if an error occurs.
|
|
927
|
+
*
|
|
928
|
+
* # Example
|
|
929
|
+
*
|
|
930
|
+
* ```javascript
|
|
931
|
+
* const processors = listPostProcessors();
|
|
932
|
+
* console.log(processors); // ["my-post-processor", ...]
|
|
933
|
+
* ```
|
|
934
|
+
* @returns {Array<any>}
|
|
935
|
+
*/
|
|
936
|
+
export function list_post_processors() {
|
|
937
|
+
const ret = wasm.list_post_processors();
|
|
938
|
+
if (ret[2]) {
|
|
939
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
940
|
+
}
|
|
941
|
+
return takeFromExternrefTable0(ret[0]);
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* List all registered validator names.
|
|
946
|
+
*
|
|
947
|
+
* # Returns
|
|
948
|
+
*
|
|
949
|
+
* Array of validator names, or Err if an error occurs.
|
|
950
|
+
*
|
|
951
|
+
* # Example
|
|
952
|
+
*
|
|
953
|
+
* ```javascript
|
|
954
|
+
* const validators = listValidators();
|
|
955
|
+
* console.log(validators); // ["min-content-length", ...]
|
|
956
|
+
* ```
|
|
957
|
+
* @returns {Array<any>}
|
|
958
|
+
*/
|
|
959
|
+
export function list_validators() {
|
|
960
|
+
const ret = wasm.list_validators();
|
|
961
|
+
if (ret[2]) {
|
|
962
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
963
|
+
}
|
|
964
|
+
return takeFromExternrefTable0(ret[0]);
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Load configuration from a string in the specified format.
|
|
969
|
+
*
|
|
970
|
+
* Parses configuration content from TOML, YAML, or JSON formats and returns
|
|
971
|
+
* a JavaScript object representing the ExtractionConfig. This is the primary
|
|
972
|
+
* way to load configuration in WebAssembly environments since file system
|
|
973
|
+
* access is not available.
|
|
974
|
+
*
|
|
975
|
+
* # JavaScript Parameters
|
|
976
|
+
*
|
|
977
|
+
* * `content: string` - The configuration content as a string
|
|
978
|
+
* * `format: string` - The format of the content: "toml", "yaml", or "json"
|
|
979
|
+
*
|
|
980
|
+
* # Returns
|
|
981
|
+
*
|
|
982
|
+
* `object` - JavaScript object representing the ExtractionConfig
|
|
983
|
+
*
|
|
984
|
+
* # Throws
|
|
985
|
+
*
|
|
986
|
+
* Throws an error if:
|
|
987
|
+
* - The content is invalid for the specified format
|
|
988
|
+
* - The format is not one of "toml", "yaml", or "json"
|
|
989
|
+
* - Required configuration fields are missing or invalid
|
|
990
|
+
*
|
|
991
|
+
* # Example
|
|
992
|
+
*
|
|
993
|
+
* ```javascript
|
|
994
|
+
* import { loadConfigFromString } from '@kreuzberg/wasm';
|
|
995
|
+
*
|
|
996
|
+
* // Load from TOML string
|
|
997
|
+
* const tomlConfig = `
|
|
998
|
+
* use_cache = true
|
|
999
|
+
* enable_quality_processing = true
|
|
1000
|
+
* `;
|
|
1001
|
+
* const config1 = loadConfigFromString(tomlConfig, 'toml');
|
|
1002
|
+
* console.log(config1.use_cache); // true
|
|
1003
|
+
*
|
|
1004
|
+
* // Load from YAML string
|
|
1005
|
+
* const yamlConfig = `
|
|
1006
|
+
* use_cache: true
|
|
1007
|
+
* enable_quality_processing: true
|
|
1008
|
+
* `;
|
|
1009
|
+
* const config2 = loadConfigFromString(yamlConfig, 'yaml');
|
|
1010
|
+
*
|
|
1011
|
+
* // Load from JSON string
|
|
1012
|
+
* const jsonConfig = `{"use_cache": true, "enable_quality_processing": true}`;
|
|
1013
|
+
* const config3 = loadConfigFromString(jsonConfig, 'json');
|
|
1014
|
+
* ```
|
|
1015
|
+
* @param {string} content
|
|
1016
|
+
* @param {string} format
|
|
1017
|
+
* @returns {any}
|
|
1018
|
+
*/
|
|
1019
|
+
export function loadConfigFromString(content, format) {
|
|
1020
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1021
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1022
|
+
const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1023
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1024
|
+
const ret = wasm.loadConfigFromString(ptr0, len0, ptr1, len1);
|
|
1025
|
+
if (ret[2]) {
|
|
1026
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1027
|
+
}
|
|
1028
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
* Normalize a MIME type string.
|
|
1033
|
+
*
|
|
1034
|
+
* Normalizes a MIME type by converting to lowercase and removing parameters
|
|
1035
|
+
* (e.g., "application/json; charset=utf-8" becomes "application/json").
|
|
1036
|
+
* This is useful for consistent MIME type comparison.
|
|
1037
|
+
*
|
|
1038
|
+
* # JavaScript Parameters
|
|
1039
|
+
*
|
|
1040
|
+
* * `mimeType: string` - The MIME type string to normalize
|
|
1041
|
+
*
|
|
1042
|
+
* # Returns
|
|
1043
|
+
*
|
|
1044
|
+
* `string` - The normalized MIME type
|
|
1045
|
+
*
|
|
1046
|
+
* # Example
|
|
1047
|
+
*
|
|
1048
|
+
* ```javascript
|
|
1049
|
+
* import { normalizeMimeType } from '@kreuzberg/wasm';
|
|
1050
|
+
*
|
|
1051
|
+
* const normalized1 = normalizeMimeType('Application/JSON');
|
|
1052
|
+
* console.log(normalized1); // "application/json"
|
|
1053
|
+
*
|
|
1054
|
+
* const normalized2 = normalizeMimeType('text/html; charset=utf-8');
|
|
1055
|
+
* console.log(normalized2); // "text/html"
|
|
1056
|
+
*
|
|
1057
|
+
* const normalized3 = normalizeMimeType('Text/Plain; charset=ISO-8859-1');
|
|
1058
|
+
* console.log(normalized3); // "text/plain"
|
|
1059
|
+
* ```
|
|
1060
|
+
* @param {string} mime_type
|
|
1061
|
+
* @returns {string}
|
|
1062
|
+
*/
|
|
1063
|
+
export function normalizeMimeType(mime_type) {
|
|
1064
|
+
const ptr0 = passStringToWasm0(mime_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1065
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1066
|
+
const ret = wasm.normalizeMimeType(ptr0, len0);
|
|
1067
|
+
var v2 = getCachedStringFromWasm0(ret[0], ret[1]);
|
|
1068
|
+
if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
|
|
1069
|
+
return v2;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* A callback function that can be invoked by Pdfium's `FPDF_LoadCustomDocument()` function,
|
|
1074
|
+
* wrapping around `crate::utils::files::read_block_from_callback()` to shuffle data buffers
|
|
1075
|
+
* from our WASM memory heap to Pdfium's WASM memory heap as they are loaded.
|
|
1076
|
+
* @param {number} param
|
|
1077
|
+
* @param {number} position
|
|
1078
|
+
* @param {number} pBuf
|
|
1079
|
+
* @param {number} size
|
|
1080
|
+
* @returns {number}
|
|
1081
|
+
*/
|
|
1082
|
+
export function read_block_from_callback_wasm(param, position, pBuf, size) {
|
|
1083
|
+
const ret = wasm.read_block_from_callback_wasm(param, position, pBuf, size);
|
|
1084
|
+
return ret;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* Register a custom OCR backend.
|
|
1089
|
+
*
|
|
1090
|
+
* # Arguments
|
|
1091
|
+
*
|
|
1092
|
+
* * `backend` - JavaScript object implementing the OcrBackendProtocol interface:
|
|
1093
|
+
* - `name(): string` - Unique backend name
|
|
1094
|
+
* - `supportedLanguages(): string[]` - Array of language codes the backend supports
|
|
1095
|
+
* - `processImage(imageBase64: string, language: string): Promise<string>` - Process image and return JSON result
|
|
1096
|
+
*
|
|
1097
|
+
* # Returns
|
|
1098
|
+
*
|
|
1099
|
+
* Ok if registration succeeds, Err with description if it fails.
|
|
1100
|
+
*
|
|
1101
|
+
* # Example
|
|
1102
|
+
*
|
|
1103
|
+
* ```javascript
|
|
1104
|
+
* registerOcrBackend({
|
|
1105
|
+
* name: () => "custom-ocr",
|
|
1106
|
+
* supportedLanguages: () => ["en", "es", "fr"],
|
|
1107
|
+
* processImage: async (imageBase64, language) => {
|
|
1108
|
+
* const buffer = Buffer.from(imageBase64, "base64");
|
|
1109
|
+
* // Process image with custom OCR engine
|
|
1110
|
+
* const text = await customOcrEngine.recognize(buffer, language);
|
|
1111
|
+
* return JSON.stringify({
|
|
1112
|
+
* content: text,
|
|
1113
|
+
* mime_type: "text/plain",
|
|
1114
|
+
* metadata: {}
|
|
1115
|
+
* });
|
|
1116
|
+
* }
|
|
1117
|
+
* });
|
|
1118
|
+
* ```
|
|
1119
|
+
* @param {any} backend
|
|
1120
|
+
*/
|
|
1121
|
+
export function register_ocr_backend(backend) {
|
|
1122
|
+
const ret = wasm.register_ocr_backend(backend);
|
|
1123
|
+
if (ret[1]) {
|
|
1124
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* Register a custom post-processor.
|
|
1130
|
+
*
|
|
1131
|
+
* # Arguments
|
|
1132
|
+
*
|
|
1133
|
+
* * `processor` - JavaScript object implementing the PostProcessorProtocol interface:
|
|
1134
|
+
* - `name(): string` - Unique processor name
|
|
1135
|
+
* - `process(jsonString: string): Promise<string>` - Process function that takes JSON input
|
|
1136
|
+
* - `processingStage(): "early" | "middle" | "late"` - Optional processing stage (defaults to "middle")
|
|
1137
|
+
*
|
|
1138
|
+
* # Returns
|
|
1139
|
+
*
|
|
1140
|
+
* Ok if registration succeeds, Err with description if it fails.
|
|
1141
|
+
*
|
|
1142
|
+
* # Example
|
|
1143
|
+
*
|
|
1144
|
+
* ```javascript
|
|
1145
|
+
* registerPostProcessor({
|
|
1146
|
+
* name: () => "my-post-processor",
|
|
1147
|
+
* processingStage: () => "middle",
|
|
1148
|
+
* process: async (jsonString) => {
|
|
1149
|
+
* const result = JSON.parse(jsonString);
|
|
1150
|
+
* // Process the extraction result
|
|
1151
|
+
* result.metadata.processed_by = "my-post-processor";
|
|
1152
|
+
* return JSON.stringify(result);
|
|
1153
|
+
* }
|
|
1154
|
+
* });
|
|
1155
|
+
* ```
|
|
1156
|
+
* @param {any} processor
|
|
1157
|
+
*/
|
|
1158
|
+
export function register_post_processor(processor) {
|
|
1159
|
+
const ret = wasm.register_post_processor(processor);
|
|
1160
|
+
if (ret[1]) {
|
|
1161
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
/**
|
|
1166
|
+
* Register a custom validator.
|
|
1167
|
+
*
|
|
1168
|
+
* # Arguments
|
|
1169
|
+
*
|
|
1170
|
+
* * `validator` - JavaScript object implementing the ValidatorProtocol interface:
|
|
1171
|
+
* - `name(): string` - Unique validator name
|
|
1172
|
+
* - `validate(jsonString: string): Promise<string>` - Validation function returning empty string on success, error message on failure
|
|
1173
|
+
* - `priority(): number` - Optional priority (defaults to 50, higher runs first)
|
|
1174
|
+
*
|
|
1175
|
+
* # Returns
|
|
1176
|
+
*
|
|
1177
|
+
* Ok if registration succeeds, Err with description if it fails.
|
|
1178
|
+
*
|
|
1179
|
+
* # Example
|
|
1180
|
+
*
|
|
1181
|
+
* ```javascript
|
|
1182
|
+
* registerValidator({
|
|
1183
|
+
* name: () => "min-content-length",
|
|
1184
|
+
* priority: () => 100,
|
|
1185
|
+
* validate: async (jsonString) => {
|
|
1186
|
+
* const result = JSON.parse(jsonString);
|
|
1187
|
+
* if (result.content.length < 100) {
|
|
1188
|
+
* return "Content too short"; // Validation failure
|
|
1189
|
+
* }
|
|
1190
|
+
* return ""; // Success
|
|
1191
|
+
* }
|
|
1192
|
+
* });
|
|
1193
|
+
* ```
|
|
1194
|
+
* @param {any} validator
|
|
1195
|
+
*/
|
|
1196
|
+
export function register_validator(validator) {
|
|
1197
|
+
const ret = wasm.register_validator(validator);
|
|
1198
|
+
if (ret[1]) {
|
|
1199
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
/**
|
|
1204
|
+
* Unregister an OCR backend by name.
|
|
1205
|
+
*
|
|
1206
|
+
* # Arguments
|
|
1207
|
+
*
|
|
1208
|
+
* * `name` - Name of the OCR backend to unregister
|
|
1209
|
+
*
|
|
1210
|
+
* # Returns
|
|
1211
|
+
*
|
|
1212
|
+
* Ok if unregistration succeeds, Err if the backend is not found or other error occurs.
|
|
1213
|
+
*
|
|
1214
|
+
* # Example
|
|
1215
|
+
*
|
|
1216
|
+
* ```javascript
|
|
1217
|
+
* unregisterOcrBackend("custom-ocr");
|
|
1218
|
+
* ```
|
|
1219
|
+
* @param {string} name
|
|
1220
|
+
*/
|
|
1221
|
+
export function unregister_ocr_backend(name) {
|
|
1222
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1223
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1224
|
+
const ret = wasm.unregister_ocr_backend(ptr0, len0);
|
|
1225
|
+
if (ret[1]) {
|
|
1226
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* Unregister a post-processor by name.
|
|
1232
|
+
*
|
|
1233
|
+
* # Arguments
|
|
1234
|
+
*
|
|
1235
|
+
* * `name` - Name of the post-processor to unregister
|
|
1236
|
+
*
|
|
1237
|
+
* # Returns
|
|
1238
|
+
*
|
|
1239
|
+
* Ok if unregistration succeeds, Err if the processor is not found or other error occurs.
|
|
1240
|
+
*
|
|
1241
|
+
* # Example
|
|
1242
|
+
*
|
|
1243
|
+
* ```javascript
|
|
1244
|
+
* unregisterPostProcessor("my-post-processor");
|
|
1245
|
+
* ```
|
|
1246
|
+
* @param {string} name
|
|
1247
|
+
*/
|
|
1248
|
+
export function unregister_post_processor(name) {
|
|
1249
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1250
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1251
|
+
const ret = wasm.unregister_post_processor(ptr0, len0);
|
|
1252
|
+
if (ret[1]) {
|
|
1253
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* Unregister a validator by name.
|
|
1259
|
+
*
|
|
1260
|
+
* # Arguments
|
|
1261
|
+
*
|
|
1262
|
+
* * `name` - Name of the validator to unregister
|
|
1263
|
+
*
|
|
1264
|
+
* # Returns
|
|
1265
|
+
*
|
|
1266
|
+
* Ok if unregistration succeeds, Err if the validator is not found or other error occurs.
|
|
1267
|
+
*
|
|
1268
|
+
* # Example
|
|
1269
|
+
*
|
|
1270
|
+
* ```javascript
|
|
1271
|
+
* unregisterValidator("min-content-length");
|
|
1272
|
+
* ```
|
|
1273
|
+
* @param {string} name
|
|
1274
|
+
*/
|
|
1275
|
+
export function unregister_validator(name) {
|
|
1276
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1277
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1278
|
+
const ret = wasm.unregister_validator(ptr0, len0);
|
|
1279
|
+
if (ret[1]) {
|
|
1280
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
/**
|
|
1285
|
+
* Version of the kreuzberg-wasm binding
|
|
1286
|
+
* @returns {string}
|
|
1287
|
+
*/
|
|
1288
|
+
export function version() {
|
|
1289
|
+
const ret = wasm.version();
|
|
1290
|
+
var v1 = getCachedStringFromWasm0(ret[0], ret[1]);
|
|
1291
|
+
if (ret[0] !== 0) { wasm.__wbindgen_free(ret[0], ret[1], 1); }
|
|
1292
|
+
return v1;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* A callback function that can be invoked by Pdfium's `FPDF_SaveAsCopy()` and `FPDF_SaveWithVersion()`
|
|
1297
|
+
* functions, wrapping around `crate::utils::files::write_block_from_callback()` to shuffle data buffers
|
|
1298
|
+
* from Pdfium's WASM memory heap to our WASM memory heap as they are written.
|
|
1299
|
+
* @param {number} param
|
|
1300
|
+
* @param {number} buf
|
|
1301
|
+
* @param {number} size
|
|
1302
|
+
* @returns {number}
|
|
1303
|
+
*/
|
|
1304
|
+
export function write_block_from_callback_wasm(param, buf, size) {
|
|
1305
|
+
const ret = wasm.write_block_from_callback_wasm(param, buf, size);
|
|
1306
|
+
return ret;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
export function __wbg_Error_52673b7de5a0ca89(arg0, arg1) {
|
|
1310
|
+
var v0 = getCachedStringFromWasm0(arg0, arg1);
|
|
1311
|
+
const ret = Error(v0);
|
|
1312
|
+
return ret;
|
|
1313
|
+
};
|
|
1314
|
+
|
|
1315
|
+
export function __wbg_Number_2d1dcfcf4ec51736(arg0) {
|
|
1316
|
+
const ret = Number(arg0);
|
|
1317
|
+
return ret;
|
|
1318
|
+
};
|
|
1319
|
+
|
|
1320
|
+
export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
|
|
1321
|
+
const ret = String(arg1);
|
|
1322
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1323
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1324
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1325
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1326
|
+
};
|
|
1327
|
+
|
|
1328
|
+
export function __wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d(arg0, arg1) {
|
|
1329
|
+
const v = arg1;
|
|
1330
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
1331
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
1332
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1333
|
+
};
|
|
1334
|
+
|
|
1335
|
+
export function __wbg___wbindgen_boolean_get_dea25b33882b895b(arg0) {
|
|
1336
|
+
const v = arg0;
|
|
1337
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
1338
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
1339
|
+
};
|
|
1340
|
+
|
|
1341
|
+
export function __wbg___wbindgen_debug_string_adfb662ae34724b6(arg0, arg1) {
|
|
1342
|
+
const ret = debugString(arg1);
|
|
1343
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1344
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1345
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1346
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1347
|
+
};
|
|
1348
|
+
|
|
1349
|
+
export function __wbg___wbindgen_in_0d3e1e8f0c669317(arg0, arg1) {
|
|
1350
|
+
const ret = arg0 in arg1;
|
|
1351
|
+
return ret;
|
|
1352
|
+
};
|
|
1353
|
+
|
|
1354
|
+
export function __wbg___wbindgen_is_bigint_0e1a2e3f55cfae27(arg0) {
|
|
1355
|
+
const ret = typeof(arg0) === 'bigint';
|
|
1356
|
+
return ret;
|
|
1357
|
+
};
|
|
1358
|
+
|
|
1359
|
+
export function __wbg___wbindgen_is_function_8d400b8b1af978cd(arg0) {
|
|
1360
|
+
const ret = typeof(arg0) === 'function';
|
|
1361
|
+
return ret;
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
export function __wbg___wbindgen_is_object_ce774f3490692386(arg0) {
|
|
1365
|
+
const val = arg0;
|
|
1366
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
1367
|
+
return ret;
|
|
1368
|
+
};
|
|
1369
|
+
|
|
1370
|
+
export function __wbg___wbindgen_is_string_704ef9c8fc131030(arg0) {
|
|
1371
|
+
const ret = typeof(arg0) === 'string';
|
|
1372
|
+
return ret;
|
|
1373
|
+
};
|
|
1374
|
+
|
|
1375
|
+
export function __wbg___wbindgen_is_undefined_f6b95eab589e0269(arg0) {
|
|
1376
|
+
const ret = arg0 === undefined;
|
|
1377
|
+
return ret;
|
|
1378
|
+
};
|
|
1379
|
+
|
|
1380
|
+
export function __wbg___wbindgen_jsval_eq_b6101cc9cef1fe36(arg0, arg1) {
|
|
1381
|
+
const ret = arg0 === arg1;
|
|
1382
|
+
return ret;
|
|
1383
|
+
};
|
|
1384
|
+
|
|
1385
|
+
export function __wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d(arg0, arg1) {
|
|
1386
|
+
const ret = arg0 == arg1;
|
|
1387
|
+
return ret;
|
|
1388
|
+
};
|
|
1389
|
+
|
|
1390
|
+
export function __wbg___wbindgen_number_get_9619185a74197f95(arg0, arg1) {
|
|
1391
|
+
const obj = arg1;
|
|
1392
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
1393
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
1394
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1395
|
+
};
|
|
1396
|
+
|
|
1397
|
+
export function __wbg___wbindgen_string_get_a2a31e16edf96e42(arg0, arg1) {
|
|
1398
|
+
const obj = arg1;
|
|
1399
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1400
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1401
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1402
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1403
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1404
|
+
};
|
|
1405
|
+
|
|
1406
|
+
export function __wbg___wbindgen_throw_dd24417ed36fc46e(arg0, arg1) {
|
|
1407
|
+
var v0 = getCachedStringFromWasm0(arg0, arg1);
|
|
1408
|
+
throw new Error(v0);
|
|
1409
|
+
};
|
|
1410
|
+
|
|
1411
|
+
export function __wbg__wbg_cb_unref_87dfb5aaa0cbcea7(arg0) {
|
|
1412
|
+
arg0._wbg_cb_unref();
|
|
1413
|
+
};
|
|
1414
|
+
|
|
1415
|
+
export function __wbg_addEventListener_6a82629b3d430a48() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1416
|
+
var v0 = getCachedStringFromWasm0(arg1, arg2);
|
|
1417
|
+
arg0.addEventListener(v0, arg3);
|
|
1418
|
+
}, arguments) };
|
|
1419
|
+
|
|
1420
|
+
export function __wbg_apply_52e9ae668d017009() { return handleError(function (arg0, arg1, arg2) {
|
|
1421
|
+
const ret = arg0.apply(arg1, arg2);
|
|
1422
|
+
return ret;
|
|
1423
|
+
}, arguments) };
|
|
1424
|
+
|
|
1425
|
+
export function __wbg_call_3020136f7a2d6e44() { return handleError(function (arg0, arg1, arg2) {
|
|
1426
|
+
const ret = arg0.call(arg1, arg2);
|
|
1427
|
+
return ret;
|
|
1428
|
+
}, arguments) };
|
|
1429
|
+
|
|
1430
|
+
export function __wbg_call_abb4ff46ce38be40() { return handleError(function (arg0, arg1) {
|
|
1431
|
+
const ret = arg0.call(arg1);
|
|
1432
|
+
return ret;
|
|
1433
|
+
}, arguments) };
|
|
1434
|
+
|
|
1435
|
+
export function __wbg_call_c8baa5c5e72d274e() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1436
|
+
const ret = arg0.call(arg1, arg2, arg3);
|
|
1437
|
+
return ret;
|
|
1438
|
+
}, arguments) };
|
|
1439
|
+
|
|
1440
|
+
export function __wbg_construct_8d61a09a064d7a0e() { return handleError(function (arg0, arg1) {
|
|
1441
|
+
const ret = Reflect.construct(arg0, arg1);
|
|
1442
|
+
return ret;
|
|
1443
|
+
}, arguments) };
|
|
1444
|
+
|
|
1445
|
+
export function __wbg_debug_9d0c87ddda3dc485(arg0) {
|
|
1446
|
+
console.debug(arg0);
|
|
1447
|
+
};
|
|
1448
|
+
|
|
1449
|
+
export function __wbg_decode_47d91d32f8c229af() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1450
|
+
const ret = arg1.decode(getArrayU8FromWasm0(arg2, arg3));
|
|
1451
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1452
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1453
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1454
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1455
|
+
}, arguments) };
|
|
1456
|
+
|
|
1457
|
+
export function __wbg_done_62ea16af4ce34b24(arg0) {
|
|
1458
|
+
const ret = arg0.done;
|
|
1459
|
+
return ret;
|
|
1460
|
+
};
|
|
1461
|
+
|
|
1462
|
+
export function __wbg_entries_83c79938054e065f(arg0) {
|
|
1463
|
+
const ret = Object.entries(arg0);
|
|
1464
|
+
return ret;
|
|
1465
|
+
};
|
|
1466
|
+
|
|
1467
|
+
export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
|
|
1468
|
+
var v0 = getCachedStringFromWasm0(arg0, arg1);
|
|
1469
|
+
if (arg0 !== 0) { wasm.__wbindgen_free(arg0, arg1, 1); }
|
|
1470
|
+
console.error(v0);
|
|
1471
|
+
};
|
|
1472
|
+
|
|
1473
|
+
export function __wbg_error_7bc7d576a6aaf855(arg0) {
|
|
1474
|
+
console.error(arg0);
|
|
1475
|
+
};
|
|
1476
|
+
|
|
1477
|
+
export function __wbg_from_29a8414a7a7cd19d(arg0) {
|
|
1478
|
+
const ret = Array.from(arg0);
|
|
1479
|
+
return ret;
|
|
1480
|
+
};
|
|
1481
|
+
|
|
1482
|
+
export function __wbg_getRandomValues_1c61fac11405ffdc() { return handleError(function (arg0, arg1) {
|
|
1483
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
1484
|
+
}, arguments) };
|
|
1485
|
+
|
|
1486
|
+
export function __wbg_getTime_ad1e9878a735af08(arg0) {
|
|
1487
|
+
const ret = arg0.getTime();
|
|
1488
|
+
return ret;
|
|
1489
|
+
};
|
|
1490
|
+
|
|
1491
|
+
export function __wbg_get_16458e8ef25ea5fa() { return handleError(function (arg0, arg1) {
|
|
1492
|
+
const ret = arg0.get(arg1 >>> 0);
|
|
1493
|
+
return ret;
|
|
1494
|
+
}, arguments) };
|
|
1495
|
+
|
|
1496
|
+
export function __wbg_get_6b7bd52aca3f9671(arg0, arg1) {
|
|
1497
|
+
const ret = arg0[arg1 >>> 0];
|
|
1498
|
+
return ret;
|
|
1499
|
+
};
|
|
1500
|
+
|
|
1501
|
+
export function __wbg_get_af9dab7e9603ea93() { return handleError(function (arg0, arg1) {
|
|
1502
|
+
const ret = Reflect.get(arg0, arg1);
|
|
1503
|
+
return ret;
|
|
1504
|
+
}, arguments) };
|
|
1505
|
+
|
|
1506
|
+
export function __wbg_get_index_4e7b3f629a0ab9cd(arg0, arg1) {
|
|
1507
|
+
const ret = arg0[arg1 >>> 0];
|
|
1508
|
+
return ret;
|
|
1509
|
+
};
|
|
1510
|
+
|
|
1511
|
+
export function __wbg_get_with_ref_key_1dc361bd10053bfe(arg0, arg1) {
|
|
1512
|
+
const ret = arg0[arg1];
|
|
1513
|
+
return ret;
|
|
1514
|
+
};
|
|
1515
|
+
|
|
1516
|
+
export function __wbg_info_ce6bcc489c22f6f0(arg0) {
|
|
1517
|
+
console.info(arg0);
|
|
1518
|
+
};
|
|
1519
|
+
|
|
1520
|
+
export function __wbg_instanceof_ArrayBuffer_f3320d2419cd0355(arg0) {
|
|
1521
|
+
let result;
|
|
1522
|
+
try {
|
|
1523
|
+
result = arg0 instanceof ArrayBuffer;
|
|
1524
|
+
} catch (_) {
|
|
1525
|
+
result = false;
|
|
1526
|
+
}
|
|
1527
|
+
const ret = result;
|
|
1528
|
+
return ret;
|
|
1529
|
+
};
|
|
1530
|
+
|
|
1531
|
+
export function __wbg_instanceof_Map_084be8da74364158(arg0) {
|
|
1532
|
+
let result;
|
|
1533
|
+
try {
|
|
1534
|
+
result = arg0 instanceof Map;
|
|
1535
|
+
} catch (_) {
|
|
1536
|
+
result = false;
|
|
1537
|
+
}
|
|
1538
|
+
const ret = result;
|
|
1539
|
+
return ret;
|
|
1540
|
+
};
|
|
1541
|
+
|
|
1542
|
+
export function __wbg_instanceof_Uint8Array_da54ccc9d3e09434(arg0) {
|
|
1543
|
+
let result;
|
|
1544
|
+
try {
|
|
1545
|
+
result = arg0 instanceof Uint8Array;
|
|
1546
|
+
} catch (_) {
|
|
1547
|
+
result = false;
|
|
1548
|
+
}
|
|
1549
|
+
const ret = result;
|
|
1550
|
+
return ret;
|
|
1551
|
+
};
|
|
1552
|
+
|
|
1553
|
+
export function __wbg_isArray_51fd9e6422c0a395(arg0) {
|
|
1554
|
+
const ret = Array.isArray(arg0);
|
|
1555
|
+
return ret;
|
|
1556
|
+
};
|
|
1557
|
+
|
|
1558
|
+
export function __wbg_isSafeInteger_ae7d3f054d55fa16(arg0) {
|
|
1559
|
+
const ret = Number.isSafeInteger(arg0);
|
|
1560
|
+
return ret;
|
|
1561
|
+
};
|
|
1562
|
+
|
|
1563
|
+
export function __wbg_iterator_27b7c8b35ab3e86b() {
|
|
1564
|
+
const ret = Symbol.iterator;
|
|
1565
|
+
return ret;
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1568
|
+
export function __wbg_length_22ac23eaec9d8053(arg0) {
|
|
1569
|
+
const ret = arg0.length;
|
|
1570
|
+
return ret;
|
|
1571
|
+
};
|
|
1572
|
+
|
|
1573
|
+
export function __wbg_length_3a9ca660d3d3391b(arg0) {
|
|
1574
|
+
const ret = arg0.length;
|
|
1575
|
+
return ret;
|
|
1576
|
+
};
|
|
1577
|
+
|
|
1578
|
+
export function __wbg_length_bd124cfd1a9444fe(arg0) {
|
|
1579
|
+
const ret = arg0.length;
|
|
1580
|
+
return ret;
|
|
1581
|
+
};
|
|
1582
|
+
|
|
1583
|
+
export function __wbg_length_d45040a40c570362(arg0) {
|
|
1584
|
+
const ret = arg0.length;
|
|
1585
|
+
return ret;
|
|
1586
|
+
};
|
|
1587
|
+
|
|
1588
|
+
export function __wbg_log_1d990106d99dacb7(arg0) {
|
|
1589
|
+
console.log(arg0);
|
|
1590
|
+
};
|
|
1591
|
+
|
|
1592
|
+
export function __wbg_new_0_23cedd11d9b40c9d() {
|
|
1593
|
+
const ret = new Date();
|
|
1594
|
+
return ret;
|
|
1595
|
+
};
|
|
1596
|
+
|
|
1597
|
+
export function __wbg_new_111dde64cffa8ba1() { return handleError(function () {
|
|
1598
|
+
const ret = new FileReader();
|
|
1599
|
+
return ret;
|
|
1600
|
+
}, arguments) };
|
|
1601
|
+
|
|
1602
|
+
export function __wbg_new_1ba21ce319a06297() {
|
|
1603
|
+
const ret = new Object();
|
|
1604
|
+
return ret;
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1607
|
+
export function __wbg_new_25f239778d6112b9() {
|
|
1608
|
+
const ret = new Array();
|
|
1609
|
+
return ret;
|
|
1610
|
+
};
|
|
1611
|
+
|
|
1612
|
+
export function __wbg_new_6421f6084cc5bc5a(arg0) {
|
|
1613
|
+
const ret = new Uint8Array(arg0);
|
|
1614
|
+
return ret;
|
|
1615
|
+
};
|
|
1616
|
+
|
|
1617
|
+
export function __wbg_new_8a6f238a6ece86ea() {
|
|
1618
|
+
const ret = new Error();
|
|
1619
|
+
return ret;
|
|
1620
|
+
};
|
|
1621
|
+
|
|
1622
|
+
export function __wbg_new_b546ae120718850e() {
|
|
1623
|
+
const ret = new Map();
|
|
1624
|
+
return ret;
|
|
1625
|
+
};
|
|
1626
|
+
|
|
1627
|
+
export function __wbg_new_ff12d2b041fb48f1(arg0, arg1) {
|
|
1628
|
+
try {
|
|
1629
|
+
var state0 = {a: arg0, b: arg1};
|
|
1630
|
+
var cb0 = (arg0, arg1) => {
|
|
1631
|
+
const a = state0.a;
|
|
1632
|
+
state0.a = 0;
|
|
1633
|
+
try {
|
|
1634
|
+
return wasm_bindgen_68ee60ea9ccb8413___convert__closures_____invoke___wasm_bindgen_68ee60ea9ccb8413___JsValue__wasm_bindgen_68ee60ea9ccb8413___JsValue_____(a, state0.b, arg0, arg1);
|
|
1635
|
+
} finally {
|
|
1636
|
+
state0.a = a;
|
|
1637
|
+
}
|
|
1638
|
+
};
|
|
1639
|
+
const ret = new Promise(cb0);
|
|
1640
|
+
return ret;
|
|
1641
|
+
} finally {
|
|
1642
|
+
state0.a = state0.b = 0;
|
|
1643
|
+
}
|
|
1644
|
+
};
|
|
1645
|
+
|
|
1646
|
+
export function __wbg_new_no_args_cb138f77cf6151ee(arg0, arg1) {
|
|
1647
|
+
var v0 = getCachedStringFromWasm0(arg0, arg1);
|
|
1648
|
+
const ret = new Function(v0);
|
|
1649
|
+
return ret;
|
|
1650
|
+
};
|
|
1651
|
+
|
|
1652
|
+
export function __wbg_new_with_label_a21974f868c72f0c() { return handleError(function (arg0, arg1) {
|
|
1653
|
+
var v0 = getCachedStringFromWasm0(arg0, arg1);
|
|
1654
|
+
const ret = new TextDecoder(v0);
|
|
1655
|
+
return ret;
|
|
1656
|
+
}, arguments) };
|
|
1657
|
+
|
|
1658
|
+
export function __wbg_new_with_length_12c6de4fac33117a(arg0) {
|
|
1659
|
+
const ret = new Array(arg0 >>> 0);
|
|
1660
|
+
return ret;
|
|
1661
|
+
};
|
|
1662
|
+
|
|
1663
|
+
export function __wbg_next_138a17bbf04e926c(arg0) {
|
|
1664
|
+
const ret = arg0.next;
|
|
1665
|
+
return ret;
|
|
1666
|
+
};
|
|
1667
|
+
|
|
1668
|
+
export function __wbg_next_3cfe5c0fe2a4cc53() { return handleError(function (arg0) {
|
|
1669
|
+
const ret = arg0.next();
|
|
1670
|
+
return ret;
|
|
1671
|
+
}, arguments) };
|
|
1672
|
+
|
|
1673
|
+
export function __wbg_of_122077a9318f8376(arg0, arg1, arg2, arg3, arg4) {
|
|
1674
|
+
const ret = Array.of(arg0, arg1, arg2, arg3, arg4);
|
|
1675
|
+
return ret;
|
|
1676
|
+
};
|
|
1677
|
+
|
|
1678
|
+
export function __wbg_of_6505a0eb509da02e(arg0) {
|
|
1679
|
+
const ret = Array.of(arg0);
|
|
1680
|
+
return ret;
|
|
1681
|
+
};
|
|
1682
|
+
|
|
1683
|
+
export function __wbg_of_7779827fa663eec8(arg0, arg1, arg2) {
|
|
1684
|
+
const ret = Array.of(arg0, arg1, arg2);
|
|
1685
|
+
return ret;
|
|
1686
|
+
};
|
|
1687
|
+
|
|
1688
|
+
export function __wbg_of_b8cd42ebb79fb759(arg0, arg1) {
|
|
1689
|
+
const ret = Array.of(arg0, arg1);
|
|
1690
|
+
return ret;
|
|
1691
|
+
};
|
|
1692
|
+
|
|
1693
|
+
export function __wbg_of_fdf875aa87d9498c(arg0, arg1, arg2, arg3) {
|
|
1694
|
+
const ret = Array.of(arg0, arg1, arg2, arg3);
|
|
1695
|
+
return ret;
|
|
1696
|
+
};
|
|
1697
|
+
|
|
1698
|
+
export function __wbg_prototypesetcall_dfe9b766cdc1f1fd(arg0, arg1, arg2) {
|
|
1699
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
1700
|
+
};
|
|
1701
|
+
|
|
1702
|
+
export function __wbg_push_7d9be8f38fc13975(arg0, arg1) {
|
|
1703
|
+
const ret = arg0.push(arg1);
|
|
1704
|
+
return ret;
|
|
1705
|
+
};
|
|
1706
|
+
|
|
1707
|
+
export function __wbg_queueMicrotask_9b549dfce8865860(arg0) {
|
|
1708
|
+
const ret = arg0.queueMicrotask;
|
|
1709
|
+
return ret;
|
|
1710
|
+
};
|
|
1711
|
+
|
|
1712
|
+
export function __wbg_queueMicrotask_fca69f5bfad613a5(arg0) {
|
|
1713
|
+
queueMicrotask(arg0);
|
|
1714
|
+
};
|
|
1715
|
+
|
|
1716
|
+
export function __wbg_readAsArrayBuffer_0aca937439be3197() { return handleError(function (arg0, arg1) {
|
|
1717
|
+
arg0.readAsArrayBuffer(arg1);
|
|
1718
|
+
}, arguments) };
|
|
1719
|
+
|
|
1720
|
+
export function __wbg_reject_e9f21cdd3c968ce3(arg0) {
|
|
1721
|
+
const ret = Promise.reject(arg0);
|
|
1722
|
+
return ret;
|
|
1723
|
+
};
|
|
1724
|
+
|
|
1725
|
+
export function __wbg_resolve_fd5bfbaa4ce36e1e(arg0) {
|
|
1726
|
+
const ret = Promise.resolve(arg0);
|
|
1727
|
+
return ret;
|
|
1728
|
+
};
|
|
1729
|
+
|
|
1730
|
+
export function __wbg_result_893437a1eaacc4df() { return handleError(function (arg0) {
|
|
1731
|
+
const ret = arg0.result;
|
|
1732
|
+
return ret;
|
|
1733
|
+
}, arguments) };
|
|
1734
|
+
|
|
1735
|
+
export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
|
|
1736
|
+
arg0[arg1] = arg2;
|
|
1737
|
+
};
|
|
1738
|
+
|
|
1739
|
+
export function __wbg_set_7df433eea03a5c14(arg0, arg1, arg2) {
|
|
1740
|
+
arg0[arg1 >>> 0] = arg2;
|
|
1741
|
+
};
|
|
1742
|
+
|
|
1743
|
+
export function __wbg_set_bc3a432bdcd60886(arg0, arg1, arg2) {
|
|
1744
|
+
arg0.set(arg1, arg2 >>> 0);
|
|
1745
|
+
};
|
|
1746
|
+
|
|
1747
|
+
export function __wbg_set_c50d03a32da17043() { return handleError(function (arg0, arg1, arg2) {
|
|
1748
|
+
arg0.set(arg1 >>> 0, arg2);
|
|
1749
|
+
}, arguments) };
|
|
1750
|
+
|
|
1751
|
+
export function __wbg_set_efaaf145b9377369(arg0, arg1, arg2) {
|
|
1752
|
+
const ret = arg0.set(arg1, arg2);
|
|
1753
|
+
return ret;
|
|
1754
|
+
};
|
|
1755
|
+
|
|
1756
|
+
export function __wbg_slice_27b3dfe21d8ce752(arg0, arg1, arg2) {
|
|
1757
|
+
const ret = arg0.slice(arg1 >>> 0, arg2 >>> 0);
|
|
1758
|
+
return ret;
|
|
1759
|
+
};
|
|
1760
|
+
|
|
1761
|
+
export function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) {
|
|
1762
|
+
const ret = arg1.stack;
|
|
1763
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1764
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1765
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1766
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1767
|
+
};
|
|
1768
|
+
|
|
1769
|
+
export function __wbg_static_accessor_GLOBAL_769e6b65d6557335() {
|
|
1770
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
1771
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1772
|
+
};
|
|
1773
|
+
|
|
1774
|
+
export function __wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1() {
|
|
1775
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
1776
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1777
|
+
};
|
|
1778
|
+
|
|
1779
|
+
export function __wbg_static_accessor_SELF_08f5a74c69739274() {
|
|
1780
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
1781
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1782
|
+
};
|
|
1783
|
+
|
|
1784
|
+
export function __wbg_static_accessor_WINDOW_a8924b26aa92d024() {
|
|
1785
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
1786
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1787
|
+
};
|
|
1788
|
+
|
|
1789
|
+
export function __wbg_subarray_845f2f5bce7d061a(arg0, arg1, arg2) {
|
|
1790
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
1791
|
+
return ret;
|
|
1792
|
+
};
|
|
1793
|
+
|
|
1794
|
+
export function __wbg_then_429f7caf1026411d(arg0, arg1, arg2) {
|
|
1795
|
+
const ret = arg0.then(arg1, arg2);
|
|
1796
|
+
return ret;
|
|
1797
|
+
};
|
|
1798
|
+
|
|
1799
|
+
export function __wbg_then_4f95312d68691235(arg0, arg1) {
|
|
1800
|
+
const ret = arg0.then(arg1);
|
|
1801
|
+
return ret;
|
|
1802
|
+
};
|
|
1803
|
+
|
|
1804
|
+
export function __wbg_type_cb833fc71b5282fb(arg0, arg1) {
|
|
1805
|
+
const ret = arg1.type;
|
|
1806
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1807
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1808
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1809
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1810
|
+
};
|
|
1811
|
+
|
|
1812
|
+
export function __wbg_value_57b7b035e117f7ee(arg0) {
|
|
1813
|
+
const ret = arg0.value;
|
|
1814
|
+
return ret;
|
|
1815
|
+
};
|
|
1816
|
+
|
|
1817
|
+
export function __wbg_warn_6e567d0d926ff881(arg0) {
|
|
1818
|
+
console.warn(arg0);
|
|
1819
|
+
};
|
|
1820
|
+
|
|
1821
|
+
export function __wbindgen_cast_4625c577ab2ec9ee(arg0) {
|
|
1822
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
1823
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
1824
|
+
return ret;
|
|
1825
|
+
};
|
|
1826
|
+
|
|
1827
|
+
export function __wbindgen_cast_7e9c58eeb11b0a6f(arg0, arg1) {
|
|
1828
|
+
var v0 = getCachedStringFromWasm0(arg0, arg1);
|
|
1829
|
+
// Cast intrinsic for `Ref(CachedString) -> Externref`.
|
|
1830
|
+
const ret = v0;
|
|
1831
|
+
return ret;
|
|
1832
|
+
};
|
|
1833
|
+
|
|
1834
|
+
export function __wbindgen_cast_965f3ca5bc091f01(arg0, arg1) {
|
|
1835
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 1976, function: Function { arguments: [Externref], shim_idx: 1977, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1836
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen_68ee60ea9ccb8413___closure__destroy___dyn_core_f96ffdd67f65b3d8___ops__function__FnMut__wasm_bindgen_68ee60ea9ccb8413___JsValue____Output_______, wasm_bindgen_68ee60ea9ccb8413___convert__closures_____invoke___wasm_bindgen_68ee60ea9ccb8413___JsValue_____);
|
|
1837
|
+
return ret;
|
|
1838
|
+
};
|
|
1839
|
+
|
|
1840
|
+
export function __wbindgen_cast_9ae0607507abb057(arg0) {
|
|
1841
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
1842
|
+
const ret = arg0;
|
|
1843
|
+
return ret;
|
|
1844
|
+
};
|
|
1845
|
+
|
|
1846
|
+
export function __wbindgen_cast_cb9088102bce6b30(arg0, arg1) {
|
|
1847
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
1848
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
1849
|
+
return ret;
|
|
1850
|
+
};
|
|
1851
|
+
|
|
1852
|
+
export function __wbindgen_cast_d6cd19b81560fd6e(arg0) {
|
|
1853
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
1854
|
+
const ret = arg0;
|
|
1855
|
+
return ret;
|
|
1856
|
+
};
|
|
1857
|
+
|
|
1858
|
+
export function __wbindgen_init_externref_table() {
|
|
1859
|
+
const table = wasm.__wbindgen_externrefs;
|
|
1860
|
+
const offset = table.grow(4);
|
|
1861
|
+
table.set(0, undefined);
|
|
1862
|
+
table.set(offset + 0, undefined);
|
|
1863
|
+
table.set(offset + 1, null);
|
|
1864
|
+
table.set(offset + 2, true);
|
|
1865
|
+
table.set(offset + 3, false);
|
|
1866
|
+
};
|
|
1867
|
+
|
|
1868
|
+
export function __wbindgen_object_is_undefined(arg0) {
|
|
1869
|
+
const ret = arg0 === undefined;
|
|
1870
|
+
return ret;
|
|
1871
|
+
};
|