@alloy-framework/client-wasm 0.15.0 → 0.16.0

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,1215 @@
1
+ /* @ts-self-types="./alloy_client_wasm.d.ts" */
2
+
3
+ export class AlloyClient {
4
+ __destroy_into_raw() {
5
+ const ptr = this.__wbg_ptr;
6
+ this.__wbg_ptr = 0;
7
+ AlloyClientFinalization.unregister(this);
8
+ return ptr;
9
+ }
10
+ free() {
11
+ const ptr = this.__destroy_into_raw();
12
+ wasm.__wbg_alloyclient_free(ptr, 0);
13
+ }
14
+ /**
15
+ * @param {string} key
16
+ * @param {string} data
17
+ * @returns {string}
18
+ */
19
+ decrypt_custom(key, data) {
20
+ let deferred4_0;
21
+ let deferred4_1;
22
+ try {
23
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
24
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
25
+ const len0 = WASM_VECTOR_LEN;
26
+ const ptr1 = passStringToWasm0(data, wasm.__wbindgen_export, wasm.__wbindgen_export2);
27
+ const len1 = WASM_VECTOR_LEN;
28
+ wasm.alloyclient_decrypt_custom(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
29
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
30
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
31
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
32
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
33
+ var ptr3 = r0;
34
+ var len3 = r1;
35
+ if (r3) {
36
+ ptr3 = 0; len3 = 0;
37
+ throw takeObject(r2);
38
+ }
39
+ deferred4_0 = ptr3;
40
+ deferred4_1 = len3;
41
+ return getStringFromWasm0(ptr3, len3);
42
+ } finally {
43
+ wasm.__wbindgen_add_to_stack_pointer(16);
44
+ wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
45
+ }
46
+ }
47
+ /**
48
+ * Smart DELETE Request
49
+ * @param {string} path
50
+ * @param {boolean | null} [encrypt_enabled]
51
+ * @returns {Promise<any>}
52
+ */
53
+ delete(path, encrypt_enabled) {
54
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
55
+ const len0 = WASM_VECTOR_LEN;
56
+ const ret = wasm.alloyclient_delete(this.__wbg_ptr, ptr0, len0, isLikeNone(encrypt_enabled) ? 0xFFFFFF : encrypt_enabled ? 1 : 0);
57
+ return takeObject(ret);
58
+ }
59
+ /**
60
+ * @param {string} key
61
+ * @param {string} data
62
+ * @returns {string}
63
+ */
64
+ encrypt_custom(key, data) {
65
+ let deferred4_0;
66
+ let deferred4_1;
67
+ try {
68
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
69
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export, wasm.__wbindgen_export2);
70
+ const len0 = WASM_VECTOR_LEN;
71
+ const ptr1 = passStringToWasm0(data, wasm.__wbindgen_export, wasm.__wbindgen_export2);
72
+ const len1 = WASM_VECTOR_LEN;
73
+ wasm.alloyclient_encrypt_custom(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
74
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
75
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
76
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
77
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
78
+ var ptr3 = r0;
79
+ var len3 = r1;
80
+ if (r3) {
81
+ ptr3 = 0; len3 = 0;
82
+ throw takeObject(r2);
83
+ }
84
+ deferred4_0 = ptr3;
85
+ deferred4_1 = len3;
86
+ return getStringFromWasm0(ptr3, len3);
87
+ } finally {
88
+ wasm.__wbindgen_add_to_stack_pointer(16);
89
+ wasm.__wbindgen_export4(deferred4_0, deferred4_1, 1);
90
+ }
91
+ }
92
+ /**
93
+ * Smart GET Request (encrypt_query: defaults to true)
94
+ * @param {string} path
95
+ * @param {boolean | null} [encrypt_enabled]
96
+ * @returns {Promise<any>}
97
+ */
98
+ get(path, encrypt_enabled) {
99
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
100
+ const len0 = WASM_VECTOR_LEN;
101
+ const ret = wasm.alloyclient_get(this.__wbg_ptr, ptr0, len0, isLikeNone(encrypt_enabled) ? 0xFFFFFF : encrypt_enabled ? 1 : 0);
102
+ return takeObject(ret);
103
+ }
104
+ /**
105
+ * @param {string} master_secret
106
+ */
107
+ constructor(master_secret) {
108
+ try {
109
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
110
+ const ptr0 = passStringToWasm0(master_secret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
111
+ const len0 = WASM_VECTOR_LEN;
112
+ wasm.alloyclient_new(retptr, ptr0, len0);
113
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
114
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
115
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
116
+ if (r2) {
117
+ throw takeObject(r1);
118
+ }
119
+ this.__wbg_ptr = r0 >>> 0;
120
+ AlloyClientFinalization.register(this, this.__wbg_ptr, this);
121
+ return this;
122
+ } finally {
123
+ wasm.__wbindgen_add_to_stack_pointer(16);
124
+ }
125
+ }
126
+ /**
127
+ * Smart PATCH Request
128
+ * @param {string} path
129
+ * @param {any} json_body
130
+ * @param {boolean | null} [encrypt_enabled]
131
+ * @returns {Promise<any>}
132
+ */
133
+ patch(path, json_body, encrypt_enabled) {
134
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
135
+ const len0 = WASM_VECTOR_LEN;
136
+ const ret = wasm.alloyclient_patch(this.__wbg_ptr, ptr0, len0, addHeapObject(json_body), isLikeNone(encrypt_enabled) ? 0xFFFFFF : encrypt_enabled ? 1 : 0);
137
+ return takeObject(ret);
138
+ }
139
+ /**
140
+ * Smart POST Request
141
+ * @param {string} path
142
+ * @param {any} json_body
143
+ * @param {boolean | null} [encrypt_enabled]
144
+ * @returns {Promise<any>}
145
+ */
146
+ post(path, json_body, encrypt_enabled) {
147
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
148
+ const len0 = WASM_VECTOR_LEN;
149
+ const ret = wasm.alloyclient_post(this.__wbg_ptr, ptr0, len0, addHeapObject(json_body), isLikeNone(encrypt_enabled) ? 0xFFFFFF : encrypt_enabled ? 1 : 0);
150
+ return takeObject(ret);
151
+ }
152
+ /**
153
+ * Smart PUT Request
154
+ * @param {string} path
155
+ * @param {any} json_body
156
+ * @param {boolean | null} [encrypt_enabled]
157
+ * @returns {Promise<any>}
158
+ */
159
+ put(path, json_body, encrypt_enabled) {
160
+ const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);
161
+ const len0 = WASM_VECTOR_LEN;
162
+ const ret = wasm.alloyclient_put(this.__wbg_ptr, ptr0, len0, addHeapObject(json_body), isLikeNone(encrypt_enabled) ? 0xFFFFFF : encrypt_enabled ? 1 : 0);
163
+ return takeObject(ret);
164
+ }
165
+ /**
166
+ * @returns {string}
167
+ */
168
+ uuid() {
169
+ let deferred1_0;
170
+ let deferred1_1;
171
+ try {
172
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
173
+ wasm.alloyclient_uuid(retptr, this.__wbg_ptr);
174
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
175
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
176
+ deferred1_0 = r0;
177
+ deferred1_1 = r1;
178
+ return getStringFromWasm0(r0, r1);
179
+ } finally {
180
+ wasm.__wbindgen_add_to_stack_pointer(16);
181
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
182
+ }
183
+ }
184
+ }
185
+ if (Symbol.dispose) AlloyClient.prototype[Symbol.dispose] = AlloyClient.prototype.free;
186
+
187
+ /**
188
+ * 📡 AlloySocket — WASM 기반 WebSocket 클라이언트
189
+ *
190
+ * 이벤트 기반 메시지 ({ type, data }) 구조를 사용하며,
191
+ * 메시지 암호화, 자동 Ping, 스마트 재연결을 지원합니다.
192
+ */
193
+ export class AlloySocket {
194
+ __destroy_into_raw() {
195
+ const ptr = this.__wbg_ptr;
196
+ this.__wbg_ptr = 0;
197
+ AlloySocketFinalization.unregister(this);
198
+ return ptr;
199
+ }
200
+ free() {
201
+ const ptr = this.__destroy_into_raw();
202
+ wasm.__wbg_alloysocket_free(ptr, 0);
203
+ }
204
+ /**
205
+ * 🔌 서버 연결
206
+ */
207
+ connect() {
208
+ try {
209
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
210
+ wasm.alloysocket_connect(retptr, this.__wbg_ptr);
211
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
212
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
213
+ if (r1) {
214
+ throw takeObject(r0);
215
+ }
216
+ } finally {
217
+ wasm.__wbindgen_add_to_stack_pointer(16);
218
+ }
219
+ }
220
+ /**
221
+ * 🔌 명시적 연결 종료
222
+ */
223
+ disconnect() {
224
+ wasm.alloysocket_disconnect(this.__wbg_ptr);
225
+ }
226
+ /**
227
+ * 🔍 연결 상태 확인
228
+ * @returns {boolean}
229
+ */
230
+ is_connected() {
231
+ const ret = wasm.alloysocket_is_connected(this.__wbg_ptr);
232
+ return ret !== 0;
233
+ }
234
+ /**
235
+ * 📡 AlloySocket 생성자
236
+ *
237
+ * @param url - WebSocket 서버 주소 (예: "ws://localhost:3000/ws")
238
+ * @param master_secret - 메시지 암호화 키
239
+ * @param encrypt_enabled - 암호화 활성화 여부 (기본: false)
240
+ * @param {string} url
241
+ * @param {string} master_secret
242
+ * @param {boolean | null} [encrypt_enabled]
243
+ */
244
+ constructor(url, master_secret, encrypt_enabled) {
245
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
246
+ const len0 = WASM_VECTOR_LEN;
247
+ const ptr1 = passStringToWasm0(master_secret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
248
+ const len1 = WASM_VECTOR_LEN;
249
+ const ret = wasm.alloysocket_new(ptr0, len0, ptr1, len1, isLikeNone(encrypt_enabled) ? 0xFFFFFF : encrypt_enabled ? 1 : 0);
250
+ this.__wbg_ptr = ret >>> 0;
251
+ AlloySocketFinalization.register(this, this.__wbg_ptr, this);
252
+ return this;
253
+ }
254
+ /**
255
+ * 📩 이벤트 핸들러 등록
256
+ *
257
+ * @param event_type - 이벤트 타입 (예: "connect", "message", "disconnect", "chat")
258
+ * @param callback - JS 콜백 함수
259
+ * @param {string} event_type
260
+ * @param {Function} callback
261
+ */
262
+ on(event_type, callback) {
263
+ const ptr0 = passStringToWasm0(event_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
264
+ const len0 = WASM_VECTOR_LEN;
265
+ wasm.alloysocket_on(this.__wbg_ptr, ptr0, len0, addHeapObject(callback));
266
+ }
267
+ /**
268
+ * 📨 이벤트 기반 메시지 전송
269
+ *
270
+ * @param event_type - 이벤트 타입 (예: "chat", "sync")
271
+ * @param data - 전송할 데이터 (JS 객체)
272
+ * @param {string} event_type
273
+ * @param {any} data
274
+ */
275
+ send(event_type, data) {
276
+ try {
277
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
278
+ const ptr0 = passStringToWasm0(event_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
279
+ const len0 = WASM_VECTOR_LEN;
280
+ wasm.alloysocket_send(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(data));
281
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
282
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
283
+ if (r1) {
284
+ throw takeObject(r0);
285
+ }
286
+ } finally {
287
+ wasm.__wbindgen_add_to_stack_pointer(16);
288
+ }
289
+ }
290
+ /**
291
+ * ⚙️ 자동 재연결 활성화/비활성화
292
+ * @param {boolean} enabled
293
+ */
294
+ set_auto_reconnect(enabled) {
295
+ wasm.alloysocket_set_auto_reconnect(this.__wbg_ptr, enabled);
296
+ }
297
+ /**
298
+ * ⚙️ 최대 재연결 시도 횟수 설정
299
+ * @param {number} count
300
+ */
301
+ set_max_reconnect_attempts(count) {
302
+ wasm.alloysocket_set_max_reconnect_attempts(this.__wbg_ptr, count);
303
+ }
304
+ /**
305
+ * ⚙️ Ping 주기 설정 (밀리초)
306
+ * @param {number} ms
307
+ */
308
+ set_ping_interval(ms) {
309
+ wasm.alloysocket_set_ping_interval(this.__wbg_ptr, ms);
310
+ }
311
+ }
312
+ if (Symbol.dispose) AlloySocket.prototype[Symbol.dispose] = AlloySocket.prototype.free;
313
+
314
+ export class AlloyUtil {
315
+ __destroy_into_raw() {
316
+ const ptr = this.__wbg_ptr;
317
+ this.__wbg_ptr = 0;
318
+ AlloyUtilFinalization.unregister(this);
319
+ return ptr;
320
+ }
321
+ free() {
322
+ const ptr = this.__destroy_into_raw();
323
+ wasm.__wbg_alloyutil_free(ptr, 0);
324
+ }
325
+ /**
326
+ * Find items > threshold (Example of complex filter)
327
+ * @param {Int32Array} list
328
+ * @param {number} threshold
329
+ * @returns {Int32Array}
330
+ */
331
+ static filter_gt(list, threshold) {
332
+ try {
333
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
334
+ const ptr0 = passArray32ToWasm0(list, wasm.__wbindgen_export);
335
+ const len0 = WASM_VECTOR_LEN;
336
+ wasm.alloyutil_filter_gt(retptr, ptr0, len0, threshold);
337
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
338
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
339
+ var v2 = getArrayI32FromWasm0(r0, r1).slice();
340
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
341
+ return v2;
342
+ } finally {
343
+ wasm.__wbindgen_add_to_stack_pointer(16);
344
+ }
345
+ }
346
+ /**
347
+ * @param {string} input
348
+ * @returns {string}
349
+ */
350
+ static md5(input) {
351
+ let deferred2_0;
352
+ let deferred2_1;
353
+ try {
354
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
355
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
356
+ const len0 = WASM_VECTOR_LEN;
357
+ wasm.alloyutil_md5(retptr, ptr0, len0);
358
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
359
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
360
+ deferred2_0 = r0;
361
+ deferred2_1 = r1;
362
+ return getStringFromWasm0(r0, r1);
363
+ } finally {
364
+ wasm.__wbindgen_add_to_stack_pointer(16);
365
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
366
+ }
367
+ }
368
+ /**
369
+ * @param {string} input
370
+ * @returns {string}
371
+ */
372
+ static sha256(input) {
373
+ let deferred2_0;
374
+ let deferred2_1;
375
+ try {
376
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
377
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
378
+ const len0 = WASM_VECTOR_LEN;
379
+ wasm.alloyutil_sha256(retptr, ptr0, len0);
380
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
381
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
382
+ deferred2_0 = r0;
383
+ deferred2_1 = r1;
384
+ return getStringFromWasm0(r0, r1);
385
+ } finally {
386
+ wasm.__wbindgen_add_to_stack_pointer(16);
387
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
388
+ }
389
+ }
390
+ /**
391
+ * Shuffle a large array of integers (Fisher-Yates)
392
+ * Much faster than JS sort(() => 0.5 - Math.random())
393
+ * @param {Int32Array} list
394
+ * @returns {Int32Array}
395
+ */
396
+ static shuffle_i32(list) {
397
+ try {
398
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
399
+ const ptr0 = passArray32ToWasm0(list, wasm.__wbindgen_export);
400
+ const len0 = WASM_VECTOR_LEN;
401
+ wasm.alloyutil_shuffle_i32(retptr, ptr0, len0);
402
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
403
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
404
+ var v2 = getArrayI32FromWasm0(r0, r1).slice();
405
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
406
+ return v2;
407
+ } finally {
408
+ wasm.__wbindgen_add_to_stack_pointer(16);
409
+ }
410
+ }
411
+ /**
412
+ * High performance sort
413
+ * @param {Int32Array} list
414
+ * @returns {Int32Array}
415
+ */
416
+ static sort_i32(list) {
417
+ try {
418
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
419
+ const ptr0 = passArray32ToWasm0(list, wasm.__wbindgen_export);
420
+ const len0 = WASM_VECTOR_LEN;
421
+ wasm.alloyutil_sort_i32(retptr, ptr0, len0);
422
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
423
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
424
+ var v2 = getArrayI32FromWasm0(r0, r1).slice();
425
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
426
+ return v2;
427
+ } finally {
428
+ wasm.__wbindgen_add_to_stack_pointer(16);
429
+ }
430
+ }
431
+ }
432
+ if (Symbol.dispose) AlloyUtil.prototype[Symbol.dispose] = AlloyUtil.prototype.free;
433
+
434
+ function __wbg_get_imports() {
435
+ const import0 = {
436
+ __proto__: null,
437
+ __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {
438
+ const ret = debugString(getObject(arg1));
439
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
440
+ const len1 = WASM_VECTOR_LEN;
441
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
442
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
443
+ },
444
+ __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {
445
+ const ret = typeof(getObject(arg0)) === 'function';
446
+ return ret;
447
+ },
448
+ __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {
449
+ const val = getObject(arg0);
450
+ const ret = typeof(val) === 'object' && val !== null;
451
+ return ret;
452
+ },
453
+ __wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {
454
+ const ret = typeof(getObject(arg0)) === 'string';
455
+ return ret;
456
+ },
457
+ __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(arg0) {
458
+ const ret = getObject(arg0) === undefined;
459
+ return ret;
460
+ },
461
+ __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {
462
+ const obj = getObject(arg1);
463
+ const ret = typeof(obj) === 'string' ? obj : undefined;
464
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
465
+ var len1 = WASM_VECTOR_LEN;
466
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
467
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
468
+ },
469
+ __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {
470
+ throw new Error(getStringFromWasm0(arg0, arg1));
471
+ },
472
+ __wbg__wbg_cb_unref_d9b87ff7982e3b21: function(arg0) {
473
+ getObject(arg0)._wbg_cb_unref();
474
+ },
475
+ __wbg_apply_ada2ee1a60ac7b3c: function() { return handleError(function (arg0, arg1, arg2) {
476
+ const ret = getObject(arg0).apply(getObject(arg1), getObject(arg2));
477
+ return addHeapObject(ret);
478
+ }, arguments); },
479
+ __wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {
480
+ const ret = getObject(arg0).call(getObject(arg1));
481
+ return addHeapObject(ret);
482
+ }, arguments); },
483
+ __wbg_call_4708e0c13bdc8e95: function() { return handleError(function (arg0, arg1, arg2) {
484
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
485
+ return addHeapObject(ret);
486
+ }, arguments); },
487
+ __wbg_clearInterval_c75df0651e74fbb8: function(arg0, arg1) {
488
+ getObject(arg0).clearInterval(arg1);
489
+ },
490
+ __wbg_clearTimeout_df03cf00269bc442: function(arg0, arg1) {
491
+ getObject(arg0).clearTimeout(arg1);
492
+ },
493
+ __wbg_close_4408f5d5868dfdbf: function() { return handleError(function (arg0, arg1) {
494
+ getObject(arg0).close(arg1);
495
+ }, arguments); },
496
+ __wbg_code_a552f1e91eda69b7: function(arg0) {
497
+ const ret = getObject(arg0).code;
498
+ return ret;
499
+ },
500
+ __wbg_crypto_86f2631e91b51511: function(arg0) {
501
+ const ret = getObject(arg0).crypto;
502
+ return addHeapObject(ret);
503
+ },
504
+ __wbg_data_5330da50312d0bc1: function(arg0) {
505
+ const ret = getObject(arg0).data;
506
+ return addHeapObject(ret);
507
+ },
508
+ __wbg_error_9a7fe3f932034cde: function(arg0) {
509
+ console.error(getObject(arg0));
510
+ },
511
+ __wbg_fetch_e6e8e0a221783759: function(arg0, arg1) {
512
+ const ret = getObject(arg0).fetch(getObject(arg1));
513
+ return addHeapObject(ret);
514
+ },
515
+ __wbg_getRandomValues_9c5c1b115e142bb8: function() { return handleError(function (arg0, arg1) {
516
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
517
+ }, arguments); },
518
+ __wbg_getRandomValues_b3f15fcbfabb0f8b: function() { return handleError(function (arg0, arg1) {
519
+ getObject(arg0).getRandomValues(getObject(arg1));
520
+ }, arguments); },
521
+ __wbg_get_941633a1d2f510cb: function() { return handleError(function (arg0, arg1, arg2, arg3) {
522
+ const ret = getObject(arg1).get(getStringFromWasm0(arg2, arg3));
523
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
524
+ var len1 = WASM_VECTOR_LEN;
525
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
526
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
527
+ }, arguments); },
528
+ __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {
529
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
530
+ return addHeapObject(ret);
531
+ }, arguments); },
532
+ __wbg_headers_59a2938db9f80985: function(arg0) {
533
+ const ret = getObject(arg0).headers;
534
+ return addHeapObject(ret);
535
+ },
536
+ __wbg_host_92d607209031b72c: function() { return handleError(function (arg0, arg1) {
537
+ const ret = getObject(arg1).host;
538
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
539
+ const len1 = WASM_VECTOR_LEN;
540
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
541
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
542
+ }, arguments); },
543
+ __wbg_instanceof_Response_ee1d54d79ae41977: function(arg0) {
544
+ let result;
545
+ try {
546
+ result = getObject(arg0) instanceof Response;
547
+ } catch (_) {
548
+ result = false;
549
+ }
550
+ const ret = result;
551
+ return ret;
552
+ },
553
+ __wbg_instanceof_Window_ed49b2db8df90359: function(arg0) {
554
+ let result;
555
+ try {
556
+ result = getObject(arg0) instanceof Window;
557
+ } catch (_) {
558
+ result = false;
559
+ }
560
+ const ret = result;
561
+ return ret;
562
+ },
563
+ __wbg_length_32ed9a279acd054c: function(arg0) {
564
+ const ret = getObject(arg0).length;
565
+ return ret;
566
+ },
567
+ __wbg_location_df7ca06c93e51763: function(arg0) {
568
+ const ret = getObject(arg0).location;
569
+ return addHeapObject(ret);
570
+ },
571
+ __wbg_log_6b5ca2e6124b2808: function(arg0) {
572
+ console.log(getObject(arg0));
573
+ },
574
+ __wbg_msCrypto_d562bbe83e0d4b91: function(arg0) {
575
+ const ret = getObject(arg0).msCrypto;
576
+ return addHeapObject(ret);
577
+ },
578
+ __wbg_navigator_43be698ba96fc088: function(arg0) {
579
+ const ret = getObject(arg0).navigator;
580
+ return addHeapObject(ret);
581
+ },
582
+ __wbg_new_057993d5b5e07835: function() { return handleError(function (arg0, arg1) {
583
+ const ret = new WebSocket(getStringFromWasm0(arg0, arg1));
584
+ return addHeapObject(ret);
585
+ }, arguments); },
586
+ __wbg_new_361308b2356cecd0: function() {
587
+ const ret = new Object();
588
+ return addHeapObject(ret);
589
+ },
590
+ __wbg_new_3eb36ae241fe6f44: function() {
591
+ const ret = new Array();
592
+ return addHeapObject(ret);
593
+ },
594
+ __wbg_new_64284bd487f9d239: function() { return handleError(function () {
595
+ const ret = new Headers();
596
+ return addHeapObject(ret);
597
+ }, arguments); },
598
+ __wbg_new_b5d9e2fb389fef91: function(arg0, arg1) {
599
+ try {
600
+ var state0 = {a: arg0, b: arg1};
601
+ var cb0 = (arg0, arg1) => {
602
+ const a = state0.a;
603
+ state0.a = 0;
604
+ try {
605
+ return __wasm_bindgen_func_elem_730(a, state0.b, arg0, arg1);
606
+ } finally {
607
+ state0.a = a;
608
+ }
609
+ };
610
+ const ret = new Promise(cb0);
611
+ return addHeapObject(ret);
612
+ } finally {
613
+ state0.a = state0.b = 0;
614
+ }
615
+ },
616
+ __wbg_new_no_args_1c7c842f08d00ebb: function(arg0, arg1) {
617
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
618
+ return addHeapObject(ret);
619
+ },
620
+ __wbg_new_with_length_a2c39cbe88fd8ff1: function(arg0) {
621
+ const ret = new Uint8Array(arg0 >>> 0);
622
+ return addHeapObject(ret);
623
+ },
624
+ __wbg_new_with_str_and_init_a61cbc6bdef21614: function() { return handleError(function (arg0, arg1, arg2) {
625
+ const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
626
+ return addHeapObject(ret);
627
+ }, arguments); },
628
+ __wbg_node_e1f24f89a7336c2e: function(arg0) {
629
+ const ret = getObject(arg0).node;
630
+ return addHeapObject(ret);
631
+ },
632
+ __wbg_now_a3af9a2f4bbaa4d1: function() {
633
+ const ret = Date.now();
634
+ return ret;
635
+ },
636
+ __wbg_parse_708461a1feddfb38: function() { return handleError(function (arg0, arg1) {
637
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
638
+ return addHeapObject(ret);
639
+ }, arguments); },
640
+ __wbg_process_3975fd6c72f520aa: function(arg0) {
641
+ const ret = getObject(arg0).process;
642
+ return addHeapObject(ret);
643
+ },
644
+ __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {
645
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
646
+ },
647
+ __wbg_push_8ffdcb2063340ba5: function(arg0, arg1) {
648
+ const ret = getObject(arg0).push(getObject(arg1));
649
+ return ret;
650
+ },
651
+ __wbg_queueMicrotask_0aa0a927f78f5d98: function(arg0) {
652
+ const ret = getObject(arg0).queueMicrotask;
653
+ return addHeapObject(ret);
654
+ },
655
+ __wbg_queueMicrotask_5bb536982f78a56f: function(arg0) {
656
+ queueMicrotask(getObject(arg0));
657
+ },
658
+ __wbg_randomFillSync_f8c153b79f285817: function() { return handleError(function (arg0, arg1) {
659
+ getObject(arg0).randomFillSync(takeObject(arg1));
660
+ }, arguments); },
661
+ __wbg_readyState_1bb73ec7b8a54656: function(arg0) {
662
+ const ret = getObject(arg0).readyState;
663
+ return ret;
664
+ },
665
+ __wbg_reason_35fce8e55dd90f31: function(arg0, arg1) {
666
+ const ret = getObject(arg1).reason;
667
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
668
+ const len1 = WASM_VECTOR_LEN;
669
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
670
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
671
+ },
672
+ __wbg_require_b74f47fc2d022fd6: function() { return handleError(function () {
673
+ const ret = module.require;
674
+ return addHeapObject(ret);
675
+ }, arguments); },
676
+ __wbg_resolve_002c4b7d9d8f6b64: function(arg0) {
677
+ const ret = Promise.resolve(getObject(arg0));
678
+ return addHeapObject(ret);
679
+ },
680
+ __wbg_send_bc0336a1b5ce4fb7: function() { return handleError(function (arg0, arg1, arg2) {
681
+ getObject(arg0).send(getStringFromWasm0(arg1, arg2));
682
+ }, arguments); },
683
+ __wbg_setInterval_612728cce80dfecf: function() { return handleError(function (arg0, arg1, arg2) {
684
+ const ret = getObject(arg0).setInterval(getObject(arg1), arg2);
685
+ return ret;
686
+ }, arguments); },
687
+ __wbg_setTimeout_eff32631ea138533: function() { return handleError(function (arg0, arg1, arg2) {
688
+ const ret = getObject(arg0).setTimeout(getObject(arg1), arg2);
689
+ return ret;
690
+ }, arguments); },
691
+ __wbg_set_6cb8631f80447a67: function() { return handleError(function (arg0, arg1, arg2) {
692
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
693
+ return ret;
694
+ }, arguments); },
695
+ __wbg_set_binaryType_5bbf62e9f705dc1a: function(arg0, arg1) {
696
+ getObject(arg0).binaryType = __wbindgen_enum_BinaryType[arg1];
697
+ },
698
+ __wbg_set_body_9a7e00afe3cfe244: function(arg0, arg1) {
699
+ getObject(arg0).body = getObject(arg1);
700
+ },
701
+ __wbg_set_credentials_c4a58d2e05ef24fb: function(arg0, arg1) {
702
+ getObject(arg0).credentials = __wbindgen_enum_RequestCredentials[arg1];
703
+ },
704
+ __wbg_set_db769d02949a271d: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
705
+ getObject(arg0).set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
706
+ }, arguments); },
707
+ __wbg_set_headers_cfc5f4b2c1f20549: function(arg0, arg1) {
708
+ getObject(arg0).headers = getObject(arg1);
709
+ },
710
+ __wbg_set_method_c3e20375f5ae7fac: function(arg0, arg1, arg2) {
711
+ getObject(arg0).method = getStringFromWasm0(arg1, arg2);
712
+ },
713
+ __wbg_set_mode_b13642c312648202: function(arg0, arg1) {
714
+ getObject(arg0).mode = __wbindgen_enum_RequestMode[arg1];
715
+ },
716
+ __wbg_set_onclose_d382f3e2c2b850eb: function(arg0, arg1) {
717
+ getObject(arg0).onclose = getObject(arg1);
718
+ },
719
+ __wbg_set_onerror_377f18bf4569bf85: function(arg0, arg1) {
720
+ getObject(arg0).onerror = getObject(arg1);
721
+ },
722
+ __wbg_set_onmessage_2114aa5f4f53051e: function(arg0, arg1) {
723
+ getObject(arg0).onmessage = getObject(arg1);
724
+ },
725
+ __wbg_set_onopen_b7b52d519d6c0f11: function(arg0, arg1) {
726
+ getObject(arg0).onopen = getObject(arg1);
727
+ },
728
+ __wbg_static_accessor_GLOBAL_12837167ad935116: function() {
729
+ const ret = typeof global === 'undefined' ? null : global;
730
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
731
+ },
732
+ __wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
733
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
734
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
735
+ },
736
+ __wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
737
+ const ret = typeof self === 'undefined' ? null : self;
738
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
739
+ },
740
+ __wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
741
+ const ret = typeof window === 'undefined' ? null : window;
742
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
743
+ },
744
+ __wbg_stringify_8d1cc6ff383e8bae: function() { return handleError(function (arg0) {
745
+ const ret = JSON.stringify(getObject(arg0));
746
+ return addHeapObject(ret);
747
+ }, arguments); },
748
+ __wbg_subarray_a96e1fef17ed23cb: function(arg0, arg1, arg2) {
749
+ const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
750
+ return addHeapObject(ret);
751
+ },
752
+ __wbg_text_083b8727c990c8c0: function() { return handleError(function (arg0) {
753
+ const ret = getObject(arg0).text();
754
+ return addHeapObject(ret);
755
+ }, arguments); },
756
+ __wbg_then_0d9fe2c7b1857d32: function(arg0, arg1, arg2) {
757
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
758
+ return addHeapObject(ret);
759
+ },
760
+ __wbg_then_b9e7b3b5f1a9e1b5: function(arg0, arg1) {
761
+ const ret = getObject(arg0).then(getObject(arg1));
762
+ return addHeapObject(ret);
763
+ },
764
+ __wbg_userAgent_34463fd660ba4a2a: function() { return handleError(function (arg0, arg1) {
765
+ const ret = getObject(arg1).userAgent;
766
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
767
+ const len1 = WASM_VECTOR_LEN;
768
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
769
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
770
+ }, arguments); },
771
+ __wbg_versions_4e31226f5e8dc909: function(arg0) {
772
+ const ret = getObject(arg0).versions;
773
+ return addHeapObject(ret);
774
+ },
775
+ __wbg_warn_f7ae1b2e66ccb930: function(arg0) {
776
+ console.warn(getObject(arg0));
777
+ },
778
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
779
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 2, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
780
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_87, __wasm_bindgen_func_elem_88);
781
+ return addHeapObject(ret);
782
+ },
783
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
784
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 2, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
785
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_87, __wasm_bindgen_func_elem_88);
786
+ return addHeapObject(ret);
787
+ },
788
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
789
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 2, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
790
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_87, __wasm_bindgen_func_elem_88);
791
+ return addHeapObject(ret);
792
+ },
793
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
794
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 1, function: Function { arguments: [], shim_idx: 6, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
795
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_87, __wasm_bindgen_func_elem_92);
796
+ return addHeapObject(ret);
797
+ },
798
+ __wbindgen_cast_0000000000000005: function(arg0, arg1) {
799
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 132, function: Function { arguments: [Externref], shim_idx: 133, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
800
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_676, __wasm_bindgen_func_elem_677);
801
+ return addHeapObject(ret);
802
+ },
803
+ __wbindgen_cast_0000000000000006: function(arg0) {
804
+ // Cast intrinsic for `F64 -> Externref`.
805
+ const ret = arg0;
806
+ return addHeapObject(ret);
807
+ },
808
+ __wbindgen_cast_0000000000000007: function(arg0, arg1) {
809
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
810
+ const ret = getArrayU8FromWasm0(arg0, arg1);
811
+ return addHeapObject(ret);
812
+ },
813
+ __wbindgen_cast_0000000000000008: function(arg0, arg1) {
814
+ // Cast intrinsic for `Ref(String) -> Externref`.
815
+ const ret = getStringFromWasm0(arg0, arg1);
816
+ return addHeapObject(ret);
817
+ },
818
+ __wbindgen_object_clone_ref: function(arg0) {
819
+ const ret = getObject(arg0);
820
+ return addHeapObject(ret);
821
+ },
822
+ __wbindgen_object_drop_ref: function(arg0) {
823
+ takeObject(arg0);
824
+ },
825
+ };
826
+ return {
827
+ __proto__: null,
828
+ "./alloy_client_wasm_bg.js": import0,
829
+ };
830
+ }
831
+
832
+ function __wasm_bindgen_func_elem_92(arg0, arg1) {
833
+ wasm.__wasm_bindgen_func_elem_92(arg0, arg1);
834
+ }
835
+
836
+ function __wasm_bindgen_func_elem_88(arg0, arg1, arg2) {
837
+ wasm.__wasm_bindgen_func_elem_88(arg0, arg1, addHeapObject(arg2));
838
+ }
839
+
840
+ function __wasm_bindgen_func_elem_677(arg0, arg1, arg2) {
841
+ wasm.__wasm_bindgen_func_elem_677(arg0, arg1, addHeapObject(arg2));
842
+ }
843
+
844
+ function __wasm_bindgen_func_elem_730(arg0, arg1, arg2, arg3) {
845
+ wasm.__wasm_bindgen_func_elem_730(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
846
+ }
847
+
848
+
849
+ const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
850
+
851
+
852
+ const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
853
+
854
+
855
+ const __wbindgen_enum_RequestMode = ["same-origin", "no-cors", "cors", "navigate"];
856
+ const AlloyClientFinalization = (typeof FinalizationRegistry === 'undefined')
857
+ ? { register: () => {}, unregister: () => {} }
858
+ : new FinalizationRegistry(ptr => wasm.__wbg_alloyclient_free(ptr >>> 0, 1));
859
+ const AlloySocketFinalization = (typeof FinalizationRegistry === 'undefined')
860
+ ? { register: () => {}, unregister: () => {} }
861
+ : new FinalizationRegistry(ptr => wasm.__wbg_alloysocket_free(ptr >>> 0, 1));
862
+ const AlloyUtilFinalization = (typeof FinalizationRegistry === 'undefined')
863
+ ? { register: () => {}, unregister: () => {} }
864
+ : new FinalizationRegistry(ptr => wasm.__wbg_alloyutil_free(ptr >>> 0, 1));
865
+
866
+ function addHeapObject(obj) {
867
+ if (heap_next === heap.length) heap.push(heap.length + 1);
868
+ const idx = heap_next;
869
+ heap_next = heap[idx];
870
+
871
+ heap[idx] = obj;
872
+ return idx;
873
+ }
874
+
875
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
876
+ ? { register: () => {}, unregister: () => {} }
877
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
878
+
879
+ function debugString(val) {
880
+ // primitive types
881
+ const type = typeof val;
882
+ if (type == 'number' || type == 'boolean' || val == null) {
883
+ return `${val}`;
884
+ }
885
+ if (type == 'string') {
886
+ return `"${val}"`;
887
+ }
888
+ if (type == 'symbol') {
889
+ const description = val.description;
890
+ if (description == null) {
891
+ return 'Symbol';
892
+ } else {
893
+ return `Symbol(${description})`;
894
+ }
895
+ }
896
+ if (type == 'function') {
897
+ const name = val.name;
898
+ if (typeof name == 'string' && name.length > 0) {
899
+ return `Function(${name})`;
900
+ } else {
901
+ return 'Function';
902
+ }
903
+ }
904
+ // objects
905
+ if (Array.isArray(val)) {
906
+ const length = val.length;
907
+ let debug = '[';
908
+ if (length > 0) {
909
+ debug += debugString(val[0]);
910
+ }
911
+ for(let i = 1; i < length; i++) {
912
+ debug += ', ' + debugString(val[i]);
913
+ }
914
+ debug += ']';
915
+ return debug;
916
+ }
917
+ // Test for built-in
918
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
919
+ let className;
920
+ if (builtInMatches && builtInMatches.length > 1) {
921
+ className = builtInMatches[1];
922
+ } else {
923
+ // Failed to match the standard '[object ClassName]'
924
+ return toString.call(val);
925
+ }
926
+ if (className == 'Object') {
927
+ // we're a user defined class or Object
928
+ // JSON.stringify avoids problems with cycles, and is generally much
929
+ // easier than looping through ownProperties of `val`.
930
+ try {
931
+ return 'Object(' + JSON.stringify(val) + ')';
932
+ } catch (_) {
933
+ return 'Object';
934
+ }
935
+ }
936
+ // errors
937
+ if (val instanceof Error) {
938
+ return `${val.name}: ${val.message}\n${val.stack}`;
939
+ }
940
+ // TODO we could test for more things here, like `Set`s and `Map`s.
941
+ return className;
942
+ }
943
+
944
+ function dropObject(idx) {
945
+ if (idx < 132) return;
946
+ heap[idx] = heap_next;
947
+ heap_next = idx;
948
+ }
949
+
950
+ function getArrayI32FromWasm0(ptr, len) {
951
+ ptr = ptr >>> 0;
952
+ return getInt32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
953
+ }
954
+
955
+ function getArrayU8FromWasm0(ptr, len) {
956
+ ptr = ptr >>> 0;
957
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
958
+ }
959
+
960
+ let cachedDataViewMemory0 = null;
961
+ function getDataViewMemory0() {
962
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
963
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
964
+ }
965
+ return cachedDataViewMemory0;
966
+ }
967
+
968
+ let cachedInt32ArrayMemory0 = null;
969
+ function getInt32ArrayMemory0() {
970
+ if (cachedInt32ArrayMemory0 === null || cachedInt32ArrayMemory0.byteLength === 0) {
971
+ cachedInt32ArrayMemory0 = new Int32Array(wasm.memory.buffer);
972
+ }
973
+ return cachedInt32ArrayMemory0;
974
+ }
975
+
976
+ function getStringFromWasm0(ptr, len) {
977
+ ptr = ptr >>> 0;
978
+ return decodeText(ptr, len);
979
+ }
980
+
981
+ let cachedUint32ArrayMemory0 = null;
982
+ function getUint32ArrayMemory0() {
983
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
984
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
985
+ }
986
+ return cachedUint32ArrayMemory0;
987
+ }
988
+
989
+ let cachedUint8ArrayMemory0 = null;
990
+ function getUint8ArrayMemory0() {
991
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
992
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
993
+ }
994
+ return cachedUint8ArrayMemory0;
995
+ }
996
+
997
+ function getObject(idx) { return heap[idx]; }
998
+
999
+ function handleError(f, args) {
1000
+ try {
1001
+ return f.apply(this, args);
1002
+ } catch (e) {
1003
+ wasm.__wbindgen_export3(addHeapObject(e));
1004
+ }
1005
+ }
1006
+
1007
+ let heap = new Array(128).fill(undefined);
1008
+ heap.push(undefined, null, true, false);
1009
+
1010
+ let heap_next = heap.length;
1011
+
1012
+ function isLikeNone(x) {
1013
+ return x === undefined || x === null;
1014
+ }
1015
+
1016
+ function makeMutClosure(arg0, arg1, dtor, f) {
1017
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
1018
+ const real = (...args) => {
1019
+
1020
+ // First up with a closure we increment the internal reference
1021
+ // count. This ensures that the Rust closure environment won't
1022
+ // be deallocated while we're invoking it.
1023
+ state.cnt++;
1024
+ const a = state.a;
1025
+ state.a = 0;
1026
+ try {
1027
+ return f(a, state.b, ...args);
1028
+ } finally {
1029
+ state.a = a;
1030
+ real._wbg_cb_unref();
1031
+ }
1032
+ };
1033
+ real._wbg_cb_unref = () => {
1034
+ if (--state.cnt === 0) {
1035
+ state.dtor(state.a, state.b);
1036
+ state.a = 0;
1037
+ CLOSURE_DTORS.unregister(state);
1038
+ }
1039
+ };
1040
+ CLOSURE_DTORS.register(real, state, state);
1041
+ return real;
1042
+ }
1043
+
1044
+ function passArray32ToWasm0(arg, malloc) {
1045
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1046
+ getUint32ArrayMemory0().set(arg, ptr / 4);
1047
+ WASM_VECTOR_LEN = arg.length;
1048
+ return ptr;
1049
+ }
1050
+
1051
+ function passStringToWasm0(arg, malloc, realloc) {
1052
+ if (realloc === undefined) {
1053
+ const buf = cachedTextEncoder.encode(arg);
1054
+ const ptr = malloc(buf.length, 1) >>> 0;
1055
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1056
+ WASM_VECTOR_LEN = buf.length;
1057
+ return ptr;
1058
+ }
1059
+
1060
+ let len = arg.length;
1061
+ let ptr = malloc(len, 1) >>> 0;
1062
+
1063
+ const mem = getUint8ArrayMemory0();
1064
+
1065
+ let offset = 0;
1066
+
1067
+ for (; offset < len; offset++) {
1068
+ const code = arg.charCodeAt(offset);
1069
+ if (code > 0x7F) break;
1070
+ mem[ptr + offset] = code;
1071
+ }
1072
+ if (offset !== len) {
1073
+ if (offset !== 0) {
1074
+ arg = arg.slice(offset);
1075
+ }
1076
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1077
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1078
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1079
+
1080
+ offset += ret.written;
1081
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1082
+ }
1083
+
1084
+ WASM_VECTOR_LEN = offset;
1085
+ return ptr;
1086
+ }
1087
+
1088
+ function takeObject(idx) {
1089
+ const ret = getObject(idx);
1090
+ dropObject(idx);
1091
+ return ret;
1092
+ }
1093
+
1094
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1095
+ cachedTextDecoder.decode();
1096
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
1097
+ let numBytesDecoded = 0;
1098
+ function decodeText(ptr, len) {
1099
+ numBytesDecoded += len;
1100
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
1101
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1102
+ cachedTextDecoder.decode();
1103
+ numBytesDecoded = len;
1104
+ }
1105
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1106
+ }
1107
+
1108
+ const cachedTextEncoder = new TextEncoder();
1109
+
1110
+ if (!('encodeInto' in cachedTextEncoder)) {
1111
+ cachedTextEncoder.encodeInto = function (arg, view) {
1112
+ const buf = cachedTextEncoder.encode(arg);
1113
+ view.set(buf);
1114
+ return {
1115
+ read: arg.length,
1116
+ written: buf.length
1117
+ };
1118
+ };
1119
+ }
1120
+
1121
+ let WASM_VECTOR_LEN = 0;
1122
+
1123
+ let wasmModule, wasm;
1124
+ function __wbg_finalize_init(instance, module) {
1125
+ wasm = instance.exports;
1126
+ wasmModule = module;
1127
+ cachedDataViewMemory0 = null;
1128
+ cachedInt32ArrayMemory0 = null;
1129
+ cachedUint32ArrayMemory0 = null;
1130
+ cachedUint8ArrayMemory0 = null;
1131
+ return wasm;
1132
+ }
1133
+
1134
+ async function __wbg_load(module, imports) {
1135
+ if (typeof Response === 'function' && module instanceof Response) {
1136
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1137
+ try {
1138
+ return await WebAssembly.instantiateStreaming(module, imports);
1139
+ } catch (e) {
1140
+ const validResponse = module.ok && expectedResponseType(module.type);
1141
+
1142
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1143
+ 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);
1144
+
1145
+ } else { throw e; }
1146
+ }
1147
+ }
1148
+
1149
+ const bytes = await module.arrayBuffer();
1150
+ return await WebAssembly.instantiate(bytes, imports);
1151
+ } else {
1152
+ const instance = await WebAssembly.instantiate(module, imports);
1153
+
1154
+ if (instance instanceof WebAssembly.Instance) {
1155
+ return { instance, module };
1156
+ } else {
1157
+ return instance;
1158
+ }
1159
+ }
1160
+
1161
+ function expectedResponseType(type) {
1162
+ switch (type) {
1163
+ case 'basic': case 'cors': case 'default': return true;
1164
+ }
1165
+ return false;
1166
+ }
1167
+ }
1168
+
1169
+ function initSync(module) {
1170
+ if (wasm !== undefined) return wasm;
1171
+
1172
+
1173
+ if (module !== undefined) {
1174
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1175
+ ({module} = module)
1176
+ } else {
1177
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1178
+ }
1179
+ }
1180
+
1181
+ const imports = __wbg_get_imports();
1182
+ if (!(module instanceof WebAssembly.Module)) {
1183
+ module = new WebAssembly.Module(module);
1184
+ }
1185
+ const instance = new WebAssembly.Instance(module, imports);
1186
+ return __wbg_finalize_init(instance, module);
1187
+ }
1188
+
1189
+ async function __wbg_init(module_or_path) {
1190
+ if (wasm !== undefined) return wasm;
1191
+
1192
+
1193
+ if (module_or_path !== undefined) {
1194
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1195
+ ({module_or_path} = module_or_path)
1196
+ } else {
1197
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1198
+ }
1199
+ }
1200
+
1201
+ if (module_or_path === undefined) {
1202
+ module_or_path = new URL('alloy_client_wasm_bg.wasm', import.meta.url);
1203
+ }
1204
+ const imports = __wbg_get_imports();
1205
+
1206
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1207
+ module_or_path = fetch(module_or_path);
1208
+ }
1209
+
1210
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1211
+
1212
+ return __wbg_finalize_init(instance, module);
1213
+ }
1214
+
1215
+ export { initSync, __wbg_init as default };
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alloy-framework/client-wasm",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "type": "module",
5
5
  "description": "Alloy Secure Protocol Client SDK (WASM) — browser-side cryptography and WebSocket",
6
6
  "main": "alloy_client_wasm.js",