@fhevm/sdk 0.14.0-13 → 0.14.0-14
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/_cjs/core/_version.js +1 -1
- package/_cjs/wasm/tfhe/loadTfheLib.js.map +1 -1
- package/_cjs/wasm/tkms/loadKmsLib.js.map +1 -1
- package/_esm/core/_version.js +1 -1
- package/core/_version.ts +1 -1
- package/package.json +3 -2
- package/wasm/tfhe/v1.6.0-dev/startWorkers.js +0 -753
- package/wasm/tfhe/v1.6.0-dev/tfhe-worker.mjs +0 -683
- package/wasm/tfhe/v1.6.0-dev/tfhe.d.ts +0 -367
- package/wasm/tfhe/v1.6.0-dev/tfhe.js +0 -1503
- package/wasm/tfhe/v1.6.0-dev/tfhe_bg.wasm +0 -0
- package/wasm/tfhe/v1.6.0-dev/tfhe_bg.wasm.base64.d.ts +0 -3
- package/wasm/tfhe/v1.6.0-dev/tfhe_bg.wasm.base64.js +0 -7
- package/wasm/tfhe/v1.6.0-dev/tfhe_bg.wasm.d.ts +0 -86
|
@@ -1,683 +0,0 @@
|
|
|
1
|
-
function ___isBrowserLike() {
|
|
2
|
-
return (
|
|
3
|
-
typeof addEventListener === 'function' &&
|
|
4
|
-
typeof removeEventListener === 'function'
|
|
5
|
-
);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
async function ___getTarget() {
|
|
9
|
-
if (___isBrowserLike()) return self;
|
|
10
|
-
const nodeModuleName = 'worker_threads';
|
|
11
|
-
const nodeModuleId = `node:${nodeModuleName}`;
|
|
12
|
-
const { parentPort } = await import(/* @vite-ignore */ nodeModuleId);
|
|
13
|
-
return parentPort;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function ___waitForMsgType(target, type) {
|
|
17
|
-
return new Promise((resolve) => {
|
|
18
|
-
if (typeof target.on === 'function') {
|
|
19
|
-
// Node: EventEmitter, data passed directly
|
|
20
|
-
target.on('message', function onMsg(data) {
|
|
21
|
-
if (data?.type !== type) return;
|
|
22
|
-
target.off('message', onMsg);
|
|
23
|
-
resolve(data);
|
|
24
|
-
});
|
|
25
|
-
} else {
|
|
26
|
-
// Browser: DOM events, data wrapped in MessageEvent
|
|
27
|
-
target.addEventListener('message', function onMsg({ data }) {
|
|
28
|
-
if (data?.type !== type) return;
|
|
29
|
-
target.removeEventListener('message', onMsg);
|
|
30
|
-
resolve(data);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
___getTarget().then((target) =>
|
|
37
|
-
___waitForMsgType(target, 'wasm_bindgen_worker_init').then(
|
|
38
|
-
async ({ init, receiver }) => {
|
|
39
|
-
const pkg = await Promise.resolve().then(function () {
|
|
40
|
-
return tfhe;
|
|
41
|
-
});
|
|
42
|
-
await pkg.default(init);
|
|
43
|
-
target.postMessage({ type: 'wasm_bindgen_worker_ready' });
|
|
44
|
-
pkg.wbg_rayon_start_worker(receiver);
|
|
45
|
-
},
|
|
46
|
-
),
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* @param {number} receiver
|
|
51
|
-
*/
|
|
52
|
-
function wbg_rayon_start_worker(receiver) {
|
|
53
|
-
wasm.wbg_rayon_start_worker(receiver);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
57
|
-
// Internal wasmbindgen tools
|
|
58
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
59
|
-
|
|
60
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
61
|
-
//
|
|
62
|
-
// Imports:
|
|
63
|
-
// __wbg_get_imports
|
|
64
|
-
//
|
|
65
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
66
|
-
|
|
67
|
-
function __wbg_get_imports(memory) {
|
|
68
|
-
const import0 = {
|
|
69
|
-
__proto__: null,
|
|
70
|
-
__wbg_BigInt_52ff8391297da194: function () {
|
|
71
|
-
return handleError(function (arg0) {
|
|
72
|
-
const ret = BigInt(arg0);
|
|
73
|
-
return ret;
|
|
74
|
-
}, arguments);
|
|
75
|
-
},
|
|
76
|
-
__wbg_BigInt_ae200e93cacbd2b3: function (arg0) {
|
|
77
|
-
const ret = BigInt(arg0);
|
|
78
|
-
return ret;
|
|
79
|
-
},
|
|
80
|
-
__wbg_Error_3639a60ed15f87e7: function (arg0, arg1) {
|
|
81
|
-
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
82
|
-
return ret;
|
|
83
|
-
},
|
|
84
|
-
__wbg___wbindgen_bigint_get_as_i64_3af6d4ca77193a4b: function (arg0, arg1) {
|
|
85
|
-
const v = arg1;
|
|
86
|
-
const ret = typeof (v) === 'bigint' ? v : undefined;
|
|
87
|
-
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
88
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
89
|
-
},
|
|
90
|
-
__wbg___wbindgen_bit_and_bfedece2bb657f4b: function (arg0, arg1) {
|
|
91
|
-
const ret = arg0 & arg1;
|
|
92
|
-
return ret;
|
|
93
|
-
},
|
|
94
|
-
__wbg___wbindgen_debug_string_07cb72cfcc952e2b: function (arg0, arg1) {
|
|
95
|
-
const ret = debugString(arg1);
|
|
96
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
97
|
-
const len1 = WASM_VECTOR_LEN;
|
|
98
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
99
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
100
|
-
},
|
|
101
|
-
__wbg___wbindgen_is_function_2f0fd7ceb86e64c5: function (arg0) {
|
|
102
|
-
const ret = typeof (arg0) === 'function';
|
|
103
|
-
return ret;
|
|
104
|
-
},
|
|
105
|
-
__wbg___wbindgen_is_object_5b22ff2418063a9c: function (arg0) {
|
|
106
|
-
const val = arg0;
|
|
107
|
-
const ret = typeof (val) === 'object' && val !== null;
|
|
108
|
-
return ret;
|
|
109
|
-
},
|
|
110
|
-
__wbg___wbindgen_is_string_eddc07a3efad52e6: function (arg0) {
|
|
111
|
-
const ret = typeof (arg0) === 'string';
|
|
112
|
-
return ret;
|
|
113
|
-
},
|
|
114
|
-
__wbg___wbindgen_is_undefined_244a92c34d3b6ec0: function (arg0) {
|
|
115
|
-
const ret = arg0 === undefined;
|
|
116
|
-
return ret;
|
|
117
|
-
},
|
|
118
|
-
__wbg___wbindgen_jsval_eq_403eaa3610500a25: function (arg0, arg1) {
|
|
119
|
-
const ret = arg0 === arg1;
|
|
120
|
-
return ret;
|
|
121
|
-
},
|
|
122
|
-
__wbg___wbindgen_lt_c483cc694de67c3e: function (arg0, arg1) {
|
|
123
|
-
const ret = arg0 < arg1;
|
|
124
|
-
return ret;
|
|
125
|
-
},
|
|
126
|
-
__wbg___wbindgen_memory_c2356dd1a089dfbd: function () {
|
|
127
|
-
const ret = wasm.memory;
|
|
128
|
-
return ret;
|
|
129
|
-
},
|
|
130
|
-
__wbg___wbindgen_module_df704393dfd1853c: function () {
|
|
131
|
-
const ret = wasmModule;
|
|
132
|
-
return ret;
|
|
133
|
-
},
|
|
134
|
-
__wbg___wbindgen_neg_9b4d71823e3bc513: function (arg0) {
|
|
135
|
-
const ret = -arg0;
|
|
136
|
-
return ret;
|
|
137
|
-
},
|
|
138
|
-
__wbg___wbindgen_shr_d8f8268f18c7a1c3: function (arg0, arg1) {
|
|
139
|
-
const ret = arg0 >> arg1;
|
|
140
|
-
return ret;
|
|
141
|
-
},
|
|
142
|
-
__wbg___wbindgen_string_get_965592073e5d848c: function (arg0, arg1) {
|
|
143
|
-
const obj = arg1;
|
|
144
|
-
const ret = typeof (obj) === 'string' ? obj : undefined;
|
|
145
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
146
|
-
var len1 = WASM_VECTOR_LEN;
|
|
147
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
148
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
149
|
-
},
|
|
150
|
-
__wbg___wbindgen_throw_9c75d47bf9e7731e: function (arg0, arg1) {
|
|
151
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
152
|
-
},
|
|
153
|
-
__wbg_call_a41d6421b30a32c5: function () {
|
|
154
|
-
return handleError(function (arg0, arg1, arg2) {
|
|
155
|
-
const ret = arg0.call(arg1, arg2);
|
|
156
|
-
return ret;
|
|
157
|
-
}, arguments);
|
|
158
|
-
},
|
|
159
|
-
__wbg_crypto_38df2bab126b63dc: function (arg0) {
|
|
160
|
-
const ret = arg0.crypto;
|
|
161
|
-
return ret;
|
|
162
|
-
},
|
|
163
|
-
__wbg_error_a6fa202b58aa1cd3: function (arg0, arg1) {
|
|
164
|
-
let deferred0_0;
|
|
165
|
-
let deferred0_1;
|
|
166
|
-
try {
|
|
167
|
-
deferred0_0 = arg0;
|
|
168
|
-
deferred0_1 = arg1;
|
|
169
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
170
|
-
}
|
|
171
|
-
finally {
|
|
172
|
-
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
__wbg_getRandomValues_c44a50d8cfdaebeb: function () {
|
|
176
|
-
return handleError(function (arg0, arg1) {
|
|
177
|
-
arg0.getRandomValues(arg1);
|
|
178
|
-
}, arguments);
|
|
179
|
-
},
|
|
180
|
-
__wbg_instanceof_Window_4153c1818a1c0c0b: function (arg0) {
|
|
181
|
-
let result;
|
|
182
|
-
try {
|
|
183
|
-
result = arg0 instanceof Window;
|
|
184
|
-
}
|
|
185
|
-
catch (_) {
|
|
186
|
-
result = false;
|
|
187
|
-
}
|
|
188
|
-
const ret = result;
|
|
189
|
-
return ret;
|
|
190
|
-
},
|
|
191
|
-
__wbg_length_ba3c032602efe310: function (arg0) {
|
|
192
|
-
const ret = arg0.length;
|
|
193
|
-
return ret;
|
|
194
|
-
},
|
|
195
|
-
__wbg_msCrypto_bd5a034af96bcba6: function (arg0) {
|
|
196
|
-
const ret = arg0.msCrypto;
|
|
197
|
-
return ret;
|
|
198
|
-
},
|
|
199
|
-
__wbg_new_227d7c05414eb861: function () {
|
|
200
|
-
const ret = new Error();
|
|
201
|
-
return ret;
|
|
202
|
-
},
|
|
203
|
-
__wbg_new_with_length_9011f5da794bf5d9: function (arg0) {
|
|
204
|
-
const ret = new Uint8Array(arg0 >>> 0);
|
|
205
|
-
return ret;
|
|
206
|
-
},
|
|
207
|
-
__wbg_node_84ea875411254db1: function (arg0) {
|
|
208
|
-
const ret = arg0.node;
|
|
209
|
-
return ret;
|
|
210
|
-
},
|
|
211
|
-
__wbg_process_44c7a14e11e9f69e: function (arg0) {
|
|
212
|
-
const ret = arg0.process;
|
|
213
|
-
return ret;
|
|
214
|
-
},
|
|
215
|
-
__wbg_prototypesetcall_fd4050e806e1d519: function (arg0, arg1, arg2) {
|
|
216
|
-
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
217
|
-
},
|
|
218
|
-
__wbg_randomFillSync_6c25eac9869eb53c: function () {
|
|
219
|
-
return handleError(function (arg0, arg1) {
|
|
220
|
-
arg0.randomFillSync(arg1);
|
|
221
|
-
}, arguments);
|
|
222
|
-
},
|
|
223
|
-
__wbg_require_b4edbdcf3e2a1ef0: function () {
|
|
224
|
-
return handleError(function () {
|
|
225
|
-
const ret = module.require;
|
|
226
|
-
return ret;
|
|
227
|
-
}, arguments);
|
|
228
|
-
},
|
|
229
|
-
__wbg_stack_3b0d974bbf31e44f: function (arg0, arg1) {
|
|
230
|
-
const ret = arg1.stack;
|
|
231
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
232
|
-
const len1 = WASM_VECTOR_LEN;
|
|
233
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
234
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
235
|
-
},
|
|
236
|
-
__wbg_startWorkers_8b582d57e92bd2d4: function (arg0, arg1, arg2) {
|
|
237
|
-
handleError(function () {
|
|
238
|
-
throw new Error('startWorkers not supported from a worker thread');
|
|
239
|
-
});
|
|
240
|
-
// const ret = startWorkers(arg0, arg1, wbg_rayon_PoolBuilder.__wrap(arg2));
|
|
241
|
-
// return ret;
|
|
242
|
-
},
|
|
243
|
-
__wbg_static_accessor_GLOBAL_THIS_1c7f1bd6c6941fdb: function () {
|
|
244
|
-
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
245
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
246
|
-
},
|
|
247
|
-
__wbg_static_accessor_GLOBAL_e039bc914f83e74e: function () {
|
|
248
|
-
const ret = typeof global === 'undefined' ? null : global;
|
|
249
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
250
|
-
},
|
|
251
|
-
__wbg_static_accessor_SELF_8bf8c48c28420ad5: function () {
|
|
252
|
-
const ret = typeof self === 'undefined' ? null : self;
|
|
253
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
254
|
-
},
|
|
255
|
-
__wbg_static_accessor_WINDOW_6aeee9b51652ee0f: function () {
|
|
256
|
-
const ret = typeof window === 'undefined' ? null : window;
|
|
257
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
258
|
-
},
|
|
259
|
-
__wbg_subarray_fbe3cef290e1fa43: function (arg0, arg1, arg2) {
|
|
260
|
-
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
261
|
-
return ret;
|
|
262
|
-
},
|
|
263
|
-
__wbg_toString_15656af8d8e71f16: function (arg0, arg1, arg2) {
|
|
264
|
-
const ret = arg1.toString(arg2);
|
|
265
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
266
|
-
const len1 = WASM_VECTOR_LEN;
|
|
267
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
268
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
269
|
-
},
|
|
270
|
-
__wbg_toString_8d874489bad7e5a2: function (arg0) {
|
|
271
|
-
const ret = arg0.toString();
|
|
272
|
-
return ret;
|
|
273
|
-
},
|
|
274
|
-
__wbg_versions_276b2795b1c6a219: function (arg0) {
|
|
275
|
-
const ret = arg0.versions;
|
|
276
|
-
return ret;
|
|
277
|
-
},
|
|
278
|
-
__wbindgen_cast_0000000000000001: function (arg0) {
|
|
279
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
280
|
-
const ret = arg0;
|
|
281
|
-
return ret;
|
|
282
|
-
},
|
|
283
|
-
__wbindgen_cast_0000000000000002: function (arg0) {
|
|
284
|
-
// Cast intrinsic for `I64 -> Externref`.
|
|
285
|
-
const ret = arg0;
|
|
286
|
-
return ret;
|
|
287
|
-
},
|
|
288
|
-
__wbindgen_cast_0000000000000003: function (arg0, arg1) {
|
|
289
|
-
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
290
|
-
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
291
|
-
return ret;
|
|
292
|
-
},
|
|
293
|
-
__wbindgen_cast_0000000000000004: function (arg0, arg1) {
|
|
294
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
295
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
296
|
-
return ret;
|
|
297
|
-
},
|
|
298
|
-
__wbindgen_cast_0000000000000005: function (arg0) {
|
|
299
|
-
// Cast intrinsic for `U64 -> Externref`.
|
|
300
|
-
const ret = BigInt.asUintN(64, arg0);
|
|
301
|
-
return ret;
|
|
302
|
-
},
|
|
303
|
-
__wbindgen_init_externref_table: function () {
|
|
304
|
-
const table = wasm.__wbindgen_externrefs;
|
|
305
|
-
const offset = table.grow(4);
|
|
306
|
-
table.set(0, undefined);
|
|
307
|
-
table.set(offset + 0, undefined);
|
|
308
|
-
table.set(offset + 1, null);
|
|
309
|
-
table.set(offset + 2, true);
|
|
310
|
-
table.set(offset + 3, false);
|
|
311
|
-
},
|
|
312
|
-
memory: memory || new WebAssembly.Memory({ initial: 19, maximum: 16384, shared: true }),
|
|
313
|
-
};
|
|
314
|
-
return {
|
|
315
|
-
__proto__: null,
|
|
316
|
-
"./tfhe_bg.js": import0,
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
321
|
-
// addToExternrefTable0
|
|
322
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
323
|
-
|
|
324
|
-
function addToExternrefTable0(obj) {
|
|
325
|
-
const idx = wasm.__externref_table_alloc();
|
|
326
|
-
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
327
|
-
return idx;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
331
|
-
// debugString
|
|
332
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
333
|
-
|
|
334
|
-
function debugString(val) {
|
|
335
|
-
// primitive types
|
|
336
|
-
const type = typeof val;
|
|
337
|
-
if (type == 'number' || type == 'boolean' || val == null) {
|
|
338
|
-
return `${val}`;
|
|
339
|
-
}
|
|
340
|
-
if (type == 'string') {
|
|
341
|
-
return `"${val}"`;
|
|
342
|
-
}
|
|
343
|
-
if (type == 'symbol') {
|
|
344
|
-
const description = val.description;
|
|
345
|
-
if (description == null) {
|
|
346
|
-
return 'Symbol';
|
|
347
|
-
}
|
|
348
|
-
else {
|
|
349
|
-
return `Symbol(${description})`;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
if (type == 'function') {
|
|
353
|
-
const name = val.name;
|
|
354
|
-
if (typeof name == 'string' && name.length > 0) {
|
|
355
|
-
return `Function(${name})`;
|
|
356
|
-
}
|
|
357
|
-
else {
|
|
358
|
-
return 'Function';
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
// objects
|
|
362
|
-
if (Array.isArray(val)) {
|
|
363
|
-
const length = val.length;
|
|
364
|
-
let debug = '[';
|
|
365
|
-
if (length > 0) {
|
|
366
|
-
debug += debugString(val[0]);
|
|
367
|
-
}
|
|
368
|
-
for (let i = 1; i < length; i++) {
|
|
369
|
-
debug += ', ' + debugString(val[i]);
|
|
370
|
-
}
|
|
371
|
-
debug += ']';
|
|
372
|
-
return debug;
|
|
373
|
-
}
|
|
374
|
-
// Test for built-in
|
|
375
|
-
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
376
|
-
let className;
|
|
377
|
-
if (builtInMatches && builtInMatches.length > 1) {
|
|
378
|
-
className = builtInMatches[1];
|
|
379
|
-
}
|
|
380
|
-
else {
|
|
381
|
-
// Failed to match the standard '[object ClassName]'
|
|
382
|
-
return toString.call(val);
|
|
383
|
-
}
|
|
384
|
-
if (className == 'Object') {
|
|
385
|
-
// we're a user defined class or Object
|
|
386
|
-
// JSON.stringify avoids problems with cycles, and is generally much
|
|
387
|
-
// easier than looping through ownProperties of `val`.
|
|
388
|
-
try {
|
|
389
|
-
return 'Object(' + JSON.stringify(val) + ')';
|
|
390
|
-
}
|
|
391
|
-
catch (_) {
|
|
392
|
-
return 'Object';
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
// errors
|
|
396
|
-
if (val instanceof Error) {
|
|
397
|
-
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
398
|
-
}
|
|
399
|
-
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
400
|
-
return className;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
404
|
-
// getArrayU8FromWasm0
|
|
405
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
406
|
-
|
|
407
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
408
|
-
ptr = ptr >>> 0;
|
|
409
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
413
|
-
// cachedDataViewMemory0
|
|
414
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
415
|
-
|
|
416
|
-
let cachedDataViewMemory0 = null;
|
|
417
|
-
|
|
418
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
419
|
-
// getDataViewMemory0
|
|
420
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
421
|
-
|
|
422
|
-
function getDataViewMemory0() {
|
|
423
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
|
|
424
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
425
|
-
}
|
|
426
|
-
return cachedDataViewMemory0;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
430
|
-
// getStringFromWasm0
|
|
431
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
432
|
-
|
|
433
|
-
function getStringFromWasm0(ptr, len) {
|
|
434
|
-
return decodeText(ptr >>> 0, len);
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
438
|
-
// cachedUint8ArrayMemory0
|
|
439
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
440
|
-
|
|
441
|
-
let cachedUint8ArrayMemory0 = null;
|
|
442
|
-
|
|
443
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
444
|
-
// getUint8ArrayMemory0
|
|
445
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
446
|
-
|
|
447
|
-
function getUint8ArrayMemory0() {
|
|
448
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.buffer !== wasm.memory.buffer) {
|
|
449
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
450
|
-
}
|
|
451
|
-
return cachedUint8ArrayMemory0;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
455
|
-
// handleError
|
|
456
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
457
|
-
|
|
458
|
-
function handleError(f, args) {
|
|
459
|
-
try {
|
|
460
|
-
return f.apply(this, args);
|
|
461
|
-
}
|
|
462
|
-
catch (e) {
|
|
463
|
-
const idx = addToExternrefTable0(e);
|
|
464
|
-
wasm.__wbindgen_exn_store(idx);
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
469
|
-
// isLikeNone
|
|
470
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
471
|
-
|
|
472
|
-
function isLikeNone(x) {
|
|
473
|
-
return x === undefined || x === null;
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
477
|
-
// passStringToWasm0
|
|
478
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
479
|
-
|
|
480
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
481
|
-
if (realloc === undefined) {
|
|
482
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
483
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
484
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
485
|
-
WASM_VECTOR_LEN = buf.length;
|
|
486
|
-
return ptr;
|
|
487
|
-
}
|
|
488
|
-
let len = arg.length;
|
|
489
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
490
|
-
const mem = getUint8ArrayMemory0();
|
|
491
|
-
let offset = 0;
|
|
492
|
-
for (; offset < len; offset++) {
|
|
493
|
-
const code = arg.charCodeAt(offset);
|
|
494
|
-
if (code > 0x7F)
|
|
495
|
-
break;
|
|
496
|
-
mem[ptr + offset] = code;
|
|
497
|
-
}
|
|
498
|
-
if (offset !== len) {
|
|
499
|
-
if (offset !== 0) {
|
|
500
|
-
arg = arg.slice(offset);
|
|
501
|
-
}
|
|
502
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
503
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
504
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
505
|
-
offset += ret.written;
|
|
506
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
507
|
-
}
|
|
508
|
-
WASM_VECTOR_LEN = offset;
|
|
509
|
-
return ptr;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
513
|
-
// cachedTextDecoder
|
|
514
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
515
|
-
|
|
516
|
-
let cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : undefined);
|
|
517
|
-
|
|
518
|
-
if (cachedTextDecoder)
|
|
519
|
-
cachedTextDecoder.decode();
|
|
520
|
-
|
|
521
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
522
|
-
// MAX_SAFARI_DECODE_BYTES
|
|
523
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
524
|
-
|
|
525
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
526
|
-
|
|
527
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
528
|
-
// numBytesDecoded
|
|
529
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
530
|
-
|
|
531
|
-
let numBytesDecoded = 0;
|
|
532
|
-
|
|
533
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
534
|
-
// decodeText
|
|
535
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
536
|
-
|
|
537
|
-
function decodeText(ptr, len) {
|
|
538
|
-
numBytesDecoded += len;
|
|
539
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
540
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
541
|
-
cachedTextDecoder.decode();
|
|
542
|
-
numBytesDecoded = len;
|
|
543
|
-
}
|
|
544
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().slice(ptr, ptr + len));
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
548
|
-
// cachedTextEncoder
|
|
549
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
550
|
-
|
|
551
|
-
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder() : undefined);
|
|
552
|
-
|
|
553
|
-
if (cachedTextEncoder) {
|
|
554
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
555
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
556
|
-
view.set(buf);
|
|
557
|
-
return {
|
|
558
|
-
read: arg.length,
|
|
559
|
-
written: buf.length
|
|
560
|
-
};
|
|
561
|
-
};
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
565
|
-
// WASM_VECTOR_LEN is a module-level variable that stores the byte length of
|
|
566
|
-
// the data just written into WASM memory. It acts as an out-parameter.
|
|
567
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
568
|
-
|
|
569
|
-
let WASM_VECTOR_LEN = 0;
|
|
570
|
-
|
|
571
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
572
|
-
// WASM module state
|
|
573
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
574
|
-
|
|
575
|
-
let wasmModule, wasmInstance, wasm;
|
|
576
|
-
|
|
577
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
578
|
-
// Init:
|
|
579
|
-
// __wbg_finalize_init
|
|
580
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
581
|
-
|
|
582
|
-
function __wbg_finalize_init(instance, module, thread_stack_size) {
|
|
583
|
-
wasmInstance = instance;
|
|
584
|
-
wasm = instance.exports;
|
|
585
|
-
wasmModule = module;
|
|
586
|
-
cachedDataViewMemory0 = null;
|
|
587
|
-
cachedUint8ArrayMemory0 = null;
|
|
588
|
-
if (typeof thread_stack_size !== 'undefined' && (typeof thread_stack_size !== 'number' || thread_stack_size === 0 || thread_stack_size % 65536 !== 0)) {
|
|
589
|
-
throw new Error('invalid stack size');
|
|
590
|
-
}
|
|
591
|
-
wasm.__wbindgen_start(thread_stack_size);
|
|
592
|
-
return wasm;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
596
|
-
// Init:
|
|
597
|
-
// __wbg_load
|
|
598
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
599
|
-
|
|
600
|
-
async function __wbg_load(module, imports) {
|
|
601
|
-
if (typeof Response === 'function' && module instanceof Response) {
|
|
602
|
-
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
603
|
-
try {
|
|
604
|
-
return await WebAssembly.instantiateStreaming(module, imports);
|
|
605
|
-
}
|
|
606
|
-
catch (e) {
|
|
607
|
-
const validResponse = module.ok && expectedResponseType(module.type);
|
|
608
|
-
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
609
|
-
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);
|
|
610
|
-
}
|
|
611
|
-
else {
|
|
612
|
-
throw e;
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
const bytes = await module.arrayBuffer();
|
|
617
|
-
return await WebAssembly.instantiate(bytes, imports);
|
|
618
|
-
}
|
|
619
|
-
else {
|
|
620
|
-
const instance = await WebAssembly.instantiate(module, imports);
|
|
621
|
-
if (instance instanceof WebAssembly.Instance) {
|
|
622
|
-
return { instance, module };
|
|
623
|
-
}
|
|
624
|
-
else {
|
|
625
|
-
return instance;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
function expectedResponseType(type) {
|
|
629
|
-
switch (type) {
|
|
630
|
-
case 'basic':
|
|
631
|
-
case 'cors':
|
|
632
|
-
case 'default': return true;
|
|
633
|
-
}
|
|
634
|
-
return false;
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
639
|
-
// Init:
|
|
640
|
-
// __wbg_init
|
|
641
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
642
|
-
|
|
643
|
-
async function __wbg_init(module_or_path, memory) {
|
|
644
|
-
if (wasm !== undefined)
|
|
645
|
-
return wasm;
|
|
646
|
-
let thread_stack_size;
|
|
647
|
-
if (module_or_path !== undefined) {
|
|
648
|
-
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
649
|
-
({ module_or_path, memory, thread_stack_size } = module_or_path);
|
|
650
|
-
}
|
|
651
|
-
else {
|
|
652
|
-
console.warn('using deprecated parameters for the initialization function; pass a single object instead');
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
// if (module_or_path === undefined) {
|
|
656
|
-
// module_or_path = new URL('tfhe_bg.wasm', import.meta.url);
|
|
657
|
-
// }
|
|
658
|
-
const imports = __wbg_get_imports(memory);
|
|
659
|
-
// if (
|
|
660
|
-
// typeof module_or_path === 'string' ||
|
|
661
|
-
// (typeof Request === 'function' && module_or_path instanceof Request) ||
|
|
662
|
-
// (typeof URL === 'function' && module_or_path instanceof URL)
|
|
663
|
-
// ) {
|
|
664
|
-
// module_or_path = fetch(module_or_path);
|
|
665
|
-
// }
|
|
666
|
-
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
667
|
-
return __wbg_finalize_init(instance, module, thread_stack_size);
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
671
|
-
//
|
|
672
|
-
// The 'tfhe' global object
|
|
673
|
-
// ========================
|
|
674
|
-
// Final tfhe object global declaration called by 'waitForMsgType' only
|
|
675
|
-
//
|
|
676
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
677
|
-
|
|
678
|
-
var tfhe = /*#__PURE__*/ Object.freeze({
|
|
679
|
-
__proto__: null,
|
|
680
|
-
default: __wbg_init,
|
|
681
|
-
wbg_rayon_start_worker: wbg_rayon_start_worker,
|
|
682
|
-
});
|
|
683
|
-
|