eddie-jekyll 0.2.4 → 0.4.1

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.
data/assets/eddie-wasm.js CHANGED
@@ -5,58 +5,55 @@ let wasm_bindgen = (function(exports) {
5
5
  }
6
6
 
7
7
  /**
8
- * @param {Uint8Array} index_bytes
8
+ * One chunk by id.
9
+ * @param {number} id
9
10
  * @returns {string}
10
11
  */
11
- function extract_model_id(index_bytes) {
12
- let deferred3_0;
13
- let deferred3_1;
12
+ function chunk(id) {
13
+ let deferred2_0;
14
+ let deferred2_1;
14
15
  try {
15
16
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
16
- const ptr0 = passArray8ToWasm0(index_bytes, wasm.__wbindgen_export);
17
- const len0 = WASM_VECTOR_LEN;
18
- wasm.extract_model_id(retptr, ptr0, len0);
17
+ wasm.chunk(retptr, id);
19
18
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
20
19
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
21
20
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
22
21
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
23
- var ptr2 = r0;
24
- var len2 = r1;
22
+ var ptr1 = r0;
23
+ var len1 = r1;
25
24
  if (r3) {
26
- ptr2 = 0; len2 = 0;
25
+ ptr1 = 0; len1 = 0;
27
26
  throw takeObject(r2);
28
27
  }
29
- deferred3_0 = ptr2;
30
- deferred3_1 = len2;
31
- return getStringFromWasm0(ptr2, len2);
28
+ deferred2_0 = ptr1;
29
+ deferred2_1 = len1;
30
+ return getStringFromWasm0(ptr1, len1);
32
31
  } finally {
33
32
  wasm.__wbindgen_add_to_stack_pointer(16);
34
- wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
33
+ wasm.__wbindgen_export2(deferred2_0, deferred2_1, 1);
35
34
  }
36
35
  }
37
- exports.extract_model_id = extract_model_id;
36
+ exports.chunk = chunk;
38
37
 
39
38
  /**
40
- * Initialize the search engine from raw model and index bytes.
41
- *
42
- * Called once by the Web Worker after downloading all assets.
43
- * @param {Uint8Array} config_bytes
44
- * @param {Uint8Array} tokenizer_bytes
45
- * @param {Uint8Array} weights_bytes
46
- * @param {Uint8Array} index_bytes
39
+ * Load the BERT-family model for a `wasm-candle` lane of the loaded index.
40
+ * @param {string} lane_id
41
+ * @param {Uint8Array} config
42
+ * @param {Uint8Array} tokenizer
43
+ * @param {Uint8Array} weights
47
44
  */
48
- function init_engine(config_bytes, tokenizer_bytes, weights_bytes, index_bytes) {
45
+ function init_dense_wasm(lane_id, config, tokenizer, weights) {
49
46
  try {
50
47
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
51
- const ptr0 = passArray8ToWasm0(config_bytes, wasm.__wbindgen_export);
48
+ const ptr0 = passStringToWasm0(lane_id, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
52
49
  const len0 = WASM_VECTOR_LEN;
53
- const ptr1 = passArray8ToWasm0(tokenizer_bytes, wasm.__wbindgen_export);
50
+ const ptr1 = passArray8ToWasm0(config, wasm.__wbindgen_export3);
54
51
  const len1 = WASM_VECTOR_LEN;
55
- const ptr2 = passArray8ToWasm0(weights_bytes, wasm.__wbindgen_export);
52
+ const ptr2 = passArray8ToWasm0(tokenizer, wasm.__wbindgen_export3);
56
53
  const len2 = WASM_VECTOR_LEN;
57
- const ptr3 = passArray8ToWasm0(index_bytes, wasm.__wbindgen_export);
54
+ const ptr3 = passArray8ToWasm0(weights, wasm.__wbindgen_export3);
58
55
  const len3 = WASM_VECTOR_LEN;
59
- wasm.init_engine(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
56
+ wasm.init_dense_wasm(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
60
57
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
61
58
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
62
59
  if (r1) {
@@ -66,169 +63,232 @@ let wasm_bindgen = (function(exports) {
66
63
  wasm.__wbindgen_add_to_stack_pointer(16);
67
64
  }
68
65
  }
69
- exports.init_engine = init_engine;
66
+ exports.init_dense_wasm = init_dense_wasm;
70
67
 
71
68
  /**
72
- * Query the embedded claims section semantically.
73
- * @param {string} query
74
- * @param {number} top_k
75
- * @returns {any}
69
+ * Parse and validate the index. Replaces any previously loaded index and
70
+ * forgets its dense embedder / sparse tokenizer.
71
+ * @param {Uint8Array} index_bytes
76
72
  */
77
- function query_claims(query, top_k) {
73
+ function init_index(index_bytes) {
78
74
  try {
79
75
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
80
- const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
76
+ const ptr0 = passArray8ToWasm0(index_bytes, wasm.__wbindgen_export3);
81
77
  const len0 = WASM_VECTOR_LEN;
82
- wasm.query_claims(retptr, ptr0, len0, top_k);
78
+ wasm.init_index(retptr, ptr0, len0);
79
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
80
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
81
+ if (r1) {
82
+ throw takeObject(r0);
83
+ }
84
+ } finally {
85
+ wasm.__wbindgen_add_to_stack_pointer(16);
86
+ }
87
+ }
88
+ exports.init_index = init_index;
89
+
90
+ /**
91
+ * Load the WordPiece tokenizer that enables the learned-sparse arm. The
92
+ * bytes must be the `tokenizer.json` the index was built with: their
93
+ * SHA-256 is checked against `manifest.sparse.vocab_hash`, because a
94
+ * different vocabulary yields different token ids and a sparse arm that
95
+ * scores noise while still looking healthy.
96
+ * @param {Uint8Array} tokenizer_bytes
97
+ */
98
+ function init_sparse_tokenizer(tokenizer_bytes) {
99
+ try {
100
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
101
+ const ptr0 = passArray8ToWasm0(tokenizer_bytes, wasm.__wbindgen_export3);
102
+ const len0 = WASM_VECTOR_LEN;
103
+ wasm.init_sparse_tokenizer(retptr, ptr0, len0);
104
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
105
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
106
+ if (r1) {
107
+ throw takeObject(r0);
108
+ }
109
+ } finally {
110
+ wasm.__wbindgen_add_to_stack_pointer(16);
111
+ }
112
+ }
113
+ exports.init_sparse_tokenizer = init_sparse_tokenizer;
114
+
115
+ /**
116
+ * Read the uncompressed manifest at the head of an `.ed` file.
117
+ * @param {Uint8Array} index_bytes
118
+ * @returns {string}
119
+ */
120
+ function manifest(index_bytes) {
121
+ let deferred3_0;
122
+ let deferred3_1;
123
+ try {
124
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
125
+ const ptr0 = passArray8ToWasm0(index_bytes, wasm.__wbindgen_export3);
126
+ const len0 = WASM_VECTOR_LEN;
127
+ wasm.manifest(retptr, ptr0, len0);
83
128
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
84
129
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
85
130
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
86
- if (r2) {
87
- throw takeObject(r1);
131
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
132
+ var ptr2 = r0;
133
+ var len2 = r1;
134
+ if (r3) {
135
+ ptr2 = 0; len2 = 0;
136
+ throw takeObject(r2);
88
137
  }
89
- return takeObject(r0);
138
+ deferred3_0 = ptr2;
139
+ deferred3_1 = len2;
140
+ return getStringFromWasm0(ptr2, len2);
90
141
  } finally {
91
142
  wasm.__wbindgen_add_to_stack_pointer(16);
143
+ wasm.__wbindgen_export2(deferred3_0, deferred3_1, 1);
92
144
  }
93
145
  }
94
- exports.query_claims = query_claims;
146
+ exports.manifest = manifest;
95
147
 
96
148
  /**
97
- * Query the embedded QA section semantically.
98
- * @param {string} query
99
- * @param {number} top_k
100
- * @returns {any}
149
+ * The text of a page (by URL) in document order: its chunks at the finest
150
+ * granularity present (`fine` when the index has it), so coarse and summary
151
+ * chunks never duplicate the same paragraphs.
152
+ * @param {string} url
153
+ * @returns {string}
101
154
  */
102
- function query_qa(query, top_k) {
155
+ function page(url) {
156
+ let deferred3_0;
157
+ let deferred3_1;
103
158
  try {
104
159
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
105
- const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
160
+ const ptr0 = passStringToWasm0(url, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
106
161
  const len0 = WASM_VECTOR_LEN;
107
- wasm.query_qa(retptr, ptr0, len0, top_k);
162
+ wasm.page(retptr, ptr0, len0);
108
163
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
109
164
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
110
165
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
111
- if (r2) {
112
- throw takeObject(r1);
166
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
167
+ var ptr2 = r0;
168
+ var len2 = r1;
169
+ if (r3) {
170
+ ptr2 = 0; len2 = 0;
171
+ throw takeObject(r2);
113
172
  }
114
- return takeObject(r0);
173
+ deferred3_0 = ptr2;
174
+ deferred3_1 = len2;
175
+ return getStringFromWasm0(ptr2, len2);
115
176
  } finally {
116
177
  wasm.__wbindgen_add_to_stack_pointer(16);
178
+ wasm.__wbindgen_export2(deferred3_0, deferred3_1, 1);
117
179
  }
118
180
  }
119
- exports.query_qa = query_qa;
181
+ exports.page = page;
120
182
 
121
183
  /**
122
- * Search the index and return results as a JS array.
123
- *
124
- * `mode`: "semantic", "keyword", or "hybrid" (default).
184
+ * QA entries ranked by [`crate::search::rank_qa`]: the qa dense lane's
185
+ * cosine fused with lexical overlap and a BM25 pass over the questions and
186
+ * answers. Returns `[]` when the index has no qa section; without a query
187
+ * vector (no runnable embedder) the ranking is lexical only and no hit is
188
+ * `confident`.
125
189
  * @param {string} query
126
- * @param {number} top_k
127
- * @param {string} mode
128
- * @returns {any}
190
+ * @param {string | null | undefined} dense_lane_id
191
+ * @param {Float32Array | null | undefined} dense_query_vec
192
+ * @param {number} k
193
+ * @returns {string}
129
194
  */
130
- function search_query(query, top_k, mode) {
195
+ function qa_lookup(query, dense_lane_id, dense_query_vec, k) {
196
+ let deferred5_0;
197
+ let deferred5_1;
131
198
  try {
132
199
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
133
- const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
200
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
134
201
  const len0 = WASM_VECTOR_LEN;
135
- const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
136
- const len1 = WASM_VECTOR_LEN;
137
- wasm.search_query(retptr, ptr0, len0, top_k, ptr1, len1);
202
+ var ptr1 = isLikeNone(dense_lane_id) ? 0 : passStringToWasm0(dense_lane_id, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
203
+ var len1 = WASM_VECTOR_LEN;
204
+ var ptr2 = isLikeNone(dense_query_vec) ? 0 : passArrayF32ToWasm0(dense_query_vec, wasm.__wbindgen_export3);
205
+ var len2 = WASM_VECTOR_LEN;
206
+ wasm.qa_lookup(retptr, ptr0, len0, ptr1, len1, ptr2, len2, k);
138
207
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
139
208
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
140
209
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
141
- if (r2) {
142
- throw takeObject(r1);
210
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
211
+ var ptr4 = r0;
212
+ var len4 = r1;
213
+ if (r3) {
214
+ ptr4 = 0; len4 = 0;
215
+ throw takeObject(r2);
143
216
  }
144
- return takeObject(r0);
217
+ deferred5_0 = ptr4;
218
+ deferred5_1 = len4;
219
+ return getStringFromWasm0(ptr4, len4);
145
220
  } finally {
146
221
  wasm.__wbindgen_add_to_stack_pointer(16);
222
+ wasm.__wbindgen_export2(deferred5_0, deferred5_1, 1);
147
223
  }
148
224
  }
149
- exports.search_query = search_query;
225
+ exports.qa_lookup = qa_lookup;
150
226
 
151
227
  /**
152
- * Search and optionally synthesize a grounded answer inside WASM.
228
+ * Search the loaded index.
229
+ *
230
+ * `mode`: `hybrid` (default), `dense`, `sparse`, or `keyword`.
231
+ * `dense_lane_id` + `dense_query_vec`: a query vector produced outside WASM
232
+ * (transformers.js) for the named lane. With both `null`, the WASM lane
233
+ * loaded by `init_dense_wasm` embeds the query (exactly once); if none is
234
+ * loaded the dense arm is skipped and reported in `degraded`.
153
235
  * @param {string} query
154
236
  * @param {number} top_k
155
- * @param {number} answer_top_k
156
237
  * @param {string} mode
157
- * @param {boolean} answer_mode
158
- * @param {string} qa_subject
159
- * @returns {any}
238
+ * @param {string | null} [dense_lane_id]
239
+ * @param {Float32Array | null} [dense_query_vec]
240
+ * @returns {string}
160
241
  */
161
- function search_with_answer(query, top_k, answer_top_k, mode, answer_mode, qa_subject) {
242
+ function search(query, top_k, mode, dense_lane_id, dense_query_vec) {
243
+ let deferred6_0;
244
+ let deferred6_1;
162
245
  try {
163
246
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
164
- const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export, wasm.__wbindgen_export2);
247
+ const ptr0 = passStringToWasm0(query, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
165
248
  const len0 = WASM_VECTOR_LEN;
166
- const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export, wasm.__wbindgen_export2);
249
+ const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
167
250
  const len1 = WASM_VECTOR_LEN;
168
- const ptr2 = passStringToWasm0(qa_subject, wasm.__wbindgen_export, wasm.__wbindgen_export2);
169
- const len2 = WASM_VECTOR_LEN;
170
- wasm.search_with_answer(retptr, ptr0, len0, top_k, answer_top_k, ptr1, len1, answer_mode, ptr2, len2);
251
+ var ptr2 = isLikeNone(dense_lane_id) ? 0 : passStringToWasm0(dense_lane_id, wasm.__wbindgen_export3, wasm.__wbindgen_export4);
252
+ var len2 = WASM_VECTOR_LEN;
253
+ var ptr3 = isLikeNone(dense_query_vec) ? 0 : passArrayF32ToWasm0(dense_query_vec, wasm.__wbindgen_export3);
254
+ var len3 = WASM_VECTOR_LEN;
255
+ wasm.search(retptr, ptr0, len0, top_k, ptr1, len1, ptr2, len2, ptr3, len3);
171
256
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
172
257
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
173
258
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
174
- if (r2) {
175
- throw takeObject(r1);
259
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
260
+ var ptr5 = r0;
261
+ var len5 = r1;
262
+ if (r3) {
263
+ ptr5 = 0; len5 = 0;
264
+ throw takeObject(r2);
176
265
  }
177
- return takeObject(r0);
266
+ deferred6_0 = ptr5;
267
+ deferred6_1 = len5;
268
+ return getStringFromWasm0(ptr5, len5);
178
269
  } finally {
179
270
  wasm.__wbindgen_add_to_stack_pointer(16);
271
+ wasm.__wbindgen_export2(deferred6_0, deferred6_1, 1);
180
272
  }
181
273
  }
182
- exports.search_with_answer = search_with_answer;
183
-
274
+ exports.search = search;
184
275
  function __wbg_get_imports() {
185
276
  const import0 = {
186
277
  __proto__: null,
187
- __wbg_String_8564e559799eccda: function(arg0, arg1) {
188
- const ret = String(getObject(arg1));
189
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
190
- const len1 = WASM_VECTOR_LEN;
191
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
192
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
193
- },
194
- __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
278
+ __wbg___wbindgen_throw_bb96b2010945f0bc: function(arg0, arg1) {
195
279
  throw new Error(getStringFromWasm0(arg0, arg1));
196
280
  },
197
- __wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
281
+ __wbg_error_dd408a7b3cb542dd: function(arg0) {
282
+ console.error(getObject(arg0));
283
+ },
284
+ __wbg_getRandomValues_a608c4436c19407a: function() { return handleError(function (arg0, arg1) {
198
285
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
199
286
  }, arguments); },
200
- __wbg_new_a70fbab9066b301f: function() {
201
- const ret = new Array();
202
- return addHeapObject(ret);
203
- },
204
- __wbg_new_ab79df5bd7c26067: function() {
205
- const ret = new Object();
206
- return addHeapObject(ret);
207
- },
208
- __wbg_now_16f0c993d5dd6c27: function() {
209
- const ret = Date.now();
210
- return ret;
211
- },
212
- __wbg_set_282384002438957f: function(arg0, arg1, arg2) {
213
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
214
- },
215
- __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
216
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
217
- },
218
- __wbindgen_cast_0000000000000001: function(arg0) {
219
- // Cast intrinsic for `F64 -> Externref`.
220
- const ret = arg0;
221
- return addHeapObject(ret);
222
- },
223
- __wbindgen_cast_0000000000000002: function(arg0, arg1) {
287
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
224
288
  // Cast intrinsic for `Ref(String) -> Externref`.
225
289
  const ret = getStringFromWasm0(arg0, arg1);
226
290
  return addHeapObject(ret);
227
291
  },
228
- __wbindgen_object_clone_ref: function(arg0) {
229
- const ret = getObject(arg0);
230
- return addHeapObject(ret);
231
- },
232
292
  __wbindgen_object_drop_ref: function(arg0) {
233
293
  takeObject(arg0);
234
294
  },
@@ -267,9 +327,16 @@ let wasm_bindgen = (function(exports) {
267
327
  return cachedDataViewMemory0;
268
328
  }
269
329
 
330
+ let cachedFloat32ArrayMemory0 = null;
331
+ function getFloat32ArrayMemory0() {
332
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
333
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
334
+ }
335
+ return cachedFloat32ArrayMemory0;
336
+ }
337
+
270
338
  function getStringFromWasm0(ptr, len) {
271
- ptr = ptr >>> 0;
272
- return decodeText(ptr, len);
339
+ return decodeText(ptr >>> 0, len);
273
340
  }
274
341
 
275
342
  let cachedUint8ArrayMemory0 = null;
@@ -286,7 +353,7 @@ let wasm_bindgen = (function(exports) {
286
353
  try {
287
354
  return f.apply(this, args);
288
355
  } catch (e) {
289
- wasm.__wbindgen_export3(addHeapObject(e));
356
+ wasm.__wbindgen_export(addHeapObject(e));
290
357
  }
291
358
  }
292
359
 
@@ -295,6 +362,10 @@ let wasm_bindgen = (function(exports) {
295
362
 
296
363
  let heap_next = heap.length;
297
364
 
365
+ function isLikeNone(x) {
366
+ return x === undefined || x === null;
367
+ }
368
+
298
369
  function passArray8ToWasm0(arg, malloc) {
299
370
  const ptr = malloc(arg.length * 1, 1) >>> 0;
300
371
  getUint8ArrayMemory0().set(arg, ptr / 1);
@@ -302,6 +373,13 @@ let wasm_bindgen = (function(exports) {
302
373
  return ptr;
303
374
  }
304
375
 
376
+ function passArrayF32ToWasm0(arg, malloc) {
377
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
378
+ getFloat32ArrayMemory0().set(arg, ptr / 4);
379
+ WASM_VECTOR_LEN = arg.length;
380
+ return ptr;
381
+ }
382
+
305
383
  function passStringToWasm0(arg, malloc, realloc) {
306
384
  if (realloc === undefined) {
307
385
  const buf = cachedTextEncoder.encode(arg);
@@ -366,22 +444,28 @@ let wasm_bindgen = (function(exports) {
366
444
 
367
445
  let WASM_VECTOR_LEN = 0;
368
446
 
369
- let wasmModule, wasm;
447
+ let wasmModule, wasmInstance, wasm;
370
448
  function __wbg_finalize_init(instance, module) {
449
+ wasmInstance = instance;
371
450
  wasm = instance.exports;
372
451
  wasmModule = module;
373
452
  cachedDataViewMemory0 = null;
453
+ cachedFloat32ArrayMemory0 = null;
374
454
  cachedUint8ArrayMemory0 = null;
375
455
  return wasm;
376
456
  }
377
457
 
378
458
  async function __wbg_load(module, imports) {
379
459
  if (typeof Response === 'function' && module instanceof Response) {
460
+ if (!module.ok) {
461
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
462
+ }
463
+
380
464
  if (typeof WebAssembly.instantiateStreaming === 'function') {
381
465
  try {
382
466
  return await WebAssembly.instantiateStreaming(module, imports);
383
467
  } catch (e) {
384
- const validResponse = module.ok && expectedResponseType(module.type);
468
+ const validResponse = expectedResponseType(module.type);
385
469
 
386
470
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
387
471
  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);