@jplorg/jpl 2.1.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/main.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region \0rolldown/runtime.js
1
+ // \0rolldown/runtime.js
2
2
  var e = Object.defineProperty, t = (t, n) => {
3
3
  let r = {};
4
4
  for (var i in t) e(r, i, {
@@ -7,14 +7,12 @@ var e = Object.defineProperty, t = (t, n) => {
7
7
  });
8
8
  return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
9
9
  };
10
- //#endregion
11
- //#region lib/createSingleton.ts
10
+ // lib/createSingleton.ts
12
11
  function n(e) {
13
12
  let t;
14
13
  return () => (t ??= e(), t);
15
14
  }
16
- //#endregion
17
- //#region lib/applyDefaults.ts
15
+ // lib/applyDefaults.ts
18
16
  function r(e, t, ...n) {
19
17
  let r = (e, t, n) => {
20
18
  if (Array.isArray(e)) return e;
@@ -32,8 +30,7 @@ function r(e, t, ...n) {
32
30
  };
33
31
  return r(e, t, n.map((e) => typeof e == "string" ? e.split(".") : e));
34
32
  }
35
- //#endregion
36
- //#region lib/library/apply.ts
33
+ // lib/library/apply.ts
37
34
  function i(e, t) {
38
35
  let n = e, r = !0;
39
36
  return t.forEach((e) => {
@@ -44,9 +41,7 @@ function i(e, t) {
44
41
  let { [t]: e, ...i } = n;
45
42
  n = i, r = !1;
46
43
  } else delete n[t];
47
- return;
48
- }
49
- Object.hasOwn(n, t) && n[t] === i || (r ? (n = {
44
+ } else Object.hasOwn(n, t) && n[t] === i || (r ? (n = {
50
45
  ...n,
51
46
  [t]: i
52
47
  }, r = !1) : n[t] = i);
@@ -98,16 +93,15 @@ function o(e, t) {
98
93
  }
99
94
  return s;
100
95
  }
101
- //#endregion
102
- //#region lib/library/ops/op.ts
103
- var s = "$.", c = "and", l = "[]", u = "$=", d = "clc", f = "cmp", p = "cnt", ee = "fls", te = "nul", ne = "tru", re = "fun", ie = "if", ae = "\"$\"", oe = "neg", se = "not", ce = "??", le = "nbr", ue = "{}", de = "or", fe = ",", pe = "\"\"", me = "try", he = "var", ge = "va=", _e = "vod", ve = "$.$", ye = "$()", be = "$[]", xe = "[:]", Se = "==", Ce = ">", we = ">=", Te = "<", Ee = "<=", De = "!=", Oe = "+", ke = "/", Ae = "*", je = "%", Me = "-", Ne = "+=", Pe = "/=", Fe = "*=", Ie = "?=", Le = "%=", Re = "=", ze = "-=", Be = "|=", Ve = 1, He = 0, m = "1.0", h = class extends Error {
96
+ // lib/library/ops/op.ts
97
+ var s = "$.", c = "and", l = "[]", u = "$=", d = "clc", f = "cmp", p = "cnt", ee = "fls", te = "nul", ne = "tru", re = "fun", ie = "if", ae = "\"$\"", oe = "neg", se = "not", ce = "??", le = "nbr", ue = "{}", de = "or", fe = ",", pe = "\"\"", me = "try", he = "var", ge = "va=", _e = "vod", ve = "$.$", ye = "$()", be = "$[]", xe = "[:]", Se = "==", Ce = ">", we = ">=", Te = "<", Ee = "<=", De = "!=", Oe = "+", ke = "/", Ae = "*", je = "%", Me = "-", Ne = "+=", Pe = "/=", Fe = "*=", Ie = "?=", Le = "%=", Re = "=", ze = "-=", Be = "|=", Ve = 1, He = 0, Ue = "1.0", m = class extends Error {
104
98
  static is(e) {
105
99
  return e instanceof this;
106
100
  }
107
101
  constructor(e, t = "JPLError") {
108
102
  super(e), this.name = t;
109
103
  }
110
- }, g = class extends h {
104
+ }, h = class extends m {
111
105
  #e;
112
106
  constructor(e, t = "JPLExecutionError") {
113
107
  super(e, t), this.#e = typeof e == "string" && e ? e : null;
@@ -119,43 +113,41 @@ var s = "$.", c = "and", l = "[]", u = "$=", d = "clc", f = "cmp", p = "cnt", ee
119
113
  return this.#e;
120
114
  }
121
115
  };
122
- //#endregion
123
- //#region lib/library/errors/adaptErrors.ts
124
- function Ue(e) {
116
+ // lib/library/errors/adaptErrors.ts
117
+ function We(e) {
125
118
  try {
126
119
  return e();
127
120
  } catch (e) {
128
- throw _(e);
121
+ throw g(e);
129
122
  }
130
123
  }
131
- async function We(e) {
124
+ async function Ge(e) {
132
125
  try {
133
126
  return await e();
134
127
  } catch (e) {
135
- throw _(e);
128
+ throw g(e);
136
129
  }
137
130
  }
138
- function _(e) {
139
- return h.is(e) ? e : new g(e?.message);
131
+ function g(e) {
132
+ return m.is(e) ? e : new h(e?.message);
140
133
  }
141
- //#endregion
142
- //#region lib/library/errors/enclosure.ts
143
- var v = class extends h {
134
+ // lib/library/errors/enclosure.ts
135
+ var _ = class extends m {
144
136
  inner;
145
137
  constructor(e) {
146
138
  super(e?.toString(), "JPLErrorEnclosure"), this.inner = e;
147
139
  }
148
- }, y = class extends h {
140
+ }, v = class extends m {
149
141
  constructor(e) {
150
142
  super(e, "JPLFatalError");
151
143
  }
152
- }, b = class {
144
+ }, y = class {
153
145
  static is(e) {
154
146
  return e instanceof this;
155
147
  }
156
148
  #e;
157
149
  constructor(e) {
158
- this.#e = Ge(e);
150
+ this.#e = Ke(e);
159
151
  }
160
152
  get value() {
161
153
  return this.#e;
@@ -164,26 +156,26 @@ var v = class extends h {
164
156
  return this.#e;
165
157
  }
166
158
  async alter(e) {
167
- return x(await e(this.value));
159
+ return b(await e(this.value));
168
160
  }
169
161
  toJSON() {
170
162
  try {
171
163
  return this.json;
172
164
  } catch (e) {
173
- throw _(e);
165
+ throw g(e);
174
166
  }
175
167
  }
176
168
  };
177
- function Ge(e) {
178
- return b.is(e) ? e.value : x(e);
169
+ function Ke(e) {
170
+ return y.is(e) ? e.value : b(e);
179
171
  }
180
- function x(e) {
181
- return D(e, void 0, Ye);
172
+ function b(e) {
173
+ return T(e, void 0, Ze);
182
174
  }
183
- function S(e) {
184
- return b.is(e) ? Ue(() => e.value) : e;
175
+ function x(e) {
176
+ return y.is(e) ? We(() => e.value) : e;
185
177
  }
186
- var Ke = [
178
+ var qe = [
187
179
  "null",
188
180
  "function",
189
181
  "boolean",
@@ -192,8 +184,8 @@ var Ke = [
192
184
  "array",
193
185
  "object"
194
186
  ];
195
- function C(e) {
196
- let t = S(e);
187
+ function Je(e) {
188
+ let t = x(e);
197
189
  if (t === null) return "null";
198
190
  if (Array.isArray(t)) return "array";
199
191
  let n = typeof t;
@@ -203,37 +195,34 @@ function C(e) {
203
195
  case "number":
204
196
  case "string":
205
197
  case "object": return n;
206
- default: throw new y(`invalid type ${n} (${e})`);
198
+ default: throw new v(`invalid type ${n} (${e})`);
207
199
  }
208
200
  }
209
- function qe(e, t) {
210
- if (b.is(e)) throw new y(T("unexpected type: JPLTypes (%*<100v) are not allowed here", e));
211
- let n = C(e);
212
- if (n !== t) throw new y(T("unexpected type: %s (%*<100v) cannot be used as %s", n, e, t));
201
+ function Ye(e, t) {
202
+ if (y.is(e)) throw new v(C("unexpected type: JPLTypes (%*<100v) are not allowed here", e));
203
+ let n = Je(e);
204
+ if (n !== t) throw new v(C("unexpected type: %s (%*<100v) cannot be used as %s", n, e, t));
213
205
  return e;
214
206
  }
215
- function w(e, t, n) {
216
- let r = n ? D(e, (e, t) => typeof S(t) == "function" ? "<function>" : t) : D(e);
207
+ function S(e, t, n) {
208
+ let r = n ? T(e, (e, t) => typeof x(t) == "function" ? "<function>" : t) : T(e);
217
209
  return t && typeof r == "string" ? r : JSON.stringify(r);
218
210
  }
219
- function T(e, ...t) {
211
+ function C(e, ...t) {
220
212
  let n = 0;
221
- return E(e).replace(/%([*\-<]+)?([1-9][0-9]*)?(.)/g, (e, r, i, a) => {
222
- switch (a) {
223
- case "%": return "%";
224
- default:
225
- }
213
+ return w(e).replace(/%([*\-<]+)?([1-9][0-9]*)?(.)/g, (e, r, i, a) => {
214
+ if (a === "%") return "%";
226
215
  let o = t[n] ?? null;
227
216
  n += 1;
228
217
  let s;
229
218
  switch (a) {
230
219
  case "s":
231
- s = E(o);
220
+ s = w(o);
232
221
  break;
233
222
  case "v":
234
- s = Je(o);
223
+ s = Xe(o);
235
224
  break;
236
- default: throw new y(`format ${e} has unknown verb ${a}`);
225
+ default: throw new v(`format ${e} has unknown verb ${a}`);
237
226
  }
238
227
  let c = !0, l = !1, u = !1;
239
228
  [...r ?? []].forEach((t) => {
@@ -247,7 +236,7 @@ function T(e, ...t) {
247
236
  case "<":
248
237
  u = !0;
249
238
  break;
250
- default: throw new y(`format ${e} has unknown flag ${t}`);
239
+ default: throw new v(`format ${e} has unknown flag ${t}`);
251
240
  }
252
241
  });
253
242
  let d = +(i ?? 0);
@@ -261,35 +250,35 @@ function T(e, ...t) {
261
250
  return s;
262
251
  });
263
252
  }
264
- function E(e) {
265
- return w(e, !0, !0);
253
+ function w(e) {
254
+ return S(e, !0, !0);
266
255
  }
267
- function Je(e) {
268
- return w(e, !1, !0);
256
+ function Xe(e) {
257
+ return S(e, !1, !0);
269
258
  }
270
- function D(e, t, n = Ze) {
259
+ function T(e, t, n = $e) {
271
260
  let r = (e, i) => {
272
261
  let a = i;
273
262
  return t && (a = t(e ?? "", a)), n(e, a, r);
274
263
  };
275
264
  return r(null, e);
276
265
  }
277
- function Ye(e, t, n) {
278
- return b.is(t) || typeof t == "function" ? t : O(e, t, n);
266
+ function Ze(e, t, n) {
267
+ return y.is(t) || typeof t == "function" ? t : E(e, t, n);
279
268
  }
280
- function Xe(e, t, n) {
269
+ function Qe(e, t, n) {
281
270
  let r = t;
282
- return b.is(r) && (r = r.toJSON()), typeof r == "function" ? r : O(e, r, n);
271
+ return y.is(r) && (r = r.toJSON()), typeof r == "function" ? r : E(e, r, n);
283
272
  }
284
- function Ze(e, t, n) {
273
+ function $e(e, t, n) {
285
274
  let r = t;
286
- return b.is(r) && (r = r.toJSON()), O(e, r, n);
275
+ return y.is(r) && (r = r.toJSON()), E(e, r, n);
287
276
  }
288
- function Qe(e, t, n) {
277
+ function et(e, t, n) {
289
278
  let r = t;
290
- return typeof r?.toJSON == "function" && (r = r.toJSON()), O(e, r, n);
279
+ return typeof r?.toJSON == "function" && (r = r.toJSON()), E(e, r, n);
291
280
  }
292
- function O(e, t, n) {
281
+ function E(e, t, n) {
293
282
  let r = e == null;
294
283
  switch (typeof t) {
295
284
  case "string":
@@ -301,36 +290,35 @@ function O(e, t, n) {
301
290
  let r = n(e, t);
302
291
  return r === void 0 ? [e] : [e, r];
303
292
  }));
304
- default: throw new y(`unexpected ${typeof t}`);
293
+ default: throw new v(`unexpected ${typeof t}`);
305
294
  }
306
295
  }
307
- //#endregion
308
- //#region lib/library/errors/runtime.ts
309
- function k(e, t) {
310
- return t.length > 0 ? T(e, ...t) : E(e);
296
+ // lib/library/errors/runtime.ts
297
+ function D(e, t) {
298
+ return t.length > 0 ? C(e, ...t) : w(e);
311
299
  }
312
- var A = class extends g {
300
+ var O = class extends h {
313
301
  constructor(e, ...t) {
314
- let n = k(e, t);
315
- super(n, "JPLRuntimeError"), this.value = t.length > 0 ? n : x(e);
302
+ let n = D(e, t);
303
+ super(n, "JPLRuntimeError"), this.value = t.length > 0 ? n : b(e);
316
304
  }
317
- }, j = class extends A {
305
+ }, k = class extends O {
318
306
  constructor(e, ...t) {
319
- super(`TypeError - ${k(e, t)}`);
307
+ super(`TypeError - ${D(e, t)}`);
320
308
  }
321
- }, $e = class extends A {
309
+ }, tt = class extends O {
322
310
  constructor(e, ...t) {
323
- super(`ReferenceError - ${k(e, t)}`);
311
+ super(`ReferenceError - ${D(e, t)}`);
324
312
  }
325
- }, et = class extends A {
313
+ }, A = class extends O {
326
314
  constructor(e, ...t) {
327
- super(`ZeroDivisionError - ${k(e, t)}`);
315
+ super(`ZeroDivisionError - ${D(e, t)}`);
328
316
  }
329
- }, tt = class extends A {
317
+ }, nt = class extends O {
330
318
  constructor(e, ...t) {
331
- super(`TypeConversionError - ${k(e, t)}`);
319
+ super(`TypeConversionError - ${D(e, t)}`);
332
320
  }
333
- }, nt = class extends h {
321
+ }, j = class extends m {
334
322
  src;
335
323
  at;
336
324
  constructor(e, t = "", n = 0) {
@@ -351,7 +339,7 @@ var A = class extends g {
351
339
  return this.#t ||= this.parent?.exited ?? !1, this.#t;
352
340
  }
353
341
  checkHealth() {
354
- if (this.exited) throw new y("execution aborted");
342
+ if (this.exited) throw new v("execution aborted");
355
343
  }
356
344
  exit = () => {
357
345
  this.exited || (this.#t = !0, Object.values(this.#n).forEach((e) => {
@@ -368,7 +356,7 @@ var A = class extends g {
368
356
  };
369
357
  };
370
358
  next = () => new e(this);
371
- }, it = class e {
359
+ }, M = class e {
372
360
  #e;
373
361
  #t;
374
362
  constructor(e = {}) {
@@ -387,34 +375,32 @@ var A = class extends g {
387
375
  });
388
376
  }
389
377
  };
390
- //#endregion
391
- //#region lib/library/functions.ts
392
- function at(e, t, n, r, ...i) {
378
+ // lib/library/functions.ts
379
+ function it(e, t, n, r, ...i) {
393
380
  let { argNames: a, pipe: o, scope: s } = this;
394
381
  return e.executeInstructions(o, [r], s.next({
395
382
  signal: t,
396
383
  vars: Object.fromEntries(a.map((e, t) => [e, i[t] ?? null]))
397
384
  }), n);
398
385
  }
399
- function ot(e, t, n) {
400
- return at.bind({
386
+ function N(e, t, n) {
387
+ return it.bind({
401
388
  argNames: e,
402
389
  pipe: t,
403
390
  scope: n
404
391
  });
405
392
  }
406
- function st(e, t, n) {
407
- return ot(e, t, new it(n));
393
+ function at(e, t, n) {
394
+ return N(e, t, new M(n));
408
395
  }
409
- function ct(e) {
396
+ function ot(e) {
410
397
  return async (t, n, r, i, ...a) => {
411
398
  let o = await e(t, i, ...a);
412
399
  return t.muxAll([o], r);
413
400
  };
414
401
  }
415
- //#endregion
416
- //#region lib/library/mux.ts
417
- function lt(e, t) {
402
+ // lib/library/mux.ts
403
+ function st(e, t) {
418
404
  let n = e.length;
419
405
  if (n === 1) {
420
406
  e[0].forEach((e) => t(e));
@@ -439,7 +425,7 @@ function lt(e, t) {
439
425
  t[1] = 0, [a[e]] = o;
440
426
  }
441
427
  }
442
- function M(e, t) {
428
+ function P(e, t) {
443
429
  let n = e.length;
444
430
  if (n === 1) return e[0].map((e) => t(e));
445
431
  let r = 1, i = e.map((e) => {
@@ -462,26 +448,26 @@ function M(e, t) {
462
448
  }
463
449
  return a;
464
450
  }
465
- function ut(e, t) {
466
- return Promise.all(M(e, t));
451
+ function F(e, t) {
452
+ return Promise.all(P(e, t));
467
453
  }
468
- async function dt(e, t) {
469
- return ft(await ut(e, t));
454
+ async function ct(e, t) {
455
+ return lt(await F(e, t));
470
456
  }
471
- function ft(e) {
457
+ function lt(e) {
472
458
  return e.length === 0 ? e : e.length === 1 ? e[0] : e.flat(1);
473
459
  }
474
- //#endregion
475
- //#region lib/runtime/index.ts
476
- var pt = { vars: {} };
477
- function N(e = {}, t = {}) {
460
+ // lib/runtime/index.ts
461
+ var ut = { vars: {} };
462
+ function I(e = {}, t = {}) {
478
463
  return r(e, t, "vars");
479
464
  }
480
- var mt = class {
465
+ var dt = class {
481
466
  #e;
482
467
  #t;
468
+ #n;
483
469
  constructor(e, t) {
484
- this.#e = N(t?.runtime, pt), this.#t = e;
470
+ this.#e = I(t?.runtime, ut), this.#t = e, this.#n = this.createScope({ vars: Object.fromEntries(this.muxOne([Object.entries(this.options.vars)], ([e, t]) => [e, this.normalizeValue(t)])) });
485
471
  }
486
472
  get options() {
487
473
  return this.#e;
@@ -489,99 +475,101 @@ var mt = class {
489
475
  get program() {
490
476
  return this.#t;
491
477
  }
492
- createScope = (e) => new it(e);
478
+ get rootScope() {
479
+ return this.#n;
480
+ }
481
+ createScope = (e) => new M(e);
493
482
  execute = async (e) => {
494
- let t = this.createScope({ vars: Object.fromEntries(this.muxOne([Object.entries(this.options.vars)], ([e, t]) => [e, this.normalizeValue(t)])) });
495
483
  try {
496
- return await this.executeInstructions(this.program.definition.instructions ?? [], e, t, this.options.adjustResult);
484
+ return await this.executeInstructions(this.program.definition.instructions ?? [], e, this.rootScope, this.options.adjustResult);
497
485
  } finally {
498
- t.signal.exit();
486
+ this.rootScope.signal.exit();
499
487
  }
500
488
  };
501
489
  executeInstructions = (e, t, n, r = (e) => [e]) => {
502
490
  let i = async (t, n, a) => {
503
491
  if (await void 0, a.signal.checkHealth(), t >= e.length) return r(n, a);
504
492
  let { op: o, params: s } = e[t], c = this.program.ops[o];
505
- if (!c) throw new y(`invalid OP '${o}'`);
493
+ if (!c) throw new v(`invalid OP '${o}'`);
506
494
  return c.op(this, n, s ?? {}, a, (e, n) => i(t + 1, e, n));
507
495
  };
508
496
  return this.muxAll([t], (e) => i(0, e, n));
509
497
  };
510
498
  op(e, t, n, r, i = (e) => [e]) {
511
499
  let a = this.program.ops[e];
512
- if (!a) throw new y(`invalid OP '${e}'`);
500
+ if (!a) throw new v(`invalid OP '${e}'`);
513
501
  let o = a.map(this, t);
514
502
  return this.muxAll([n], (e) => a.op(this, e, o ?? {}, r, i));
515
503
  }
516
- normalizeValue = x;
504
+ normalizeValue = b;
517
505
  normalizeValues = (e = [], t = "values") => {
518
- if (!Array.isArray(e)) throw new y(`expected ${t} to be an array`);
506
+ if (!Array.isArray(e)) throw new v(`expected ${t} to be an array`);
519
507
  return this.normalizeValue(e);
520
508
  };
521
- unwrapValue = S;
509
+ unwrapValue = x;
522
510
  unwrapValues = (e = [], t = "values") => {
523
- if (!Array.isArray(e)) throw new y(`expected ${t} to be an array`);
511
+ if (!Array.isArray(e)) throw new v(`expected ${t} to be an array`);
524
512
  return this.muxOne([e], (e) => this.unwrapValue(e));
525
513
  };
526
- stripValue = (e) => D(e, (e, t) => this.unwrapValue(t));
514
+ stripValue = (e) => T(e, (e, t) => this.unwrapValue(t));
527
515
  stripValues = (e = [], t = "values") => {
528
- if (!Array.isArray(e)) throw new y(`expected ${t} to be an array`);
516
+ if (!Array.isArray(e)) throw new v(`expected ${t} to be an array`);
529
517
  return this.muxOne([e], (e) => this.stripValue(e));
530
518
  };
531
- alterValue = async (e, t) => b.is(e) ? We(() => e.alter(t)) : this.normalizeValue(await t(e));
532
- type = C;
533
- assertType = qe;
519
+ alterValue = async (e, t) => y.is(e) ? Ge(() => e.alter(t)) : this.normalizeValue(await t(e));
520
+ type = Je;
521
+ assertType = Ye;
534
522
  truthy = (e) => {
535
523
  let t = this.unwrapValue(e);
536
524
  return t !== null && t !== !1;
537
525
  };
538
- compare = P.bind(this);
526
+ compare = L.bind(this);
539
527
  compareStrings = (e, t) => {
540
528
  let n = this.type(e);
541
- if (n !== "string") throw new y(`unexpected type ${n}`);
529
+ if (n !== "string") throw new v(`unexpected type ${n}`);
542
530
  let r = this.type(t);
543
- if (r !== "string") throw new y(`unexpected type ${r}`);
544
- return F(this.unwrapValue(e), this.unwrapValue(t));
531
+ if (r !== "string") throw new v(`unexpected type ${r}`);
532
+ return R(this.unwrapValue(e), this.unwrapValue(t));
545
533
  };
546
534
  compareArrays = (e, t) => {
547
535
  let n = this.type(e);
548
- if (n !== "array") throw new y(`unexpected type ${n}`);
536
+ if (n !== "array") throw new v(`unexpected type ${n}`);
549
537
  let r = this.type(t);
550
- if (r !== "array") throw new y(`unexpected type ${r}`);
551
- return I.call(this, this.unwrapValue(e), this.unwrapValue(t));
538
+ if (r !== "array") throw new v(`unexpected type ${r}`);
539
+ return ft.call(this, this.unwrapValue(e), this.unwrapValue(t));
552
540
  };
553
541
  compareObjects = (e, t) => {
554
542
  let n = this.type(e);
555
- if (n !== "object") throw new y(`unexpected type ${n}`);
543
+ if (n !== "object") throw new v(`unexpected type ${n}`);
556
544
  let r = this.type(t);
557
- if (r !== "object") throw new y(`unexpected type ${r}`);
558
- return ht.call(this, this.unwrapValue(e), this.unwrapValue(t));
545
+ if (r !== "object") throw new v(`unexpected type ${r}`);
546
+ return pt.call(this, this.unwrapValue(e), this.unwrapValue(t));
559
547
  };
560
548
  equals = (e, t) => this.compare(e, t) === 0;
561
549
  merge = async (e, t) => (await void 0, this.type(e) !== "object" || this.type(t) !== "object" ? t : this.alterValue(e, async (e) => i(e, await Promise.all(Object.entries(this.unwrapValue(t)).map(async ([t, n]) => [t, await this.merge(e[t] ?? null, n)])))));
562
- stringifyJSON = (e, t) => w(e, t);
563
- stripJSON = (e) => D(e);
564
- mux = lt;
565
- muxOne = M;
566
- muxAsync = ut;
567
- muxAll = dt;
550
+ stringifyJSON = (e, t) => S(e, t);
551
+ stripJSON = (e) => T(e);
552
+ mux = st;
553
+ muxOne = P;
554
+ muxAsync = F;
555
+ muxAll = ct;
568
556
  };
569
- function P(e, t) {
557
+ function L(e, t) {
570
558
  let n = this.type(e), r = this.type(t);
571
- if (n !== r) return Ke.indexOf(n) - Ke.indexOf(r);
559
+ if (n !== r) return qe.indexOf(n) - qe.indexOf(r);
572
560
  let i = this.unwrapValue(e), a = this.unwrapValue(t);
573
561
  switch (n) {
574
562
  case "null":
575
563
  case "function": return 0;
576
564
  case "boolean":
577
- case "number": return i - +a;
578
- case "string": return F(i, a);
579
- case "array": return I.call(this, i, a);
580
- case "object": return ht.call(this, i, a);
581
- default: throw new y(`unexpected type ${n}`);
565
+ case "number": return +i - a;
566
+ case "string": return R(i, a);
567
+ case "array": return ft.call(this, i, a);
568
+ case "object": return pt.call(this, i, a);
569
+ default: throw new v(`unexpected type ${n}`);
582
570
  }
583
571
  }
584
- function F(e, t) {
572
+ function R(e, t) {
585
573
  let n = Math.min(e.length, t.length), r = 0;
586
574
  for (let i of e) {
587
575
  if (r >= n) break;
@@ -591,33 +579,32 @@ function F(e, t) {
591
579
  }
592
580
  return e.length - t.length;
593
581
  }
594
- function I(e, t) {
582
+ function ft(e, t) {
595
583
  let n = Math.min(e.length, t.length);
596
584
  for (let r = 0; r < n; r += 1) {
597
- let n = P.call(this, e[r], t[r]);
585
+ let n = L.call(this, e[r], t[r]);
598
586
  if (n !== 0) return n;
599
587
  }
600
588
  return e.length - t.length;
601
589
  }
602
- function ht(e, t) {
603
- let n = Object.keys(e).sort(F), r = Object.keys(t).sort(F), i = I.call(this, n, r);
590
+ function pt(e, t) {
591
+ let n = Object.keys(e).sort(R), r = Object.keys(t).sort(R), i = ft.call(this, n, r);
604
592
  if (i !== 0) return i;
605
- for (let r of n) if (i = P.call(this, e[r], t[r]), i !== 0) return i;
593
+ for (let r of n) if (i = L.call(this, e[r], t[r]), i !== 0) return i;
606
594
  return 0;
607
595
  }
608
- //#endregion
609
- //#region lib/program/ops/utils.ts
610
- function L(e) {
596
+ // lib/program/ops/utils.ts
597
+ function z(e) {
611
598
  return [{
612
599
  op: "cnt",
613
600
  params: { value: e ?? null }
614
601
  }];
615
602
  }
616
- function R(e) {
603
+ function B(e) {
617
604
  return [{
618
605
  op: "$.",
619
606
  params: {
620
- pipe: L(qe(e, "function")),
607
+ pipe: z(Ye(e, "function")),
621
608
  selectors: [{
622
609
  op: "$()",
623
610
  params: {
@@ -629,9 +616,8 @@ function R(e) {
629
616
  }
630
617
  }];
631
618
  }
632
- //#endregion
633
- //#region lib/program/ops/opAccess/opaField.ts
634
- var gt = {
619
+ // lib/program/ops/opAccess/opaField.ts
620
+ var mt = {
635
621
  op(e, t, n, r, i, a) {
636
622
  let o = e.unwrapValue(n), s = e.type(o);
637
623
  return e.executeInstructions(r.pipe ?? [], [t], i, (t) => {
@@ -649,58 +635,52 @@ var gt = {
649
635
  return a(o[e >= 0 ? e : o.length + e] ?? null);
650
636
  }
651
637
  break;
652
- case "string":
653
- if (i === "number") {
654
- let e = Math.trunc(n), t = [...o];
655
- return a(t[e >= 0 ? e : t.length + e] ?? null);
656
- }
657
- break;
658
- default:
638
+ case "string": if (i === "number") {
639
+ let e = Math.trunc(n), t = [...o];
640
+ return a(t[e >= 0 ? e : t.length + e] ?? null);
641
+ }
659
642
  }
660
643
  if (r.optional) return [];
661
- throw new j("cannot access field of %s (%*<100v) with %s (%*<100v)", s, o, i, n);
644
+ throw new k("cannot access field of %s (%*<100v) with %s (%*<100v)", s, o, i, n);
662
645
  });
663
646
  },
664
647
  map(e, t) {
665
648
  return {
666
- pipe: R(t.pipe),
649
+ pipe: B(t.pipe),
667
650
  optional: e.assertType(t.optional, "boolean")
668
651
  };
669
652
  }
670
- }, _t = {
653
+ }, ht = {
671
654
  async op(e, t, n, r, i, a) {
672
655
  let o = e.unwrapValue(n), s = e.type(o);
673
- switch (s) {
674
- case "function": {
675
- let n = await e.muxAsync([r.args ?? []], (n) => e.executeInstructions(n ?? [], [t], i));
676
- return e.muxAll(n, async (...n) => {
677
- try {
678
- let s = async (e) => {
679
- try {
680
- return await a(e);
681
- } catch (e) {
682
- throw new v(e);
683
- }
684
- };
685
- return r.bound ? await o(e, i.signal, s, n[0] ?? null, ...n.slice(1)) : await o(e, i.signal, s, t, ...n);
686
- } catch (e) {
687
- throw v.is(e) ? e.inner : _(e);
688
- }
689
- });
690
- }
691
- default:
656
+ if (s === "function") {
657
+ let n = await e.muxAsync([r.args ?? []], (n) => e.executeInstructions(n ?? [], [t], i));
658
+ return e.muxAll(n, async (...n) => {
659
+ try {
660
+ let s = async (e) => {
661
+ try {
662
+ return await a(e);
663
+ } catch (e) {
664
+ throw new _(e);
665
+ }
666
+ };
667
+ return r.bound ? await o(e, i.signal, s, n[0] ?? null, ...n.slice(1)) : await o(e, i.signal, s, t, ...n);
668
+ } catch (e) {
669
+ throw _.is(e) ? e.inner : g(e);
670
+ }
671
+ });
692
672
  }
693
673
  if (r.optional) return [];
694
- throw new j("cannot execute %s (%*<100v)", s, o);
674
+ throw new k("cannot execute %s (%*<100v)", s, o);
695
675
  },
696
676
  map(e, t) {
697
677
  return {
698
- args: e.muxOne([t.args], (e) => R(e)),
678
+ args: e.muxOne([t.args], (e) => B(e)),
699
679
  bound: e.assertType(t.bound, "boolean"),
700
680
  optional: e.assertType(t.optional, "boolean")
701
681
  };
702
682
  }
703
- }, vt = {
683
+ }, gt = {
704
684
  op(e, t, n, r, i, a) {
705
685
  let o = e.unwrapValue(n), s = e.type(o);
706
686
  switch (s) {
@@ -708,15 +688,14 @@ var gt = {
708
688
  case "object": return e.muxAll([Object.values(o)], a);
709
689
  case "array": return e.muxAll([o], a);
710
690
  case "string": return e.muxAll([[...o]], a);
711
- default:
712
691
  }
713
692
  if (r.optional) return [];
714
- throw new j("cannot iterate over %s (%*<100v)", s, o);
693
+ throw new k("cannot iterate over %s (%*<100v)", s, o);
715
694
  },
716
695
  map(e, t) {
717
696
  return { optional: e.assertType(t.optional, "boolean") };
718
697
  }
719
- }, yt = {
698
+ }, _t = {
720
699
  async op(e, t, n, r, i, a) {
721
700
  let o = e.unwrapValue(n), s = e.type(o), [c, l] = await Promise.all([e.executeInstructions(r.from ?? [], [t], i), e.executeInstructions(r.to ?? [], [t], i)]);
722
701
  return e.muxAll([e.unwrapValues(c), e.unwrapValues(l)], (t, n) => {
@@ -726,41 +705,38 @@ var gt = {
726
705
  case "array":
727
706
  if (["number", "null"].includes(i) && ["number", "null"].includes(c)) return a(o.slice(Math.trunc(t ?? 0), Math.trunc(n ?? o.length)));
728
707
  break;
729
- case "string":
730
- if (["number", "null"].includes(i) && ["number", "null"].includes(c)) {
731
- let e = [...o];
732
- return a(e.slice(Math.trunc(t ?? 0), Math.trunc(n ?? e.length)).join(""));
733
- }
734
- break;
735
- default:
708
+ case "string": if (["number", "null"].includes(i) && ["number", "null"].includes(c)) {
709
+ let e = [...o];
710
+ return a(e.slice(Math.trunc(t ?? 0), Math.trunc(n ?? e.length)).join(""));
711
+ }
736
712
  }
737
713
  if (r.optional) return [];
738
- throw new j("cannot slice %s (%*<100v) with %s (%*<100v) and %s (%*<100v)", s, o, i, t, c, n);
714
+ throw new k("cannot slice %s (%*<100v) with %s (%*<100v) and %s (%*<100v)", s, o, i, t, c, n);
739
715
  });
740
716
  },
741
717
  map(e, t) {
742
718
  return {
743
- from: R(t.from),
744
- to: R(t.to),
719
+ from: B(t.from),
720
+ to: B(t.to),
745
721
  optional: e.assertType(t.optional, "boolean")
746
722
  };
747
723
  }
748
- }, bt = {
724
+ }, vt = {
749
725
  op(e, t, n, r, i) {
750
726
  let a = async (o, s) => {
751
727
  if (await void 0, r.signal.checkHealth(), o >= (n.selectors?.length ?? 0)) return i(s, r);
752
- let { op: c, params: l } = n.selectors[o], u = xt[c];
753
- if (!u) throw new y(`invalid OPA '${c}'`);
728
+ let { op: c, params: l } = n.selectors[o], u = yt[c];
729
+ if (!u) throw new v(`invalid OPA '${c}'`);
754
730
  return u.op(e, t, s, l ?? {}, r, (e) => a(o + 1, e));
755
731
  };
756
732
  return e.executeInstructions(n.pipe ?? [], [t], r, (e) => a(0, e));
757
733
  },
758
734
  map(e, t) {
759
735
  return {
760
- pipe: R(t.pipe),
736
+ pipe: B(t.pipe),
761
737
  selectors: e.muxOne([t.selectors], ({ op: t, params: n }) => {
762
- let r = xt[t];
763
- if (!r) throw new y(`invalid OPA '${t}'`);
738
+ let r = yt[t];
739
+ if (!r) throw new v(`invalid OPA '${t}'`);
764
740
  return {
765
741
  op: e.assertType(t, "string"),
766
742
  params: r.map(e, n)
@@ -768,12 +744,12 @@ var gt = {
768
744
  })
769
745
  };
770
746
  }
771
- }, xt = {
772
- "$.$": gt,
773
- "$()": _t,
774
- "$[]": vt,
775
- "[:]": yt
776
- }, St = {
747
+ }, yt = {
748
+ "$.$": mt,
749
+ "$()": ht,
750
+ "$[]": gt,
751
+ "[:]": _t
752
+ }, bt = {
777
753
  op(e, t, n, r, i) {
778
754
  let a = async (o) => {
779
755
  if (await void 0, r.signal.checkHealth(), o >= (n.pipes?.length ?? 0)) return i(!0, r);
@@ -783,16 +759,16 @@ var gt = {
783
759
  return a(0);
784
760
  },
785
761
  map(e, t) {
786
- return { pipes: e.muxOne([t.pipes], (e) => R(e)) };
762
+ return { pipes: e.muxOne([t.pipes], (e) => B(e)) };
787
763
  }
788
- }, Ct = {
764
+ }, xt = {
789
765
  async op(e, t, n, r, i) {
790
766
  return i(await e.executeInstructions(n.pipe ?? [], [t], r), r);
791
767
  },
792
768
  map(e, t) {
793
- return { pipe: R(t.pipe) };
769
+ return { pipe: B(t.pipe) };
794
770
  }
795
- }, wt = {
771
+ }, St = {
796
772
  async op(e, t, n, r, o, s) {
797
773
  let c, l = e.unwrapValue(n), u = e.type(n);
798
774
  switch (u) {
@@ -806,7 +782,7 @@ var gt = {
806
782
  break;
807
783
  default:
808
784
  if (r.optional) return [void 0];
809
- throw new j("cannot access fields of %s (%*<100v) (assignment)", u, l);
785
+ throw new k("cannot access fields of %s (%*<100v) (assignment)", u, l);
810
786
  }
811
787
  let d = await e.executeInstructions(r.pipe ?? [], [t], o, (e) => [e]), f = async (t, n) => {
812
788
  if (await void 0, o.signal.checkHealth(), t >= d.length) return [n];
@@ -819,7 +795,6 @@ var gt = {
819
795
  let r = Math.trunc(l);
820
796
  return e.muxAll([await s(null)], (e) => e === void 0 ? f(t + 1, n) : f(t + 1, a([], [[r, e]])));
821
797
  }
822
- default:
823
798
  }
824
799
  break;
825
800
  case "object":
@@ -834,25 +809,21 @@ var gt = {
834
809
  return e.muxAll([await s(i ?? null)], (e) => e === void 0 ? f(t + 1, n) : f(t + 1, a(n, [[r, e]])));
835
810
  }
836
811
  break;
837
- case "string":
838
- if (p === "number") {
839
- let r = Math.trunc(l), i = n[r >= 0 ? r : n.length + r];
840
- return e.muxAll([await s(i ?? null)], (i) => {
841
- if (i === void 0) return f(t + 1, n);
842
- let o = e.unwrapValue(i), s = e.type(o);
843
- switch (s) {
844
- case "null":
845
- case "string": return f(t + 1, a(n, [[r, i ?? " "]], " "));
846
- default:
847
- }
848
- throw new j("cannot assign %s (%*<100v) to string (%*<100v)", s, o, n.join(""));
849
- });
850
- }
851
- break;
852
- default:
812
+ case "string": if (p === "number") {
813
+ let r = Math.trunc(l), i = n[r >= 0 ? r : n.length + r];
814
+ return e.muxAll([await s(i ?? null)], (i) => {
815
+ if (i === void 0) return f(t + 1, n);
816
+ let o = e.unwrapValue(i), s = e.type(o);
817
+ switch (s) {
818
+ case "null":
819
+ case "string": return f(t + 1, a(n, [[r, i ?? " "]], " "));
820
+ }
821
+ throw new k("cannot assign %s (%*<100v) to string (%*<100v)", s, o, n.join(""));
822
+ });
823
+ }
853
824
  }
854
825
  if (r.optional) return f(t + 1, n);
855
- throw new j("cannot access field of %s (%*<100v) with %s (%*<100v) (assignment)", c, c === "string" ? n.join("") : n, p, l);
826
+ throw new k("cannot access field of %s (%*<100v) with %s (%*<100v) (assignment)", c, c === "string" ? n.join("") : n, p, l);
856
827
  };
857
828
  return e.muxAsync([await f(0, c)], (t) => {
858
829
  if (c === t) return n;
@@ -861,17 +832,16 @@ var gt = {
861
832
  case "object":
862
833
  case "array": return e.alterValue(n, () => t);
863
834
  case "string": return e.alterValue(n, () => t.join(""));
864
- default:
865
835
  }
866
836
  });
867
837
  },
868
838
  map(e, t) {
869
839
  return {
870
- pipe: R(t.pipe),
840
+ pipe: B(t.pipe),
871
841
  optional: e.assertType(t.optional, "boolean")
872
842
  };
873
843
  }
874
- }, Tt = {
844
+ }, Ct = {
875
845
  async op(e, t, n, r, i, a) {
876
846
  let s = e.unwrapValue(n), c = e.type(s);
877
847
  switch (c) {
@@ -891,27 +861,24 @@ var gt = {
891
861
  switch (i) {
892
862
  case "null":
893
863
  case "string": return r ?? " ";
894
- default:
895
864
  }
896
- throw new j("cannot assign %s (%*<100v) to string (%*<100v)", i, r, s);
865
+ throw new k("cannot assign %s (%*<100v) to string (%*<100v)", i, r, s);
897
866
  }));
898
867
  return e.muxAsync([o(t, r)], (r) => t === r ? n : e.alterValue(n, () => r.join("")));
899
868
  }
900
- default:
901
869
  }
902
870
  if (r.optional) return [void 0];
903
- throw new j("cannot iterate over %s (%*<100v) (assignment)", c, s);
871
+ throw new k("cannot iterate over %s (%*<100v) (assignment)", c, s);
904
872
  },
905
873
  map(e, t) {
906
874
  return { optional: e.assertType(t.optional, "boolean") };
907
875
  }
908
876
  };
909
- //#endregion
910
- //#region lib/program/ops/opAssignment/opaAssignSlice.ts
911
- function Et(e, t) {
912
- return e.length === t.length ? e.every((e, n) => e === t[n]) : !1;
877
+ // lib/program/ops/opAssignment/opaAssignSlice.ts
878
+ function wt(e, t) {
879
+ return e.length === t.length && e.every((e, n) => e === t[n]);
913
880
  }
914
- var Dt = {
881
+ var Tt = {
915
882
  async op(e, t, n, r, i, a) {
916
883
  let [o, s] = await Promise.all([e.executeInstructions(r.from ?? [], [t], i), e.executeInstructions(r.to ?? [], [t], i)]), c = e.muxOne([e.unwrapValues(o), e.unwrapValues(s)], (e, t) => [e, t]), l = async (t, n) => {
917
884
  if (await void 0, i.signal.checkHealth(), t >= c.length) return [n];
@@ -925,52 +892,47 @@ var Dt = {
925
892
  case "null":
926
893
  case "array": {
927
894
  let e = Math.trunc(u ?? 0), r = Math.trunc(d ?? t.length);
928
- if (e = e >= 0 ? Math.min(t.length, e) : Math.max(0, t.length + e), r = Math.max(e, r >= 0 ? Math.min(t.length, r) : Math.max(0, t.length + r)), Et(t.slice(e, r), n ?? [])) return t;
895
+ if (e = e >= 0 ? Math.min(t.length, e) : Math.max(0, t.length + e), r = Math.max(e, r >= 0 ? Math.min(t.length, r) : Math.max(0, t.length + r)), wt(t.slice(e, r), n ?? [])) return t;
929
896
  let i = [...t];
930
897
  return i.splice(e, r - e, ...n ?? []), i;
931
898
  }
932
- default:
933
899
  }
934
- throw new j("cannot assign %s (%*<100v) to slice of %s (%*<100v)", i, n, s, t);
900
+ throw new k("cannot assign %s (%*<100v) to slice of %s (%*<100v)", i, n, s, t);
935
901
  })));
936
902
  break;
937
- case "string":
938
- if (["number", "null"].includes(f) && ["number", "null"].includes(p)) {
939
- let r = [...o];
940
- return e.muxAll([await a(r.slice(Math.trunc(u ?? 0), Math.trunc(d ?? r.length)).join(""))], async (r) => r === void 0 ? l(t + 1, n) : l(t + 1, await e.alterValue(n, (t) => {
941
- let n = e.unwrapValue(r), i = e.type(n);
942
- switch (i) {
943
- case "null":
944
- case "string": {
945
- let e = [...t], r = Math.trunc(u ?? 0), i = Math.trunc(d ?? e.length);
946
- return r = r >= 0 ? Math.min(e.length, r) : Math.max(0, e.length + r), i = Math.max(r, i >= 0 ? Math.min(e.length, i) : Math.max(0, e.length + i)), Et(e.slice(r, i), n ?? []) ? t : (e.splice(r, i - r, ...n ?? []), e.join(""));
947
- }
948
- default:
903
+ case "string": if (["number", "null"].includes(f) && ["number", "null"].includes(p)) {
904
+ let r = [...o];
905
+ return e.muxAll([await a(r.slice(Math.trunc(u ?? 0), Math.trunc(d ?? r.length)).join(""))], async (r) => r === void 0 ? l(t + 1, n) : l(t + 1, await e.alterValue(n, (t) => {
906
+ let n = e.unwrapValue(r), i = e.type(n);
907
+ switch (i) {
908
+ case "null":
909
+ case "string": {
910
+ let e = [...t], r = Math.trunc(u ?? 0), i = Math.trunc(d ?? e.length);
911
+ return r = r >= 0 ? Math.min(e.length, r) : Math.max(0, e.length + r), i = Math.max(r, i >= 0 ? Math.min(e.length, i) : Math.max(0, e.length + i)), wt(e.slice(r, i), n ?? []) ? t : (e.splice(r, i - r, ...n ?? []), e.join(""));
949
912
  }
950
- throw new j("cannot assign %s (%*<100v) to slice of %s (%*<100v)", i, n, s, t);
951
- })));
952
- }
953
- break;
954
- default:
913
+ }
914
+ throw new k("cannot assign %s (%*<100v) to slice of %s (%*<100v)", i, n, s, t);
915
+ })));
916
+ }
955
917
  }
956
918
  if (r.optional) return l(t + 1, n);
957
- throw new j("cannot slice %s (%*<100v) with %s (%*<100v) and %s (%*<100v) (assignment)", s, o, f, u, p, d);
919
+ throw new k("cannot slice %s (%*<100v) with %s (%*<100v) and %s (%*<100v) (assignment)", s, o, f, u, p, d);
958
920
  };
959
921
  return e.muxOne([await l(0, n)], (t) => e.type(t) === "null" ? void 0 : t);
960
922
  },
961
923
  map(e, t) {
962
924
  return {
963
- from: R(t.from),
964
- to: R(t.to),
925
+ from: B(t.from),
926
+ to: B(t.to),
965
927
  optional: e.assertType(t.optional, "boolean")
966
928
  };
967
929
  }
968
- }, Ot = {
930
+ }, Et = {
969
931
  op(e, t, n, r, i, a) {
970
932
  return e.executeInstructions([{
971
933
  op: "clc",
972
934
  params: {
973
- pipe: L(n),
935
+ pipe: z(n),
974
936
  operations: [{
975
937
  op: "+",
976
938
  params: { by: r.pipe ?? [] }
@@ -979,14 +941,14 @@ var Dt = {
979
941
  }], [t], i, a);
980
942
  },
981
943
  map(e, t) {
982
- return { pipe: R(t.pipe) };
944
+ return { pipe: B(t.pipe) };
983
945
  }
984
- }, kt = {
946
+ }, Dt = {
985
947
  op(e, t, n, r, i, a) {
986
948
  return e.executeInstructions([{
987
949
  op: "clc",
988
950
  params: {
989
- pipe: L(n),
951
+ pipe: z(n),
990
952
  operations: [{
991
953
  op: "/",
992
954
  params: { by: r.pipe ?? [] }
@@ -995,14 +957,14 @@ var Dt = {
995
957
  }], [t], i, a);
996
958
  },
997
959
  map(e, t) {
998
- return { pipe: R(t.pipe) };
960
+ return { pipe: B(t.pipe) };
999
961
  }
1000
- }, At = {
962
+ }, Ot = {
1001
963
  op(e, t, n, r, i, a) {
1002
964
  return e.executeInstructions([{
1003
965
  op: "clc",
1004
966
  params: {
1005
- pipe: L(n),
967
+ pipe: z(n),
1006
968
  operations: [{
1007
969
  op: "*",
1008
970
  params: { by: r.pipe ?? [] }
@@ -1011,24 +973,24 @@ var Dt = {
1011
973
  }], [t], i, a);
1012
974
  },
1013
975
  map(e, t) {
1014
- return { pipe: R(t.pipe) };
976
+ return { pipe: B(t.pipe) };
1015
977
  }
1016
- }, jt = {
978
+ }, kt = {
1017
979
  op(e, t, n, r, i, a) {
1018
980
  return e.executeInstructions([{
1019
981
  op: "??",
1020
- params: { pipes: [L(n), r.pipe ?? []] }
982
+ params: { pipes: [z(n), r.pipe ?? []] }
1021
983
  }], [t], i, a);
1022
984
  },
1023
985
  map(e, t) {
1024
- return { pipe: R(t.pipe) };
986
+ return { pipe: B(t.pipe) };
1025
987
  }
1026
- }, Mt = {
988
+ }, At = {
1027
989
  op(e, t, n, r, i, a) {
1028
990
  return e.executeInstructions([{
1029
991
  op: "clc",
1030
992
  params: {
1031
- pipe: L(n),
993
+ pipe: z(n),
1032
994
  operations: [{
1033
995
  op: "%",
1034
996
  params: { by: r.pipe ?? [] }
@@ -1037,21 +999,21 @@ var Dt = {
1037
999
  }], [t], i, a);
1038
1000
  },
1039
1001
  map(e, t) {
1040
- return { pipe: R(t.pipe) };
1002
+ return { pipe: B(t.pipe) };
1041
1003
  }
1042
- }, Nt = {
1004
+ }, jt = {
1043
1005
  op(e, t, n, r, i, a) {
1044
1006
  return e.executeInstructions(r.pipe ?? [], [t], i, a);
1045
1007
  },
1046
1008
  map(e, t) {
1047
- return { pipe: R(t.pipe) };
1009
+ return { pipe: B(t.pipe) };
1048
1010
  }
1049
- }, Pt = {
1011
+ }, Mt = {
1050
1012
  op(e, t, n, r, i, a) {
1051
1013
  return e.executeInstructions([{
1052
1014
  op: "clc",
1053
1015
  params: {
1054
- pipe: L(n),
1016
+ pipe: z(n),
1055
1017
  operations: [{
1056
1018
  op: "-",
1057
1019
  params: { by: r.pipe ?? [] }
@@ -1060,43 +1022,43 @@ var Dt = {
1060
1022
  }], [t], i, a);
1061
1023
  },
1062
1024
  map(e, t) {
1063
- return { pipe: R(t.pipe) };
1025
+ return { pipe: B(t.pipe) };
1064
1026
  }
1065
- }, Ft = {
1027
+ }, Nt = {
1066
1028
  op(e, t, n, r, i, a) {
1067
1029
  return e.executeInstructions(r.pipe ?? [], [n], i, a);
1068
1030
  },
1069
1031
  map(e, t) {
1070
- return { pipe: R(t.pipe) };
1032
+ return { pipe: B(t.pipe) };
1071
1033
  }
1072
- }, It = {
1034
+ }, Pt = {
1073
1035
  op(e, t, n, r, i) {
1074
1036
  let a = async (i, o) => {
1075
1037
  if (await void 0, r.signal.checkHealth(), i >= (n.selectors?.length ?? 0)) {
1076
- let { op: i, params: a } = n.assignment ?? {}, s = Rt[i];
1077
- if (!s) throw new y(`invalid OPU '${i}'`);
1038
+ let { op: i, params: a } = n.assignment ?? {}, s = It[i];
1039
+ if (!s) throw new v(`invalid OPU '${i}'`);
1078
1040
  return s.op(e, t, o, a ?? {}, r, (e) => [e]);
1079
1041
  }
1080
- let { op: s, params: c } = n.selectors[i], l = Lt[s];
1081
- if (!l) throw new y(`invalid OPA '${s}' (assignment)`);
1042
+ let { op: s, params: c } = n.selectors[i], l = Ft[s];
1043
+ if (!l) throw new v(`invalid OPA '${s}' (assignment)`);
1082
1044
  return l.op(e, t, o, c ?? {}, r, (e) => a(i + 1, e));
1083
1045
  };
1084
1046
  return e.executeInstructions(n.pipe ?? [], [t], r, async (t) => e.muxAll([await a(0, t)], (e) => i(e === void 0 ? t : e, r)));
1085
1047
  },
1086
1048
  map(e, t) {
1087
1049
  return {
1088
- pipe: R(t.pipe),
1050
+ pipe: B(t.pipe),
1089
1051
  selectors: e.muxOne([t.selectors], ({ op: t, params: n }) => {
1090
- let r = Lt[t];
1091
- if (!r) throw new y(`invalid OPA '${t}' (assignment)`);
1052
+ let r = Ft[t];
1053
+ if (!r) throw new v(`invalid OPA '${t}' (assignment)`);
1092
1054
  return {
1093
1055
  op: e.assertType(t, "string"),
1094
1056
  params: r.map(e, n)
1095
1057
  };
1096
1058
  }),
1097
1059
  assignment: (({ op: t, params: n }) => {
1098
- let r = Rt[t];
1099
- if (!r) throw new y(`invalid OPU '${t}'`);
1060
+ let r = It[t];
1061
+ if (!r) throw new v(`invalid OPU '${t}'`);
1100
1062
  return {
1101
1063
  op: e.assertType(t, "string"),
1102
1064
  params: r.map(e, n)
@@ -1104,20 +1066,20 @@ var Dt = {
1104
1066
  })(t.assignment)
1105
1067
  };
1106
1068
  }
1069
+ }, Ft = {
1070
+ "$.$": St,
1071
+ "$[]": Ct,
1072
+ "[:]": Tt
1073
+ }, It = {
1074
+ "+=": Et,
1075
+ "/=": Dt,
1076
+ "*=": Ot,
1077
+ "?=": kt,
1078
+ "%=": At,
1079
+ "=": jt,
1080
+ "-=": Mt,
1081
+ "|=": Nt
1107
1082
  }, Lt = {
1108
- "$.$": wt,
1109
- "$[]": Tt,
1110
- "[:]": Dt
1111
- }, Rt = {
1112
- "+=": Ot,
1113
- "/=": kt,
1114
- "*=": At,
1115
- "?=": jt,
1116
- "%=": Mt,
1117
- "=": Nt,
1118
- "-=": Pt,
1119
- "|=": Ft
1120
- }, zt = {
1121
1083
  op(e, t, n, r, a, o) {
1122
1084
  return e.executeInstructions(r.by ?? [], [t], a, async (t) => o(await e.alterValue(n, (n) => {
1123
1085
  let r = e.unwrapValue(t), a = e.type(n), o = e.type(r);
@@ -1132,40 +1094,34 @@ var Dt = {
1132
1094
  case "string":
1133
1095
  if (o === "string") return n + r;
1134
1096
  break;
1135
- case "object":
1136
- if (o === "object") return i(n, Object.entries(r));
1137
- break;
1138
- default:
1097
+ case "object": if (o === "object") return i(n, Object.entries(r));
1139
1098
  }
1140
- throw new j("%s (%*<100v) and %s (%*<100v) cannot be added together", a, n, o, r);
1099
+ throw new k("%s (%*<100v) and %s (%*<100v) cannot be added together", a, n, o, r);
1141
1100
  })));
1142
1101
  },
1143
1102
  map(e, t) {
1144
- return { by: R(t.by) };
1103
+ return { by: B(t.by) };
1145
1104
  }
1146
- }, Bt = {
1105
+ }, Rt = {
1147
1106
  op(e, t, n, r, i, a) {
1148
1107
  return e.executeInstructions(r.by ?? [], [t], i, async (t) => a(await e.alterValue(n, (n) => {
1149
1108
  let r = e.unwrapValue(t), i = e.type(n), a = e.type(r);
1150
1109
  switch (i) {
1151
1110
  case "number":
1152
1111
  if (a === "number") {
1153
- if (r === 0) throw new et("%s (%*<100v) cannot be divided by zero", i, n);
1112
+ if (r === 0) throw new A("%s (%*<100v) cannot be divided by zero", i, n);
1154
1113
  return n / r;
1155
1114
  }
1156
1115
  break;
1157
- case "string":
1158
- if (a === "string") return r === "" ? [...n] : n.split(r);
1159
- break;
1160
- default:
1116
+ case "string": if (a === "string") return r === "" ? [...n] : n.split(r);
1161
1117
  }
1162
- throw new j("%s (%*<100v) cannot be divided by %s (%*<100v)", i, n, a, r);
1118
+ throw new k("%s (%*<100v) cannot be divided by %s (%*<100v)", i, n, a, r);
1163
1119
  })));
1164
1120
  },
1165
1121
  map(e, t) {
1166
- return { by: R(t.by) };
1122
+ return { by: B(t.by) };
1167
1123
  }
1168
- }, Vt = {
1124
+ }, zt = {
1169
1125
  op(e, t, n, r, i, a) {
1170
1126
  return e.executeInstructions(r.by ?? [], [t], i, async (t) => a(await e.alterValue(n, (n) => {
1171
1127
  let r = e.unwrapValue(t), i = e.type(n), a = e.type(r);
@@ -1176,37 +1132,29 @@ var Dt = {
1176
1132
  case "string":
1177
1133
  if (a === "number") return r < 1 ? null : n.repeat(r);
1178
1134
  break;
1179
- case "object":
1180
- if (a === "object") return e.merge(n, r);
1181
- break;
1182
- default:
1135
+ case "object": if (a === "object") return e.merge(n, r);
1183
1136
  }
1184
- throw new j("%s (%*<100v) and %s (%*<100v) cannot be multiplied together", i, n, a, r);
1137
+ throw new k("%s (%*<100v) and %s (%*<100v) cannot be multiplied together", i, n, a, r);
1185
1138
  })));
1186
1139
  },
1187
1140
  map(e, t) {
1188
- return { by: R(t.by) };
1141
+ return { by: B(t.by) };
1189
1142
  }
1190
- }, Ht = {
1143
+ }, Bt = {
1191
1144
  op(e, t, n, r, i, a) {
1192
1145
  return e.executeInstructions(r.by ?? [], [t], i, async (t) => a(await e.alterValue(n, (n) => {
1193
1146
  let r = e.unwrapValue(t), i = e.type(n), a = e.type(r);
1194
- switch (i) {
1195
- case "number":
1196
- if (a === "number") {
1197
- if (r === 0) throw new et("%s (%*<100v) cannot be divided by zero (remainder)", i, n);
1198
- return n % r;
1199
- }
1200
- break;
1201
- default:
1147
+ if (i === "number" && a === "number") {
1148
+ if (r === 0) throw new A("%s (%*<100v) cannot be divided by zero (remainder)", i, n);
1149
+ return n % r;
1202
1150
  }
1203
- throw new j("%s (%*<100v) cannot be divided by %s (%*<100v) (remainder)", i, n, a, r);
1151
+ throw new k("%s (%*<100v) cannot be divided by %s (%*<100v) (remainder)", i, n, a, r);
1204
1152
  })));
1205
1153
  },
1206
1154
  map(e, t) {
1207
- return { by: R(t.by) };
1155
+ return { by: B(t.by) };
1208
1156
  }
1209
- }, Ut = {
1157
+ }, Vt = {
1210
1158
  op(e, t, n, r, a, o) {
1211
1159
  return e.executeInstructions(r.by ?? [], [t], a, async (t) => o(await e.alterValue(n, (n) => {
1212
1160
  let r = e.unwrapValue(t), a = e.type(n), o = e.type(r);
@@ -1224,37 +1172,33 @@ var Dt = {
1224
1172
  case "string":
1225
1173
  if (o === "string") return n.replaceAll(r, "");
1226
1174
  break;
1227
- case "object":
1228
- switch (o) {
1229
- case "array": return r.length === 0 ? n : i(n, Object.entries(n).filter(([, t]) => r.some((n) => e.equals(t, n))).map(([e]) => [e]));
1230
- case "string": return i(n, [[r]]);
1231
- default:
1232
- }
1233
- break;
1234
- default:
1175
+ case "object": switch (o) {
1176
+ case "array": return r.length === 0 ? n : i(n, Object.entries(n).filter(([, t]) => r.some((n) => e.equals(t, n))).map(([e]) => [e]));
1177
+ case "string": return i(n, [[r]]);
1178
+ }
1235
1179
  }
1236
- throw new j("%s (%*<100v) and %s (%*<100v) cannot be subtracted", a, n, o, r);
1180
+ throw new k("%s (%*<100v) and %s (%*<100v) cannot be subtracted", a, n, o, r);
1237
1181
  })));
1238
1182
  },
1239
1183
  map(e, t) {
1240
- return { by: R(t.by) };
1184
+ return { by: B(t.by) };
1241
1185
  }
1242
- }, Wt = {
1186
+ }, Ht = {
1243
1187
  op(e, t, n, r, i) {
1244
1188
  let a = async (o, s) => {
1245
1189
  if (await void 0, r.signal.checkHealth(), o >= (n.operations?.length ?? 0)) return i(s, r);
1246
- let { op: c, params: l } = n.operations[o], u = Gt[c];
1247
- if (!u) throw new y(`invalid OPM '${c}'`);
1190
+ let { op: c, params: l } = n.operations[o], u = Ut[c];
1191
+ if (!u) throw new v(`invalid OPM '${c}'`);
1248
1192
  return u.op(e, t, s, l ?? {}, r, (e) => a(o + 1, e));
1249
1193
  };
1250
1194
  return e.executeInstructions(n.pipe ?? [], [t], r, (e) => a(0, e));
1251
1195
  },
1252
1196
  map(e, t) {
1253
1197
  return {
1254
- pipe: R(t.pipe),
1198
+ pipe: B(t.pipe),
1255
1199
  operations: e.muxOne([t.operations], ({ op: t, params: n }) => {
1256
- let r = Gt[t];
1257
- if (!r) throw new y(`invalid OPM '${t}'`);
1200
+ let r = Ut[t];
1201
+ if (!r) throw new v(`invalid OPM '${t}'`);
1258
1202
  return {
1259
1203
  op: e.assertType(t, "string"),
1260
1204
  params: r.map(e, n)
@@ -1262,70 +1206,70 @@ var Dt = {
1262
1206
  })
1263
1207
  };
1264
1208
  }
1265
- }, Gt = {
1266
- "+": zt,
1267
- "/": Bt,
1268
- "*": Vt,
1269
- "%": Ht,
1270
- "-": Ut
1271
- }, Kt = {
1209
+ }, Ut = {
1210
+ "+": Lt,
1211
+ "/": Rt,
1212
+ "*": zt,
1213
+ "%": Bt,
1214
+ "-": Vt
1215
+ }, Wt = {
1272
1216
  op(e, t, n, r, i, a) {
1273
1217
  return e.executeInstructions(r.by ?? [], [t], i, (t) => a(e.equals(n, t)));
1274
1218
  },
1275
1219
  map(e, t) {
1276
- return { by: R(t.by) };
1220
+ return { by: B(t.by) };
1277
1221
  }
1278
- }, qt = {
1222
+ }, Gt = {
1279
1223
  op(e, t, n, r, i, a) {
1280
1224
  return e.executeInstructions(r.by ?? [], [t], i, (t) => a(e.compare(n, t) > 0));
1281
1225
  },
1282
1226
  map(e, t) {
1283
- return { by: R(t.by) };
1227
+ return { by: B(t.by) };
1284
1228
  }
1285
- }, Jt = {
1229
+ }, Kt = {
1286
1230
  op(e, t, n, r, i, a) {
1287
1231
  return e.executeInstructions(r.by ?? [], [t], i, (t) => a(e.compare(n, t) >= 0));
1288
1232
  },
1289
1233
  map(e, t) {
1290
- return { by: R(t.by) };
1234
+ return { by: B(t.by) };
1291
1235
  }
1292
- }, Yt = {
1236
+ }, qt = {
1293
1237
  op(e, t, n, r, i, a) {
1294
1238
  return e.executeInstructions(r.by ?? [], [t], i, (t) => a(e.compare(n, t) < 0));
1295
1239
  },
1296
1240
  map(e, t) {
1297
- return { by: R(t.by) };
1241
+ return { by: B(t.by) };
1298
1242
  }
1299
- }, Xt = {
1243
+ }, Jt = {
1300
1244
  op(e, t, n, r, i, a) {
1301
1245
  return e.executeInstructions(r.by ?? [], [t], i, (t) => a(e.compare(n, t) <= 0));
1302
1246
  },
1303
1247
  map(e, t) {
1304
- return { by: R(t.by) };
1248
+ return { by: B(t.by) };
1305
1249
  }
1306
- }, Zt = {
1250
+ }, Yt = {
1307
1251
  op(e, t, n, r, i, a) {
1308
1252
  return e.executeInstructions(r.by ?? [], [t], i, (t) => a(!e.equals(n, t)));
1309
1253
  },
1310
1254
  map(e, t) {
1311
- return { by: R(t.by) };
1255
+ return { by: B(t.by) };
1312
1256
  }
1313
- }, Qt = {
1257
+ }, Xt = {
1314
1258
  op(e, t, n, r, i) {
1315
1259
  let a = async (o, s) => {
1316
1260
  if (await void 0, r.signal.checkHealth(), o >= (n.comparisons?.length ?? 0)) return i(s, r);
1317
- let { op: c, params: l } = n.comparisons[o], u = $t[c];
1318
- if (!u) throw new y(`invalid OPC '${c}'`);
1261
+ let { op: c, params: l } = n.comparisons[o], u = Zt[c];
1262
+ if (!u) throw new v(`invalid OPC '${c}'`);
1319
1263
  return u.op(e, t, s, l ?? {}, r, (e) => a(o + 1, e));
1320
1264
  };
1321
1265
  return e.executeInstructions(n.pipe ?? [], [t], r, (e) => a(0, e));
1322
1266
  },
1323
1267
  map(e, t) {
1324
1268
  return {
1325
- pipe: R(t.pipe),
1269
+ pipe: B(t.pipe),
1326
1270
  comparisons: e.muxOne([t.comparisons], ({ op: t, params: n }) => {
1327
- let r = $t[t];
1328
- if (!r) throw new y(`invalid OPC '${t}'`);
1271
+ let r = Zt[t];
1272
+ if (!r) throw new v(`invalid OPC '${t}'`);
1329
1273
  return {
1330
1274
  op: e.assertType(t, "string"),
1331
1275
  params: r.map(e, n)
@@ -1333,20 +1277,20 @@ var Dt = {
1333
1277
  })
1334
1278
  };
1335
1279
  }
1336
- }, $t = {
1337
- "==": Kt,
1338
- ">": qt,
1339
- ">=": Jt,
1340
- "<": Yt,
1341
- "<=": Xt,
1342
- "!=": Zt
1343
- }, en = {
1344
- "$.": bt,
1345
- and: St,
1346
- "[]": Ct,
1347
- "$=": It,
1348
- clc: Wt,
1349
- cmp: Qt,
1280
+ }, Zt = {
1281
+ "==": Wt,
1282
+ ">": Gt,
1283
+ ">=": Kt,
1284
+ "<": qt,
1285
+ "<=": Jt,
1286
+ "!=": Yt
1287
+ }, Qt = {
1288
+ "$.": vt,
1289
+ and: bt,
1290
+ "[]": xt,
1291
+ "$=": Pt,
1292
+ clc: Ht,
1293
+ cmp: Xt,
1350
1294
  cnt: {
1351
1295
  op(e, t, n, r, i) {
1352
1296
  return i(n.value ?? null, r);
@@ -1381,12 +1325,12 @@ var Dt = {
1381
1325
  },
1382
1326
  fun: {
1383
1327
  op(e, t, n, r, i) {
1384
- return i(ot(n.argNames ?? [], n.pipe ?? [], r), r);
1328
+ return i(N(n.argNames ?? [], n.pipe ?? [], r), r);
1385
1329
  },
1386
1330
  map(e, t) {
1387
1331
  return {
1388
1332
  argNames: e.muxOne([t.argNames], (t) => e.assertType(t, "string")),
1389
- pipe: R(t.pipe)
1333
+ pipe: B(t.pipe)
1390
1334
  };
1391
1335
  }
1392
1336
  },
@@ -1402,10 +1346,10 @@ var Dt = {
1402
1346
  map(e, t) {
1403
1347
  return {
1404
1348
  ifs: e.muxOne([t.ifs], (e) => ({
1405
- if: R(e.if),
1406
- then: R(e.then)
1349
+ if: B(e.if),
1350
+ then: B(e.then)
1407
1351
  })),
1408
- else: R(t.else)
1352
+ else: B(t.else)
1409
1353
  };
1410
1354
  }
1411
1355
  },
@@ -1418,7 +1362,7 @@ var Dt = {
1418
1362
  return {
1419
1363
  interpolations: e.muxOne([t.interpolations], (t) => ({
1420
1364
  before: e.assertType(t.before, "string"),
1421
- pipe: R(t.pipe)
1365
+ pipe: B(t.pipe)
1422
1366
  })),
1423
1367
  after: e.assertType(t.after, "string")
1424
1368
  };
@@ -1428,11 +1372,8 @@ var Dt = {
1428
1372
  async op(e, t, n, r, i) {
1429
1373
  return i(await e.alterValue(t, (t) => {
1430
1374
  let n = e.type(t);
1431
- switch (n) {
1432
- case "number": return -t;
1433
- default:
1434
- }
1435
- throw new j("%s (%*<100v) cannot be negated", n, t);
1375
+ if (n === "number") return -t;
1376
+ throw new k("%s (%*<100v) cannot be negated", n, t);
1436
1377
  }), r);
1437
1378
  },
1438
1379
  map(e, t) {
@@ -1462,7 +1403,7 @@ var Dt = {
1462
1403
  return a(0);
1463
1404
  },
1464
1405
  map(e, t) {
1465
- return { pipes: e.muxOne([t.pipes], (e) => R(e)) };
1406
+ return { pipes: e.muxOne([t.pipes], (e) => B(e)) };
1466
1407
  }
1467
1408
  },
1468
1409
  nbr: {
@@ -1479,20 +1420,17 @@ var Dt = {
1479
1420
  let [i, a] = await Promise.all([e.executeInstructions(n.key ?? [], [t], r), e.executeInstructions(n.value ?? [], [t], r)]);
1480
1421
  return e.muxAll([e.unwrapValues(i), a], (t, r) => {
1481
1422
  let i = e.type(t);
1482
- switch (i) {
1483
- case "string": return [[t, r]];
1484
- default:
1485
- }
1423
+ if (i === "string") return [[t, r]];
1486
1424
  if (n.optional) return [];
1487
- throw new j("cannot use %s (%*<100v) as object key", i, t);
1425
+ throw new k("cannot use %s (%*<100v) as object key", i, t);
1488
1426
  });
1489
1427
  });
1490
1428
  return e.muxAll(a, (...e) => i(Object.fromEntries(e), r));
1491
1429
  },
1492
1430
  map(e, t) {
1493
1431
  return { fields: e.muxOne([t.fields], (t) => ({
1494
- key: R(t.key),
1495
- value: R(t.value),
1432
+ key: B(t.key),
1433
+ value: B(t.value),
1496
1434
  optional: e.assertType(t.optional, "boolean")
1497
1435
  })) };
1498
1436
  }
@@ -1507,7 +1445,7 @@ var Dt = {
1507
1445
  return a(0);
1508
1446
  },
1509
1447
  map(e, t) {
1510
- return { pipes: e.muxOne([t.pipes], (e) => R(e)) };
1448
+ return { pipes: e.muxOne([t.pipes], (e) => B(e)) };
1511
1449
  }
1512
1450
  },
1513
1451
  ",": {
@@ -1515,7 +1453,7 @@ var Dt = {
1515
1453
  return e.muxAll([n.pipes ?? []], (n) => e.executeInstructions(n ?? [], [t], r, (e) => i(e, r)));
1516
1454
  },
1517
1455
  map(e, t) {
1518
- return { pipes: e.muxOne([t.pipes], (e) => R(e)) };
1456
+ return { pipes: e.muxOne([t.pipes], (e) => B(e)) };
1519
1457
  }
1520
1458
  },
1521
1459
  "\"\"": {
@@ -1534,25 +1472,25 @@ var Dt = {
1534
1472
  try {
1535
1473
  return await i(e, r);
1536
1474
  } catch (e) {
1537
- throw new v(e);
1475
+ throw new _(e);
1538
1476
  }
1539
1477
  });
1540
1478
  } catch (t) {
1541
- if (v.is(t)) throw t.inner;
1542
- if (!g.is(t)) throw t;
1479
+ if (_.is(t)) throw t.inner;
1480
+ if (!h.is(t)) throw t;
1543
1481
  return a.signal.exit(), e.executeInstructions(n.catch ?? [], [t.value], r, (e) => i(e, r));
1544
1482
  }
1545
1483
  },
1546
1484
  map(e, t) {
1547
1485
  return {
1548
- try: R(t.try),
1549
- catch: R(t.catch)
1486
+ try: B(t.try),
1487
+ catch: B(t.catch)
1550
1488
  };
1551
1489
  }
1552
1490
  },
1553
1491
  var: {
1554
1492
  op(e, t, n, r, i) {
1555
- if (!Object.hasOwn(r.vars, n.name ?? "")) throw new $e("%s is not defined", n.name ?? "");
1493
+ if (!Object.hasOwn(r.vars, n.name ?? "")) throw new tt("%s is not defined", n.name ?? "");
1556
1494
  return i(r.vars[n.name ?? ""], r);
1557
1495
  },
1558
1496
  map(e, t) {
@@ -1566,7 +1504,7 @@ var Dt = {
1566
1504
  map(e, t) {
1567
1505
  return {
1568
1506
  name: e.assertType(t.name, "string"),
1569
- pipe: R(t.pipe)
1507
+ pipe: B(t.pipe)
1570
1508
  };
1571
1509
  }
1572
1510
  },
@@ -1578,22 +1516,22 @@ var Dt = {
1578
1516
  return {};
1579
1517
  }
1580
1518
  }
1581
- }, tn = {};
1582
- function z(e = {}, t = {}) {
1519
+ }, $t = {};
1520
+ function en(e = {}, t = {}) {
1583
1521
  return r(e, t);
1584
1522
  }
1585
- function nn(e) {
1523
+ function tn(e) {
1586
1524
  let t = e?.version, [, n, r] = typeof t == "string" ? /^(\d+)\.(\d+)?$/g.exec(t) ?? [] : [];
1587
- if (!n || !r || !Array.isArray(e.instructions)) throw new y("invalid program definition");
1588
- if (+n != 1 || +r > 0) throw new y(`unsupported program definition v${n}.${r} - this version of JPL only supports v1 (up to v${m})`);
1525
+ if (!n || !r || !Array.isArray(e.instructions)) throw new v("invalid program definition");
1526
+ if (+n != 1 || +r > 0) throw new v(`unsupported program definition v${n}.${r} - this version of JPL only supports v1 (up to v1.0)`);
1589
1527
  }
1590
- var rn = class e {
1528
+ var nn = class e {
1591
1529
  #e;
1592
1530
  #t;
1593
1531
  #n;
1594
1532
  #r;
1595
1533
  constructor(e, t) {
1596
- nn(e), this.#e = z(t?.program, tn), this.#t = t?.runtime, this.#n = e, this.#r = en;
1534
+ tn(e), this.#e = en(t?.program, $t), this.#t = t?.runtime, this.#n = e, this.#r = Qt;
1597
1535
  }
1598
1536
  get options() {
1599
1537
  return this.#e;
@@ -1605,36 +1543,44 @@ var rn = class e {
1605
1543
  return this.#r;
1606
1544
  }
1607
1545
  run = async (e, t) => {
1608
- let n = new mt(this, { runtime: N(t?.runtime, this.#t) }), r = n.normalizeValues(e, "program inputs"), i = await n.execute(r);
1546
+ let n = new dt(this, { runtime: I(t?.runtime, this.#t) }), r = n.normalizeValues(e, "program inputs"), i = await n.execute(r);
1609
1547
  return n.stripJSON(i);
1610
1548
  };
1611
- prepend = (t) => (nn(t), new e({
1612
- version: m,
1613
- instructions: [...t.instructions, ...this.definition.instructions]
1614
- }, {
1615
- program: this.#e,
1616
- runtime: this.#t
1617
- }));
1618
- append = (t) => (nn(t), new e({
1619
- version: m,
1620
- instructions: [...this.definition.instructions, ...t.instructions]
1621
- }, {
1622
- program: this.#e,
1623
- runtime: this.#t
1624
- }));
1625
- }, an = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", on = "0123456789", sn = `${an}_$`, cn = `${sn}${on}`, ln = cn, un = " \xA0\r\n ", dn = `${on}abcdefABCDEF`;
1626
- function B(e, t, n) {
1549
+ prepend = (t) => {
1550
+ tn(t);
1551
+ let n = {
1552
+ version: "1.0",
1553
+ instructions: [...t.instructions, ...this.definition.instructions]
1554
+ };
1555
+ return new e(n, {
1556
+ program: this.#e,
1557
+ runtime: this.#t
1558
+ });
1559
+ };
1560
+ append = (t) => {
1561
+ tn(t);
1562
+ let n = {
1563
+ version: "1.0",
1564
+ instructions: [...this.definition.instructions, ...t.instructions]
1565
+ };
1566
+ return new e(n, {
1567
+ program: this.#e,
1568
+ runtime: this.#t
1569
+ });
1570
+ };
1571
+ }, rn = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", an = "0123456789", on = `${rn}_$`, sn = `${on}${an}`, cn = sn, ln = " \xA0\r\n ", un = `${an}abcdefABCDEF`;
1572
+ function V(e, t, n) {
1627
1573
  let r = t, i = !1;
1628
1574
  for (;;) {
1629
- let t = V(e, r, n, { phrase: "#" });
1575
+ let t = H(e, r, n, { phrase: "#" });
1630
1576
  if (t.is) {
1631
1577
  for ({i: r} = t;;) {
1632
- let t = U(e, r, n, { set: "\r\n" });
1578
+ let t = W(e, r, n, { set: "\r\n" });
1633
1579
  if (t.is) {
1634
1580
  ({i: r} = t);
1635
1581
  break;
1636
1582
  }
1637
- let i = G(e, r, n);
1583
+ let i = K(e, r, n);
1638
1584
  if (i.is) {
1639
1585
  ({i: r} = i);
1640
1586
  break;
@@ -1644,14 +1590,14 @@ function B(e, t, n) {
1644
1590
  i = !0;
1645
1591
  continue;
1646
1592
  }
1647
- if (t = V(e, r, n, { phrase: "/*" }), t.is) {
1593
+ if (t = H(e, r, n, { phrase: "/*" }), t.is) {
1648
1594
  for ({i: r} = t;;) {
1649
- if (t = V(e, r, n, { phrase: "*/" }), t.is) {
1595
+ if (t = H(e, r, n, { phrase: "*/" }), t.is) {
1650
1596
  ({i: r} = t);
1651
1597
  break;
1652
1598
  }
1653
- let i = G(e, r, n);
1654
- if (i.is) return {i: r} = i, K(e, r, n, {
1599
+ let i = K(e, r, n);
1600
+ if (i.is) return {i: r} = i, q(e, r, n, {
1655
1601
  operator: "comment",
1656
1602
  message: "incomplete comment"
1657
1603
  });
@@ -1660,7 +1606,7 @@ function B(e, t, n) {
1660
1606
  i = !0;
1661
1607
  continue;
1662
1608
  }
1663
- let a = U(e, r, n, { set: un });
1609
+ let a = W(e, r, n, { set: ln });
1664
1610
  if ({i: r} = a, !a.is) break;
1665
1611
  i = !0;
1666
1612
  }
@@ -1669,24 +1615,24 @@ function B(e, t, n) {
1669
1615
  is: i
1670
1616
  };
1671
1617
  }
1672
- function V(e, t, n, { phrase: r, notBeforeSet: i, spaceBefore: a, spaceAfter: o }) {
1618
+ function H(e, t, n, { phrase: r, notBeforeSet: i, spaceBefore: a, spaceAfter: o }) {
1673
1619
  let s = t;
1674
- if (a && t > 0 && !U(e, s - 1, n, {
1675
- set: ln,
1620
+ if (a && t > 0 && !W(e, s - 1, n, {
1621
+ set: cn,
1676
1622
  exclusive: !0
1677
1623
  }).is) return {
1678
1624
  i: s,
1679
1625
  is: !1
1680
1626
  };
1681
1627
  for (let t = 0; t < r.length; t += 1, s += 1) {
1682
- let i = G(e, s, n);
1628
+ let i = K(e, s, n);
1683
1629
  if (i.is || e[s] !== r[t]) return {
1684
1630
  i: i.i,
1685
1631
  is: !1
1686
1632
  };
1687
1633
  }
1688
- return !G(e, s, n).is && (i && U(e, s, n, { set: i }).is || o && !U(e, s, n, {
1689
- set: ln,
1634
+ return !K(e, s, n).is && (i && W(e, s, n, { set: i }).is || o && !W(e, s, n, {
1635
+ set: cn,
1690
1636
  exclusive: !0
1691
1637
  }).is) ? {
1692
1638
  i: s,
@@ -1696,14 +1642,14 @@ function V(e, t, n, { phrase: r, notBeforeSet: i, spaceBefore: a, spaceAfter: o
1696
1642
  is: !0
1697
1643
  };
1698
1644
  }
1699
- function H(e, t, n, { phrase: r, notBeforeSet: i, spaceBefore: a, spaceAfter: o }) {
1700
- let s = t, c = V(e, s, n, {
1645
+ function U(e, t, n, { phrase: r, notBeforeSet: i, spaceBefore: a, spaceAfter: o }) {
1646
+ let s = t, c = H(e, s, n, {
1701
1647
  phrase: r,
1702
1648
  notBeforeSet: i,
1703
1649
  spaceBefore: a,
1704
1650
  spaceAfter: o
1705
1651
  });
1706
- return c.is ? ({i: s} = c, {i: s} = B(e, s, n), {
1652
+ return c.is ? ({i: s} = c, {i: s} = V(e, s, n), {
1707
1653
  i: s,
1708
1654
  is: !0
1709
1655
  }) : {
@@ -1711,11 +1657,11 @@ function H(e, t, n, { phrase: r, notBeforeSet: i, spaceBefore: a, spaceAfter: o
1711
1657
  is: !1
1712
1658
  };
1713
1659
  }
1714
- function fn(e, t, n) {
1715
- return U(e, t, n, { set: dn });
1660
+ function dn(e, t, n) {
1661
+ return W(e, t, n, { set: un });
1716
1662
  }
1717
- function U(e, t, n, { set: r, exclusive: i }) {
1718
- let a = G(e, t, n);
1663
+ function W(e, t, n, { set: r, exclusive: i }) {
1664
+ let a = K(e, t, n);
1719
1665
  if (a.is) return {
1720
1666
  i: a.i,
1721
1667
  is: !1,
@@ -1732,21 +1678,21 @@ function U(e, t, n, { set: r, exclusive: i }) {
1732
1678
  value: ""
1733
1679
  };
1734
1680
  }
1735
- function pn(e, t, n) {
1681
+ function fn(e, t, n) {
1736
1682
  let r = t, i = !1, a = "";
1737
1683
  for (;;) {
1738
- let t = U(e, r, n, { set: i ? cn : sn });
1684
+ let t = W(e, r, n, { set: i ? sn : on });
1739
1685
  if ({i: r} = t, !t.is) break;
1740
1686
  i = !0, a += t.value;
1741
1687
  }
1742
- return i && ({i: r} = B(e, r, n)), {
1688
+ return i && ({i: r} = V(e, r, n)), {
1743
1689
  i: r,
1744
1690
  is: i,
1745
1691
  value: a
1746
1692
  };
1747
1693
  }
1748
- function W(e, t, n) {
1749
- let r = pn(e, t, n);
1694
+ function G(e, t, n) {
1695
+ let r = fn(e, t, n);
1750
1696
  if (!r.is) return r;
1751
1697
  switch (r.value) {
1752
1698
  case "and":
@@ -1771,7 +1717,7 @@ function W(e, t, n) {
1771
1717
  default: return r;
1772
1718
  }
1773
1719
  }
1774
- function G(e, t, n) {
1720
+ function K(e, t, n) {
1775
1721
  return t >= e.length ? {
1776
1722
  i: e.length,
1777
1723
  is: !0
@@ -1780,7 +1726,7 @@ function G(e, t, n) {
1780
1726
  is: !1
1781
1727
  };
1782
1728
  }
1783
- function mn(e, t, n) {
1729
+ function pn(e, t, n) {
1784
1730
  let r = e.substring(0, t).split(/\r?\n|\r/), i = r[r.length - 1];
1785
1731
  return {
1786
1732
  i: t,
@@ -1788,7 +1734,7 @@ function mn(e, t, n) {
1788
1734
  column: i.length
1789
1735
  };
1790
1736
  }
1791
- function hn(e, t, n, { area: r = 25 } = {}) {
1737
+ function mn(e, t, n, { area: r = 25 } = {}) {
1792
1738
  let i = Math.max(Math.min(t, e.length - 1 - r), r) - r, a = Math.min(i + r + 1 + r, e.length), o = e.substring(i, a).replaceAll(/\r?\n|\r/g, "⏎").replaceAll(" ", "→"), s = " > ";
1793
1739
  i > 0 && (s += "…");
1794
1740
  let c = "";
@@ -1797,79 +1743,78 @@ function hn(e, t, n, { area: r = 25 } = {}) {
1797
1743
  value: `${s}${o}${c}\n${" ".repeat(s.length + (t - i))}^ here`
1798
1744
  };
1799
1745
  }
1800
- function K(e, t, n, { operator: r, message: i } = {}) {
1746
+ function q(e, t, n, { operator: r, message: i } = {}) {
1801
1747
  let a;
1802
- if (G(e, t, n).is) a = "unexpected EOT";
1748
+ if (K(e, t, n).is) a = "unexpected EOT";
1803
1749
  else {
1804
- let { line: r, column: i } = mn(e, t, n);
1750
+ let { line: r, column: i } = pn(e, t, n);
1805
1751
  a = `unexpected token '${e[t]}' at line ${r + 1}, column ${i + 1}`;
1806
1752
  }
1807
- throw r && (a += ` while parsing ${r}`), i && (a += `: ${i}`), a += `\n${hn(e, t, n).value}`, new nt(a, e, t);
1753
+ throw r && (a += ` while parsing ${r}`), i && (a += `: ${i}`), a += `\n${mn(e, t, n).value}`, new j(a, e, t);
1808
1754
  }
1809
- function gn(e, t, n, { operator: r, message: i } = {}) {
1755
+ function hn(e, t, n, { operator: r, message: i } = {}) {
1810
1756
  let a = "error";
1811
- throw r && (a += ` while parsing ${r}`), i && (a += `: ${i}`), a += `\n${hn(e, t, n).value}`, new nt(a, e, t);
1757
+ throw r && (a += ` while parsing ${r}`), i && (a += `: ${i}`), a += `\n${mn(e, t, n).value}`, new j(a, e, t);
1812
1758
  }
1813
- //#endregion
1814
- //#region lib/interpreter/parse.ts
1815
- async function _n(e, t, n) {
1816
- let r = t, i = await vn(e, r, n);
1817
- return {i: r} = i, G(e, r, n).is ? i : K(e, r, n, {
1759
+ // lib/interpreter/parse.ts
1760
+ async function gn(e, t, n) {
1761
+ let r = t, i = await _n(e, r, n);
1762
+ return {i: r} = i, K(e, r, n).is ? i : q(e, r, n, {
1818
1763
  operator: "program",
1819
1764
  message: "expected EOT"
1820
1765
  });
1821
1766
  }
1822
- function vn(e, t, n) {
1767
+ function _n(e, t, n) {
1823
1768
  let r = t;
1824
- return {i: r} = B(e, r, n), q(e, r, n);
1769
+ return {i: r} = V(e, r, n), J(e, r, n);
1825
1770
  }
1826
- function yn(e, t, n) {
1827
- let r = t, i = H(e, r, n, { phrase: "(" });
1828
- if ({i: r} = i, !i.is) return K(e, r, n, {
1771
+ function vn(e, t, n) {
1772
+ let r = t, i = U(e, r, n, { phrase: "(" });
1773
+ if ({i: r} = i, !i.is) return q(e, r, n, {
1829
1774
  operator: "function definition",
1830
1775
  message: "expected '('"
1831
1776
  });
1832
1777
  let a = [];
1833
- if (i = H(e, r, n, { phrase: ")" }), i.is) ({i: r} = i);
1778
+ if (i = U(e, r, n, { phrase: ")" }), i.is) ({i: r} = i);
1834
1779
  else for (;;) {
1835
- let t = W(e, r, n);
1836
- if (!t.is) return K(e, r, n, {
1780
+ let t = G(e, r, n);
1781
+ if (!t.is) return q(e, r, n, {
1837
1782
  operator: "function definition",
1838
1783
  message: "expected argument name"
1839
1784
  });
1840
1785
  let o;
1841
- if ({i: r, value: o} = t, a.push(o), i = H(e, r, n, { phrase: ")" }), i.is) {
1786
+ if ({i: r, value: o} = t, a.push(o), i = U(e, r, n, { phrase: ")" }), i.is) {
1842
1787
  ({i: r} = i);
1843
1788
  break;
1844
1789
  }
1845
- if (i = H(e, r, n, { phrase: "," }), {i: r} = i, !i.is) return K(e, r, n, {
1790
+ if (i = U(e, r, n, { phrase: "," }), {i: r} = i, !i.is) return q(e, r, n, {
1846
1791
  operator: "function definition",
1847
1792
  message: "expected ',' or ')'"
1848
1793
  });
1849
1794
  }
1850
- return i = H(e, r, n, { phrase: ":" }), {i: r} = i, i.is ? {
1795
+ return i = U(e, r, n, { phrase: ":" }), {i: r} = i, i.is ? {
1851
1796
  i: r,
1852
1797
  argNames: a
1853
- } : K(e, r, n, {
1798
+ } : q(e, r, n, {
1854
1799
  operator: "function definition",
1855
1800
  message: "expected ':'"
1856
1801
  });
1857
1802
  }
1858
- async function bn(e, t, n, { identity: r } = {}) {
1803
+ async function yn(e, t, n, { identity: r } = {}) {
1859
1804
  let i = t, a = [], o = !0;
1860
1805
  for (;;) {
1861
- let t = H(e, i, n, { phrase: "." });
1806
+ let t = U(e, i, n, { phrase: "." });
1862
1807
  if (!(r && a.length === 0) && t.is) {
1863
1808
  ({i: i} = t);
1864
- let r = W(e, i, n);
1865
- if (!r.is) return K(e, i, n, {
1809
+ let r = G(e, i, n);
1810
+ if (!r.is) return q(e, i, n, {
1866
1811
  operator: "field access operator",
1867
1812
  message: "expected field name"
1868
1813
  });
1869
1814
  let o;
1870
1815
  ({i: i, value: o} = r);
1871
1816
  let s = !1;
1872
- t = H(e, i, n, {
1817
+ t = U(e, i, n, {
1873
1818
  phrase: "?",
1874
1819
  notBeforeSet: "?="
1875
1820
  }), t.is && ({i: i, is: s} = t), a.push({
@@ -1884,11 +1829,11 @@ async function bn(e, t, n, { identity: r } = {}) {
1884
1829
  });
1885
1830
  continue;
1886
1831
  }
1887
- if (t = H(e, i, n, { phrase: "[" }), t.is) {
1888
- if ({i: i} = t, t = H(e, i, n, { phrase: "]" }), t.is) {
1832
+ if (t = U(e, i, n, { phrase: "[" }), t.is) {
1833
+ if ({i: i} = t, t = U(e, i, n, { phrase: "]" }), t.is) {
1889
1834
  ({i: i} = t);
1890
1835
  let r = !1;
1891
- t = H(e, i, n, {
1836
+ t = U(e, i, n, {
1892
1837
  phrase: "?",
1893
1838
  notBeforeSet: "?="
1894
1839
  }), t.is && ({i: i, is: r} = t), a.push({
@@ -1897,11 +1842,11 @@ async function bn(e, t, n, { identity: r } = {}) {
1897
1842
  });
1898
1843
  continue;
1899
1844
  }
1900
- if (t = H(e, i, n, { phrase: ":" }), t.is) {
1901
- if ({i: i} = t, t = H(e, i, n, { phrase: "]" }), t.is) {
1845
+ if (t = U(e, i, n, { phrase: ":" }), t.is) {
1846
+ if ({i: i} = t, t = U(e, i, n, { phrase: "]" }), t.is) {
1902
1847
  ({i: i} = t);
1903
1848
  let r = !1;
1904
- t = H(e, i, n, {
1849
+ t = U(e, i, n, {
1905
1850
  phrase: "?",
1906
1851
  notBeforeSet: "?="
1907
1852
  }), t.is && ({i: i, is: r} = t), a.push({
@@ -1921,12 +1866,12 @@ async function bn(e, t, n, { identity: r } = {}) {
1921
1866
  continue;
1922
1867
  }
1923
1868
  let r;
1924
- if ({i: i, ops: r} = await q(e, i, n), t = H(e, i, n, { phrase: "]" }), {i: i} = t, !t.is) return K(e, i, n, {
1869
+ if ({i: i, ops: r} = await J(e, i, n), t = U(e, i, n, { phrase: "]" }), {i: i} = t, !t.is) return q(e, i, n, {
1925
1870
  operator: "array slice operator",
1926
1871
  message: "expected ']'"
1927
1872
  });
1928
1873
  let o = !1;
1929
- t = H(e, i, n, {
1874
+ t = U(e, i, n, {
1930
1875
  phrase: "?",
1931
1876
  notBeforeSet: "?="
1932
1877
  }), t.is && ({i: i, is: o} = t), a.push({
@@ -1943,10 +1888,10 @@ async function bn(e, t, n, { identity: r } = {}) {
1943
1888
  continue;
1944
1889
  }
1945
1890
  let r;
1946
- if ({i: i, ops: r} = await q(e, i, n), t = H(e, i, n, { phrase: "]" }), t.is) {
1891
+ if ({i: i, ops: r} = await J(e, i, n), t = U(e, i, n, { phrase: "]" }), t.is) {
1947
1892
  ({i: i} = t);
1948
1893
  let o = !1;
1949
- t = H(e, i, n, {
1894
+ t = U(e, i, n, {
1950
1895
  phrase: "?",
1951
1896
  notBeforeSet: "?="
1952
1897
  }), t.is && ({i: i, is: o} = t), a.push({
@@ -1958,14 +1903,14 @@ async function bn(e, t, n, { identity: r } = {}) {
1958
1903
  });
1959
1904
  continue;
1960
1905
  }
1961
- if (t = H(e, i, n, { phrase: ":" }), !t.is) return K(e, i, n, {
1906
+ if (t = U(e, i, n, { phrase: ":" }), !t.is) return q(e, i, n, {
1962
1907
  operator: "variable access operator",
1963
1908
  message: "expected ':' or ']'"
1964
1909
  });
1965
- if ({i: i} = t, t = H(e, i, n, { phrase: "]" }), t.is) {
1910
+ if ({i: i} = t, t = U(e, i, n, { phrase: "]" }), t.is) {
1966
1911
  ({i: i} = t);
1967
1912
  let o = !1;
1968
- t = H(e, i, n, {
1913
+ t = U(e, i, n, {
1969
1914
  phrase: "?",
1970
1915
  notBeforeSet: "?="
1971
1916
  }), t.is && ({i: i, is: o} = t), a.push({
@@ -1982,12 +1927,12 @@ async function bn(e, t, n, { identity: r } = {}) {
1982
1927
  continue;
1983
1928
  }
1984
1929
  let o;
1985
- if ({i: i, ops: o} = await q(e, i, n), t = H(e, i, n, { phrase: "]" }), {i: i} = t, !t.is) return K(e, i, n, {
1930
+ if ({i: i, ops: o} = await J(e, i, n), t = U(e, i, n, { phrase: "]" }), {i: i} = t, !t.is) return q(e, i, n, {
1986
1931
  operator: "array slice operator",
1987
1932
  message: "expected ']'"
1988
1933
  });
1989
1934
  let s = !1;
1990
- t = H(e, i, n, {
1935
+ t = U(e, i, n, {
1991
1936
  phrase: "?",
1992
1937
  notBeforeSet: "?="
1993
1938
  }), t.is && ({i: i, is: s} = t), a.push({
@@ -2001,27 +1946,27 @@ async function bn(e, t, n, { identity: r } = {}) {
2001
1946
  continue;
2002
1947
  }
2003
1948
  let s = !1;
2004
- if (t = H(e, i, n, { phrase: "->" }), t.is && ({i: i, is: s} = t), t = H(e, i, n, { phrase: "(" }), !t.is && s) return K(e, i, n, {
1949
+ if (t = U(e, i, n, { phrase: "->" }), t.is && ({i: i, is: s} = t), t = U(e, i, n, { phrase: "(" }), !t.is && s) return q(e, i, n, {
2005
1950
  operator: "bound function call",
2006
1951
  message: "expected '('"
2007
1952
  });
2008
1953
  if (t.is) {
2009
1954
  ({i: i} = t);
2010
1955
  let r = [];
2011
- if (t = H(e, i, n, { phrase: ")" }), t.is) ({i: i} = t);
1956
+ if (t = U(e, i, n, { phrase: ")" }), t.is) ({i: i} = t);
2012
1957
  else for (;;) {
2013
1958
  let a;
2014
- if ({i: i, ops: a} = await J(e, i, n), r.push(a), t = H(e, i, n, { phrase: ")" }), t.is) {
1959
+ if ({i: i, ops: a} = await Y(e, i, n), r.push(a), t = U(e, i, n, { phrase: ")" }), t.is) {
2015
1960
  ({i: i} = t);
2016
1961
  break;
2017
1962
  }
2018
- if (t = H(e, i, n, { phrase: "," }), {i: i} = t, !t.is) return K(e, i, n, {
1963
+ if (t = U(e, i, n, { phrase: "," }), {i: i} = t, !t.is) return q(e, i, n, {
2019
1964
  operator: "function call",
2020
1965
  message: "expected ',' or ')'"
2021
1966
  });
2022
1967
  }
2023
1968
  let c = !1;
2024
- t = H(e, i, n, {
1969
+ t = U(e, i, n, {
2025
1970
  phrase: "?",
2026
1971
  notBeforeSet: "?="
2027
1972
  }), t.is && ({i: i, is: c} = t), a.push({
@@ -2032,9 +1977,7 @@ async function bn(e, t, n, { identity: r } = {}) {
2032
1977
  optional: c
2033
1978
  }
2034
1979
  }), o = !1;
2035
- continue;
2036
- }
2037
- break;
1980
+ } else break;
2038
1981
  }
2039
1982
  return {
2040
1983
  i,
@@ -2043,15 +1986,15 @@ async function bn(e, t, n, { identity: r } = {}) {
2043
1986
  canAssign: o
2044
1987
  };
2045
1988
  }
2046
- async function xn(e, t, n) {
2047
- let r = t, i = H(e, r, n, {
1989
+ async function bn(e, t, n) {
1990
+ let r = t, i = U(e, r, n, {
2048
1991
  phrase: "=",
2049
1992
  notBeforeSet: "="
2050
1993
  });
2051
1994
  if (i.is) {
2052
1995
  ({i: r} = i);
2053
1996
  let t;
2054
- return {i: r, ops: t} = await Y(e, r, n), {
1997
+ return {i: r, ops: t} = await X(e, r, n), {
2055
1998
  i: r,
2056
1999
  is: !0,
2057
2000
  assignment: {
@@ -2060,10 +2003,10 @@ async function xn(e, t, n) {
2060
2003
  }
2061
2004
  };
2062
2005
  }
2063
- if (i = H(e, r, n, { phrase: "|=" }), i.is) {
2006
+ if (i = U(e, r, n, { phrase: "|=" }), i.is) {
2064
2007
  ({i: r} = i);
2065
2008
  let t;
2066
- return {i: r, ops: t} = await Y(e, r, n), {
2009
+ return {i: r, ops: t} = await X(e, r, n), {
2067
2010
  i: r,
2068
2011
  is: !0,
2069
2012
  assignment: {
@@ -2072,10 +2015,10 @@ async function xn(e, t, n) {
2072
2015
  }
2073
2016
  };
2074
2017
  }
2075
- if (i = H(e, r, n, { phrase: "+=" }), i.is) {
2018
+ if (i = U(e, r, n, { phrase: "+=" }), i.is) {
2076
2019
  ({i: r} = i);
2077
2020
  let t;
2078
- return {i: r, ops: t} = await Y(e, r, n), {
2021
+ return {i: r, ops: t} = await X(e, r, n), {
2079
2022
  i: r,
2080
2023
  is: !0,
2081
2024
  assignment: {
@@ -2084,10 +2027,10 @@ async function xn(e, t, n) {
2084
2027
  }
2085
2028
  };
2086
2029
  }
2087
- if (i = H(e, r, n, { phrase: "-=" }), i.is) {
2030
+ if (i = U(e, r, n, { phrase: "-=" }), i.is) {
2088
2031
  ({i: r} = i);
2089
2032
  let t;
2090
- return {i: r, ops: t} = await Y(e, r, n), {
2033
+ return {i: r, ops: t} = await X(e, r, n), {
2091
2034
  i: r,
2092
2035
  is: !0,
2093
2036
  assignment: {
@@ -2096,10 +2039,10 @@ async function xn(e, t, n) {
2096
2039
  }
2097
2040
  };
2098
2041
  }
2099
- if (i = H(e, r, n, { phrase: "*=" }), i.is) {
2042
+ if (i = U(e, r, n, { phrase: "*=" }), i.is) {
2100
2043
  ({i: r} = i);
2101
2044
  let t;
2102
- return {i: r, ops: t} = await Y(e, r, n), {
2045
+ return {i: r, ops: t} = await X(e, r, n), {
2103
2046
  i: r,
2104
2047
  is: !0,
2105
2048
  assignment: {
@@ -2108,10 +2051,10 @@ async function xn(e, t, n) {
2108
2051
  }
2109
2052
  };
2110
2053
  }
2111
- if (i = H(e, r, n, { phrase: "/=" }), i.is) {
2054
+ if (i = U(e, r, n, { phrase: "/=" }), i.is) {
2112
2055
  ({i: r} = i);
2113
2056
  let t;
2114
- return {i: r, ops: t} = await Y(e, r, n), {
2057
+ return {i: r, ops: t} = await X(e, r, n), {
2115
2058
  i: r,
2116
2059
  is: !0,
2117
2060
  assignment: {
@@ -2120,10 +2063,10 @@ async function xn(e, t, n) {
2120
2063
  }
2121
2064
  };
2122
2065
  }
2123
- if (i = H(e, r, n, { phrase: "%=" }), i.is) {
2066
+ if (i = U(e, r, n, { phrase: "%=" }), i.is) {
2124
2067
  ({i: r} = i);
2125
2068
  let t;
2126
- return {i: r, ops: t} = await Y(e, r, n), {
2069
+ return {i: r, ops: t} = await X(e, r, n), {
2127
2070
  i: r,
2128
2071
  is: !0,
2129
2072
  assignment: {
@@ -2132,10 +2075,10 @@ async function xn(e, t, n) {
2132
2075
  }
2133
2076
  };
2134
2077
  }
2135
- if (i = H(e, r, n, { phrase: "?=" }), i.is) {
2078
+ if (i = U(e, r, n, { phrase: "?=" }), i.is) {
2136
2079
  ({i: r} = i);
2137
2080
  let t;
2138
- return {i: r, ops: t} = await Y(e, r, n), {
2081
+ return {i: r, ops: t} = await X(e, r, n), {
2139
2082
  i: r,
2140
2083
  is: !0,
2141
2084
  assignment: {
@@ -2149,10 +2092,10 @@ async function xn(e, t, n) {
2149
2092
  is: !1
2150
2093
  };
2151
2094
  }
2152
- function Sn(e, t, n) {
2095
+ function xn(e, t, n) {
2153
2096
  let r = t, i = !1, a = "";
2154
2097
  for (;;) {
2155
- let t = U(e, r, n, { set: "0123456789" });
2098
+ let t = W(e, r, n, { set: "0123456789" });
2156
2099
  if (!t.is) break;
2157
2100
  ({i: r} = t), i = !0, a += t.value;
2158
2101
  }
@@ -2160,37 +2103,37 @@ function Sn(e, t, n) {
2160
2103
  i: r,
2161
2104
  is: !1
2162
2105
  };
2163
- let o = V(e, r, n, { phrase: "." });
2106
+ let o = H(e, r, n, { phrase: "." });
2164
2107
  if (o.is) for ({i: r} = o, a += ".";;) {
2165
- let t = U(e, r, n, { set: "0123456789" });
2108
+ let t = W(e, r, n, { set: "0123456789" });
2166
2109
  if (!t.is) break;
2167
2110
  ({i: r} = t), a += t.value;
2168
2111
  }
2169
- let s = U(e, r, n, { set: "eE" });
2112
+ let s = W(e, r, n, { set: "eE" });
2170
2113
  if (s.is) {
2171
- ({i: r} = s), a += s.value, s = U(e, r, n, { set: "+-" }), s.is && ({i: r} = s, a += s.value);
2114
+ ({i: r} = s), a += s.value, s = W(e, r, n, { set: "+-" }), s.is && ({i: r} = s, a += s.value);
2172
2115
  let t = !1;
2173
- for (; s = U(e, r, n, { set: "0123456789" }), s.is;) ({i: r} = s), t = !0, a += s.value;
2174
- if (!t) return K(e, r, n, {
2116
+ for (; s = W(e, r, n, { set: "0123456789" }), s.is;) ({i: r} = s), t = !0, a += s.value;
2117
+ if (!t) return q(e, r, n, {
2175
2118
  operator: "number",
2176
2119
  message: "expected digit"
2177
2120
  });
2178
2121
  }
2179
2122
  let c = +a;
2180
- return Number.isFinite(c) ? ({i: r} = B(e, r, n), {
2123
+ return Number.isFinite(c) ? ({i: r} = V(e, r, n), {
2181
2124
  i: r,
2182
2125
  is: !0,
2183
2126
  ops: [{
2184
2127
  op: "nbr",
2185
2128
  params: { number: c }
2186
2129
  }]
2187
- }) : gn(e, r, n, {
2130
+ }) : hn(e, r, n, {
2188
2131
  operator: "number",
2189
2132
  message: `invalid number ${c}`
2190
2133
  });
2191
2134
  }
2192
- async function Cn(e, t, n) {
2193
- let r = t, i = "", a = U(e, r, n, { set: "\"'`" });
2135
+ async function Sn(e, t, n) {
2136
+ let r = t, i = "", a = W(e, r, n, { set: "\"'`" });
2194
2137
  if (!a.is) return {
2195
2138
  i: r,
2196
2139
  is: !1
@@ -2199,21 +2142,21 @@ async function Cn(e, t, n) {
2199
2142
  ({i: r, value: o} = a);
2200
2143
  let s = o === "`", c = [];
2201
2144
  for (;;) {
2202
- let t = V(e, r, n, { phrase: o });
2145
+ let t = H(e, r, n, { phrase: o });
2203
2146
  if (t.is) {
2204
2147
  ({i: r} = t);
2205
2148
  break;
2206
2149
  }
2207
- let a = G(e, r, n);
2208
- if (a.is) return {i: r} = a, K(e, r, n, {
2150
+ let a = K(e, r, n);
2151
+ if (a.is) return {i: r} = a, q(e, r, n, {
2209
2152
  operator: "string",
2210
2153
  message: "incomplete string literal"
2211
2154
  });
2212
- if (t = V(e, r, n, { phrase: "\\" }), t.is) {
2213
- if ({i: r} = t, t = H(e, r, n, { phrase: "(" }), t.is) {
2155
+ if (t = H(e, r, n, { phrase: "\\" }), t.is) {
2156
+ if ({i: r} = t, t = U(e, r, n, { phrase: "(" }), t.is) {
2214
2157
  ({i: r} = t);
2215
2158
  let a;
2216
- if ({i: r, ops: a} = await q(e, r, n), t = V(e, r, n, { phrase: ")" }), {i: r} = t, !t.is) return K(e, r, n, {
2159
+ if ({i: r, ops: a} = await J(e, r, n), t = H(e, r, n, { phrase: ")" }), {i: r} = t, !t.is) return q(e, r, n, {
2217
2160
  operator: "string interpolation",
2218
2161
  message: "expected ')'"
2219
2162
  });
@@ -2228,9 +2171,8 @@ async function Cn(e, t, n) {
2228
2171
  r += 1;
2229
2172
  continue;
2230
2173
  case "\r":
2231
- r += 1, !G(e, r, n).is && e[r] === "\n" && (r += 1);
2174
+ r += 1, !K(e, r, n).is && e[r] === "\n" && (r += 1);
2232
2175
  continue;
2233
- default:
2234
2176
  }
2235
2177
  switch (e[r]) {
2236
2178
  case "\"":
@@ -2267,7 +2209,7 @@ async function Cn(e, t, n) {
2267
2209
  r += 1;
2268
2210
  let a = "";
2269
2211
  for (let i = 0; i < 4; i += 1) {
2270
- if (t = fn(e, r, n), {i: r} = t, !t.is) return K(e, r, n, {
2212
+ if (t = dn(e, r, n), {i: r} = t, !t.is) return q(e, r, n, {
2271
2213
  operator: "string",
2272
2214
  message: "incomplete unicode escape sequence: expected hex digit"
2273
2215
  });
@@ -2276,7 +2218,7 @@ async function Cn(e, t, n) {
2276
2218
  i += String.fromCodePoint(parseInt(a, 16));
2277
2219
  continue;
2278
2220
  }
2279
- default: return K(e, r, n, {
2221
+ default: return q(e, r, n, {
2280
2222
  operator: "string",
2281
2223
  message: "invalid escape sequence"
2282
2224
  });
@@ -2288,12 +2230,11 @@ async function Cn(e, t, n) {
2288
2230
  case " ":
2289
2231
  i += e[r], r += 1;
2290
2232
  continue;
2291
- default:
2292
2233
  }
2293
- if (e.charCodeAt(r) < 32) return K(e, r, n, { operator: "string" });
2234
+ if (e.charCodeAt(r) < 32) return q(e, r, n, { operator: "string" });
2294
2235
  i += e[r], r += 1;
2295
2236
  }
2296
- return {i: r} = B(e, r, n), c.length === 0 ? {
2237
+ return {i: r} = V(e, r, n), c.length === 0 ? {
2297
2238
  i: r,
2298
2239
  is: !0,
2299
2240
  ops: [{
@@ -2312,13 +2253,13 @@ async function Cn(e, t, n) {
2312
2253
  }]
2313
2254
  };
2314
2255
  }
2315
- async function q(e, t, n) {
2256
+ async function J(e, t, n) {
2316
2257
  await void 0;
2317
2258
  let r = t, i = [];
2318
2259
  for (;;) {
2319
2260
  let t;
2320
- ({i: r, ops: t} = await wn(e, r, n)), i.push(...t);
2321
- let a = H(e, r, n, {
2261
+ ({i: r, ops: t} = await Cn(e, r, n)), i.push(...t);
2262
+ let a = U(e, r, n, {
2322
2263
  phrase: "|",
2323
2264
  notBeforeSet: "="
2324
2265
  });
@@ -2330,13 +2271,13 @@ async function q(e, t, n) {
2330
2271
  ops: i
2331
2272
  };
2332
2273
  }
2333
- async function J(e, t, n) {
2274
+ async function Y(e, t, n) {
2334
2275
  await void 0;
2335
2276
  let r = t, i = [];
2336
2277
  for (;;) {
2337
2278
  let t;
2338
- ({i: r, ops: t} = await Tn(e, r, n)), i.push(...t);
2339
- let a = H(e, r, n, {
2279
+ ({i: r, ops: t} = await wn(e, r, n)), i.push(...t);
2280
+ let a = U(e, r, n, {
2340
2281
  phrase: "|",
2341
2282
  notBeforeSet: "="
2342
2283
  });
@@ -2348,15 +2289,15 @@ async function J(e, t, n) {
2348
2289
  ops: i
2349
2290
  };
2350
2291
  }
2351
- async function Y(e, t, n) {
2352
- return await void 0, Tn(e, t, n);
2292
+ async function X(e, t, n) {
2293
+ return await void 0, wn(e, t, n);
2353
2294
  }
2354
- async function wn(e, t, n) {
2295
+ async function Cn(e, t, n) {
2355
2296
  let r = t, i = [];
2356
2297
  for (;;) {
2357
2298
  let t;
2358
- ({i: r, ops: t} = await Tn(e, r, n)), i.push(t);
2359
- let a = H(e, r, n, { phrase: "," });
2299
+ ({i: r, ops: t} = await wn(e, r, n)), i.push(t);
2300
+ let a = U(e, r, n, { phrase: "," });
2360
2301
  if (!a.is) break;
2361
2302
  ({i: r} = a);
2362
2303
  }
@@ -2371,21 +2312,21 @@ async function wn(e, t, n) {
2371
2312
  }]
2372
2313
  };
2373
2314
  }
2374
- async function Tn(e, t, n) {
2375
- let r = t, i = H(e, r, n, {
2315
+ async function wn(e, t, n) {
2316
+ let r = t, i = U(e, r, n, {
2376
2317
  phrase: "try",
2377
2318
  spaceAfter: !0
2378
2319
  });
2379
- if (!i.is) return En(e, r, n);
2320
+ if (!i.is) return Tn(e, r, n);
2380
2321
  ({i: r} = i);
2381
2322
  let a;
2382
- ({i: r, ops: a} = await En(e, r, n));
2323
+ ({i: r, ops: a} = await Tn(e, r, n));
2383
2324
  let o;
2384
- return i = H(e, r, n, {
2325
+ return i = U(e, r, n, {
2385
2326
  spaceBefore: !0,
2386
2327
  phrase: "catch",
2387
2328
  spaceAfter: !0
2388
- }), i.is ? ({i: r} = i, {i: r, ops: o} = await En(e, r, n)) : o = [{
2329
+ }), i.is ? ({i: r} = i, {i: r, ops: o} = await Tn(e, r, n)) : o = [{
2389
2330
  op: "vod",
2390
2331
  params: {}
2391
2332
  }], {
@@ -2399,12 +2340,12 @@ async function Tn(e, t, n) {
2399
2340
  }]
2400
2341
  };
2401
2342
  }
2402
- async function En(e, t, n) {
2343
+ async function Tn(e, t, n) {
2403
2344
  let r = t, i = [];
2404
2345
  for (;;) {
2405
2346
  let t;
2406
- ({i: r, ops: t} = await Dn(e, r, n)), i.push(t);
2407
- let a = H(e, r, n, {
2347
+ ({i: r, ops: t} = await En(e, r, n)), i.push(t);
2348
+ let a = U(e, r, n, {
2408
2349
  spaceBefore: !0,
2409
2350
  phrase: "or",
2410
2351
  spaceAfter: !0
@@ -2423,12 +2364,12 @@ async function En(e, t, n) {
2423
2364
  }]
2424
2365
  };
2425
2366
  }
2426
- async function Dn(e, t, n) {
2367
+ async function En(e, t, n) {
2427
2368
  let r = t, i = [];
2428
2369
  for (;;) {
2429
2370
  let t;
2430
- ({i: r, ops: t} = await On(e, r, n)), i.push(t);
2431
- let a = H(e, r, n, {
2371
+ ({i: r, ops: t} = await Dn(e, r, n)), i.push(t);
2372
+ let a = U(e, r, n, {
2432
2373
  spaceBefore: !0,
2433
2374
  phrase: "and",
2434
2375
  spaceAfter: !0
@@ -2447,31 +2388,27 @@ async function Dn(e, t, n) {
2447
2388
  }]
2448
2389
  };
2449
2390
  }
2450
- async function On(e, t, n) {
2391
+ async function Dn(e, t, n) {
2451
2392
  let r = t, i;
2452
- ({i: r, ops: i} = await kn(e, r, n));
2393
+ ({i: r, ops: i} = await On(e, r, n));
2453
2394
  let a = [];
2454
2395
  for (;;) {
2455
- let t = H(e, r, n, { phrase: "==" });
2396
+ let t = U(e, r, n, { phrase: "==" });
2456
2397
  if (t.is) {
2457
2398
  ({i: r} = t);
2458
2399
  let i;
2459
- ({i: r, ops: i} = await kn(e, r, n)), a.push({
2400
+ ({i: r, ops: i} = await On(e, r, n)), a.push({
2460
2401
  op: "==",
2461
2402
  params: { by: i }
2462
2403
  });
2463
- continue;
2464
- }
2465
- if (t = H(e, r, n, { phrase: "!=" }), t.is) {
2404
+ } else if (t = U(e, r, n, { phrase: "!=" }), t.is) {
2466
2405
  ({i: r} = t);
2467
2406
  let i;
2468
- ({i: r, ops: i} = await kn(e, r, n)), a.push({
2407
+ ({i: r, ops: i} = await On(e, r, n)), a.push({
2469
2408
  op: "!=",
2470
2409
  params: { by: i }
2471
2410
  });
2472
- continue;
2473
- }
2474
- break;
2411
+ } else break;
2475
2412
  }
2476
2413
  return a.length === 0 ? {
2477
2414
  i: r,
@@ -2487,49 +2424,41 @@ async function On(e, t, n) {
2487
2424
  }]
2488
2425
  };
2489
2426
  }
2490
- async function kn(e, t, n) {
2427
+ async function On(e, t, n) {
2491
2428
  let r = t, i;
2492
- ({i: r, ops: i} = await X(e, r, n));
2429
+ ({i: r, ops: i} = await Z(e, r, n));
2493
2430
  let a = [];
2494
2431
  for (;;) {
2495
- let t = H(e, r, n, { phrase: "<=" });
2432
+ let t = U(e, r, n, { phrase: "<=" });
2496
2433
  if (t.is) {
2497
2434
  ({i: r} = t);
2498
2435
  let i;
2499
- ({i: r, ops: i} = await X(e, r, n)), a.push({
2436
+ ({i: r, ops: i} = await Z(e, r, n)), a.push({
2500
2437
  op: "<=",
2501
2438
  params: { by: i }
2502
2439
  });
2503
- continue;
2504
- }
2505
- if (t = H(e, r, n, { phrase: "<" }), t.is) {
2440
+ } else if (t = U(e, r, n, { phrase: "<" }), t.is) {
2506
2441
  ({i: r} = t);
2507
2442
  let i;
2508
- ({i: r, ops: i} = await X(e, r, n)), a.push({
2443
+ ({i: r, ops: i} = await Z(e, r, n)), a.push({
2509
2444
  op: "<",
2510
2445
  params: { by: i }
2511
2446
  });
2512
- continue;
2513
- }
2514
- if (t = H(e, r, n, { phrase: ">=" }), t.is) {
2447
+ } else if (t = U(e, r, n, { phrase: ">=" }), t.is) {
2515
2448
  ({i: r} = t);
2516
2449
  let i;
2517
- ({i: r, ops: i} = await X(e, r, n)), a.push({
2450
+ ({i: r, ops: i} = await Z(e, r, n)), a.push({
2518
2451
  op: ">=",
2519
2452
  params: { by: i }
2520
2453
  });
2521
- continue;
2522
- }
2523
- if (t = H(e, r, n, { phrase: ">" }), t.is) {
2454
+ } else if (t = U(e, r, n, { phrase: ">" }), t.is) {
2524
2455
  ({i: r} = t);
2525
2456
  let i;
2526
- ({i: r, ops: i} = await X(e, r, n)), a.push({
2457
+ ({i: r, ops: i} = await Z(e, r, n)), a.push({
2527
2458
  op: ">",
2528
2459
  params: { by: i }
2529
2460
  });
2530
- continue;
2531
- }
2532
- break;
2461
+ } else break;
2533
2462
  }
2534
2463
  return a.length === 0 ? {
2535
2464
  i: r,
@@ -2545,15 +2474,15 @@ async function kn(e, t, n) {
2545
2474
  }]
2546
2475
  };
2547
2476
  }
2548
- async function X(e, t, n) {
2549
- let r = t, i = H(e, r, n, {
2477
+ async function Z(e, t, n) {
2478
+ let r = t, i = U(e, r, n, {
2550
2479
  phrase: "not",
2551
2480
  spaceAfter: !0
2552
2481
  });
2553
- if (!i.is) return An(e, r, n);
2482
+ if (!i.is) return kn(e, r, n);
2554
2483
  ({i: r} = i);
2555
2484
  let a;
2556
- return {i: r, ops: a} = await An(e, r, n), {
2485
+ return {i: r, ops: a} = await kn(e, r, n), {
2557
2486
  i: r,
2558
2487
  ops: [...a, {
2559
2488
  op: "not",
@@ -2561,10 +2490,10 @@ async function X(e, t, n) {
2561
2490
  }]
2562
2491
  };
2563
2492
  }
2564
- async function An(e, t, n) {
2565
- let r = t, i = await jn(e, r, n);
2493
+ async function kn(e, t, n) {
2494
+ let r = t, i = await An(e, r, n);
2566
2495
  ({i: r} = i);
2567
- let a = H(e, r, n, {
2496
+ let a = U(e, r, n, {
2568
2497
  phrase: "?",
2569
2498
  notBeforeSet: "?="
2570
2499
  });
@@ -2582,37 +2511,33 @@ async function An(e, t, n) {
2582
2511
  }]
2583
2512
  }) : i;
2584
2513
  }
2585
- async function jn(e, t, n) {
2514
+ async function An(e, t, n) {
2586
2515
  let r = t, i;
2587
- ({i: r, ops: i} = await Z(e, r, n));
2516
+ ({i: r, ops: i} = await jn(e, r, n));
2588
2517
  let a = [];
2589
2518
  for (;;) {
2590
- let t = H(e, r, n, {
2519
+ let t = U(e, r, n, {
2591
2520
  phrase: "+",
2592
2521
  notBeforeSet: "="
2593
2522
  });
2594
2523
  if (t.is) {
2595
2524
  ({i: r} = t);
2596
2525
  let i;
2597
- ({i: r, ops: i} = await Z(e, r, n)), a.push({
2526
+ ({i: r, ops: i} = await jn(e, r, n)), a.push({
2598
2527
  op: "+",
2599
2528
  params: { by: i }
2600
2529
  });
2601
- continue;
2602
- }
2603
- if (t = H(e, r, n, {
2530
+ } else if (t = U(e, r, n, {
2604
2531
  phrase: "-",
2605
2532
  notBeforeSet: "=>"
2606
2533
  }), t.is) {
2607
2534
  ({i: r} = t);
2608
2535
  let i;
2609
- ({i: r, ops: i} = await Z(e, r, n)), a.push({
2536
+ ({i: r, ops: i} = await jn(e, r, n)), a.push({
2610
2537
  op: "-",
2611
2538
  params: { by: i }
2612
2539
  });
2613
- continue;
2614
- }
2615
- break;
2540
+ } else break;
2616
2541
  }
2617
2542
  return a.length === 0 ? {
2618
2543
  i: r,
@@ -2628,12 +2553,12 @@ async function jn(e, t, n) {
2628
2553
  }]
2629
2554
  };
2630
2555
  }
2631
- async function Z(e, t, n) {
2556
+ async function jn(e, t, n) {
2632
2557
  let r = t, i;
2633
2558
  ({i: r, ops: i} = await Q(e, r, n));
2634
2559
  let a = [];
2635
2560
  for (;;) {
2636
- let t = H(e, r, n, {
2561
+ let t = U(e, r, n, {
2637
2562
  phrase: "*",
2638
2563
  notBeforeSet: "="
2639
2564
  });
@@ -2644,9 +2569,7 @@ async function Z(e, t, n) {
2644
2569
  op: "*",
2645
2570
  params: { by: i }
2646
2571
  });
2647
- continue;
2648
- }
2649
- if (t = H(e, r, n, {
2572
+ } else if (t = U(e, r, n, {
2650
2573
  phrase: "/",
2651
2574
  notBeforeSet: "="
2652
2575
  }), t.is) {
@@ -2656,9 +2579,7 @@ async function Z(e, t, n) {
2656
2579
  op: "/",
2657
2580
  params: { by: i }
2658
2581
  });
2659
- continue;
2660
- }
2661
- if (t = H(e, r, n, {
2582
+ } else if (t = U(e, r, n, {
2662
2583
  phrase: "%",
2663
2584
  notBeforeSet: "="
2664
2585
  }), t.is) {
@@ -2668,9 +2589,7 @@ async function Z(e, t, n) {
2668
2589
  op: "%",
2669
2590
  params: { by: i }
2670
2591
  });
2671
- continue;
2672
- }
2673
- break;
2592
+ } else break;
2674
2593
  }
2675
2594
  return a.length === 0 ? {
2676
2595
  i: r,
@@ -2691,7 +2610,7 @@ async function Q(e, t, n) {
2691
2610
  for (;;) {
2692
2611
  let t;
2693
2612
  ({i: r, ops: t} = await Mn(e, r, n)), i.push(t);
2694
- let a = H(e, r, n, { phrase: "??" });
2613
+ let a = U(e, r, n, { phrase: "??" });
2695
2614
  if (!a.is) break;
2696
2615
  ({i: r} = a);
2697
2616
  }
@@ -2707,7 +2626,7 @@ async function Q(e, t, n) {
2707
2626
  };
2708
2627
  }
2709
2628
  async function Mn(e, t, n) {
2710
- let r = t, i = H(e, r, n, {
2629
+ let r = t, i = U(e, r, n, {
2711
2630
  phrase: "-",
2712
2631
  notBeforeSet: "=>"
2713
2632
  });
@@ -2723,7 +2642,7 @@ async function Mn(e, t, n) {
2723
2642
  };
2724
2643
  }
2725
2644
  async function Nn(e, t, n) {
2726
- let r = t, i = H(e, r, n, {
2645
+ let r = t, i = U(e, r, n, {
2727
2646
  phrase: "if",
2728
2647
  spaceAfter: !0
2729
2648
  });
@@ -2732,19 +2651,19 @@ async function Nn(e, t, n) {
2732
2651
  let a = [];
2733
2652
  for (;;) {
2734
2653
  let t;
2735
- if ({i: r, ops: t} = await q(e, r, n), i = H(e, r, n, {
2654
+ if ({i: r, ops: t} = await J(e, r, n), i = U(e, r, n, {
2736
2655
  spaceBefore: !0,
2737
2656
  phrase: "then",
2738
2657
  spaceAfter: !0
2739
- }), {i: r} = i, !i.is) return K(e, r, n, {
2658
+ }), {i: r} = i, !i.is) return q(e, r, n, {
2740
2659
  operator: "if statement",
2741
2660
  message: "expected 'then'"
2742
2661
  });
2743
2662
  let o;
2744
- if ({i: r, ops: o} = await q(e, r, n), a.push({
2663
+ if ({i: r, ops: o} = await J(e, r, n), a.push({
2745
2664
  if: t,
2746
2665
  then: o
2747
- }), i = H(e, r, n, {
2666
+ }), i = U(e, r, n, {
2748
2667
  spaceBefore: !0,
2749
2668
  phrase: "elif",
2750
2669
  spaceAfter: !0
@@ -2752,11 +2671,11 @@ async function Nn(e, t, n) {
2752
2671
  ({i: r} = i);
2753
2672
  }
2754
2673
  let o;
2755
- return i = H(e, r, n, {
2674
+ return i = U(e, r, n, {
2756
2675
  spaceBefore: !0,
2757
2676
  phrase: "else",
2758
2677
  spaceAfter: !0
2759
- }), i.is ? ({i: r} = i, {i: r, ops: o} = await q(e, r, n)) : o = [], i = H(e, r, n, {
2678
+ }), i.is ? ({i: r} = i, {i: r, ops: o} = await J(e, r, n)) : o = [], i = U(e, r, n, {
2760
2679
  spaceBefore: !0,
2761
2680
  phrase: "end"
2762
2681
  }), {i: r} = i, i.is ? {
@@ -2768,13 +2687,13 @@ async function Nn(e, t, n) {
2768
2687
  else: o
2769
2688
  }
2770
2689
  }]
2771
- } : K(e, r, n, {
2690
+ } : q(e, r, n, {
2772
2691
  operator: "if statement",
2773
2692
  message: "expected 'end'"
2774
2693
  });
2775
2694
  }
2776
2695
  function Pn(e, t, n) {
2777
- let r = t, i = H(e, r, n, {
2696
+ let r = t, i = U(e, r, n, {
2778
2697
  phrase: "true",
2779
2698
  spaceAfter: !0
2780
2699
  });
@@ -2784,7 +2703,7 @@ function Pn(e, t, n) {
2784
2703
  op: "tru",
2785
2704
  params: {}
2786
2705
  }]
2787
- }) : (i = H(e, r, n, {
2706
+ }) : (i = U(e, r, n, {
2788
2707
  phrase: "false",
2789
2708
  spaceAfter: !0
2790
2709
  }), i.is ? ({i: r} = i, {
@@ -2793,7 +2712,7 @@ function Pn(e, t, n) {
2793
2712
  op: "fls",
2794
2713
  params: {}
2795
2714
  }]
2796
- }) : (i = H(e, r, n, {
2715
+ }) : (i = U(e, r, n, {
2797
2716
  phrase: "null",
2798
2717
  spaceAfter: !0
2799
2718
  }), i.is ? ({i: r} = i, {
@@ -2805,27 +2724,27 @@ function Pn(e, t, n) {
2805
2724
  }) : Fn(e, r, n)));
2806
2725
  }
2807
2726
  async function Fn(e, t, n) {
2808
- let r = t, i = await Sn(e, r, n);
2727
+ let r = t, i = await xn(e, r, n);
2809
2728
  return i.is ? ({i: r} = i, {
2810
2729
  i: r,
2811
2730
  ops: i.ops
2812
2731
  }) : In(e, r, n);
2813
2732
  }
2814
2733
  async function In(e, t, n) {
2815
- let r = t, i = H(e, r, n, {
2734
+ let r = t, i = U(e, r, n, {
2816
2735
  phrase: "func",
2817
2736
  spaceAfter: !0
2818
2737
  });
2819
2738
  if (!i.is) return Ln(e, r, n);
2820
2739
  ({i: r} = i);
2821
- let a = W(e, r, n);
2740
+ let a = G(e, r, n);
2822
2741
  if (!a.is) return Ln(e, t, n);
2823
2742
  let o;
2824
2743
  ({i: r, value: o} = a);
2825
2744
  let s;
2826
- ({i: r, argNames: s} = await yn(e, r, n));
2745
+ ({i: r, argNames: s} = await vn(e, r, n));
2827
2746
  let c;
2828
- return {i: r, ops: c} = await Y(e, r, n), {
2747
+ return {i: r, ops: c} = await X(e, r, n), {
2829
2748
  i: r,
2830
2749
  ops: [{
2831
2750
  op: "va=",
@@ -2843,16 +2762,16 @@ async function In(e, t, n) {
2843
2762
  };
2844
2763
  }
2845
2764
  async function Ln(e, t, n) {
2846
- let r = t, i = H(e, r, n, {
2765
+ let r = t, i = U(e, r, n, {
2847
2766
  phrase: "func",
2848
2767
  spaceAfter: !0
2849
2768
  });
2850
2769
  if (!i.is) return Rn(e, r, n);
2851
2770
  ({i: r} = i);
2852
2771
  let a;
2853
- ({i: r, argNames: a} = await yn(e, r, n));
2772
+ ({i: r, argNames: a} = await vn(e, r, n));
2854
2773
  let o;
2855
- return {i: r, ops: o} = await Y(e, r, n), {
2774
+ return {i: r, ops: o} = await X(e, r, n), {
2856
2775
  i: r,
2857
2776
  ops: [{
2858
2777
  op: "fun",
@@ -2864,11 +2783,11 @@ async function Ln(e, t, n) {
2864
2783
  };
2865
2784
  }
2866
2785
  async function Rn(e, t, n) {
2867
- let r = t, i = W(e, r, n);
2786
+ let r = t, i = G(e, r, n);
2868
2787
  if (!i.is) return zn(e, r, n);
2869
2788
  let a;
2870
2789
  ({i: r, value: a} = i);
2871
- let o, s, c = await bn(e, r, n);
2790
+ let o, s, c = await yn(e, r, n);
2872
2791
  if (c.is ? {i: r, selectors: o, canAssign: s} = c : (o = [], s = !0), !s) {
2873
2792
  let e = [{
2874
2793
  op: "var",
@@ -2888,7 +2807,7 @@ async function Rn(e, t, n) {
2888
2807
  }]
2889
2808
  };
2890
2809
  }
2891
- let l = await xn(e, r, n);
2810
+ let l = await bn(e, r, n);
2892
2811
  if (!l.is) {
2893
2812
  let e = [{
2894
2813
  op: "var",
@@ -2940,16 +2859,16 @@ async function Rn(e, t, n) {
2940
2859
  };
2941
2860
  }
2942
2861
  async function zn(e, t, n) {
2943
- let r = t, i = [], a, o = H(e, r, n, { phrase: "." });
2862
+ let r = t, i = [], a, o = U(e, r, n, { phrase: "." });
2944
2863
  if (!o.is) ({i: r, ops: a} = await Bn(e, r, n));
2945
2864
  else {
2946
2865
  ({i: r} = o), a = [];
2947
- let t = W(e, r, n);
2866
+ let t = G(e, r, n);
2948
2867
  if (t.is) {
2949
2868
  let a;
2950
2869
  ({i: r, value: a} = t);
2951
2870
  let s = !1;
2952
- o = H(e, r, n, {
2871
+ o = U(e, r, n, {
2953
2872
  phrase: "?",
2954
2873
  notBeforeSet: "?="
2955
2874
  }), o.is && ({i: r, is: s} = o), i.push({
@@ -2964,7 +2883,7 @@ async function zn(e, t, n) {
2964
2883
  });
2965
2884
  }
2966
2885
  }
2967
- let s = await bn(e, r, n, { identity: a.length === 0 && i.length === 0 }), c;
2886
+ let s = await yn(e, r, n, { identity: a.length === 0 && i.length === 0 }), c;
2968
2887
  if (s.is ? ({i: r, canAssign: c} = s, i.push(...s.selectors)) : c = i.length > 0, i.length === 0) return {
2969
2888
  i: r,
2970
2889
  ops: a
@@ -2979,7 +2898,7 @@ async function zn(e, t, n) {
2979
2898
  }
2980
2899
  }]
2981
2900
  };
2982
- let l = await xn(e, r, n);
2901
+ let l = await bn(e, r, n);
2983
2902
  if (!l.is) return {
2984
2903
  i: r,
2985
2904
  ops: [{
@@ -3004,70 +2923,70 @@ async function zn(e, t, n) {
3004
2923
  };
3005
2924
  }
3006
2925
  async function Bn(e, t, n) {
3007
- let r = t, i = H(e, r, n, { phrase: "{" });
2926
+ let r = t, i = U(e, r, n, { phrase: "{" });
3008
2927
  if (!i.is) return Vn(e, r, n);
3009
2928
  ({i: r} = i);
3010
2929
  let a = [];
3011
- if (i = H(e, r, n, { phrase: "}" }), i.is) ({i: r} = i);
2930
+ if (i = U(e, r, n, { phrase: "}" }), i.is) ({i: r} = i);
3012
2931
  else for (;;) {
3013
- if (i = H(e, r, n, { phrase: "(" }), i.is) {
2932
+ if (i = U(e, r, n, { phrase: "(" }), i.is) {
3014
2933
  ({i: r} = i);
3015
2934
  let t;
3016
- if ({i: r, ops: t} = await q(e, r, n), i = H(e, r, n, { phrase: ")" }), {i: r} = i, !i.is) return K(e, r, n, {
2935
+ if ({i: r, ops: t} = await J(e, r, n), i = U(e, r, n, { phrase: ")" }), {i: r} = i, !i.is) return q(e, r, n, {
3017
2936
  operator: "object",
3018
2937
  message: "expected ')'"
3019
2938
  });
3020
2939
  let o;
3021
- if ({i: r, is: o} = H(e, r, n, { phrase: "?" }), i = H(e, r, n, { phrase: ":" }), {i: r} = i, !i.is) return K(e, r, n, {
2940
+ if ({i: r, is: o} = U(e, r, n, { phrase: "?" }), i = U(e, r, n, { phrase: ":" }), {i: r} = i, !i.is) return q(e, r, n, {
3022
2941
  operator: "object",
3023
2942
  message: "expected ':'"
3024
2943
  });
3025
2944
  let s;
3026
- if ({i: r, ops: s} = await J(e, r, n), a.push({
2945
+ if ({i: r, ops: s} = await Y(e, r, n), a.push({
3027
2946
  key: t,
3028
2947
  value: s,
3029
2948
  optional: o
3030
- }), i = H(e, r, n, { phrase: "}" }), i.is) {
2949
+ }), i = U(e, r, n, { phrase: "}" }), i.is) {
3031
2950
  ({i: r} = i);
3032
2951
  break;
3033
2952
  }
3034
- if (i = H(e, r, n, { phrase: "," }), {i: r} = i, !i.is) return K(e, r, n, {
2953
+ if (i = U(e, r, n, { phrase: "," }), {i: r} = i, !i.is) return q(e, r, n, {
3035
2954
  operator: "object",
3036
2955
  message: "expected ',' or '}'"
3037
2956
  });
3038
2957
  continue;
3039
2958
  }
3040
- let t = await Cn(e, r, n);
2959
+ let t = await Sn(e, r, n);
3041
2960
  if (t.is) {
3042
2961
  let o;
3043
- if ({i: r, ops: o} = t, i = H(e, r, n, { phrase: ":" }), {i: r} = i, !i.is) return K(e, r, n, {
2962
+ if ({i: r, ops: o} = t, i = U(e, r, n, { phrase: ":" }), {i: r} = i, !i.is) return q(e, r, n, {
3044
2963
  operator: "object",
3045
2964
  message: "expected ':'"
3046
2965
  });
3047
2966
  let s;
3048
- if ({i: r, ops: s} = await J(e, r, n), a.push({
2967
+ if ({i: r, ops: s} = await Y(e, r, n), a.push({
3049
2968
  key: o,
3050
2969
  value: s,
3051
2970
  optional: !1
3052
- }), i = H(e, r, n, { phrase: "}" }), i.is) {
2971
+ }), i = U(e, r, n, { phrase: "}" }), i.is) {
3053
2972
  ({i: r} = i);
3054
2973
  break;
3055
2974
  }
3056
- if (i = H(e, r, n, { phrase: "," }), {i: r} = i, !i.is) return K(e, r, n, {
2975
+ if (i = U(e, r, n, { phrase: "," }), {i: r} = i, !i.is) return q(e, r, n, {
3057
2976
  operator: "object",
3058
2977
  message: "expected ',' or '}'"
3059
2978
  });
3060
2979
  continue;
3061
2980
  }
3062
- let o = W(e, r, n);
2981
+ let o = G(e, r, n);
3063
2982
  if (o.is) {
3064
2983
  let t;
3065
2984
  ({i: r, value: t} = o);
3066
2985
  let s;
3067
- if (i = H(e, r, n, { phrase: ":" }), i.is) ({i: r} = i), {i: r, ops: s} = await J(e, r, n);
2986
+ if (i = U(e, r, n, { phrase: ":" }), i.is) ({i: r} = i), {i: r, ops: s} = await Y(e, r, n);
3068
2987
  else {
3069
2988
  let i;
3070
- ({i: r, is: i} = H(e, r, n, { phrase: "?" })), s = i ? [{
2989
+ ({i: r, is: i} = U(e, r, n, { phrase: "?" })), s = i ? [{
3071
2990
  op: "try",
3072
2991
  params: {
3073
2992
  try: [{
@@ -3091,17 +3010,15 @@ async function Bn(e, t, n) {
3091
3010
  }],
3092
3011
  value: s,
3093
3012
  optional: !1
3094
- }), i = H(e, r, n, { phrase: "}" }), i.is) {
3013
+ }), i = U(e, r, n, { phrase: "}" }), i.is) {
3095
3014
  ({i: r} = i);
3096
3015
  break;
3097
3016
  }
3098
- if (i = H(e, r, n, { phrase: "," }), {i: r} = i, !i.is) return K(e, r, n, {
3017
+ if (i = U(e, r, n, { phrase: "," }), {i: r} = i, !i.is) return q(e, r, n, {
3099
3018
  operator: "object",
3100
3019
  message: "expected ',' or '}'"
3101
3020
  });
3102
- continue;
3103
- }
3104
- return K(e, r, n, {
3021
+ } else return q(e, r, n, {
3105
3022
  operator: "object",
3106
3023
  message: "expected field declaration"
3107
3024
  });
@@ -3115,14 +3032,14 @@ async function Bn(e, t, n) {
3115
3032
  };
3116
3033
  }
3117
3034
  async function Vn(e, t, n) {
3118
- let r = t, i = H(e, r, n, { phrase: "[" });
3035
+ let r = t, i = U(e, r, n, { phrase: "[" });
3119
3036
  if ({i: r} = i, !i.is) return Hn(e, r, n);
3120
3037
  let a;
3121
- if (i = H(e, r, n, { phrase: "]" }), i.is) ({i: r} = i), a = [{
3038
+ if (i = U(e, r, n, { phrase: "]" }), i.is) ({i: r} = i), a = [{
3122
3039
  op: "vod",
3123
3040
  params: {}
3124
3041
  }];
3125
- else if ({i: r, ops: a} = await q(e, r, n), i = H(e, r, n, { phrase: "]" }), {i: r} = i, !i.is) return K(e, r, n, {
3042
+ else if ({i: r, ops: a} = await J(e, r, n), i = U(e, r, n, { phrase: "]" }), {i: r} = i, !i.is) return q(e, r, n, {
3126
3043
  operator: "array",
3127
3044
  message: "expected ']'"
3128
3045
  });
@@ -3135,26 +3052,25 @@ async function Vn(e, t, n) {
3135
3052
  };
3136
3053
  }
3137
3054
  async function Hn(e, t, n) {
3138
- let r = t, i = await Cn(e, r, n);
3055
+ let r = t, i = await Sn(e, r, n);
3139
3056
  return i.is ? ({i: r} = i, {
3140
3057
  i: r,
3141
3058
  ops: i.ops
3142
3059
  }) : Un(e, r, n);
3143
3060
  }
3144
3061
  async function Un(e, t, n) {
3145
- let r = t, i = H(e, r, n, { phrase: "(" });
3146
- if ({i: r} = i, !i.is) return K(e, r, n);
3062
+ let r = t, i = U(e, r, n, { phrase: "(" });
3063
+ if ({i: r} = i, !i.is) return q(e, r, n);
3147
3064
  let a;
3148
- return {i: r, ops: a} = await q(e, r, n), i = H(e, r, n, { phrase: ")" }), {i: r} = i, i.is ? {
3065
+ return {i: r, ops: a} = await J(e, r, n), i = U(e, r, n, { phrase: ")" }), {i: r} = i, i.is ? {
3149
3066
  i: r,
3150
3067
  ops: a
3151
- } : K(e, r, n, {
3068
+ } : q(e, r, n, {
3152
3069
  operator: "group",
3153
3070
  message: "expected ')'"
3154
3071
  });
3155
3072
  }
3156
- //#endregion
3157
- //#region lib/interpreter/index.ts
3073
+ // lib/interpreter/index.ts
3158
3074
  var Wn = {};
3159
3075
  function Gn(e = {}, t = {}) {
3160
3076
  return r(e, t);
@@ -3169,20 +3085,19 @@ var Kn = class {
3169
3085
  get options() {
3170
3086
  return this.#e;
3171
3087
  }
3172
- parse = async (e, t) => new rn({
3173
- version: m,
3088
+ parse = async (e, t) => new nn({
3089
+ version: "1.0",
3174
3090
  instructions: await this.parseInstructions(e)
3175
3091
  }, {
3176
- program: z(t?.program, this.#t),
3177
- runtime: N(t?.runtime, this.#n)
3092
+ program: en(t?.program, this.#t),
3093
+ runtime: I(t?.runtime, this.#n)
3178
3094
  });
3179
3095
  parseInstructions = async (e) => {
3180
- let { ops: t } = await _n(e, 0, { interpreter: this });
3096
+ let { ops: t } = await gn(e, 0, { interpreter: this });
3181
3097
  return t;
3182
3098
  };
3183
- }, qn = new Kn(), Jn = /* @__PURE__ */ t({ sortEntries: () => Yn }), Yn = ct(async (e, t) => [await e.alterValue(t, (t) => [...t].sort((t, n) => e.compareArrays(e.unwrapValue(t)[0], e.unwrapValue(n)[0])))]);
3184
- //#endregion
3185
- //#region lib/builtins/funcContains.ts
3099
+ }, qn = new Kn(), Jn = /* @__PURE__ */ t({ sortEntries: () => Yn }), Yn = ot(async (e, t) => [await e.alterValue(t, (t) => [...t].sort((t, n) => e.compareArrays(e.unwrapValue(t)[0], e.unwrapValue(n)[0])))]);
3100
+ // lib/builtins/funcContains.ts
3186
3101
  function Xn(e, t, n, r, i) {
3187
3102
  let a = e.unwrapValue(r), o = e.type(a), s = e.unwrapValue(i ?? null), c = e.type(s);
3188
3103
  switch (o) {
@@ -3191,88 +3106,65 @@ function Xn(e, t, n, r, i) {
3191
3106
  if (c === "string") return n(a.includes(s));
3192
3107
  break;
3193
3108
  case "object": return n(Object.values(a).some((t) => e.equals(t, s)));
3194
- default:
3195
3109
  }
3196
- throw new j("%s (%*<100v) cannot contain %s (%*<100v)", o, a, c, s);
3110
+ throw new k("%s (%*<100v) cannot contain %s (%*<100v)", o, a, c, s);
3197
3111
  }
3198
- //#endregion
3199
- //#region lib/builtins/funcEndsWith.ts
3112
+ // lib/builtins/funcEndsWith.ts
3200
3113
  function Zn(e, t, n, r, i) {
3201
3114
  let a = e.unwrapValue(r), o = e.type(a), s = e.unwrapValue(i ?? null), c = e.type(s);
3202
- switch (o) {
3203
- case "string":
3204
- if (c === "string") return n(a.endsWith(s));
3205
- break;
3206
- default:
3207
- }
3208
- throw new j("%s (%*<100v) cannot end with %s (%*<100v)", o, a, c, s);
3115
+ if (o === "string" && c === "string") return n(a.endsWith(s));
3116
+ throw new k("%s (%*<100v) cannot end with %s (%*<100v)", o, a, c, s);
3209
3117
  }
3210
- //#endregion
3211
- //#region lib/builtins/funcError.ts
3118
+ // lib/builtins/funcError.ts
3212
3119
  function Qn(e, t, n, r) {
3213
- throw new A(r);
3120
+ throw new O(r);
3214
3121
  }
3215
- //#endregion
3216
- //#region lib/builtins/funcFromJSON.ts
3122
+ // lib/builtins/funcFromJSON.ts
3217
3123
  function $n(e, t, n, r) {
3218
3124
  let i = e.unwrapValue(r), a = e.type(i);
3219
- switch (a) {
3220
- case "string": {
3221
- let e;
3222
- try {
3223
- e = JSON.parse(i);
3224
- } catch (e) {
3225
- throw new A(e.message);
3226
- }
3227
- return n(e);
3125
+ if (a === "string") {
3126
+ let e;
3127
+ try {
3128
+ e = JSON.parse(i);
3129
+ } catch (e) {
3130
+ throw new O(e.message);
3228
3131
  }
3229
- default:
3132
+ return n(e);
3230
3133
  }
3231
- throw new j("%s (%*<100v) cannot be parsed as JSON", a, i);
3134
+ throw new k("%s (%*<100v) cannot be parsed as JSON", a, i);
3232
3135
  }
3233
- //#endregion
3234
- //#region lib/builtins/funcHas.ts
3136
+ // lib/builtins/funcHas.ts
3235
3137
  function er(e, t, n, r, i) {
3236
3138
  let a = e.unwrapValue(r), o = e.type(a), s = e.unwrapValue(i ?? null), c = e.type(s);
3237
3139
  switch (o) {
3238
3140
  case "array":
3239
3141
  if (c === "number") return n(s >= 0 && s < a.length);
3240
3142
  break;
3241
- case "object":
3242
- if (c === "string") return n(Object.hasOwn(a, s));
3243
- break;
3244
- default:
3143
+ case "object": if (c === "string") return n(Object.hasOwn(a, s));
3245
3144
  }
3246
- throw new j("%s (%*<100v) cannot have %s (%*<100v) as key", o, a, c, s);
3145
+ throw new k("%s (%*<100v) cannot have %s (%*<100v) as key", o, a, c, s);
3247
3146
  }
3248
- //#endregion
3249
- //#region lib/builtins/funcIn.ts
3147
+ // lib/builtins/funcIn.ts
3250
3148
  function tr(e, t, n, r, i) {
3251
3149
  let a = e.unwrapValue(r), o = e.type(a), s = e.unwrapValue(i ?? null), c = e.type(s);
3252
3150
  switch (c) {
3253
3151
  case "array":
3254
3152
  if (o === "number") return n(a >= 0 && a < s.length);
3255
3153
  break;
3256
- case "object":
3257
- if (o === "string") return n(Object.hasOwn(s, a));
3258
- break;
3259
- default:
3154
+ case "object": if (o === "string") return n(Object.hasOwn(s, a));
3260
3155
  }
3261
- throw new j("%s (%*<100v) cannot have %s (%*<100v) as key", c, s, o, a);
3156
+ throw new k("%s (%*<100v) cannot have %s (%*<100v) as key", c, s, o, a);
3262
3157
  }
3263
- //#endregion
3264
- //#region lib/builtins/funcKeys.ts
3158
+ // lib/builtins/funcKeys.ts
3265
3159
  function nr(e, t, n, r) {
3266
3160
  let i = e.unwrapValue(r), a = e.type(i);
3267
3161
  switch (a) {
3268
3162
  case "array": return n(i.map((e, t) => t));
3269
3163
  case "object": return n(Object.keys(i));
3270
- default:
3271
3164
  }
3272
- throw new j("%s (%*<100v) has no keys", a, i);
3165
+ throw new k("%s (%*<100v) has no keys", a, i);
3273
3166
  }
3274
- //#endregion
3275
- //#region lib/builtins/funcLength.ts
3167
+ // lib/builtins/funcLength.ts
3276
3168
  function rr(e, t, n, r) {
3277
3169
  let i = e.unwrapValue(r), a = e.type(i);
3278
3170
  switch (a) {
@@ -3280,123 +3172,88 @@ function rr(e, t, n, r) {
3280
3172
  case "array": return n(i.length);
3281
3173
  case "string": return n([...i].length);
3282
3174
  case "object": return n(Object.keys(i).length);
3283
- default:
3284
3175
  }
3285
- throw new j("%s (%*<100v) has no length", a, i);
3176
+ throw new k("%s (%*<100v) has no length", a, i);
3286
3177
  }
3287
- //#endregion
3288
- //#region lib/builtins/funcNow.ts
3178
+ // lib/builtins/funcNow.ts
3289
3179
  function ir(e, t, n, r) {
3290
3180
  return n(Date.now());
3291
3181
  }
3292
- //#endregion
3293
- //#region lib/builtins/funcStartsWith.ts
3182
+ // lib/builtins/funcStartsWith.ts
3294
3183
  function ar(e, t, n, r, i) {
3295
3184
  let a = e.unwrapValue(r), o = e.type(a), s = e.unwrapValue(i ?? null), c = e.type(s);
3296
- switch (o) {
3297
- case "string":
3298
- if (c === "string") return n(a.startsWith(s));
3299
- break;
3300
- default:
3301
- }
3302
- throw new j("%s (%*<100v) cannot start with %s (%*<100v)", o, a, c, s);
3185
+ if (o === "string" && c === "string") return n(a.startsWith(s));
3186
+ throw new k("%s (%*<100v) cannot start with %s (%*<100v)", o, a, c, s);
3303
3187
  }
3304
- //#endregion
3305
- //#region lib/builtins/funcToJSON.ts
3188
+ // lib/builtins/funcToJSON.ts
3306
3189
  function or(e, t, n, r) {
3307
3190
  return n(e.stringifyJSON(r, !1));
3308
3191
  }
3309
- //#endregion
3310
- //#region lib/builtins/funcToLowerCase.ts
3192
+ // lib/builtins/funcToLowerCase.ts
3311
3193
  async function sr(e, t, n, r) {
3312
3194
  let i = e.type(r);
3313
- switch (i) {
3314
- case "string": return n(await e.alterValue(r, (e) => e.toLowerCase()));
3315
- default:
3316
- }
3317
- throw new j("%s (%*<100v) cannot be converted to lower case", i, e.unwrapValue(r));
3195
+ if (i === "string") return n(await e.alterValue(r, (e) => e.toLowerCase()));
3196
+ throw new k("%s (%*<100v) cannot be converted to lower case", i, e.unwrapValue(r));
3318
3197
  }
3319
- //#endregion
3320
- //#region lib/builtins/funcToNumber.ts
3198
+ // lib/builtins/funcToNumber.ts
3321
3199
  function cr(e, t, n, r) {
3322
3200
  let i = e.unwrapValue(r), a = e.type(i);
3323
3201
  switch (a) {
3324
3202
  case "number": return n(i);
3325
3203
  case "string": {
3326
3204
  let t = e.normalizeValue(+i);
3327
- if (i === "" || e.type(t) !== "number") throw new tt("%s (%*<100v) does not contain a valid number", a, i);
3205
+ if (i === "" || e.type(t) !== "number") throw new nt("%s (%*<100v) does not contain a valid number", a, i);
3328
3206
  return n(t);
3329
3207
  }
3330
- default:
3331
3208
  }
3332
- throw new j("%s (%*<100v) cannot be parsed as a number", a, i);
3209
+ throw new k("%s (%*<100v) cannot be parsed as a number", a, i);
3333
3210
  }
3334
- //#endregion
3335
- //#region lib/builtins/funcToString.ts
3211
+ // lib/builtins/funcToString.ts
3336
3212
  function lr(e, t, n, r) {
3337
3213
  return n(e.stringifyJSON(r, !0));
3338
3214
  }
3339
- //#endregion
3340
- //#region lib/builtins/funcToUpperCase.ts
3215
+ // lib/builtins/funcToUpperCase.ts
3341
3216
  async function ur(e, t, n, r) {
3342
3217
  let i = e.type(r);
3343
- switch (i) {
3344
- case "string": return n(await e.alterValue(r, (e) => e.toUpperCase()));
3345
- default:
3346
- }
3347
- throw new j("%s (%*<100v) cannot be converted to upper case", i, e.unwrapValue(r));
3218
+ if (i === "string") return n(await e.alterValue(r, (e) => e.toUpperCase()));
3219
+ throw new k("%s (%*<100v) cannot be converted to upper case", i, e.unwrapValue(r));
3348
3220
  }
3349
- //#endregion
3350
- //#region lib/builtins/funcTrim.ts
3221
+ // lib/builtins/funcTrim.ts
3351
3222
  async function dr(e, t, n, r) {
3352
3223
  let i = e.type(r);
3353
- switch (i) {
3354
- case "string": return n(await e.alterValue(r, (e) => e.trim()));
3355
- default:
3356
- }
3357
- throw new j("%s (%*<100v) cannot be trimmed", i, e.unwrapValue(r));
3224
+ if (i === "string") return n(await e.alterValue(r, (e) => e.trim()));
3225
+ throw new k("%s (%*<100v) cannot be trimmed", i, e.unwrapValue(r));
3358
3226
  }
3359
- //#endregion
3360
- //#region lib/builtins/funcTrimEnd.ts
3227
+ // lib/builtins/funcTrimEnd.ts
3361
3228
  async function fr(e, t, n, r) {
3362
3229
  let i = e.type(r);
3363
- switch (i) {
3364
- case "string": return n(await e.alterValue(r, (e) => e.trimEnd()));
3365
- default:
3366
- }
3367
- throw new j("%s (%*<100v) cannot be trimmed", i, e.unwrapValue(r));
3230
+ if (i === "string") return n(await e.alterValue(r, (e) => e.trimEnd()));
3231
+ throw new k("%s (%*<100v) cannot be trimmed", i, e.unwrapValue(r));
3368
3232
  }
3369
- //#endregion
3370
- //#region lib/builtins/funcTrimStart.ts
3233
+ // lib/builtins/funcTrimStart.ts
3371
3234
  async function pr(e, t, n, r) {
3372
3235
  let i = e.type(r);
3373
- switch (i) {
3374
- case "string": return n(await e.alterValue(r, (e) => e.trimStart()));
3375
- default:
3376
- }
3377
- throw new j("%s (%*<100v) cannot be trimmed", i, e.unwrapValue(r));
3236
+ if (i === "string") return n(await e.alterValue(r, (e) => e.trimStart()));
3237
+ throw new k("%s (%*<100v) cannot be trimmed", i, e.unwrapValue(r));
3378
3238
  }
3379
- //#endregion
3380
- //#region lib/builtins/funcType.ts
3239
+ // lib/builtins/funcType.ts
3381
3240
  function mr(e, t, n, r) {
3382
3241
  return n(e.type(r));
3383
3242
  }
3384
- //#endregion
3385
- //#region lib/builtins/funcVoid.ts
3243
+ // lib/builtins/funcVoid.ts
3386
3244
  function hr(e, t, n, r) {
3387
3245
  return [];
3388
3246
  }
3389
- //#endregion
3390
- //#region lib/builtins/math.ts
3247
+ // lib/builtins/math.ts
3391
3248
  function gr(e, t) {
3392
3249
  let n = e.type(t), r = e.unwrapValue(t);
3393
- if (n !== "number") throw new j("%s (%*<100v) cannot be used for mathematical operations", n, r);
3250
+ if (n !== "number") throw new k("%s (%*<100v) cannot be used for mathematical operations", n, r);
3394
3251
  return r;
3395
3252
  }
3396
3253
  function $(e) {
3397
3254
  return async function(t, n, r, i, ...a) {
3398
3255
  let o = t.type(i);
3399
- if (o !== "number") throw new j("%s (%*<100v) cannot be used for mathematical operations", o, t.unwrapValue(i));
3256
+ if (o !== "number") throw new k("%s (%*<100v) cannot be used for mathematical operations", o, t.unwrapValue(i));
3400
3257
  return r(await t.alterValue(i, (n) => e(t, n, ...a)));
3401
3258
  };
3402
3259
  }
@@ -3451,13 +3308,11 @@ var _r = $((e, t, n) => t ** gr(e, n ?? null)), vr = $((e, t) => Math.sqrt(t)),
3451
3308
  }
3452
3309
  } })).run([null]), e;
3453
3310
  });
3454
- //#endregion
3455
- //#region lib/interpreter/parseFunction.ts
3311
+ // lib/interpreter/parseFunction.ts
3456
3312
  async function Ir(e, t, n) {
3457
- return st(e, await qn.parseInstructions(t), n);
3313
+ return at(e, await qn.parseInstructions(t), n);
3458
3314
  }
3459
- //#endregion
3460
- //#region lib/main.ts
3315
+ // lib/main.ts
3461
3316
  var Lr = n(async () => ({
3462
3317
  interpreter: {},
3463
3318
  program: {},
@@ -3466,9 +3321,8 @@ var Lr = n(async () => ({
3466
3321
  let n = await Lr();
3467
3322
  return new Kn({
3468
3323
  interpreter: Gn(t?.interpreter, n.interpreter),
3469
- program: z(t?.program, n.program),
3470
- runtime: N(t?.runtime, n.runtime)
3324
+ program: en(t?.program, n.program),
3325
+ runtime: I(t?.runtime, n.runtime)
3471
3326
  }).parse(e);
3472
3327
  }, zr = async (e, t, n) => (await Rr(e, n)).run(t);
3473
- //#endregion
3474
- export { m as DEFINITION_VERSION, Ve as DEFINITION_VERSION_MAJOR, He as DEFINITION_VERSION_MINOR, h as JPLError, v as JPLErrorEnclosure, g as JPLExecutionError, y as JPLFatalError, $e as JPLReferenceError, A as JPLRuntimeError, it as JPLRuntimeScope, rt as JPLRuntimeSignal, nt as JPLSyntaxError, b as JPLType, tt as JPLTypeConversionError, j as JPLTypeError, et as JPLZeroDivisionError, ve as OPA_FIELD, ye as OPA_FUNCTION, be as OPA_ITER, xe as OPA_SLICE, Se as OPC_EQUAL, Ce as OPC_GREATER, we as OPC_GREATEREQUAL, Te as OPC_LESS, Ee as OPC_LESSEQUAL, De as OPC_UNEQUAL, Oe as OPM_ADDITION, ke as OPM_DIVISION, Ae as OPM_MULTIPLICATION, je as OPM_REMAINDER, Me as OPM_SUBTRACTION, Ne as OPU_ADDITION, Pe as OPU_DIVISION, Fe as OPU_MULTIPLICATION, Ie as OPU_NULL_COALESCENCE, Le as OPU_REMAINDER, Re as OPU_SET, ze as OPU_SUBTRACTION, Be as OPU_UPDATE, s as OP_ACCESS, c as OP_AND, l as OP_ARRAY_CONSTRUCTOR, u as OP_ASSIGNMENT, d as OP_CALCULATION, f as OP_COMPARISON, p as OP_CONSTANT, ee as OP_CONSTANT_FALSE, te as OP_CONSTANT_NULL, ne as OP_CONSTANT_TRUE, re as OP_FUNCTION_DEFINITION, ie as OP_IF, ae as OP_INTERPOLATED_STRING, oe as OP_NEGATION, se as OP_NOT, ce as OP_NULL_COALESCENCE, le as OP_NUMBER, ue as OP_OBJECT_CONSTRUCTOR, de as OP_OR, fe as OP_OUTPUT_CONCAT, pe as OP_STRING, me as OP_TRY, he as OP_VARIABLE, ge as OP_VARIABLE_DEFINITION, _e as OP_VOID, _ as adaptError, Ue as adaptErrors, We as adaptErrorsAsync, a as applyArray, o as applyCombinations, i as applyObject, qe as assertType, E as displayValue, Fr as getBuiltins, Lr as getOptions, Ze as jplJSONStripper, Xe as jplStripper, Ye as jplTypedStripper, Qe as jsonStripper, ft as mergeSegments, lt as mux, dt as muxAll, ut as muxAsync, M as muxOne, ct as nativeFunction, x as normalize, st as orphanFunction, Rr as parse, Ir as parseFunction, O as rawStripper, zr as run, ot as scopedFunction, Je as strictDisplayValue, w as stringify, D as strip, T as template, C as typeOf, Ke as typeOrder, S as unwrap };
3328
+ export { Ue as DEFINITION_VERSION, Ve as DEFINITION_VERSION_MAJOR, He as DEFINITION_VERSION_MINOR, m as JPLError, _ as JPLErrorEnclosure, h as JPLExecutionError, v as JPLFatalError, tt as JPLReferenceError, O as JPLRuntimeError, M as JPLRuntimeScope, rt as JPLRuntimeSignal, j as JPLSyntaxError, y as JPLType, nt as JPLTypeConversionError, k as JPLTypeError, A as JPLZeroDivisionError, ve as OPA_FIELD, ye as OPA_FUNCTION, be as OPA_ITER, xe as OPA_SLICE, Se as OPC_EQUAL, Ce as OPC_GREATER, we as OPC_GREATEREQUAL, Te as OPC_LESS, Ee as OPC_LESSEQUAL, De as OPC_UNEQUAL, Oe as OPM_ADDITION, ke as OPM_DIVISION, Ae as OPM_MULTIPLICATION, je as OPM_REMAINDER, Me as OPM_SUBTRACTION, Ne as OPU_ADDITION, Pe as OPU_DIVISION, Fe as OPU_MULTIPLICATION, Ie as OPU_NULL_COALESCENCE, Le as OPU_REMAINDER, Re as OPU_SET, ze as OPU_SUBTRACTION, Be as OPU_UPDATE, s as OP_ACCESS, c as OP_AND, l as OP_ARRAY_CONSTRUCTOR, u as OP_ASSIGNMENT, d as OP_CALCULATION, f as OP_COMPARISON, p as OP_CONSTANT, ee as OP_CONSTANT_FALSE, te as OP_CONSTANT_NULL, ne as OP_CONSTANT_TRUE, re as OP_FUNCTION_DEFINITION, ie as OP_IF, ae as OP_INTERPOLATED_STRING, oe as OP_NEGATION, se as OP_NOT, ce as OP_NULL_COALESCENCE, le as OP_NUMBER, ue as OP_OBJECT_CONSTRUCTOR, de as OP_OR, fe as OP_OUTPUT_CONCAT, pe as OP_STRING, me as OP_TRY, he as OP_VARIABLE, ge as OP_VARIABLE_DEFINITION, _e as OP_VOID, g as adaptError, We as adaptErrors, Ge as adaptErrorsAsync, a as applyArray, o as applyCombinations, i as applyObject, Ye as assertType, w as displayValue, Fr as getBuiltins, Lr as getOptions, $e as jplJSONStripper, Qe as jplStripper, Ze as jplTypedStripper, et as jsonStripper, lt as mergeSegments, st as mux, ct as muxAll, F as muxAsync, P as muxOne, ot as nativeFunction, b as normalize, at as orphanFunction, Rr as parse, Ir as parseFunction, E as rawStripper, zr as run, N as scopedFunction, Xe as strictDisplayValue, S as stringify, T as strip, C as template, Je as typeOf, qe as typeOrder, x as unwrap };