freshblu-wasm 0.1.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.
- package/README.md +58 -0
- package/freshblu_wasm.d.ts +59 -0
- package/freshblu_wasm.js +9 -0
- package/freshblu_wasm_bg.js +847 -0
- package/freshblu_wasm_bg.wasm +0 -0
- package/package.json +32 -0
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# freshblu-wasm
|
|
2
|
+
|
|
3
|
+
WASM client library for FreshBlu — works in browsers and Node.js.
|
|
4
|
+
|
|
5
|
+
## Building
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# For browsers
|
|
9
|
+
wasm-pack build --target web
|
|
10
|
+
|
|
11
|
+
# For Node.js
|
|
12
|
+
wasm-pack build --target nodejs
|
|
13
|
+
|
|
14
|
+
# For bundlers (Webpack/Vite)
|
|
15
|
+
wasm-pack build --target bundler
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Browser Usage
|
|
19
|
+
|
|
20
|
+
```html
|
|
21
|
+
<script type="module">
|
|
22
|
+
import init, { FreshBluConfig, FreshBluHttp } from './pkg/freshblu_wasm.js';
|
|
23
|
+
|
|
24
|
+
await init();
|
|
25
|
+
|
|
26
|
+
const config = new FreshBluConfig('localhost', 3000);
|
|
27
|
+
const client = new FreshBluHttp(config);
|
|
28
|
+
|
|
29
|
+
// Check server status
|
|
30
|
+
const status = await client.status();
|
|
31
|
+
console.log(status);
|
|
32
|
+
|
|
33
|
+
// Register a device
|
|
34
|
+
const device = await client.register('sensor');
|
|
35
|
+
console.log(device.uuid, device.token);
|
|
36
|
+
</script>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Node.js Usage
|
|
40
|
+
|
|
41
|
+
```javascript
|
|
42
|
+
const { FreshBluConfig, FreshBluHttp } = require('./pkg/freshblu_wasm.js');
|
|
43
|
+
|
|
44
|
+
const config = new FreshBluConfig('localhost', 3000);
|
|
45
|
+
const client = new FreshBluHttp(config);
|
|
46
|
+
const status = await client.status();
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Testing
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
wasm-pack test --node
|
|
53
|
+
wasm-pack test --headless --chrome
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
MIT OR Apache-2.0
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the FreshBlu client
|
|
6
|
+
*/
|
|
7
|
+
export class FreshBluConfig {
|
|
8
|
+
free(): void;
|
|
9
|
+
[Symbol.dispose](): void;
|
|
10
|
+
http_base_url(): string;
|
|
11
|
+
constructor(hostname: string, port: number);
|
|
12
|
+
set_secure(secure: boolean): void;
|
|
13
|
+
set_token(token: string): void;
|
|
14
|
+
set_uuid(uuid: string): void;
|
|
15
|
+
ws_url(): string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* HTTP-based FreshBlu client (works in browser and Node.js)
|
|
20
|
+
*/
|
|
21
|
+
export class FreshBluHttp {
|
|
22
|
+
free(): void;
|
|
23
|
+
[Symbol.dispose](): void;
|
|
24
|
+
/**
|
|
25
|
+
* Get a device by UUID
|
|
26
|
+
*/
|
|
27
|
+
get_device(uuid: string): Promise<any>;
|
|
28
|
+
/**
|
|
29
|
+
* Send a message
|
|
30
|
+
*/
|
|
31
|
+
message(msg: any): Promise<any>;
|
|
32
|
+
constructor(config: FreshBluConfig);
|
|
33
|
+
/**
|
|
34
|
+
* Register a new device. Returns JSON string with uuid and token.
|
|
35
|
+
*/
|
|
36
|
+
register(properties: any): Promise<any>;
|
|
37
|
+
/**
|
|
38
|
+
* Search devices
|
|
39
|
+
*/
|
|
40
|
+
search(query: any): Promise<any>;
|
|
41
|
+
/**
|
|
42
|
+
* Get server status
|
|
43
|
+
*/
|
|
44
|
+
status(): Promise<any>;
|
|
45
|
+
/**
|
|
46
|
+
* Create a subscription
|
|
47
|
+
*/
|
|
48
|
+
subscribe(subscriber_uuid: string, emitter_uuid: string, subscription_type: string): Promise<any>;
|
|
49
|
+
/**
|
|
50
|
+
* Update a device
|
|
51
|
+
*/
|
|
52
|
+
update_device(uuid: string, properties: any): Promise<any>;
|
|
53
|
+
/**
|
|
54
|
+
* Get authenticated device info
|
|
55
|
+
*/
|
|
56
|
+
whoami(): Promise<any>;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function main(): void;
|
package/freshblu_wasm.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./freshblu_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
import * as wasm from "./freshblu_wasm_bg.wasm";
|
|
4
|
+
import { __wbg_set_wasm } from "./freshblu_wasm_bg.js";
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
FreshBluConfig, FreshBluHttp, main
|
|
9
|
+
} from "./freshblu_wasm_bg.js";
|
|
@@ -0,0 +1,847 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for the FreshBlu client
|
|
3
|
+
*/
|
|
4
|
+
export class FreshBluConfig {
|
|
5
|
+
__destroy_into_raw() {
|
|
6
|
+
const ptr = this.__wbg_ptr;
|
|
7
|
+
this.__wbg_ptr = 0;
|
|
8
|
+
FreshBluConfigFinalization.unregister(this);
|
|
9
|
+
return ptr;
|
|
10
|
+
}
|
|
11
|
+
free() {
|
|
12
|
+
const ptr = this.__destroy_into_raw();
|
|
13
|
+
wasm.__wbg_freshbluconfig_free(ptr, 0);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @returns {string}
|
|
17
|
+
*/
|
|
18
|
+
http_base_url() {
|
|
19
|
+
let deferred1_0;
|
|
20
|
+
let deferred1_1;
|
|
21
|
+
try {
|
|
22
|
+
const ret = wasm.freshbluconfig_http_base_url(this.__wbg_ptr);
|
|
23
|
+
deferred1_0 = ret[0];
|
|
24
|
+
deferred1_1 = ret[1];
|
|
25
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
26
|
+
} finally {
|
|
27
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @param {string} hostname
|
|
32
|
+
* @param {number} port
|
|
33
|
+
*/
|
|
34
|
+
constructor(hostname, port) {
|
|
35
|
+
const ptr0 = passStringToWasm0(hostname, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
36
|
+
const len0 = WASM_VECTOR_LEN;
|
|
37
|
+
const ret = wasm.freshbluconfig_new(ptr0, len0, port);
|
|
38
|
+
this.__wbg_ptr = ret >>> 0;
|
|
39
|
+
FreshBluConfigFinalization.register(this, this.__wbg_ptr, this);
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @param {boolean} secure
|
|
44
|
+
*/
|
|
45
|
+
set_secure(secure) {
|
|
46
|
+
wasm.freshbluconfig_set_secure(this.__wbg_ptr, secure);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @param {string} token
|
|
50
|
+
*/
|
|
51
|
+
set_token(token) {
|
|
52
|
+
const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
53
|
+
const len0 = WASM_VECTOR_LEN;
|
|
54
|
+
wasm.freshbluconfig_set_token(this.__wbg_ptr, ptr0, len0);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @param {string} uuid
|
|
58
|
+
*/
|
|
59
|
+
set_uuid(uuid) {
|
|
60
|
+
const ptr0 = passStringToWasm0(uuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
61
|
+
const len0 = WASM_VECTOR_LEN;
|
|
62
|
+
wasm.freshbluconfig_set_uuid(this.__wbg_ptr, ptr0, len0);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @returns {string}
|
|
66
|
+
*/
|
|
67
|
+
ws_url() {
|
|
68
|
+
let deferred1_0;
|
|
69
|
+
let deferred1_1;
|
|
70
|
+
try {
|
|
71
|
+
const ret = wasm.freshbluconfig_ws_url(this.__wbg_ptr);
|
|
72
|
+
deferred1_0 = ret[0];
|
|
73
|
+
deferred1_1 = ret[1];
|
|
74
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
75
|
+
} finally {
|
|
76
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (Symbol.dispose) FreshBluConfig.prototype[Symbol.dispose] = FreshBluConfig.prototype.free;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* HTTP-based FreshBlu client (works in browser and Node.js)
|
|
84
|
+
*/
|
|
85
|
+
export class FreshBluHttp {
|
|
86
|
+
__destroy_into_raw() {
|
|
87
|
+
const ptr = this.__wbg_ptr;
|
|
88
|
+
this.__wbg_ptr = 0;
|
|
89
|
+
FreshBluHttpFinalization.unregister(this);
|
|
90
|
+
return ptr;
|
|
91
|
+
}
|
|
92
|
+
free() {
|
|
93
|
+
const ptr = this.__destroy_into_raw();
|
|
94
|
+
wasm.__wbg_freshbluhttp_free(ptr, 0);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Get a device by UUID
|
|
98
|
+
* @param {string} uuid
|
|
99
|
+
* @returns {Promise<any>}
|
|
100
|
+
*/
|
|
101
|
+
get_device(uuid) {
|
|
102
|
+
const ptr0 = passStringToWasm0(uuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
103
|
+
const len0 = WASM_VECTOR_LEN;
|
|
104
|
+
const ret = wasm.freshbluhttp_get_device(this.__wbg_ptr, ptr0, len0);
|
|
105
|
+
return ret;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Send a message
|
|
109
|
+
* @param {any} msg
|
|
110
|
+
* @returns {Promise<any>}
|
|
111
|
+
*/
|
|
112
|
+
message(msg) {
|
|
113
|
+
const ret = wasm.freshbluhttp_message(this.__wbg_ptr, msg);
|
|
114
|
+
return ret;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* @param {FreshBluConfig} config
|
|
118
|
+
*/
|
|
119
|
+
constructor(config) {
|
|
120
|
+
_assertClass(config, FreshBluConfig);
|
|
121
|
+
var ptr0 = config.__destroy_into_raw();
|
|
122
|
+
const ret = wasm.freshbluhttp_new(ptr0);
|
|
123
|
+
this.__wbg_ptr = ret >>> 0;
|
|
124
|
+
FreshBluHttpFinalization.register(this, this.__wbg_ptr, this);
|
|
125
|
+
return this;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Register a new device. Returns JSON string with uuid and token.
|
|
129
|
+
* @param {any} properties
|
|
130
|
+
* @returns {Promise<any>}
|
|
131
|
+
*/
|
|
132
|
+
register(properties) {
|
|
133
|
+
const ret = wasm.freshbluhttp_register(this.__wbg_ptr, properties);
|
|
134
|
+
return ret;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Search devices
|
|
138
|
+
* @param {any} query
|
|
139
|
+
* @returns {Promise<any>}
|
|
140
|
+
*/
|
|
141
|
+
search(query) {
|
|
142
|
+
const ret = wasm.freshbluhttp_search(this.__wbg_ptr, query);
|
|
143
|
+
return ret;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Get server status
|
|
147
|
+
* @returns {Promise<any>}
|
|
148
|
+
*/
|
|
149
|
+
status() {
|
|
150
|
+
const ret = wasm.freshbluhttp_status(this.__wbg_ptr);
|
|
151
|
+
return ret;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Create a subscription
|
|
155
|
+
* @param {string} subscriber_uuid
|
|
156
|
+
* @param {string} emitter_uuid
|
|
157
|
+
* @param {string} subscription_type
|
|
158
|
+
* @returns {Promise<any>}
|
|
159
|
+
*/
|
|
160
|
+
subscribe(subscriber_uuid, emitter_uuid, subscription_type) {
|
|
161
|
+
const ptr0 = passStringToWasm0(subscriber_uuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
162
|
+
const len0 = WASM_VECTOR_LEN;
|
|
163
|
+
const ptr1 = passStringToWasm0(emitter_uuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
164
|
+
const len1 = WASM_VECTOR_LEN;
|
|
165
|
+
const ptr2 = passStringToWasm0(subscription_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
166
|
+
const len2 = WASM_VECTOR_LEN;
|
|
167
|
+
const ret = wasm.freshbluhttp_subscribe(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
168
|
+
return ret;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Update a device
|
|
172
|
+
* @param {string} uuid
|
|
173
|
+
* @param {any} properties
|
|
174
|
+
* @returns {Promise<any>}
|
|
175
|
+
*/
|
|
176
|
+
update_device(uuid, properties) {
|
|
177
|
+
const ptr0 = passStringToWasm0(uuid, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
178
|
+
const len0 = WASM_VECTOR_LEN;
|
|
179
|
+
const ret = wasm.freshbluhttp_update_device(this.__wbg_ptr, ptr0, len0, properties);
|
|
180
|
+
return ret;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Get authenticated device info
|
|
184
|
+
* @returns {Promise<any>}
|
|
185
|
+
*/
|
|
186
|
+
whoami() {
|
|
187
|
+
const ret = wasm.freshbluhttp_whoami(this.__wbg_ptr);
|
|
188
|
+
return ret;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (Symbol.dispose) FreshBluHttp.prototype[Symbol.dispose] = FreshBluHttp.prototype.free;
|
|
192
|
+
|
|
193
|
+
export function main() {
|
|
194
|
+
wasm.main();
|
|
195
|
+
}
|
|
196
|
+
export function __wbg_Error_83742b46f01ce22d(arg0, arg1) {
|
|
197
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
198
|
+
return ret;
|
|
199
|
+
}
|
|
200
|
+
export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
201
|
+
const ret = String(arg1);
|
|
202
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
203
|
+
const len1 = WASM_VECTOR_LEN;
|
|
204
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
205
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
206
|
+
}
|
|
207
|
+
export function __wbg___wbindgen_bigint_get_as_i64_447a76b5c6ef7bda(arg0, arg1) {
|
|
208
|
+
const v = arg1;
|
|
209
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
210
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
211
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
212
|
+
}
|
|
213
|
+
export function __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1(arg0) {
|
|
214
|
+
const v = arg0;
|
|
215
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
216
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
217
|
+
}
|
|
218
|
+
export function __wbg___wbindgen_debug_string_5398f5bb970e0daa(arg0, arg1) {
|
|
219
|
+
const ret = debugString(arg1);
|
|
220
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
221
|
+
const len1 = WASM_VECTOR_LEN;
|
|
222
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
223
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
224
|
+
}
|
|
225
|
+
export function __wbg___wbindgen_in_41dbb8413020e076(arg0, arg1) {
|
|
226
|
+
const ret = arg0 in arg1;
|
|
227
|
+
return ret;
|
|
228
|
+
}
|
|
229
|
+
export function __wbg___wbindgen_is_bigint_e2141d4f045b7eda(arg0) {
|
|
230
|
+
const ret = typeof(arg0) === 'bigint';
|
|
231
|
+
return ret;
|
|
232
|
+
}
|
|
233
|
+
export function __wbg___wbindgen_is_function_3c846841762788c1(arg0) {
|
|
234
|
+
const ret = typeof(arg0) === 'function';
|
|
235
|
+
return ret;
|
|
236
|
+
}
|
|
237
|
+
export function __wbg___wbindgen_is_object_781bc9f159099513(arg0) {
|
|
238
|
+
const val = arg0;
|
|
239
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
240
|
+
return ret;
|
|
241
|
+
}
|
|
242
|
+
export function __wbg___wbindgen_is_string_7ef6b97b02428fae(arg0) {
|
|
243
|
+
const ret = typeof(arg0) === 'string';
|
|
244
|
+
return ret;
|
|
245
|
+
}
|
|
246
|
+
export function __wbg___wbindgen_is_undefined_52709e72fb9f179c(arg0) {
|
|
247
|
+
const ret = arg0 === undefined;
|
|
248
|
+
return ret;
|
|
249
|
+
}
|
|
250
|
+
export function __wbg___wbindgen_jsval_eq_ee31bfad3e536463(arg0, arg1) {
|
|
251
|
+
const ret = arg0 === arg1;
|
|
252
|
+
return ret;
|
|
253
|
+
}
|
|
254
|
+
export function __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b(arg0, arg1) {
|
|
255
|
+
const ret = arg0 == arg1;
|
|
256
|
+
return ret;
|
|
257
|
+
}
|
|
258
|
+
export function __wbg___wbindgen_number_get_34bb9d9dcfa21373(arg0, arg1) {
|
|
259
|
+
const obj = arg1;
|
|
260
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
261
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
262
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
263
|
+
}
|
|
264
|
+
export function __wbg___wbindgen_string_get_395e606bd0ee4427(arg0, arg1) {
|
|
265
|
+
const obj = arg1;
|
|
266
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
267
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
268
|
+
var len1 = WASM_VECTOR_LEN;
|
|
269
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
270
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
271
|
+
}
|
|
272
|
+
export function __wbg___wbindgen_throw_6ddd609b62940d55(arg0, arg1) {
|
|
273
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
274
|
+
}
|
|
275
|
+
export function __wbg__wbg_cb_unref_6b5b6b8576d35cb1(arg0) {
|
|
276
|
+
arg0._wbg_cb_unref();
|
|
277
|
+
}
|
|
278
|
+
export function __wbg_call_2d781c1f4d5c0ef8() { return handleError(function (arg0, arg1, arg2) {
|
|
279
|
+
const ret = arg0.call(arg1, arg2);
|
|
280
|
+
return ret;
|
|
281
|
+
}, arguments); }
|
|
282
|
+
export function __wbg_call_e133b57c9155d22c() { return handleError(function (arg0, arg1) {
|
|
283
|
+
const ret = arg0.call(arg1);
|
|
284
|
+
return ret;
|
|
285
|
+
}, arguments); }
|
|
286
|
+
export function __wbg_done_08ce71ee07e3bd17(arg0) {
|
|
287
|
+
const ret = arg0.done;
|
|
288
|
+
return ret;
|
|
289
|
+
}
|
|
290
|
+
export function __wbg_entries_e8a20ff8c9757101(arg0) {
|
|
291
|
+
const ret = Object.entries(arg0);
|
|
292
|
+
return ret;
|
|
293
|
+
}
|
|
294
|
+
export function __wbg_fetch_5550a88cf343aaa9(arg0, arg1) {
|
|
295
|
+
const ret = arg0.fetch(arg1);
|
|
296
|
+
return ret;
|
|
297
|
+
}
|
|
298
|
+
export function __wbg_fetch_f8a611684c3b5fe5(arg0, arg1) {
|
|
299
|
+
const ret = arg0.fetch(arg1);
|
|
300
|
+
return ret;
|
|
301
|
+
}
|
|
302
|
+
export function __wbg_get_326e41e095fb2575() { return handleError(function (arg0, arg1) {
|
|
303
|
+
const ret = Reflect.get(arg0, arg1);
|
|
304
|
+
return ret;
|
|
305
|
+
}, arguments); }
|
|
306
|
+
export function __wbg_get_3ef1eba1850ade27() { return handleError(function (arg0, arg1) {
|
|
307
|
+
const ret = Reflect.get(arg0, arg1);
|
|
308
|
+
return ret;
|
|
309
|
+
}, arguments); }
|
|
310
|
+
export function __wbg_get_a8ee5c45dabc1b3b(arg0, arg1) {
|
|
311
|
+
const ret = arg0[arg1 >>> 0];
|
|
312
|
+
return ret;
|
|
313
|
+
}
|
|
314
|
+
export function __wbg_get_unchecked_329cfe50afab7352(arg0, arg1) {
|
|
315
|
+
const ret = arg0[arg1 >>> 0];
|
|
316
|
+
return ret;
|
|
317
|
+
}
|
|
318
|
+
export function __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6(arg0) {
|
|
319
|
+
let result;
|
|
320
|
+
try {
|
|
321
|
+
result = arg0 instanceof ArrayBuffer;
|
|
322
|
+
} catch (_) {
|
|
323
|
+
result = false;
|
|
324
|
+
}
|
|
325
|
+
const ret = result;
|
|
326
|
+
return ret;
|
|
327
|
+
}
|
|
328
|
+
export function __wbg_instanceof_Error_4691a5b466e32a80(arg0) {
|
|
329
|
+
let result;
|
|
330
|
+
try {
|
|
331
|
+
result = arg0 instanceof Error;
|
|
332
|
+
} catch (_) {
|
|
333
|
+
result = false;
|
|
334
|
+
}
|
|
335
|
+
const ret = result;
|
|
336
|
+
return ret;
|
|
337
|
+
}
|
|
338
|
+
export function __wbg_instanceof_Map_f194b366846aca0c(arg0) {
|
|
339
|
+
let result;
|
|
340
|
+
try {
|
|
341
|
+
result = arg0 instanceof Map;
|
|
342
|
+
} catch (_) {
|
|
343
|
+
result = false;
|
|
344
|
+
}
|
|
345
|
+
const ret = result;
|
|
346
|
+
return ret;
|
|
347
|
+
}
|
|
348
|
+
export function __wbg_instanceof_Response_9b4d9fd451e051b1(arg0) {
|
|
349
|
+
let result;
|
|
350
|
+
try {
|
|
351
|
+
result = arg0 instanceof Response;
|
|
352
|
+
} catch (_) {
|
|
353
|
+
result = false;
|
|
354
|
+
}
|
|
355
|
+
const ret = result;
|
|
356
|
+
return ret;
|
|
357
|
+
}
|
|
358
|
+
export function __wbg_instanceof_Uint8Array_740438561a5b956d(arg0) {
|
|
359
|
+
let result;
|
|
360
|
+
try {
|
|
361
|
+
result = arg0 instanceof Uint8Array;
|
|
362
|
+
} catch (_) {
|
|
363
|
+
result = false;
|
|
364
|
+
}
|
|
365
|
+
const ret = result;
|
|
366
|
+
return ret;
|
|
367
|
+
}
|
|
368
|
+
export function __wbg_instanceof_Window_23e677d2c6843922(arg0) {
|
|
369
|
+
let result;
|
|
370
|
+
try {
|
|
371
|
+
result = arg0 instanceof Window;
|
|
372
|
+
} catch (_) {
|
|
373
|
+
result = false;
|
|
374
|
+
}
|
|
375
|
+
const ret = result;
|
|
376
|
+
return ret;
|
|
377
|
+
}
|
|
378
|
+
export function __wbg_instanceof_WorkerGlobalScope_de6976d00cb213c6(arg0) {
|
|
379
|
+
let result;
|
|
380
|
+
try {
|
|
381
|
+
result = arg0 instanceof WorkerGlobalScope;
|
|
382
|
+
} catch (_) {
|
|
383
|
+
result = false;
|
|
384
|
+
}
|
|
385
|
+
const ret = result;
|
|
386
|
+
return ret;
|
|
387
|
+
}
|
|
388
|
+
export function __wbg_isArray_33b91feb269ff46e(arg0) {
|
|
389
|
+
const ret = Array.isArray(arg0);
|
|
390
|
+
return ret;
|
|
391
|
+
}
|
|
392
|
+
export function __wbg_isSafeInteger_ecd6a7f9c3e053cd(arg0) {
|
|
393
|
+
const ret = Number.isSafeInteger(arg0);
|
|
394
|
+
return ret;
|
|
395
|
+
}
|
|
396
|
+
export function __wbg_iterator_d8f549ec8fb061b1() {
|
|
397
|
+
const ret = Symbol.iterator;
|
|
398
|
+
return ret;
|
|
399
|
+
}
|
|
400
|
+
export function __wbg_length_b3416cf66a5452c8(arg0) {
|
|
401
|
+
const ret = arg0.length;
|
|
402
|
+
return ret;
|
|
403
|
+
}
|
|
404
|
+
export function __wbg_length_ea16607d7b61445b(arg0) {
|
|
405
|
+
const ret = arg0.length;
|
|
406
|
+
return ret;
|
|
407
|
+
}
|
|
408
|
+
export function __wbg_message_00d63f20c41713dd(arg0) {
|
|
409
|
+
const ret = arg0.message;
|
|
410
|
+
return ret;
|
|
411
|
+
}
|
|
412
|
+
export function __wbg_name_ecf53d5e050a495d(arg0) {
|
|
413
|
+
const ret = arg0.name;
|
|
414
|
+
return ret;
|
|
415
|
+
}
|
|
416
|
+
export function __wbg_new_0837727332ac86ba() { return handleError(function () {
|
|
417
|
+
const ret = new Headers();
|
|
418
|
+
return ret;
|
|
419
|
+
}, arguments); }
|
|
420
|
+
export function __wbg_new_49d5571bd3f0c4d4() {
|
|
421
|
+
const ret = new Map();
|
|
422
|
+
return ret;
|
|
423
|
+
}
|
|
424
|
+
export function __wbg_new_5415f704ce1c4eda() { return handleError(function () {
|
|
425
|
+
const ret = new URLSearchParams();
|
|
426
|
+
return ret;
|
|
427
|
+
}, arguments); }
|
|
428
|
+
export function __wbg_new_5f486cdf45a04d78(arg0) {
|
|
429
|
+
const ret = new Uint8Array(arg0);
|
|
430
|
+
return ret;
|
|
431
|
+
}
|
|
432
|
+
export function __wbg_new_a70fbab9066b301f() {
|
|
433
|
+
const ret = new Array();
|
|
434
|
+
return ret;
|
|
435
|
+
}
|
|
436
|
+
export function __wbg_new_ab79df5bd7c26067() {
|
|
437
|
+
const ret = new Object();
|
|
438
|
+
return ret;
|
|
439
|
+
}
|
|
440
|
+
export function __wbg_new_bb1018d527df73cb() { return handleError(function (arg0, arg1) {
|
|
441
|
+
const ret = new URL(getStringFromWasm0(arg0, arg1));
|
|
442
|
+
return ret;
|
|
443
|
+
}, arguments); }
|
|
444
|
+
export function __wbg_new_typed_aaaeaf29cf802876(arg0, arg1) {
|
|
445
|
+
try {
|
|
446
|
+
var state0 = {a: arg0, b: arg1};
|
|
447
|
+
var cb0 = (arg0, arg1) => {
|
|
448
|
+
const a = state0.a;
|
|
449
|
+
state0.a = 0;
|
|
450
|
+
try {
|
|
451
|
+
return wasm_bindgen__convert__closures_____invoke__h3a2c0020c2d210b6(a, state0.b, arg0, arg1);
|
|
452
|
+
} finally {
|
|
453
|
+
state0.a = a;
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
const ret = new Promise(cb0);
|
|
457
|
+
return ret;
|
|
458
|
+
} finally {
|
|
459
|
+
state0.a = state0.b = 0;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
export function __wbg_new_with_str_4c859c3e69e6cb15() { return handleError(function (arg0, arg1) {
|
|
463
|
+
const ret = new Request(getStringFromWasm0(arg0, arg1));
|
|
464
|
+
return ret;
|
|
465
|
+
}, arguments); }
|
|
466
|
+
export function __wbg_new_with_str_and_init_b4b54d1a819bc724() { return handleError(function (arg0, arg1, arg2) {
|
|
467
|
+
const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
|
|
468
|
+
return ret;
|
|
469
|
+
}, arguments); }
|
|
470
|
+
export function __wbg_next_11b99ee6237339e3() { return handleError(function (arg0) {
|
|
471
|
+
const ret = arg0.next();
|
|
472
|
+
return ret;
|
|
473
|
+
}, arguments); }
|
|
474
|
+
export function __wbg_next_e01a967809d1aa68(arg0) {
|
|
475
|
+
const ret = arg0.next;
|
|
476
|
+
return ret;
|
|
477
|
+
}
|
|
478
|
+
export function __wbg_prototypesetcall_d62e5099504357e6(arg0, arg1, arg2) {
|
|
479
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
480
|
+
}
|
|
481
|
+
export function __wbg_queueMicrotask_0c399741342fb10f(arg0) {
|
|
482
|
+
const ret = arg0.queueMicrotask;
|
|
483
|
+
return ret;
|
|
484
|
+
}
|
|
485
|
+
export function __wbg_queueMicrotask_a082d78ce798393e(arg0) {
|
|
486
|
+
queueMicrotask(arg0);
|
|
487
|
+
}
|
|
488
|
+
export function __wbg_resolve_ae8d83246e5bcc12(arg0) {
|
|
489
|
+
const ret = Promise.resolve(arg0);
|
|
490
|
+
return ret;
|
|
491
|
+
}
|
|
492
|
+
export function __wbg_search_35617fb7936183df(arg0, arg1) {
|
|
493
|
+
const ret = arg1.search;
|
|
494
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
495
|
+
const len1 = WASM_VECTOR_LEN;
|
|
496
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
497
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
498
|
+
}
|
|
499
|
+
export function __wbg_set_282384002438957f(arg0, arg1, arg2) {
|
|
500
|
+
arg0[arg1 >>> 0] = arg2;
|
|
501
|
+
}
|
|
502
|
+
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
503
|
+
arg0[arg1] = arg2;
|
|
504
|
+
}
|
|
505
|
+
export function __wbg_set_bf7251625df30a02(arg0, arg1, arg2) {
|
|
506
|
+
const ret = arg0.set(arg1, arg2);
|
|
507
|
+
return ret;
|
|
508
|
+
}
|
|
509
|
+
export function __wbg_set_body_a3d856b097dfda04(arg0, arg1) {
|
|
510
|
+
arg0.body = arg1;
|
|
511
|
+
}
|
|
512
|
+
export function __wbg_set_e09648bea3f1af1e() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
513
|
+
arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
514
|
+
}, arguments); }
|
|
515
|
+
export function __wbg_set_headers_3c8fecc693b75327(arg0, arg1) {
|
|
516
|
+
arg0.headers = arg1;
|
|
517
|
+
}
|
|
518
|
+
export function __wbg_set_method_8c015e8bcafd7be1(arg0, arg1, arg2) {
|
|
519
|
+
arg0.method = getStringFromWasm0(arg1, arg2);
|
|
520
|
+
}
|
|
521
|
+
export function __wbg_set_search_bd09fe57b201bac5(arg0, arg1, arg2) {
|
|
522
|
+
arg0.search = getStringFromWasm0(arg1, arg2);
|
|
523
|
+
}
|
|
524
|
+
export function __wbg_static_accessor_GLOBAL_8adb955bd33fac2f() {
|
|
525
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
526
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
527
|
+
}
|
|
528
|
+
export function __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913() {
|
|
529
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
530
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
531
|
+
}
|
|
532
|
+
export function __wbg_static_accessor_SELF_f207c857566db248() {
|
|
533
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
534
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
535
|
+
}
|
|
536
|
+
export function __wbg_static_accessor_WINDOW_bb9f1ba69d61b386() {
|
|
537
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
538
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
539
|
+
}
|
|
540
|
+
export function __wbg_text_372f5b91442c50f9() { return handleError(function (arg0) {
|
|
541
|
+
const ret = arg0.text();
|
|
542
|
+
return ret;
|
|
543
|
+
}, arguments); }
|
|
544
|
+
export function __wbg_then_098abe61755d12f6(arg0, arg1) {
|
|
545
|
+
const ret = arg0.then(arg1);
|
|
546
|
+
return ret;
|
|
547
|
+
}
|
|
548
|
+
export function __wbg_then_9e335f6dd892bc11(arg0, arg1, arg2) {
|
|
549
|
+
const ret = arg0.then(arg1, arg2);
|
|
550
|
+
return ret;
|
|
551
|
+
}
|
|
552
|
+
export function __wbg_toString_3272fa0dfd05dd87(arg0) {
|
|
553
|
+
const ret = arg0.toString();
|
|
554
|
+
return ret;
|
|
555
|
+
}
|
|
556
|
+
export function __wbg_toString_fca8b5e46235cfb4(arg0) {
|
|
557
|
+
const ret = arg0.toString();
|
|
558
|
+
return ret;
|
|
559
|
+
}
|
|
560
|
+
export function __wbg_url_b6f96880b733816c(arg0, arg1) {
|
|
561
|
+
const ret = arg1.url;
|
|
562
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
563
|
+
const len1 = WASM_VECTOR_LEN;
|
|
564
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
565
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
566
|
+
}
|
|
567
|
+
export function __wbg_value_21fc78aab0322612(arg0) {
|
|
568
|
+
const ret = arg0.value;
|
|
569
|
+
return ret;
|
|
570
|
+
}
|
|
571
|
+
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
572
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 78, function: Function { arguments: [Externref], shim_idx: 94, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
573
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h82a0fe3e4942c191, wasm_bindgen__convert__closures_____invoke__hc68e009cef2df4be);
|
|
574
|
+
return ret;
|
|
575
|
+
}
|
|
576
|
+
export function __wbindgen_cast_0000000000000002(arg0) {
|
|
577
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
578
|
+
const ret = arg0;
|
|
579
|
+
return ret;
|
|
580
|
+
}
|
|
581
|
+
export function __wbindgen_cast_0000000000000003(arg0) {
|
|
582
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
583
|
+
const ret = arg0;
|
|
584
|
+
return ret;
|
|
585
|
+
}
|
|
586
|
+
export function __wbindgen_cast_0000000000000004(arg0, arg1) {
|
|
587
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
588
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
589
|
+
return ret;
|
|
590
|
+
}
|
|
591
|
+
export function __wbindgen_cast_0000000000000005(arg0) {
|
|
592
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
593
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
594
|
+
return ret;
|
|
595
|
+
}
|
|
596
|
+
export function __wbindgen_init_externref_table() {
|
|
597
|
+
const table = wasm.__wbindgen_externrefs;
|
|
598
|
+
const offset = table.grow(4);
|
|
599
|
+
table.set(0, undefined);
|
|
600
|
+
table.set(offset + 0, undefined);
|
|
601
|
+
table.set(offset + 1, null);
|
|
602
|
+
table.set(offset + 2, true);
|
|
603
|
+
table.set(offset + 3, false);
|
|
604
|
+
}
|
|
605
|
+
function wasm_bindgen__convert__closures_____invoke__hc68e009cef2df4be(arg0, arg1, arg2) {
|
|
606
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__hc68e009cef2df4be(arg0, arg1, arg2);
|
|
607
|
+
if (ret[1]) {
|
|
608
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
function wasm_bindgen__convert__closures_____invoke__h3a2c0020c2d210b6(arg0, arg1, arg2, arg3) {
|
|
613
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h3a2c0020c2d210b6(arg0, arg1, arg2, arg3);
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
const FreshBluConfigFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
617
|
+
? { register: () => {}, unregister: () => {} }
|
|
618
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_freshbluconfig_free(ptr >>> 0, 1));
|
|
619
|
+
const FreshBluHttpFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
620
|
+
? { register: () => {}, unregister: () => {} }
|
|
621
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_freshbluhttp_free(ptr >>> 0, 1));
|
|
622
|
+
|
|
623
|
+
function addToExternrefTable0(obj) {
|
|
624
|
+
const idx = wasm.__externref_table_alloc();
|
|
625
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
626
|
+
return idx;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
function _assertClass(instance, klass) {
|
|
630
|
+
if (!(instance instanceof klass)) {
|
|
631
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
636
|
+
? { register: () => {}, unregister: () => {} }
|
|
637
|
+
: new FinalizationRegistry(state => state.dtor(state.a, state.b));
|
|
638
|
+
|
|
639
|
+
function debugString(val) {
|
|
640
|
+
// primitive types
|
|
641
|
+
const type = typeof val;
|
|
642
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
643
|
+
return `${val}`;
|
|
644
|
+
}
|
|
645
|
+
if (type == 'string') {
|
|
646
|
+
return `"${val}"`;
|
|
647
|
+
}
|
|
648
|
+
if (type == 'symbol') {
|
|
649
|
+
const description = val.description;
|
|
650
|
+
if (description == null) {
|
|
651
|
+
return 'Symbol';
|
|
652
|
+
} else {
|
|
653
|
+
return `Symbol(${description})`;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
if (type == 'function') {
|
|
657
|
+
const name = val.name;
|
|
658
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
659
|
+
return `Function(${name})`;
|
|
660
|
+
} else {
|
|
661
|
+
return 'Function';
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
// objects
|
|
665
|
+
if (Array.isArray(val)) {
|
|
666
|
+
const length = val.length;
|
|
667
|
+
let debug = '[';
|
|
668
|
+
if (length > 0) {
|
|
669
|
+
debug += debugString(val[0]);
|
|
670
|
+
}
|
|
671
|
+
for(let i = 1; i < length; i++) {
|
|
672
|
+
debug += ', ' + debugString(val[i]);
|
|
673
|
+
}
|
|
674
|
+
debug += ']';
|
|
675
|
+
return debug;
|
|
676
|
+
}
|
|
677
|
+
// Test for built-in
|
|
678
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
679
|
+
let className;
|
|
680
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
681
|
+
className = builtInMatches[1];
|
|
682
|
+
} else {
|
|
683
|
+
// Failed to match the standard '[object ClassName]'
|
|
684
|
+
return toString.call(val);
|
|
685
|
+
}
|
|
686
|
+
if (className == 'Object') {
|
|
687
|
+
// we're a user defined class or Object
|
|
688
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
689
|
+
// easier than looping through ownProperties of `val`.
|
|
690
|
+
try {
|
|
691
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
692
|
+
} catch (_) {
|
|
693
|
+
return 'Object';
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
// errors
|
|
697
|
+
if (val instanceof Error) {
|
|
698
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
699
|
+
}
|
|
700
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
701
|
+
return className;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
705
|
+
ptr = ptr >>> 0;
|
|
706
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
let cachedDataViewMemory0 = null;
|
|
710
|
+
function getDataViewMemory0() {
|
|
711
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
712
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
713
|
+
}
|
|
714
|
+
return cachedDataViewMemory0;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
function getStringFromWasm0(ptr, len) {
|
|
718
|
+
ptr = ptr >>> 0;
|
|
719
|
+
return decodeText(ptr, len);
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
let cachedUint8ArrayMemory0 = null;
|
|
723
|
+
function getUint8ArrayMemory0() {
|
|
724
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
725
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
726
|
+
}
|
|
727
|
+
return cachedUint8ArrayMemory0;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
function handleError(f, args) {
|
|
731
|
+
try {
|
|
732
|
+
return f.apply(this, args);
|
|
733
|
+
} catch (e) {
|
|
734
|
+
const idx = addToExternrefTable0(e);
|
|
735
|
+
wasm.__wbindgen_exn_store(idx);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
function isLikeNone(x) {
|
|
740
|
+
return x === undefined || x === null;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
744
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
745
|
+
const real = (...args) => {
|
|
746
|
+
|
|
747
|
+
// First up with a closure we increment the internal reference
|
|
748
|
+
// count. This ensures that the Rust closure environment won't
|
|
749
|
+
// be deallocated while we're invoking it.
|
|
750
|
+
state.cnt++;
|
|
751
|
+
const a = state.a;
|
|
752
|
+
state.a = 0;
|
|
753
|
+
try {
|
|
754
|
+
return f(a, state.b, ...args);
|
|
755
|
+
} finally {
|
|
756
|
+
state.a = a;
|
|
757
|
+
real._wbg_cb_unref();
|
|
758
|
+
}
|
|
759
|
+
};
|
|
760
|
+
real._wbg_cb_unref = () => {
|
|
761
|
+
if (--state.cnt === 0) {
|
|
762
|
+
state.dtor(state.a, state.b);
|
|
763
|
+
state.a = 0;
|
|
764
|
+
CLOSURE_DTORS.unregister(state);
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
768
|
+
return real;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
772
|
+
if (realloc === undefined) {
|
|
773
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
774
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
775
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
776
|
+
WASM_VECTOR_LEN = buf.length;
|
|
777
|
+
return ptr;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
let len = arg.length;
|
|
781
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
782
|
+
|
|
783
|
+
const mem = getUint8ArrayMemory0();
|
|
784
|
+
|
|
785
|
+
let offset = 0;
|
|
786
|
+
|
|
787
|
+
for (; offset < len; offset++) {
|
|
788
|
+
const code = arg.charCodeAt(offset);
|
|
789
|
+
if (code > 0x7F) break;
|
|
790
|
+
mem[ptr + offset] = code;
|
|
791
|
+
}
|
|
792
|
+
if (offset !== len) {
|
|
793
|
+
if (offset !== 0) {
|
|
794
|
+
arg = arg.slice(offset);
|
|
795
|
+
}
|
|
796
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
797
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
798
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
799
|
+
|
|
800
|
+
offset += ret.written;
|
|
801
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
WASM_VECTOR_LEN = offset;
|
|
805
|
+
return ptr;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
function takeFromExternrefTable0(idx) {
|
|
809
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
810
|
+
wasm.__externref_table_dealloc(idx);
|
|
811
|
+
return value;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
815
|
+
cachedTextDecoder.decode();
|
|
816
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
817
|
+
let numBytesDecoded = 0;
|
|
818
|
+
function decodeText(ptr, len) {
|
|
819
|
+
numBytesDecoded += len;
|
|
820
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
821
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
822
|
+
cachedTextDecoder.decode();
|
|
823
|
+
numBytesDecoded = len;
|
|
824
|
+
}
|
|
825
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
const cachedTextEncoder = new TextEncoder();
|
|
829
|
+
|
|
830
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
831
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
832
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
833
|
+
view.set(buf);
|
|
834
|
+
return {
|
|
835
|
+
read: arg.length,
|
|
836
|
+
written: buf.length
|
|
837
|
+
};
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
let WASM_VECTOR_LEN = 0;
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
let wasm;
|
|
845
|
+
export function __wbg_set_wasm(val) {
|
|
846
|
+
wasm = val;
|
|
847
|
+
}
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "freshblu-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"collaborators": [
|
|
5
|
+
"FreshBlu Contributors"
|
|
6
|
+
],
|
|
7
|
+
"description": "FreshBlu WASM client library for browser and Node.js",
|
|
8
|
+
"version": "0.1.0",
|
|
9
|
+
"license": "MIT OR Apache-2.0",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/virgilvox/freshblu"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"freshblu_wasm_bg.wasm",
|
|
16
|
+
"freshblu_wasm.js",
|
|
17
|
+
"freshblu_wasm_bg.js",
|
|
18
|
+
"freshblu_wasm.d.ts"
|
|
19
|
+
],
|
|
20
|
+
"main": "freshblu_wasm.js",
|
|
21
|
+
"types": "freshblu_wasm.d.ts",
|
|
22
|
+
"sideEffects": [
|
|
23
|
+
"./freshblu_wasm.js",
|
|
24
|
+
"./snippets/*"
|
|
25
|
+
],
|
|
26
|
+
"keywords": [
|
|
27
|
+
"iot",
|
|
28
|
+
"meshblu",
|
|
29
|
+
"wasm",
|
|
30
|
+
"websocket"
|
|
31
|
+
]
|
|
32
|
+
}
|