@kreuzberg/html-to-markdown-wasm 2.19.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1395 @@
1
+ let wasm;
2
+ /**
3
+ * @typedef {import("./html_to_markdown_wasm").WasmConversionOptions} WasmConversionOptions
4
+ */
5
+
6
+
7
+ function addHeapObject(obj) {
8
+ if (heap_next === heap.length) heap.push(heap.length + 1);
9
+ const idx = heap_next;
10
+ heap_next = heap[idx];
11
+
12
+ heap[idx] = obj;
13
+ return idx;
14
+ }
15
+
16
+ function _assertClass(instance, klass) {
17
+ if (!(instance instanceof klass)) {
18
+ throw new Error(`expected instance of ${klass.name}`);
19
+ }
20
+ }
21
+
22
+ function debugString(val) {
23
+ // primitive types
24
+ const type = typeof val;
25
+ if (type == 'number' || type == 'boolean' || val == null) {
26
+ return `${val}`;
27
+ }
28
+ if (type == 'string') {
29
+ return `"${val}"`;
30
+ }
31
+ if (type == 'symbol') {
32
+ const description = val.description;
33
+ if (description == null) {
34
+ return 'Symbol';
35
+ } else {
36
+ return `Symbol(${description})`;
37
+ }
38
+ }
39
+ if (type == 'function') {
40
+ const name = val.name;
41
+ if (typeof name == 'string' && name.length > 0) {
42
+ return `Function(${name})`;
43
+ } else {
44
+ return 'Function';
45
+ }
46
+ }
47
+ // objects
48
+ if (Array.isArray(val)) {
49
+ const length = val.length;
50
+ let debug = '[';
51
+ if (length > 0) {
52
+ debug += debugString(val[0]);
53
+ }
54
+ for(let i = 1; i < length; i++) {
55
+ debug += ', ' + debugString(val[i]);
56
+ }
57
+ debug += ']';
58
+ return debug;
59
+ }
60
+ // Test for built-in
61
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
62
+ let className;
63
+ if (builtInMatches && builtInMatches.length > 1) {
64
+ className = builtInMatches[1];
65
+ } else {
66
+ // Failed to match the standard '[object ClassName]'
67
+ return toString.call(val);
68
+ }
69
+ if (className == 'Object') {
70
+ // we're a user defined class or Object
71
+ // JSON.stringify avoids problems with cycles, and is generally much
72
+ // easier than looping through ownProperties of `val`.
73
+ try {
74
+ return 'Object(' + JSON.stringify(val) + ')';
75
+ } catch (_) {
76
+ return 'Object';
77
+ }
78
+ }
79
+ // errors
80
+ if (val instanceof Error) {
81
+ return `${val.name}: ${val.message}\n${val.stack}`;
82
+ }
83
+ // TODO we could test for more things here, like `Set`s and `Map`s.
84
+ return className;
85
+ }
86
+
87
+ function dropObject(idx) {
88
+ if (idx < 132) return;
89
+ heap[idx] = heap_next;
90
+ heap_next = idx;
91
+ }
92
+
93
+ function getArrayJsValueFromWasm0(ptr, len) {
94
+ ptr = ptr >>> 0;
95
+ const mem = getDataViewMemory0();
96
+ const result = [];
97
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
98
+ result.push(takeObject(mem.getUint32(i, true)));
99
+ }
100
+ return result;
101
+ }
102
+
103
+ function getArrayU32FromWasm0(ptr, len) {
104
+ ptr = ptr >>> 0;
105
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
106
+ }
107
+
108
+ function getArrayU8FromWasm0(ptr, len) {
109
+ ptr = ptr >>> 0;
110
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
111
+ }
112
+
113
+ let cachedDataViewMemory0 = null;
114
+ function getDataViewMemory0() {
115
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
116
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
117
+ }
118
+ return cachedDataViewMemory0;
119
+ }
120
+
121
+ function getStringFromWasm0(ptr, len) {
122
+ ptr = ptr >>> 0;
123
+ return decodeText(ptr, len);
124
+ }
125
+
126
+ let cachedUint32ArrayMemory0 = null;
127
+ function getUint32ArrayMemory0() {
128
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
129
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
130
+ }
131
+ return cachedUint32ArrayMemory0;
132
+ }
133
+
134
+ let cachedUint8ArrayMemory0 = null;
135
+ function getUint8ArrayMemory0() {
136
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
137
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
138
+ }
139
+ return cachedUint8ArrayMemory0;
140
+ }
141
+
142
+ function getObject(idx) { return heap[idx]; }
143
+
144
+ function handleError(f, args) {
145
+ try {
146
+ return f.apply(this, args);
147
+ } catch (e) {
148
+ wasm.__wbindgen_export3(addHeapObject(e));
149
+ }
150
+ }
151
+
152
+ let heap = new Array(128).fill(undefined);
153
+ heap.push(undefined, null, true, false);
154
+
155
+ let heap_next = heap.length;
156
+
157
+ function isLikeNone(x) {
158
+ return x === undefined || x === null;
159
+ }
160
+
161
+ function passStringToWasm0(arg, malloc, realloc) {
162
+ if (realloc === undefined) {
163
+ const buf = cachedTextEncoder.encode(arg);
164
+ const ptr = malloc(buf.length, 1) >>> 0;
165
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
166
+ WASM_VECTOR_LEN = buf.length;
167
+ return ptr;
168
+ }
169
+
170
+ let len = arg.length;
171
+ let ptr = malloc(len, 1) >>> 0;
172
+
173
+ const mem = getUint8ArrayMemory0();
174
+
175
+ let offset = 0;
176
+
177
+ for (; offset < len; offset++) {
178
+ const code = arg.charCodeAt(offset);
179
+ if (code > 0x7F) break;
180
+ mem[ptr + offset] = code;
181
+ }
182
+ if (offset !== len) {
183
+ if (offset !== 0) {
184
+ arg = arg.slice(offset);
185
+ }
186
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
187
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
188
+ const ret = cachedTextEncoder.encodeInto(arg, view);
189
+
190
+ offset += ret.written;
191
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
192
+ }
193
+
194
+ WASM_VECTOR_LEN = offset;
195
+ return ptr;
196
+ }
197
+
198
+ function takeObject(idx) {
199
+ const ret = getObject(idx);
200
+ dropObject(idx);
201
+ return ret;
202
+ }
203
+
204
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
205
+ cachedTextDecoder.decode();
206
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
207
+ let numBytesDecoded = 0;
208
+ function decodeText(ptr, len) {
209
+ numBytesDecoded += len;
210
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
211
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
212
+ cachedTextDecoder.decode();
213
+ numBytesDecoded = len;
214
+ }
215
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
216
+ }
217
+
218
+ const cachedTextEncoder = new TextEncoder();
219
+
220
+ if (!('encodeInto' in cachedTextEncoder)) {
221
+ cachedTextEncoder.encodeInto = function (arg, view) {
222
+ const buf = cachedTextEncoder.encode(arg);
223
+ view.set(buf);
224
+ return {
225
+ read: arg.length,
226
+ written: buf.length
227
+ };
228
+ }
229
+ }
230
+
231
+ let WASM_VECTOR_LEN = 0;
232
+
233
+ const WasmConversionOptionsHandleFinalization = (typeof FinalizationRegistry === 'undefined')
234
+ ? { register: () => {}, unregister: () => {} }
235
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmconversionoptionshandle_free(ptr >>> 0, 1));
236
+
237
+ const WasmHtmlExtractionFinalization = (typeof FinalizationRegistry === 'undefined')
238
+ ? { register: () => {}, unregister: () => {} }
239
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmhtmlextraction_free(ptr >>> 0, 1));
240
+
241
+ const WasmInlineImageFinalization = (typeof FinalizationRegistry === 'undefined')
242
+ ? { register: () => {}, unregister: () => {} }
243
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasminlineimage_free(ptr >>> 0, 1));
244
+
245
+ const WasmInlineImageConfigFinalization = (typeof FinalizationRegistry === 'undefined')
246
+ ? { register: () => {}, unregister: () => {} }
247
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasminlineimageconfig_free(ptr >>> 0, 1));
248
+
249
+ const WasmInlineImageWarningFinalization = (typeof FinalizationRegistry === 'undefined')
250
+ ? { register: () => {}, unregister: () => {} }
251
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasminlineimagewarning_free(ptr >>> 0, 1));
252
+
253
+ const WasmMetadataConfigFinalization = (typeof FinalizationRegistry === 'undefined')
254
+ ? { register: () => {}, unregister: () => {} }
255
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmmetadataconfig_free(ptr >>> 0, 1));
256
+
257
+ export class WasmConversionOptionsHandle {
258
+ static __wrap(ptr) {
259
+ ptr = ptr >>> 0;
260
+ const obj = Object.create(WasmConversionOptionsHandle.prototype);
261
+ obj.__wbg_ptr = ptr;
262
+ WasmConversionOptionsHandleFinalization.register(obj, obj.__wbg_ptr, obj);
263
+ return obj;
264
+ }
265
+ __destroy_into_raw() {
266
+ const ptr = this.__wbg_ptr;
267
+ this.__wbg_ptr = 0;
268
+ WasmConversionOptionsHandleFinalization.unregister(this);
269
+ return ptr;
270
+ }
271
+ free() {
272
+ const ptr = this.__destroy_into_raw();
273
+ wasm.__wbg_wasmconversionoptionshandle_free(ptr, 0);
274
+ }
275
+ /**
276
+ * @param {WasmConversionOptions | null | undefined} [options]
277
+ */
278
+ constructor(options) {
279
+ try {
280
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
281
+ wasm.wasmconversionoptionshandle_new(retptr, addHeapObject(options));
282
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
283
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
284
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
285
+ if (r2) {
286
+ throw takeObject(r1);
287
+ }
288
+ this.__wbg_ptr = r0 >>> 0;
289
+ WasmConversionOptionsHandleFinalization.register(this, this.__wbg_ptr, this);
290
+ return this;
291
+ } finally {
292
+ wasm.__wbindgen_add_to_stack_pointer(16);
293
+ }
294
+ }
295
+ }
296
+ if (Symbol.dispose) WasmConversionOptionsHandle.prototype[Symbol.dispose] = WasmConversionOptionsHandle.prototype.free;
297
+
298
+ /**
299
+ * Result of HTML extraction with inline images
300
+ */
301
+ export class WasmHtmlExtraction {
302
+ static __wrap(ptr) {
303
+ ptr = ptr >>> 0;
304
+ const obj = Object.create(WasmHtmlExtraction.prototype);
305
+ obj.__wbg_ptr = ptr;
306
+ WasmHtmlExtractionFinalization.register(obj, obj.__wbg_ptr, obj);
307
+ return obj;
308
+ }
309
+ __destroy_into_raw() {
310
+ const ptr = this.__wbg_ptr;
311
+ this.__wbg_ptr = 0;
312
+ WasmHtmlExtractionFinalization.unregister(this);
313
+ return ptr;
314
+ }
315
+ free() {
316
+ const ptr = this.__destroy_into_raw();
317
+ wasm.__wbg_wasmhtmlextraction_free(ptr, 0);
318
+ }
319
+ /**
320
+ * @returns {WasmInlineImage[]}
321
+ */
322
+ get inlineImages() {
323
+ try {
324
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
325
+ wasm.wasmhtmlextraction_inlineImages(retptr, this.__wbg_ptr);
326
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
327
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
328
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
329
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
330
+ return v1;
331
+ } finally {
332
+ wasm.__wbindgen_add_to_stack_pointer(16);
333
+ }
334
+ }
335
+ /**
336
+ * @returns {string}
337
+ */
338
+ get markdown() {
339
+ let deferred1_0;
340
+ let deferred1_1;
341
+ try {
342
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
343
+ wasm.wasmhtmlextraction_markdown(retptr, this.__wbg_ptr);
344
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
345
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
346
+ deferred1_0 = r0;
347
+ deferred1_1 = r1;
348
+ return getStringFromWasm0(r0, r1);
349
+ } finally {
350
+ wasm.__wbindgen_add_to_stack_pointer(16);
351
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
352
+ }
353
+ }
354
+ /**
355
+ * @returns {WasmInlineImageWarning[]}
356
+ */
357
+ get warnings() {
358
+ try {
359
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
360
+ wasm.wasmhtmlextraction_warnings(retptr, this.__wbg_ptr);
361
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
362
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
363
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
364
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
365
+ return v1;
366
+ } finally {
367
+ wasm.__wbindgen_add_to_stack_pointer(16);
368
+ }
369
+ }
370
+ }
371
+ if (Symbol.dispose) WasmHtmlExtraction.prototype[Symbol.dispose] = WasmHtmlExtraction.prototype.free;
372
+
373
+ /**
374
+ * Inline image data
375
+ */
376
+ export class WasmInlineImage {
377
+ static __wrap(ptr) {
378
+ ptr = ptr >>> 0;
379
+ const obj = Object.create(WasmInlineImage.prototype);
380
+ obj.__wbg_ptr = ptr;
381
+ WasmInlineImageFinalization.register(obj, obj.__wbg_ptr, obj);
382
+ return obj;
383
+ }
384
+ __destroy_into_raw() {
385
+ const ptr = this.__wbg_ptr;
386
+ this.__wbg_ptr = 0;
387
+ WasmInlineImageFinalization.unregister(this);
388
+ return ptr;
389
+ }
390
+ free() {
391
+ const ptr = this.__destroy_into_raw();
392
+ wasm.__wbg_wasminlineimage_free(ptr, 0);
393
+ }
394
+ /**
395
+ * @returns {Record<string, string>}
396
+ */
397
+ get attributes() {
398
+ const ret = wasm.wasminlineimage_attributes(this.__wbg_ptr);
399
+ return takeObject(ret);
400
+ }
401
+ /**
402
+ * @returns {Uint32Array | undefined}
403
+ */
404
+ get dimensions() {
405
+ try {
406
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
407
+ wasm.wasminlineimage_dimensions(retptr, this.__wbg_ptr);
408
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
409
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
410
+ let v1;
411
+ if (r0 !== 0) {
412
+ v1 = getArrayU32FromWasm0(r0, r1).slice();
413
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
414
+ }
415
+ return v1;
416
+ } finally {
417
+ wasm.__wbindgen_add_to_stack_pointer(16);
418
+ }
419
+ }
420
+ /**
421
+ * @returns {string | undefined}
422
+ */
423
+ get description() {
424
+ try {
425
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
426
+ wasm.wasminlineimage_description(retptr, this.__wbg_ptr);
427
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
428
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
429
+ let v1;
430
+ if (r0 !== 0) {
431
+ v1 = getStringFromWasm0(r0, r1).slice();
432
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
433
+ }
434
+ return v1;
435
+ } finally {
436
+ wasm.__wbindgen_add_to_stack_pointer(16);
437
+ }
438
+ }
439
+ /**
440
+ * @returns {Uint8Array}
441
+ */
442
+ get data() {
443
+ const ret = wasm.wasminlineimage_data(this.__wbg_ptr);
444
+ return takeObject(ret);
445
+ }
446
+ /**
447
+ * @returns {string}
448
+ */
449
+ get format() {
450
+ let deferred1_0;
451
+ let deferred1_1;
452
+ try {
453
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
454
+ wasm.wasminlineimage_format(retptr, this.__wbg_ptr);
455
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
456
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
457
+ deferred1_0 = r0;
458
+ deferred1_1 = r1;
459
+ return getStringFromWasm0(r0, r1);
460
+ } finally {
461
+ wasm.__wbindgen_add_to_stack_pointer(16);
462
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
463
+ }
464
+ }
465
+ /**
466
+ * @returns {string}
467
+ */
468
+ get source() {
469
+ let deferred1_0;
470
+ let deferred1_1;
471
+ try {
472
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
473
+ wasm.wasminlineimage_source(retptr, this.__wbg_ptr);
474
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
475
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
476
+ deferred1_0 = r0;
477
+ deferred1_1 = r1;
478
+ return getStringFromWasm0(r0, r1);
479
+ } finally {
480
+ wasm.__wbindgen_add_to_stack_pointer(16);
481
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
482
+ }
483
+ }
484
+ /**
485
+ * @returns {string | undefined}
486
+ */
487
+ get filename() {
488
+ try {
489
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
490
+ wasm.wasminlineimage_filename(retptr, this.__wbg_ptr);
491
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
492
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
493
+ let v1;
494
+ if (r0 !== 0) {
495
+ v1 = getStringFromWasm0(r0, r1).slice();
496
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
497
+ }
498
+ return v1;
499
+ } finally {
500
+ wasm.__wbindgen_add_to_stack_pointer(16);
501
+ }
502
+ }
503
+ }
504
+ if (Symbol.dispose) WasmInlineImage.prototype[Symbol.dispose] = WasmInlineImage.prototype.free;
505
+
506
+ /**
507
+ * Inline image configuration
508
+ */
509
+ export class WasmInlineImageConfig {
510
+ __destroy_into_raw() {
511
+ const ptr = this.__wbg_ptr;
512
+ this.__wbg_ptr = 0;
513
+ WasmInlineImageConfigFinalization.unregister(this);
514
+ return ptr;
515
+ }
516
+ free() {
517
+ const ptr = this.__destroy_into_raw();
518
+ wasm.__wbg_wasminlineimageconfig_free(ptr, 0);
519
+ }
520
+ /**
521
+ * @param {boolean} capture
522
+ */
523
+ set captureSvg(capture) {
524
+ wasm.wasminlineimageconfig_set_captureSvg(this.__wbg_ptr, capture);
525
+ }
526
+ /**
527
+ * @param {string | null} [prefix]
528
+ */
529
+ set filenamePrefix(prefix) {
530
+ var ptr0 = isLikeNone(prefix) ? 0 : passStringToWasm0(prefix, wasm.__wbindgen_export, wasm.__wbindgen_export2);
531
+ var len0 = WASM_VECTOR_LEN;
532
+ wasm.wasminlineimageconfig_set_filenamePrefix(this.__wbg_ptr, ptr0, len0);
533
+ }
534
+ /**
535
+ * @param {boolean} infer
536
+ */
537
+ set inferDimensions(infer) {
538
+ wasm.wasminlineimageconfig_set_inferDimensions(this.__wbg_ptr, infer);
539
+ }
540
+ /**
541
+ * @param {number | null} [max_decoded_size_bytes]
542
+ */
543
+ constructor(max_decoded_size_bytes) {
544
+ const ret = wasm.wasminlineimageconfig_new(!isLikeNone(max_decoded_size_bytes), isLikeNone(max_decoded_size_bytes) ? 0 : max_decoded_size_bytes);
545
+ this.__wbg_ptr = ret >>> 0;
546
+ WasmInlineImageConfigFinalization.register(this, this.__wbg_ptr, this);
547
+ return this;
548
+ }
549
+ }
550
+ if (Symbol.dispose) WasmInlineImageConfig.prototype[Symbol.dispose] = WasmInlineImageConfig.prototype.free;
551
+
552
+ /**
553
+ * Warning about inline image processing
554
+ */
555
+ export class WasmInlineImageWarning {
556
+ static __wrap(ptr) {
557
+ ptr = ptr >>> 0;
558
+ const obj = Object.create(WasmInlineImageWarning.prototype);
559
+ obj.__wbg_ptr = ptr;
560
+ WasmInlineImageWarningFinalization.register(obj, obj.__wbg_ptr, obj);
561
+ return obj;
562
+ }
563
+ __destroy_into_raw() {
564
+ const ptr = this.__wbg_ptr;
565
+ this.__wbg_ptr = 0;
566
+ WasmInlineImageWarningFinalization.unregister(this);
567
+ return ptr;
568
+ }
569
+ free() {
570
+ const ptr = this.__destroy_into_raw();
571
+ wasm.__wbg_wasminlineimagewarning_free(ptr, 0);
572
+ }
573
+ /**
574
+ * @returns {number}
575
+ */
576
+ get index() {
577
+ const ret = wasm.wasminlineimagewarning_index(this.__wbg_ptr);
578
+ return ret >>> 0;
579
+ }
580
+ /**
581
+ * @returns {string}
582
+ */
583
+ get message() {
584
+ let deferred1_0;
585
+ let deferred1_1;
586
+ try {
587
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
588
+ wasm.wasminlineimagewarning_message(retptr, this.__wbg_ptr);
589
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
590
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
591
+ deferred1_0 = r0;
592
+ deferred1_1 = r1;
593
+ return getStringFromWasm0(r0, r1);
594
+ } finally {
595
+ wasm.__wbindgen_add_to_stack_pointer(16);
596
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
597
+ }
598
+ }
599
+ }
600
+ if (Symbol.dispose) WasmInlineImageWarning.prototype[Symbol.dispose] = WasmInlineImageWarning.prototype.free;
601
+
602
+ /**
603
+ * Metadata extraction configuration
604
+ */
605
+ export class WasmMetadataConfig {
606
+ __destroy_into_raw() {
607
+ const ptr = this.__wbg_ptr;
608
+ this.__wbg_ptr = 0;
609
+ WasmMetadataConfigFinalization.unregister(this);
610
+ return ptr;
611
+ }
612
+ free() {
613
+ const ptr = this.__destroy_into_raw();
614
+ wasm.__wbg_wasmmetadataconfig_free(ptr, 0);
615
+ }
616
+ /**
617
+ * @returns {boolean}
618
+ */
619
+ get extract_links() {
620
+ const ret = wasm.wasmmetadataconfig_extract_links(this.__wbg_ptr);
621
+ return ret !== 0;
622
+ }
623
+ /**
624
+ * @returns {boolean}
625
+ */
626
+ get extract_images() {
627
+ const ret = wasm.wasmmetadataconfig_extract_images(this.__wbg_ptr);
628
+ return ret !== 0;
629
+ }
630
+ /**
631
+ * @returns {boolean}
632
+ */
633
+ get extract_headers() {
634
+ const ret = wasm.wasmmetadataconfig_extract_headers(this.__wbg_ptr);
635
+ return ret !== 0;
636
+ }
637
+ /**
638
+ * @returns {boolean}
639
+ */
640
+ get extract_document() {
641
+ const ret = wasm.wasmmetadataconfig_extract_document(this.__wbg_ptr);
642
+ return ret !== 0;
643
+ }
644
+ /**
645
+ * @param {boolean} value
646
+ */
647
+ set extract_links(value) {
648
+ wasm.wasmmetadataconfig_set_extract_links(this.__wbg_ptr, value);
649
+ }
650
+ /**
651
+ * @param {boolean} value
652
+ */
653
+ set extract_images(value) {
654
+ wasm.wasmmetadataconfig_set_extract_images(this.__wbg_ptr, value);
655
+ }
656
+ /**
657
+ * @param {boolean} value
658
+ */
659
+ set extract_headers(value) {
660
+ wasm.wasmmetadataconfig_set_extract_headers(this.__wbg_ptr, value);
661
+ }
662
+ /**
663
+ * @param {boolean} value
664
+ */
665
+ set extract_document(value) {
666
+ wasm.wasmmetadataconfig_set_extract_document(this.__wbg_ptr, value);
667
+ }
668
+ /**
669
+ * @returns {boolean}
670
+ */
671
+ get extract_structured_data() {
672
+ const ret = wasm.wasmmetadataconfig_extract_structured_data(this.__wbg_ptr);
673
+ return ret !== 0;
674
+ }
675
+ /**
676
+ * @returns {number}
677
+ */
678
+ get max_structured_data_size() {
679
+ const ret = wasm.wasmmetadataconfig_max_structured_data_size(this.__wbg_ptr);
680
+ return ret >>> 0;
681
+ }
682
+ /**
683
+ * @param {boolean} value
684
+ */
685
+ set extract_structured_data(value) {
686
+ wasm.wasmmetadataconfig_set_extract_structured_data(this.__wbg_ptr, value);
687
+ }
688
+ /**
689
+ * @param {number} value
690
+ */
691
+ set max_structured_data_size(value) {
692
+ wasm.wasmmetadataconfig_set_max_structured_data_size(this.__wbg_ptr, value);
693
+ }
694
+ /**
695
+ * Create a new metadata configuration with defaults
696
+ *
697
+ * All extraction types enabled by default with 1MB structured data limit
698
+ */
699
+ constructor() {
700
+ const ret = wasm.wasmmetadataconfig_new();
701
+ this.__wbg_ptr = ret >>> 0;
702
+ WasmMetadataConfigFinalization.register(this, this.__wbg_ptr, this);
703
+ return this;
704
+ }
705
+ }
706
+ if (Symbol.dispose) WasmMetadataConfig.prototype[Symbol.dispose] = WasmMetadataConfig.prototype.free;
707
+
708
+ /**
709
+ * Convert HTML to Markdown
710
+ *
711
+ * # Arguments
712
+ *
713
+ * * `html` - The HTML string to convert
714
+ * * `options` - Optional conversion options (as a JavaScript object)
715
+ *
716
+ * # Example
717
+ *
718
+ * ```javascript
719
+ * import { convert } from 'html-to-markdown-wasm';
720
+ *
721
+ * const html = '<h1>Hello World</h1>';
722
+ * const markdown = convert(html);
723
+ * console.log(markdown); // # Hello World
724
+ * ```
725
+ * @param {string} html
726
+ * @param {WasmConversionOptions | null | undefined} [options]
727
+ * @returns {string}
728
+ */
729
+ export function convert(html, options) {
730
+ let deferred3_0;
731
+ let deferred3_1;
732
+ try {
733
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
734
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
735
+ const len0 = WASM_VECTOR_LEN;
736
+ wasm.convert(retptr, ptr0, len0, addHeapObject(options));
737
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
738
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
739
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
740
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
741
+ var ptr2 = r0;
742
+ var len2 = r1;
743
+ if (r3) {
744
+ ptr2 = 0; len2 = 0;
745
+ throw takeObject(r2);
746
+ }
747
+ deferred3_0 = ptr2;
748
+ deferred3_1 = len2;
749
+ return getStringFromWasm0(ptr2, len2);
750
+ } finally {
751
+ wasm.__wbindgen_add_to_stack_pointer(16);
752
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
753
+ }
754
+ }
755
+
756
+ /**
757
+ * @param {Uint8Array} html
758
+ * @param {WasmConversionOptions | null | undefined} [options]
759
+ * @returns {string}
760
+ */
761
+ export function convertBytes(html, options) {
762
+ let deferred2_0;
763
+ let deferred2_1;
764
+ try {
765
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
766
+ wasm.convertBytes(retptr, addHeapObject(html), addHeapObject(options));
767
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
768
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
769
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
770
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
771
+ var ptr1 = r0;
772
+ var len1 = r1;
773
+ if (r3) {
774
+ ptr1 = 0; len1 = 0;
775
+ throw takeObject(r2);
776
+ }
777
+ deferred2_0 = ptr1;
778
+ deferred2_1 = len1;
779
+ return getStringFromWasm0(ptr1, len1);
780
+ } finally {
781
+ wasm.__wbindgen_add_to_stack_pointer(16);
782
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
783
+ }
784
+ }
785
+
786
+ /**
787
+ * @param {Uint8Array} html
788
+ * @param {WasmConversionOptions | null | undefined} [options]
789
+ * @param {WasmInlineImageConfig | null} [image_config]
790
+ * @returns {WasmHtmlExtraction}
791
+ */
792
+ export function convertBytesWithInlineImages(html, options, image_config) {
793
+ try {
794
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
795
+ let ptr0 = 0;
796
+ if (!isLikeNone(image_config)) {
797
+ _assertClass(image_config, WasmInlineImageConfig);
798
+ ptr0 = image_config.__destroy_into_raw();
799
+ }
800
+ wasm.convertBytesWithInlineImages(retptr, addHeapObject(html), addHeapObject(options), ptr0);
801
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
802
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
803
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
804
+ if (r2) {
805
+ throw takeObject(r1);
806
+ }
807
+ return WasmHtmlExtraction.__wrap(r0);
808
+ } finally {
809
+ wasm.__wbindgen_add_to_stack_pointer(16);
810
+ }
811
+ }
812
+
813
+ /**
814
+ * Convert HTML bytes to Markdown with metadata extraction
815
+ *
816
+ * # Arguments
817
+ *
818
+ * * `html` - The HTML bytes to convert
819
+ * * `options` - Optional conversion options (as a JavaScript object)
820
+ * * `metadata_config` - Metadata extraction configuration
821
+ *
822
+ * # Returns
823
+ *
824
+ * JavaScript object with `markdown` (string) and `metadata` (object) fields
825
+ * @param {Uint8Array} html
826
+ * @param {WasmConversionOptions | null | undefined} [options]
827
+ * @param {WasmMetadataConfig | null} [metadata_config]
828
+ * @returns {Record<string, string>}
829
+ */
830
+ export function convertBytesWithMetadata(html, options, metadata_config) {
831
+ try {
832
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
833
+ let ptr0 = 0;
834
+ if (!isLikeNone(metadata_config)) {
835
+ _assertClass(metadata_config, WasmMetadataConfig);
836
+ ptr0 = metadata_config.__destroy_into_raw();
837
+ }
838
+ wasm.convertBytesWithMetadata(retptr, addHeapObject(html), addHeapObject(options), ptr0);
839
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
840
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
841
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
842
+ if (r2) {
843
+ throw takeObject(r1);
844
+ }
845
+ return takeObject(r0);
846
+ } finally {
847
+ wasm.__wbindgen_add_to_stack_pointer(16);
848
+ }
849
+ }
850
+
851
+ /**
852
+ * @param {Uint8Array} html
853
+ * @param {WasmConversionOptionsHandle} handle
854
+ * @returns {string}
855
+ */
856
+ export function convertBytesWithOptionsHandle(html, handle) {
857
+ let deferred2_0;
858
+ let deferred2_1;
859
+ try {
860
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
861
+ _assertClass(handle, WasmConversionOptionsHandle);
862
+ wasm.convertBytesWithOptionsHandle(retptr, addHeapObject(html), handle.__wbg_ptr);
863
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
864
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
865
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
866
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
867
+ var ptr1 = r0;
868
+ var len1 = r1;
869
+ if (r3) {
870
+ ptr1 = 0; len1 = 0;
871
+ throw takeObject(r2);
872
+ }
873
+ deferred2_0 = ptr1;
874
+ deferred2_1 = len1;
875
+ return getStringFromWasm0(ptr1, len1);
876
+ } finally {
877
+ wasm.__wbindgen_add_to_stack_pointer(16);
878
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
879
+ }
880
+ }
881
+
882
+ /**
883
+ * @param {string} html
884
+ * @param {WasmConversionOptions | null | undefined} [options]
885
+ * @param {WasmInlineImageConfig | null} [image_config]
886
+ * @returns {WasmHtmlExtraction}
887
+ */
888
+ export function convertWithInlineImages(html, options, image_config) {
889
+ try {
890
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
891
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
892
+ const len0 = WASM_VECTOR_LEN;
893
+ let ptr1 = 0;
894
+ if (!isLikeNone(image_config)) {
895
+ _assertClass(image_config, WasmInlineImageConfig);
896
+ ptr1 = image_config.__destroy_into_raw();
897
+ }
898
+ wasm.convertWithInlineImages(retptr, ptr0, len0, addHeapObject(options), ptr1);
899
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
900
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
901
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
902
+ if (r2) {
903
+ throw takeObject(r1);
904
+ }
905
+ return WasmHtmlExtraction.__wrap(r0);
906
+ } finally {
907
+ wasm.__wbindgen_add_to_stack_pointer(16);
908
+ }
909
+ }
910
+
911
+ /**
912
+ * Convert HTML to Markdown with metadata extraction
913
+ *
914
+ * # Arguments
915
+ *
916
+ * * `html` - The HTML string to convert
917
+ * * `options` - Optional conversion options (as a JavaScript object)
918
+ * * `metadata_config` - Metadata extraction configuration
919
+ *
920
+ * # Returns
921
+ *
922
+ * JavaScript object with `markdown` (string) and `metadata` (object) fields
923
+ *
924
+ * # Example
925
+ *
926
+ * ```javascript
927
+ * import { convertWithMetadata, WasmMetadataConfig } from 'html-to-markdown-wasm';
928
+ *
929
+ * const html = '<h1>Hello World</h1><a href="https://example.com">Link</a>';
930
+ * const config = new WasmMetadataConfig();
931
+ * config.extractHeaders = true;
932
+ * config.extractLinks = true;
933
+ *
934
+ * const result = convertWithMetadata(html, null, config);
935
+ * console.log(result.markdown); // # Hello World\n\n[Link](https://example.com)
936
+ * console.log(result.metadata.headers); // [{ level: 1, text: "Hello World", ... }]
937
+ * console.log(result.metadata.links); // [{ href: "https://example.com", text: "Link", ... }]
938
+ * ```
939
+ * @param {string} html
940
+ * @param {WasmConversionOptions | null | undefined} [options]
941
+ * @param {WasmMetadataConfig | null} [metadata_config]
942
+ * @returns {Record<string, string>}
943
+ */
944
+ export function convertWithMetadata(html, options, metadata_config) {
945
+ try {
946
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
947
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
948
+ const len0 = WASM_VECTOR_LEN;
949
+ let ptr1 = 0;
950
+ if (!isLikeNone(metadata_config)) {
951
+ _assertClass(metadata_config, WasmMetadataConfig);
952
+ ptr1 = metadata_config.__destroy_into_raw();
953
+ }
954
+ wasm.convertWithMetadata(retptr, ptr0, len0, addHeapObject(options), ptr1);
955
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
956
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
957
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
958
+ if (r2) {
959
+ throw takeObject(r1);
960
+ }
961
+ return takeObject(r0);
962
+ } finally {
963
+ wasm.__wbindgen_add_to_stack_pointer(16);
964
+ }
965
+ }
966
+
967
+ /**
968
+ * @param {string} html
969
+ * @param {WasmConversionOptionsHandle} handle
970
+ * @returns {string}
971
+ */
972
+ export function convertWithOptionsHandle(html, handle) {
973
+ let deferred3_0;
974
+ let deferred3_1;
975
+ try {
976
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
977
+ const ptr0 = passStringToWasm0(html, wasm.__wbindgen_export, wasm.__wbindgen_export2);
978
+ const len0 = WASM_VECTOR_LEN;
979
+ _assertClass(handle, WasmConversionOptionsHandle);
980
+ wasm.convertWithOptionsHandle(retptr, ptr0, len0, handle.__wbg_ptr);
981
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
982
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
983
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
984
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
985
+ var ptr2 = r0;
986
+ var len2 = r1;
987
+ if (r3) {
988
+ ptr2 = 0; len2 = 0;
989
+ throw takeObject(r2);
990
+ }
991
+ deferred3_0 = ptr2;
992
+ deferred3_1 = len2;
993
+ return getStringFromWasm0(ptr2, len2);
994
+ } finally {
995
+ wasm.__wbindgen_add_to_stack_pointer(16);
996
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
997
+ }
998
+ }
999
+
1000
+ /**
1001
+ * @param {WasmConversionOptions | null | undefined} [options]
1002
+ * @returns {WasmConversionOptionsHandle}
1003
+ */
1004
+ export function createConversionOptionsHandle(options) {
1005
+ try {
1006
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1007
+ wasm.createConversionOptionsHandle(retptr, addHeapObject(options));
1008
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1009
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1010
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1011
+ if (r2) {
1012
+ throw takeObject(r1);
1013
+ }
1014
+ return WasmConversionOptionsHandle.__wrap(r0);
1015
+ } finally {
1016
+ wasm.__wbindgen_add_to_stack_pointer(16);
1017
+ }
1018
+ }
1019
+
1020
+ /**
1021
+ * Initialize panic hook for better error messages in the browser
1022
+ */
1023
+ export function init() {
1024
+ wasm.init();
1025
+ }
1026
+
1027
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
1028
+
1029
+ async function __wbg_load(module, imports) {
1030
+ if (typeof Response === 'function' && module instanceof Response) {
1031
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1032
+ try {
1033
+ return await WebAssembly.instantiateStreaming(module, imports);
1034
+ } catch (e) {
1035
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
1036
+
1037
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1038
+ 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);
1039
+
1040
+ } else {
1041
+ throw e;
1042
+ }
1043
+ }
1044
+ }
1045
+
1046
+ const bytes = await module.arrayBuffer();
1047
+ return await WebAssembly.instantiate(bytes, imports);
1048
+ } else {
1049
+ const instance = await WebAssembly.instantiate(module, imports);
1050
+
1051
+ if (instance instanceof WebAssembly.Instance) {
1052
+ return { instance, module };
1053
+ } else {
1054
+ return instance;
1055
+ }
1056
+ }
1057
+ }
1058
+
1059
+ function __wbg_get_imports() {
1060
+ const imports = {};
1061
+ imports.wbg = {};
1062
+ imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
1063
+ const ret = Error(getStringFromWasm0(arg0, arg1));
1064
+ return addHeapObject(ret);
1065
+ };
1066
+ imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) {
1067
+ const ret = Number(getObject(arg0));
1068
+ return ret;
1069
+ };
1070
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
1071
+ const ret = String(getObject(arg1));
1072
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1073
+ const len1 = WASM_VECTOR_LEN;
1074
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1075
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1076
+ };
1077
+ imports.wbg.__wbg___wbindgen_bigint_get_as_i64_6e32f5e6aff02e1d = function(arg0, arg1) {
1078
+ const v = getObject(arg1);
1079
+ const ret = typeof(v) === 'bigint' ? v : undefined;
1080
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1081
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1082
+ };
1083
+ imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
1084
+ const v = getObject(arg0);
1085
+ const ret = typeof(v) === 'boolean' ? v : undefined;
1086
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1087
+ };
1088
+ imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
1089
+ const ret = debugString(getObject(arg1));
1090
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1091
+ const len1 = WASM_VECTOR_LEN;
1092
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1093
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1094
+ };
1095
+ imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
1096
+ const ret = getObject(arg0) in getObject(arg1);
1097
+ return ret;
1098
+ };
1099
+ imports.wbg.__wbg___wbindgen_is_bigint_0e1a2e3f55cfae27 = function(arg0) {
1100
+ const ret = typeof(getObject(arg0)) === 'bigint';
1101
+ return ret;
1102
+ };
1103
+ imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
1104
+ const ret = typeof(getObject(arg0)) === 'function';
1105
+ return ret;
1106
+ };
1107
+ imports.wbg.__wbg___wbindgen_is_null_dfda7d66506c95b5 = function(arg0) {
1108
+ const ret = getObject(arg0) === null;
1109
+ return ret;
1110
+ };
1111
+ imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
1112
+ const val = getObject(arg0);
1113
+ const ret = typeof(val) === 'object' && val !== null;
1114
+ return ret;
1115
+ };
1116
+ imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
1117
+ const ret = typeof(getObject(arg0)) === 'string';
1118
+ return ret;
1119
+ };
1120
+ imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
1121
+ const ret = getObject(arg0) === undefined;
1122
+ return ret;
1123
+ };
1124
+ imports.wbg.__wbg___wbindgen_jsval_eq_b6101cc9cef1fe36 = function(arg0, arg1) {
1125
+ const ret = getObject(arg0) === getObject(arg1);
1126
+ return ret;
1127
+ };
1128
+ imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
1129
+ const ret = getObject(arg0) == getObject(arg1);
1130
+ return ret;
1131
+ };
1132
+ imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
1133
+ const obj = getObject(arg1);
1134
+ const ret = typeof(obj) === 'number' ? obj : undefined;
1135
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1136
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1137
+ };
1138
+ imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
1139
+ const obj = getObject(arg1);
1140
+ const ret = typeof(obj) === 'string' ? obj : undefined;
1141
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1142
+ var len1 = WASM_VECTOR_LEN;
1143
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1144
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1145
+ };
1146
+ imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
1147
+ throw new Error(getStringFromWasm0(arg0, arg1));
1148
+ };
1149
+ imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
1150
+ const ret = getObject(arg0).call(getObject(arg1));
1151
+ return addHeapObject(ret);
1152
+ }, arguments) };
1153
+ imports.wbg.__wbg_codePointAt_6fd4439a1e465afd = function(arg0, arg1) {
1154
+ const ret = getObject(arg0).codePointAt(arg1 >>> 0);
1155
+ return addHeapObject(ret);
1156
+ };
1157
+ imports.wbg.__wbg_done_62ea16af4ce34b24 = function(arg0) {
1158
+ const ret = getObject(arg0).done;
1159
+ return ret;
1160
+ };
1161
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
1162
+ let deferred0_0;
1163
+ let deferred0_1;
1164
+ try {
1165
+ deferred0_0 = arg0;
1166
+ deferred0_1 = arg1;
1167
+ console.error(getStringFromWasm0(arg0, arg1));
1168
+ } finally {
1169
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
1170
+ }
1171
+ };
1172
+ imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
1173
+ const ret = getObject(arg0)[arg1 >>> 0];
1174
+ return addHeapObject(ret);
1175
+ };
1176
+ imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
1177
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
1178
+ return addHeapObject(ret);
1179
+ }, arguments) };
1180
+ imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
1181
+ const ret = getObject(arg0)[getObject(arg1)];
1182
+ return addHeapObject(ret);
1183
+ };
1184
+ imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
1185
+ let result;
1186
+ try {
1187
+ result = getObject(arg0) instanceof ArrayBuffer;
1188
+ } catch (_) {
1189
+ result = false;
1190
+ }
1191
+ const ret = result;
1192
+ return ret;
1193
+ };
1194
+ imports.wbg.__wbg_instanceof_Object_577e21051f7bcb79 = function(arg0) {
1195
+ let result;
1196
+ try {
1197
+ result = getObject(arg0) instanceof Object;
1198
+ } catch (_) {
1199
+ result = false;
1200
+ }
1201
+ const ret = result;
1202
+ return ret;
1203
+ };
1204
+ imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
1205
+ let result;
1206
+ try {
1207
+ result = getObject(arg0) instanceof Uint8Array;
1208
+ } catch (_) {
1209
+ result = false;
1210
+ }
1211
+ const ret = result;
1212
+ return ret;
1213
+ };
1214
+ imports.wbg.__wbg_isArray_51fd9e6422c0a395 = function(arg0) {
1215
+ const ret = Array.isArray(getObject(arg0));
1216
+ return ret;
1217
+ };
1218
+ imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
1219
+ const ret = Number.isSafeInteger(getObject(arg0));
1220
+ return ret;
1221
+ };
1222
+ imports.wbg.__wbg_iterator_27b7c8b35ab3e86b = function() {
1223
+ const ret = Symbol.iterator;
1224
+ return addHeapObject(ret);
1225
+ };
1226
+ imports.wbg.__wbg_keys_f5c6002ff150fc6c = function(arg0) {
1227
+ const ret = Object.keys(getObject(arg0));
1228
+ return addHeapObject(ret);
1229
+ };
1230
+ imports.wbg.__wbg_length_1f83b8e5895c84aa = function(arg0) {
1231
+ const ret = getObject(arg0).length;
1232
+ return ret;
1233
+ };
1234
+ imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
1235
+ const ret = getObject(arg0).length;
1236
+ return ret;
1237
+ };
1238
+ imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
1239
+ const ret = getObject(arg0).length;
1240
+ return ret;
1241
+ };
1242
+ imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
1243
+ const ret = new Object();
1244
+ return addHeapObject(ret);
1245
+ };
1246
+ imports.wbg.__wbg_new_25f239778d6112b9 = function() {
1247
+ const ret = new Array();
1248
+ return addHeapObject(ret);
1249
+ };
1250
+ imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
1251
+ const ret = new Uint8Array(getObject(arg0));
1252
+ return addHeapObject(ret);
1253
+ };
1254
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
1255
+ const ret = new Error();
1256
+ return addHeapObject(ret);
1257
+ };
1258
+ imports.wbg.__wbg_new_b546ae120718850e = function() {
1259
+ const ret = new Map();
1260
+ return addHeapObject(ret);
1261
+ };
1262
+ imports.wbg.__wbg_new_from_slice_f9c22b9153b26992 = function(arg0, arg1) {
1263
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1264
+ return addHeapObject(ret);
1265
+ };
1266
+ imports.wbg.__wbg_next_138a17bbf04e926c = function(arg0) {
1267
+ const ret = getObject(arg0).next;
1268
+ return addHeapObject(ret);
1269
+ };
1270
+ imports.wbg.__wbg_next_3cfe5c0fe2a4cc53 = function() { return handleError(function (arg0) {
1271
+ const ret = getObject(arg0).next();
1272
+ return addHeapObject(ret);
1273
+ }, arguments) };
1274
+ imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
1275
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1276
+ };
1277
+ imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
1278
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1279
+ };
1280
+ imports.wbg.__wbg_set_781438a03c0c3c81 = function() { return handleError(function (arg0, arg1, arg2) {
1281
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1282
+ return ret;
1283
+ }, arguments) };
1284
+ imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
1285
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1286
+ };
1287
+ imports.wbg.__wbg_set_efaaf145b9377369 = function(arg0, arg1, arg2) {
1288
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
1289
+ return addHeapObject(ret);
1290
+ };
1291
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
1292
+ const ret = getObject(arg1).stack;
1293
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1294
+ const len1 = WASM_VECTOR_LEN;
1295
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1296
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1297
+ };
1298
+ imports.wbg.__wbg_value_57b7b035e117f7ee = function(arg0) {
1299
+ const ret = getObject(arg0).value;
1300
+ return addHeapObject(ret);
1301
+ };
1302
+ imports.wbg.__wbg_wasminlineimage_new = function(arg0) {
1303
+ const ret = WasmInlineImage.__wrap(arg0);
1304
+ return addHeapObject(ret);
1305
+ };
1306
+ imports.wbg.__wbg_wasminlineimagewarning_new = function(arg0) {
1307
+ const ret = WasmInlineImageWarning.__wrap(arg0);
1308
+ return addHeapObject(ret);
1309
+ };
1310
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1311
+ // Cast intrinsic for `Ref(String) -> Externref`.
1312
+ const ret = getStringFromWasm0(arg0, arg1);
1313
+ return addHeapObject(ret);
1314
+ };
1315
+ imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
1316
+ // Cast intrinsic for `U64 -> Externref`.
1317
+ const ret = BigInt.asUintN(64, arg0);
1318
+ return addHeapObject(ret);
1319
+ };
1320
+ imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1321
+ // Cast intrinsic for `F64 -> Externref`.
1322
+ const ret = arg0;
1323
+ return addHeapObject(ret);
1324
+ };
1325
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
1326
+ const ret = getObject(arg0);
1327
+ return addHeapObject(ret);
1328
+ };
1329
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
1330
+ takeObject(arg0);
1331
+ };
1332
+
1333
+ return imports;
1334
+ }
1335
+
1336
+ function __wbg_finalize_init(instance, module) {
1337
+ wasm = instance.exports;
1338
+ __wbg_init.__wbindgen_wasm_module = module;
1339
+ cachedDataViewMemory0 = null;
1340
+ cachedUint32ArrayMemory0 = null;
1341
+ cachedUint8ArrayMemory0 = null;
1342
+
1343
+
1344
+ wasm.__wbindgen_start();
1345
+ return wasm;
1346
+ }
1347
+
1348
+ function initSync(module) {
1349
+ if (wasm !== undefined) return wasm;
1350
+
1351
+
1352
+ if (typeof module !== 'undefined') {
1353
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1354
+ ({module} = module)
1355
+ } else {
1356
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1357
+ }
1358
+ }
1359
+
1360
+ const imports = __wbg_get_imports();
1361
+ if (!(module instanceof WebAssembly.Module)) {
1362
+ module = new WebAssembly.Module(module);
1363
+ }
1364
+ const instance = new WebAssembly.Instance(module, imports);
1365
+ return __wbg_finalize_init(instance, module);
1366
+ }
1367
+
1368
+ async function __wbg_init(module_or_path) {
1369
+ if (wasm !== undefined) return wasm;
1370
+
1371
+
1372
+ if (typeof module_or_path !== 'undefined') {
1373
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1374
+ ({module_or_path} = module_or_path)
1375
+ } else {
1376
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1377
+ }
1378
+ }
1379
+
1380
+ if (typeof module_or_path === 'undefined') {
1381
+ module_or_path = new URL('html_to_markdown_wasm_bg.wasm', import.meta.url);
1382
+ }
1383
+ const imports = __wbg_get_imports();
1384
+
1385
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1386
+ module_or_path = fetch(module_or_path);
1387
+ }
1388
+
1389
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1390
+
1391
+ return __wbg_finalize_init(instance, module);
1392
+ }
1393
+
1394
+ export { initSync };
1395
+ export default __wbg_init;