mqtt5-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/mqtt5_wasm.js ADDED
@@ -0,0 +1,1714 @@
1
+ let wasm;
2
+
3
+ function debugString(val) {
4
+ // primitive types
5
+ const type = typeof val;
6
+ if (type == 'number' || type == 'boolean' || val == null) {
7
+ return `${val}`;
8
+ }
9
+ if (type == 'string') {
10
+ return `"${val}"`;
11
+ }
12
+ if (type == 'symbol') {
13
+ const description = val.description;
14
+ if (description == null) {
15
+ return 'Symbol';
16
+ } else {
17
+ return `Symbol(${description})`;
18
+ }
19
+ }
20
+ if (type == 'function') {
21
+ const name = val.name;
22
+ if (typeof name == 'string' && name.length > 0) {
23
+ return `Function(${name})`;
24
+ } else {
25
+ return 'Function';
26
+ }
27
+ }
28
+ // objects
29
+ if (Array.isArray(val)) {
30
+ const length = val.length;
31
+ let debug = '[';
32
+ if (length > 0) {
33
+ debug += debugString(val[0]);
34
+ }
35
+ for(let i = 1; i < length; i++) {
36
+ debug += ', ' + debugString(val[i]);
37
+ }
38
+ debug += ']';
39
+ return debug;
40
+ }
41
+ // Test for built-in
42
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
43
+ let className;
44
+ if (builtInMatches && builtInMatches.length > 1) {
45
+ className = builtInMatches[1];
46
+ } else {
47
+ // Failed to match the standard '[object ClassName]'
48
+ return toString.call(val);
49
+ }
50
+ if (className == 'Object') {
51
+ // we're a user defined class or Object
52
+ // JSON.stringify avoids problems with cycles, and is generally much
53
+ // easier than looping through ownProperties of `val`.
54
+ try {
55
+ return 'Object(' + JSON.stringify(val) + ')';
56
+ } catch (_) {
57
+ return 'Object';
58
+ }
59
+ }
60
+ // errors
61
+ if (val instanceof Error) {
62
+ return `${val.name}: ${val.message}\n${val.stack}`;
63
+ }
64
+ // TODO we could test for more things here, like `Set`s and `Map`s.
65
+ return className;
66
+ }
67
+
68
+ let WASM_VECTOR_LEN = 0;
69
+
70
+ let cachedUint8ArrayMemory0 = null;
71
+
72
+ function getUint8ArrayMemory0() {
73
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
74
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
75
+ }
76
+ return cachedUint8ArrayMemory0;
77
+ }
78
+
79
+ const cachedTextEncoder = new TextEncoder();
80
+
81
+ if (!('encodeInto' in cachedTextEncoder)) {
82
+ cachedTextEncoder.encodeInto = function (arg, view) {
83
+ const buf = cachedTextEncoder.encode(arg);
84
+ view.set(buf);
85
+ return {
86
+ read: arg.length,
87
+ written: buf.length
88
+ };
89
+ }
90
+ }
91
+
92
+ function passStringToWasm0(arg, malloc, realloc) {
93
+
94
+ if (realloc === undefined) {
95
+ const buf = cachedTextEncoder.encode(arg);
96
+ const ptr = malloc(buf.length, 1) >>> 0;
97
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
98
+ WASM_VECTOR_LEN = buf.length;
99
+ return ptr;
100
+ }
101
+
102
+ let len = arg.length;
103
+ let ptr = malloc(len, 1) >>> 0;
104
+
105
+ const mem = getUint8ArrayMemory0();
106
+
107
+ let offset = 0;
108
+
109
+ for (; offset < len; offset++) {
110
+ const code = arg.charCodeAt(offset);
111
+ if (code > 0x7F) break;
112
+ mem[ptr + offset] = code;
113
+ }
114
+
115
+ if (offset !== len) {
116
+ if (offset !== 0) {
117
+ arg = arg.slice(offset);
118
+ }
119
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
120
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
121
+ const ret = cachedTextEncoder.encodeInto(arg, view);
122
+
123
+ offset += ret.written;
124
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
125
+ }
126
+
127
+ WASM_VECTOR_LEN = offset;
128
+ return ptr;
129
+ }
130
+
131
+ let cachedDataViewMemory0 = null;
132
+
133
+ function getDataViewMemory0() {
134
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
135
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
136
+ }
137
+ return cachedDataViewMemory0;
138
+ }
139
+
140
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
141
+
142
+ cachedTextDecoder.decode();
143
+
144
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
145
+ let numBytesDecoded = 0;
146
+ function decodeText(ptr, len) {
147
+ numBytesDecoded += len;
148
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
149
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
150
+ cachedTextDecoder.decode();
151
+ numBytesDecoded = len;
152
+ }
153
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
154
+ }
155
+
156
+ function getStringFromWasm0(ptr, len) {
157
+ ptr = ptr >>> 0;
158
+ return decodeText(ptr, len);
159
+ }
160
+
161
+ function addToExternrefTable0(obj) {
162
+ const idx = wasm.__externref_table_alloc();
163
+ wasm.__wbindgen_externrefs.set(idx, obj);
164
+ return idx;
165
+ }
166
+
167
+ function handleError(f, args) {
168
+ try {
169
+ return f.apply(this, args);
170
+ } catch (e) {
171
+ const idx = addToExternrefTable0(e);
172
+ wasm.__wbindgen_exn_store(idx);
173
+ }
174
+ }
175
+
176
+ function getArrayU8FromWasm0(ptr, len) {
177
+ ptr = ptr >>> 0;
178
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
179
+ }
180
+
181
+ function isLikeNone(x) {
182
+ return x === undefined || x === null;
183
+ }
184
+
185
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
186
+ ? { register: () => {}, unregister: () => {} }
187
+ : new FinalizationRegistry(state => state.dtor(state.a, state.b));
188
+
189
+ function makeMutClosure(arg0, arg1, dtor, f) {
190
+ const state = { a: arg0, b: arg1, cnt: 1, dtor };
191
+ const real = (...args) => {
192
+
193
+ // First up with a closure we increment the internal reference
194
+ // count. This ensures that the Rust closure environment won't
195
+ // be deallocated while we're invoking it.
196
+ state.cnt++;
197
+ const a = state.a;
198
+ state.a = 0;
199
+ try {
200
+ return f(a, state.b, ...args);
201
+ } finally {
202
+ state.a = a;
203
+ real._wbg_cb_unref();
204
+ }
205
+ };
206
+ real._wbg_cb_unref = () => {
207
+ if (--state.cnt === 0) {
208
+ state.dtor(state.a, state.b);
209
+ state.a = 0;
210
+ CLOSURE_DTORS.unregister(state);
211
+ }
212
+ };
213
+ CLOSURE_DTORS.register(real, state, state);
214
+ return real;
215
+ }
216
+
217
+ function takeFromExternrefTable0(idx) {
218
+ const value = wasm.__wbindgen_externrefs.get(idx);
219
+ wasm.__externref_table_dealloc(idx);
220
+ return value;
221
+ }
222
+
223
+ function _assertClass(instance, klass) {
224
+ if (!(instance instanceof klass)) {
225
+ throw new Error(`expected instance of ${klass.name}`);
226
+ }
227
+ }
228
+
229
+ function passArray8ToWasm0(arg, malloc) {
230
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
231
+ getUint8ArrayMemory0().set(arg, ptr / 1);
232
+ WASM_VECTOR_LEN = arg.length;
233
+ return ptr;
234
+ }
235
+ function wasm_bindgen__convert__closures_____invoke__hacd56641ea4358f0(arg0, arg1, arg2) {
236
+ wasm.wasm_bindgen__convert__closures_____invoke__hacd56641ea4358f0(arg0, arg1, arg2);
237
+ }
238
+
239
+ function wasm_bindgen__convert__closures_____invoke__h2d3fbbff27fe5544(arg0, arg1, arg2) {
240
+ wasm.wasm_bindgen__convert__closures_____invoke__h2d3fbbff27fe5544(arg0, arg1, arg2);
241
+ }
242
+
243
+ function wasm_bindgen__convert__closures_____invoke__h4c33ce4d986075ed(arg0, arg1) {
244
+ wasm.wasm_bindgen__convert__closures_____invoke__h4c33ce4d986075ed(arg0, arg1);
245
+ }
246
+
247
+ function wasm_bindgen__convert__closures_____invoke__hbbb6f9316512cb4e(arg0, arg1, arg2, arg3) {
248
+ wasm.wasm_bindgen__convert__closures_____invoke__hbbb6f9316512cb4e(arg0, arg1, arg2, arg3);
249
+ }
250
+
251
+ const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
252
+
253
+ const WasmBrokerFinalization = (typeof FinalizationRegistry === 'undefined')
254
+ ? { register: () => {}, unregister: () => {} }
255
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmbroker_free(ptr >>> 0, 1));
256
+
257
+ export class WasmBroker {
258
+
259
+ static __wrap(ptr) {
260
+ ptr = ptr >>> 0;
261
+ const obj = Object.create(WasmBroker.prototype);
262
+ obj.__wbg_ptr = ptr;
263
+ WasmBrokerFinalization.register(obj, obj.__wbg_ptr, obj);
264
+ return obj;
265
+ }
266
+
267
+ __destroy_into_raw() {
268
+ const ptr = this.__wbg_ptr;
269
+ this.__wbg_ptr = 0;
270
+ WasmBrokerFinalization.unregister(this);
271
+ return ptr;
272
+ }
273
+
274
+ free() {
275
+ const ptr = this.__destroy_into_raw();
276
+ wasm.__wbg_wasmbroker_free(ptr, 0);
277
+ }
278
+ constructor() {
279
+ const ret = wasm.wasmbroker_new();
280
+ if (ret[2]) {
281
+ throw takeFromExternrefTable0(ret[1]);
282
+ }
283
+ this.__wbg_ptr = ret[0] >>> 0;
284
+ WasmBrokerFinalization.register(this, this.__wbg_ptr, this);
285
+ return this;
286
+ }
287
+ /**
288
+ * @param {WasmBrokerConfig} wasm_config
289
+ * @returns {WasmBroker}
290
+ */
291
+ static with_config(wasm_config) {
292
+ _assertClass(wasm_config, WasmBrokerConfig);
293
+ var ptr0 = wasm_config.__destroy_into_raw();
294
+ const ret = wasm.wasmbroker_with_config(ptr0);
295
+ if (ret[2]) {
296
+ throw takeFromExternrefTable0(ret[1]);
297
+ }
298
+ return WasmBroker.__wrap(ret[0]);
299
+ }
300
+ /**
301
+ * @param {string} username
302
+ * @param {string} password
303
+ * @returns {Promise<void>}
304
+ */
305
+ add_user(username, password) {
306
+ const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
307
+ const len0 = WASM_VECTOR_LEN;
308
+ const ptr1 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
309
+ const len1 = WASM_VECTOR_LEN;
310
+ const ret = wasm.wasmbroker_add_user(this.__wbg_ptr, ptr0, len0, ptr1, len1);
311
+ return ret;
312
+ }
313
+ /**
314
+ * @param {string} username
315
+ * @param {string} password_hash
316
+ * @returns {Promise<void>}
317
+ */
318
+ add_user_with_hash(username, password_hash) {
319
+ const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
320
+ const len0 = WASM_VECTOR_LEN;
321
+ const ptr1 = passStringToWasm0(password_hash, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
322
+ const len1 = WASM_VECTOR_LEN;
323
+ const ret = wasm.wasmbroker_add_user_with_hash(this.__wbg_ptr, ptr0, len0, ptr1, len1);
324
+ return ret;
325
+ }
326
+ /**
327
+ * @param {string} username
328
+ * @returns {Promise<boolean>}
329
+ */
330
+ remove_user(username) {
331
+ const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
332
+ const len0 = WASM_VECTOR_LEN;
333
+ const ret = wasm.wasmbroker_remove_user(this.__wbg_ptr, ptr0, len0);
334
+ return ret;
335
+ }
336
+ /**
337
+ * @param {string} username
338
+ * @returns {Promise<boolean>}
339
+ */
340
+ has_user(username) {
341
+ const ptr0 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
342
+ const len0 = WASM_VECTOR_LEN;
343
+ const ret = wasm.wasmbroker_has_user(this.__wbg_ptr, ptr0, len0);
344
+ return ret;
345
+ }
346
+ /**
347
+ * @returns {Promise<number>}
348
+ */
349
+ user_count() {
350
+ const ret = wasm.wasmbroker_user_count(this.__wbg_ptr);
351
+ return ret;
352
+ }
353
+ /**
354
+ * @param {boolean} allow
355
+ */
356
+ set_allow_anonymous(allow) {
357
+ wasm.wasmbroker_set_allow_anonymous(this.__wbg_ptr, allow);
358
+ }
359
+ /**
360
+ * @param {string} password
361
+ * @returns {string}
362
+ */
363
+ static hash_password(password) {
364
+ let deferred3_0;
365
+ let deferred3_1;
366
+ try {
367
+ const ptr0 = passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
368
+ const len0 = WASM_VECTOR_LEN;
369
+ const ret = wasm.wasmbroker_hash_password(ptr0, len0);
370
+ var ptr2 = ret[0];
371
+ var len2 = ret[1];
372
+ if (ret[3]) {
373
+ ptr2 = 0; len2 = 0;
374
+ throw takeFromExternrefTable0(ret[2]);
375
+ }
376
+ deferred3_0 = ptr2;
377
+ deferred3_1 = len2;
378
+ return getStringFromWasm0(ptr2, len2);
379
+ } finally {
380
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
381
+ }
382
+ }
383
+ /**
384
+ * @returns {MessagePort}
385
+ */
386
+ create_client_port() {
387
+ const ret = wasm.wasmbroker_create_client_port(this.__wbg_ptr);
388
+ if (ret[2]) {
389
+ throw takeFromExternrefTable0(ret[1]);
390
+ }
391
+ return takeFromExternrefTable0(ret[0]);
392
+ }
393
+ }
394
+ if (Symbol.dispose) WasmBroker.prototype[Symbol.dispose] = WasmBroker.prototype.free;
395
+
396
+ const WasmBrokerConfigFinalization = (typeof FinalizationRegistry === 'undefined')
397
+ ? { register: () => {}, unregister: () => {} }
398
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmbrokerconfig_free(ptr >>> 0, 1));
399
+
400
+ export class WasmBrokerConfig {
401
+
402
+ __destroy_into_raw() {
403
+ const ptr = this.__wbg_ptr;
404
+ this.__wbg_ptr = 0;
405
+ WasmBrokerConfigFinalization.unregister(this);
406
+ return ptr;
407
+ }
408
+
409
+ free() {
410
+ const ptr = this.__destroy_into_raw();
411
+ wasm.__wbg_wasmbrokerconfig_free(ptr, 0);
412
+ }
413
+ constructor() {
414
+ const ret = wasm.wasmbrokerconfig_new();
415
+ this.__wbg_ptr = ret >>> 0;
416
+ WasmBrokerConfigFinalization.register(this, this.__wbg_ptr, this);
417
+ return this;
418
+ }
419
+ /**
420
+ * @param {number} value
421
+ */
422
+ set max_clients(value) {
423
+ wasm.wasmbrokerconfig_set_max_clients(this.__wbg_ptr, value);
424
+ }
425
+ /**
426
+ * @param {number} value
427
+ */
428
+ set session_expiry_interval_secs(value) {
429
+ wasm.wasmbrokerconfig_set_session_expiry_interval_secs(this.__wbg_ptr, value);
430
+ }
431
+ /**
432
+ * @param {number} value
433
+ */
434
+ set max_packet_size(value) {
435
+ wasm.wasmbrokerconfig_set_max_packet_size(this.__wbg_ptr, value);
436
+ }
437
+ /**
438
+ * @param {number} value
439
+ */
440
+ set topic_alias_maximum(value) {
441
+ wasm.wasmbrokerconfig_set_topic_alias_maximum(this.__wbg_ptr, value);
442
+ }
443
+ /**
444
+ * @param {boolean} value
445
+ */
446
+ set retain_available(value) {
447
+ wasm.wasmbrokerconfig_set_retain_available(this.__wbg_ptr, value);
448
+ }
449
+ /**
450
+ * @param {number} value
451
+ */
452
+ set maximum_qos(value) {
453
+ wasm.wasmbrokerconfig_set_maximum_qos(this.__wbg_ptr, value);
454
+ }
455
+ /**
456
+ * @param {boolean} value
457
+ */
458
+ set wildcard_subscription_available(value) {
459
+ wasm.wasmbrokerconfig_set_wildcard_subscription_available(this.__wbg_ptr, value);
460
+ }
461
+ /**
462
+ * @param {boolean} value
463
+ */
464
+ set subscription_identifier_available(value) {
465
+ wasm.wasmbrokerconfig_set_subscription_identifier_available(this.__wbg_ptr, value);
466
+ }
467
+ /**
468
+ * @param {boolean} value
469
+ */
470
+ set shared_subscription_available(value) {
471
+ wasm.wasmbrokerconfig_set_shared_subscription_available(this.__wbg_ptr, value);
472
+ }
473
+ /**
474
+ * @param {number | null} [value]
475
+ */
476
+ set server_keep_alive_secs(value) {
477
+ wasm.wasmbrokerconfig_set_server_keep_alive_secs(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
478
+ }
479
+ }
480
+ if (Symbol.dispose) WasmBrokerConfig.prototype[Symbol.dispose] = WasmBrokerConfig.prototype.free;
481
+
482
+ const WasmConnectOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
483
+ ? { register: () => {}, unregister: () => {} }
484
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmconnectoptions_free(ptr >>> 0, 1));
485
+
486
+ export class WasmConnectOptions {
487
+
488
+ __destroy_into_raw() {
489
+ const ptr = this.__wbg_ptr;
490
+ this.__wbg_ptr = 0;
491
+ WasmConnectOptionsFinalization.unregister(this);
492
+ return ptr;
493
+ }
494
+
495
+ free() {
496
+ const ptr = this.__destroy_into_raw();
497
+ wasm.__wbg_wasmconnectoptions_free(ptr, 0);
498
+ }
499
+ constructor() {
500
+ const ret = wasm.wasmconnectoptions_new();
501
+ this.__wbg_ptr = ret >>> 0;
502
+ WasmConnectOptionsFinalization.register(this, this.__wbg_ptr, this);
503
+ return this;
504
+ }
505
+ /**
506
+ * @returns {number}
507
+ */
508
+ get keepAlive() {
509
+ const ret = wasm.wasmconnectoptions_keepAlive(this.__wbg_ptr);
510
+ return ret;
511
+ }
512
+ /**
513
+ * @param {number} value
514
+ */
515
+ set keepAlive(value) {
516
+ wasm.wasmconnectoptions_set_keepAlive(this.__wbg_ptr, value);
517
+ }
518
+ /**
519
+ * @returns {boolean}
520
+ */
521
+ get cleanStart() {
522
+ const ret = wasm.wasmconnectoptions_cleanStart(this.__wbg_ptr);
523
+ return ret !== 0;
524
+ }
525
+ /**
526
+ * @param {boolean} value
527
+ */
528
+ set cleanStart(value) {
529
+ wasm.wasmconnectoptions_set_cleanStart(this.__wbg_ptr, value);
530
+ }
531
+ /**
532
+ * @returns {string | undefined}
533
+ */
534
+ get username() {
535
+ const ret = wasm.wasmconnectoptions_username(this.__wbg_ptr);
536
+ let v1;
537
+ if (ret[0] !== 0) {
538
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
539
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
540
+ }
541
+ return v1;
542
+ }
543
+ /**
544
+ * @param {string | null} [value]
545
+ */
546
+ set username(value) {
547
+ var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
548
+ var len0 = WASM_VECTOR_LEN;
549
+ wasm.wasmconnectoptions_set_username(this.__wbg_ptr, ptr0, len0);
550
+ }
551
+ /**
552
+ * @param {Uint8Array} value
553
+ */
554
+ set password(value) {
555
+ const ptr0 = passArray8ToWasm0(value, wasm.__wbindgen_malloc);
556
+ const len0 = WASM_VECTOR_LEN;
557
+ wasm.wasmconnectoptions_set_password(this.__wbg_ptr, ptr0, len0);
558
+ }
559
+ /**
560
+ * @param {WasmWillMessage} will
561
+ */
562
+ set_will(will) {
563
+ _assertClass(will, WasmWillMessage);
564
+ var ptr0 = will.__destroy_into_raw();
565
+ wasm.wasmconnectoptions_set_will(this.__wbg_ptr, ptr0);
566
+ }
567
+ clear_will() {
568
+ wasm.wasmconnectoptions_clear_will(this.__wbg_ptr);
569
+ }
570
+ /**
571
+ * @returns {number | undefined}
572
+ */
573
+ get sessionExpiryInterval() {
574
+ const ret = wasm.wasmconnectoptions_sessionExpiryInterval(this.__wbg_ptr);
575
+ return ret === 0x100000001 ? undefined : ret;
576
+ }
577
+ /**
578
+ * @param {number | null} [value]
579
+ */
580
+ set sessionExpiryInterval(value) {
581
+ wasm.wasmbrokerconfig_set_server_keep_alive_secs(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
582
+ }
583
+ /**
584
+ * @returns {number | undefined}
585
+ */
586
+ get receiveMaximum() {
587
+ const ret = wasm.wasmconnectoptions_receiveMaximum(this.__wbg_ptr);
588
+ return ret === 0xFFFFFF ? undefined : ret;
589
+ }
590
+ /**
591
+ * @param {number | null} [value]
592
+ */
593
+ set receiveMaximum(value) {
594
+ wasm.wasmconnectoptions_set_receiveMaximum(this.__wbg_ptr, isLikeNone(value) ? 0xFFFFFF : value);
595
+ }
596
+ /**
597
+ * @returns {number | undefined}
598
+ */
599
+ get maximumPacketSize() {
600
+ const ret = wasm.wasmconnectoptions_maximumPacketSize(this.__wbg_ptr);
601
+ return ret === 0x100000001 ? undefined : ret;
602
+ }
603
+ /**
604
+ * @param {number | null} [value]
605
+ */
606
+ set maximumPacketSize(value) {
607
+ wasm.wasmconnectoptions_set_maximumPacketSize(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
608
+ }
609
+ /**
610
+ * @returns {number | undefined}
611
+ */
612
+ get topicAliasMaximum() {
613
+ const ret = wasm.wasmconnectoptions_topicAliasMaximum(this.__wbg_ptr);
614
+ return ret === 0xFFFFFF ? undefined : ret;
615
+ }
616
+ /**
617
+ * @param {number | null} [value]
618
+ */
619
+ set topicAliasMaximum(value) {
620
+ wasm.wasmconnectoptions_set_topicAliasMaximum(this.__wbg_ptr, isLikeNone(value) ? 0xFFFFFF : value);
621
+ }
622
+ /**
623
+ * @returns {boolean | undefined}
624
+ */
625
+ get requestResponseInformation() {
626
+ const ret = wasm.wasmconnectoptions_requestResponseInformation(this.__wbg_ptr);
627
+ return ret === 0xFFFFFF ? undefined : ret !== 0;
628
+ }
629
+ /**
630
+ * @param {boolean | null} [value]
631
+ */
632
+ set requestResponseInformation(value) {
633
+ wasm.wasmconnectoptions_set_requestResponseInformation(this.__wbg_ptr, isLikeNone(value) ? 0xFFFFFF : value ? 1 : 0);
634
+ }
635
+ /**
636
+ * @returns {boolean | undefined}
637
+ */
638
+ get requestProblemInformation() {
639
+ const ret = wasm.wasmconnectoptions_requestProblemInformation(this.__wbg_ptr);
640
+ return ret === 0xFFFFFF ? undefined : ret !== 0;
641
+ }
642
+ /**
643
+ * @param {boolean | null} [value]
644
+ */
645
+ set requestProblemInformation(value) {
646
+ wasm.wasmconnectoptions_set_requestProblemInformation(this.__wbg_ptr, isLikeNone(value) ? 0xFFFFFF : value ? 1 : 0);
647
+ }
648
+ /**
649
+ * @returns {string | undefined}
650
+ */
651
+ get authenticationMethod() {
652
+ const ret = wasm.wasmconnectoptions_authenticationMethod(this.__wbg_ptr);
653
+ let v1;
654
+ if (ret[0] !== 0) {
655
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
656
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
657
+ }
658
+ return v1;
659
+ }
660
+ /**
661
+ * @param {string | null} [value]
662
+ */
663
+ set authenticationMethod(value) {
664
+ var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
665
+ var len0 = WASM_VECTOR_LEN;
666
+ wasm.wasmconnectoptions_set_authenticationMethod(this.__wbg_ptr, ptr0, len0);
667
+ }
668
+ /**
669
+ * @param {Uint8Array} value
670
+ */
671
+ set authenticationData(value) {
672
+ const ptr0 = passArray8ToWasm0(value, wasm.__wbindgen_malloc);
673
+ const len0 = WASM_VECTOR_LEN;
674
+ wasm.wasmconnectoptions_set_authenticationData(this.__wbg_ptr, ptr0, len0);
675
+ }
676
+ /**
677
+ * @param {string} key
678
+ * @param {string} value
679
+ */
680
+ addUserProperty(key, value) {
681
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
682
+ const len0 = WASM_VECTOR_LEN;
683
+ const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
684
+ const len1 = WASM_VECTOR_LEN;
685
+ wasm.wasmconnectoptions_addUserProperty(this.__wbg_ptr, ptr0, len0, ptr1, len1);
686
+ }
687
+ clearUserProperties() {
688
+ wasm.wasmconnectoptions_clearUserProperties(this.__wbg_ptr);
689
+ }
690
+ }
691
+ if (Symbol.dispose) WasmConnectOptions.prototype[Symbol.dispose] = WasmConnectOptions.prototype.free;
692
+
693
+ const WasmMqttClientFinalization = (typeof FinalizationRegistry === 'undefined')
694
+ ? { register: () => {}, unregister: () => {} }
695
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmmqttclient_free(ptr >>> 0, 1));
696
+
697
+ export class WasmMqttClient {
698
+
699
+ __destroy_into_raw() {
700
+ const ptr = this.__wbg_ptr;
701
+ this.__wbg_ptr = 0;
702
+ WasmMqttClientFinalization.unregister(this);
703
+ return ptr;
704
+ }
705
+
706
+ free() {
707
+ const ptr = this.__destroy_into_raw();
708
+ wasm.__wbg_wasmmqttclient_free(ptr, 0);
709
+ }
710
+ /**
711
+ * @param {string} client_id
712
+ */
713
+ constructor(client_id) {
714
+ const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
715
+ const len0 = WASM_VECTOR_LEN;
716
+ const ret = wasm.wasmmqttclient_new(ptr0, len0);
717
+ this.__wbg_ptr = ret >>> 0;
718
+ WasmMqttClientFinalization.register(this, this.__wbg_ptr, this);
719
+ return this;
720
+ }
721
+ /**
722
+ * @param {string} url
723
+ * @returns {Promise<void>}
724
+ */
725
+ connect(url) {
726
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
727
+ const len0 = WASM_VECTOR_LEN;
728
+ const ret = wasm.wasmmqttclient_connect(this.__wbg_ptr, ptr0, len0);
729
+ return ret;
730
+ }
731
+ /**
732
+ * @param {string} url
733
+ * @param {WasmConnectOptions} config
734
+ * @returns {Promise<void>}
735
+ */
736
+ connect_with_options(url, config) {
737
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
738
+ const len0 = WASM_VECTOR_LEN;
739
+ _assertClass(config, WasmConnectOptions);
740
+ const ret = wasm.wasmmqttclient_connect_with_options(this.__wbg_ptr, ptr0, len0, config.__wbg_ptr);
741
+ return ret;
742
+ }
743
+ /**
744
+ * @param {MessagePort} port
745
+ * @returns {Promise<void>}
746
+ */
747
+ connect_message_port(port) {
748
+ const ret = wasm.wasmmqttclient_connect_message_port(this.__wbg_ptr, port);
749
+ return ret;
750
+ }
751
+ /**
752
+ * @param {string} channel_name
753
+ * @returns {Promise<void>}
754
+ */
755
+ connect_broadcast_channel(channel_name) {
756
+ const ptr0 = passStringToWasm0(channel_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
757
+ const len0 = WASM_VECTOR_LEN;
758
+ const ret = wasm.wasmmqttclient_connect_broadcast_channel(this.__wbg_ptr, ptr0, len0);
759
+ return ret;
760
+ }
761
+ /**
762
+ * @param {string} topic
763
+ * @param {Uint8Array} payload
764
+ * @returns {Promise<void>}
765
+ */
766
+ publish(topic, payload) {
767
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
768
+ const len0 = WASM_VECTOR_LEN;
769
+ const ptr1 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
770
+ const len1 = WASM_VECTOR_LEN;
771
+ const ret = wasm.wasmmqttclient_publish(this.__wbg_ptr, ptr0, len0, ptr1, len1);
772
+ return ret;
773
+ }
774
+ /**
775
+ * @param {string} topic
776
+ * @param {Uint8Array} payload
777
+ * @param {WasmPublishOptions} options
778
+ * @returns {Promise<void>}
779
+ */
780
+ publish_with_options(topic, payload, options) {
781
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
782
+ const len0 = WASM_VECTOR_LEN;
783
+ const ptr1 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
784
+ const len1 = WASM_VECTOR_LEN;
785
+ _assertClass(options, WasmPublishOptions);
786
+ const ret = wasm.wasmmqttclient_publish_with_options(this.__wbg_ptr, ptr0, len0, ptr1, len1, options.__wbg_ptr);
787
+ return ret;
788
+ }
789
+ /**
790
+ * @param {string} topic
791
+ * @param {Uint8Array} payload
792
+ * @param {Function} callback
793
+ * @returns {Promise<number>}
794
+ */
795
+ publish_qos1(topic, payload, callback) {
796
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
797
+ const len0 = WASM_VECTOR_LEN;
798
+ const ptr1 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
799
+ const len1 = WASM_VECTOR_LEN;
800
+ const ret = wasm.wasmmqttclient_publish_qos1(this.__wbg_ptr, ptr0, len0, ptr1, len1, callback);
801
+ return ret;
802
+ }
803
+ /**
804
+ * @param {string} topic
805
+ * @param {Uint8Array} payload
806
+ * @param {Function} callback
807
+ * @returns {Promise<number>}
808
+ */
809
+ publish_qos2(topic, payload, callback) {
810
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
811
+ const len0 = WASM_VECTOR_LEN;
812
+ const ptr1 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
813
+ const len1 = WASM_VECTOR_LEN;
814
+ const ret = wasm.wasmmqttclient_publish_qos2(this.__wbg_ptr, ptr0, len0, ptr1, len1, callback);
815
+ return ret;
816
+ }
817
+ /**
818
+ * @param {string} topic
819
+ * @returns {Promise<number>}
820
+ */
821
+ subscribe(topic) {
822
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
823
+ const len0 = WASM_VECTOR_LEN;
824
+ const ret = wasm.wasmmqttclient_subscribe(this.__wbg_ptr, ptr0, len0);
825
+ return ret;
826
+ }
827
+ /**
828
+ * @param {string} topic
829
+ * @param {Function} callback
830
+ * @param {WasmSubscribeOptions} options
831
+ * @returns {Promise<number>}
832
+ */
833
+ subscribe_with_options(topic, callback, options) {
834
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
835
+ const len0 = WASM_VECTOR_LEN;
836
+ _assertClass(options, WasmSubscribeOptions);
837
+ const ret = wasm.wasmmqttclient_subscribe_with_options(this.__wbg_ptr, ptr0, len0, callback, options.__wbg_ptr);
838
+ return ret;
839
+ }
840
+ /**
841
+ * @param {string} topic
842
+ * @param {Function} callback
843
+ * @returns {Promise<number>}
844
+ */
845
+ subscribe_with_callback(topic, callback) {
846
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
847
+ const len0 = WASM_VECTOR_LEN;
848
+ const ret = wasm.wasmmqttclient_subscribe_with_callback(this.__wbg_ptr, ptr0, len0, callback);
849
+ return ret;
850
+ }
851
+ /**
852
+ * @param {string} topic
853
+ * @returns {Promise<number>}
854
+ */
855
+ unsubscribe(topic) {
856
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
857
+ const len0 = WASM_VECTOR_LEN;
858
+ const ret = wasm.wasmmqttclient_unsubscribe(this.__wbg_ptr, ptr0, len0);
859
+ return ret;
860
+ }
861
+ /**
862
+ * @returns {Promise<void>}
863
+ */
864
+ disconnect() {
865
+ const ret = wasm.wasmmqttclient_disconnect(this.__wbg_ptr);
866
+ return ret;
867
+ }
868
+ /**
869
+ * @returns {boolean}
870
+ */
871
+ is_connected() {
872
+ const ret = wasm.wasmmqttclient_is_connected(this.__wbg_ptr);
873
+ return ret !== 0;
874
+ }
875
+ /**
876
+ * @param {Function} callback
877
+ */
878
+ on_connect(callback) {
879
+ wasm.wasmmqttclient_on_connect(this.__wbg_ptr, callback);
880
+ }
881
+ /**
882
+ * @param {Function} callback
883
+ */
884
+ on_disconnect(callback) {
885
+ wasm.wasmmqttclient_on_disconnect(this.__wbg_ptr, callback);
886
+ }
887
+ /**
888
+ * @param {Function} callback
889
+ */
890
+ on_error(callback) {
891
+ wasm.wasmmqttclient_on_error(this.__wbg_ptr, callback);
892
+ }
893
+ /**
894
+ * @param {Function} callback
895
+ */
896
+ on_auth_challenge(callback) {
897
+ wasm.wasmmqttclient_on_auth_challenge(this.__wbg_ptr, callback);
898
+ }
899
+ /**
900
+ * @param {Uint8Array} auth_data
901
+ * @returns {Promise<void>}
902
+ */
903
+ respond_auth(auth_data) {
904
+ const ptr0 = passArray8ToWasm0(auth_data, wasm.__wbindgen_malloc);
905
+ const len0 = WASM_VECTOR_LEN;
906
+ const ret = wasm.wasmmqttclient_respond_auth(this.__wbg_ptr, ptr0, len0);
907
+ return ret;
908
+ }
909
+ }
910
+ if (Symbol.dispose) WasmMqttClient.prototype[Symbol.dispose] = WasmMqttClient.prototype.free;
911
+
912
+ const WasmPublishOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
913
+ ? { register: () => {}, unregister: () => {} }
914
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmpublishoptions_free(ptr >>> 0, 1));
915
+
916
+ export class WasmPublishOptions {
917
+
918
+ __destroy_into_raw() {
919
+ const ptr = this.__wbg_ptr;
920
+ this.__wbg_ptr = 0;
921
+ WasmPublishOptionsFinalization.unregister(this);
922
+ return ptr;
923
+ }
924
+
925
+ free() {
926
+ const ptr = this.__destroy_into_raw();
927
+ wasm.__wbg_wasmpublishoptions_free(ptr, 0);
928
+ }
929
+ constructor() {
930
+ const ret = wasm.wasmpublishoptions_new();
931
+ this.__wbg_ptr = ret >>> 0;
932
+ WasmPublishOptionsFinalization.register(this, this.__wbg_ptr, this);
933
+ return this;
934
+ }
935
+ /**
936
+ * @returns {number}
937
+ */
938
+ get qos() {
939
+ const ret = wasm.wasmpublishoptions_qos(this.__wbg_ptr);
940
+ return ret;
941
+ }
942
+ /**
943
+ * @param {number} value
944
+ */
945
+ set qos(value) {
946
+ wasm.wasmpublishoptions_set_qos(this.__wbg_ptr, value);
947
+ }
948
+ /**
949
+ * @returns {boolean}
950
+ */
951
+ get retain() {
952
+ const ret = wasm.wasmpublishoptions_retain(this.__wbg_ptr);
953
+ return ret !== 0;
954
+ }
955
+ /**
956
+ * @param {boolean} value
957
+ */
958
+ set retain(value) {
959
+ wasm.wasmpublishoptions_set_retain(this.__wbg_ptr, value);
960
+ }
961
+ /**
962
+ * @returns {boolean | undefined}
963
+ */
964
+ get payloadFormatIndicator() {
965
+ const ret = wasm.wasmpublishoptions_payloadFormatIndicator(this.__wbg_ptr);
966
+ return ret === 0xFFFFFF ? undefined : ret !== 0;
967
+ }
968
+ /**
969
+ * @param {boolean | null} [value]
970
+ */
971
+ set payloadFormatIndicator(value) {
972
+ wasm.wasmpublishoptions_set_payloadFormatIndicator(this.__wbg_ptr, isLikeNone(value) ? 0xFFFFFF : value ? 1 : 0);
973
+ }
974
+ /**
975
+ * @returns {number | undefined}
976
+ */
977
+ get messageExpiryInterval() {
978
+ const ret = wasm.wasmconnectoptions_sessionExpiryInterval(this.__wbg_ptr);
979
+ return ret === 0x100000001 ? undefined : ret;
980
+ }
981
+ /**
982
+ * @param {number | null} [value]
983
+ */
984
+ set messageExpiryInterval(value) {
985
+ wasm.wasmbrokerconfig_set_server_keep_alive_secs(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
986
+ }
987
+ /**
988
+ * @returns {number | undefined}
989
+ */
990
+ get topicAlias() {
991
+ const ret = wasm.wasmpublishoptions_topicAlias(this.__wbg_ptr);
992
+ return ret === 0xFFFFFF ? undefined : ret;
993
+ }
994
+ /**
995
+ * @param {number | null} [value]
996
+ */
997
+ set topicAlias(value) {
998
+ wasm.wasmpublishoptions_set_topicAlias(this.__wbg_ptr, isLikeNone(value) ? 0xFFFFFF : value);
999
+ }
1000
+ /**
1001
+ * @returns {string | undefined}
1002
+ */
1003
+ get responseTopic() {
1004
+ const ret = wasm.wasmpublishoptions_responseTopic(this.__wbg_ptr);
1005
+ let v1;
1006
+ if (ret[0] !== 0) {
1007
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
1008
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1009
+ }
1010
+ return v1;
1011
+ }
1012
+ /**
1013
+ * @param {string | null} [value]
1014
+ */
1015
+ set responseTopic(value) {
1016
+ var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1017
+ var len0 = WASM_VECTOR_LEN;
1018
+ wasm.wasmpublishoptions_set_responseTopic(this.__wbg_ptr, ptr0, len0);
1019
+ }
1020
+ /**
1021
+ * @param {Uint8Array} value
1022
+ */
1023
+ set correlationData(value) {
1024
+ const ptr0 = passArray8ToWasm0(value, wasm.__wbindgen_malloc);
1025
+ const len0 = WASM_VECTOR_LEN;
1026
+ wasm.wasmpublishoptions_set_correlationData(this.__wbg_ptr, ptr0, len0);
1027
+ }
1028
+ /**
1029
+ * @returns {string | undefined}
1030
+ */
1031
+ get contentType() {
1032
+ const ret = wasm.wasmpublishoptions_contentType(this.__wbg_ptr);
1033
+ let v1;
1034
+ if (ret[0] !== 0) {
1035
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
1036
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1037
+ }
1038
+ return v1;
1039
+ }
1040
+ /**
1041
+ * @param {string | null} [value]
1042
+ */
1043
+ set contentType(value) {
1044
+ var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1045
+ var len0 = WASM_VECTOR_LEN;
1046
+ wasm.wasmpublishoptions_set_contentType(this.__wbg_ptr, ptr0, len0);
1047
+ }
1048
+ /**
1049
+ * @param {string} key
1050
+ * @param {string} value
1051
+ */
1052
+ addUserProperty(key, value) {
1053
+ const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1054
+ const len0 = WASM_VECTOR_LEN;
1055
+ const ptr1 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1056
+ const len1 = WASM_VECTOR_LEN;
1057
+ wasm.wasmpublishoptions_addUserProperty(this.__wbg_ptr, ptr0, len0, ptr1, len1);
1058
+ }
1059
+ clearUserProperties() {
1060
+ wasm.wasmpublishoptions_clearUserProperties(this.__wbg_ptr);
1061
+ }
1062
+ }
1063
+ if (Symbol.dispose) WasmPublishOptions.prototype[Symbol.dispose] = WasmPublishOptions.prototype.free;
1064
+
1065
+ const WasmSubscribeOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
1066
+ ? { register: () => {}, unregister: () => {} }
1067
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmsubscribeoptions_free(ptr >>> 0, 1));
1068
+
1069
+ export class WasmSubscribeOptions {
1070
+
1071
+ __destroy_into_raw() {
1072
+ const ptr = this.__wbg_ptr;
1073
+ this.__wbg_ptr = 0;
1074
+ WasmSubscribeOptionsFinalization.unregister(this);
1075
+ return ptr;
1076
+ }
1077
+
1078
+ free() {
1079
+ const ptr = this.__destroy_into_raw();
1080
+ wasm.__wbg_wasmsubscribeoptions_free(ptr, 0);
1081
+ }
1082
+ constructor() {
1083
+ const ret = wasm.wasmsubscribeoptions_new();
1084
+ this.__wbg_ptr = ret >>> 0;
1085
+ WasmSubscribeOptionsFinalization.register(this, this.__wbg_ptr, this);
1086
+ return this;
1087
+ }
1088
+ /**
1089
+ * @returns {number}
1090
+ */
1091
+ get qos() {
1092
+ const ret = wasm.wasmsubscribeoptions_qos(this.__wbg_ptr);
1093
+ return ret;
1094
+ }
1095
+ /**
1096
+ * @param {number} value
1097
+ */
1098
+ set qos(value) {
1099
+ wasm.wasmsubscribeoptions_set_qos(this.__wbg_ptr, value);
1100
+ }
1101
+ /**
1102
+ * @returns {boolean}
1103
+ */
1104
+ get noLocal() {
1105
+ const ret = wasm.wasmsubscribeoptions_noLocal(this.__wbg_ptr);
1106
+ return ret !== 0;
1107
+ }
1108
+ /**
1109
+ * @param {boolean} value
1110
+ */
1111
+ set noLocal(value) {
1112
+ wasm.wasmsubscribeoptions_set_noLocal(this.__wbg_ptr, value);
1113
+ }
1114
+ /**
1115
+ * @returns {boolean}
1116
+ */
1117
+ get retainAsPublished() {
1118
+ const ret = wasm.wasmsubscribeoptions_retainAsPublished(this.__wbg_ptr);
1119
+ return ret !== 0;
1120
+ }
1121
+ /**
1122
+ * @param {boolean} value
1123
+ */
1124
+ set retainAsPublished(value) {
1125
+ wasm.wasmsubscribeoptions_set_retainAsPublished(this.__wbg_ptr, value);
1126
+ }
1127
+ /**
1128
+ * @returns {number}
1129
+ */
1130
+ get retainHandling() {
1131
+ const ret = wasm.wasmsubscribeoptions_retainHandling(this.__wbg_ptr);
1132
+ return ret;
1133
+ }
1134
+ /**
1135
+ * @param {number} value
1136
+ */
1137
+ set retainHandling(value) {
1138
+ wasm.wasmsubscribeoptions_set_retainHandling(this.__wbg_ptr, value);
1139
+ }
1140
+ /**
1141
+ * @returns {number | undefined}
1142
+ */
1143
+ get subscriptionIdentifier() {
1144
+ const ret = wasm.wasmconnectoptions_sessionExpiryInterval(this.__wbg_ptr);
1145
+ return ret === 0x100000001 ? undefined : ret;
1146
+ }
1147
+ /**
1148
+ * @param {number | null} [value]
1149
+ */
1150
+ set subscriptionIdentifier(value) {
1151
+ wasm.wasmbrokerconfig_set_server_keep_alive_secs(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
1152
+ }
1153
+ }
1154
+ if (Symbol.dispose) WasmSubscribeOptions.prototype[Symbol.dispose] = WasmSubscribeOptions.prototype.free;
1155
+
1156
+ const WasmWillMessageFinalization = (typeof FinalizationRegistry === 'undefined')
1157
+ ? { register: () => {}, unregister: () => {} }
1158
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmwillmessage_free(ptr >>> 0, 1));
1159
+
1160
+ export class WasmWillMessage {
1161
+
1162
+ __destroy_into_raw() {
1163
+ const ptr = this.__wbg_ptr;
1164
+ this.__wbg_ptr = 0;
1165
+ WasmWillMessageFinalization.unregister(this);
1166
+ return ptr;
1167
+ }
1168
+
1169
+ free() {
1170
+ const ptr = this.__destroy_into_raw();
1171
+ wasm.__wbg_wasmwillmessage_free(ptr, 0);
1172
+ }
1173
+ /**
1174
+ * @param {string} topic
1175
+ * @param {Uint8Array} payload
1176
+ */
1177
+ constructor(topic, payload) {
1178
+ const ptr0 = passStringToWasm0(topic, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1179
+ const len0 = WASM_VECTOR_LEN;
1180
+ const ptr1 = passArray8ToWasm0(payload, wasm.__wbindgen_malloc);
1181
+ const len1 = WASM_VECTOR_LEN;
1182
+ const ret = wasm.wasmwillmessage_new(ptr0, len0, ptr1, len1);
1183
+ this.__wbg_ptr = ret >>> 0;
1184
+ WasmWillMessageFinalization.register(this, this.__wbg_ptr, this);
1185
+ return this;
1186
+ }
1187
+ /**
1188
+ * @returns {string}
1189
+ */
1190
+ get topic() {
1191
+ let deferred1_0;
1192
+ let deferred1_1;
1193
+ try {
1194
+ const ret = wasm.wasmwillmessage_topic(this.__wbg_ptr);
1195
+ deferred1_0 = ret[0];
1196
+ deferred1_1 = ret[1];
1197
+ return getStringFromWasm0(ret[0], ret[1]);
1198
+ } finally {
1199
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
1200
+ }
1201
+ }
1202
+ /**
1203
+ * @param {string} value
1204
+ */
1205
+ set topic(value) {
1206
+ const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1207
+ const len0 = WASM_VECTOR_LEN;
1208
+ wasm.wasmwillmessage_set_topic(this.__wbg_ptr, ptr0, len0);
1209
+ }
1210
+ /**
1211
+ * @returns {number}
1212
+ */
1213
+ get qos() {
1214
+ const ret = wasm.wasmwillmessage_qos(this.__wbg_ptr);
1215
+ return ret;
1216
+ }
1217
+ /**
1218
+ * @param {number} value
1219
+ */
1220
+ set qos(value) {
1221
+ wasm.wasmwillmessage_set_qos(this.__wbg_ptr, value);
1222
+ }
1223
+ /**
1224
+ * @returns {boolean}
1225
+ */
1226
+ get retain() {
1227
+ const ret = wasm.wasmwillmessage_retain(this.__wbg_ptr);
1228
+ return ret !== 0;
1229
+ }
1230
+ /**
1231
+ * @param {boolean} value
1232
+ */
1233
+ set retain(value) {
1234
+ wasm.wasmwillmessage_set_retain(this.__wbg_ptr, value);
1235
+ }
1236
+ /**
1237
+ * @returns {number | undefined}
1238
+ */
1239
+ get willDelayInterval() {
1240
+ const ret = wasm.wasmconnectoptions_sessionExpiryInterval(this.__wbg_ptr);
1241
+ return ret === 0x100000001 ? undefined : ret;
1242
+ }
1243
+ /**
1244
+ * @param {number | null} [value]
1245
+ */
1246
+ set willDelayInterval(value) {
1247
+ wasm.wasmbrokerconfig_set_server_keep_alive_secs(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
1248
+ }
1249
+ /**
1250
+ * @returns {number | undefined}
1251
+ */
1252
+ get messageExpiryInterval() {
1253
+ const ret = wasm.wasmconnectoptions_maximumPacketSize(this.__wbg_ptr);
1254
+ return ret === 0x100000001 ? undefined : ret;
1255
+ }
1256
+ /**
1257
+ * @param {number | null} [value]
1258
+ */
1259
+ set messageExpiryInterval(value) {
1260
+ wasm.wasmconnectoptions_set_maximumPacketSize(this.__wbg_ptr, isLikeNone(value) ? 0x100000001 : (value) >>> 0);
1261
+ }
1262
+ /**
1263
+ * @returns {string | undefined}
1264
+ */
1265
+ get contentType() {
1266
+ const ret = wasm.wasmwillmessage_contentType(this.__wbg_ptr);
1267
+ let v1;
1268
+ if (ret[0] !== 0) {
1269
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
1270
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1271
+ }
1272
+ return v1;
1273
+ }
1274
+ /**
1275
+ * @param {string | null} [value]
1276
+ */
1277
+ set contentType(value) {
1278
+ var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1279
+ var len0 = WASM_VECTOR_LEN;
1280
+ wasm.wasmwillmessage_set_contentType(this.__wbg_ptr, ptr0, len0);
1281
+ }
1282
+ /**
1283
+ * @returns {string | undefined}
1284
+ */
1285
+ get responseTopic() {
1286
+ const ret = wasm.wasmwillmessage_responseTopic(this.__wbg_ptr);
1287
+ let v1;
1288
+ if (ret[0] !== 0) {
1289
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
1290
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
1291
+ }
1292
+ return v1;
1293
+ }
1294
+ /**
1295
+ * @param {string | null} [value]
1296
+ */
1297
+ set responseTopic(value) {
1298
+ var ptr0 = isLikeNone(value) ? 0 : passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1299
+ var len0 = WASM_VECTOR_LEN;
1300
+ wasm.wasmwillmessage_set_responseTopic(this.__wbg_ptr, ptr0, len0);
1301
+ }
1302
+ }
1303
+ if (Symbol.dispose) WasmWillMessage.prototype[Symbol.dispose] = WasmWillMessage.prototype.free;
1304
+
1305
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
1306
+
1307
+ async function __wbg_load(module, imports) {
1308
+ if (typeof Response === 'function' && module instanceof Response) {
1309
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
1310
+ try {
1311
+ return await WebAssembly.instantiateStreaming(module, imports);
1312
+
1313
+ } catch (e) {
1314
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
1315
+
1316
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
1317
+ 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);
1318
+
1319
+ } else {
1320
+ throw e;
1321
+ }
1322
+ }
1323
+ }
1324
+
1325
+ const bytes = await module.arrayBuffer();
1326
+ return await WebAssembly.instantiate(bytes, imports);
1327
+
1328
+ } else {
1329
+ const instance = await WebAssembly.instantiate(module, imports);
1330
+
1331
+ if (instance instanceof WebAssembly.Instance) {
1332
+ return { instance, module };
1333
+
1334
+ } else {
1335
+ return instance;
1336
+ }
1337
+ }
1338
+ }
1339
+
1340
+ function __wbg_get_imports() {
1341
+ const imports = {};
1342
+ imports.wbg = {};
1343
+ imports.wbg.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
1344
+ const ret = debugString(arg1);
1345
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1346
+ const len1 = WASM_VECTOR_LEN;
1347
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1348
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1349
+ };
1350
+ imports.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
1351
+ const ret = typeof(arg0) === 'function';
1352
+ return ret;
1353
+ };
1354
+ imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
1355
+ const ret = arg0 === undefined;
1356
+ return ret;
1357
+ };
1358
+ imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
1359
+ throw new Error(getStringFromWasm0(arg0, arg1));
1360
+ };
1361
+ imports.wbg.__wbg__wbg_cb_unref_2454a539ea5790d9 = function(arg0) {
1362
+ arg0._wbg_cb_unref();
1363
+ };
1364
+ imports.wbg.__wbg_buffer_ccc4520b36d3ccf4 = function(arg0) {
1365
+ const ret = arg0.buffer;
1366
+ return ret;
1367
+ };
1368
+ imports.wbg.__wbg_call_525440f72fbfc0ea = function() { return handleError(function (arg0, arg1, arg2) {
1369
+ const ret = arg0.call(arg1, arg2);
1370
+ return ret;
1371
+ }, arguments) };
1372
+ imports.wbg.__wbg_call_e45d2cf9fc925fcf = function() { return handleError(function (arg0, arg1, arg2, arg3) {
1373
+ const ret = arg0.call(arg1, arg2, arg3);
1374
+ return ret;
1375
+ }, arguments) };
1376
+ imports.wbg.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
1377
+ const ret = arg0.call(arg1);
1378
+ return ret;
1379
+ }, arguments) };
1380
+ imports.wbg.__wbg_clearTimeout_5a54f8841c30079a = function(arg0) {
1381
+ const ret = clearTimeout(arg0);
1382
+ return ret;
1383
+ };
1384
+ imports.wbg.__wbg_close_209083eb02f34c98 = function(arg0) {
1385
+ arg0.close();
1386
+ };
1387
+ imports.wbg.__wbg_close_462d6d95a9f53a1d = function(arg0) {
1388
+ arg0.close();
1389
+ };
1390
+ imports.wbg.__wbg_close_885e277edf06b3fa = function() { return handleError(function (arg0) {
1391
+ arg0.close();
1392
+ }, arguments) };
1393
+ imports.wbg.__wbg_data_ee4306d069f24f2d = function(arg0) {
1394
+ const ret = arg0.data;
1395
+ return ret;
1396
+ };
1397
+ imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
1398
+ let deferred0_0;
1399
+ let deferred0_1;
1400
+ try {
1401
+ deferred0_0 = arg0;
1402
+ deferred0_1 = arg1;
1403
+ console.error(getStringFromWasm0(arg0, arg1));
1404
+ } finally {
1405
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
1406
+ }
1407
+ };
1408
+ imports.wbg.__wbg_error_a7f8fbb0523dae15 = function(arg0) {
1409
+ console.error(arg0);
1410
+ };
1411
+ imports.wbg.__wbg_getRandomValues_1c61fac11405ffdc = function() { return handleError(function (arg0, arg1) {
1412
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
1413
+ }, arguments) };
1414
+ imports.wbg.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38 = function(arg0) {
1415
+ let result;
1416
+ try {
1417
+ result = arg0 instanceof ArrayBuffer;
1418
+ } catch (_) {
1419
+ result = false;
1420
+ }
1421
+ const ret = result;
1422
+ return ret;
1423
+ };
1424
+ imports.wbg.__wbg_instanceof_Window_4846dbb3de56c84c = function(arg0) {
1425
+ let result;
1426
+ try {
1427
+ result = arg0 instanceof Window;
1428
+ } catch (_) {
1429
+ result = false;
1430
+ }
1431
+ const ret = result;
1432
+ return ret;
1433
+ };
1434
+ imports.wbg.__wbg_length_69bca3cb64fc8748 = function(arg0) {
1435
+ const ret = arg0.length;
1436
+ return ret;
1437
+ };
1438
+ imports.wbg.__wbg_log_8cec76766b8c0e33 = function(arg0) {
1439
+ console.log(arg0);
1440
+ };
1441
+ imports.wbg.__wbg_new_3c3d849046688a66 = function(arg0, arg1) {
1442
+ try {
1443
+ var state0 = {a: arg0, b: arg1};
1444
+ var cb0 = (arg0, arg1) => {
1445
+ const a = state0.a;
1446
+ state0.a = 0;
1447
+ try {
1448
+ return wasm_bindgen__convert__closures_____invoke__hbbb6f9316512cb4e(a, state0.b, arg0, arg1);
1449
+ } finally {
1450
+ state0.a = a;
1451
+ }
1452
+ };
1453
+ const ret = new Promise(cb0);
1454
+ return ret;
1455
+ } finally {
1456
+ state0.a = state0.b = 0;
1457
+ }
1458
+ };
1459
+ imports.wbg.__wbg_new_5a79be3ab53b8aa5 = function(arg0) {
1460
+ const ret = new Uint8Array(arg0);
1461
+ return ret;
1462
+ };
1463
+ imports.wbg.__wbg_new_67069b49258d9f2a = function() { return handleError(function (arg0, arg1) {
1464
+ const ret = new BroadcastChannel(getStringFromWasm0(arg0, arg1));
1465
+ return ret;
1466
+ }, arguments) };
1467
+ imports.wbg.__wbg_new_881c4fe631eee9ad = function() { return handleError(function (arg0, arg1) {
1468
+ const ret = new WebSocket(getStringFromWasm0(arg0, arg1));
1469
+ return ret;
1470
+ }, arguments) };
1471
+ imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
1472
+ const ret = new Error();
1473
+ return ret;
1474
+ };
1475
+ imports.wbg.__wbg_new_c31bb2023cab7b59 = function() { return handleError(function () {
1476
+ const ret = new MessageChannel();
1477
+ return ret;
1478
+ }, arguments) };
1479
+ imports.wbg.__wbg_new_e17d9f43105b08be = function() {
1480
+ const ret = new Array();
1481
+ return ret;
1482
+ };
1483
+ imports.wbg.__wbg_new_from_slice_92f4d78ca282a2d2 = function(arg0, arg1) {
1484
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
1485
+ return ret;
1486
+ };
1487
+ imports.wbg.__wbg_new_no_args_ee98eee5275000a4 = function(arg0, arg1) {
1488
+ const ret = new Function(getStringFromWasm0(arg0, arg1));
1489
+ return ret;
1490
+ };
1491
+ imports.wbg.__wbg_now_2c95c9de01293173 = function(arg0) {
1492
+ const ret = arg0.now();
1493
+ return ret;
1494
+ };
1495
+ imports.wbg.__wbg_now_793306c526e2e3b6 = function() {
1496
+ const ret = Date.now();
1497
+ return ret;
1498
+ };
1499
+ imports.wbg.__wbg_performance_7a3ffd0b17f663ad = function(arg0) {
1500
+ const ret = arg0.performance;
1501
+ return ret;
1502
+ };
1503
+ imports.wbg.__wbg_port1_d9822fb6881d8cfe = function(arg0) {
1504
+ const ret = arg0.port1;
1505
+ return ret;
1506
+ };
1507
+ imports.wbg.__wbg_port2_bd4cbea5c475915f = function(arg0) {
1508
+ const ret = arg0.port2;
1509
+ return ret;
1510
+ };
1511
+ imports.wbg.__wbg_postMessage_2e1248c7fe808340 = function() { return handleError(function (arg0, arg1) {
1512
+ arg0.postMessage(arg1);
1513
+ }, arguments) };
1514
+ imports.wbg.__wbg_postMessage_cea6d6f3b452f8bc = function() { return handleError(function (arg0, arg1) {
1515
+ arg0.postMessage(arg1);
1516
+ }, arguments) };
1517
+ imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
1518
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1519
+ };
1520
+ imports.wbg.__wbg_push_df81a39d04db858c = function(arg0, arg1) {
1521
+ const ret = arg0.push(arg1);
1522
+ return ret;
1523
+ };
1524
+ imports.wbg.__wbg_queueMicrotask_34d692c25c47d05b = function(arg0) {
1525
+ const ret = arg0.queueMicrotask;
1526
+ return ret;
1527
+ };
1528
+ imports.wbg.__wbg_queueMicrotask_9d76cacb20c84d58 = function(arg0) {
1529
+ queueMicrotask(arg0);
1530
+ };
1531
+ imports.wbg.__wbg_resolve_caf97c30b83f7053 = function(arg0) {
1532
+ const ret = Promise.resolve(arg0);
1533
+ return ret;
1534
+ };
1535
+ imports.wbg.__wbg_send_3d2cf376613294f0 = function() { return handleError(function (arg0, arg1, arg2) {
1536
+ arg0.send(getArrayU8FromWasm0(arg1, arg2));
1537
+ }, arguments) };
1538
+ imports.wbg.__wbg_setTimeout_780ac15e3df4c663 = function() { return handleError(function (arg0, arg1, arg2) {
1539
+ const ret = arg0.setTimeout(arg1, arg2);
1540
+ return ret;
1541
+ }, arguments) };
1542
+ imports.wbg.__wbg_setTimeout_db2dbaeefb6f39c7 = function() { return handleError(function (arg0, arg1) {
1543
+ const ret = setTimeout(arg0, arg1);
1544
+ return ret;
1545
+ }, arguments) };
1546
+ imports.wbg.__wbg_set_binaryType_9d839cea8fcdc5c3 = function(arg0, arg1) {
1547
+ arg0.binaryType = __wbindgen_enum_BinaryType[arg1];
1548
+ };
1549
+ imports.wbg.__wbg_set_onclose_c09e4f7422de8dae = function(arg0, arg1) {
1550
+ arg0.onclose = arg1;
1551
+ };
1552
+ imports.wbg.__wbg_set_onerror_337a3a2db9517378 = function(arg0, arg1) {
1553
+ arg0.onerror = arg1;
1554
+ };
1555
+ imports.wbg.__wbg_set_onmessage_8661558551a89792 = function(arg0, arg1) {
1556
+ arg0.onmessage = arg1;
1557
+ };
1558
+ imports.wbg.__wbg_set_onmessage_86d8d65dbed3a751 = function(arg0, arg1) {
1559
+ arg0.onmessage = arg1;
1560
+ };
1561
+ imports.wbg.__wbg_set_onmessage_ac099d3d55b27116 = function(arg0, arg1) {
1562
+ arg0.onmessage = arg1;
1563
+ };
1564
+ imports.wbg.__wbg_set_onopen_efccb9305427b907 = function(arg0, arg1) {
1565
+ arg0.onopen = arg1;
1566
+ };
1567
+ imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
1568
+ const ret = arg1.stack;
1569
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1570
+ const len1 = WASM_VECTOR_LEN;
1571
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1572
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1573
+ };
1574
+ imports.wbg.__wbg_start_90678d64025085fc = function(arg0) {
1575
+ arg0.start();
1576
+ };
1577
+ imports.wbg.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
1578
+ const ret = typeof global === 'undefined' ? null : global;
1579
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1580
+ };
1581
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac = function() {
1582
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
1583
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1584
+ };
1585
+ imports.wbg.__wbg_static_accessor_SELF_6fdf4b64710cc91b = function() {
1586
+ const ret = typeof self === 'undefined' ? null : self;
1587
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1588
+ };
1589
+ imports.wbg.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2 = function() {
1590
+ const ret = typeof window === 'undefined' ? null : window;
1591
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
1592
+ };
1593
+ imports.wbg.__wbg_then_4f46f6544e6b4a28 = function(arg0, arg1) {
1594
+ const ret = arg0.then(arg1);
1595
+ return ret;
1596
+ };
1597
+ imports.wbg.__wbg_then_70d05cf780a18d77 = function(arg0, arg1, arg2) {
1598
+ const ret = arg0.then(arg1, arg2);
1599
+ return ret;
1600
+ };
1601
+ imports.wbg.__wbg_warn_1d74dddbe2fd1dbb = function(arg0) {
1602
+ console.warn(arg0);
1603
+ };
1604
+ imports.wbg.__wbindgen_cast_185aa6d69e66b753 = function(arg0, arg1) {
1605
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 223, function: Function { arguments: [], shim_idx: 224, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1606
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__he3a6d52737a61d69, wasm_bindgen__convert__closures_____invoke__h4c33ce4d986075ed);
1607
+ return ret;
1608
+ };
1609
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
1610
+ // Cast intrinsic for `Ref(String) -> Externref`.
1611
+ const ret = getStringFromWasm0(arg0, arg1);
1612
+ return ret;
1613
+ };
1614
+ imports.wbg.__wbindgen_cast_841ad4dc62ebec90 = function(arg0, arg1) {
1615
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 2, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 3, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1616
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h07c691622f9242a9, wasm_bindgen__convert__closures_____invoke__h2d3fbbff27fe5544);
1617
+ return ret;
1618
+ };
1619
+ imports.wbg.__wbindgen_cast_9a4d11962b71bb1d = function(arg0, arg1) {
1620
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 2, function: Function { arguments: [NamedExternref("ErrorEvent")], shim_idx: 3, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1621
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h07c691622f9242a9, wasm_bindgen__convert__closures_____invoke__h2d3fbbff27fe5544);
1622
+ return ret;
1623
+ };
1624
+ imports.wbg.__wbindgen_cast_9f5e1abc47e97f45 = function(arg0, arg1) {
1625
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 234, function: Function { arguments: [Externref], shim_idx: 235, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1626
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h2a5cb8478cd1adb0, wasm_bindgen__convert__closures_____invoke__hacd56641ea4358f0);
1627
+ return ret;
1628
+ };
1629
+ imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
1630
+ // Cast intrinsic for `F64 -> Externref`.
1631
+ const ret = arg0;
1632
+ return ret;
1633
+ };
1634
+ imports.wbg.__wbindgen_cast_eee2c0f90882ae61 = function(arg0, arg1) {
1635
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 2, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 3, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
1636
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h07c691622f9242a9, wasm_bindgen__convert__closures_____invoke__h2d3fbbff27fe5544);
1637
+ return ret;
1638
+ };
1639
+ imports.wbg.__wbindgen_init_externref_table = function() {
1640
+ const table = wasm.__wbindgen_externrefs;
1641
+ const offset = table.grow(4);
1642
+ table.set(0, undefined);
1643
+ table.set(offset + 0, undefined);
1644
+ table.set(offset + 1, null);
1645
+ table.set(offset + 2, true);
1646
+ table.set(offset + 3, false);
1647
+ ;
1648
+ };
1649
+
1650
+ return imports;
1651
+ }
1652
+
1653
+ function __wbg_finalize_init(instance, module) {
1654
+ wasm = instance.exports;
1655
+ __wbg_init.__wbindgen_wasm_module = module;
1656
+ cachedDataViewMemory0 = null;
1657
+ cachedUint8ArrayMemory0 = null;
1658
+
1659
+
1660
+ wasm.__wbindgen_start();
1661
+ return wasm;
1662
+ }
1663
+
1664
+ function initSync(module) {
1665
+ if (wasm !== undefined) return wasm;
1666
+
1667
+
1668
+ if (typeof module !== 'undefined') {
1669
+ if (Object.getPrototypeOf(module) === Object.prototype) {
1670
+ ({module} = module)
1671
+ } else {
1672
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
1673
+ }
1674
+ }
1675
+
1676
+ const imports = __wbg_get_imports();
1677
+
1678
+ if (!(module instanceof WebAssembly.Module)) {
1679
+ module = new WebAssembly.Module(module);
1680
+ }
1681
+
1682
+ const instance = new WebAssembly.Instance(module, imports);
1683
+
1684
+ return __wbg_finalize_init(instance, module);
1685
+ }
1686
+
1687
+ async function __wbg_init(module_or_path) {
1688
+ if (wasm !== undefined) return wasm;
1689
+
1690
+
1691
+ if (typeof module_or_path !== 'undefined') {
1692
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
1693
+ ({module_or_path} = module_or_path)
1694
+ } else {
1695
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
1696
+ }
1697
+ }
1698
+
1699
+ if (typeof module_or_path === 'undefined') {
1700
+ module_or_path = new URL('mqtt5_wasm_bg.wasm', import.meta.url);
1701
+ }
1702
+ const imports = __wbg_get_imports();
1703
+
1704
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
1705
+ module_or_path = fetch(module_or_path);
1706
+ }
1707
+
1708
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
1709
+
1710
+ return __wbg_finalize_init(instance, module);
1711
+ }
1712
+
1713
+ export { initSync };
1714
+ export default __wbg_init;