glassjar 0.1.0 → 0.2.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.
package/dist/glassjar.js CHANGED
@@ -1,228 +1,228 @@
1
- function NA(Q) {
1
+ function UA(Q) {
2
2
  return Q && Q.__esModule && Object.prototype.hasOwnProperty.call(Q, "default") ? Q.default : Q;
3
3
  }
4
- var j = { exports: {} }, v;
5
- function GA() {
6
- if (v) return j.exports;
7
- v = 1;
8
- var Q = typeof Reflect == "object" ? Reflect : null, A = Q && typeof Q.apply == "function" ? Q.apply : function(B, D, o) {
9
- return Function.prototype.apply.call(B, D, o);
4
+ var b = { exports: {} }, CA;
5
+ function JA() {
6
+ if (CA) return b.exports;
7
+ CA = 1;
8
+ var Q = typeof Reflect == "object" ? Reflect : null, A = Q && typeof Q.apply == "function" ? Q.apply : function(E, o, G) {
9
+ return Function.prototype.apply.call(E, o, G);
10
10
  }, g;
11
- Q && typeof Q.ownKeys == "function" ? g = Q.ownKeys : Object.getOwnPropertySymbols ? g = function(B) {
12
- return Object.getOwnPropertyNames(B).concat(Object.getOwnPropertySymbols(B));
13
- } : g = function(B) {
14
- return Object.getOwnPropertyNames(B);
11
+ Q && typeof Q.ownKeys == "function" ? g = Q.ownKeys : Object.getOwnPropertySymbols ? g = function(E) {
12
+ return Object.getOwnPropertyNames(E).concat(Object.getOwnPropertySymbols(E));
13
+ } : g = function(E) {
14
+ return Object.getOwnPropertyNames(E);
15
15
  };
16
- function I(E) {
17
- console && console.warn && console.warn(E);
16
+ function I(w) {
17
+ console && console.warn && console.warn(w);
18
18
  }
19
- var C = Number.isNaN || function(B) {
20
- return B !== B;
19
+ var C = Number.isNaN || function(E) {
20
+ return E !== E;
21
21
  };
22
- function w() {
23
- w.init.call(this);
22
+ function B() {
23
+ B.init.call(this);
24
24
  }
25
- j.exports = w, j.exports.once = wA, w.EventEmitter = w, w.prototype._events = void 0, w.prototype._eventsCount = 0, w.prototype._maxListeners = void 0;
26
- var N = 10;
27
- function M(E) {
28
- if (typeof E != "function")
29
- throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof E);
25
+ b.exports = B, b.exports.once = yA, B.EventEmitter = B, B.prototype._events = void 0, B.prototype._eventsCount = 0, B.prototype._maxListeners = void 0;
26
+ var i = 10;
27
+ function D(w) {
28
+ if (typeof w != "function")
29
+ throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof w);
30
30
  }
31
- Object.defineProperty(w, "defaultMaxListeners", {
31
+ Object.defineProperty(B, "defaultMaxListeners", {
32
32
  enumerable: !0,
33
33
  get: function() {
34
- return N;
34
+ return i;
35
35
  },
36
- set: function(E) {
37
- if (typeof E != "number" || E < 0 || C(E))
38
- throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + E + ".");
39
- N = E;
36
+ set: function(w) {
37
+ if (typeof w != "number" || w < 0 || C(w))
38
+ throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + w + ".");
39
+ i = w;
40
40
  }
41
- }), w.init = function() {
41
+ }), B.init = function() {
42
42
  (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
43
- }, w.prototype.setMaxListeners = function(B) {
44
- if (typeof B != "number" || B < 0 || C(B))
45
- throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + B + ".");
46
- return this._maxListeners = B, this;
43
+ }, B.prototype.setMaxListeners = function(E) {
44
+ if (typeof E != "number" || E < 0 || C(E))
45
+ throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + E + ".");
46
+ return this._maxListeners = E, this;
47
47
  };
48
- function Y(E) {
49
- return E._maxListeners === void 0 ? w.defaultMaxListeners : E._maxListeners;
50
- }
51
- w.prototype.getMaxListeners = function() {
52
- return Y(this);
53
- }, w.prototype.emit = function(B) {
54
- for (var D = [], o = 1; o < arguments.length; o++) D.push(arguments[o]);
55
- var G = B === "error", y = this._events;
56
- if (y !== void 0)
57
- G = G && y.error === void 0;
58
- else if (!G)
48
+ function N(w) {
49
+ return w._maxListeners === void 0 ? B.defaultMaxListeners : w._maxListeners;
50
+ }
51
+ B.prototype.getMaxListeners = function() {
52
+ return N(this);
53
+ }, B.prototype.emit = function(E) {
54
+ for (var o = [], G = 1; G < arguments.length; G++) o.push(arguments[G]);
55
+ var k = E === "error", R = this._events;
56
+ if (R !== void 0)
57
+ k = k && R.error === void 0;
58
+ else if (!k)
59
59
  return !1;
60
- if (G) {
60
+ if (k) {
61
61
  var F;
62
- if (D.length > 0 && (F = D[0]), F instanceof Error)
62
+ if (o.length > 0 && (F = o[0]), F instanceof Error)
63
63
  throw F;
64
- var U = new Error("Unhandled error." + (F ? " (" + F.message + ")" : ""));
65
- throw U.context = F, U;
64
+ var H = new Error("Unhandled error." + (F ? " (" + F.message + ")" : ""));
65
+ throw H.context = F, H;
66
66
  }
67
- var H = y[B];
68
- if (H === void 0)
67
+ var W = R[E];
68
+ if (W === void 0)
69
69
  return !1;
70
- if (typeof H == "function")
71
- A(H, this, D);
70
+ if (typeof W == "function")
71
+ A(W, this, o);
72
72
  else
73
- for (var r = H.length, oA = b(H, r), o = 0; o < r; ++o)
74
- A(oA[o], this, D);
73
+ for (var IA = W.length, YA = Z(W, IA), G = 0; G < IA; ++G)
74
+ A(YA[G], this, o);
75
75
  return !0;
76
76
  };
77
- function s(E, B, D, o) {
78
- var G, y, F;
79
- if (M(D), y = E._events, y === void 0 ? (y = E._events = /* @__PURE__ */ Object.create(null), E._eventsCount = 0) : (y.newListener !== void 0 && (E.emit(
77
+ function y(w, E, o, G) {
78
+ var k, R, F;
79
+ if (D(o), R = w._events, R === void 0 ? (R = w._events = /* @__PURE__ */ Object.create(null), w._eventsCount = 0) : (R.newListener !== void 0 && (w.emit(
80
80
  "newListener",
81
- B,
82
- D.listener ? D.listener : D
83
- ), y = E._events), F = y[B]), F === void 0)
84
- F = y[B] = D, ++E._eventsCount;
85
- else if (typeof F == "function" ? F = y[B] = o ? [D, F] : [F, D] : o ? F.unshift(D) : F.push(D), G = Y(E), G > 0 && F.length > G && !F.warned) {
81
+ E,
82
+ o.listener ? o.listener : o
83
+ ), R = w._events), F = R[E]), F === void 0)
84
+ F = R[E] = o, ++w._eventsCount;
85
+ else if (typeof F == "function" ? F = R[E] = G ? [o, F] : [F, o] : G ? F.unshift(o) : F.push(o), k = N(w), k > 0 && F.length > k && !F.warned) {
86
86
  F.warned = !0;
87
- var U = new Error("Possible EventEmitter memory leak detected. " + F.length + " " + String(B) + " listeners added. Use emitter.setMaxListeners() to increase limit");
88
- U.name = "MaxListenersExceededWarning", U.emitter = E, U.type = B, U.count = F.length, I(U);
87
+ var H = new Error("Possible EventEmitter memory leak detected. " + F.length + " " + String(E) + " listeners added. Use emitter.setMaxListeners() to increase limit");
88
+ H.name = "MaxListenersExceededWarning", H.emitter = w, H.type = E, H.count = F.length, I(H);
89
89
  }
90
- return E;
90
+ return w;
91
91
  }
92
- w.prototype.addListener = function(B, D) {
93
- return s(this, B, D, !1);
94
- }, w.prototype.on = w.prototype.addListener, w.prototype.prependListener = function(B, D) {
95
- return s(this, B, D, !0);
92
+ B.prototype.addListener = function(E, o) {
93
+ return y(this, E, o, !1);
94
+ }, B.prototype.on = B.prototype.addListener, B.prototype.prependListener = function(E, o) {
95
+ return y(this, E, o, !0);
96
96
  };
97
- function BA() {
97
+ function J() {
98
98
  if (!this.fired)
99
99
  return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
100
100
  }
101
- function f(E, B, D) {
102
- var o = { fired: !1, wrapFn: void 0, target: E, type: B, listener: D }, G = BA.bind(o);
103
- return G.listener = D, o.wrapFn = G, G;
104
- }
105
- w.prototype.once = function(B, D) {
106
- return M(D), this.on(B, f(this, B, D)), this;
107
- }, w.prototype.prependOnceListener = function(B, D) {
108
- return M(D), this.prependListener(B, f(this, B, D)), this;
109
- }, w.prototype.removeListener = function(B, D) {
110
- var o, G, y, F, U;
111
- if (M(D), G = this._events, G === void 0)
101
+ function h(w, E, o) {
102
+ var G = { fired: !1, wrapFn: void 0, target: w, type: E, listener: o }, k = J.bind(G);
103
+ return k.listener = o, G.wrapFn = k, k;
104
+ }
105
+ B.prototype.once = function(E, o) {
106
+ return D(o), this.on(E, h(this, E, o)), this;
107
+ }, B.prototype.prependOnceListener = function(E, o) {
108
+ return D(o), this.prependListener(E, h(this, E, o)), this;
109
+ }, B.prototype.removeListener = function(E, o) {
110
+ var G, k, R, F, H;
111
+ if (D(o), k = this._events, k === void 0)
112
112
  return this;
113
- if (o = G[B], o === void 0)
113
+ if (G = k[E], G === void 0)
114
114
  return this;
115
- if (o === D || o.listener === D)
116
- --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete G[B], G.removeListener && this.emit("removeListener", B, o.listener || D));
117
- else if (typeof o != "function") {
118
- for (y = -1, F = o.length - 1; F >= 0; F--)
119
- if (o[F] === D || o[F].listener === D) {
120
- U = o[F].listener, y = F;
115
+ if (G === o || G.listener === o)
116
+ --this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : (delete k[E], k.removeListener && this.emit("removeListener", E, G.listener || o));
117
+ else if (typeof G != "function") {
118
+ for (R = -1, F = G.length - 1; F >= 0; F--)
119
+ if (G[F] === o || G[F].listener === o) {
120
+ H = G[F].listener, R = F;
121
121
  break;
122
122
  }
123
- if (y < 0)
123
+ if (R < 0)
124
124
  return this;
125
- y === 0 ? o.shift() : EA(o, y), o.length === 1 && (G[B] = o[0]), G.removeListener !== void 0 && this.emit("removeListener", B, U || D);
125
+ R === 0 ? G.shift() : p(G, R), G.length === 1 && (k[E] = G[0]), k.removeListener !== void 0 && this.emit("removeListener", E, H || o);
126
126
  }
127
127
  return this;
128
- }, w.prototype.off = w.prototype.removeListener, w.prototype.removeAllListeners = function(B) {
129
- var D, o, G;
130
- if (o = this._events, o === void 0)
128
+ }, B.prototype.off = B.prototype.removeListener, B.prototype.removeAllListeners = function(E) {
129
+ var o, G, k;
130
+ if (G = this._events, G === void 0)
131
131
  return this;
132
- if (o.removeListener === void 0)
133
- return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : o[B] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete o[B]), this;
132
+ if (G.removeListener === void 0)
133
+ return arguments.length === 0 ? (this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0) : G[E] !== void 0 && (--this._eventsCount === 0 ? this._events = /* @__PURE__ */ Object.create(null) : delete G[E]), this;
134
134
  if (arguments.length === 0) {
135
- var y = Object.keys(o), F;
136
- for (G = 0; G < y.length; ++G)
137
- F = y[G], F !== "removeListener" && this.removeAllListeners(F);
135
+ var R = Object.keys(G), F;
136
+ for (k = 0; k < R.length; ++k)
137
+ F = R[k], F !== "removeListener" && this.removeAllListeners(F);
138
138
  return this.removeAllListeners("removeListener"), this._events = /* @__PURE__ */ Object.create(null), this._eventsCount = 0, this;
139
139
  }
140
- if (D = o[B], typeof D == "function")
141
- this.removeListener(B, D);
142
- else if (D !== void 0)
143
- for (G = D.length - 1; G >= 0; G--)
144
- this.removeListener(B, D[G]);
140
+ if (o = G[E], typeof o == "function")
141
+ this.removeListener(E, o);
142
+ else if (o !== void 0)
143
+ for (k = o.length - 1; k >= 0; k--)
144
+ this.removeListener(E, o[k]);
145
145
  return this;
146
146
  };
147
- function X(E, B, D) {
148
- var o = E._events;
149
- if (o === void 0)
147
+ function Y(w, E, o) {
148
+ var G = w._events;
149
+ if (G === void 0)
150
150
  return [];
151
- var G = o[B];
152
- return G === void 0 ? [] : typeof G == "function" ? D ? [G.listener || G] : [G] : D ? DA(G) : b(G, G.length);
153
- }
154
- w.prototype.listeners = function(B) {
155
- return X(this, B, !0);
156
- }, w.prototype.rawListeners = function(B) {
157
- return X(this, B, !1);
158
- }, w.listenerCount = function(E, B) {
159
- return typeof E.listenerCount == "function" ? E.listenerCount(B) : m.call(E, B);
160
- }, w.prototype.listenerCount = m;
161
- function m(E) {
162
- var B = this._events;
163
- if (B !== void 0) {
164
- var D = B[E];
165
- if (typeof D == "function")
151
+ var k = G[E];
152
+ return k === void 0 ? [] : typeof k == "function" ? o ? [k.listener || k] : [k] : o ? KA(k) : Z(k, k.length);
153
+ }
154
+ B.prototype.listeners = function(E) {
155
+ return Y(this, E, !0);
156
+ }, B.prototype.rawListeners = function(E) {
157
+ return Y(this, E, !1);
158
+ }, B.listenerCount = function(w, E) {
159
+ return typeof w.listenerCount == "function" ? w.listenerCount(E) : S.call(w, E);
160
+ }, B.prototype.listenerCount = S;
161
+ function S(w) {
162
+ var E = this._events;
163
+ if (E !== void 0) {
164
+ var o = E[w];
165
+ if (typeof o == "function")
166
166
  return 1;
167
- if (D !== void 0)
168
- return D.length;
167
+ if (o !== void 0)
168
+ return o.length;
169
169
  }
170
170
  return 0;
171
171
  }
172
- w.prototype.eventNames = function() {
172
+ B.prototype.eventNames = function() {
173
173
  return this._eventsCount > 0 ? g(this._events) : [];
174
174
  };
175
- function b(E, B) {
176
- for (var D = new Array(B), o = 0; o < B; ++o)
177
- D[o] = E[o];
178
- return D;
179
- }
180
- function EA(E, B) {
181
- for (; B + 1 < E.length; B++)
182
- E[B] = E[B + 1];
183
- E.pop();
184
- }
185
- function DA(E) {
186
- for (var B = new Array(E.length), D = 0; D < B.length; ++D)
187
- B[D] = E[D].listener || E[D];
188
- return B;
189
- }
190
- function wA(E, B) {
191
- return new Promise(function(D, o) {
192
- function G(F) {
193
- E.removeListener(B, y), o(F);
175
+ function Z(w, E) {
176
+ for (var o = new Array(E), G = 0; G < E; ++G)
177
+ o[G] = w[G];
178
+ return o;
179
+ }
180
+ function p(w, E) {
181
+ for (; E + 1 < w.length; E++)
182
+ w[E] = w[E + 1];
183
+ w.pop();
184
+ }
185
+ function KA(w) {
186
+ for (var E = new Array(w.length), o = 0; o < E.length; ++o)
187
+ E[o] = w[o].listener || w[o];
188
+ return E;
189
+ }
190
+ function yA(w, E) {
191
+ return new Promise(function(o, G) {
192
+ function k(F) {
193
+ w.removeListener(E, R), G(F);
194
194
  }
195
- function y() {
196
- typeof E.removeListener == "function" && E.removeListener("error", G), D([].slice.call(arguments));
195
+ function R() {
196
+ typeof w.removeListener == "function" && w.removeListener("error", k), o([].slice.call(arguments));
197
197
  }
198
- n(E, B, y, { once: !0 }), B !== "error" && iA(E, G, { once: !0 });
198
+ gA(w, E, R, { once: !0 }), E !== "error" && RA(w, k, { once: !0 });
199
199
  });
200
200
  }
201
- function iA(E, B, D) {
202
- typeof E.on == "function" && n(E, "error", B, D);
201
+ function RA(w, E, o) {
202
+ typeof w.on == "function" && gA(w, "error", E, o);
203
203
  }
204
- function n(E, B, D, o) {
205
- if (typeof E.on == "function")
206
- o.once ? E.once(B, D) : E.on(B, D);
207
- else if (typeof E.addEventListener == "function")
208
- E.addEventListener(B, function G(y) {
209
- o.once && E.removeEventListener(B, G), D(y);
204
+ function gA(w, E, o, G) {
205
+ if (typeof w.on == "function")
206
+ G.once ? w.once(E, o) : w.on(E, o);
207
+ else if (typeof w.addEventListener == "function")
208
+ w.addEventListener(E, function k(R) {
209
+ G.once && w.removeEventListener(E, k), o(R);
210
210
  });
211
211
  else
212
- throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof E);
212
+ throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof w);
213
213
  }
214
- return j.exports;
214
+ return b.exports;
215
215
  }
216
- var FA = GA();
217
- const gA = /* @__PURE__ */ NA(FA);
218
- class t {
216
+ var SA = JA();
217
+ const MA = /* @__PURE__ */ UA(SA);
218
+ class e {
219
219
  __destroy_into_raw() {
220
220
  const A = this.__wbg_ptr;
221
- return this.__wbg_ptr = 0, e.unregister(this), A;
221
+ return this.__wbg_ptr = 0, EA.unregister(this), A;
222
222
  }
223
223
  free() {
224
224
  const A = this.__destroy_into_raw();
225
- i.__wbg_dapadapter_free(A, 0);
225
+ M.__wbg_dapadapter_free(A, 0);
226
226
  }
227
227
  /**
228
228
  * Attaches a worker to the adapter.
@@ -233,62 +233,80 @@ class t {
233
233
  * @param {Worker} worker
234
234
  */
235
235
  attach(A) {
236
- i.dapadapter_attach(this.__wbg_ptr, A);
236
+ M.dapadapter_attach(this.__wbg_ptr, A);
237
+ }
238
+ /**
239
+ * Retire the listener without borrowing session state (callbacks can synchronously Stop).
240
+ */
241
+ detach() {
242
+ M.dapadapter_detach(this.__wbg_ptr);
237
243
  }
238
244
  constructor() {
239
- const A = i.dapadapter_new();
240
- return this.__wbg_ptr = A >>> 0, e.register(this, this.__wbg_ptr, this), this;
245
+ const A = M.dapadapter_new();
246
+ return this.__wbg_ptr = A >>> 0, EA.register(this, this.__wbg_ptr, this), this;
241
247
  }
242
248
  /**
243
249
  * @param {Function} callback
244
250
  */
245
251
  on(A) {
246
- i.dapadapter_on(this.__wbg_ptr, A);
252
+ M.dapadapter_on(this.__wbg_ptr, A);
253
+ }
254
+ resetRun() {
255
+ M.dapadapter_resetRun(this.__wbg_ptr);
247
256
  }
248
257
  /**
249
258
  * @param {any} msg
250
259
  * @returns {any}
251
260
  */
252
261
  sendMessage(A) {
253
- return i.dapadapter_sendMessage(this.__wbg_ptr, A);
262
+ return M.dapadapter_sendMessage(this.__wbg_ptr, A);
254
263
  }
255
264
  /**
256
265
  * @param {boolean} value
257
266
  */
258
267
  setFilterInternals(A) {
259
- i.dapadapter_setFilterInternals(this.__wbg_ptr, A);
268
+ M.dapadapter_setFilterInternals(this.__wbg_ptr, A);
260
269
  }
261
270
  }
262
- Symbol.dispose && (t.prototype[Symbol.dispose] = t.prototype.free);
263
- class T {
271
+ Symbol.dispose && (e.prototype[Symbol.dispose] = e.prototype.free);
272
+ class l {
264
273
  static __wrap(A) {
265
274
  A = A >>> 0;
266
- const g = Object.create(T.prototype);
267
- return g.__wbg_ptr = A, _.register(g, g.__wbg_ptr, g), g;
275
+ const g = Object.create(l.prototype);
276
+ return g.__wbg_ptr = A, DA.register(g, g.__wbg_ptr, g), g;
268
277
  }
269
278
  __destroy_into_raw() {
270
279
  const A = this.__wbg_ptr;
271
- return this.__wbg_ptr = 0, _.unregister(this), A;
280
+ return this.__wbg_ptr = 0, DA.unregister(this), A;
272
281
  }
273
282
  free() {
274
283
  const A = this.__destroy_into_raw();
275
- i.__wbg_trap_free(A, 0);
284
+ M.__wbg_trap_free(A, 0);
276
285
  }
277
286
  /**
278
287
  * A marker method to indicate that an object is an instance of the `Trap`
279
288
  * class.
280
289
  */
281
290
  static __wbg_wasmer_trap() {
282
- i.trap___wbg_wasmer_trap();
291
+ M.trap___wbg_wasmer_trap();
283
292
  }
284
293
  }
285
- Symbol.dispose && (T.prototype[Symbol.dispose] = T.prototype.free);
286
- function kA(Q) {
287
- const A = a(Q, i.__wbindgen_malloc, i.__wbindgen_realloc), g = L, I = i.prefetch_urls(A, g);
288
- var C = IA(I[0], I[1]).slice();
289
- return i.__wbindgen_free(I[0], I[1] * 4, 4), C;
294
+ Symbol.dispose && (l.prototype[Symbol.dispose] = l.prototype.free);
295
+ function hA() {
296
+ let Q, A;
297
+ try {
298
+ const g = M.cpp_exception_hash();
299
+ return Q = g[0], A = g[1], c(g[0], g[1]);
300
+ } finally {
301
+ M.__wbindgen_free(Q, A, 1);
302
+ }
290
303
  }
291
- function MA() {
304
+ function QA(Q) {
305
+ const A = j(Q, M.__wbindgen_malloc, M.__wbindgen_realloc), g = d, I = M.prefetch_urls(A, g);
306
+ var C = GA(I[0], I[1]).slice();
307
+ return M.__wbindgen_free(I[0], I[1] * 4, 4), C;
308
+ }
309
+ function LA() {
292
310
  return {
293
311
  __proto__: null,
294
312
  "./engine_bg.js": {
@@ -297,29 +315,29 @@ function MA() {
297
315
  return BigInt(A);
298
316
  },
299
317
  __wbg_Error_8c4e43fe74559d73: function(A, g) {
300
- return Error(h(A, g));
318
+ return Error(c(A, g));
301
319
  },
302
320
  __wbg_Number_04624de7d0e8332d: function(A) {
303
321
  return Number(A);
304
322
  },
305
323
  __wbg_String_8f0eb39a4a4c2f66: function(A, g) {
306
- const I = String(g), C = a(I, i.__wbindgen_malloc, i.__wbindgen_realloc), w = L;
307
- K().setInt32(A + 4, w, !0), K().setInt32(A + 0, C, !0);
324
+ const I = String(g), C = j(I, M.__wbindgen_malloc, M.__wbindgen_realloc), B = d;
325
+ s().setInt32(A + 4, B, !0), s().setInt32(A + 0, C, !0);
308
326
  },
309
327
  __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(A, g) {
310
328
  const I = g, C = typeof I == "bigint" ? I : void 0;
311
- K().setBigInt64(A + 8, J(C) ? BigInt(0) : C, !0), K().setInt32(A + 0, !J(C), !0);
329
+ s().setBigInt64(A + 8, q(C) ? BigInt(0) : C, !0), s().setInt32(A + 0, !q(C), !0);
312
330
  },
313
331
  __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(A) {
314
332
  const g = A, I = typeof g == "boolean" ? g : void 0;
315
- return J(I) ? 16777215 : I ? 1 : 0;
333
+ return q(I) ? 16777215 : I ? 1 : 0;
316
334
  },
317
335
  __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(A, g) {
318
- const I = z(g), C = a(I, i.__wbindgen_malloc, i.__wbindgen_realloc), w = L;
319
- K().setInt32(A + 4, w, !0), K().setInt32(A + 0, C, !0);
336
+ const I = _(g), C = j(I, M.__wbindgen_malloc, M.__wbindgen_realloc), B = d;
337
+ s().setInt32(A + 4, B, !0), s().setInt32(A + 0, C, !0);
320
338
  },
321
339
  __wbg___wbindgen_function_table_5ae7216dfcbcc506: function() {
322
- return i.__wbindgen_export;
340
+ return M.__wbindgen_export;
323
341
  },
324
342
  __wbg___wbindgen_in_47fa6863be6f2f25: function(A, g) {
325
343
  return A in g;
@@ -354,7 +372,7 @@ function MA() {
354
372
  },
355
373
  __wbg___wbindgen_number_get_8ff4255516ccad3e: function(A, g) {
356
374
  const I = g, C = typeof I == "number" ? I : void 0;
357
- K().setFloat64(A + 8, J(C) ? 0 : C, !0), K().setInt32(A + 0, !J(C), !0);
375
+ s().setFloat64(A + 8, q(C) ? 0 : C, !0), s().setInt32(A + 0, !q(C), !0);
358
376
  },
359
377
  __wbg___wbindgen_rethrow_05525c567f154472: function(A) {
360
378
  throw A;
@@ -364,32 +382,32 @@ function MA() {
364
382
  },
365
383
  __wbg___wbindgen_string_get_72fb696202c56729: function(A, g) {
366
384
  const I = g, C = typeof I == "string" ? I : void 0;
367
- var w = J(C) ? 0 : a(C, i.__wbindgen_malloc, i.__wbindgen_realloc), N = L;
368
- K().setInt32(A + 4, N, !0), K().setInt32(A + 0, w, !0);
385
+ var B = q(C) ? 0 : j(C, M.__wbindgen_malloc, M.__wbindgen_realloc), i = d;
386
+ s().setInt32(A + 4, i, !0), s().setInt32(A + 0, B, !0);
369
387
  },
370
388
  __wbg___wbindgen_throw_be289d5034ed271b: function(A, g) {
371
- throw new Error(h(A, g));
389
+ throw new Error(c(A, g));
372
390
  },
373
391
  __wbg__wbg_cb_unref_d9b87ff7982e3b21: function(A) {
374
392
  A._wbg_cb_unref();
375
393
  },
376
394
  __wbg_addEventListener_3acb0aad4483804c: function() {
377
- return k(function(A, g, I, C) {
378
- A.addEventListener(h(g, I), C);
395
+ return K(function(A, g, I, C) {
396
+ A.addEventListener(c(g, I), C);
379
397
  }, arguments);
380
398
  },
381
399
  __wbg_apply_2e22c45cb4f12415: function() {
382
- return k(function(A, g, I) {
400
+ return K(function(A, g, I) {
383
401
  return Reflect.apply(A, g, I);
384
402
  }, arguments);
385
403
  },
386
404
  __wbg_apply_ada2ee1a60ac7b3c: function() {
387
- return k(function(A, g, I) {
405
+ return K(function(A, g, I) {
388
406
  return A.apply(g, I);
389
407
  }, arguments);
390
408
  },
391
409
  __wbg_arrayBuffer_bb54076166006c39: function() {
392
- return k(function(A) {
410
+ return K(function(A) {
393
411
  return A.arrayBuffer();
394
412
  }, arguments);
395
413
  },
@@ -405,16 +423,24 @@ function MA() {
405
423
  __wbg_byteLength_7b03c17ff1e4037f: function(A) {
406
424
  return A.byteLength;
407
425
  },
426
+ __wbg_byteLength_b5d783d06792ed2c: function(A) {
427
+ return A.byteLength;
428
+ },
408
429
  __wbg_call_389efe28435a9388: function() {
409
- return k(function(A, g) {
430
+ return K(function(A, g) {
410
431
  return A.call(g);
411
432
  }, arguments);
412
433
  },
413
434
  __wbg_call_4708e0c13bdc8e95: function() {
414
- return k(function(A, g, I) {
435
+ return K(function(A, g, I) {
415
436
  return A.call(g, I);
416
437
  }, arguments);
417
438
  },
439
+ __wbg_compareExchange_b578410c358e695e: function() {
440
+ return K(function(A, g, I, C) {
441
+ return Atomics.compareExchange(A, g >>> 0, I, C);
442
+ }, arguments);
443
+ },
418
444
  __wbg_constructor_ad6c0ed428f55d34: function(A) {
419
445
  return A.constructor;
420
446
  },
@@ -422,7 +448,7 @@ function MA() {
422
448
  return A.crypto;
423
449
  },
424
450
  __wbg_customSections_193491b069139fb1: function(A, g, I) {
425
- return WebAssembly.Module.customSections(A, h(g, I));
451
+ return WebAssembly.Module.customSections(A, c(g, I));
426
452
  },
427
453
  __wbg_data_5330da50312d0bc1: function(A) {
428
454
  return A.data;
@@ -436,9 +462,9 @@ function MA() {
436
462
  __wbg_error_7534b8e9a36f1ab4: function(A, g) {
437
463
  let I, C;
438
464
  try {
439
- I = A, C = g, console.error(h(A, g));
465
+ I = A, C = g, console.error(c(A, g));
440
466
  } finally {
441
- i.__wbindgen_free(I, C, 1);
467
+ M.__wbindgen_free(I, C, 1);
442
468
  }
443
469
  },
444
470
  __wbg_exports_794a42000dacd046: function(A) {
@@ -448,18 +474,18 @@ function MA() {
448
474
  return A.exports;
449
475
  },
450
476
  __wbg_fetch_d1488f40cef1e210: function(A, g, I) {
451
- return A.fetch(h(g, I));
477
+ return A.fetch(c(g, I));
452
478
  },
453
479
  __wbg_from_bddd64e7d5ff6941: function(A) {
454
480
  return Array.from(A);
455
481
  },
456
482
  __wbg_getPrototypeOf_2653517f1dc884d5: function() {
457
- return k(function(A) {
483
+ return K(function(A) {
458
484
  return Reflect.getPrototypeOf(A);
459
485
  }, arguments);
460
486
  },
461
487
  __wbg_getRandomValues_b3f15fcbfabb0f8b: function() {
462
- return k(function(A, g) {
488
+ return K(function(A, g) {
463
489
  A.getRandomValues(g);
464
490
  }, arguments);
465
491
  },
@@ -473,7 +499,7 @@ function MA() {
473
499
  return A.getUint32(g >>> 0, I !== 0);
474
500
  },
475
501
  __wbg_get_7efbcc3819719b0f: function() {
476
- return k(function(A, g) {
502
+ return K(function(A, g) {
477
503
  return A.get(g >>> 0);
478
504
  }, arguments);
479
505
  },
@@ -481,7 +507,7 @@ function MA() {
481
507
  return A[g >>> 0];
482
508
  },
483
509
  __wbg_get_b3ed3ad4be2bc8ac: function() {
484
- return k(function(A, g) {
510
+ return K(function(A, g) {
485
511
  return Reflect.get(A, g);
486
512
  }, arguments);
487
513
  },
@@ -495,12 +521,12 @@ function MA() {
495
521
  return A[g];
496
522
  },
497
523
  __wbg_grow_5d42bf28c2da22cb: function() {
498
- return k(function(A, g) {
524
+ return K(function(A, g) {
499
525
  return A.grow(g >>> 0);
500
526
  }, arguments);
501
527
  },
502
528
  __wbg_grow_d034989fce14cc8e: function() {
503
- return k(function(A, g) {
529
+ return K(function(A, g) {
504
530
  return A.grow(g >>> 0);
505
531
  }, arguments);
506
532
  },
@@ -561,6 +587,15 @@ function MA() {
561
587
  }
562
588
  return g;
563
589
  },
590
+ __wbg_instanceof_Module_d0d412b14363ba9a: function(A) {
591
+ let g;
592
+ try {
593
+ g = A instanceof WebAssembly.Module;
594
+ } catch {
595
+ g = !1;
596
+ }
597
+ return g;
598
+ },
564
599
  __wbg_instanceof_Object_1c6af87502b733ed: function(A) {
565
600
  let g;
566
601
  try {
@@ -646,7 +681,7 @@ function MA() {
646
681
  return A.length;
647
682
  },
648
683
  __wbg_load_eff64ff5e429a422: function() {
649
- return k(function(A, g) {
684
+ return K(function(A, g) {
650
685
  return Atomics.load(A, g >>> 0);
651
686
  }, arguments);
652
687
  },
@@ -657,7 +692,7 @@ function MA() {
657
692
  return A.msCrypto;
658
693
  },
659
694
  __wbg_new_0728bd2d4c5d41dd: function() {
660
- return k(function(A) {
695
+ return K(function(A) {
661
696
  return new WebAssembly.Tag(A);
662
697
  }, arguments);
663
698
  },
@@ -677,17 +712,17 @@ function MA() {
677
712
  return new Array();
678
713
  },
679
714
  __wbg_new_4a996a46a82782b6: function() {
680
- return k(function(A, g) {
715
+ return K(function(A, g) {
681
716
  return new WebAssembly.Global(A, g);
682
717
  }, arguments);
683
718
  },
684
719
  __wbg_new_57c27ff3ddf5b62c: function() {
685
- return k(function(A) {
720
+ return K(function(A) {
686
721
  return new WebAssembly.Module(A);
687
722
  }, arguments);
688
723
  },
689
724
  __wbg_new_67274f72d5abea37: function() {
690
- return k(function(A) {
725
+ return K(function(A) {
691
726
  return new WebAssembly.Table(A);
692
727
  }, arguments);
693
728
  },
@@ -695,15 +730,31 @@ function MA() {
695
730
  return new Error();
696
731
  },
697
732
  __wbg_new_a4e3cab1cdd635ba: function() {
698
- return k(function(A, g) {
733
+ return K(function(A, g) {
699
734
  return new WebAssembly.Instance(A, g);
700
735
  }, arguments);
701
736
  },
702
737
  __wbg_new_b061c0550d9f3281: function() {
703
- return k(function(A) {
738
+ return K(function(A) {
704
739
  return new WebAssembly.Memory(A);
705
740
  }, arguments);
706
741
  },
742
+ __wbg_new_b5d9e2fb389fef91: function(A, g) {
743
+ try {
744
+ var I = { a: A, b: g }, C = (i, D) => {
745
+ const N = I.a;
746
+ I.a = 0;
747
+ try {
748
+ return qA(N, I.b, i, D);
749
+ } finally {
750
+ I.a = N;
751
+ }
752
+ };
753
+ return new Promise(C);
754
+ } finally {
755
+ I.a = I.b = 0;
756
+ }
757
+ },
707
758
  __wbg_new_ca409f861989e0c5: function(A) {
708
759
  return new SharedArrayBuffer(A >>> 0);
709
760
  },
@@ -714,13 +765,13 @@ function MA() {
714
765
  return new Uint8Array(A);
715
766
  },
716
767
  __wbg_new_from_slice_a3d2629dc1826784: function(A, g) {
717
- return new Uint8Array(Z(A, g));
768
+ return new Uint8Array(P(A, g));
718
769
  },
719
770
  __wbg_new_no_args_1c7c842f08d00ebb: function(A, g) {
720
- return new Function(h(A, g));
771
+ return new Function(c(A, g));
721
772
  },
722
773
  __wbg_new_with_args_7bba34e94b1cfa40: function(A, g, I, C) {
723
- return new Function(h(A, g), h(I, C));
774
+ return new Function(c(A, g), c(I, C));
724
775
  },
725
776
  __wbg_new_with_byte_offset_9120ba79e057895b: function(A, g) {
726
777
  return new Uint8Array(A, g >>> 0);
@@ -738,7 +789,7 @@ function MA() {
738
789
  return new Uint8Array(A >>> 0);
739
790
  },
740
791
  __wbg_next_3482f54c49e8af19: function() {
741
- return k(function(A) {
792
+ return K(function(A) {
742
793
  return A.next();
743
794
  }, arguments);
744
795
  },
@@ -749,7 +800,7 @@ function MA() {
749
800
  return A.node;
750
801
  },
751
802
  __wbg_notify_78a90977fab74963: function() {
752
- return k(function(A, g) {
803
+ return K(function(A, g) {
753
804
  return Atomics.notify(A, g >>> 0);
754
805
  }, arguments);
755
806
  },
@@ -759,8 +810,11 @@ function MA() {
759
810
  __wbg_now_ebffdf7e580f210d: function(A) {
760
811
  return A.now();
761
812
  },
813
+ __wbg_ok_87f537440a0acf85: function(A) {
814
+ return A.ok;
815
+ },
762
816
  __wbg_postMessage_2041f4e90af61318: function() {
763
- return k(function(A, g) {
817
+ return K(function(A, g) {
764
818
  A.postMessage(g);
765
819
  }, arguments);
766
820
  },
@@ -768,7 +822,7 @@ function MA() {
768
822
  return A.process;
769
823
  },
770
824
  __wbg_prototypesetcall_bdcdcc5842e4d77d: function(A, g, I) {
771
- Uint8Array.prototype.set.call(Z(A, g), I);
825
+ Uint8Array.prototype.set.call(P(A, g), I);
772
826
  },
773
827
  __wbg_push_8ffdcb2063340ba5: function(A, g) {
774
828
  return A.push(g);
@@ -780,23 +834,33 @@ function MA() {
780
834
  queueMicrotask(A);
781
835
  },
782
836
  __wbg_randomFillSync_f8c153b79f285817: function() {
783
- return k(function(A, g) {
837
+ return K(function(A, g) {
784
838
  A.randomFillSync(g);
785
839
  }, arguments);
786
840
  },
841
+ __wbg_removeEventListener_e63328781a5b9af9: function() {
842
+ return K(function(A, g, I, C) {
843
+ A.removeEventListener(c(g, I), C);
844
+ }, arguments);
845
+ },
787
846
  __wbg_require_b74f47fc2d022fd6: function() {
788
- return k(function() {
847
+ return K(function() {
789
848
  return module.require;
790
849
  }, arguments);
791
850
  },
792
851
  __wbg_resolve_002c4b7d9d8f6b64: function(A) {
793
852
  return Promise.resolve(A);
794
853
  },
854
+ __wbg_setTimeout_e0aacd5a637418a6: function() {
855
+ return K(function(A, g, I) {
856
+ return A.setTimeout(g, I);
857
+ }, arguments);
858
+ },
795
859
  __wbg_setUint32_d168af7751a8557e: function(A, g, I, C) {
796
860
  A.setUint32(g >>> 0, I >>> 0, C !== 0);
797
861
  },
798
862
  __wbg_set_0af2522656c2a71b: function() {
799
- return k(function(A, g, I) {
863
+ return K(function(A, g, I) {
800
864
  A.set(g >>> 0, I);
801
865
  }, arguments);
802
866
  },
@@ -810,12 +874,12 @@ function MA() {
810
874
  A[g] = I;
811
875
  },
812
876
  __wbg_set_6cb8631f80447a67: function() {
813
- return k(function(A, g, I) {
877
+ return K(function(A, g, I) {
814
878
  return Reflect.set(A, g, I);
815
879
  }, arguments);
816
880
  },
817
881
  __wbg_set_cc56eefd2dd91957: function(A, g, I) {
818
- A.set(Z(g, I));
882
+ A.set(P(g, I));
819
883
  },
820
884
  __wbg_set_f43e577aea94465b: function(A, g, I) {
821
885
  A[g >>> 0] = I;
@@ -836,27 +900,27 @@ function MA() {
836
900
  return A.slice(g >>> 0, I >>> 0);
837
901
  },
838
902
  __wbg_stack_0ed75d68575b0f3c: function(A, g) {
839
- const I = g.stack, C = a(I, i.__wbindgen_malloc, i.__wbindgen_realloc), w = L;
840
- K().setInt32(A + 4, w, !0), K().setInt32(A + 0, C, !0);
903
+ const I = g.stack, C = j(I, M.__wbindgen_malloc, M.__wbindgen_realloc), B = d;
904
+ s().setInt32(A + 4, B, !0), s().setInt32(A + 0, C, !0);
841
905
  },
842
906
  __wbg_static_accessor_GLOBAL_12837167ad935116: function() {
843
907
  const A = typeof global > "u" ? null : global;
844
- return J(A) ? 0 : p(A);
908
+ return q(A) ? 0 : t(A);
845
909
  },
846
910
  __wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
847
911
  const A = typeof globalThis > "u" ? null : globalThis;
848
- return J(A) ? 0 : p(A);
912
+ return q(A) ? 0 : t(A);
849
913
  },
850
914
  __wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
851
915
  const A = typeof self > "u" ? null : self;
852
- return J(A) ? 0 : p(A);
916
+ return q(A) ? 0 : t(A);
853
917
  },
854
918
  __wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
855
919
  const A = typeof window > "u" ? null : window;
856
- return J(A) ? 0 : p(A);
920
+ return q(A) ? 0 : t(A);
857
921
  },
858
922
  __wbg_store_d1d951c98d9bed41: function() {
859
- return k(function(A, g, I) {
923
+ return K(function(A, g, I) {
860
924
  return Atomics.store(A, g >>> 0, I);
861
925
  }, arguments);
862
926
  },
@@ -870,17 +934,17 @@ function MA() {
870
934
  return A.then(g);
871
935
  },
872
936
  __wbg_toString_56d946daff83867b: function(A, g, I) {
873
- const C = g.toString(I), w = a(C, i.__wbindgen_malloc, i.__wbindgen_realloc), N = L;
874
- K().setInt32(A + 4, N, !0), K().setInt32(A + 0, w, !0);
937
+ const C = g.toString(I), B = j(C, M.__wbindgen_malloc, M.__wbindgen_realloc), i = d;
938
+ s().setInt32(A + 4, i, !0), s().setInt32(A + 0, B, !0);
875
939
  },
876
940
  __wbg_toString_964ff7fe6eca8362: function(A) {
877
941
  return A.toString();
878
942
  },
879
943
  __wbg_trap_new: function(A) {
880
- return T.__wrap(A);
944
+ return l.__wrap(A);
881
945
  },
882
946
  __wbg_validate_71c2d02a71bda62f: function() {
883
- return k(function(A) {
947
+ return K(function(A) {
884
948
  return WebAssembly.validate(A);
885
949
  }, arguments);
886
950
  },
@@ -894,7 +958,7 @@ function MA() {
894
958
  return A.versions;
895
959
  },
896
960
  __wbg_wait_be5dae1e53f590f1: function() {
897
- return k(function(A, g, I) {
961
+ return K(function(A, g, I) {
898
962
  return Atomics.wait(A, g >>> 0, I);
899
963
  }, arguments);
900
964
  },
@@ -902,22 +966,22 @@ function MA() {
902
966
  console.warn(A, g, I);
903
967
  },
904
968
  __wbindgen_cast_0000000000000001: function(A, g) {
905
- return UA(A, g, i.wasm_bindgen_9e4ca303acbbbe7a___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_78b8e98be7a29c4d___features__gen_MessageEvent__MessageEvent____Output_______, yA);
969
+ return O(A, g, M.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___, BA);
906
970
  },
907
971
  __wbindgen_cast_0000000000000002: function(A, g) {
908
- return q(A, g, i.wasm_bindgen_9e4ca303acbbbe7a___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_78b8e98be7a29c4d___features__gen_MessageEvent__MessageEvent____Output_______, KA);
972
+ return O(A, g, M.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___, BA);
909
973
  },
910
974
  __wbindgen_cast_0000000000000003: function(A, g) {
911
- return q(A, g, i.wasm_bindgen_9e4ca303acbbbe7a___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_63fabc86795a2ba6___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_63fabc86795a2ba6___Array__wasm_bindgen_9e4ca303acbbbe7a___JsValue___, u);
975
+ return O(A, g, M.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_9eaf8169b8189500___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue___, aA);
912
976
  },
913
977
  __wbindgen_cast_0000000000000004: function(A, g) {
914
- return q(A, g, i.wasm_bindgen_9e4ca303acbbbe7a___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_63fabc86795a2ba6___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_63fabc86795a2ba6___Array__wasm_bindgen_9e4ca303acbbbe7a___JsValue___, u);
978
+ return O(A, g, M.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__FnMut__wasm_bindgen_36932265c58943ab___JsValue____Output_______, sA);
915
979
  },
916
980
  __wbindgen_cast_0000000000000005: function(A, g) {
917
- return q(A, g, i.wasm_bindgen_9e4ca303acbbbe7a___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_63fabc86795a2ba6___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_63fabc86795a2ba6___Array__wasm_bindgen_9e4ca303acbbbe7a___JsValue___, RA);
981
+ return pA(A, g, M.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent____Output_______, cA);
918
982
  },
919
983
  __wbindgen_cast_0000000000000006: function(A, g) {
920
- return q(A, g, i.wasm_bindgen_9e4ca303acbbbe7a___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__FnMut__wasm_bindgen_9e4ca303acbbbe7a___JsValue____Output_______, YA);
984
+ return O(A, g, M.wasm_bindgen_36932265c58943ab___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent____Output_______, HA);
921
985
  },
922
986
  __wbindgen_cast_0000000000000007: function(A) {
923
987
  return A;
@@ -926,10 +990,10 @@ function MA() {
926
990
  return A;
927
991
  },
928
992
  __wbindgen_cast_0000000000000009: function(A, g) {
929
- return Z(A, g);
993
+ return P(A, g);
930
994
  },
931
995
  __wbindgen_cast_000000000000000a: function(A, g) {
932
- return h(A, g);
996
+ return c(A, g);
933
997
  },
934
998
  __wbindgen_cast_000000000000000b: function(A, g) {
935
999
  return BigInt.asUintN(64, A) | BigInt.asUintN(64, g) << BigInt(64);
@@ -938,49 +1002,52 @@ function MA() {
938
1002
  return BigInt.asUintN(64, A);
939
1003
  },
940
1004
  __wbindgen_cast_000000000000000d: function(A, g) {
941
- var I = IA(A, g).slice();
942
- return i.__wbindgen_free(A, g * 4, 4), I;
1005
+ var I = GA(A, g).slice();
1006
+ return M.__wbindgen_free(A, g * 4, 4), I;
943
1007
  },
944
1008
  __wbindgen_init_externref_table: function() {
945
- const A = i.__wbindgen_externrefs, g = A.grow(4);
1009
+ const A = M.__wbindgen_externrefs, g = A.grow(4);
946
1010
  A.set(0, void 0), A.set(g + 0, void 0), A.set(g + 1, null), A.set(g + 2, !0), A.set(g + 3, !1);
947
1011
  }
948
1012
  }
949
1013
  };
950
1014
  }
951
- function yA(Q, A, g) {
952
- i.wasm_bindgen_9e4ca303acbbbe7a___convert__closures_____invoke___web_sys_78b8e98be7a29c4d___features__gen_MessageEvent__MessageEvent_____(Q, A, g);
1015
+ function sA(Q, A, g) {
1016
+ M.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___wasm_bindgen_36932265c58943ab___JsValue_____(Q, A, g);
953
1017
  }
954
- function KA(Q, A, g) {
955
- i.wasm_bindgen_9e4ca303acbbbe7a___convert__closures_____invoke___web_sys_78b8e98be7a29c4d___features__gen_MessageEvent__MessageEvent______1_(Q, A, g);
1018
+ function cA(Q, A, g) {
1019
+ M.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent_____(Q, A, g);
956
1020
  }
957
- function YA(Q, A, g) {
958
- i.wasm_bindgen_9e4ca303acbbbe7a___convert__closures_____invoke___wasm_bindgen_9e4ca303acbbbe7a___JsValue_____(Q, A, g);
1021
+ function HA(Q, A, g) {
1022
+ M.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___web_sys_ca373f7aaf47173f___features__gen_MessageEvent__MessageEvent______1_(Q, A, g);
959
1023
  }
960
- function RA(Q, A, g) {
961
- const I = i.wasm_bindgen_9e4ca303acbbbe7a___convert__closures________invoke___js_sys_63fabc86795a2ba6___Array__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_9e4ca303acbbbe7a___JsValue__(Q, A, g);
1024
+ function aA(Q, A, g) {
1025
+ const I = M.wasm_bindgen_36932265c58943ab___convert__closures________invoke___js_sys_9eaf8169b8189500___Array__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_36932265c58943ab___JsValue__(Q, A, g);
962
1026
  if (I[1])
963
- throw l(I[0]);
1027
+ throw $(I[0]);
964
1028
  }
965
- function u(Q, A, g) {
966
- const I = i.wasm_bindgen_9e4ca303acbbbe7a___convert__closures________invoke___js_sys_63fabc86795a2ba6___Array__core_37ee0ce0c4cd57d5___result__Result_js_sys_63fabc86795a2ba6___Array__wasm_bindgen_9e4ca303acbbbe7a___JsValue__(Q, A, g);
1029
+ function BA(Q, A, g) {
1030
+ const I = M.wasm_bindgen_36932265c58943ab___convert__closures________invoke___js_sys_9eaf8169b8189500___Array__core_37ee0ce0c4cd57d5___result__Result_js_sys_9eaf8169b8189500___Array__wasm_bindgen_36932265c58943ab___JsValue__(Q, A, g);
967
1031
  if (I[2])
968
- throw l(I[1]);
969
- return l(I[0]);
1032
+ throw $(I[1]);
1033
+ return $(I[0]);
1034
+ }
1035
+ function qA(Q, A, g, I) {
1036
+ M.wasm_bindgen_36932265c58943ab___convert__closures_____invoke___wasm_bindgen_36932265c58943ab___JsValue__wasm_bindgen_36932265c58943ab___JsValue_____(Q, A, g, I);
970
1037
  }
971
- const e = typeof FinalizationRegistry > "u" ? { register: () => {
1038
+ const EA = typeof FinalizationRegistry > "u" ? { register: () => {
972
1039
  }, unregister: () => {
973
- } } : new FinalizationRegistry((Q) => i.__wbg_dapadapter_free(Q >>> 0, 1)), _ = typeof FinalizationRegistry > "u" ? { register: () => {
1040
+ } } : new FinalizationRegistry((Q) => M.__wbg_dapadapter_free(Q >>> 0, 1)), DA = typeof FinalizationRegistry > "u" ? { register: () => {
974
1041
  }, unregister: () => {
975
- } } : new FinalizationRegistry((Q) => i.__wbg_trap_free(Q >>> 0, 1));
976
- function p(Q) {
977
- const A = i.__externref_table_alloc();
978
- return i.__wbindgen_externrefs.set(A, Q), A;
1042
+ } } : new FinalizationRegistry((Q) => M.__wbg_trap_free(Q >>> 0, 1));
1043
+ function t(Q) {
1044
+ const A = M.__externref_table_alloc();
1045
+ return M.__wbindgen_externrefs.set(A, Q), A;
979
1046
  }
980
- const V = typeof FinalizationRegistry > "u" ? { register: () => {
1047
+ const r = typeof FinalizationRegistry > "u" ? { register: () => {
981
1048
  }, unregister: () => {
982
1049
  } } : new FinalizationRegistry((Q) => Q.dtor(Q.a, Q.b));
983
- function z(Q) {
1050
+ function _(Q) {
984
1051
  const A = typeof Q;
985
1052
  if (A == "number" || A == "boolean" || Q == null)
986
1053
  return `${Q}`;
@@ -996,11 +1063,11 @@ function z(Q) {
996
1063
  }
997
1064
  if (Array.isArray(Q)) {
998
1065
  const C = Q.length;
999
- let w = "[";
1000
- C > 0 && (w += z(Q[0]));
1001
- for (let N = 1; N < C; N++)
1002
- w += ", " + z(Q[N]);
1003
- return w += "]", w;
1066
+ let B = "[";
1067
+ C > 0 && (B += _(Q[0]));
1068
+ for (let i = 1; i < C; i++)
1069
+ B += ", " + _(Q[i]);
1070
+ return B += "]", B;
1004
1071
  }
1005
1072
  const g = /\[object ([^\]]+)\]/.exec(toString.call(Q));
1006
1073
  let I;
@@ -1017,110 +1084,110 @@ function z(Q) {
1017
1084
  return Q instanceof Error ? `${Q.name}: ${Q.message}
1018
1085
  ${Q.stack}` : I;
1019
1086
  }
1020
- function IA(Q, A) {
1087
+ function GA(Q, A) {
1021
1088
  Q = Q >>> 0;
1022
- const g = K(), I = [];
1089
+ const g = s(), I = [];
1023
1090
  for (let C = Q; C < Q + 4 * A; C += 4)
1024
- I.push(i.__wbindgen_externrefs.get(g.getUint32(C, !0)));
1025
- return i.__externref_drop_slice(Q, A), I;
1091
+ I.push(M.__wbindgen_externrefs.get(g.getUint32(C, !0)));
1092
+ return M.__externref_drop_slice(Q, A), I;
1026
1093
  }
1027
- function Z(Q, A) {
1028
- return Q = Q >>> 0, x().subarray(Q / 1, Q / 1 + A);
1094
+ function P(Q, A) {
1095
+ return Q = Q >>> 0, V().subarray(Q / 1, Q / 1 + A);
1029
1096
  }
1030
- let c = null;
1031
- function K() {
1032
- return (c === null || c.buffer.detached === !0 || c.buffer.detached === void 0 && c.buffer !== i.memory.buffer) && (c = new DataView(i.memory.buffer)), c;
1097
+ let x = null;
1098
+ function s() {
1099
+ return (x === null || x.buffer.detached === !0 || x.buffer.detached === void 0 && x.buffer !== M.memory.buffer) && (x = new DataView(M.memory.buffer)), x;
1033
1100
  }
1034
- function h(Q, A) {
1035
- return Q = Q >>> 0, JA(Q, A);
1101
+ function c(Q, A) {
1102
+ return Q = Q >>> 0, xA(Q, A);
1036
1103
  }
1037
- let O = null;
1038
- function x() {
1039
- return (O === null || O.byteLength === 0) && (O = new Uint8Array(i.memory.buffer)), O;
1104
+ let T = null;
1105
+ function V() {
1106
+ return (T === null || T.byteLength === 0) && (T = new Uint8Array(M.memory.buffer)), T;
1040
1107
  }
1041
- function k(Q, A) {
1108
+ function K(Q, A) {
1042
1109
  try {
1043
1110
  return Q.apply(this, A);
1044
1111
  } catch (g) {
1045
- const I = p(g);
1046
- i.__wbindgen_exn_store(I);
1112
+ const I = t(g);
1113
+ M.__wbindgen_exn_store(I);
1047
1114
  }
1048
1115
  }
1049
- function J(Q) {
1116
+ function q(Q) {
1050
1117
  return Q == null;
1051
1118
  }
1052
- function UA(Q, A, g, I) {
1053
- const C = { a: Q, b: A, cnt: 1, dtor: g }, w = (...N) => {
1119
+ function pA(Q, A, g, I) {
1120
+ const C = { a: Q, b: A, cnt: 1, dtor: g }, B = (...i) => {
1054
1121
  C.cnt++;
1055
1122
  try {
1056
- return I(C.a, C.b, ...N);
1123
+ return I(C.a, C.b, ...i);
1057
1124
  } finally {
1058
- w._wbg_cb_unref();
1125
+ B._wbg_cb_unref();
1059
1126
  }
1060
1127
  };
1061
- return w._wbg_cb_unref = () => {
1062
- --C.cnt === 0 && (C.dtor(C.a, C.b), C.a = 0, V.unregister(C));
1063
- }, V.register(w, C, C), w;
1128
+ return B._wbg_cb_unref = () => {
1129
+ --C.cnt === 0 && (C.dtor(C.a, C.b), C.a = 0, r.unregister(C));
1130
+ }, r.register(B, C, C), B;
1064
1131
  }
1065
- function q(Q, A, g, I) {
1066
- const C = { a: Q, b: A, cnt: 1, dtor: g }, w = (...N) => {
1132
+ function O(Q, A, g, I) {
1133
+ const C = { a: Q, b: A, cnt: 1, dtor: g }, B = (...i) => {
1067
1134
  C.cnt++;
1068
- const M = C.a;
1135
+ const D = C.a;
1069
1136
  C.a = 0;
1070
1137
  try {
1071
- return I(M, C.b, ...N);
1138
+ return I(D, C.b, ...i);
1072
1139
  } finally {
1073
- C.a = M, w._wbg_cb_unref();
1140
+ C.a = D, B._wbg_cb_unref();
1074
1141
  }
1075
1142
  };
1076
- return w._wbg_cb_unref = () => {
1077
- --C.cnt === 0 && (C.dtor(C.a, C.b), C.a = 0, V.unregister(C));
1078
- }, V.register(w, C, C), w;
1143
+ return B._wbg_cb_unref = () => {
1144
+ --C.cnt === 0 && (C.dtor(C.a, C.b), C.a = 0, r.unregister(C));
1145
+ }, r.register(B, C, C), B;
1079
1146
  }
1080
- function a(Q, A, g) {
1147
+ function j(Q, A, g) {
1081
1148
  if (g === void 0) {
1082
- const M = d.encode(Q), Y = A(M.length, 1) >>> 0;
1083
- return x().subarray(Y, Y + M.length).set(M), L = M.length, Y;
1149
+ const D = z.encode(Q), N = A(D.length, 1) >>> 0;
1150
+ return V().subarray(N, N + D.length).set(D), d = D.length, N;
1084
1151
  }
1085
1152
  let I = Q.length, C = A(I, 1) >>> 0;
1086
- const w = x();
1087
- let N = 0;
1088
- for (; N < I; N++) {
1089
- const M = Q.charCodeAt(N);
1090
- if (M > 127) break;
1091
- w[C + N] = M;
1092
- }
1093
- if (N !== I) {
1094
- N !== 0 && (Q = Q.slice(N)), C = g(C, I, I = N + Q.length * 3, 1) >>> 0;
1095
- const M = x().subarray(C + N, C + I), Y = d.encodeInto(Q, M);
1096
- N += Y.written, C = g(C, I, N, 1) >>> 0;
1097
- }
1098
- return L = N, C;
1153
+ const B = V();
1154
+ let i = 0;
1155
+ for (; i < I; i++) {
1156
+ const D = Q.charCodeAt(i);
1157
+ if (D > 127) break;
1158
+ B[C + i] = D;
1159
+ }
1160
+ if (i !== I) {
1161
+ i !== 0 && (Q = Q.slice(i)), C = g(C, I, I = i + Q.length * 3, 1) >>> 0;
1162
+ const D = V().subarray(C + i, C + I), N = z.encodeInto(Q, D);
1163
+ i += N.written, C = g(C, I, i, 1) >>> 0;
1164
+ }
1165
+ return d = i, C;
1099
1166
  }
1100
- function l(Q) {
1101
- const A = i.__wbindgen_externrefs.get(Q);
1102
- return i.__externref_table_dealloc(Q), A;
1167
+ function $(Q) {
1168
+ const A = M.__wbindgen_externrefs.get(Q);
1169
+ return M.__externref_table_dealloc(Q), A;
1103
1170
  }
1104
- let W = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
1105
- W.decode();
1106
- const hA = 2146435072;
1107
- let P = 0;
1108
- function JA(Q, A) {
1109
- return P += A, P >= hA && (W = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }), W.decode(), P = A), W.decode(x().subarray(Q, Q + A));
1171
+ let X = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
1172
+ X.decode();
1173
+ const dA = 2146435072;
1174
+ let v = 0;
1175
+ function xA(Q, A) {
1176
+ return v += A, v >= dA && (X = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }), X.decode(), v = A), X.decode(V().subarray(Q, Q + A));
1110
1177
  }
1111
- const d = new TextEncoder();
1112
- "encodeInto" in d || (d.encodeInto = function(Q, A) {
1113
- const g = d.encode(Q);
1178
+ const z = new TextEncoder();
1179
+ "encodeInto" in z || (z.encodeInto = function(Q, A) {
1180
+ const g = z.encode(Q);
1114
1181
  return A.set(g), {
1115
1182
  read: Q.length,
1116
1183
  written: g.length
1117
1184
  };
1118
1185
  });
1119
- let L = 0, i;
1120
- function SA(Q, A) {
1121
- return i = Q.exports, c = null, O = null, i.__wbindgen_start(), i;
1186
+ let d = 0, M;
1187
+ function ZA(Q, A) {
1188
+ return M = Q.exports, x = null, T = null, M.__wbindgen_start(), M;
1122
1189
  }
1123
- async function LA(Q, A) {
1190
+ async function jA(Q, A) {
1124
1191
  if (typeof Response == "function" && Q instanceof Response) {
1125
1192
  if (typeof WebAssembly.instantiateStreaming == "function")
1126
1193
  try {
@@ -1147,16 +1214,190 @@ async function LA(Q, A) {
1147
1214
  return !1;
1148
1215
  }
1149
1216
  }
1150
- async function cA(Q) {
1151
- if (i !== void 0) return i;
1217
+ async function WA(Q) {
1218
+ if (M !== void 0) return M;
1152
1219
  Q !== void 0 && (Object.getPrototypeOf(Q) === Object.prototype ? { module_or_path: Q } = Q : console.warn("using deprecated parameters for the initialization function; pass a single object instead")), Q === void 0 && (Q = new URL("", import.meta.url));
1153
- const A = MA();
1220
+ const A = LA();
1154
1221
  (typeof Q == "string" || typeof Request == "function" && Q instanceof Request || typeof URL == "function" && Q instanceof URL) && (Q = fetch(Q));
1155
- const { instance: g, module: I } = await LA(await Q, A);
1156
- return SA(g);
1222
+ const { instance: g, module: I } = await jA(await Q, A);
1223
+ return ZA(g);
1224
+ }
1225
+ const OA = new URL("https://cdn.jsdelivr.net/npm/glassjar@0.2.1/dist/engine_bg.wasm"), tA = Object.freeze({
1226
+ maxObjectBytes: 128 * 1024 * 1024,
1227
+ maxEntries: 256,
1228
+ maxMetadataBytes: 8 * 1024 * 1024,
1229
+ maxEntryMetadataBytes: 1024 * 1024
1230
+ });
1231
+ class TA {
1232
+ records = /* @__PURE__ */ new Map();
1233
+ staged = /* @__PURE__ */ new Map();
1234
+ stagingFailed = !1;
1235
+ objectBytes = 0;
1236
+ metadataBytes = 0;
1237
+ evictions = 0;
1238
+ oversized = 0;
1239
+ limits;
1240
+ constructor(A = {}) {
1241
+ this.limits = Object.freeze({ ...tA, ...A });
1242
+ for (const g of Object.values(this.limits))
1243
+ if (!Number.isSafeInteger(g) || g < 0)
1244
+ throw new RangeError("C++ cache limits must be nonnegative safe integers");
1245
+ }
1246
+ beginBatch() {
1247
+ this.discardBatch(), this.stagingFailed = !1;
1248
+ }
1249
+ /** Stage against the same storage budget, before copying any optional object. */
1250
+ stage(A) {
1251
+ if (this.stagingFailed) return;
1252
+ const g = this.recordSize(A);
1253
+ if (g === void 0 || this.staged.has(A.source)) {
1254
+ this.failBatch();
1255
+ return;
1256
+ }
1257
+ const I = this.limits;
1258
+ for (; this.records.size && (this.records.size + this.staged.size >= I.maxEntries || this.objectBytes + A.object.byteLength > I.maxObjectBytes || this.metadataBytes + g > I.maxMetadataBytes); )
1259
+ this.remove(this.records.keys().next().value), this.evictions++;
1260
+ if (this.records.size + this.staged.size >= I.maxEntries || this.objectBytes + A.object.byteLength > I.maxObjectBytes || this.metadataBytes + g > I.maxMetadataBytes || g > I.maxEntryMetadataBytes) {
1261
+ this.oversized++, this.failBatch();
1262
+ return;
1263
+ }
1264
+ this.staged.set(A.source, {
1265
+ ...A,
1266
+ object: new Uint8Array(A.object),
1267
+ metadataBytes: g
1268
+ }), this.objectBytes += A.object.byteLength, this.metadataBytes += g;
1269
+ }
1270
+ abandonBatch() {
1271
+ this.failBatch();
1272
+ }
1273
+ failBatch() {
1274
+ this.discardBatch(), this.stagingFailed = !0;
1275
+ }
1276
+ recordSize(A) {
1277
+ if (!(typeof A.source != "string" || !A.source.startsWith("/") || A.source.split("/").slice(1).some((g) => !g || g === "." || g === "..") || typeof A.key != "string" || typeof A.object_hash != "string" || !/^[a-f0-9]{64}$/.test(A.key) || !/^[a-f0-9]{64}$/.test(A.object_hash) || A.receipt != null && typeof A.receipt != "string" || !(A.object instanceof Uint8Array)))
1278
+ return new TextEncoder().encode(
1279
+ JSON.stringify({
1280
+ source: A.source,
1281
+ key: A.key,
1282
+ object_hash: A.object_hash,
1283
+ ...A.receipt == null ? {} : { receipt: A.receipt }
1284
+ })
1285
+ ).byteLength;
1286
+ }
1287
+ async validateBatch() {
1288
+ if (this.stagingFailed) return !1;
1289
+ const A = [...this.staged.values()];
1290
+ for (const g of A) {
1291
+ if (!VA(g.object)) return !1;
1292
+ const I = await crypto.subtle.digest("SHA-256", g.object);
1293
+ if (Array.from(
1294
+ new Uint8Array(I),
1295
+ (B) => B.toString(16).padStart(2, "0")
1296
+ ).join("") !== g.object_hash) return !1;
1297
+ }
1298
+ return !0;
1299
+ }
1300
+ commitBatch() {
1301
+ for (const [A, g] of this.staged)
1302
+ this.remove(A), this.records.set(A, g);
1303
+ this.staged.clear(), this.stagingFailed = !1;
1304
+ }
1305
+ discardBatch() {
1306
+ for (const A of this.staged.values())
1307
+ this.objectBytes -= A.object.byteLength, this.metadataBytes -= A.metadataBytes;
1308
+ this.staged.clear();
1309
+ }
1310
+ snapshot() {
1311
+ return [...this.records.values()].map(({ source: A, key: g, object_hash: I, object: C, receipt: B }) => ({
1312
+ source: A,
1313
+ key: g,
1314
+ object_hash: I,
1315
+ ...B == null ? {} : { receipt: B },
1316
+ object: C.slice()
1317
+ }));
1318
+ }
1319
+ /** Worker hits are the only accesses that move an entry to the LRU tail. */
1320
+ touch(A) {
1321
+ const g = this.records.get(A);
1322
+ g && (this.records.delete(A), this.records.set(A, g));
1323
+ }
1324
+ put(A) {
1325
+ if (typeof A.source != "string" || !A.source.startsWith("/") || A.source.split("/").slice(1).some((B) => !B || B === "." || B === "..") || typeof A.key != "string" || typeof A.object_hash != "string" || !/^[a-f0-9]{64}$/.test(A.object_hash) || !/^[a-f0-9]{64}$/.test(A.key) || !(A.object instanceof Uint8Array))
1326
+ return;
1327
+ const g = this.recordSize(A);
1328
+ if (g === void 0) return;
1329
+ const I = this.limits;
1330
+ if (this.remove(A.source), I.maxEntries === 0 || A.object.byteLength > I.maxObjectBytes || g > I.maxMetadataBytes || g > I.maxEntryMetadataBytes) {
1331
+ this.oversized++;
1332
+ return;
1333
+ }
1334
+ for (; this.records.size >= I.maxEntries || this.objectBytes + A.object.byteLength > I.maxObjectBytes || this.metadataBytes + g > I.maxMetadataBytes; )
1335
+ this.remove(this.records.keys().next().value), this.evictions++;
1336
+ const C = { ...A, object: new Uint8Array(A.object), metadataBytes: g };
1337
+ this.records.set(A.source, C), this.objectBytes += C.object.byteLength, this.metadataBytes += g;
1338
+ }
1339
+ delete(A) {
1340
+ this.remove(A);
1341
+ }
1342
+ remove(A) {
1343
+ const g = this.records.get(A);
1344
+ g && (this.objectBytes -= g.object.byteLength, this.metadataBytes -= g.metadataBytes, this.records.delete(A));
1345
+ }
1346
+ clear() {
1347
+ this.records.clear(), this.staged.clear(), this.stagingFailed = !1, this.objectBytes = this.metadataBytes = 0;
1348
+ }
1349
+ stats() {
1350
+ return {
1351
+ objectBytes: this.objectBytes,
1352
+ metadataBytes: this.metadataBytes,
1353
+ entries: this.records.size,
1354
+ stagingEntries: this.staged.size,
1355
+ stagingObjectBytes: [...this.staged.values()].reduce(
1356
+ (A, g) => A + g.object.byteLength,
1357
+ 0
1358
+ ),
1359
+ stagingMetadataBytes: [...this.staged.values()].reduce(
1360
+ (A, g) => A + g.metadataBytes,
1361
+ 0
1362
+ ),
1363
+ evictions: this.evictions,
1364
+ oversized: this.oversized
1365
+ };
1366
+ }
1367
+ }
1368
+ function VA(Q) {
1369
+ if (!WebAssembly.validate(Q) || Q.length < 8) return !1;
1370
+ let A = 8, g = !1;
1371
+ const I = () => {
1372
+ let C = 0, B = 0;
1373
+ for (let i = 0; i < 5 && A < Q.length; i++, B += 7) {
1374
+ const D = Q[A++];
1375
+ if (C += (D & 127) * 2 ** B, !(D & 128)) return C;
1376
+ }
1377
+ throw new Error("Malformed object section");
1378
+ };
1379
+ try {
1380
+ for (; A < Q.length; ) {
1381
+ const C = Q[A++], B = I(), i = A + B;
1382
+ if (i > Q.length || C === 8) return !1;
1383
+ if (C === 0) {
1384
+ const D = I();
1385
+ if (A + D > i) return !1;
1386
+ const N = new TextDecoder().decode(Q.subarray(A, A + D));
1387
+ if (A += D, N === "linking") {
1388
+ if (g || I() !== 2) return !1;
1389
+ g = !0;
1390
+ }
1391
+ }
1392
+ A = i;
1393
+ }
1394
+ return g;
1395
+ } catch {
1396
+ return !1;
1397
+ }
1157
1398
  }
1158
- const sA = new URL("https://cdn.jsdelivr.net/npm/glassjar@0.1.0/dist/engine_bg.wasm"), R = /* @__PURE__ */ Symbol();
1159
- function aA(Q) {
1399
+ const U = /* @__PURE__ */ Symbol();
1400
+ function L(Q) {
1160
1401
  return Q instanceof Error ? {
1161
1402
  type: "error",
1162
1403
  error: { type: Q.constructor.name, message: Q.message }
@@ -1165,7 +1406,7 @@ function aA(Q) {
1165
1406
  error: { type: typeof Q, message: String(Q) }
1166
1407
  };
1167
1408
  }
1168
- class HA {
1409
+ class zA {
1169
1410
  name;
1170
1411
  data;
1171
1412
  constructor(A, g) {
@@ -1176,13 +1417,13 @@ class HA {
1176
1417
  C.href = I, C.download = this.name, document.body.appendChild(C), C.click(), document.body.removeChild(C), URL.revokeObjectURL(I);
1177
1418
  }
1178
1419
  }
1179
- class qA extends gA {
1420
+ class fA extends MA {
1180
1421
  /**
1181
1422
  * Access to internal properties of the debugger.
1182
1423
  * These are put under a special symbol so that they cannot be accessed by
1183
1424
  * clients of the library.
1184
1425
  */
1185
- [R];
1426
+ [U];
1186
1427
  dap;
1187
1428
  /**
1188
1429
  * Whether or not debugging is enabled.
@@ -1199,1065 +1440,710 @@ class qA extends gA {
1199
1440
  this.dap.setFilterInternals(A);
1200
1441
  }
1201
1442
  constructor() {
1202
- super(), this[R] = {
1203
- attach: this.attach.bind(this)
1204
- }, this.onMessage = this.onMessage.bind(this), this.dap = new t(), this.dap.on(this.onMessage);
1443
+ super(), this[U] = {
1444
+ attach: this.attach.bind(this),
1445
+ detach: this.detach.bind(this),
1446
+ beginRun: () => this.dap.resetRun()
1447
+ }, this.onMessage = this.onMessage.bind(this), this.dap = new e(), this.dap.on(this.onMessage);
1205
1448
  }
1206
1449
  send(A) {
1207
1450
  return this.dap.sendMessage(A);
1208
1451
  }
1452
+ artifactListener = (A) => {
1453
+ if (A.data.type !== "artifact") return;
1454
+ const g = new zA(A.data.name, new Uint8Array(A.data.data));
1455
+ this.emit("artifact", g);
1456
+ };
1209
1457
  attach(A) {
1210
- A.addEventListener("message", (g) => {
1211
- if (g.data.type !== "artifact") return;
1212
- const I = new HA(g.data.name, new Uint8Array(g.data.data));
1213
- this.emit("artifact", I);
1214
- }), this.dap.attach(A);
1458
+ A.addEventListener("message", this.artifactListener), this.dap.attach(A);
1459
+ }
1460
+ detach(A) {
1461
+ A.removeEventListener("message", this.artifactListener), this.dap.detach();
1215
1462
  }
1216
1463
  onMessage(A) {
1217
1464
  this.emit("event", A);
1218
1465
  }
1219
1466
  }
1220
- const CA = `class h {
1221
- static __wrap(A) {
1222
- A = A >>> 0;
1223
- const g = Object.create(h.prototype);
1224
- return g.__wbg_ptr = A, p.register(g, g.__wbg_ptr, g), g;
1467
+ const lA = "glassjar-wasm:";
1468
+ function bA(Q, A) {
1469
+ const g = new URL(String(Q), A);
1470
+ if (g.protocol !== "https:" && g.protocol !== "http:")
1471
+ throw new TypeError(`Engine Wasm must be served over http(s), not ${g.protocol}`);
1472
+ return g.href;
1473
+ }
1474
+ function PA(Q) {
1475
+ return new Worker(
1476
+ "" + new URL("assets/worker-BPJOu1S6.js", import.meta.url).href,
1477
+ {
1478
+ type: "module",
1479
+ name: Q?.name
1480
+ }
1481
+ );
1482
+ }
1483
+ function mA(Q) {
1484
+ return new PA(Q ? { name: lA + Q } : void 0);
1485
+ }
1486
+ const nA = "/dev/debugger-sh-host";
1487
+ class wA {
1488
+ buffer = new SharedArrayBuffer(4 + 64 * 1024);
1489
+ length = new Int32Array(this.buffer, 0, 1);
1490
+ bytes = new Uint8Array(this.buffer, 4);
1491
+ publish(A) {
1492
+ Atomics.store(this.length, 0, A), Atomics.notify(this.length, 0);
1225
1493
  }
1226
- __destroy_into_raw() {
1227
- const A = this.__wbg_ptr;
1228
- return this.__wbg_ptr = 0, p.unregister(this), A;
1494
+ }
1495
+ function AA(Q) {
1496
+ try {
1497
+ return new Error(
1498
+ `Host device callback failed: ${Q instanceof Error ? Q.message : String(Q)}`
1499
+ );
1500
+ } catch {
1501
+ return new Error("Host device callback failed");
1229
1502
  }
1230
- free() {
1231
- const A = this.__destroy_into_raw();
1232
- B.__wbg_trap_free(A, 0);
1503
+ }
1504
+ function iA(Q) {
1505
+ try {
1506
+ const A = Q?.();
1507
+ if (A && typeof A.then == "function")
1508
+ return Promise.resolve(A).catch(() => {
1509
+ }), new TypeError("Host device cleanup must be synchronous");
1510
+ } catch (A) {
1511
+ return AA(A);
1233
1512
  }
1234
- /**
1235
- * A marker method to indicate that an object is an instance of the \`Trap\`
1236
- * class.
1237
- */
1238
- static __wbg_wasmer_trap() {
1239
- B.trap___wbg_wasmer_trap();
1513
+ }
1514
+ class XA {
1515
+ constructor(A) {
1516
+ this.onFailure = A;
1517
+ }
1518
+ incoming = new wA();
1519
+ outgoing = new wA();
1520
+ workerStart = {
1521
+ guest_to_host: this.incoming.buffer,
1522
+ host_to_guest: this.outgoing.buffer
1523
+ };
1524
+ abort = new AbortController();
1525
+ listeners = /* @__PURE__ */ new Set();
1526
+ cleanup;
1527
+ worker;
1528
+ writing = !1;
1529
+ open(A) {
1530
+ let g;
1531
+ try {
1532
+ g = A({
1533
+ signal: this.abort.signal,
1534
+ onData: (I) => {
1535
+ if (this.assertOpen(), typeof I != "function")
1536
+ throw new TypeError("Host device listener must be a function");
1537
+ return this.listeners.add(I), () => {
1538
+ this.listeners.delete(I);
1539
+ };
1540
+ },
1541
+ write: (I) => this.write(I)
1542
+ });
1543
+ } catch (I) {
1544
+ throw AA(I);
1545
+ }
1546
+ if (g !== void 0 && typeof g != "function")
1547
+ throw Promise.resolve(g).catch(() => {
1548
+ }), new TypeError("Host device opener must return a cleanup function or undefined");
1549
+ if (typeof g == "function")
1550
+ if (this.abort.signal.aborted) {
1551
+ const I = iA(g);
1552
+ if (I) throw I;
1553
+ } else this.cleanup = g;
1554
+ }
1555
+ attach(A) {
1556
+ this.assertOpen(), this.worker = A, A.addEventListener("message", this.onMessage);
1557
+ }
1558
+ assertOpen() {
1559
+ if (this.abort.signal.aborted) throw new Error("Host device is closed");
1560
+ }
1561
+ async write(A) {
1562
+ if (this.assertOpen(), !(A instanceof Uint8Array))
1563
+ throw new TypeError("Host device writes require Uint8Array");
1564
+ if (this.writing) throw new Error("Await the previous host device write before writing again");
1565
+ this.writing = !0;
1566
+ try {
1567
+ const g = new Uint8Array(A), I = this.outgoing;
1568
+ let C = 0;
1569
+ for (; C < g.length; ) {
1570
+ this.assertOpen();
1571
+ const B = Atomics.load(I.length, 0);
1572
+ if (B !== 0) {
1573
+ await Atomics.waitAsync(I.length, 0, B).value;
1574
+ continue;
1575
+ }
1576
+ const i = g.subarray(C, C + I.bytes.length);
1577
+ I.bytes.set(i), I.publish(i.length), C += i.length;
1578
+ }
1579
+ } finally {
1580
+ this.writing = !1;
1581
+ }
1582
+ }
1583
+ onMessage = (A) => {
1584
+ if (!(this.abort.signal.aborted || A.data?.type !== "host_wake"))
1585
+ try {
1586
+ const g = Atomics.load(this.incoming.length, 0);
1587
+ if (g <= 0) return;
1588
+ const I = this.incoming.bytes.slice(0, g);
1589
+ this.incoming.publish(0);
1590
+ for (const C of this.listeners) {
1591
+ if (this.abort.signal.aborted) break;
1592
+ Promise.resolve(C(I)).catch((B) => this.fail(B));
1593
+ }
1594
+ } catch (g) {
1595
+ this.fail(g);
1596
+ }
1597
+ };
1598
+ fail(A) {
1599
+ this.abort.signal.aborted || (this.close(), this.onFailure(AA(A)));
1600
+ }
1601
+ close() {
1602
+ if (this.abort.signal.aborted) return;
1603
+ this.worker?.removeEventListener("message", this.onMessage), this.worker = void 0, this.incoming.publish(-1), this.outgoing.publish(-1), this.abort.abort(), this.listeners.clear();
1604
+ const A = this.cleanup;
1605
+ return this.cleanup = void 0, iA(A);
1240
1606
  }
1241
1607
  }
1242
- Symbol.dispose && (h.prototype[Symbol.dispose] = h.prototype.free);
1243
- function O() {
1244
- B.main();
1608
+ const rA = [
1609
+ "4847c7cda81eb51b1cec18fe40b396605579fe84e17eca2760702b8a9666e4e1"
1610
+ ], n = Object.freeze({
1611
+ compiler: "24fbed474c7b5b4968fd73fc4827440b93fb351c1b6264516130300eff3e7bf5",
1612
+ sysroot: "8745c6af23fd841fa507d0c73f6b6b8e8da1b4ec216a6339739a28b38ff7227b",
1613
+ exceptions: "20986166552953de0e3ca5c1e9f341e7aec8b9ba54dcb244d0d2b2f9ca843ab4"
1614
+ });
1615
+ function kA(Q = "legacy") {
1616
+ if (Q === "legacy") return { profile: Q, digests: n };
1617
+ if (Q === "stock-certified-v1" && rA.length > 0)
1618
+ return { profile: Q, digests: n };
1619
+ throw new Error(`The ${Q} toolchain is not available in this build`);
1245
1620
  }
1246
- function x() {
1247
- return {
1248
- __proto__: null,
1249
- "./engine_bg.js": {
1250
- __proto__: null,
1251
- __wbg_BigInt_b7bbccdff258c9f2: function(A) {
1252
- return BigInt(A);
1253
- },
1254
- __wbg_Error_8c4e43fe74559d73: function(A, g) {
1255
- return Error(N(A, g));
1256
- },
1257
- __wbg_Number_04624de7d0e8332d: function(A) {
1258
- return Number(A);
1259
- },
1260
- __wbg_String_8f0eb39a4a4c2f66: function(A, g) {
1261
- const I = String(g), C = K(I, B.__wbindgen_malloc, B.__wbindgen_realloc), E = k;
1262
- i().setInt32(A + 4, E, !0), i().setInt32(A + 0, C, !0);
1263
- },
1264
- __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(A, g) {
1265
- const I = g, C = typeof I == "bigint" ? I : void 0;
1266
- i().setBigInt64(A + 8, G(C) ? BigInt(0) : C, !0), i().setInt32(A + 0, !G(C), !0);
1267
- },
1268
- __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(A) {
1269
- const g = A, I = typeof g == "boolean" ? g : void 0;
1270
- return G(I) ? 16777215 : I ? 1 : 0;
1271
- },
1272
- __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(A, g) {
1273
- const I = a(g), C = K(I, B.__wbindgen_malloc, B.__wbindgen_realloc), E = k;
1274
- i().setInt32(A + 4, E, !0), i().setInt32(A + 0, C, !0);
1275
- },
1276
- __wbg___wbindgen_function_table_5ae7216dfcbcc506: function() {
1277
- return B.__wbindgen_export;
1278
- },
1279
- __wbg___wbindgen_in_47fa6863be6f2f25: function(A, g) {
1280
- return A in g;
1281
- },
1282
- __wbg___wbindgen_is_bigint_31b12575b56f32fc: function(A) {
1283
- return typeof A == "bigint";
1284
- },
1285
- __wbg___wbindgen_is_function_0095a73b8b156f76: function(A) {
1286
- return typeof A == "function";
1287
- },
1288
- __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(A) {
1289
- const g = A;
1290
- return typeof g == "object" && g !== null;
1291
- },
1292
- __wbg___wbindgen_is_string_cd444516edc5b180: function(A) {
1293
- return typeof A == "string";
1294
- },
1295
- __wbg___wbindgen_is_undefined_9e4d92534c42d778: function(A) {
1296
- return A === void 0;
1297
- },
1298
- __wbg___wbindgen_jsval_eq_11888390b0186270: function(A, g) {
1299
- return A === g;
1300
- },
1301
- __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(A, g) {
1302
- return A == g;
1303
- },
1304
- __wbg___wbindgen_lt_bb59cc3d23526e0d: function(A, g) {
1305
- return A < g;
1306
- },
1307
- __wbg___wbindgen_neg_6b4d356dff49dcc6: function(A) {
1308
- return -A;
1309
- },
1310
- __wbg___wbindgen_number_get_8ff4255516ccad3e: function(A, g) {
1311
- const I = g, C = typeof I == "number" ? I : void 0;
1312
- i().setFloat64(A + 8, G(C) ? 0 : C, !0), i().setInt32(A + 0, !G(C), !0);
1313
- },
1314
- __wbg___wbindgen_rethrow_05525c567f154472: function(A) {
1315
- throw A;
1316
- },
1317
- __wbg___wbindgen_shr_ef8e07cce709eb54: function(A, g) {
1318
- return A >> g;
1319
- },
1320
- __wbg___wbindgen_string_get_72fb696202c56729: function(A, g) {
1321
- const I = g, C = typeof I == "string" ? I : void 0;
1322
- var E = G(C) ? 0 : K(C, B.__wbindgen_malloc, B.__wbindgen_realloc), w = k;
1323
- i().setInt32(A + 4, w, !0), i().setInt32(A + 0, E, !0);
1324
- },
1325
- __wbg___wbindgen_throw_be289d5034ed271b: function(A, g) {
1326
- throw new Error(N(A, g));
1327
- },
1328
- __wbg__wbg_cb_unref_d9b87ff7982e3b21: function(A) {
1329
- A._wbg_cb_unref();
1330
- },
1331
- __wbg_addEventListener_3acb0aad4483804c: function() {
1332
- return D(function(A, g, I, C) {
1333
- A.addEventListener(N(g, I), C);
1334
- }, arguments);
1335
- },
1336
- __wbg_apply_2e22c45cb4f12415: function() {
1337
- return D(function(A, g, I) {
1338
- return Reflect.apply(A, g, I);
1339
- }, arguments);
1340
- },
1341
- __wbg_apply_ada2ee1a60ac7b3c: function() {
1342
- return D(function(A, g, I) {
1343
- return A.apply(g, I);
1344
- }, arguments);
1345
- },
1346
- __wbg_arrayBuffer_bb54076166006c39: function() {
1347
- return D(function(A) {
1348
- return A.arrayBuffer();
1349
- }, arguments);
1350
- },
1351
- __wbg_bind_1dc37de2b9939128: function(A, g, I, C) {
1352
- return A.bind(g, I, C);
1353
- },
1354
- __wbg_bind_29ba380591735d8c: function(A, g, I) {
1355
- return A.bind(g, I);
1356
- },
1357
- __wbg_buffer_7b5f53e46557d8f1: function(A) {
1358
- return A.buffer;
1359
- },
1360
- __wbg_byteLength_7b03c17ff1e4037f: function(A) {
1361
- return A.byteLength;
1362
- },
1363
- __wbg_call_389efe28435a9388: function() {
1364
- return D(function(A, g) {
1365
- return A.call(g);
1366
- }, arguments);
1367
- },
1368
- __wbg_call_4708e0c13bdc8e95: function() {
1369
- return D(function(A, g, I) {
1370
- return A.call(g, I);
1371
- }, arguments);
1372
- },
1373
- __wbg_constructor_ad6c0ed428f55d34: function(A) {
1374
- return A.constructor;
1375
- },
1376
- __wbg_crypto_86f2631e91b51511: function(A) {
1377
- return A.crypto;
1378
- },
1379
- __wbg_customSections_193491b069139fb1: function(A, g, I) {
1380
- return WebAssembly.Module.customSections(A, N(g, I));
1381
- },
1382
- __wbg_data_5330da50312d0bc1: function(A) {
1383
- return A.data;
1384
- },
1385
- __wbg_done_57b39ecd9addfe81: function(A) {
1386
- return A.done;
1387
- },
1388
- __wbg_entries_58c7934c745daac7: function(A) {
1389
- return Object.entries(A);
1390
- },
1391
- __wbg_error_7534b8e9a36f1ab4: function(A, g) {
1392
- let I, C;
1621
+ class f {
1622
+ #A;
1623
+ hashCount = 3;
1624
+ hashMs;
1625
+ constructor(A, g) {
1626
+ this.#A = A, this.hashMs = g;
1627
+ }
1628
+ static async load(A, g, I, C = n.exceptions, B = "legacy") {
1629
+ const i = kA(B);
1630
+ if (A.length !== 2) throw new Error("Missing C++ toolchain assets");
1631
+ let D;
1632
+ const N = await Promise.allSettled(
1633
+ A.map(async (Z) => {
1393
1634
  try {
1394
- I = A, C = g, console.error(N(A, g));
1395
- } finally {
1396
- B.__wbindgen_free(I, C, 1);
1635
+ const p = await fetch(Z, { cache: "force-cache", signal: I });
1636
+ if (!p.ok) throw new Error(`Cannot load C++ toolchain (${p.status})`);
1637
+ return new Uint8Array(await p.arrayBuffer());
1638
+ } catch (p) {
1639
+ throw D ??= { error: p }, p;
1397
1640
  }
1398
- },
1399
- __wbg_exports_794a42000dacd046: function(A) {
1400
- return WebAssembly.Module.exports(A);
1401
- },
1402
- __wbg_exports_86b4926134c40288: function(A) {
1403
- return A.exports;
1404
- },
1405
- __wbg_fetch_d1488f40cef1e210: function(A, g, I) {
1406
- return A.fetch(N(g, I));
1407
- },
1408
- __wbg_from_bddd64e7d5ff6941: function(A) {
1409
- return Array.from(A);
1410
- },
1411
- __wbg_getPrototypeOf_2653517f1dc884d5: function() {
1412
- return D(function(A) {
1413
- return Reflect.getPrototypeOf(A);
1414
- }, arguments);
1415
- },
1416
- __wbg_getRandomValues_b3f15fcbfabb0f8b: function() {
1417
- return D(function(A, g) {
1418
- A.getRandomValues(g);
1419
- }, arguments);
1420
- },
1421
- __wbg_getTime_1e3cd1391c5c3995: function(A) {
1422
- return A.getTime();
1423
- },
1424
- __wbg_getTimezoneOffset_81776d10a4ec18a8: function(A) {
1425
- return A.getTimezoneOffset();
1426
- },
1427
- __wbg_getUint32_bb6f5a401408e7fa: function(A, g, I) {
1428
- return A.getUint32(g >>> 0, I !== 0);
1429
- },
1430
- __wbg_get_7efbcc3819719b0f: function() {
1431
- return D(function(A, g) {
1432
- return A.get(g >>> 0);
1433
- }, arguments);
1434
- },
1435
- __wbg_get_9b94d73e6221f75c: function(A, g) {
1436
- return A[g >>> 0];
1437
- },
1438
- __wbg_get_b3ed3ad4be2bc8ac: function() {
1439
- return D(function(A, g) {
1440
- return Reflect.get(A, g);
1441
- }, arguments);
1442
- },
1443
- __wbg_get_index_253dd2a9e007656d: function(A, g) {
1444
- return A[g >>> 0];
1445
- },
1446
- __wbg_get_index_9a5bfdd2ca49c65f: function(A, g) {
1447
- return A[g >>> 0];
1448
- },
1449
- __wbg_get_with_ref_key_1dc361bd10053bfe: function(A, g) {
1450
- return A[g];
1451
- },
1452
- __wbg_grow_5d42bf28c2da22cb: function() {
1453
- return D(function(A, g) {
1454
- return A.grow(g >>> 0);
1455
- }, arguments);
1456
- },
1457
- __wbg_grow_d034989fce14cc8e: function() {
1458
- return D(function(A, g) {
1459
- return A.grow(g >>> 0);
1460
- }, arguments);
1461
- },
1462
- __wbg_imports_8333d40ab24779ad: function(A) {
1463
- return WebAssembly.Module.imports(A);
1464
- },
1465
- __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(A) {
1466
- let g;
1467
- try {
1468
- g = A instanceof ArrayBuffer;
1469
- } catch {
1470
- g = !1;
1471
- }
1472
- return g;
1473
- },
1474
- __wbg_instanceof_Error_8573fe0b0b480f46: function(A) {
1475
- let g;
1476
- try {
1477
- g = A instanceof Error;
1478
- } catch {
1479
- g = !1;
1480
- }
1481
- return g;
1482
- },
1483
- __wbg_instanceof_Function_2a29eec978bb3b11: function(A) {
1484
- let g;
1485
- try {
1486
- g = A instanceof Function;
1487
- } catch {
1488
- g = !1;
1489
- }
1490
- return g;
1491
- },
1492
- __wbg_instanceof_Global_2db767b6b2347f01: function(A) {
1493
- let g;
1494
- try {
1495
- g = A instanceof WebAssembly.Global;
1496
- } catch {
1497
- g = !1;
1498
- }
1499
- return g;
1500
- },
1501
- __wbg_instanceof_Map_53af74335dec57f4: function(A) {
1502
- let g;
1503
- try {
1504
- g = A instanceof Map;
1505
- } catch {
1506
- g = !1;
1507
- }
1508
- return g;
1509
- },
1510
- __wbg_instanceof_Memory_dc8c61e3f831ee37: function(A) {
1511
- let g;
1512
- try {
1513
- g = A instanceof WebAssembly.Memory;
1514
- } catch {
1515
- g = !1;
1516
- }
1517
- return g;
1518
- },
1519
- __wbg_instanceof_Object_1c6af87502b733ed: function(A) {
1520
- let g;
1521
- try {
1522
- g = A instanceof Object;
1523
- } catch {
1524
- g = !1;
1525
- }
1526
- return g;
1527
- },
1528
- __wbg_instanceof_RangeError_0b0dd056bc557b89: function(A) {
1529
- let g;
1530
- try {
1531
- g = A instanceof RangeError;
1532
- } catch {
1533
- g = !1;
1534
- }
1535
- return g;
1536
- },
1537
- __wbg_instanceof_Response_ee1d54d79ae41977: function(A) {
1538
- let g;
1539
- try {
1540
- g = A instanceof Response;
1541
- } catch {
1542
- g = !1;
1543
- }
1544
- return g;
1545
- },
1546
- __wbg_instanceof_SharedArrayBuffer_91d8a2fa16a2cc26: function(A) {
1547
- let g;
1548
- try {
1549
- g = A instanceof SharedArrayBuffer;
1550
- } catch {
1551
- g = !1;
1552
- }
1553
- return g;
1554
- },
1555
- __wbg_instanceof_Table_127f216e592f4159: function(A) {
1556
- let g;
1557
- try {
1558
- g = A instanceof WebAssembly.Table;
1559
- } catch {
1560
- g = !1;
1561
- }
1562
- return g;
1563
- },
1564
- __wbg_instanceof_Tag_f1d6b24a98b95210: function(A) {
1565
- let g;
1566
- try {
1567
- g = A instanceof WebAssembly.Tag;
1568
- } catch {
1569
- g = !1;
1570
- }
1571
- return g;
1572
- },
1573
- __wbg_instanceof_Uint8Array_9b9075935c74707c: function(A) {
1574
- let g;
1575
- try {
1576
- g = A instanceof Uint8Array;
1577
- } catch {
1578
- g = !1;
1579
- }
1580
- return g;
1581
- },
1582
- __wbg_isArray_d314bb98fcf08331: function(A) {
1583
- return Array.isArray(A);
1584
- },
1585
- __wbg_isSafeInteger_bfbc7332a9768d2a: function(A) {
1586
- return Number.isSafeInteger(A);
1587
- },
1588
- __wbg_is_f29129f676e5410c: function(A, g) {
1589
- return Object.is(A, g);
1590
- },
1591
- __wbg_iterator_6ff6560ca1568e55: function() {
1592
- return Symbol.iterator;
1593
- },
1594
- __wbg_length_32ed9a279acd054c: function(A) {
1595
- return A.length;
1596
- },
1597
- __wbg_length_35a7bace40f36eac: function(A) {
1598
- return A.length;
1599
- },
1600
- __wbg_length_aeb94ff17a8a8556: function(A) {
1601
- return A.length;
1602
- },
1603
- __wbg_load_eff64ff5e429a422: function() {
1604
- return D(function(A, g) {
1605
- return Atomics.load(A, g >>> 0);
1606
- }, arguments);
1607
- },
1608
- __wbg_message_9ddc4b9a62a7c379: function(A) {
1609
- return A.message;
1610
- },
1611
- __wbg_msCrypto_d562bbe83e0d4b91: function(A) {
1612
- return A.msCrypto;
1613
- },
1614
- __wbg_new_0728bd2d4c5d41dd: function() {
1615
- return D(function(A) {
1616
- return new WebAssembly.Tag(A);
1617
- }, arguments);
1618
- },
1619
- __wbg_new_0_73afc35eb544e539: function() {
1620
- return /* @__PURE__ */ new Date();
1621
- },
1622
- __wbg_new_245cd5c49157e602: function(A) {
1623
- return new Date(A);
1624
- },
1625
- __wbg_new_2ac7fa8be584d280: function(A, g, I) {
1626
- return new DataView(A, g >>> 0, I >>> 0);
1627
- },
1628
- __wbg_new_361308b2356cecd0: function() {
1629
- return new Object();
1630
- },
1631
- __wbg_new_3eb36ae241fe6f44: function() {
1632
- return new Array();
1633
- },
1634
- __wbg_new_4a996a46a82782b6: function() {
1635
- return D(function(A, g) {
1636
- return new WebAssembly.Global(A, g);
1637
- }, arguments);
1638
- },
1639
- __wbg_new_57c27ff3ddf5b62c: function() {
1640
- return D(function(A) {
1641
- return new WebAssembly.Module(A);
1642
- }, arguments);
1643
- },
1644
- __wbg_new_67274f72d5abea37: function() {
1645
- return D(function(A) {
1646
- return new WebAssembly.Table(A);
1647
- }, arguments);
1648
- },
1649
- __wbg_new_8a6f238a6ece86ea: function() {
1650
- return new Error();
1651
- },
1652
- __wbg_new_a4e3cab1cdd635ba: function() {
1653
- return D(function(A, g) {
1654
- return new WebAssembly.Instance(A, g);
1655
- }, arguments);
1656
- },
1657
- __wbg_new_b061c0550d9f3281: function() {
1658
- return D(function(A) {
1659
- return new WebAssembly.Memory(A);
1660
- }, arguments);
1661
- },
1662
- __wbg_new_ca409f861989e0c5: function(A) {
1663
- return new SharedArrayBuffer(A >>> 0);
1664
- },
1665
- __wbg_new_dca287b076112a51: function() {
1666
- return /* @__PURE__ */ new Map();
1667
- },
1668
- __wbg_new_dd2b680c8bf6ae29: function(A) {
1669
- return new Uint8Array(A);
1670
- },
1671
- __wbg_new_from_slice_a3d2629dc1826784: function(A, g) {
1672
- return new Uint8Array(S(A, g));
1673
- },
1674
- __wbg_new_no_args_1c7c842f08d00ebb: function(A, g) {
1675
- return new Function(N(A, g));
1676
- },
1677
- __wbg_new_with_args_7bba34e94b1cfa40: function(A, g, I, C) {
1678
- return new Function(N(A, g), N(I, C));
1679
- },
1680
- __wbg_new_with_byte_offset_9120ba79e057895b: function(A, g) {
1681
- return new Uint8Array(A, g >>> 0);
1682
- },
1683
- __wbg_new_with_byte_offset_and_length_aa261d9c9da49eb1: function(A, g, I) {
1684
- return new Uint8Array(A, g >>> 0, I >>> 0);
1685
- },
1686
- __wbg_new_with_byte_offset_and_length_bc2e7b72cc96d1c1: function(A, g, I) {
1687
- return new Int32Array(A, g >>> 0, I >>> 0);
1688
- },
1689
- __wbg_new_with_length_1763c527b2923202: function(A) {
1690
- return new Array(A >>> 0);
1691
- },
1692
- __wbg_new_with_length_a2c39cbe88fd8ff1: function(A) {
1693
- return new Uint8Array(A >>> 0);
1694
- },
1695
- __wbg_next_3482f54c49e8af19: function() {
1696
- return D(function(A) {
1697
- return A.next();
1698
- }, arguments);
1699
- },
1700
- __wbg_next_418f80d8f5303233: function(A) {
1701
- return A.next;
1702
- },
1703
- __wbg_node_e1f24f89a7336c2e: function(A) {
1704
- return A.node;
1705
- },
1706
- __wbg_notify_78a90977fab74963: function() {
1707
- return D(function(A, g) {
1708
- return Atomics.notify(A, g >>> 0);
1709
- }, arguments);
1710
- },
1711
- __wbg_now_a3af9a2f4bbaa4d1: function() {
1712
- return Date.now();
1713
- },
1714
- __wbg_now_ebffdf7e580f210d: function(A) {
1715
- return A.now();
1716
- },
1717
- __wbg_postMessage_2041f4e90af61318: function() {
1718
- return D(function(A, g) {
1719
- A.postMessage(g);
1720
- }, arguments);
1721
- },
1722
- __wbg_process_3975fd6c72f520aa: function(A) {
1723
- return A.process;
1724
- },
1725
- __wbg_prototypesetcall_bdcdcc5842e4d77d: function(A, g, I) {
1726
- Uint8Array.prototype.set.call(S(A, g), I);
1727
- },
1728
- __wbg_push_8ffdcb2063340ba5: function(A, g) {
1729
- return A.push(g);
1730
- },
1731
- __wbg_queueMicrotask_0aa0a927f78f5d98: function(A) {
1732
- return A.queueMicrotask;
1733
- },
1734
- __wbg_queueMicrotask_5bb536982f78a56f: function(A) {
1735
- queueMicrotask(A);
1736
- },
1737
- __wbg_randomFillSync_f8c153b79f285817: function() {
1738
- return D(function(A, g) {
1739
- A.randomFillSync(g);
1740
- }, arguments);
1741
- },
1742
- __wbg_require_b74f47fc2d022fd6: function() {
1743
- return D(function() {
1744
- return module.require;
1745
- }, arguments);
1746
- },
1747
- __wbg_resolve_002c4b7d9d8f6b64: function(A) {
1748
- return Promise.resolve(A);
1749
- },
1750
- __wbg_setUint32_d168af7751a8557e: function(A, g, I, C) {
1751
- A.setUint32(g >>> 0, I >>> 0, C !== 0);
1752
- },
1753
- __wbg_set_0af2522656c2a71b: function() {
1754
- return D(function(A, g, I) {
1755
- A.set(g >>> 0, I);
1756
- }, arguments);
1757
- },
1758
- __wbg_set_1eb0999cf5d27fc8: function(A, g, I) {
1759
- return A.set(g, I);
1760
- },
1761
- __wbg_set_25cf9deff6bf0ea8: function(A, g, I) {
1762
- A.set(g, I >>> 0);
1763
- },
1764
- __wbg_set_3f1d0b984ed272ed: function(A, g, I) {
1765
- A[g] = I;
1766
- },
1767
- __wbg_set_6cb8631f80447a67: function() {
1768
- return D(function(A, g, I) {
1769
- return Reflect.set(A, g, I);
1770
- }, arguments);
1771
- },
1772
- __wbg_set_cc56eefd2dd91957: function(A, g, I) {
1773
- A.set(S(g, I));
1774
- },
1775
- __wbg_set_f43e577aea94465b: function(A, g, I) {
1776
- A[g >>> 0] = I;
1777
- },
1778
- __wbg_set_index_b3244a6c458021e4: function(A, g, I) {
1779
- A[g >>> 0] = I;
1780
- },
1781
- __wbg_set_index_f259b54e97f7b177: function(A, g, I) {
1782
- A[g >>> 0] = I;
1783
- },
1784
- __wbg_set_onmessage_ea7cc2ba099021cd: function(A, g) {
1785
- A.onmessage = g;
1786
- },
1787
- __wbg_set_value_fc06e541de098215: function(A, g) {
1788
- A.value = g;
1789
- },
1790
- __wbg_slice_8bbd46adb2100583: function(A, g, I) {
1791
- return A.slice(g >>> 0, I >>> 0);
1792
- },
1793
- __wbg_stack_0ed75d68575b0f3c: function(A, g) {
1794
- const I = g.stack, C = K(I, B.__wbindgen_malloc, B.__wbindgen_realloc), E = k;
1795
- i().setInt32(A + 4, E, !0), i().setInt32(A + 0, C, !0);
1796
- },
1797
- __wbg_static_accessor_GLOBAL_12837167ad935116: function() {
1798
- const A = typeof global > "u" ? null : global;
1799
- return G(A) ? 0 : Y(A);
1800
- },
1801
- __wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f: function() {
1802
- const A = typeof globalThis > "u" ? null : globalThis;
1803
- return G(A) ? 0 : Y(A);
1804
- },
1805
- __wbg_static_accessor_SELF_a621d3dfbb60d0ce: function() {
1806
- const A = typeof self > "u" ? null : self;
1807
- return G(A) ? 0 : Y(A);
1808
- },
1809
- __wbg_static_accessor_WINDOW_f8727f0cf888e0bd: function() {
1810
- const A = typeof window > "u" ? null : window;
1811
- return G(A) ? 0 : Y(A);
1812
- },
1813
- __wbg_store_d1d951c98d9bed41: function() {
1814
- return D(function(A, g, I) {
1815
- return Atomics.store(A, g >>> 0, I);
1816
- }, arguments);
1817
- },
1818
- __wbg_subarray_a96e1fef17ed23cb: function(A, g, I) {
1819
- return A.subarray(g >>> 0, I >>> 0);
1820
- },
1821
- __wbg_then_0d9fe2c7b1857d32: function(A, g, I) {
1822
- return A.then(g, I);
1823
- },
1824
- __wbg_then_b9e7b3b5f1a9e1b5: function(A, g) {
1825
- return A.then(g);
1826
- },
1827
- __wbg_toString_56d946daff83867b: function(A, g, I) {
1828
- const C = g.toString(I), E = K(C, B.__wbindgen_malloc, B.__wbindgen_realloc), w = k;
1829
- i().setInt32(A + 4, w, !0), i().setInt32(A + 0, E, !0);
1830
- },
1831
- __wbg_toString_964ff7fe6eca8362: function(A) {
1832
- return A.toString();
1833
- },
1834
- __wbg_trap_new: function(A) {
1835
- return h.__wrap(A);
1836
- },
1837
- __wbg_validate_71c2d02a71bda62f: function() {
1838
- return D(function(A) {
1839
- return WebAssembly.validate(A);
1840
- }, arguments);
1841
- },
1842
- __wbg_value_0546255b415e96c1: function(A) {
1843
- return A.value;
1844
- },
1845
- __wbg_value_ce37a60e576310ff: function(A) {
1846
- return A.value;
1847
- },
1848
- __wbg_versions_4e31226f5e8dc909: function(A) {
1849
- return A.versions;
1850
- },
1851
- __wbg_wait_be5dae1e53f590f1: function() {
1852
- return D(function(A, g, I) {
1853
- return Atomics.wait(A, g >>> 0, I);
1854
- }, arguments);
1855
- },
1856
- __wbg_warn_81ab00e6e16e886d: function(A, g, I) {
1857
- console.warn(A, g, I);
1858
- },
1859
- __wbindgen_cast_0000000000000001: function(A, g) {
1860
- return V(A, g, B.wasm_bindgen_9e4ca303acbbbe7a___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_78b8e98be7a29c4d___features__gen_MessageEvent__MessageEvent____Output_______, d);
1861
- },
1862
- __wbindgen_cast_0000000000000002: function(A, g) {
1863
- return y(A, g, B.wasm_bindgen_9e4ca303acbbbe7a___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__Fn__web_sys_78b8e98be7a29c4d___features__gen_MessageEvent__MessageEvent____Output_______, T);
1864
- },
1865
- __wbindgen_cast_0000000000000003: function(A, g) {
1866
- return y(A, g, B.wasm_bindgen_9e4ca303acbbbe7a___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_63fabc86795a2ba6___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_63fabc86795a2ba6___Array__wasm_bindgen_9e4ca303acbbbe7a___JsValue___, q);
1867
- },
1868
- __wbindgen_cast_0000000000000004: function(A, g) {
1869
- return y(A, g, B.wasm_bindgen_9e4ca303acbbbe7a___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_63fabc86795a2ba6___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_63fabc86795a2ba6___Array__wasm_bindgen_9e4ca303acbbbe7a___JsValue___, q);
1870
- },
1871
- __wbindgen_cast_0000000000000005: function(A, g) {
1872
- return y(A, g, B.wasm_bindgen_9e4ca303acbbbe7a___closure__destroy___dyn_for__a__core_37ee0ce0c4cd57d5___ops__function__FnMut____a_js_sys_63fabc86795a2ba6___Array____Output___core_37ee0ce0c4cd57d5___result__Result_js_sys_63fabc86795a2ba6___Array__wasm_bindgen_9e4ca303acbbbe7a___JsValue___, Z);
1873
- },
1874
- __wbindgen_cast_0000000000000006: function(A, g) {
1875
- return y(A, g, B.wasm_bindgen_9e4ca303acbbbe7a___closure__destroy___dyn_core_37ee0ce0c4cd57d5___ops__function__FnMut__wasm_bindgen_9e4ca303acbbbe7a___JsValue____Output_______, j);
1876
- },
1877
- __wbindgen_cast_0000000000000007: function(A) {
1878
- return A;
1879
- },
1880
- __wbindgen_cast_0000000000000008: function(A) {
1881
- return A;
1882
- },
1883
- __wbindgen_cast_0000000000000009: function(A, g) {
1884
- return S(A, g);
1885
- },
1886
- __wbindgen_cast_000000000000000a: function(A, g) {
1887
- return N(A, g);
1888
- },
1889
- __wbindgen_cast_000000000000000b: function(A, g) {
1890
- return BigInt.asUintN(64, A) | BigInt.asUintN(64, g) << BigInt(64);
1891
- },
1892
- __wbindgen_cast_000000000000000c: function(A) {
1893
- return BigInt.asUintN(64, A);
1894
- },
1895
- __wbindgen_cast_000000000000000d: function(A, g) {
1896
- var I = W(A, g).slice();
1897
- return B.__wbindgen_free(A, g * 4, 4), I;
1898
- },
1899
- __wbindgen_init_externref_table: function() {
1900
- const A = B.__wbindgen_externrefs, g = A.grow(4);
1901
- A.set(0, void 0), A.set(g + 0, void 0), A.set(g + 1, null), A.set(g + 2, !0), A.set(g + 3, !1);
1902
- }
1903
- }
1904
- };
1905
- }
1906
- function d(Q, A, g) {
1907
- B.wasm_bindgen_9e4ca303acbbbe7a___convert__closures_____invoke___web_sys_78b8e98be7a29c4d___features__gen_MessageEvent__MessageEvent_____(Q, A, g);
1908
- }
1909
- function T(Q, A, g) {
1910
- B.wasm_bindgen_9e4ca303acbbbe7a___convert__closures_____invoke___web_sys_78b8e98be7a29c4d___features__gen_MessageEvent__MessageEvent______1_(Q, A, g);
1911
- }
1912
- function j(Q, A, g) {
1913
- B.wasm_bindgen_9e4ca303acbbbe7a___convert__closures_____invoke___wasm_bindgen_9e4ca303acbbbe7a___JsValue_____(Q, A, g);
1914
- }
1915
- function Z(Q, A, g) {
1916
- const I = B.wasm_bindgen_9e4ca303acbbbe7a___convert__closures________invoke___js_sys_63fabc86795a2ba6___Array__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_9e4ca303acbbbe7a___JsValue__(Q, A, g);
1917
- if (I[1])
1918
- throw H(I[0]);
1919
- }
1920
- function q(Q, A, g) {
1921
- const I = B.wasm_bindgen_9e4ca303acbbbe7a___convert__closures________invoke___js_sys_63fabc86795a2ba6___Array__core_37ee0ce0c4cd57d5___result__Result_js_sys_63fabc86795a2ba6___Array__wasm_bindgen_9e4ca303acbbbe7a___JsValue__(Q, A, g);
1922
- if (I[2])
1923
- throw H(I[1]);
1924
- return H(I[0]);
1925
- }
1926
- typeof FinalizationRegistry > "u" || new FinalizationRegistry((Q) => B.__wbg_dapadapter_free(Q >>> 0, 1));
1927
- const p = typeof FinalizationRegistry > "u" ? { register: () => {
1928
- }, unregister: () => {
1929
- } } : new FinalizationRegistry((Q) => B.__wbg_trap_free(Q >>> 0, 1));
1930
- function Y(Q) {
1931
- const A = B.__externref_table_alloc();
1932
- return B.__wbindgen_externrefs.set(A, Q), A;
1933
- }
1934
- const c = typeof FinalizationRegistry > "u" ? { register: () => {
1935
- }, unregister: () => {
1936
- } } : new FinalizationRegistry((Q) => Q.dtor(Q.a, Q.b));
1937
- function a(Q) {
1938
- const A = typeof Q;
1939
- if (A == "number" || A == "boolean" || Q == null)
1940
- return \`\${Q}\`;
1941
- if (A == "string")
1942
- return \`"\${Q}"\`;
1943
- if (A == "symbol") {
1944
- const C = Q.description;
1945
- return C == null ? "Symbol" : \`Symbol(\${C})\`;
1641
+ })
1642
+ );
1643
+ if (N[0].status === "rejected" || N[1].status === "rejected")
1644
+ throw D?.error;
1645
+ const [y, J] = [N[0].value, N[1].value], [h, Y] = await Promise.allSettled([
1646
+ f.ingestOwned(y, J, !1, C),
1647
+ g ? Promise.resolve().then(() => WebAssembly.compile(y)) : Promise.resolve(void 0)
1648
+ ]);
1649
+ if (h.status === "rejected") throw h.reason;
1650
+ const S = h.value;
1651
+ if (S.#A.compilerHash !== i.digests.compiler || S.#A.sysrootHash !== i.digests.sysroot || S.#A.exceptionsHash !== i.digests.exceptions)
1652
+ throw new Error("C++ toolchain integrity mismatch");
1653
+ if (I?.aborted) throw new DOMException("Toolchain loading aborted", "AbortError");
1654
+ if (Y.status === "rejected") throw Y.reason;
1655
+ return S.#A.stockProfile = i.profile === "stock-certified-v1", S.#A.module = Y.value, S;
1656
+ }
1657
+ /** Captures even Buffer/subclass inputs before the first asynchronous boundary. */
1658
+ static async fromBytes(A, g, I) {
1659
+ const C = new Uint8Array(A), B = new Uint8Array(g);
1660
+ return f.ingestOwned(
1661
+ C,
1662
+ B,
1663
+ I,
1664
+ n.exceptions
1665
+ );
1946
1666
  }
1947
- if (A == "function") {
1948
- const C = Q.name;
1949
- return typeof C == "string" && C.length > 0 ? \`Function(\${C})\` : "Function";
1667
+ static async ingestOwned(A, g, I, C) {
1668
+ const B = performance.now(), i = await Promise.allSettled([oA(A), oA(g)]);
1669
+ if (i[0].status === "rejected") throw i[0].reason;
1670
+ if (i[1].status === "rejected") throw i[1].reason;
1671
+ const [D, N] = [i[0].value, i[1].value], y = I ? await WebAssembly.compile(A) : void 0;
1672
+ return new f(
1673
+ { compiler: A, sysroot: g, compilerHash: D, sysrootHash: N, exceptionsHash: C, module: y },
1674
+ performance.now() - B
1675
+ );
1950
1676
  }
1951
- if (Array.isArray(Q)) {
1952
- const C = Q.length;
1953
- let E = "[";
1954
- C > 0 && (E += a(Q[0]));
1955
- for (let w = 1; w < C; w++)
1956
- E += ", " + a(Q[w]);
1957
- return E += "]", E;
1677
+ matchesExpectation(A) {
1678
+ return A.compilerSha256 === this.#A.compilerHash && A.sysrootSha256 === this.#A.sysrootHash && A.exceptionsSha256 === this.#A.exceptionsHash;
1958
1679
  }
1959
- const g = /\\[object ([^\\]]+)\\]/.exec(toString.call(Q));
1960
- let I;
1961
- if (g && g.length > 1)
1962
- I = g[1];
1963
- else
1964
- return toString.call(Q);
1965
- if (I == "Object")
1966
- try {
1967
- return "Object(" + JSON.stringify(Q) + ")";
1968
- } catch {
1969
- return "Object";
1970
- }
1971
- return Q instanceof Error ? \`\${Q.name}: \${Q.message}
1972
- \${Q.stack}\` : I;
1973
- }
1974
- function W(Q, A) {
1975
- Q = Q >>> 0;
1976
- const g = i(), I = [];
1977
- for (let C = Q; C < Q + 4 * A; C += 4)
1978
- I.push(B.__wbindgen_externrefs.get(g.getUint32(C, !0)));
1979
- return B.__externref_drop_slice(Q, A), I;
1980
- }
1981
- function S(Q, A) {
1982
- return Q = Q >>> 0, U().subarray(Q / 1, Q / 1 + A);
1983
- }
1984
- let F = null;
1985
- function i() {
1986
- return (F === null || F.buffer.detached === !0 || F.buffer.detached === void 0 && F.buffer !== B.memory.buffer) && (F = new DataView(B.memory.buffer)), F;
1987
- }
1988
- function N(Q, A) {
1989
- return Q = Q >>> 0, t(Q, A);
1990
- }
1991
- let R = null;
1992
- function U() {
1993
- return (R === null || R.byteLength === 0) && (R = new Uint8Array(B.memory.buffer)), R;
1994
- }
1995
- function D(Q, A) {
1996
- try {
1997
- return Q.apply(this, A);
1998
- } catch (g) {
1999
- const I = Y(g);
2000
- B.__wbindgen_exn_store(I);
1680
+ get identity() {
1681
+ return `${this.#A.compilerHash}:${this.#A.sysrootHash}:${this.#A.exceptionsHash}`;
2001
1682
  }
2002
- }
2003
- function G(Q) {
2004
- return Q == null;
2005
- }
2006
- function V(Q, A, g, I) {
2007
- const C = { a: Q, b: A, cnt: 1, dtor: g }, E = (...w) => {
2008
- C.cnt++;
2009
- try {
2010
- return I(C.a, C.b, ...w);
2011
- } finally {
2012
- E._wbg_cb_unref();
2013
- }
2014
- };
2015
- return E._wbg_cb_unref = () => {
2016
- --C.cnt === 0 && (C.dtor(C.a, C.b), C.a = 0, c.unregister(C));
2017
- }, c.register(E, C, C), E;
2018
- }
2019
- function y(Q, A, g, I) {
2020
- const C = { a: Q, b: A, cnt: 1, dtor: g }, E = (...w) => {
2021
- C.cnt++;
2022
- const o = C.a;
2023
- C.a = 0;
2024
- try {
2025
- return I(o, C.b, ...w);
2026
- } finally {
2027
- C.a = o, E._wbg_cb_unref();
2028
- }
2029
- };
2030
- return E._wbg_cb_unref = () => {
2031
- --C.cnt === 0 && (C.dtor(C.a, C.b), C.a = 0, c.unregister(C));
2032
- }, c.register(E, C, C), E;
2033
- }
2034
- function K(Q, A, g) {
2035
- if (g === void 0) {
2036
- const o = J.encode(Q), M = A(o.length, 1) >>> 0;
2037
- return U().subarray(M, M + o.length).set(o), k = o.length, M;
1683
+ get identityBytes() {
1684
+ return this.#A.compiler.byteLength + this.#A.sysroot.byteLength;
2038
1685
  }
2039
- let I = Q.length, C = A(I, 1) >>> 0;
2040
- const E = U();
2041
- let w = 0;
2042
- for (; w < I; w++) {
2043
- const o = Q.charCodeAt(w);
2044
- if (o > 127) break;
2045
- E[C + w] = o;
2046
- }
2047
- if (w !== I) {
2048
- w !== 0 && (Q = Q.slice(w)), C = g(C, I, I = w + Q.length * 3, 1) >>> 0;
2049
- const o = U().subarray(C + w, C + I), M = J.encodeInto(Q, o);
2050
- w += M.written, C = g(C, I, w, 1) >>> 0;
2051
- }
2052
- return k = w, C;
2053
- }
2054
- function H(Q) {
2055
- const A = B.__wbindgen_externrefs.get(Q);
2056
- return B.__externref_table_dealloc(Q), A;
2057
- }
2058
- let L = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 });
2059
- L.decode();
2060
- const P = 2146435072;
2061
- let s = 0;
2062
- function t(Q, A) {
2063
- return s += A, s >= P && (L = new TextDecoder("utf-8", { ignoreBOM: !0, fatal: !0 }), L.decode(), s = A), L.decode(U().subarray(Q, Q + A));
2064
- }
2065
- const J = new TextEncoder();
2066
- "encodeInto" in J || (J.encodeInto = function(Q, A) {
2067
- const g = J.encode(Q);
2068
- return A.set(g), {
2069
- read: Q.length,
2070
- written: g.length
2071
- };
2072
- });
2073
- let k = 0, B;
2074
- function z(Q, A) {
2075
- return B = Q.exports, F = null, R = null, B.__wbindgen_start(), B;
2076
- }
2077
- async function l(Q, A) {
2078
- if (typeof Response == "function" && Q instanceof Response) {
2079
- if (typeof WebAssembly.instantiateStreaming == "function")
2080
- try {
2081
- return await WebAssembly.instantiateStreaming(Q, A);
2082
- } catch (C) {
2083
- if (Q.ok && g(Q.type) && Q.headers.get("Content-Type") !== "application/wasm")
2084
- 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", C);
2085
- else
2086
- throw C;
2087
- }
2088
- const I = await Q.arrayBuffer();
2089
- return await WebAssembly.instantiate(I, A);
2090
- } else {
2091
- const I = await WebAssembly.instantiate(Q, A);
2092
- return I instanceof WebAssembly.Instance ? { instance: I, module: Q } : I;
1686
+ get compilerBytes() {
1687
+ return this.#A.compiler.byteLength;
2093
1688
  }
2094
- function g(I) {
2095
- switch (I) {
2096
- case "basic":
2097
- case "cors":
2098
- case "default":
2099
- return !0;
1689
+ /** postMessage clones the private seed; never transfer/detach the restart owner. */
1690
+ configure(A, g) {
1691
+ try {
1692
+ return A.postMessage({ ...g, toolchain: this.#A }), !!this.#A.module;
1693
+ } catch (I) {
1694
+ if (!(I instanceof DOMException) || I.name !== "DataCloneError" || !this.#A.module)
1695
+ throw I;
1696
+ return A.postMessage({ ...g, toolchain: { ...this.#A, module: void 0 } }), !1;
2100
1697
  }
2101
- return !1;
2102
1698
  }
2103
1699
  }
2104
- async function f(Q) {
2105
- if (B !== void 0) return B;
2106
- Q !== void 0 && (Object.getPrototypeOf(Q) === Object.prototype ? { module_or_path: Q } = Q : console.warn("using deprecated parameters for the initialization function; pass a single object instead")), Q === void 0 && (Q = new URL("", import.meta.url));
2107
- const A = x();
2108
- (typeof Q == "string" || typeof Request == "function" && Q instanceof Request || typeof URL == "function" && Q instanceof URL) && (Q = fetch(Q));
2109
- const { instance: g, module: I } = await l(await Q, A);
2110
- return z(g);
2111
- }
2112
- var X = new URL("https://cdn.jsdelivr.net/npm/glassjar@0.1.0/dist/engine_bg.wasm");
2113
- function b(Q) {
2114
- return Q instanceof Error ? {
2115
- type: "error",
2116
- error: { type: Q.constructor.name, message: Q.message }
2117
- } : {
2118
- type: "error",
2119
- error: { type: typeof Q, message: String(Q) }
2120
- };
2121
- }
2122
- try {
2123
- await f({ module_or_path: X }), O();
2124
- } catch (Q) {
2125
- postMessage({
2126
- type: "stop",
2127
- result: b(Q)
2128
- });
2129
- }
2130
- `, $ = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", CA], { type: "text/javascript;charset=utf-8" });
2131
- function pA(Q) {
2132
- let A;
2133
- try {
2134
- if (A = $ && (self.URL || self.webkitURL).createObjectURL($), !A) throw "";
2135
- const g = new Worker(A, {
2136
- type: "module",
2137
- name: Q?.name
2138
- });
2139
- return g.addEventListener("error", () => {
2140
- (self.URL || self.webkitURL).revokeObjectURL(A);
2141
- }), g;
2142
- } catch {
2143
- return new Worker(
2144
- "data:text/javascript;charset=utf-8," + encodeURIComponent(CA),
2145
- {
2146
- type: "module",
2147
- name: Q?.name
2148
- }
2149
- );
2150
- }
1700
+ async function oA(Q) {
1701
+ const A = await crypto.subtle.digest("SHA-256", Q);
1702
+ return Array.from(new Uint8Array(A), (g) => g.toString(16).padStart(2, "0")).join("");
2151
1703
  }
2152
- class QA {
2153
- stdout = new AA(1);
2154
- stderr = new AA(2);
2155
- stdin = new S();
1704
+ let u, m;
1705
+ class FA {
1706
+ stdout = new NA(1);
1707
+ stderr = new NA(2);
1708
+ stdin = new a();
2156
1709
  debugger;
2157
- /** A function which, when called, rejects the ongoing execution */
2158
- rejector;
2159
- /** The ongoing `run` promise, if any */
2160
- promise;
2161
- /**
2162
- * The programming language of this engine.
2163
- */
2164
1710
  lang;
2165
- /**
2166
- * The *initial* filesystem that the code sees.
2167
- *
2168
- * This is neither updated while the code is running, nor
2169
- * will updating it have any effect on code that is already running.
2170
- */
1711
+ scope;
2171
1712
  fs = {};
2172
- static async create(A) {
2173
- if (await cA({ module_or_path: sA }), typeof window < "u" && typeof fetch < "u")
2174
- for (const g of kA(A)) fetch(g, { cache: "force-cache" });
2175
- return new QA(A);
1713
+ binaryFiles = {};
1714
+ cppArtifacts;
1715
+ hostDevice;
1716
+ options;
1717
+ /** Absolute `EngineOptions.wasmUrl`, handed to each worker; unset uses the default. */
1718
+ wasmUrl;
1719
+ objects;
1720
+ generation = 0;
1721
+ scopeEpoch = 0;
1722
+ operationId = 0;
1723
+ disposed = !1;
1724
+ active;
1725
+ promise;
1726
+ slot;
1727
+ idleTimer;
1728
+ toolchain;
1729
+ toolchainLoading;
1730
+ toolchainController;
1731
+ initializing = /* @__PURE__ */ new Set();
1732
+ toolchainIdentity;
1733
+ toolchainIngestions = 0;
1734
+ toolchainHashCount = 0;
1735
+ toolchainHashMs = 0;
1736
+ compilerModuleCloned = !1;
1737
+ disposal;
1738
+ cancellationDraining;
1739
+ releaseDrain;
1740
+ releases = /* @__PURE__ */ new Set();
1741
+ retirements = 0;
1742
+ latest;
1743
+ cacheValidation;
1744
+ static async create(A, g = {}) {
1745
+ const { wasmUrl: I, ...C } = g, B = I === void 0 ? void 0 : bA(I, globalThis.location?.href), i = structuredClone(C), D = B ?? null;
1746
+ if (m !== void 0 && m !== D)
1747
+ throw new Error("The engine Wasm is already loaded from a different wasmUrl");
1748
+ m = D, u ??= WA({ module_or_path: B ?? OA }).catch((y) => {
1749
+ throw u = void 0, m = void 0, y;
1750
+ }), await u;
1751
+ const N = new FA(A, i);
1752
+ if (N.wasmUrl = B, A !== "c" && typeof window < "u" && typeof fetch < "u")
1753
+ for (const y of QA(A))
1754
+ fetch(y, { cache: "force-cache" }).then((J) => J.arrayBuffer()).catch(() => {
1755
+ });
1756
+ return N;
2176
1757
  }
2177
- constructor(A) {
2178
- this.debugger = new qA(), this.lang = A;
1758
+ constructor(A, g) {
1759
+ const I = g.cpp;
1760
+ if (I) {
1761
+ if (A !== "c") throw new TypeError("C++ performance options require C/C++");
1762
+ if (!I.scope?.projectId || !I.scope.accountId)
1763
+ throw new TypeError("C++ performance options require project and account identity");
1764
+ const C = I.idleTimeoutMs ?? 3e4;
1765
+ if (!Number.isSafeInteger(C) || C < 1 || C > 3e5)
1766
+ throw new RangeError("Compiler idle timeout must be between 1 and 300000 milliseconds");
1767
+ if (I.compilerLifetime !== void 0 && !["idle", "project"].includes(I.compilerLifetime))
1768
+ throw new TypeError("Invalid compiler lifetime");
1769
+ kA(I.toolchainProfile), this.scope = Object.freeze({ ...I.scope }), this.options = Object.freeze({ ...I, scope: this.scope, idleTimeoutMs: C });
1770
+ }
1771
+ this.objects = new TA(typeof I?.objectCache == "object" ? I.objectCache : {}), this.debugger = new fA(), this.lang = A;
1772
+ }
1773
+ get cacheStats() {
1774
+ return structuredClone({
1775
+ ...this.objects.stats(),
1776
+ generation: this.generation,
1777
+ scopeEpoch: this.scopeEpoch,
1778
+ operationId: this.operationId,
1779
+ cacheEpoch: this.generation,
1780
+ toolchainProfile: this.options?.toolchainProfile ?? "legacy",
1781
+ cacheEligible: this.cacheValidation?.eligible ?? !1,
1782
+ stockCertificateSha256: this.cacheValidation?.certificate,
1783
+ cacheEligibilitySnapshot: this.cacheValidation?.snapshot,
1784
+ cacheEligibilityOperationId: this.cacheValidation?.operationId,
1785
+ cacheEligibilityReason: this.cacheValidation?.reason,
1786
+ toolchainIdentityBytes: this.toolchain?.identityBytes ?? 0,
1787
+ toolchainIngestions: this.toolchainIngestions,
1788
+ toolchainHashCount: this.toolchainHashCount,
1789
+ toolchainHashMs: this.toolchainHashMs,
1790
+ compilerModuleCloned: this.compilerModuleCloned,
1791
+ workerRetained: !!this.slot && !this.active,
1792
+ workerRetirements: this.retirements,
1793
+ compilerModuleIdentityBytes: this.options?.cacheCompilerModule ? this.toolchain?.compilerBytes ?? 0 : 0,
1794
+ latest: this.active?.stats ?? this.latest
1795
+ });
2179
1796
  }
2180
- /**
2181
- * Stops the currently running execution.
2182
- */
1797
+ /** Clears all retained code/objects. An active job may finish but cannot repopulate them. */
1798
+ clearCaches() {
1799
+ this.cacheValidation = void 0, this.generation++, this.objects.clear(), this.toolchain = void 0, this.active || (this.toolchainController?.abort(), this.toolchainLoading = void 0), this.active || this.retireWorker();
1800
+ }
1801
+ /** Stops synchronously, drops retained resources, and resolves after job cleanup. */
2183
1802
  stop() {
2184
- this.rejector?.();
1803
+ return this.clearCaches(), this.cancelCurrentOperation();
1804
+ }
1805
+ /** Cancels execution without discarding committed immutable compiler resources. */
1806
+ cancelCurrentOperation() {
1807
+ if (this.cancellationDraining) return this.cancellationDraining;
1808
+ this.operationId++;
1809
+ const A = this.promise, g = this.active?.publication;
1810
+ this.retireWorker(), this.objects.discardBatch(), this.active && this.finish(this.active, { type: "stopped" });
1811
+ const I = Promise.allSettled([A, g]).then(() => {
1812
+ this.cancellationDraining === I && (this.cancellationDraining = void 0);
1813
+ });
1814
+ return this.cancellationDraining = I, I;
1815
+ }
1816
+ /** Release idle compiler resources, or defer behind an active guest without stopping it. */
1817
+ releaseCompilerResources(A = {}) {
1818
+ const g = A.signal;
1819
+ return g?.aborted ? Promise.resolve("cancelled") : this.disposed ? Promise.resolve("released") : new Promise((I) => {
1820
+ const C = { resolve: I, signal: g, abort: () => this.settleRelease(C, "cancelled") };
1821
+ this.releases.add(C), g?.addEventListener("abort", C.abort, { once: !0 }), this.flushReleases();
1822
+ });
2185
1823
  }
2186
- /**
2187
- * Runs the program. {@link CompletedResult} carries build/run timing: `timing.runMs`
2188
- * is the isolated user-program execution step, `timing.buildMs` covers toolchain fetch,
2189
- * compile, and link, and `timing.totalMs` adds host-side worker startup and teardown.
2190
- */
2191
- async run() {
2192
- if (this.promise) return this.promise;
2193
- this.promise = this.execute();
1824
+ settleRelease(A, g) {
1825
+ this.releases.delete(A) && (A.signal?.removeEventListener("abort", A.abort), A.resolve(g));
1826
+ }
1827
+ flushReleases() {
1828
+ if (!(this.active || !this.releases.size || this.releaseDrain)) {
1829
+ if (this.initializing.size) {
1830
+ this.toolchainController?.abort();
1831
+ const A = [...this.initializing];
1832
+ this.toolchainLoading = void 0, this.releaseDrain = Promise.allSettled(A).then(() => {
1833
+ this.releaseDrain = void 0, this.flushReleases();
1834
+ });
1835
+ return;
1836
+ }
1837
+ this.retireWorker(), this.toolchainController?.abort(), this.toolchain = void 0, this.toolchainLoading = void 0;
1838
+ for (const A of this.releases) this.settleRelease(A, "released");
1839
+ }
1840
+ }
1841
+ /** Permanent synchronous fence and idempotent cleanup barrier. */
1842
+ dispose() {
1843
+ if (this.disposal) return this.disposal;
1844
+ this.disposed = !0, this.scopeEpoch++, this.fs = {}, this.binaryFiles = {}, this.cppArtifacts = void 0, this.hostDevice = void 0, this.stdout.removeAllListeners(), this.stderr.removeAllListeners(), this.debugger.removeAllListeners();
1845
+ const A = [...this.initializing];
1846
+ return this.toolchainController?.abort(), this.disposal = Promise.allSettled([this.stop(), ...A]).then(() => {
1847
+ this.latest = void 0, this.flushReleases();
1848
+ }), this.disposal;
1849
+ }
1850
+ /** Load compiler resources. Optional input validation never invokes Clang, links, or runs a guest. */
1851
+ prepareCompiler(A) {
1852
+ if (A?.validateCacheInputs !== void 0 && typeof A.validateCacheInputs != "boolean")
1853
+ return Promise.resolve(L(new TypeError("Invalid compiler preparation options")));
1854
+ const g = A?.validateCacheInputs === !0 && this.options?.toolchainProfile === "stock-certified-v1" && !!this.options?.objectCache && this.objects.limits.maxEntries > 0 && this.objects.limits.maxObjectBytes > 0 && this.objects.limits.maxMetadataBytes > 0 && this.objects.limits.maxEntryMetadataBytes > 0;
1855
+ return this.submit(!0, !0, g);
1856
+ }
1857
+ /** Every Run links current objects and starts a fresh student runtime. */
1858
+ run() {
1859
+ return this.submit(!1);
1860
+ }
1861
+ /** Compiles Run-profile C++ translation units only; never links, runs, or opens devices. */
1862
+ compile() {
1863
+ return this.submit(!0);
1864
+ }
1865
+ submit(A, g = !1, I = !1) {
1866
+ if (this.disposed) return Promise.resolve(L(new Error("Engine is disposed")));
1867
+ if (this.active || this.cancellationDraining)
1868
+ return Promise.resolve(L(new Error("An engine job is already active")));
1869
+ if (A && this.lang !== "c")
1870
+ return Promise.resolve(L(new Error("Compile-only is supported for C/C++")));
1871
+ this.cacheValidation = void 0;
1872
+ const C = g && !I;
1873
+ let B;
2194
1874
  try {
2195
- return await this.promise;
2196
- } finally {
2197
- this.promise = void 0;
1875
+ const Y = C || !this.cppArtifacts ? null : { ...this.cppArtifacts };
1876
+ if (Y?.cacheCertificate !== void 0) {
1877
+ const S = Y.cacheCertificate;
1878
+ (typeof S != "string" || S.length > 1024 * 1024 || new TextEncoder().encode(S).byteLength > 1024 * 1024) && delete Y.cacheCertificate;
1879
+ }
1880
+ B = {
1881
+ fs: C ? {} : structuredClone(this.fs),
1882
+ binary_files: Object.fromEntries(
1883
+ Object.entries(C ? {} : this.binaryFiles).map(([S, Z]) => [
1884
+ S,
1885
+ new Uint8Array(Z)
1886
+ ])
1887
+ ),
1888
+ cpp_artifacts: structuredClone(Y)
1889
+ };
1890
+ } catch (Y) {
1891
+ return Promise.resolve(L(Y));
1892
+ }
1893
+ const i = !A && this.debugger.enabled, D = A ? void 0 : this.hostDevice;
1894
+ if (D !== void 0 && (typeof D != "function" || !["c", "python"].includes(this.lang)))
1895
+ return Promise.resolve(L(new TypeError("Invalid host device configuration")));
1896
+ clearTimeout(this.idleTimer), i && this.retireWorker(), this.stdin[U].clear();
1897
+ const N = !!this.slot;
1898
+ let y;
1899
+ const J = new Promise((Y) => {
1900
+ y = Y;
1901
+ });
1902
+ this.promise = J;
1903
+ const h = {
1904
+ generation: this.generation,
1905
+ scopeEpoch: this.scopeEpoch,
1906
+ operationId: ++this.operationId,
1907
+ cacheEpoch: this.generation,
1908
+ prepareOnly: g,
1909
+ validateCacheInputs: I,
1910
+ settled: !1,
1911
+ buildOnly: A,
1912
+ debug: i,
1913
+ opener: D,
1914
+ startedAt: performance.now(),
1915
+ resolve: y,
1916
+ stats: {
1917
+ operation: g ? "prepare_compiler" : A ? "compile" : "run",
1918
+ workerReadyMs: 0,
1919
+ workerReused: N
1920
+ },
1921
+ start: {
1922
+ ...B,
1923
+ lang: this.lang,
1924
+ prepare_compiler: g,
1925
+ validate_cache_inputs: I,
1926
+ scope_epoch: this.scopeEpoch,
1927
+ operation_id: this.operationId,
1928
+ cache_epoch: this.generation,
1929
+ is_debug: i,
1930
+ build_only: A,
1931
+ stdin_buffer: this.stdin[U].buffer,
1932
+ cpp_cache: this.options?.objectCache && !i && !g ? {
1933
+ generation: this.generation,
1934
+ entries: this.objects.snapshot(),
1935
+ max_entry_metadata_bytes: Math.min(
1936
+ this.objects.limits.maxEntryMetadataBytes,
1937
+ this.objects.limits.maxMetadataBytes,
1938
+ 1024 * 1024
1939
+ )
1940
+ } : null
1941
+ }
1942
+ };
1943
+ this.objects.beginBatch(), this.active = h;
1944
+ try {
1945
+ if (this.slot || this.makeWorker(), !this.current(h)) return J;
1946
+ const Y = this.slot;
1947
+ this.lang === "c" && !this.toolchain && this.ensureToolchain().catch((S) => {
1948
+ this.current(h) && this.slot === Y && this.finish(h, L(S));
1949
+ }), this.slot.ready && this.dispatch(h);
1950
+ } catch (Y) {
1951
+ this.finish(h, L(Y));
2198
1952
  }
1953
+ return J;
1954
+ }
1955
+ current(A) {
1956
+ return this.active === A && !A.settled;
1957
+ }
1958
+ makeWorker() {
1959
+ const A = mA(this.wasmUrl), g = { worker: A, ready: !1, remove: () => {
1960
+ } };
1961
+ this.slot = g;
1962
+ const I = (i) => {
1963
+ if (this.slot !== g) return;
1964
+ const D = i.data, N = this.active;
1965
+ if (D.type === "ready") {
1966
+ if (g.ready) return;
1967
+ g.ready = !0, N && this.current(N) && this.dispatch(N);
1968
+ return;
1969
+ }
1970
+ if (!(!N || !this.current(N))) {
1971
+ if (!g.ready && D.type === "error") {
1972
+ this.finish(N, L(new Error(D.message)));
1973
+ return;
1974
+ }
1975
+ if (!(D.operationId !== N.operationId || D.scopeEpoch !== N.scopeEpoch))
1976
+ try {
1977
+ if (D.type === "cpp_cache_eligibility") {
1978
+ if (this.options?.toolchainProfile !== "stock-certified-v1" || N.prepareOnly && !N.validateCacheInputs)
1979
+ return;
1980
+ const y = (h) => typeof h == "string" && /^[0-9a-f]{64}$/.test(h), J = D.eligible === !0 && y(D.certificate_sha256) && y(D.snapshot);
1981
+ this.cacheValidation = {
1982
+ eligible: J,
1983
+ certificate: y(D.certificate_sha256) ? D.certificate_sha256 : void 0,
1984
+ snapshot: J ? D.snapshot : void 0,
1985
+ operationId: N.operationId,
1986
+ reason: J ? void 0 : typeof D.reason == "string" ? D.reason.slice(0, 128) : "stock-input-validation"
1987
+ };
1988
+ } else if (D.type === "stop")
1989
+ this.finish(N, {
1990
+ type: "completed",
1991
+ exitCode: D.exit_code,
1992
+ timing: {
1993
+ totalMs: performance.now() - N.startedAt,
1994
+ buildMs: D.build_ms,
1995
+ runMs: D.run_ms
1996
+ }
1997
+ });
1998
+ else if (D.type === "error")
1999
+ this.finish(N, L(new Error(D.message)));
2000
+ else if (D.type === "cpp_cache_object" && D.generation === this.generation && N.generation === this.generation)
2001
+ try {
2002
+ this.objects.stage(D);
2003
+ } catch {
2004
+ this.objects.abandonBatch();
2005
+ }
2006
+ else D.type === "cpp_cache_stats" && D.generation === N.generation ? N.stats.cache = D.stats : D.type === "cpp_cache_abandon" ? this.objects.abandonBatch() : D.type === "object_build_complete" ? N.publication ??= this.publishObjects(N, g) : D.type === "compiler_module_stats" && (N.stats.compilerModule = D);
2007
+ } catch (y) {
2008
+ this.finish(N, L(y));
2009
+ }
2010
+ }
2011
+ }, C = (i) => {
2012
+ this.slot === g && (this.clearCaches(), this.active ? this.finish(this.active, L(i.error ?? new Error(i.message))) : this.retireWorker());
2013
+ }, B = () => C({ message: "Unreadable execution worker message" });
2014
+ this.debugger[U].attach(A), A.addEventListener("message", I), A.addEventListener("error", C), A.addEventListener("messageerror", B), g.remove = () => {
2015
+ A.removeEventListener("message", I), A.removeEventListener("error", C), A.removeEventListener("messageerror", B), this.debugger[U].detach(A);
2016
+ };
2199
2017
  }
2200
- async execute() {
2201
- const A = performance.now(), g = new pA();
2202
- this.stdout[R].attach(g), this.stderr[R].attach(g), this.debugger[R].attach(g);
2018
+ async publishObjects(A, g) {
2019
+ let I = !1;
2203
2020
  try {
2204
- return await new Promise(async (I, C) => {
2205
- this.rejector = () => C("stopped"), g.addEventListener("error", (N) => C(N.error)), await new Promise((N) => {
2206
- const M = (Y) => {
2207
- Y.data.type === "ready" && (g.removeEventListener("message", M), N());
2208
- };
2209
- g.addEventListener("message", M);
2210
- }), g.addEventListener("message", (N) => {
2211
- N.data.type === "stop" ? I({
2212
- type: "completed",
2213
- exitCode: N.data.exit_code,
2214
- timing: {
2215
- totalMs: performance.now() - A,
2216
- buildMs: N.data.build_ms,
2217
- runMs: N.data.run_ms
2218
- }
2219
- }) : N.data.type === "error" && I({
2220
- type: "error",
2221
- error: { type: "EngineError", message: N.data.message }
2222
- });
2021
+ I = await this.objects.validateBatch();
2022
+ } catch {
2023
+ }
2024
+ if (!(!this.current(A) || this.slot !== g)) {
2025
+ try {
2026
+ I && A.cacheEpoch === this.generation ? this.objects.commitBatch() : (this.objects.abandonBatch(), this.cacheValidation?.operationId === A.operationId && (this.cacheValidation = {
2027
+ ...this.cacheValidation,
2028
+ eligible: !1,
2029
+ snapshot: void 0,
2030
+ reason: "stock-publication-budget-or-validation"
2031
+ }));
2032
+ } catch {
2033
+ this.objects.clear(), this.cacheValidation?.operationId === A.operationId && (this.cacheValidation = {
2034
+ ...this.cacheValidation,
2035
+ eligible: !1,
2036
+ snapshot: void 0,
2037
+ reason: "stock-publication-failure"
2223
2038
  });
2224
- const w = {
2225
- fs: this.fs,
2226
- lang: this.lang,
2227
- stdin_buffer: this.stdin[R].buffer,
2228
- is_debug: this.debugger.enabled
2229
- };
2230
- g.postMessage(w);
2039
+ }
2040
+ this.current(A) && g.worker.postMessage({
2041
+ type: "object_build_ack",
2042
+ scopeEpoch: A.scopeEpoch,
2043
+ operationId: A.operationId,
2044
+ cacheEpoch: A.cacheEpoch
2231
2045
  });
2232
- } catch (I) {
2233
- return I === "stopped" ? { type: "stopped" } : aA(I);
2234
- } finally {
2235
- this.rejector = void 0, this.stdout[R].detach(g), this.stderr[R].detach(g), this.stdin[R].clear(), g.terminate();
2236
2046
  }
2237
2047
  }
2048
+ ensureToolchain() {
2049
+ if (this.toolchain) return Promise.resolve(this.toolchain);
2050
+ if (this.toolchainLoading) return this.toolchainLoading;
2051
+ this.toolchainController = new AbortController();
2052
+ const A = f.load(
2053
+ QA("c"),
2054
+ !!this.options?.cacheCompilerModule,
2055
+ this.toolchainController.signal,
2056
+ hA(),
2057
+ this.options?.toolchainProfile
2058
+ );
2059
+ return this.toolchainLoading = A, this.initializing.add(A), A.then(
2060
+ () => this.initializing.delete(A),
2061
+ () => {
2062
+ this.initializing.delete(A), this.toolchainLoading === A && (this.toolchainLoading = void 0);
2063
+ }
2064
+ ), A;
2065
+ }
2066
+ async dispatch(A) {
2067
+ const g = this.slot;
2068
+ if (!(!this.current(A) || !g))
2069
+ try {
2070
+ if (this.lang === "c") {
2071
+ const B = this.scopeEpoch, i = this.generation, D = this.ensureToolchain(), N = this.toolchain ?? await D;
2072
+ if (!this.current(A) || this.slot !== g || B !== this.scopeEpoch) return;
2073
+ const y = A.start.cpp_artifacts?.requiredToolchain;
2074
+ if (y && !N.matchesExpectation(y)) {
2075
+ this.finish(A, {
2076
+ type: "error",
2077
+ error: {
2078
+ type: "artifact-toolchain-integrity",
2079
+ message: "C++ artifacts require a different compiler, sysroot, or exception runtime"
2080
+ }
2081
+ });
2082
+ return;
2083
+ }
2084
+ i === this.generation && (this.toolchainIdentity && this.toolchainIdentity !== N.identity && (this.objects.clear(), A.start.cpp_cache = null), this.toolchain !== N && (this.toolchainIngestions++, this.toolchainHashCount += N.hashCount, this.toolchainHashMs += N.hashMs), this.toolchainIdentity = N.identity, this.toolchain = N, this.toolchainLoading === D && (this.toolchainLoading = void 0)), g.toolchain !== N && (this.compilerModuleCloned = N.configure(g.worker, {
2085
+ type: "configure_cpp",
2086
+ cacheCompilerModule: !!this.options?.cacheCompilerModule
2087
+ }), g.toolchain = N);
2088
+ }
2089
+ if (!this.current(A) || this.slot !== g) return;
2090
+ const I = g.worker;
2091
+ A.stats.workerReadyMs = performance.now() - A.startedAt;
2092
+ const C = (B) => this.current(A) && B.scopeEpoch === A.scopeEpoch && B.operationId === A.operationId;
2093
+ if (this.stdout[U].attach(I, C), this.stderr[U].attach(I, C), A.prepareOnly || this.debugger[U].beginRun(), A.opener) {
2094
+ if (A.device = new XA((B) => this.finish(A, L(B))), A.device.attach(I), A.device.open(A.opener), !this.current(A)) return;
2095
+ A.start.host_device = A.device.workerStart;
2096
+ }
2097
+ this.current(A) && (I.postMessage(A.start), A.start.fs = {}, A.start.binary_files = {}, A.start.cpp_artifacts = null, A.start.cpp_cache = null);
2098
+ } catch (I) {
2099
+ this.current(A) && (this.toolchainLoading = void 0, this.finish(A, L(I)));
2100
+ }
2101
+ }
2102
+ finish(A, g) {
2103
+ if (!this.current(A)) return;
2104
+ (g.type !== "completed" || g.exitCode !== 0) && (this.cacheValidation = void 0), A.settled = !0;
2105
+ const I = this.slot?.worker;
2106
+ I && (this.stdout[U].detach(I), this.stderr[U].detach(I));
2107
+ const C = A.device?.close();
2108
+ C && (g = L(C));
2109
+ const B = g.type === "completed" && g.exitCode === 0 && !A.debug && A.generation === this.generation && !this.disposed;
2110
+ if (A.generation === this.generation)
2111
+ for (const i of A.stats.cache?.invalid_sources ?? []) this.objects.delete(i);
2112
+ if (B)
2113
+ for (const i of A.stats.cache?.hit_sources ?? []) this.objects.touch(i);
2114
+ this.objects.discardBatch(), this.latest = A.stats, this.stdin[U].clear(), (!B || !this.options?.retainWorker || this.lang !== "c") && this.retireWorker(), !this.disposed && A.cacheEpoch === this.generation && this.toolchain && this.options?.compilerLifetime !== "project" && (this.options?.retainWorker || this.options?.cacheCompilerModule) && (this.idleTimer = setTimeout(() => {
2115
+ this.retireWorker(), this.toolchain = void 0, this.toolchainLoading = void 0;
2116
+ }, this.options.idleTimeoutMs)), !this.options?.retainWorker && !this.options?.cacheCompilerModule && (this.toolchain = void 0), A.cacheEpoch !== this.generation && (this.toolchainController?.abort(), this.toolchainLoading = void 0), this.active = void 0, this.promise = void 0, this.flushReleases(), A.resolve(g);
2117
+ }
2118
+ retireWorker() {
2119
+ clearTimeout(this.idleTimer);
2120
+ const A = this.slot;
2121
+ A && (this.slot = void 0, A.remove(), this.stdout[U].detach(A.worker), this.stderr[U].detach(A.worker), A.worker.onerror = (g) => g.preventDefault(), A.worker.terminate(), this.retirements++);
2122
+ }
2238
2123
  }
2239
- class AA extends gA {
2124
+ class NA extends MA {
2240
2125
  constructor(A) {
2241
2126
  super(), this.mode = A, this.callback = ((g) => {
2242
2127
  const I = g.data;
2243
- if (I.type !== "stdout" || I.mode !== this.mode) return;
2128
+ if (this.accepts && !this.accepts(I) || I.type !== "stdout" || I.mode !== this.mode) return;
2244
2129
  const C = I.data;
2245
2130
  this.emit("data", C);
2246
- }).bind(this), this[R] = {
2131
+ }).bind(this), this[U] = {
2247
2132
  attach: this.attach.bind(this),
2248
2133
  detach: this.detach.bind(this)
2249
2134
  };
2250
2135
  }
2251
2136
  callback;
2252
- [R];
2253
- attach(A) {
2254
- A.addEventListener("message", this.callback);
2137
+ accepts;
2138
+ [U];
2139
+ attach(A, g) {
2140
+ this.accepts = g, A.addEventListener("message", this.callback);
2255
2141
  }
2256
2142
  detach(A) {
2257
2143
  A.removeEventListener("message", this.callback);
2258
2144
  }
2259
2145
  }
2260
- class S {
2146
+ class a {
2261
2147
  /**
2262
2148
  * Ring buffer to store stdin data.
2263
2149
  *
@@ -2267,48 +2153,55 @@ class S {
2267
2153
  static BUFFER_SIZE = 2048;
2268
2154
  static HEADER_SIZE = 8;
2269
2155
  // 2 x i32
2270
- static DATA_SIZE = S.BUFFER_SIZE - S.HEADER_SIZE;
2156
+ static DATA_SIZE = a.BUFFER_SIZE - a.HEADER_SIZE;
2271
2157
  static READ_IDX = 0;
2272
2158
  static WRITE_IDX = 1;
2273
2159
  static encoder = new TextEncoder();
2274
- buffer = new SharedArrayBuffer(S.BUFFER_SIZE);
2160
+ buffer = new SharedArrayBuffer(a.BUFFER_SIZE);
2161
+ generation = 0;
2275
2162
  indices;
2276
2163
  data;
2277
- [R];
2164
+ [U];
2278
2165
  constructor() {
2279
- this.indices = new Int32Array(this.buffer, 0, 2), this.data = new Int8Array(this.buffer, S.HEADER_SIZE), this[R] = {
2166
+ this.indices = new Int32Array(this.buffer, 0, 2), this.data = new Int8Array(this.buffer, a.HEADER_SIZE);
2167
+ const A = () => this.buffer;
2168
+ this[U] = {
2280
2169
  clear: this.clear.bind(this),
2281
- buffer: this.buffer
2170
+ get buffer() {
2171
+ return A();
2172
+ }
2282
2173
  };
2283
2174
  }
2284
2175
  clear() {
2285
- this.indices.fill(0);
2176
+ this.generation++, Atomics.notify(this.indices, a.READ_IDX), this.buffer = new SharedArrayBuffer(a.BUFFER_SIZE), this.indices = new Int32Array(this.buffer, 0, 2), this.data = new Int8Array(this.buffer, a.HEADER_SIZE);
2286
2177
  }
2287
2178
  async write(A) {
2288
- const g = typeof A == "string" ? S.encoder.encode(A) : A;
2179
+ const g = typeof A == "string" ? a.encoder.encode(A) : A;
2289
2180
  return this.writeBytes(g);
2290
2181
  }
2291
2182
  async writeBytes(A) {
2292
- const { DATA_SIZE: g, READ_IDX: I, WRITE_IDX: C } = S;
2293
- let w = 0;
2294
- for (; w < A.length; ) {
2295
- const N = Atomics.load(this.indices, I);
2296
- let M = Atomics.load(this.indices, C);
2297
- M === g - 1 && N > 0 && (M = 0);
2298
- const Y = N <= M ? g - M - 1 : N - M - 1;
2299
- if (Y === 0) {
2300
- await Atomics.waitAsync(this.indices, I, N).value;
2183
+ const { DATA_SIZE: g, READ_IDX: I, WRITE_IDX: C } = a;
2184
+ let B = 0;
2185
+ const i = this.generation;
2186
+ for (; B < A.length && i === this.generation; ) {
2187
+ const D = Atomics.load(this.indices, I);
2188
+ let N = Atomics.load(this.indices, C);
2189
+ N === g - 1 && D > 0 && (N = 0);
2190
+ const y = D <= N ? g - N - 1 : D - N - 1;
2191
+ if (y === 0) {
2192
+ await Atomics.waitAsync(this.indices, I, D).value;
2301
2193
  continue;
2302
2194
  }
2303
- const s = Math.min(A.length - w, Y);
2304
- this.data.set(A.subarray(w, w + s), M), Atomics.store(this.indices, C, (M + s) % g), Atomics.notify(this.indices, C), w += s;
2195
+ const J = Math.min(A.length - B, y);
2196
+ this.data.set(A.subarray(B, B + J), N), Atomics.store(this.indices, C, (N + J) % g), Atomics.notify(this.indices, C), B += J;
2305
2197
  }
2306
2198
  }
2307
2199
  }
2308
2200
  export {
2309
- HA as Artifact,
2310
- qA as Debugger,
2311
- QA as Engine,
2312
- S as Stdin,
2313
- AA as Stdout
2201
+ zA as Artifact,
2202
+ fA as Debugger,
2203
+ FA as Engine,
2204
+ nA as HOST_DEVICE_PATH,
2205
+ a as Stdin,
2206
+ NA as Stdout
2314
2207
  };