@benrogmans/lemma-engine 0.8.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lemma.js CHANGED
@@ -1,1220 +1,23 @@
1
- /* @ts-self-types="./lemma.d.ts" */
2
- import { bytes_literal } from './snippets/wasm-streams-42e57edbcd526312/inline0.js';
3
-
4
- export class IntoUnderlyingByteSource {
5
- __destroy_into_raw() {
6
- const ptr = this.__wbg_ptr;
7
- this.__wbg_ptr = 0;
8
- IntoUnderlyingByteSourceFinalization.unregister(this);
9
- return ptr;
10
- }
11
- free() {
12
- const ptr = this.__destroy_into_raw();
13
- wasm.__wbg_intounderlyingbytesource_free(ptr, 0);
14
- }
15
- /**
16
- * @returns {number}
17
- */
18
- get autoAllocateChunkSize() {
19
- const ret = wasm.intounderlyingbytesource_autoAllocateChunkSize(this.__wbg_ptr);
20
- return ret >>> 0;
21
- }
22
- cancel() {
23
- const ptr = this.__destroy_into_raw();
24
- wasm.intounderlyingbytesource_cancel(ptr);
25
- }
26
- /**
27
- * @param {any} controller
28
- * @returns {Promise<any>}
29
- */
30
- pull(controller) {
31
- const ret = wasm.intounderlyingbytesource_pull(this.__wbg_ptr, addHeapObject(controller));
32
- return takeObject(ret);
33
- }
34
- /**
35
- * @param {any} controller
36
- */
37
- start(controller) {
38
- wasm.intounderlyingbytesource_start(this.__wbg_ptr, addHeapObject(controller));
39
- }
40
- /**
41
- * @returns {any}
42
- */
43
- get type() {
44
- const ret = wasm.intounderlyingbytesource_type(this.__wbg_ptr);
45
- return takeObject(ret);
46
- }
47
- }
48
- if (Symbol.dispose) IntoUnderlyingByteSource.prototype[Symbol.dispose] = IntoUnderlyingByteSource.prototype.free;
49
-
50
- export class IntoUnderlyingSink {
51
- __destroy_into_raw() {
52
- const ptr = this.__wbg_ptr;
53
- this.__wbg_ptr = 0;
54
- IntoUnderlyingSinkFinalization.unregister(this);
55
- return ptr;
56
- }
57
- free() {
58
- const ptr = this.__destroy_into_raw();
59
- wasm.__wbg_intounderlyingsink_free(ptr, 0);
60
- }
61
- /**
62
- * @param {any} reason
63
- * @returns {Promise<any>}
64
- */
65
- abort(reason) {
66
- const ptr = this.__destroy_into_raw();
67
- const ret = wasm.intounderlyingsink_abort(ptr, addHeapObject(reason));
68
- return takeObject(ret);
69
- }
70
- /**
71
- * @returns {Promise<any>}
72
- */
73
- close() {
74
- const ptr = this.__destroy_into_raw();
75
- const ret = wasm.intounderlyingsink_close(ptr);
76
- return takeObject(ret);
77
- }
78
- /**
79
- * @param {any} chunk
80
- * @returns {Promise<any>}
81
- */
82
- write(chunk) {
83
- const ret = wasm.intounderlyingsink_write(this.__wbg_ptr, addHeapObject(chunk));
84
- return takeObject(ret);
85
- }
86
- }
87
- if (Symbol.dispose) IntoUnderlyingSink.prototype[Symbol.dispose] = IntoUnderlyingSink.prototype.free;
88
-
89
- export class IntoUnderlyingSource {
90
- __destroy_into_raw() {
91
- const ptr = this.__wbg_ptr;
92
- this.__wbg_ptr = 0;
93
- IntoUnderlyingSourceFinalization.unregister(this);
94
- return ptr;
95
- }
96
- free() {
97
- const ptr = this.__destroy_into_raw();
98
- wasm.__wbg_intounderlyingsource_free(ptr, 0);
99
- }
100
- cancel() {
101
- const ptr = this.__destroy_into_raw();
102
- wasm.intounderlyingsource_cancel(ptr);
103
- }
104
- /**
105
- * @param {any} controller
106
- * @returns {Promise<any>}
107
- */
108
- pull(controller) {
109
- const ret = wasm.intounderlyingsource_pull(this.__wbg_ptr, addHeapObject(controller));
110
- return takeObject(ret);
111
- }
112
- }
113
- if (Symbol.dispose) IntoUnderlyingSource.prototype[Symbol.dispose] = IntoUnderlyingSource.prototype.free;
114
-
115
1
  /**
116
- * Raw options for [`pipeTo()`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/pipeTo).
2
+ * @benrogmans/lemma-engine public entry.
3
+ * Glue: lemma.bindings.js (wasm-pack output, renamed by build).
117
4
  */
118
- export class PipeOptions {
119
- __destroy_into_raw() {
120
- const ptr = this.__wbg_ptr;
121
- this.__wbg_ptr = 0;
122
- PipeOptionsFinalization.unregister(this);
123
- return ptr;
124
- }
125
- free() {
126
- const ptr = this.__destroy_into_raw();
127
- wasm.__wbg_pipeoptions_free(ptr, 0);
128
- }
129
- /**
130
- * @returns {boolean}
131
- */
132
- get preventAbort() {
133
- const ret = wasm.pipeoptions_preventAbort(this.__wbg_ptr);
134
- return ret !== 0;
135
- }
136
- /**
137
- * @returns {boolean}
138
- */
139
- get preventCancel() {
140
- const ret = wasm.pipeoptions_preventCancel(this.__wbg_ptr);
141
- return ret !== 0;
142
- }
143
- /**
144
- * @returns {boolean}
145
- */
146
- get preventClose() {
147
- const ret = wasm.pipeoptions_preventClose(this.__wbg_ptr);
148
- return ret !== 0;
149
- }
150
- /**
151
- * @returns {AbortSignal | undefined}
152
- */
153
- get signal() {
154
- const ret = wasm.pipeoptions_signal(this.__wbg_ptr);
155
- return takeObject(ret);
156
- }
157
- }
158
- if (Symbol.dispose) PipeOptions.prototype[Symbol.dispose] = PipeOptions.prototype.free;
159
-
160
- export class QueuingStrategy {
161
- __destroy_into_raw() {
162
- const ptr = this.__wbg_ptr;
163
- this.__wbg_ptr = 0;
164
- QueuingStrategyFinalization.unregister(this);
165
- return ptr;
166
- }
167
- free() {
168
- const ptr = this.__destroy_into_raw();
169
- wasm.__wbg_queuingstrategy_free(ptr, 0);
170
- }
171
- /**
172
- * @returns {number}
173
- */
174
- get highWaterMark() {
175
- const ret = wasm.queuingstrategy_highWaterMark(this.__wbg_ptr);
176
- return ret;
177
- }
178
- }
179
- if (Symbol.dispose) QueuingStrategy.prototype[Symbol.dispose] = QueuingStrategy.prototype.free;
180
-
181
- /**
182
- * Raw options for [`getReader()`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/getReader).
183
- */
184
- export class ReadableStreamGetReaderOptions {
185
- __destroy_into_raw() {
186
- const ptr = this.__wbg_ptr;
187
- this.__wbg_ptr = 0;
188
- ReadableStreamGetReaderOptionsFinalization.unregister(this);
189
- return ptr;
190
- }
191
- free() {
192
- const ptr = this.__destroy_into_raw();
193
- wasm.__wbg_readablestreamgetreaderoptions_free(ptr, 0);
194
- }
195
- /**
196
- * @returns {ReadableStreamReaderMode}
197
- */
198
- get mode() {
199
- const ret = wasm.readablestreamgetreaderoptions_mode(this.__wbg_ptr);
200
- return __wbindgen_enum_ReadableStreamReaderMode[ret];
201
- }
202
- }
203
- if (Symbol.dispose) ReadableStreamGetReaderOptions.prototype[Symbol.dispose] = ReadableStreamGetReaderOptions.prototype.free;
204
-
205
- export class ServerConfig {
206
- __destroy_into_raw() {
207
- const ptr = this.__wbg_ptr;
208
- this.__wbg_ptr = 0;
209
- ServerConfigFinalization.unregister(this);
210
- return ptr;
211
- }
212
- free() {
213
- const ptr = this.__destroy_into_raw();
214
- wasm.__wbg_serverconfig_free(ptr, 0);
215
- }
216
- /**
217
- * @param {AsyncIterator<any>} into_server
218
- * @param {WritableStream} from_server
219
- */
220
- constructor(into_server, from_server) {
221
- const ret = wasm.serverconfig_new(addHeapObject(into_server), addHeapObject(from_server));
222
- this.__wbg_ptr = ret >>> 0;
223
- ServerConfigFinalization.register(this, this.__wbg_ptr, this);
224
- return this;
225
- }
226
- }
227
- if (Symbol.dispose) ServerConfig.prototype[Symbol.dispose] = ServerConfig.prototype.free;
228
-
229
- export class WasmEngine {
230
- __destroy_into_raw() {
231
- const ptr = this.__wbg_ptr;
232
- this.__wbg_ptr = 0;
233
- WasmEngineFinalization.unregister(this);
234
- return ptr;
235
- }
236
- free() {
237
- const ptr = this.__destroy_into_raw();
238
- wasm.__wbg_wasmengine_free(ptr, 0);
239
- }
240
- /**
241
- * @param {string} code
242
- * @param {string} source
243
- * @returns {Promise<any>}
244
- */
245
- addLemmaFile(code, source) {
246
- const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
247
- const len0 = WASM_VECTOR_LEN;
248
- const ptr1 = passStringToWasm0(source, wasm.__wbindgen_export, wasm.__wbindgen_export2);
249
- const len1 = WASM_VECTOR_LEN;
250
- const ret = wasm.wasmengine_addLemmaFile(this.__wbg_ptr, ptr0, len0, ptr1, len1);
251
- return takeObject(ret);
252
- }
253
- /**
254
- * Evaluate at current time.
255
- * @param {string} spec_name
256
- * @param {string} hash
257
- * @param {string} rule_names_json
258
- * @param {string} fact_values_json
259
- * @returns {string}
260
- */
261
- evaluate(spec_name, hash, rule_names_json, fact_values_json) {
262
- let deferred5_0;
263
- let deferred5_1;
264
- try {
265
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
266
- const ptr0 = passStringToWasm0(spec_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
267
- const len0 = WASM_VECTOR_LEN;
268
- const ptr1 = passStringToWasm0(hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
269
- const len1 = WASM_VECTOR_LEN;
270
- const ptr2 = passStringToWasm0(rule_names_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
271
- const len2 = WASM_VECTOR_LEN;
272
- const ptr3 = passStringToWasm0(fact_values_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
273
- const len3 = WASM_VECTOR_LEN;
274
- wasm.wasmengine_evaluate(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
275
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
276
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
277
- deferred5_0 = r0;
278
- deferred5_1 = r1;
279
- return getStringFromWasm0(r0, r1);
280
- } finally {
281
- wasm.__wbindgen_add_to_stack_pointer(16);
282
- wasm.__wbindgen_export4(deferred5_0, deferred5_1, 1);
283
- }
284
- }
285
- /**
286
- * Evaluate at a specific datetime.
287
- * @param {string} spec_name
288
- * @param {string} effective
289
- * @param {string} hash
290
- * @param {string} rule_names_json
291
- * @param {string} fact_values_json
292
- * @returns {string}
293
- */
294
- evaluateEffective(spec_name, effective, hash, rule_names_json, fact_values_json) {
295
- let deferred6_0;
296
- let deferred6_1;
297
- try {
298
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
299
- const ptr0 = passStringToWasm0(spec_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
300
- const len0 = WASM_VECTOR_LEN;
301
- const ptr1 = passStringToWasm0(effective, wasm.__wbindgen_export, wasm.__wbindgen_export2);
302
- const len1 = WASM_VECTOR_LEN;
303
- const ptr2 = passStringToWasm0(hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
304
- const len2 = WASM_VECTOR_LEN;
305
- const ptr3 = passStringToWasm0(rule_names_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
306
- const len3 = WASM_VECTOR_LEN;
307
- const ptr4 = passStringToWasm0(fact_values_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
308
- const len4 = WASM_VECTOR_LEN;
309
- wasm.wasmengine_evaluateEffective(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4);
310
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
311
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
312
- deferred6_0 = r0;
313
- deferred6_1 = r1;
314
- return getStringFromWasm0(r0, r1);
315
- } finally {
316
- wasm.__wbindgen_add_to_stack_pointer(16);
317
- wasm.__wbindgen_export4(deferred6_0, deferred6_1, 1);
318
- }
319
- }
320
- /**
321
- * @param {string} code
322
- * @param {string} source_attribute
323
- * @returns {string}
324
- */
325
- formatSource(code, source_attribute) {
326
- let deferred3_0;
327
- let deferred3_1;
328
- try {
329
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
330
- const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
331
- const len0 = WASM_VECTOR_LEN;
332
- const ptr1 = passStringToWasm0(source_attribute, wasm.__wbindgen_export, wasm.__wbindgen_export2);
333
- const len1 = WASM_VECTOR_LEN;
334
- wasm.wasmengine_formatSource(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
335
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
336
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
337
- deferred3_0 = r0;
338
- deferred3_1 = r1;
339
- return getStringFromWasm0(r0, r1);
340
- } finally {
341
- wasm.__wbindgen_add_to_stack_pointer(16);
342
- wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
343
- }
344
- }
345
- /**
346
- * Schema at current time.
347
- * @param {string} spec_name
348
- * @param {string} rule_names_json
349
- * @returns {string}
350
- */
351
- getSchema(spec_name, rule_names_json) {
352
- let deferred3_0;
353
- let deferred3_1;
354
- try {
355
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
356
- const ptr0 = passStringToWasm0(spec_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
357
- const len0 = WASM_VECTOR_LEN;
358
- const ptr1 = passStringToWasm0(rule_names_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
359
- const len1 = WASM_VECTOR_LEN;
360
- wasm.wasmengine_getSchema(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
361
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
362
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
363
- deferred3_0 = r0;
364
- deferred3_1 = r1;
365
- return getStringFromWasm0(r0, r1);
366
- } finally {
367
- wasm.__wbindgen_add_to_stack_pointer(16);
368
- wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
369
- }
370
- }
371
- /**
372
- * Schema at a specific datetime.
373
- * @param {string} spec_name
374
- * @param {string} effective
375
- * @param {string} rule_names_json
376
- * @returns {string}
377
- */
378
- getSchemaEffective(spec_name, effective, rule_names_json) {
379
- let deferred4_0;
380
- let deferred4_1;
381
- try {
382
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
383
- const ptr0 = passStringToWasm0(spec_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
384
- const len0 = WASM_VECTOR_LEN;
385
- const ptr1 = passStringToWasm0(effective, wasm.__wbindgen_export, wasm.__wbindgen_export2);
386
- const len1 = WASM_VECTOR_LEN;
387
- const ptr2 = passStringToWasm0(rule_names_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
388
- const len2 = WASM_VECTOR_LEN;
389
- wasm.wasmengine_getSchemaEffective(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
390
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
391
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
392
- deferred4_0 = r0;
393
- deferred4_1 = r1;
394
- return getStringFromWasm0(r0, r1);
395
- } finally {
396
- wasm.__wbindgen_add_to_stack_pointer(16);
397
- wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
398
- }
399
- }
400
- /**
401
- * @param {string} _spec_name
402
- * @param {string} _rule_name
403
- * @param {string} _target_json
404
- * @param {string} _provided_values_json
405
- * @returns {string}
406
- */
407
- invert(_spec_name, _rule_name, _target_json, _provided_values_json) {
408
- let deferred5_0;
409
- let deferred5_1;
410
- try {
411
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
412
- const ptr0 = passStringToWasm0(_spec_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
413
- const len0 = WASM_VECTOR_LEN;
414
- const ptr1 = passStringToWasm0(_rule_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
415
- const len1 = WASM_VECTOR_LEN;
416
- const ptr2 = passStringToWasm0(_target_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
417
- const len2 = WASM_VECTOR_LEN;
418
- const ptr3 = passStringToWasm0(_provided_values_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
419
- const len3 = WASM_VECTOR_LEN;
420
- wasm.wasmengine_invert(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
421
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
422
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
423
- deferred5_0 = r0;
424
- deferred5_1 = r1;
425
- return getStringFromWasm0(r0, r1);
426
- } finally {
427
- wasm.__wbindgen_add_to_stack_pointer(16);
428
- wasm.__wbindgen_export4(deferred5_0, deferred5_1, 1);
429
- }
430
- }
431
- /**
432
- * @returns {string}
433
- */
434
- listSpecs() {
435
- let deferred1_0;
436
- let deferred1_1;
437
- try {
438
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
439
- wasm.wasmengine_listSpecs(retptr, this.__wbg_ptr);
440
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
441
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
442
- deferred1_0 = r0;
443
- deferred1_1 = r1;
444
- return getStringFromWasm0(r0, r1);
445
- } finally {
446
- wasm.__wbindgen_add_to_stack_pointer(16);
447
- wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
448
- }
449
- }
450
- constructor() {
451
- const ret = wasm.wasmengine_new();
452
- this.__wbg_ptr = ret >>> 0;
453
- WasmEngineFinalization.register(this, this.__wbg_ptr, this);
454
- return this;
455
- }
456
- }
457
- if (Symbol.dispose) WasmEngine.prototype[Symbol.dispose] = WasmEngine.prototype.free;
458
-
459
- /**
460
- * Run the Lemma LSP over the given streams. Call from JS after creating
461
- * an AsyncIterator (client → server messages) and a WritableStream (server → client).
462
- * @param {ServerConfig} config
463
- * @returns {Promise<void>}
464
- */
465
- export function serve(config) {
466
- _assertClass(config, ServerConfig);
467
- var ptr0 = config.__destroy_into_raw();
468
- const ret = wasm.serve(ptr0);
469
- return takeObject(ret);
470
- }
471
-
472
- function __wbg_get_imports() {
473
- const import0 = {
474
- __proto__: null,
475
- __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
476
- const ret = debugString(getObject(arg1));
477
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
478
- const len1 = WASM_VECTOR_LEN;
479
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
480
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
481
- },
482
- __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
483
- const ret = typeof(getObject(arg0)) === 'function';
484
- return ret;
485
- },
486
- __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
487
- const val = getObject(arg0);
488
- const ret = typeof(val) === 'object' && val !== null;
489
- return ret;
490
- },
491
- __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
492
- const ret = getObject(arg0) === undefined;
493
- return ret;
494
- },
495
- __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
496
- const obj = getObject(arg1);
497
- const ret = typeof(obj) === 'string' ? obj : undefined;
498
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
499
- var len1 = WASM_VECTOR_LEN;
500
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
501
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
502
- },
503
- __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
504
- throw new Error(getStringFromWasm0(arg0, arg1));
505
- },
506
- __wbg__wbg_cb_unref_6b5b6b8576d35cb1: function(arg0) {
507
- getObject(arg0)._wbg_cb_unref();
508
- },
509
- __wbg_buffer_e0851da9dee8b991: function(arg0) {
510
- const ret = getObject(arg0).buffer;
511
- return addHeapObject(ret);
512
- },
513
- __wbg_byobRequest_b7b7dc91511df816: function(arg0) {
514
- const ret = getObject(arg0).byobRequest;
515
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
516
- },
517
- __wbg_byteLength_811fef9e08eaa78e: function(arg0) {
518
- const ret = getObject(arg0).byteLength;
519
- return ret;
520
- },
521
- __wbg_byteOffset_ea230546a0297033: function(arg0) {
522
- const ret = getObject(arg0).byteOffset;
523
- return ret;
524
- },
525
- __wbg_bytes_literal_e5a87f6707f097d2: function() {
526
- const ret = bytes_literal();
527
- return addHeapObject(ret);
528
- },
529
- __wbg_call_2d781c1f4d5c0ef8: function() { return handleError(function (arg0, arg1, arg2) {
530
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
531
- return addHeapObject(ret);
532
- }, arguments); },
533
- __wbg_close_45c653345d40a7e8: function(arg0) {
534
- const ret = getObject(arg0).close();
535
- return addHeapObject(ret);
536
- },
537
- __wbg_close_7a687d357ff8e0e0: function(arg0) {
538
- getObject(arg0).close();
539
- },
540
- __wbg_close_8d217f4c57faede7: function(arg0) {
541
- getObject(arg0).close();
542
- },
543
- __wbg_done_08ce71ee07e3bd17: function(arg0) {
544
- const ret = getObject(arg0).done;
545
- return ret;
546
- },
547
- __wbg_enqueue_74e7ffeb3e67888a: function(arg0, arg1) {
548
- getObject(arg0).enqueue(getObject(arg1));
549
- },
550
- __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
551
- let deferred0_0;
552
- let deferred0_1;
553
- try {
554
- deferred0_0 = arg0;
555
- deferred0_1 = arg1;
556
- console.error(getStringFromWasm0(arg0, arg1));
557
- } finally {
558
- wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
559
- }
560
- },
561
- __wbg_fetch_8d9b732df7467c44: function(arg0) {
562
- const ret = fetch(getObject(arg0));
563
- return addHeapObject(ret);
564
- },
565
- __wbg_getTime_1dad7b5386ddd2d9: function(arg0) {
566
- const ret = getObject(arg0).getTime();
567
- return ret;
568
- },
569
- __wbg_getTimezoneOffset_639bcf2dde21158b: function(arg0) {
570
- const ret = getObject(arg0).getTimezoneOffset();
571
- return ret;
572
- },
573
- __wbg_getWriter_149120e35db2c28d: function() { return handleError(function (arg0) {
574
- const ret = getObject(arg0).getWriter();
575
- return addHeapObject(ret);
576
- }, arguments); },
577
- __wbg_instanceof_Error_4691a5b466e32a80: function(arg0) {
578
- let result;
579
- try {
580
- result = getObject(arg0) instanceof Error;
581
- } catch (_) {
582
- result = false;
583
- }
584
- const ret = result;
585
- return ret;
586
- },
587
- __wbg_instanceof_Response_9b4d9fd451e051b1: function(arg0) {
588
- let result;
589
- try {
590
- result = getObject(arg0) instanceof Response;
591
- } catch (_) {
592
- result = false;
593
- }
594
- const ret = result;
595
- return ret;
596
- },
597
- __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
598
- let result;
599
- try {
600
- result = getObject(arg0) instanceof Uint8Array;
601
- } catch (_) {
602
- result = false;
603
- }
604
- const ret = result;
605
- return ret;
606
- },
607
- __wbg_length_ea16607d7b61445b: function(arg0) {
608
- const ret = getObject(arg0).length;
609
- return ret;
610
- },
611
- __wbg_message_00d63f20c41713dd: function(arg0) {
612
- const ret = getObject(arg0).message;
613
- return addHeapObject(ret);
614
- },
615
- __wbg_name_ecf53d5e050a495d: function(arg0) {
616
- const ret = getObject(arg0).name;
617
- return addHeapObject(ret);
618
- },
619
- __wbg_new_0837727332ac86ba: function() { return handleError(function () {
620
- const ret = new Headers();
621
- return addHeapObject(ret);
622
- }, arguments); },
623
- __wbg_new_0_1dcafdf5e786e876: function() {
624
- const ret = new Date();
625
- return addHeapObject(ret);
626
- },
627
- __wbg_new_227d7c05414eb861: function() {
628
- const ret = new Error();
629
- return addHeapObject(ret);
630
- },
631
- __wbg_new_5415f704ce1c4eda: function() { return handleError(function () {
632
- const ret = new URLSearchParams();
633
- return addHeapObject(ret);
634
- }, arguments); },
635
- __wbg_new_ab79df5bd7c26067: function() {
636
- const ret = new Object();
637
- return addHeapObject(ret);
638
- },
639
- __wbg_new_bb1018d527df73cb: function() { return handleError(function (arg0, arg1) {
640
- const ret = new URL(getStringFromWasm0(arg0, arg1));
641
- return addHeapObject(ret);
642
- }, arguments); },
643
- __wbg_new_d15cb560a6a0e5f0: function(arg0, arg1) {
644
- const ret = new Error(getStringFromWasm0(arg0, arg1));
645
- return addHeapObject(ret);
646
- },
647
- __wbg_new_fd94ca5c9639abd2: function(arg0) {
648
- const ret = new Date(getObject(arg0));
649
- return addHeapObject(ret);
650
- },
651
- __wbg_new_from_slice_22da9388ac046e50: function(arg0, arg1) {
652
- const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
653
- return addHeapObject(ret);
654
- },
655
- __wbg_new_typed_aaaeaf29cf802876: function(arg0, arg1) {
656
- try {
657
- var state0 = {a: arg0, b: arg1};
658
- var cb0 = (arg0, arg1) => {
659
- const a = state0.a;
660
- state0.a = 0;
661
- try {
662
- return __wasm_bindgen_func_elem_10458(a, state0.b, arg0, arg1);
663
- } finally {
664
- state0.a = a;
665
- }
666
- };
667
- const ret = new Promise(cb0);
668
- return addHeapObject(ret);
669
- } finally {
670
- state0.a = state0.b = 0;
671
- }
672
- },
673
- __wbg_new_with_byte_offset_and_length_b2ec5bf7b2f35743: function(arg0, arg1, arg2) {
674
- const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0);
675
- return addHeapObject(ret);
676
- },
677
- __wbg_new_with_str_4c859c3e69e6cb15: function() { return handleError(function (arg0, arg1) {
678
- const ret = new Request(getStringFromWasm0(arg0, arg1));
679
- return addHeapObject(ret);
680
- }, arguments); },
681
- __wbg_new_with_str_and_init_b4b54d1a819bc724: function() { return handleError(function (arg0, arg1, arg2) {
682
- const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
683
- return addHeapObject(ret);
684
- }, arguments); },
685
- __wbg_next_9c645ba5e1273237: function() { return handleError(function (arg0) {
686
- const ret = getObject(arg0).next();
687
- return addHeapObject(ret);
688
- }, arguments); },
689
- __wbg_ok_7ec8b94facac7704: function(arg0) {
690
- const ret = getObject(arg0).ok;
691
- return ret;
692
- },
693
- __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
694
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
695
- },
696
- __wbg_queueMicrotask_0c399741342fb10f: function(arg0) {
697
- const ret = getObject(arg0).queueMicrotask;
698
- return addHeapObject(ret);
699
- },
700
- __wbg_queueMicrotask_a082d78ce798393e: function(arg0) {
701
- queueMicrotask(getObject(arg0));
702
- },
703
- __wbg_ready_bf757735fa2c98fc: function(arg0) {
704
- const ret = getObject(arg0).ready;
705
- return addHeapObject(ret);
706
- },
707
- __wbg_releaseLock_48ae86fe0d5c344a: function(arg0) {
708
- getObject(arg0).releaseLock();
709
- },
710
- __wbg_resolve_ae8d83246e5bcc12: function(arg0) {
711
- const ret = Promise.resolve(getObject(arg0));
712
- return addHeapObject(ret);
713
- },
714
- __wbg_respond_137ffa35de748507: function(arg0, arg1) {
715
- getObject(arg0).respond(arg1 >>> 0);
716
- },
717
- __wbg_search_35617fb7936183df: function(arg0, arg1) {
718
- const ret = getObject(arg1).search;
719
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
720
- const len1 = WASM_VECTOR_LEN;
721
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
722
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
723
- },
724
- __wbg_set_8c0b3ffcf05d61c2: function(arg0, arg1, arg2) {
725
- getObject(arg0).set(getArrayU8FromWasm0(arg1, arg2));
726
- },
727
- __wbg_set_headers_3c8fecc693b75327: function(arg0, arg1) {
728
- getObject(arg0).headers = getObject(arg1);
729
- },
730
- __wbg_set_method_8c015e8bcafd7be1: function(arg0, arg1, arg2) {
731
- getObject(arg0).method = getStringFromWasm0(arg1, arg2);
732
- },
733
- __wbg_set_search_bd09fe57b201bac5: function(arg0, arg1, arg2) {
734
- getObject(arg0).search = getStringFromWasm0(arg1, arg2);
735
- },
736
- __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
737
- const ret = getObject(arg1).stack;
738
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
739
- const len1 = WASM_VECTOR_LEN;
740
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
741
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
742
- },
743
- __wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
744
- const ret = typeof global === 'undefined' ? null : global;
745
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
746
- },
747
- __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913: function() {
748
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
749
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
750
- },
751
- __wbg_static_accessor_SELF_f207c857566db248: function() {
752
- const ret = typeof self === 'undefined' ? null : self;
753
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
754
- },
755
- __wbg_static_accessor_WINDOW_bb9f1ba69d61b386: function() {
756
- const ret = typeof window === 'undefined' ? null : window;
757
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
758
- },
759
- __wbg_status_318629ab93a22955: function(arg0) {
760
- const ret = getObject(arg0).status;
761
- return ret;
762
- },
763
- __wbg_text_372f5b91442c50f9: function() { return handleError(function (arg0) {
764
- const ret = getObject(arg0).text();
765
- return addHeapObject(ret);
766
- }, arguments); },
767
- __wbg_then_098abe61755d12f6: function(arg0, arg1) {
768
- const ret = getObject(arg0).then(getObject(arg1));
769
- return addHeapObject(ret);
770
- },
771
- __wbg_then_9e335f6dd892bc11: function(arg0, arg1, arg2) {
772
- const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
773
- return addHeapObject(ret);
774
- },
775
- __wbg_toString_3272fa0dfd05dd87: function(arg0) {
776
- const ret = getObject(arg0).toString();
777
- return addHeapObject(ret);
778
- },
779
- __wbg_toString_fca8b5e46235cfb4: function(arg0) {
780
- const ret = getObject(arg0).toString();
781
- return addHeapObject(ret);
782
- },
783
- __wbg_url_b6f96880b733816c: function(arg0, arg1) {
784
- const ret = getObject(arg1).url;
785
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
786
- const len1 = WASM_VECTOR_LEN;
787
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
788
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
789
- },
790
- __wbg_value_21fc78aab0322612: function(arg0) {
791
- const ret = getObject(arg0).value;
792
- return addHeapObject(ret);
793
- },
794
- __wbg_view_98a9719f4bca1157: function(arg0) {
795
- const ret = getObject(arg0).view;
796
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
797
- },
798
- __wbg_write_1efac7e6738150f4: function(arg0, arg1) {
799
- const ret = getObject(arg0).write(takeObject(arg1));
800
- return addHeapObject(ret);
801
- },
802
- __wbindgen_cast_0000000000000001: function(arg0, arg1) {
803
- // Cast intrinsic for `Closure(Closure { dtor_idx: 1185, function: Function { arguments: [Externref], shim_idx: 1238, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
804
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_9296, __wasm_bindgen_func_elem_10439);
805
- return addHeapObject(ret);
806
- },
807
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
808
- // Cast intrinsic for `Closure(Closure { dtor_idx: 7, function: Function { arguments: [NamedExternref("IteratorResult<any>")], shim_idx: 8, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
809
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_356, __wasm_bindgen_func_elem_2709);
810
- return addHeapObject(ret);
811
- },
812
- __wbindgen_cast_0000000000000003: function(arg0) {
813
- // Cast intrinsic for `F64 -> Externref`.
814
- const ret = arg0;
815
- return addHeapObject(ret);
816
- },
817
- __wbindgen_cast_0000000000000004: function(arg0, arg1) {
818
- // Cast intrinsic for `Ref(String) -> Externref`.
819
- const ret = getStringFromWasm0(arg0, arg1);
820
- return addHeapObject(ret);
821
- },
822
- __wbindgen_object_clone_ref: function(arg0) {
823
- const ret = getObject(arg0);
824
- return addHeapObject(ret);
825
- },
826
- __wbindgen_object_drop_ref: function(arg0) {
827
- takeObject(arg0);
828
- },
829
- };
830
- return {
831
- __proto__: null,
832
- "./lemma_bg.js": import0,
833
- };
834
- }
835
-
836
- function __wasm_bindgen_func_elem_10439(arg0, arg1, arg2) {
837
- try {
838
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
839
- wasm.__wasm_bindgen_func_elem_10439(retptr, arg0, arg1, addHeapObject(arg2));
840
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
841
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
842
- if (r1) {
843
- throw takeObject(r0);
844
- }
845
- } finally {
846
- wasm.__wbindgen_add_to_stack_pointer(16);
847
- }
848
- }
849
-
850
- function __wasm_bindgen_func_elem_2709(arg0, arg1, arg2) {
851
- try {
852
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
853
- wasm.__wasm_bindgen_func_elem_2709(retptr, arg0, arg1, addHeapObject(arg2));
854
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
855
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
856
- if (r1) {
857
- throw takeObject(r0);
858
- }
859
- } finally {
860
- wasm.__wbindgen_add_to_stack_pointer(16);
861
- }
862
- }
863
-
864
- function __wasm_bindgen_func_elem_10458(arg0, arg1, arg2, arg3) {
865
- wasm.__wasm_bindgen_func_elem_10458(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
866
- }
867
-
868
-
869
- const __wbindgen_enum_ReadableStreamReaderMode = ["byob"];
870
- const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
871
- ? { register: () => {}, unregister: () => {} }
872
- : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1));
873
- const IntoUnderlyingSinkFinalization = (typeof FinalizationRegistry === 'undefined')
874
- ? { register: () => {}, unregister: () => {} }
875
- : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsink_free(ptr >>> 0, 1));
876
- const IntoUnderlyingSourceFinalization = (typeof FinalizationRegistry === 'undefined')
877
- ? { register: () => {}, unregister: () => {} }
878
- : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingsource_free(ptr >>> 0, 1));
879
- const PipeOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
880
- ? { register: () => {}, unregister: () => {} }
881
- : new FinalizationRegistry(ptr => wasm.__wbg_pipeoptions_free(ptr >>> 0, 1));
882
- const QueuingStrategyFinalization = (typeof FinalizationRegistry === 'undefined')
883
- ? { register: () => {}, unregister: () => {} }
884
- : new FinalizationRegistry(ptr => wasm.__wbg_queuingstrategy_free(ptr >>> 0, 1));
885
- const ReadableStreamGetReaderOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
886
- ? { register: () => {}, unregister: () => {} }
887
- : new FinalizationRegistry(ptr => wasm.__wbg_readablestreamgetreaderoptions_free(ptr >>> 0, 1));
888
- const ServerConfigFinalization = (typeof FinalizationRegistry === 'undefined')
889
- ? { register: () => {}, unregister: () => {} }
890
- : new FinalizationRegistry(ptr => wasm.__wbg_serverconfig_free(ptr >>> 0, 1));
891
- const WasmEngineFinalization = (typeof FinalizationRegistry === 'undefined')
892
- ? { register: () => {}, unregister: () => {} }
893
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmengine_free(ptr >>> 0, 1));
5
+ import initWasm, * as bindings from './lemma.bindings.js';
894
6
 
895
- function addHeapObject(obj) {
896
- if (heap_next === heap.length) heap.push(heap.length + 1);
897
- const idx = heap_next;
898
- heap_next = heap[idx];
7
+ let wasmReady = null;
899
8
 
900
- heap[idx] = obj;
901
- return idx;
9
+ export async function init() {
10
+ if (wasmReady === null) wasmReady = initWasm();
11
+ return wasmReady;
902
12
  }
903
13
 
904
- function _assertClass(instance, klass) {
905
- if (!(instance instanceof klass)) {
906
- throw new Error(`expected instance of ${klass.name}`);
907
- }
908
- }
909
-
910
- const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
911
- ? { register: () => {}, unregister: () => {} }
912
- : new FinalizationRegistry(state => state.dtor(state.a, state.b));
913
-
914
- function debugString(val) {
915
- // primitive types
916
- const type = typeof val;
917
- if (type == 'number' || type == 'boolean' || val == null) {
918
- return `${val}`;
919
- }
920
- if (type == 'string') {
921
- return `"${val}"`;
922
- }
923
- if (type == 'symbol') {
924
- const description = val.description;
925
- if (description == null) {
926
- return 'Symbol';
927
- } else {
928
- return `Symbol(${description})`;
929
- }
930
- }
931
- if (type == 'function') {
932
- const name = val.name;
933
- if (typeof name == 'string' && name.length > 0) {
934
- return `Function(${name})`;
935
- } else {
936
- return 'Function';
937
- }
938
- }
939
- // objects
940
- if (Array.isArray(val)) {
941
- const length = val.length;
942
- let debug = '[';
943
- if (length > 0) {
944
- debug += debugString(val[0]);
945
- }
946
- for(let i = 1; i < length; i++) {
947
- debug += ', ' + debugString(val[i]);
948
- }
949
- debug += ']';
950
- return debug;
951
- }
952
- // Test for built-in
953
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
954
- let className;
955
- if (builtInMatches && builtInMatches.length > 1) {
956
- className = builtInMatches[1];
957
- } else {
958
- // Failed to match the standard '[object ClassName]'
959
- return toString.call(val);
960
- }
961
- if (className == 'Object') {
962
- // we're a user defined class or Object
963
- // JSON.stringify avoids problems with cycles, and is generally much
964
- // easier than looping through ownProperties of `val`.
965
- try {
966
- return 'Object(' + JSON.stringify(val) + ')';
967
- } catch (_) {
968
- return 'Object';
969
- }
970
- }
971
- // errors
972
- if (val instanceof Error) {
973
- return `${val.name}: ${val.message}\n${val.stack}`;
974
- }
975
- // TODO we could test for more things here, like `Set`s and `Map`s.
976
- return className;
14
+ export function initSync(module) {
15
+ return bindings.initSync(module);
977
16
  }
978
17
 
979
- function dropObject(idx) {
980
- if (idx < 1028) return;
981
- heap[idx] = heap_next;
982
- heap_next = idx;
983
- }
984
-
985
- function getArrayU8FromWasm0(ptr, len) {
986
- ptr = ptr >>> 0;
987
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
988
- }
989
-
990
- let cachedDataViewMemory0 = null;
991
- function getDataViewMemory0() {
992
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
993
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
994
- }
995
- return cachedDataViewMemory0;
996
- }
997
-
998
- function getStringFromWasm0(ptr, len) {
999
- ptr = ptr >>> 0;
1000
- return decodeText(ptr, len);
1001
- }
1002
-
1003
- let cachedUint8ArrayMemory0 = null;
1004
- function getUint8ArrayMemory0() {
1005
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1006
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1007
- }
1008
- return cachedUint8ArrayMemory0;
1009
- }
1010
-
1011
- function getObject(idx) { return heap[idx]; }
1012
-
1013
- function handleError(f, args) {
1014
- try {
1015
- return f.apply(this, args);
1016
- } catch (e) {
1017
- wasm.__wbindgen_export3(addHeapObject(e));
1018
- }
1019
- }
1020
-
1021
- let heap = new Array(1024).fill(undefined);
1022
- heap.push(undefined, null, true, false);
1023
-
1024
- let heap_next = heap.length;
1025
-
1026
- function isLikeNone(x) {
1027
- return x === undefined || x === null;
1028
- }
1029
-
1030
- function makeMutClosure(arg0, arg1, dtor, f) {
1031
- const state = { a: arg0, b: arg1, cnt: 1, dtor };
1032
- const real = (...args) => {
1033
-
1034
- // First up with a closure we increment the internal reference
1035
- // count. This ensures that the Rust closure environment won't
1036
- // be deallocated while we're invoking it.
1037
- state.cnt++;
1038
- const a = state.a;
1039
- state.a = 0;
1040
- try {
1041
- return f(a, state.b, ...args);
1042
- } finally {
1043
- state.a = a;
1044
- real._wbg_cb_unref();
1045
- }
1046
- };
1047
- real._wbg_cb_unref = () => {
1048
- if (--state.cnt === 0) {
1049
- state.dtor(state.a, state.b);
1050
- state.a = 0;
1051
- CLOSURE_DTORS.unregister(state);
1052
- }
1053
- };
1054
- CLOSURE_DTORS.register(real, state, state);
1055
- return real;
1056
- }
1057
-
1058
- function passStringToWasm0(arg, malloc, realloc) {
1059
- if (realloc === undefined) {
1060
- const buf = cachedTextEncoder.encode(arg);
1061
- const ptr = malloc(buf.length, 1) >>> 0;
1062
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1063
- WASM_VECTOR_LEN = buf.length;
1064
- return ptr;
1065
- }
1066
-
1067
- let len = arg.length;
1068
- let ptr = malloc(len, 1) >>> 0;
1069
-
1070
- const mem = getUint8ArrayMemory0();
1071
-
1072
- let offset = 0;
1073
-
1074
- for (; offset < len; offset++) {
1075
- const code = arg.charCodeAt(offset);
1076
- if (code > 0x7F) break;
1077
- mem[ptr + offset] = code;
1078
- }
1079
- if (offset !== len) {
1080
- if (offset !== 0) {
1081
- arg = arg.slice(offset);
1082
- }
1083
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1084
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1085
- const ret = cachedTextEncoder.encodeInto(arg, view);
1086
-
1087
- offset += ret.written;
1088
- ptr = realloc(ptr, len, offset, 1) >>> 0;
1089
- }
1090
-
1091
- WASM_VECTOR_LEN = offset;
1092
- return ptr;
1093
- }
1094
-
1095
- function takeObject(idx) {
1096
- const ret = getObject(idx);
1097
- dropObject(idx);
1098
- return ret;
1099
- }
1100
-
1101
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1102
- cachedTextDecoder.decode();
1103
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
1104
- let numBytesDecoded = 0;
1105
- function decodeText(ptr, len) {
1106
- numBytesDecoded += len;
1107
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1108
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1109
- cachedTextDecoder.decode();
1110
- numBytesDecoded = len;
1111
- }
1112
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1113
- }
1114
-
1115
- const cachedTextEncoder = new TextEncoder();
1116
-
1117
- if (!('encodeInto' in cachedTextEncoder)) {
1118
- cachedTextEncoder.encodeInto = function (arg, view) {
1119
- const buf = cachedTextEncoder.encode(arg);
1120
- view.set(buf);
1121
- return {
1122
- read: arg.length,
1123
- written: buf.length
1124
- };
1125
- };
1126
- }
1127
-
1128
- let WASM_VECTOR_LEN = 0;
1129
-
1130
- let wasmModule, wasm;
1131
- function __wbg_finalize_init(instance, module) {
1132
- wasm = instance.exports;
1133
- wasmModule = module;
1134
- cachedDataViewMemory0 = null;
1135
- cachedUint8ArrayMemory0 = null;
1136
- return wasm;
1137
- }
1138
-
1139
- async function __wbg_load(module, imports) {
1140
- if (typeof Response === 'function' && module instanceof Response) {
1141
- if (typeof WebAssembly.instantiateStreaming === 'function') {
1142
- try {
1143
- return await WebAssembly.instantiateStreaming(module, imports);
1144
- } catch (e) {
1145
- const validResponse = module.ok && expectedResponseType(module.type);
1146
-
1147
- if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1148
- 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);
1149
-
1150
- } else { throw e; }
1151
- }
1152
- }
1153
-
1154
- const bytes = await module.arrayBuffer();
1155
- return await WebAssembly.instantiate(bytes, imports);
1156
- } else {
1157
- const instance = await WebAssembly.instantiate(module, imports);
1158
-
1159
- if (instance instanceof WebAssembly.Instance) {
1160
- return { instance, module };
1161
- } else {
1162
- return instance;
1163
- }
1164
- }
1165
-
1166
- function expectedResponseType(type) {
1167
- switch (type) {
1168
- case 'basic': case 'cors': case 'default': return true;
1169
- }
1170
- return false;
1171
- }
1172
- }
1173
-
1174
- function initSync(module) {
1175
- if (wasm !== undefined) return wasm;
1176
-
1177
-
1178
- if (module !== undefined) {
1179
- if (Object.getPrototypeOf(module) === Object.prototype) {
1180
- ({module} = module)
1181
- } else {
1182
- console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1183
- }
1184
- }
1185
-
1186
- const imports = __wbg_get_imports();
1187
- if (!(module instanceof WebAssembly.Module)) {
1188
- module = new WebAssembly.Module(module);
1189
- }
1190
- const instance = new WebAssembly.Instance(module, imports);
1191
- return __wbg_finalize_init(instance, module);
1192
- }
1193
-
1194
- async function __wbg_init(module_or_path) {
1195
- if (wasm !== undefined) return wasm;
1196
-
1197
-
1198
- if (module_or_path !== undefined) {
1199
- if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1200
- ({module_or_path} = module_or_path)
1201
- } else {
1202
- console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1203
- }
1204
- }
1205
-
1206
- if (module_or_path === undefined) {
1207
- module_or_path = new URL('lemma_bg.wasm', import.meta.url);
1208
- }
1209
- const imports = __wbg_get_imports();
1210
-
1211
- if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1212
- module_or_path = fetch(module_or_path);
1213
- }
1214
-
1215
- const { instance, module } = await __wbg_load(await module_or_path, imports);
1216
-
1217
- return __wbg_finalize_init(instance, module);
18
+ export async function Lemma() {
19
+ await init();
20
+ return new bindings.Engine();
1218
21
  }
1219
22
 
1220
- export { initSync, __wbg_init as default };
23
+ export const Engine = bindings.Engine;