hakuban 0.8.4 → 0.8.5

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/hakuban.js CHANGED
@@ -1,218 +1,274 @@
1
- let wasm;
1
+ /* @ts-self-types="./hakuban.d.ts" */
2
2
 
3
- function addToExternrefTable0(obj) {
4
- const idx = wasm.__externref_table_alloc();
5
- wasm.__wbindgen_export_2.set(idx, obj);
6
- return idx;
7
- }
8
-
9
- function handleError(f, args) {
10
- try {
11
- return f.apply(this, args);
12
- } catch (e) {
13
- const idx = addToExternrefTable0(e);
14
- wasm.__wbindgen_exn_store(idx);
3
+ class WasmResult {
4
+ static __wrap(ptr) {
5
+ ptr = ptr >>> 0;
6
+ const obj = Object.create(WasmResult.prototype);
7
+ obj.__wbg_ptr = ptr;
8
+ WasmResultFinalization.register(obj, obj.__wbg_ptr, obj);
9
+ return obj;
15
10
  }
16
- }
17
-
18
- let cachedUint8ArrayMemory0 = null;
19
-
20
- function getUint8ArrayMemory0() {
21
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
22
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
11
+ __destroy_into_raw() {
12
+ const ptr = this.__wbg_ptr;
13
+ this.__wbg_ptr = 0;
14
+ WasmResultFinalization.unregister(this);
15
+ return ptr;
16
+ }
17
+ free() {
18
+ const ptr = this.__destroy_into_raw();
19
+ wasm.__wbg_wasmresult_free(ptr, 0);
20
+ }
21
+ /**
22
+ * @returns {string | undefined}
23
+ */
24
+ get error_message() {
25
+ const ret = wasm.__wbg_get_wasmresult_error_message(this.__wbg_ptr);
26
+ let v1;
27
+ if (ret[0] !== 0) {
28
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
29
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
30
+ }
31
+ return v1;
32
+ }
33
+ /**
34
+ * @returns {number | undefined}
35
+ */
36
+ get pointer() {
37
+ const ret = wasm.__wbg_get_wasmresult_pointer(this.__wbg_ptr);
38
+ return ret === 0x100000001 ? undefined : ret;
39
+ }
40
+ /**
41
+ * @returns {WasmResultStatus}
42
+ */
43
+ get status() {
44
+ const ret = wasm.__wbg_get_wasmresult_status(this.__wbg_ptr);
45
+ return ret;
46
+ }
47
+ /**
48
+ * @param {string | null} [arg0]
49
+ */
50
+ set error_message(arg0) {
51
+ var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
52
+ var len0 = WASM_VECTOR_LEN;
53
+ wasm.__wbg_set_wasmresult_error_message(this.__wbg_ptr, ptr0, len0);
54
+ }
55
+ /**
56
+ * @param {number | null} [arg0]
57
+ */
58
+ set pointer(arg0) {
59
+ wasm.__wbg_set_wasmresult_pointer(this.__wbg_ptr, isLikeNone(arg0) ? 0x100000001 : (arg0) >>> 0);
60
+ }
61
+ /**
62
+ * @param {WasmResultStatus} arg0
63
+ */
64
+ set status(arg0) {
65
+ wasm.__wbg_set_wasmresult_status(this.__wbg_ptr, arg0);
23
66
  }
24
- return cachedUint8ArrayMemory0;
25
67
  }
68
+ if (Symbol.dispose) WasmResult.prototype[Symbol.dispose] = WasmResult.prototype.free;
26
69
 
27
- let cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
70
+ /**
71
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}
72
+ */
73
+ Object.freeze({
74
+ Ok: 0, "0": "Ok",
75
+ Pointer: 1, "1": "Pointer",
76
+ Pending: 2, "2": "Pending",
77
+ EndOfStream: 3, "3": "EndOfStream",
78
+ InvalidString: 4, "4": "InvalidString",
79
+ InvalidJSON: 5, "5": "InvalidJSON",
80
+ InvalidURL: 6, "6": "InvalidURL",
81
+ InvalidLogLevel: 7, "7": "InvalidLogLevel",
82
+ LoggerInitializationError: 8, "8": "LoggerInitializationError",
83
+ ConnectionTerminated: 9, "9": "ConnectionTerminated",
84
+ });
28
85
 
29
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }
30
- const MAX_SAFARI_DECODE_BYTES = 2146435072;
31
- let numBytesDecoded = 0;
32
- function decodeText(ptr, len) {
33
- numBytesDecoded += len;
34
- if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
35
- cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
36
- cachedTextDecoder.decode();
37
- numBytesDecoded = len;
38
- }
39
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
86
+ /**
87
+ * @param {number} exchange
88
+ */
89
+ function hakuban_exchange_drop(exchange) {
90
+ wasm.hakuban_exchange_drop(exchange);
40
91
  }
41
92
 
42
- function getStringFromWasm0(ptr, len) {
43
- ptr = ptr >>> 0;
44
- return decodeText(ptr, len);
93
+ /**
94
+ * @returns {WasmResult}
95
+ */
96
+ function hakuban_exchange_new() {
97
+ const ret = wasm.hakuban_exchange_new();
98
+ return WasmResult.__wrap(ret);
45
99
  }
46
100
 
47
- let WASM_VECTOR_LEN = 0;
48
-
49
- const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
50
-
51
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
52
- ? function (arg, view) {
53
- return cachedTextEncoder.encodeInto(arg, view);
101
+ /**
102
+ * @param {number} exchange
103
+ * @returns {BigUint64Array}
104
+ */
105
+ function hakuban_exchange_notified(exchange) {
106
+ const ret = wasm.hakuban_exchange_notified(exchange);
107
+ var v1 = getArrayU64FromWasm0(ret[0], ret[1]).slice();
108
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
109
+ return v1;
54
110
  }
55
- : function (arg, view) {
56
- const buf = cachedTextEncoder.encode(arg);
57
- view.set(buf);
58
- return {
59
- read: arg.length,
60
- written: buf.length
61
- };
62
- });
63
-
64
- function passStringToWasm0(arg, malloc, realloc) {
65
-
66
- if (realloc === undefined) {
67
- const buf = cachedTextEncoder.encode(arg);
68
- const ptr = malloc(buf.length, 1) >>> 0;
69
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
70
- WASM_VECTOR_LEN = buf.length;
71
- return ptr;
72
- }
73
-
74
- let len = arg.length;
75
- let ptr = malloc(len, 1) >>> 0;
76
-
77
- const mem = getUint8ArrayMemory0();
78
-
79
- let offset = 0;
80
-
81
- for (; offset < len; offset++) {
82
- const code = arg.charCodeAt(offset);
83
- if (code > 0x7F) break;
84
- mem[ptr + offset] = code;
85
- }
86
-
87
- if (offset !== len) {
88
- if (offset !== 0) {
89
- arg = arg.slice(offset);
90
- }
91
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
92
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
93
- const ret = encodeString(arg, view);
94
-
95
- offset += ret.written;
96
- ptr = realloc(ptr, len, offset, 1) >>> 0;
97
- }
98
111
 
99
- WASM_VECTOR_LEN = offset;
100
- return ptr;
112
+ /**
113
+ * @param {number} future
114
+ */
115
+ function hakuban_future_drop(future) {
116
+ wasm.hakuban_future_drop(future);
101
117
  }
102
118
 
103
- let cachedDataViewMemory0 = null;
104
-
105
- function getDataViewMemory0() {
106
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
107
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
108
- }
109
- return cachedDataViewMemory0;
119
+ /**
120
+ * @param {number} exchange_pointer
121
+ * @param {number} future_pointer
122
+ * @param {bigint} waker_id
123
+ * @returns {WasmResult}
124
+ */
125
+ function hakuban_future_poll(exchange_pointer, future_pointer, waker_id) {
126
+ const ret = wasm.hakuban_future_poll(exchange_pointer, future_pointer, waker_id);
127
+ return WasmResult.__wrap(ret);
110
128
  }
111
129
 
112
- function isLikeNone(x) {
113
- return x === undefined || x === null;
130
+ /**
131
+ * @param {string} default_log_level
132
+ * @returns {WasmResult}
133
+ */
134
+ function hakuban_logger_initialize(default_log_level) {
135
+ const ptr0 = passStringToWasm0(default_log_level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
136
+ const len0 = WASM_VECTOR_LEN;
137
+ const ret = wasm.hakuban_logger_initialize(ptr0, len0);
138
+ return WasmResult.__wrap(ret);
114
139
  }
115
140
 
116
- let cachedBigUint64ArrayMemory0 = null;
117
-
118
- function getBigUint64ArrayMemory0() {
119
- if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
120
- cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
121
- }
122
- return cachedBigUint64ArrayMemory0;
141
+ /**
142
+ * @param {number} message_pointer
143
+ * @returns {Uint8Array}
144
+ */
145
+ function hakuban_message_serialize(message_pointer) {
146
+ const ret = wasm.hakuban_message_serialize(message_pointer);
147
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
148
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
149
+ return v1;
123
150
  }
124
151
 
125
- function passArray64ToWasm0(arg, malloc) {
126
- const ptr = malloc(arg.length * 8, 8) >>> 0;
127
- getBigUint64ArrayMemory0().set(arg, ptr / 8);
128
- WASM_VECTOR_LEN = arg.length;
129
- return ptr;
152
+ /**
153
+ * @param {number} descriptor_pointer
154
+ */
155
+ function hakuban_object_descriptor_drop(descriptor_pointer) {
156
+ wasm.hakuban_object_descriptor_drop(descriptor_pointer);
130
157
  }
131
158
 
132
- function passArrayJsValueToWasm0(array, malloc) {
133
- const ptr = malloc(array.length * 4, 4) >>> 0;
134
- for (let i = 0; i < array.length; i++) {
135
- const add = addToExternrefTable0(array[i]);
136
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
159
+ /**
160
+ * @param {number} descriptor_pointer
161
+ * @returns {string}
162
+ */
163
+ function hakuban_object_descriptor_json(descriptor_pointer) {
164
+ let deferred1_0;
165
+ let deferred1_1;
166
+ try {
167
+ const ret = wasm.hakuban_object_descriptor_json(descriptor_pointer);
168
+ deferred1_0 = ret[0];
169
+ deferred1_1 = ret[1];
170
+ return getStringFromWasm0(ret[0], ret[1]);
171
+ } finally {
172
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
137
173
  }
138
- WASM_VECTOR_LEN = array.length;
139
- return ptr;
140
174
  }
141
175
 
142
- function passArray8ToWasm0(arg, malloc) {
143
- const ptr = malloc(arg.length * 1, 1) >>> 0;
144
- getUint8ArrayMemory0().set(arg, ptr / 1);
145
- WASM_VECTOR_LEN = arg.length;
146
- return ptr;
147
- }
148
176
  /**
149
- * @param {BigInt64Array} version
150
- * @param {any[]} format_jsvalues
151
- * @param {Uint8Array} data
152
- * @param {bigint} synchronized_us_ago
177
+ * @param {string} json_string
178
+ * @param {Uint32Array} tag_pointers
153
179
  * @returns {WasmResult}
154
180
  */
155
- function hakuban_object_state_new(version, format_jsvalues, data, synchronized_us_ago) {
156
- const ptr0 = passArray64ToWasm0(version, wasm.__wbindgen_malloc);
181
+ function hakuban_object_descriptor_new(json_string, tag_pointers) {
182
+ const ptr0 = passStringToWasm0(json_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
157
183
  const len0 = WASM_VECTOR_LEN;
158
- const ptr1 = passArrayJsValueToWasm0(format_jsvalues, wasm.__wbindgen_malloc);
184
+ const ptr1 = passArray32ToWasm0(tag_pointers, wasm.__wbindgen_malloc);
159
185
  const len1 = WASM_VECTOR_LEN;
160
- const ptr2 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
161
- const len2 = WASM_VECTOR_LEN;
162
- const ret = wasm.hakuban_object_state_new(ptr0, len0, ptr1, len1, ptr2, len2, synchronized_us_ago);
186
+ const ret = wasm.hakuban_object_descriptor_new(ptr0, len0, ptr1, len1);
163
187
  return WasmResult.__wrap(ret);
164
188
  }
165
189
 
166
190
  /**
167
- * @param {number} object_state_pointer
191
+ * @param {number} descriptor_pointer
192
+ * @returns {Uint32Array}
168
193
  */
169
- function hakuban_object_state_drop(object_state_pointer) {
170
- wasm.hakuban_object_state_drop(object_state_pointer);
194
+ function hakuban_object_descriptor_tags(descriptor_pointer) {
195
+ const ret = wasm.hakuban_object_descriptor_tags(descriptor_pointer);
196
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
197
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
198
+ return v1;
171
199
  }
172
200
 
173
- let cachedBigInt64ArrayMemory0 = null;
201
+ /**
202
+ * @param {number} object_ptr
203
+ */
204
+ function hakuban_object_expose_contract_drop(object_ptr) {
205
+ wasm.hakuban_object_expose_contract_drop(object_ptr);
206
+ }
174
207
 
175
- function getBigInt64ArrayMemory0() {
176
- if (cachedBigInt64ArrayMemory0 === null || cachedBigInt64ArrayMemory0.byteLength === 0) {
177
- cachedBigInt64ArrayMemory0 = new BigInt64Array(wasm.memory.buffer);
178
- }
179
- return cachedBigInt64ArrayMemory0;
208
+ /**
209
+ * @param {number} exchange
210
+ * @param {number} descriptor
211
+ * @param {number} capacity
212
+ * @returns {number}
213
+ */
214
+ function hakuban_object_expose_contract_new(exchange, descriptor, capacity) {
215
+ const ret = wasm.hakuban_object_expose_contract_new(exchange, descriptor, capacity);
216
+ return ret >>> 0;
180
217
  }
181
218
 
182
- function getArrayI64FromWasm0(ptr, len) {
183
- ptr = ptr >>> 0;
184
- return getBigInt64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
219
+ /**
220
+ * @param {number} object_expose_pointer
221
+ * @returns {number}
222
+ */
223
+ function hakuban_object_expose_contract_next(object_expose_pointer) {
224
+ const ret = wasm.hakuban_object_expose_contract_next(object_expose_pointer);
225
+ return ret >>> 0;
185
226
  }
227
+
228
+ /**
229
+ * @param {number} object_ptr
230
+ */
231
+ function hakuban_object_observe_contract_drop(object_ptr) {
232
+ wasm.hakuban_object_observe_contract_drop(object_ptr);
233
+ }
234
+
235
+ /**
236
+ * @param {number} exchange
237
+ * @param {number} descriptor
238
+ * @returns {number}
239
+ */
240
+ function hakuban_object_observe_contract_new(exchange, descriptor) {
241
+ const ret = wasm.hakuban_object_observe_contract_new(exchange, descriptor);
242
+ return ret >>> 0;
243
+ }
244
+
245
+ /**
246
+ * @param {number} object_observe_pointer
247
+ * @returns {number}
248
+ */
249
+ function hakuban_object_observe_contract_next(object_observe_pointer) {
250
+ const ret = wasm.hakuban_object_observe_contract_next(object_observe_pointer);
251
+ return ret >>> 0;
252
+ }
253
+
186
254
  /**
187
255
  * @param {number} object_state_pointer
188
- * @returns {BigInt64Array}
256
+ * @returns {Uint8Array}
189
257
  */
190
- function hakuban_object_state_version(object_state_pointer) {
191
- const ret = wasm.hakuban_object_state_version(object_state_pointer);
192
- var v1 = getArrayI64FromWasm0(ret[0], ret[1]).slice();
193
- wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
258
+ function hakuban_object_state_data(object_state_pointer) {
259
+ const ret = wasm.hakuban_object_state_data(object_state_pointer);
260
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
261
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
194
262
  return v1;
195
263
  }
196
264
 
197
265
  /**
198
266
  * @param {number} object_state_pointer
199
- * @returns {bigint}
200
267
  */
201
- function hakuban_object_state_synchronized_ago(object_state_pointer) {
202
- const ret = wasm.hakuban_object_state_synchronized_ago(object_state_pointer);
203
- return BigInt.asUintN(64, ret);
268
+ function hakuban_object_state_drop(object_state_pointer) {
269
+ wasm.hakuban_object_state_drop(object_state_pointer);
204
270
  }
205
271
 
206
- function getArrayJsValueFromWasm0(ptr, len) {
207
- ptr = ptr >>> 0;
208
- const mem = getDataViewMemory0();
209
- const result = [];
210
- for (let i = ptr; i < ptr + 4 * len; i += 4) {
211
- result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
212
- }
213
- wasm.__externref_drop_slice(ptr, len);
214
- return result;
215
- }
216
272
  /**
217
273
  * @param {number} object_state_pointer
218
274
  * @returns {any[]}
@@ -224,19 +280,22 @@ function hakuban_object_state_format(object_state_pointer) {
224
280
  return v1;
225
281
  }
226
282
 
227
- function getArrayU8FromWasm0(ptr, len) {
228
- ptr = ptr >>> 0;
229
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
230
- }
231
283
  /**
232
- * @param {number} object_state_pointer
233
- * @returns {Uint8Array}
284
+ * @param {BigInt64Array} version
285
+ * @param {any[]} format_jsvalues
286
+ * @param {Uint8Array} data
287
+ * @param {bigint} synchronized_us_ago
288
+ * @returns {WasmResult}
234
289
  */
235
- function hakuban_object_state_data(object_state_pointer) {
236
- const ret = wasm.hakuban_object_state_data(object_state_pointer);
237
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
238
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
239
- return v1;
290
+ function hakuban_object_state_new(version, format_jsvalues, data, synchronized_us_ago) {
291
+ const ptr0 = passArray64ToWasm0(version, wasm.__wbindgen_malloc);
292
+ const len0 = WASM_VECTOR_LEN;
293
+ const ptr1 = passArrayJsValueToWasm0(format_jsvalues, wasm.__wbindgen_malloc);
294
+ const len1 = WASM_VECTOR_LEN;
295
+ const ptr2 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
296
+ const len2 = WASM_VECTOR_LEN;
297
+ const ret = wasm.hakuban_object_state_new(ptr0, len0, ptr1, len1, ptr2, len2, synchronized_us_ago);
298
+ return WasmResult.__wrap(ret);
240
299
  }
241
300
 
242
301
  /**
@@ -264,16 +323,6 @@ function hakuban_object_state_sink_next(object_state_sink_pointer) {
264
323
  return ret >>> 0;
265
324
  }
266
325
 
267
- /**
268
- * @param {number} object_state_sink_pointer
269
- * @param {number} object_state_pointer
270
- * @returns {number}
271
- */
272
- function hakuban_object_state_sink_push(object_state_sink_pointer, object_state_pointer) {
273
- const ret = wasm.hakuban_object_state_sink_push(object_state_sink_pointer, object_state_pointer);
274
- return ret >>> 0;
275
- }
276
-
277
326
  /**
278
327
  * @param {number} object_state_sink_params_pointer
279
328
  */
@@ -282,140 +331,138 @@ function hakuban_object_state_sink_params_drop(object_state_sink_params_pointer)
282
331
  }
283
332
 
284
333
  /**
285
- * @param {number} exchange
286
- * @param {number} descriptor
287
- * @param {number} capacity
334
+ * @param {number} object_state_sink_pointer
335
+ * @param {number} object_state_pointer
288
336
  * @returns {number}
289
337
  */
290
- function hakuban_tag_expose_contract_new(exchange, descriptor, capacity) {
291
- const ret = wasm.hakuban_tag_expose_contract_new(exchange, descriptor, capacity);
338
+ function hakuban_object_state_sink_push(object_state_sink_pointer, object_state_pointer) {
339
+ const ret = wasm.hakuban_object_state_sink_push(object_state_sink_pointer, object_state_pointer);
292
340
  return ret >>> 0;
293
341
  }
294
342
 
295
343
  /**
296
- * @param {number} tag_expose_contract_pointer
344
+ * @param {number} object_state_stream_pointer
345
+ * @returns {number}
297
346
  */
298
- function hakuban_tag_expose_contract_drop(tag_expose_contract_pointer) {
299
- wasm.hakuban_tag_expose_contract_drop(tag_expose_contract_pointer);
347
+ function hakuban_object_state_stream_descriptor(object_state_stream_pointer) {
348
+ const ret = wasm.hakuban_object_state_stream_descriptor(object_state_stream_pointer);
349
+ return ret >>> 0;
300
350
  }
301
351
 
302
352
  /**
303
- * @param {number} tag_expose_pointer
304
- * @returns {number}
305
- */
306
- function hakuban_tag_expose_contract_next(tag_expose_pointer) {
307
- const ret = wasm.hakuban_tag_expose_contract_next(tag_expose_pointer);
308
- return ret >>> 0;
353
+ * @param {number} object_state_stream_pointer
354
+ */
355
+ function hakuban_object_state_stream_drop(object_state_stream_pointer) {
356
+ wasm.hakuban_object_state_stream_drop(object_state_stream_pointer);
309
357
  }
310
358
 
311
359
  /**
312
- * @returns {WasmResult}
360
+ * @param {number} object_state_stream_pointer
361
+ * @returns {number}
313
362
  */
314
- function hakuban_exchange_new() {
315
- const ret = wasm.hakuban_exchange_new();
316
- return WasmResult.__wrap(ret);
363
+ function hakuban_object_state_stream_next(object_state_stream_pointer) {
364
+ const ret = wasm.hakuban_object_state_stream_next(object_state_stream_pointer);
365
+ return ret >>> 0;
317
366
  }
318
367
 
319
368
  /**
320
- * @param {number} exchange
369
+ * @param {number} object_state_pointer
370
+ * @returns {bigint}
321
371
  */
322
- function hakuban_exchange_drop(exchange) {
323
- wasm.hakuban_exchange_drop(exchange);
372
+ function hakuban_object_state_synchronized_ago(object_state_pointer) {
373
+ const ret = wasm.hakuban_object_state_synchronized_ago(object_state_pointer);
374
+ return BigInt.asUintN(64, ret);
324
375
  }
325
376
 
326
- function getArrayU64FromWasm0(ptr, len) {
327
- ptr = ptr >>> 0;
328
- return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
329
- }
330
377
  /**
331
- * @param {number} exchange
332
- * @returns {BigUint64Array}
378
+ * @param {number} object_state_pointer
379
+ * @returns {BigInt64Array}
333
380
  */
334
- function hakuban_exchange_notified(exchange) {
335
- const ret = wasm.hakuban_exchange_notified(exchange);
336
- var v1 = getArrayU64FromWasm0(ret[0], ret[1]).slice();
381
+ function hakuban_object_state_version(object_state_pointer) {
382
+ const ret = wasm.hakuban_object_state_version(object_state_pointer);
383
+ var v1 = getArrayI64FromWasm0(ret[0], ret[1]).slice();
337
384
  wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
338
385
  return v1;
339
386
  }
340
387
 
341
388
  /**
342
- * @param {number} exchange
343
- * @param {number} descriptor
344
- * @param {number} capacity
345
- * @returns {number}
389
+ * @param {number} descriptor_pointer
346
390
  */
347
- function hakuban_object_expose_contract_new(exchange, descriptor, capacity) {
348
- const ret = wasm.hakuban_object_expose_contract_new(exchange, descriptor, capacity);
349
- return ret >>> 0;
391
+ function hakuban_tag_descriptor_drop(descriptor_pointer) {
392
+ wasm.hakuban_tag_descriptor_drop(descriptor_pointer);
350
393
  }
351
394
 
352
395
  /**
353
- * @param {number} object_ptr
396
+ * @param {string} json_string
397
+ * @returns {WasmResult}
354
398
  */
355
- function hakuban_object_expose_contract_drop(object_ptr) {
356
- wasm.hakuban_object_expose_contract_drop(object_ptr);
399
+ function hakuban_tag_descriptor_new(json_string) {
400
+ const ptr0 = passStringToWasm0(json_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
401
+ const len0 = WASM_VECTOR_LEN;
402
+ const ret = wasm.hakuban_tag_descriptor_new(ptr0, len0);
403
+ return WasmResult.__wrap(ret);
357
404
  }
358
405
 
359
406
  /**
360
- * @param {number} object_expose_pointer
361
- * @returns {number}
407
+ * @param {number} tag_expose_contract_pointer
362
408
  */
363
- function hakuban_object_expose_contract_next(object_expose_pointer) {
364
- const ret = wasm.hakuban_object_expose_contract_next(object_expose_pointer);
365
- return ret >>> 0;
409
+ function hakuban_tag_expose_contract_drop(tag_expose_contract_pointer) {
410
+ wasm.hakuban_tag_expose_contract_drop(tag_expose_contract_pointer);
366
411
  }
367
412
 
368
413
  /**
369
414
  * @param {number} exchange
370
415
  * @param {number} descriptor
416
+ * @param {number} capacity
371
417
  * @returns {number}
372
418
  */
373
- function hakuban_object_observe_contract_new(exchange, descriptor) {
374
- const ret = wasm.hakuban_object_observe_contract_new(exchange, descriptor);
419
+ function hakuban_tag_expose_contract_new(exchange, descriptor, capacity) {
420
+ const ret = wasm.hakuban_tag_expose_contract_new(exchange, descriptor, capacity);
375
421
  return ret >>> 0;
376
422
  }
377
423
 
378
424
  /**
379
- * @param {number} object_ptr
380
- */
381
- function hakuban_object_observe_contract_drop(object_ptr) {
382
- wasm.hakuban_object_observe_contract_drop(object_ptr);
383
- }
384
-
385
- /**
386
- * @param {number} object_observe_pointer
425
+ * @param {number} tag_expose_pointer
387
426
  * @returns {number}
388
427
  */
389
- function hakuban_object_observe_contract_next(object_observe_pointer) {
390
- const ret = wasm.hakuban_object_observe_contract_next(object_observe_pointer);
428
+ function hakuban_tag_expose_contract_next(tag_expose_pointer) {
429
+ const ret = wasm.hakuban_tag_expose_contract_next(tag_expose_pointer);
391
430
  return ret >>> 0;
392
431
  }
393
432
 
394
433
  /**
395
- * @param {number} object_state_stream_pointer
434
+ * @param {number} tag_pointer
396
435
  */
397
- function hakuban_object_state_stream_drop(object_state_stream_pointer) {
398
- wasm.hakuban_object_state_stream_drop(object_state_stream_pointer);
436
+ function hakuban_tag_observe_contract_drop(tag_pointer) {
437
+ wasm.hakuban_tag_observe_contract_drop(tag_pointer);
399
438
  }
400
439
 
401
440
  /**
402
- * @param {number} object_state_stream_pointer
441
+ * @param {number} exchange
442
+ * @param {number} descriptor
403
443
  * @returns {number}
404
444
  */
405
- function hakuban_object_state_stream_next(object_state_stream_pointer) {
406
- const ret = wasm.hakuban_object_state_stream_next(object_state_stream_pointer);
445
+ function hakuban_tag_observe_contract_new(exchange, descriptor) {
446
+ const ret = wasm.hakuban_tag_observe_contract_new(exchange, descriptor);
407
447
  return ret >>> 0;
408
448
  }
409
449
 
410
450
  /**
411
- * @param {number} object_state_stream_pointer
451
+ * @param {number} tag_observe_pointer
412
452
  * @returns {number}
413
453
  */
414
- function hakuban_object_state_stream_descriptor(object_state_stream_pointer) {
415
- const ret = wasm.hakuban_object_state_stream_descriptor(object_state_stream_pointer);
454
+ function hakuban_tag_observe_contract_next(tag_observe_pointer) {
455
+ const ret = wasm.hakuban_tag_observe_contract_next(tag_observe_pointer);
416
456
  return ret >>> 0;
417
457
  }
418
458
 
459
+ /**
460
+ * @param {number} wasm_upstream_connection
461
+ */
462
+ function hakuban_upstream_connection_drop(wasm_upstream_connection) {
463
+ wasm.hakuban_upstream_connection_drop(wasm_upstream_connection);
464
+ }
465
+
419
466
  /**
420
467
  * @param {number} exchange_pointer
421
468
  * @param {string} local_name
@@ -431,13 +478,6 @@ function hakuban_upstream_connection_new(exchange_pointer, local_name, local_add
431
478
  return ret >>> 0;
432
479
  }
433
480
 
434
- /**
435
- * @param {number} wasm_upstream_connection
436
- */
437
- function hakuban_upstream_connection_drop(wasm_upstream_connection) {
438
- wasm.hakuban_upstream_connection_drop(wasm_upstream_connection);
439
- }
440
-
441
481
  /**
442
482
  * @param {number} wasm_upstream_connection
443
483
  * @returns {number}
@@ -447,17 +487,6 @@ function hakuban_upstream_connection_next_message_to_network(wasm_upstream_conne
447
487
  return ret >>> 0;
448
488
  }
449
489
 
450
- /**
451
- * @param {number} message_pointer
452
- * @returns {Uint8Array}
453
- */
454
- function hakuban_message_serialize(message_pointer) {
455
- const ret = wasm.hakuban_message_serialize(message_pointer);
456
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
457
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
458
- return v1;
459
- }
460
-
461
490
  /**
462
491
  * @param {number} wasm_upstream_connection
463
492
  * @param {Uint8Array} message_data
@@ -469,395 +498,345 @@ function hakuban_upstream_connection_send_message_from_network(wasm_upstream_con
469
498
  const ret = wasm.hakuban_upstream_connection_send_message_from_network(wasm_upstream_connection, ptr0, len0);
470
499
  return ret >>> 0;
471
500
  }
472
-
473
- /**
474
- * @param {number} exchange_pointer
475
- * @param {number} future_pointer
476
- * @param {bigint} waker_id
477
- * @returns {WasmResult}
478
- */
479
- function hakuban_future_poll(exchange_pointer, future_pointer, waker_id) {
480
- const ret = wasm.hakuban_future_poll(exchange_pointer, future_pointer, waker_id);
481
- return WasmResult.__wrap(ret);
501
+ function __wbg_get_imports() {
502
+ const import0 = {
503
+ __proto__: null,
504
+ __wbg___wbindgen_is_undefined_29a43b4d42920abd: function(arg0) {
505
+ const ret = arg0 === undefined;
506
+ return ret;
507
+ },
508
+ __wbg___wbindgen_string_get_7ed5322991caaec5: function(arg0, arg1) {
509
+ const obj = arg1;
510
+ const ret = typeof(obj) === 'string' ? obj : undefined;
511
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
512
+ var len1 = WASM_VECTOR_LEN;
513
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
514
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
515
+ },
516
+ __wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
517
+ throw new Error(getStringFromWasm0(arg0, arg1));
518
+ },
519
+ __wbg_debug_c014a160490283dc: function(arg0) {
520
+ console.debug(arg0);
521
+ },
522
+ __wbg_error_2001591ad2463697: function(arg0) {
523
+ console.error(arg0);
524
+ },
525
+ __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
526
+ let deferred0_0;
527
+ let deferred0_1;
528
+ try {
529
+ deferred0_0 = arg0;
530
+ deferred0_1 = arg1;
531
+ console.error(getStringFromWasm0(arg0, arg1));
532
+ } finally {
533
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
534
+ }
535
+ },
536
+ __wbg_info_7479429238bffbce: function(arg0) {
537
+ console.info(arg0);
538
+ },
539
+ __wbg_log_7e1aa9064a1dbdbd: function(arg0) {
540
+ console.log(arg0);
541
+ },
542
+ __wbg_new_227d7c05414eb861: function() {
543
+ const ret = new Error();
544
+ return ret;
545
+ },
546
+ __wbg_now_e7c6795a7f81e10f: function(arg0) {
547
+ const ret = arg0.now();
548
+ return ret;
549
+ },
550
+ __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
551
+ const ret = arg0.performance;
552
+ return ret;
553
+ },
554
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
555
+ const ret = arg1.stack;
556
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
557
+ const len1 = WASM_VECTOR_LEN;
558
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
559
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
560
+ },
561
+ __wbg_static_accessor_GLOBAL_8cfadc87a297ca02: function() {
562
+ const ret = typeof global === 'undefined' ? null : global;
563
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
564
+ },
565
+ __wbg_static_accessor_GLOBAL_THIS_602256ae5c8f42cf: function() {
566
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
567
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
568
+ },
569
+ __wbg_static_accessor_SELF_e445c1c7484aecc3: function() {
570
+ const ret = typeof self === 'undefined' ? null : self;
571
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
572
+ },
573
+ __wbg_static_accessor_WINDOW_f20e8576ef1e0f17: function() {
574
+ const ret = typeof window === 'undefined' ? null : window;
575
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
576
+ },
577
+ __wbg_warn_3cc416af27dbdc02: function(arg0) {
578
+ console.warn(arg0);
579
+ },
580
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
581
+ // Cast intrinsic for `Ref(String) -> Externref`.
582
+ const ret = getStringFromWasm0(arg0, arg1);
583
+ return ret;
584
+ },
585
+ __wbindgen_init_externref_table: function() {
586
+ const table = wasm.__wbindgen_externrefs;
587
+ const offset = table.grow(4);
588
+ table.set(0, undefined);
589
+ table.set(offset + 0, undefined);
590
+ table.set(offset + 1, null);
591
+ table.set(offset + 2, true);
592
+ table.set(offset + 3, false);
593
+ },
594
+ };
595
+ return {
596
+ __proto__: null,
597
+ "./hakuban_bg.js": import0,
598
+ };
482
599
  }
483
600
 
484
- /**
485
- * @param {number} future
486
- */
487
- function hakuban_future_drop(future) {
488
- wasm.hakuban_future_drop(future);
489
- }
601
+ const WasmResultFinalization = (typeof FinalizationRegistry === 'undefined')
602
+ ? { register: () => {}, unregister: () => {} }
603
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmresult_free(ptr >>> 0, 1));
490
604
 
491
- /**
492
- * @param {string} json_string
493
- * @returns {WasmResult}
494
- */
495
- function hakuban_tag_descriptor_new(json_string) {
496
- const ptr0 = passStringToWasm0(json_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
497
- const len0 = WASM_VECTOR_LEN;
498
- const ret = wasm.hakuban_tag_descriptor_new(ptr0, len0);
499
- return WasmResult.__wrap(ret);
605
+ function addToExternrefTable0(obj) {
606
+ const idx = wasm.__externref_table_alloc();
607
+ wasm.__wbindgen_externrefs.set(idx, obj);
608
+ return idx;
500
609
  }
501
610
 
502
- /**
503
- * @param {number} descriptor_pointer
504
- */
505
- function hakuban_tag_descriptor_drop(descriptor_pointer) {
506
- wasm.hakuban_tag_descriptor_drop(descriptor_pointer);
611
+ function getArrayI64FromWasm0(ptr, len) {
612
+ ptr = ptr >>> 0;
613
+ return getBigInt64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
507
614
  }
508
615
 
509
- let cachedUint32ArrayMemory0 = null;
510
-
511
- function getUint32ArrayMemory0() {
512
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
513
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
616
+ function getArrayJsValueFromWasm0(ptr, len) {
617
+ ptr = ptr >>> 0;
618
+ const mem = getDataViewMemory0();
619
+ const result = [];
620
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
621
+ result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
514
622
  }
515
- return cachedUint32ArrayMemory0;
623
+ wasm.__externref_drop_slice(ptr, len);
624
+ return result;
516
625
  }
517
626
 
518
- function passArray32ToWasm0(arg, malloc) {
519
- const ptr = malloc(arg.length * 4, 4) >>> 0;
520
- getUint32ArrayMemory0().set(arg, ptr / 4);
521
- WASM_VECTOR_LEN = arg.length;
522
- return ptr;
627
+ function getArrayU32FromWasm0(ptr, len) {
628
+ ptr = ptr >>> 0;
629
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
523
630
  }
524
- /**
525
- * @param {string} json_string
526
- * @param {Uint32Array} tag_pointers
527
- * @returns {WasmResult}
528
- */
529
- function hakuban_object_descriptor_new(json_string, tag_pointers) {
530
- const ptr0 = passStringToWasm0(json_string, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
531
- const len0 = WASM_VECTOR_LEN;
532
- const ptr1 = passArray32ToWasm0(tag_pointers, wasm.__wbindgen_malloc);
533
- const len1 = WASM_VECTOR_LEN;
534
- const ret = wasm.hakuban_object_descriptor_new(ptr0, len0, ptr1, len1);
535
- return WasmResult.__wrap(ret);
631
+
632
+ function getArrayU64FromWasm0(ptr, len) {
633
+ ptr = ptr >>> 0;
634
+ return getBigUint64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
536
635
  }
537
636
 
538
- /**
539
- * @param {number} descriptor_pointer
540
- */
541
- function hakuban_object_descriptor_drop(descriptor_pointer) {
542
- wasm.hakuban_object_descriptor_drop(descriptor_pointer);
637
+ function getArrayU8FromWasm0(ptr, len) {
638
+ ptr = ptr >>> 0;
639
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
543
640
  }
544
641
 
545
- /**
546
- * @param {number} descriptor_pointer
547
- * @returns {string}
548
- */
549
- function hakuban_object_descriptor_json(descriptor_pointer) {
550
- let deferred1_0;
551
- let deferred1_1;
552
- try {
553
- const ret = wasm.hakuban_object_descriptor_json(descriptor_pointer);
554
- deferred1_0 = ret[0];
555
- deferred1_1 = ret[1];
556
- return getStringFromWasm0(ret[0], ret[1]);
557
- } finally {
558
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
642
+ let cachedBigInt64ArrayMemory0 = null;
643
+ function getBigInt64ArrayMemory0() {
644
+ if (cachedBigInt64ArrayMemory0 === null || cachedBigInt64ArrayMemory0.byteLength === 0) {
645
+ cachedBigInt64ArrayMemory0 = new BigInt64Array(wasm.memory.buffer);
559
646
  }
647
+ return cachedBigInt64ArrayMemory0;
560
648
  }
561
649
 
562
- function getArrayU32FromWasm0(ptr, len) {
563
- ptr = ptr >>> 0;
564
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
650
+ let cachedBigUint64ArrayMemory0 = null;
651
+ function getBigUint64ArrayMemory0() {
652
+ if (cachedBigUint64ArrayMemory0 === null || cachedBigUint64ArrayMemory0.byteLength === 0) {
653
+ cachedBigUint64ArrayMemory0 = new BigUint64Array(wasm.memory.buffer);
654
+ }
655
+ return cachedBigUint64ArrayMemory0;
565
656
  }
566
- /**
567
- * @param {number} descriptor_pointer
568
- * @returns {Uint32Array}
569
- */
570
- function hakuban_object_descriptor_tags(descriptor_pointer) {
571
- const ret = wasm.hakuban_object_descriptor_tags(descriptor_pointer);
572
- var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
573
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
574
- return v1;
657
+
658
+ let cachedDataViewMemory0 = null;
659
+ function getDataViewMemory0() {
660
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
661
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
662
+ }
663
+ return cachedDataViewMemory0;
575
664
  }
576
665
 
577
- /**
578
- * @param {string} default_log_level
579
- * @returns {WasmResult}
580
- */
581
- function hakuban_logger_initialize(default_log_level) {
582
- const ptr0 = passStringToWasm0(default_log_level, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
583
- const len0 = WASM_VECTOR_LEN;
584
- const ret = wasm.hakuban_logger_initialize(ptr0, len0);
585
- return WasmResult.__wrap(ret);
666
+ function getStringFromWasm0(ptr, len) {
667
+ ptr = ptr >>> 0;
668
+ return decodeText(ptr, len);
586
669
  }
587
670
 
588
- /**
589
- * @param {number} exchange
590
- * @param {number} descriptor
591
- * @returns {number}
592
- */
593
- function hakuban_tag_observe_contract_new(exchange, descriptor) {
594
- const ret = wasm.hakuban_tag_observe_contract_new(exchange, descriptor);
595
- return ret >>> 0;
671
+ let cachedUint32ArrayMemory0 = null;
672
+ function getUint32ArrayMemory0() {
673
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
674
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
675
+ }
676
+ return cachedUint32ArrayMemory0;
596
677
  }
597
678
 
598
- /**
599
- * @param {number} tag_pointer
600
- */
601
- function hakuban_tag_observe_contract_drop(tag_pointer) {
602
- wasm.hakuban_tag_observe_contract_drop(tag_pointer);
679
+ let cachedUint8ArrayMemory0 = null;
680
+ function getUint8ArrayMemory0() {
681
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
682
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
683
+ }
684
+ return cachedUint8ArrayMemory0;
603
685
  }
604
686
 
605
- /**
606
- * @param {number} tag_observe_pointer
607
- * @returns {number}
608
- */
609
- function hakuban_tag_observe_contract_next(tag_observe_pointer) {
610
- const ret = wasm.hakuban_tag_observe_contract_next(tag_observe_pointer);
611
- return ret >>> 0;
687
+ function isLikeNone(x) {
688
+ return x === undefined || x === null;
612
689
  }
613
690
 
614
- /**
615
- * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9}
616
- */
617
- Object.freeze({
618
- Ok: 0, "0": "Ok",
619
- Pointer: 1, "1": "Pointer",
620
- Pending: 2, "2": "Pending",
621
- EndOfStream: 3, "3": "EndOfStream",
622
- InvalidString: 4, "4": "InvalidString",
623
- InvalidJSON: 5, "5": "InvalidJSON",
624
- InvalidURL: 6, "6": "InvalidURL",
625
- InvalidLogLevel: 7, "7": "InvalidLogLevel",
626
- LoggerInitializationError: 8, "8": "LoggerInitializationError",
627
- ConnectionTerminated: 9, "9": "ConnectionTerminated",
628
- });
691
+ function passArray32ToWasm0(arg, malloc) {
692
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
693
+ getUint32ArrayMemory0().set(arg, ptr / 4);
694
+ WASM_VECTOR_LEN = arg.length;
695
+ return ptr;
696
+ }
629
697
 
630
- const WasmResultFinalization = (typeof FinalizationRegistry === 'undefined')
631
- ? { register: () => {}, unregister: () => {} }
632
- : new FinalizationRegistry(ptr => wasm.__wbg_wasmresult_free(ptr >>> 0, 1));
698
+ function passArray64ToWasm0(arg, malloc) {
699
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
700
+ getBigUint64ArrayMemory0().set(arg, ptr / 8);
701
+ WASM_VECTOR_LEN = arg.length;
702
+ return ptr;
703
+ }
633
704
 
634
- class WasmResult {
705
+ function passArray8ToWasm0(arg, malloc) {
706
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
707
+ getUint8ArrayMemory0().set(arg, ptr / 1);
708
+ WASM_VECTOR_LEN = arg.length;
709
+ return ptr;
710
+ }
635
711
 
636
- static __wrap(ptr) {
637
- ptr = ptr >>> 0;
638
- const obj = Object.create(WasmResult.prototype);
639
- obj.__wbg_ptr = ptr;
640
- WasmResultFinalization.register(obj, obj.__wbg_ptr, obj);
641
- return obj;
712
+ function passArrayJsValueToWasm0(array, malloc) {
713
+ const ptr = malloc(array.length * 4, 4) >>> 0;
714
+ for (let i = 0; i < array.length; i++) {
715
+ const add = addToExternrefTable0(array[i]);
716
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
642
717
  }
718
+ WASM_VECTOR_LEN = array.length;
719
+ return ptr;
720
+ }
643
721
 
644
- __destroy_into_raw() {
645
- const ptr = this.__wbg_ptr;
646
- this.__wbg_ptr = 0;
647
- WasmResultFinalization.unregister(this);
722
+ function passStringToWasm0(arg, malloc, realloc) {
723
+ if (realloc === undefined) {
724
+ const buf = cachedTextEncoder.encode(arg);
725
+ const ptr = malloc(buf.length, 1) >>> 0;
726
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
727
+ WASM_VECTOR_LEN = buf.length;
648
728
  return ptr;
649
729
  }
650
730
 
651
- free() {
652
- const ptr = this.__destroy_into_raw();
653
- wasm.__wbg_wasmresult_free(ptr, 0);
654
- }
655
- /**
656
- * @returns {WasmResultStatus}
657
- */
658
- get status() {
659
- const ret = wasm.__wbg_get_wasmresult_status(this.__wbg_ptr);
660
- return ret;
661
- }
662
- /**
663
- * @param {WasmResultStatus} arg0
664
- */
665
- set status(arg0) {
666
- wasm.__wbg_set_wasmresult_status(this.__wbg_ptr, arg0);
667
- }
668
- /**
669
- * @returns {number | undefined}
670
- */
671
- get pointer() {
672
- const ret = wasm.__wbg_get_wasmresult_pointer(this.__wbg_ptr);
673
- return ret === 0x100000001 ? undefined : ret;
674
- }
675
- /**
676
- * @param {number | null} [arg0]
677
- */
678
- set pointer(arg0) {
679
- wasm.__wbg_set_wasmresult_pointer(this.__wbg_ptr, isLikeNone(arg0) ? 0x100000001 : (arg0) >>> 0);
731
+ let len = arg.length;
732
+ let ptr = malloc(len, 1) >>> 0;
733
+
734
+ const mem = getUint8ArrayMemory0();
735
+
736
+ let offset = 0;
737
+
738
+ for (; offset < len; offset++) {
739
+ const code = arg.charCodeAt(offset);
740
+ if (code > 0x7F) break;
741
+ mem[ptr + offset] = code;
680
742
  }
681
- /**
682
- * @returns {string | undefined}
683
- */
684
- get error_message() {
685
- const ret = wasm.__wbg_get_wasmresult_error_message(this.__wbg_ptr);
686
- let v1;
687
- if (ret[0] !== 0) {
688
- v1 = getStringFromWasm0(ret[0], ret[1]).slice();
689
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
743
+ if (offset !== len) {
744
+ if (offset !== 0) {
745
+ arg = arg.slice(offset);
690
746
  }
691
- return v1;
747
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
748
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
749
+ const ret = cachedTextEncoder.encodeInto(arg, view);
750
+
751
+ offset += ret.written;
752
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
692
753
  }
693
- /**
694
- * @param {string | null} [arg0]
695
- */
696
- set error_message(arg0) {
697
- var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
698
- var len0 = WASM_VECTOR_LEN;
699
- wasm.__wbg_set_wasmresult_error_message(this.__wbg_ptr, ptr0, len0);
754
+
755
+ WASM_VECTOR_LEN = offset;
756
+ return ptr;
757
+ }
758
+
759
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
760
+ cachedTextDecoder.decode();
761
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
762
+ let numBytesDecoded = 0;
763
+ function decodeText(ptr, len) {
764
+ numBytesDecoded += len;
765
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
766
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
767
+ cachedTextDecoder.decode();
768
+ numBytesDecoded = len;
700
769
  }
770
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
771
+ }
772
+
773
+ const cachedTextEncoder = new TextEncoder();
774
+
775
+ if (!('encodeInto' in cachedTextEncoder)) {
776
+ cachedTextEncoder.encodeInto = function (arg, view) {
777
+ const buf = cachedTextEncoder.encode(arg);
778
+ view.set(buf);
779
+ return {
780
+ read: arg.length,
781
+ written: buf.length
782
+ };
783
+ };
701
784
  }
702
785
 
703
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
786
+ let WASM_VECTOR_LEN = 0;
787
+
788
+ let wasm;
789
+ function __wbg_finalize_init(instance, module) {
790
+ wasm = instance.exports;
791
+ cachedBigInt64ArrayMemory0 = null;
792
+ cachedBigUint64ArrayMemory0 = null;
793
+ cachedDataViewMemory0 = null;
794
+ cachedUint32ArrayMemory0 = null;
795
+ cachedUint8ArrayMemory0 = null;
796
+ wasm.__wbindgen_start();
797
+ return wasm;
798
+ }
704
799
 
705
800
  async function __wbg_load(module, imports) {
706
801
  if (typeof Response === 'function' && module instanceof Response) {
707
802
  if (typeof WebAssembly.instantiateStreaming === 'function') {
708
803
  try {
709
804
  return await WebAssembly.instantiateStreaming(module, imports);
710
-
711
805
  } catch (e) {
712
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
806
+ const validResponse = module.ok && expectedResponseType(module.type);
713
807
 
714
808
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
715
809
  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);
716
810
 
717
- } else {
718
- throw e;
719
- }
811
+ } else { throw e; }
720
812
  }
721
813
  }
722
814
 
723
815
  const bytes = await module.arrayBuffer();
724
816
  return await WebAssembly.instantiate(bytes, imports);
725
-
726
817
  } else {
727
818
  const instance = await WebAssembly.instantiate(module, imports);
728
819
 
729
820
  if (instance instanceof WebAssembly.Instance) {
730
821
  return { instance, module };
731
-
732
822
  } else {
733
823
  return instance;
734
824
  }
735
825
  }
736
- }
737
826
 
738
- function __wbg_get_imports() {
739
- const imports = {};
740
- imports.wbg = {};
741
- imports.wbg.__wbg_call_fbe8be8bf6436ce5 = function() { return handleError(function (arg0, arg1) {
742
- const ret = arg0.call(arg1);
743
- return ret;
744
- }, arguments) };
745
- imports.wbg.__wbg_debug_58d16ea352cfbca1 = function(arg0) {
746
- console.debug(arg0);
747
- };
748
- imports.wbg.__wbg_error_51ecdd39ec054205 = function(arg0) {
749
- console.error(arg0);
750
- };
751
- imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
752
- let deferred0_0;
753
- let deferred0_1;
754
- try {
755
- deferred0_0 = arg0;
756
- deferred0_1 = arg1;
757
- console.error(getStringFromWasm0(arg0, arg1));
758
- } finally {
759
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
827
+ function expectedResponseType(type) {
828
+ switch (type) {
829
+ case 'basic': case 'cors': case 'default': return true;
760
830
  }
761
- };
762
- imports.wbg.__wbg_info_e56933705c348038 = function(arg0) {
763
- console.info(arg0);
764
- };
765
- imports.wbg.__wbg_log_ea240990d83e374e = function(arg0) {
766
- console.log(arg0);
767
- };
768
- imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
769
- const ret = new Error();
770
- return ret;
771
- };
772
- imports.wbg.__wbg_newnoargs_ff528e72d35de39a = function(arg0, arg1) {
773
- const ret = new Function(getStringFromWasm0(arg0, arg1));
774
- return ret;
775
- };
776
- imports.wbg.__wbg_now_2c95c9de01293173 = function(arg0) {
777
- const ret = arg0.now();
778
- return ret;
779
- };
780
- imports.wbg.__wbg_performance_7a3ffd0b17f663ad = function(arg0) {
781
- const ret = arg0.performance;
782
- return ret;
783
- };
784
- imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
785
- const ret = arg1.stack;
786
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
787
- const len1 = WASM_VECTOR_LEN;
788
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
789
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
790
- };
791
- imports.wbg.__wbg_static_accessor_GLOBAL_487c52c58d65314d = function() {
792
- const ret = typeof global === 'undefined' ? null : global;
793
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
794
- };
795
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_ee9704f328b6b291 = function() {
796
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
797
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
798
- };
799
- imports.wbg.__wbg_static_accessor_SELF_78c9e3071b912620 = function() {
800
- const ret = typeof self === 'undefined' ? null : self;
801
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
802
- };
803
- imports.wbg.__wbg_static_accessor_WINDOW_a093d21393777366 = function() {
804
- const ret = typeof window === 'undefined' ? null : window;
805
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
806
- };
807
- imports.wbg.__wbg_warn_d89f6637da554c8d = function(arg0) {
808
- console.warn(arg0);
809
- };
810
- imports.wbg.__wbindgen_init_externref_table = function() {
811
- const table = wasm.__wbindgen_export_2;
812
- const offset = table.grow(4);
813
- table.set(0, undefined);
814
- table.set(offset + 0, undefined);
815
- table.set(offset + 1, null);
816
- table.set(offset + 2, true);
817
- table.set(offset + 3, false);
818
- };
819
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
820
- const ret = arg0 === undefined;
821
- return ret;
822
- };
823
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
824
- const obj = arg1;
825
- const ret = typeof(obj) === 'string' ? obj : undefined;
826
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
827
- var len1 = WASM_VECTOR_LEN;
828
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
829
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
830
- };
831
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
832
- const ret = getStringFromWasm0(arg0, arg1);
833
- return ret;
834
- };
835
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
836
- throw new Error(getStringFromWasm0(arg0, arg1));
837
- };
838
-
839
- return imports;
840
- }
841
-
842
- function __wbg_finalize_init(instance, module) {
843
- wasm = instance.exports;
844
- __wbg_init.__wbindgen_wasm_module = module;
845
- cachedBigInt64ArrayMemory0 = null;
846
- cachedBigUint64ArrayMemory0 = null;
847
- cachedDataViewMemory0 = null;
848
- cachedUint32ArrayMemory0 = null;
849
- cachedUint8ArrayMemory0 = null;
850
-
851
-
852
- wasm.__wbindgen_start();
853
- return wasm;
831
+ return false;
832
+ }
854
833
  }
855
834
 
856
835
  async function __wbg_init(module_or_path) {
857
836
  if (wasm !== undefined) return wasm;
858
837
 
859
838
 
860
- if (typeof module_or_path !== 'undefined') {
839
+ if (module_or_path !== undefined) {
861
840
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
862
841
  ({module_or_path} = module_or_path);
863
842
  } else {
@@ -865,7 +844,7 @@ async function __wbg_init(module_or_path) {
865
844
  }
866
845
  }
867
846
 
868
- if (typeof module_or_path === 'undefined') {
847
+ if (module_or_path === undefined) {
869
848
  module_or_path = new URL('hakuban_bg.wasm', import.meta.url);
870
849
  }
871
850
  const imports = __wbg_get_imports();
@@ -876,7 +855,7 @@ async function __wbg_init(module_or_path) {
876
855
 
877
856
  const { instance, module } = await __wbg_load(await module_or_path, imports);
878
857
 
879
- return __wbg_finalize_init(instance, module);
858
+ return __wbg_finalize_init(instance);
880
859
  }
881
860
 
882
861
  var logger_log_level;
@@ -1185,7 +1164,7 @@ var ObjectState = class ObjectState extends FFIObject {
1185
1164
  })();
1186
1165
  this.synchronized_us_ago = hakuban_object_state_synchronized_ago(pointer);
1187
1166
  this.format = hakuban_object_state_format(pointer);
1188
- this.data = new TextDecoder().decode(hakuban_object_state_data(pointer));
1167
+ this.data = hakuban_object_state_data(pointer);
1189
1168
  } else {
1190
1169
  if (version == null) {
1191
1170
  timestamp = new Date().getTime();
@@ -1225,7 +1204,7 @@ var ObjectState = class ObjectState extends FFIObject {
1225
1204
  if (this._pointer != null) {
1226
1205
  return block(this._pointer);
1227
1206
  } else {
1228
- pointer = unwrap_pointer(hakuban_object_state_new(this.version, this.format, new TextEncoder().encode(this.data), this.synchronized_us_ago));
1207
+ pointer = unwrap_pointer(hakuban_object_state_new(this.version, this.format, this.data, this.synchronized_us_ago));
1229
1208
  this.initialize_pointer(null, pointer, hakuban_object_state_drop);
1230
1209
  return block(this._pointer);
1231
1210
  }
@@ -1251,11 +1230,11 @@ var ObjectState = class ObjectState extends FFIObject {
1251
1230
  if (this.format[this.format.length - 1] !== "JSON") {
1252
1231
  throw "Invalid data format";
1253
1232
  }
1254
- return new ObjectState(JSON.parse(this.data), this.version, this.format.slice(0, -1), this.synchronized_us_ago);
1233
+ return new ObjectState(JSON.parse(new TextDecoder().decode(this.data)), this.version, this.format.slice(0, -1), this.synchronized_us_ago);
1255
1234
  }
1256
1235
 
1257
1236
  json_serialize() {
1258
- return new ObjectState(JSON.stringify(this.data), this.version, this.format.concat("JSON"), this.synchronized_us_ago);
1237
+ return new ObjectState(new TextEncoder().encode(JSON.stringify(this.data)), this.version, this.format.concat("JSON"), this.synchronized_us_ago);
1259
1238
  }
1260
1239
 
1261
1240
  };