@blue-labs/document-processor 2.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/api/document-processor.d.ts.map +1 -1
  2. package/dist/engine/checkpoint-manager.d.ts.map +1 -1
  3. package/dist/engine/contract-bundle.d.ts.map +1 -1
  4. package/dist/engine/contract-loader.d.ts.map +1 -1
  5. package/dist/engine/processor-engine.d.ts.map +1 -1
  6. package/dist/engine/scope-executor.d.ts.map +1 -1
  7. package/dist/index.js +1496 -1386
  8. package/dist/model/channels/document-update-channel.d.ts +4 -4
  9. package/dist/model/channels/embedded-node-channel.d.ts +4 -4
  10. package/dist/model/channels/lifecycle-channel.d.ts +4 -4
  11. package/dist/model/channels/myos-timeline-channel.d.ts +4 -4
  12. package/dist/model/channels/timeline-channel.d.ts +4 -4
  13. package/dist/model/channels/triggered-event-channel.d.ts +4 -4
  14. package/dist/model/handlers/sequential-workflow-operation.d.ts +6 -6
  15. package/dist/model/handlers/sequential-workflow-operation.d.ts.map +1 -1
  16. package/dist/model/handlers/sequential-workflow.d.ts +6 -6
  17. package/dist/model/handlers/sequential-workflow.d.ts.map +1 -1
  18. package/dist/model/markers/channel-event-checkpoint.d.ts +2 -2
  19. package/dist/model/markers/document-anchors.d.ts +3 -6
  20. package/dist/model/markers/document-anchors.d.ts.map +1 -1
  21. package/dist/model/markers/document-links.d.ts +3 -6
  22. package/dist/model/markers/document-links.d.ts.map +1 -1
  23. package/dist/model/markers/initialization-marker.d.ts +2 -2
  24. package/dist/model/markers/myos-participants-orchestration.d.ts +2 -2
  25. package/dist/model/markers/myos-session-interaction.d.ts +2 -2
  26. package/dist/model/markers/myos-worker-agency.d.ts +2 -2
  27. package/dist/model/markers/operation.d.ts +2 -2
  28. package/dist/model/markers/process-embedded.d.ts +2 -2
  29. package/dist/model/markers/processing-terminated-marker.d.ts +2 -2
  30. package/dist/model/shared/channel-contract-base.d.ts +4 -4
  31. package/dist/model/shared/handler-contract-base.d.ts +4 -4
  32. package/dist/model/shared/marker-contract-base.d.ts +2 -2
  33. package/dist/registry/processors/myos-timeline-channel-processor.d.ts +4 -4
  34. package/dist/registry/processors/myos-timeline-channel-processor.d.ts.map +1 -1
  35. package/dist/registry/processors/operation-marker-processor.d.ts +2 -2
  36. package/dist/registry/processors/operation-marker-processor.d.ts.map +1 -1
  37. package/dist/registry/processors/sequential-workflow-operation-processor.d.ts +6 -6
  38. package/dist/registry/processors/sequential-workflow-operation-processor.d.ts.map +1 -1
  39. package/dist/registry/processors/sequential-workflow-processor.d.ts +6 -6
  40. package/dist/registry/processors/sequential-workflow-processor.d.ts.map +1 -1
  41. package/dist/registry/processors/steps/javascript-code-step-executor.d.ts +6 -0
  42. package/dist/registry/processors/steps/javascript-code-step-executor.d.ts.map +1 -1
  43. package/dist/registry/processors/steps/trigger-event-step-executor.d.ts.map +1 -1
  44. package/dist/registry/processors/steps/update-document-step-executor.d.ts.map +1 -1
  45. package/dist/registry/processors/timeline-channel-processor.d.ts +4 -4
  46. package/dist/registry/processors/timeline-channel-processor.d.ts.map +1 -1
  47. package/dist/registry/processors/utils/operation-utils.d.ts +1 -1
  48. package/dist/registry/processors/utils/operation-utils.d.ts.map +1 -1
  49. package/dist/registry/processors/workflow/operation-matcher.d.ts +2 -1
  50. package/dist/registry/processors/workflow/operation-matcher.d.ts.map +1 -1
  51. package/dist/registry/types.d.ts.map +1 -1
  52. package/dist/runtime/gas-helpers.d.ts +0 -3
  53. package/dist/runtime/gas-helpers.d.ts.map +1 -1
  54. package/dist/runtime/gas-meter.d.ts +1 -3
  55. package/dist/runtime/gas-meter.d.ts.map +1 -1
  56. package/dist/runtime/gas-schedule.d.ts +8 -0
  57. package/dist/runtime/gas-schedule.d.ts.map +1 -0
  58. package/dist/test-support/blue.d.ts +16 -22
  59. package/dist/test-support/blue.d.ts.map +1 -1
  60. package/dist/util/expression/quickjs-config.d.ts +2 -0
  61. package/dist/util/expression/quickjs-config.d.ts.map +1 -0
  62. package/dist/util/expression/quickjs-evaluator.d.ts +23 -22
  63. package/dist/util/expression/quickjs-evaluator.d.ts.map +1 -1
  64. package/dist/util/expression/quickjs-expression-utils.d.ts +3 -3
  65. package/dist/util/expression/quickjs-expression-utils.d.ts.map +1 -1
  66. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -1,39 +1,39 @@
1
- import { blueIds as m, ContractSchema as nt, ChannelSchema as rt, HandlerSchema as it, MarkerSchema as st, DocumentUpdateChannelSchema as ot, EmbeddedNodeChannelSchema as at, LifecycleEventChannelSchema as ct, TriggeredEventChannelSchema as lt, ChannelEventCheckpointSchema as ut, ProcessingInitializedMarkerSchema as dt, ProcessEmbeddedSchema as ht, ProcessingTerminatedMarkerSchema as ft, repository as pt } from "@blue-repository/core";
2
- import { getQuickJS as mt } from "quickjs-emscripten";
3
- import { BlueNode as d, blueNodeField as V, withTypeBlueId as gt, BlueIdCalculator as Et, Blue as yt, MergingProcessors as P } from "@blue-labs/language";
4
- import fe from "picomatch";
5
- import { z as b, ZodError as Me } from "zod";
6
- import { TimelineChannelSchema as wt, OperationSchema as z, SequentialWorkflowSchema as St, SequentialWorkflowOperationSchema as bt, TimelineEntrySchema as v, blueIds as R, TriggerEventSchema as pe, JavaScriptCodeSchema as me, UpdateDocumentSchema as ge, OperationRequestSchema as ne, repository as Ct } from "@blue-repository/conversation";
7
- import { MyOSTimelineChannelSchema as It, DocumentAnchorsSchema as vt, DocumentLinksSchema as kt, MyOSParticipantsOrchestrationSchema as Tt, MyOSSessionInteractionSchema as Rt, MyOSWorkerAgencySchema as Pt, blueIds as D, MyOSTimelineEntrySchema as Ee, repository as Nt } from "@blue-repository/myos";
8
- import { isNullable as re } from "@blue-labs/shared-utils";
9
- function Mt(i) {
1
+ import { evaluate as Et } from "@blue-quickjs/quickjs-runtime";
2
+ import { validateDv as yt, DV_LIMIT_DEFAULTS as St } from "@blue-quickjs/dv";
3
+ import { HOST_V1_MANIFEST as Ct, HOST_V1_HASH as wt } from "@blue-quickjs/abi-manifest";
4
+ import { BlueNode as h, withTypeBlueId as m, blueNodeField as v, Properties as Ce, BlueIdCalculator as vt, Blue as kt, MergingProcessors as D } from "@blue-labs/language";
5
+ import we from "picomatch";
6
+ import { z as l, ZodError as Ue } from "zod";
7
+ import { isNullable as le } from "@blue-labs/shared-utils";
8
+ import { repository as bt } from "@blue-repository/types";
9
+ function It(i) {
10
10
  return { ok: !0, value: i };
11
11
  }
12
- function Ot(i) {
12
+ function Tt(i) {
13
13
  return { ok: !1, error: i };
14
14
  }
15
- function gi(i) {
15
+ function Bi(i) {
16
16
  return i.ok;
17
17
  }
18
- function Ei(i) {
18
+ function Li(i) {
19
19
  return !i.ok;
20
20
  }
21
- function yi(i, e) {
22
- return i.ok ? Mt(e(i.value)) : i;
21
+ function _i(i, e) {
22
+ return i.ok ? It(e(i.value)) : i;
23
23
  }
24
- function wi(i, e) {
25
- return i.ok ? i : Ot(e(i.error));
24
+ function Fi(i, e) {
25
+ return i.ok ? i : Tt(e(i.error));
26
26
  }
27
- function Si(i, e) {
27
+ function Ui(i, e) {
28
28
  return i.ok ? e(i.value) : i;
29
29
  }
30
- function bi(i, e) {
30
+ function zi(i, e) {
31
31
  return i.ok ? i.value : e;
32
32
  }
33
- function Ci(i, e) {
33
+ function $i(i, e) {
34
34
  return i.ok ? i.value : e(i.error);
35
35
  }
36
- function Ii(i, e) {
36
+ function Vi(i, e) {
37
37
  return i.ok ? e.ok(i.value) : e.err(i.error);
38
38
  }
39
39
  const E = {
@@ -56,14 +56,14 @@ const E = {
56
56
  return { kind: "UnsupportedOp", operation: i, reason: e };
57
57
  }
58
58
  };
59
- function At(i) {
59
+ function Rt(i) {
60
60
  return Object.freeze([...i]);
61
61
  }
62
- const Dt = {
62
+ const Mt = {
63
63
  of(i, e, t) {
64
64
  return {
65
65
  document: i,
66
- triggeredEvents: At(e),
66
+ triggeredEvents: Rt(e),
67
67
  totalGas: t,
68
68
  capabilityFailure: !1,
69
69
  failureReason: null
@@ -78,68 +78,85 @@ const Dt = {
78
78
  failureReason: e ?? null
79
79
  };
80
80
  }
81
- }, Oe = Dt, Bt = [
81
+ }, ze = Mt, p = {
82
+ "Core/Channel": "DcoJyCh7XXxy1nR5xjy7qfkUgQ1GiZnKKSxh8DJusBSr",
83
+ "Core/Channel Event Checkpoint": "B7YQeYdQzUNuzaDQ4tNTd2iJqgd4YnVQkgz4QgymDWWU",
84
+ "Core/Contract": "AERp8BWnuUsjoPciAeNXuUWS9fmqPNMdWbxmKn3tcitx",
85
+ "Core/Document Processing Initiated": "BrpmpNt5JkapeUvPqYcxgXZrHNZX3R757dRwuXXdfNM2",
86
+ "Core/Document Processing Terminated": "5AJiAUgiSDwfCzv9rCYKNaAJu1hm8BXFu7eLNAEHNACr",
87
+ "Core/Document Update": "7htwgHAXA9FjUGRytXFfwYMUZz4R3BDMfmeHeGvpscLP",
88
+ "Core/Document Update Channel": "6H1iGrDAcqtFE1qv3iyMTj79jCZsMUMxsNUzqYSJNbyR",
89
+ "Core/Embedded Node Channel": "Fjbu3QpnUaTruDTcTidETCX2N5STyv7KYxT42PCzGHxm",
90
+ "Core/Handler": "9ZE5pGjtSGJgWJG7iAVz4iPEz5CatceX3yb3qp5MpAKJ",
91
+ "Core/Json Patch Entry": "Bz49DbfqKC1yJeCfv5RYPZUKTfb7rtZnmreCaz4RsXn5",
92
+ "Core/Lifecycle Event Channel": "H2aCCTUcLMTJozWkn7HPUjyFBFxamraw1q8DyWk87zxr",
93
+ "Core/Marker": "7QACj919YMRvFCTELCf6jfQTp41RVhtHdE6bPazLUZQ6",
94
+ "Core/Process Embedded": "Hu4XkfvyXLSdfFNUwuXebEu3oJeWcMyhBTcRV9AQyKPC",
95
+ "Core/Processing Initialized Marker": "EVguxFmq5iFtMZaBQgHfjWDojaoesQ1vEXCQFZ59yL28",
96
+ "Core/Processing Terminated Marker": "5NiEhupJ6uF54Q3vs4GwQX4UX4ExtwHpKRVvjKEHtvjR",
97
+ "Core/Triggered Event Channel": "C77W4kVGcxL7Mkx9WL9QESPEFFL2GzWAe647s1Efprt"
98
+ }, Pt = [
82
99
  "embedded",
83
100
  "initialized",
84
101
  "terminated",
85
102
  "checkpoint"
86
- ], _t = [
87
- m["Document Update Channel"],
88
- m["Triggered Event Channel"],
89
- m["Lifecycle Event Channel"],
90
- m["Embedded Node Channel"]
91
- ], Ae = "embedded", De = "initialized", Be = "terminated", T = "checkpoint", oe = new Set(
92
- Bt
93
- ), _e = new Set(_t);
94
- function Lt(i) {
95
- return i != null && oe.has(i);
96
- }
97
- function ae(i) {
98
- return i != null && _e.has(
103
+ ], Ot = [
104
+ p["Core/Document Update Channel"],
105
+ p["Core/Triggered Event Channel"],
106
+ p["Core/Lifecycle Event Channel"],
107
+ p["Core/Embedded Node Channel"]
108
+ ], $e = "embedded", Ve = "initialized", He = "terminated", A = "checkpoint", me = new Set(
109
+ Pt
110
+ ), We = new Set(Ot);
111
+ function Nt(i) {
112
+ return i != null && me.has(i);
113
+ }
114
+ function fe(i) {
115
+ return i != null && We.has(
99
116
  i
100
117
  );
101
118
  }
102
- const vi = {
103
- KEY_EMBEDDED: Ae,
104
- KEY_INITIALIZED: De,
105
- KEY_TERMINATED: Be,
106
- KEY_CHECKPOINT: T,
107
- RESERVED_CONTRACT_KEYS: oe,
108
- PROCESSOR_MANAGED_CHANNEL_BLUE_IDS: _e,
109
- isReservedContractKey: Lt,
110
- isProcessorManagedChannelBlueId: ae
111
- }, B = "/contracts", ie = `${B}/${De}`, Le = `${B}/${Be}`, $t = `${B}/${Ae}`, $e = `${B}/${T}`, xe = "/lastEvents", Fe = "/lastSignatures";
112
- function Q(i) {
113
- return `${B}/${i}`;
114
- }
115
- function ze(i, e) {
116
- return `${Q(i)}${xe}/${e}`;
117
- }
118
- function Ue(i, e) {
119
- return `${Q(i)}${Fe}/${e}`;
120
- }
121
- const ki = {
122
- RELATIVE_CONTRACTS: B,
123
- RELATIVE_INITIALIZED: ie,
124
- RELATIVE_TERMINATED: Le,
125
- RELATIVE_EMBEDDED: $t,
126
- RELATIVE_CHECKPOINT: $e,
127
- LAST_EVENTS_SUFFIX: xe,
128
- LAST_SIGNATURES_SUFFIX: Fe,
129
- relativeContractsEntry: Q,
130
- relativeCheckpointLastEvent: ze,
131
- relativeCheckpointLastSignature: Ue
119
+ const Hi = {
120
+ KEY_EMBEDDED: $e,
121
+ KEY_INITIALIZED: Ve,
122
+ KEY_TERMINATED: He,
123
+ KEY_CHECKPOINT: A,
124
+ RESERVED_CONTRACT_KEYS: me,
125
+ PROCESSOR_MANAGED_CHANNEL_BLUE_IDS: We,
126
+ isReservedContractKey: Nt,
127
+ isProcessorManagedChannelBlueId: fe
128
+ }, F = "/contracts", ue = `${F}/${Ve}`, Ge = `${F}/${He}`, At = `${F}/${$e}`, Ke = `${F}/${A}`, qe = "/lastEvents", Je = "/lastSignatures";
129
+ function ee(i) {
130
+ return `${F}/${i}`;
131
+ }
132
+ function je(i, e) {
133
+ return `${ee(i)}${qe}/${e}`;
134
+ }
135
+ function Qe(i, e) {
136
+ return `${ee(i)}${Je}/${e}`;
137
+ }
138
+ const Wi = {
139
+ RELATIVE_CONTRACTS: F,
140
+ RELATIVE_INITIALIZED: ue,
141
+ RELATIVE_TERMINATED: Ge,
142
+ RELATIVE_EMBEDDED: At,
143
+ RELATIVE_CHECKPOINT: Ke,
144
+ LAST_EVENTS_SUFFIX: qe,
145
+ LAST_SIGNATURES_SUFFIX: Je,
146
+ relativeContractsEntry: ee,
147
+ relativeCheckpointLastEvent: je,
148
+ relativeCheckpointLastSignature: Qe
132
149
  };
133
- function Ve(i) {
150
+ function Xe(i) {
134
151
  return i == null || i.length === 0;
135
152
  }
136
- function y(i) {
137
- return Ve(i) ? "/" : i.startsWith("/") ? i : `/${i}`;
138
- }
139
153
  function S(i) {
140
- return Ve(i) ? "/" : i.startsWith("/") ? i : `/${i}`;
154
+ return Xe(i) ? "/" : i.startsWith("/") ? i : `/${i}`;
141
155
  }
142
- function ye(i) {
156
+ function T(i) {
157
+ return Xe(i) ? "/" : i.startsWith("/") ? i : `/${i}`;
158
+ }
159
+ function ve(i) {
143
160
  if (i == null)
144
161
  return "";
145
162
  let e = i.trim();
@@ -151,16 +168,16 @@ function ye(i) {
151
168
  e = e.substring(0, e.length - 1);
152
169
  return e;
153
170
  }
154
- function Ti(i, e) {
155
- const t = ye(i), n = ye(e);
171
+ function Gi(i, e) {
172
+ const t = ve(i), n = ve(e);
156
173
  return t.length === 0 && n.length === 0 ? "/" : t.length === 0 ? `/${n}` : n.length === 0 ? `/${t}` : `/${t}/${n}`;
157
174
  }
158
- function w(i, e) {
159
- const t = y(i), n = S(e);
175
+ function b(i, e) {
176
+ const t = S(i), n = T(e);
160
177
  return t === "/" ? n : n === "/" || n.length === 1 ? t : `${t}${n}`;
161
178
  }
162
- function xt(i, e) {
163
- const t = y(i), n = S(e);
179
+ function Dt(i, e) {
180
+ const t = S(i), n = T(e);
164
181
  if (t === "/" || !n.startsWith(t))
165
182
  return n;
166
183
  if (n.length === t.length)
@@ -168,526 +185,570 @@ function xt(i, e) {
168
185
  const r = n.substring(t.length);
169
186
  return r.length === 0 ? "/" : r.startsWith("/") ? r : `/${r}`;
170
187
  }
171
- function Ft(i) {
188
+ function xt(i) {
172
189
  return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
173
190
  }
174
- var X, we;
175
- function zt() {
176
- return we || (we = 1, X = function i(e) {
191
+ var oe, ke;
192
+ function Bt() {
193
+ return ke || (ke = 1, oe = function i(e) {
177
194
  if (typeof e == "number" && isNaN(e))
178
195
  throw new Error("NaN is not allowed");
179
196
  if (typeof e == "number" && !isFinite(e))
180
197
  throw new Error("Infinity is not allowed");
181
- return e === null || typeof e != "object" ? JSON.stringify(e) : e.toJSON instanceof Function ? i(e.toJSON()) : Array.isArray(e) ? `[${e.reduce((r, s, o) => `${r}${o === 0 ? "" : ","}${i(s === void 0 || typeof s == "symbol" ? null : s)}`, "")}]` : `{${Object.keys(e).sort().reduce((n, r) => {
198
+ return e === null || typeof e != "object" ? JSON.stringify(e) : e.toJSON instanceof Function ? i(e.toJSON()) : Array.isArray(e) ? `[${e.reduce((r, o, s) => `${r}${s === 0 ? "" : ","}${i(o === void 0 || typeof o == "symbol" ? null : o)}`, "")}]` : `{${Object.keys(e).sort().reduce((n, r) => {
182
199
  if (e[r] === void 0 || typeof e[r] == "symbol")
183
200
  return n;
184
- const s = n.length === 0 ? "" : ",";
185
- return `${n}${s}${i(r)}:${i(e[r])}`;
201
+ const o = n.length === 0 ? "" : ",";
202
+ return `${n}${o}${i(r)}:${i(e[r])}`;
186
203
  }, "")}}`;
187
- }), X;
204
+ }), oe;
188
205
  }
189
- var Ut = zt();
190
- const Vt = /* @__PURE__ */ Ft(Ut);
191
- function Ht(i, e) {
206
+ var Lt = Bt();
207
+ const _t = /* @__PURE__ */ xt(Lt);
208
+ function Ft(i, e) {
192
209
  return i.nodeToJson(e, "official");
193
210
  }
194
- function Kt(i, e) {
195
- const t = Ht(i, e);
196
- return Vt(t);
211
+ function Ut(i, e) {
212
+ const t = Ft(i, e);
213
+ return _t(t);
197
214
  }
198
- function He(i, e) {
199
- return e ? Kt(i, e) : null;
215
+ function Ye(i, e) {
216
+ return e ? Ut(i, e) : null;
200
217
  }
201
- function Se(i, e) {
202
- const t = He(i, e);
218
+ function be(i, e) {
219
+ const t = Ye(i, e);
203
220
  return t == null ? 0 : new TextEncoder().encode(t).length;
204
221
  }
205
- function Ke(i) {
206
- return typeof i == "object" && i !== null && !Array.isArray(i);
207
- }
222
+ const zt = 1700, de = BigInt(
223
+ zt
224
+ ), $t = BigInt(Number.MAX_SAFE_INTEGER), Vt = 4e4, Ht = 4e4;
208
225
  function Wt(i) {
209
- return i.replace(/~1/g, "/").replace(/~0/g, "~");
210
- }
211
- function Gt(i) {
212
- if (i.length === 0 || !/^\d+$/.test(i))
213
- return !1;
214
- const e = Number(i);
215
- return Number.isSafeInteger(e);
216
- }
217
- function x(i, e = !0) {
218
- if (Array.isArray(i))
219
- return e ? i.map((r) => x(r, !0)) : i.slice();
220
- if (!Ke(i))
221
- return i;
222
- if (Object.prototype.hasOwnProperty.call(i, "value")) {
223
- const r = i.value;
224
- return e ? x(r, !0) : r;
225
- }
226
- const t = i.items;
227
- if (Array.isArray(t))
228
- return e ? t.map((r) => x(r, !0)) : t.slice();
229
- const n = {};
230
- for (const [r, s] of Object.entries(i))
231
- n[r] = e ? x(s, !0) : s;
232
- return n;
233
- }
234
- function qt(i, e) {
235
- if (e === "")
236
- return i;
237
- if (!e.startsWith("/"))
238
- throw new TypeError('JSON pointer must start with "/"');
239
- const t = e.split("/").slice(1).map((r) => Wt(r));
240
- let n = i;
241
- for (const r of t) {
242
- if (n == null)
243
- return;
244
- if (Array.isArray(n)) {
245
- if (!Gt(r))
246
- return;
247
- const s = Number(r);
248
- n = n[s];
249
- continue;
250
- }
251
- if (Ke(n)) {
252
- n = n[r];
253
- continue;
254
- }
255
- return;
226
+ let e;
227
+ if (typeof i == "bigint")
228
+ e = i;
229
+ else {
230
+ if (!Number.isFinite(i) || i <= 0)
231
+ return 0;
232
+ e = BigInt(Math.trunc(i));
233
+ }
234
+ if (e <= 0n)
235
+ return 0;
236
+ const t = (e + de - 1n) / de;
237
+ return t > $t ? Number.MAX_SAFE_INTEGER : Number(t);
238
+ }
239
+ function Ze(i) {
240
+ const e = BigInt(Math.max(0, Math.trunc(i)));
241
+ return e <= 0n ? 0n : e * de;
242
+ }
243
+ const et = Ze(
244
+ Vt
245
+ ), Gt = Ze(
246
+ Ht
247
+ ), O = 1, Kt = /* @__PURE__ */ new Set([
248
+ "event",
249
+ "eventCanonical",
250
+ "steps",
251
+ "document",
252
+ "emit"
253
+ ]);
254
+ class ge {
255
+ // Serialize evaluations to avoid races when updating host handler bindings.
256
+ evaluationQueue = Promise.resolve();
257
+ handlerState = {
258
+ documentGet: () => ({ ok: null, units: O }),
259
+ documentGetCanonical: () => ({ ok: null, units: O }),
260
+ emit: () => ({ ok: null, units: O })
261
+ };
262
+ handlers = {
263
+ document: {
264
+ get: (e) => this.handlerState.documentGet(e),
265
+ getCanonical: (e) => this.handlerState.documentGetCanonical(e)
266
+ },
267
+ emit: (e) => this.handlerState.emit(e)
268
+ };
269
+ async evaluate(e) {
270
+ const t = this.evaluationQueue.then(() => this.evaluateOnce(e));
271
+ return this.evaluationQueue = t.then(
272
+ () => {
273
+ },
274
+ () => {
275
+ }
276
+ ), t;
256
277
  }
257
- return n;
258
- }
259
- const Jt = 500, jt = 32 * 1024 * 1024;
260
- class ce {
261
- modulePromise;
262
- moduleInstance;
263
- async evaluate({
278
+ async evaluateOnce({
264
279
  code: e,
265
280
  bindings: t,
266
- timeout: n = Jt,
267
- memoryLimit: r = jt
281
+ wasmGasLimit: n,
282
+ onWasmGasUsed: r
268
283
  }) {
269
- const o = (await this.ensureModule()).newRuntime();
270
- o.setMemoryLimit(r);
271
- const a = Number.isFinite(n) ? Date.now() + Math.max(n, 0) : void 0;
272
- a !== void 0 && o.setInterruptHandler(() => Date.now() > a);
273
- const c = o.newContext();
284
+ const o = this.prepareBindings(t), s = n ?? et, a = {
285
+ code: this.wrapCode(e),
286
+ abiId: "Host.v1",
287
+ abiVersion: 1,
288
+ abiManifestHash: wt
289
+ };
274
290
  try {
275
- this.installConsole(c), this.installDeterministicGlobals(c), this.installCanonNamespace(c), this.installBindings(c, t);
276
- const l = this.wrapCode(e), u = c.evalCode(l), f = c.unwrapResult(u);
277
- let h = null;
278
- try {
279
- return h = await this.resolveHandle(
280
- c,
281
- o,
282
- f,
283
- a
284
- ), c.dump(h);
285
- } finally {
286
- h ? h.dispose() : f.dispose();
287
- }
288
- } finally {
289
- c.dispose(), o.removeInterruptHandler?.(), o.dispose();
291
+ const c = await Et({
292
+ program: a,
293
+ input: o,
294
+ gasLimit: s,
295
+ manifest: Ct,
296
+ handlers: this.handlers
297
+ });
298
+ if (n !== void 0 && r && r({
299
+ used: c.gasUsed,
300
+ remaining: c.gasRemaining
301
+ }), !c.ok)
302
+ throw jt(c);
303
+ return j(c.value);
304
+ } catch (c) {
305
+ throw Qt(c);
290
306
  }
291
307
  }
292
- async ensureModule() {
293
- return this.moduleInstance ? this.moduleInstance : (this.modulePromise || (this.modulePromise = mt().then((e) => (this.moduleInstance = e, e))), this.modulePromise);
308
+ prepareBindings(e) {
309
+ const t = e ?? {};
310
+ qt(t);
311
+ const n = se(t.event, null, "event"), r = se(
312
+ t.eventCanonical ?? n,
313
+ n,
314
+ "eventCanonical"
315
+ ), o = se(t.steps, [], "steps"), s = {
316
+ event: n,
317
+ eventCanonical: r,
318
+ steps: o
319
+ }, a = this.extractDocumentBinding(t), c = typeof a?.canonical == "function" ? a.canonical : void 0;
320
+ this.handlerState.documentGet = Ie(a), this.handlerState.documentGetCanonical = Ie(
321
+ c ?? a
322
+ );
323
+ const u = this.extractEmitBinding(t);
324
+ return this.handlerState.emit = Jt(u), s;
325
+ }
326
+ extractDocumentBinding(e) {
327
+ if (!Object.prototype.hasOwnProperty.call(e, "document"))
328
+ return;
329
+ const t = e.document;
330
+ if (t != null) {
331
+ if (typeof t != "function")
332
+ throw new TypeError("QuickJS document binding must be a function");
333
+ return t;
334
+ }
335
+ }
336
+ extractEmitBinding(e) {
337
+ if (!Object.prototype.hasOwnProperty.call(e, "emit"))
338
+ return;
339
+ const t = e.emit;
340
+ if (t != null) {
341
+ if (typeof t != "function")
342
+ throw new TypeError("QuickJS emit binding must be a function");
343
+ return t;
344
+ }
294
345
  }
295
346
  wrapCode(e) {
296
- return `(async () => {
347
+ return `(() => {
348
+ return (() => {
297
349
  ${e}
350
+ })()
298
351
  })()`;
299
352
  }
300
- installConsole(e) {
301
- e.newObject().consume((t) => {
302
- const n = ["log", "info", "warn", "error"];
303
- for (const r of n) {
304
- const s = console[r] ?? console.log;
305
- e.newFunction(r, (...o) => {
306
- const a = o.map((c) => e.dump(c));
307
- return s.apply(console, a), e.undefined;
308
- }).consume((o) => e.setProp(t, r, o));
309
- }
310
- e.setProp(e.global, "console", t);
311
- });
312
- }
313
- installDeterministicGlobals(e) {
314
- e.setProp(e.global, "Date", e.undefined.dup());
315
- }
316
- installCanonNamespace(e) {
317
- e.newObject().consume((t) => {
318
- e.newFunction("unwrap", (...n) => {
319
- try {
320
- const [r, s] = n, o = r !== void 0 ? e.dump(r) : void 0, a = s === void 0 ? !0 : !!e.dump(s), c = x(o, a);
321
- return this.createReturnHandle(e, c);
322
- } catch (r) {
323
- const s = r instanceof Error ? r.message : String(r);
324
- return e.newError(s);
325
- }
326
- }).consume((n) => e.setProp(t, "unwrap", n)), e.newFunction("at", (...n) => {
327
- try {
328
- const [r, s] = n, o = r !== void 0 ? e.dump(r) : void 0;
329
- if (s === void 0)
330
- throw new TypeError(
331
- "canon.at(target, pointer) requires a pointer argument"
332
- );
333
- const a = e.dump(s);
334
- if (typeof a != "string")
335
- throw new TypeError("canon.at pointer must be a string");
336
- const c = qt(o, a);
337
- return this.createReturnHandle(e, c);
338
- } catch (r) {
339
- const s = r instanceof Error ? r.message : String(r);
340
- return e.newError(s);
341
- }
342
- }).consume((n) => e.setProp(t, "at", n)), e.setProp(e.global, "canon", t);
343
- });
344
- }
345
- installBindings(e, t) {
346
- if (t)
347
- for (const [n, r] of Object.entries(t))
348
- typeof r == "function" ? this.createFunctionHandle(
349
- e,
350
- n,
351
- r
352
- ).consume(
353
- (o) => e.setProp(e.global, n, o)
354
- ) : r !== void 0 && this.createOwnedHandle(e, r).consume(
355
- (o) => e.setProp(e.global, n, o)
356
- );
357
- }
358
- createFunctionHandle(e, t, n) {
359
- const r = e.newFunction(
360
- t,
361
- (...s) => {
362
- try {
363
- const o = s.map((c) => e.dump(c)), a = n(...o);
364
- if (a instanceof Promise)
365
- throw new TypeError("Async bindings are not supported");
366
- return this.createReturnHandle(e, a);
367
- } catch (o) {
368
- const a = o instanceof Error ? o.message : String(o);
369
- return e.newError(a);
370
- }
371
- }
372
- );
373
- return this.applyFunctionProperties(e, r, n), r;
374
- }
375
- /**
376
- * Copies enumerable properties from a host function onto the QuickJS handle.
377
- * Nested functions (e.g. `document.canonical = () => {}`) are recursively wrapped
378
- * so they stay callable inside QuickJS; plain values are serialized via
379
- * `createOwnedHandle`. This preserves helper namespaces on binding functions.
380
- */
381
- applyFunctionProperties(e, t, n) {
382
- if (!(n === null || typeof n != "object" && typeof n != "function"))
383
- for (const [r, s] of Object.entries(
384
- n
385
- )) {
386
- if (s === void 0)
387
- continue;
388
- if (typeof s == "function") {
389
- this.createFunctionHandle(
390
- e,
391
- r,
392
- s
393
- ).consume(
394
- (c) => e.setProp(t, r, c)
395
- );
396
- continue;
397
- }
398
- this.createOwnedHandle(e, s).consume(
399
- (a) => e.setProp(t, r, a)
400
- );
401
- }
402
- }
403
- createOwnedHandle(e, t) {
404
- if (t === void 0)
405
- return e.undefined.dup();
406
- if (t === null)
407
- return e.null.dup();
408
- if (typeof t == "boolean")
409
- return (t ? e.true : e.false).dup();
410
- if (typeof t == "number")
411
- return e.newNumber(t);
412
- if (typeof t == "string")
413
- return e.newString(t);
414
- if (typeof t == "bigint")
415
- return e.newBigInt(t);
416
- if (Array.isArray(t) || typeof t == "object") {
417
- const n = JSON.stringify(t);
418
- if (n === void 0)
419
- return e.undefined.dup();
420
- const r = e.evalCode(`(${n})`);
421
- return e.unwrapResult(r);
422
- }
353
+ }
354
+ function qt(i) {
355
+ for (const e of Object.keys(i))
356
+ if (!Kt.has(e))
357
+ throw new TypeError(`Unsupported QuickJS binding: "${e}"`);
358
+ }
359
+ function se(i, e, t) {
360
+ const n = i === void 0 ? e : i;
361
+ try {
362
+ yt(n, { limits: St });
363
+ } catch (r) {
364
+ const o = r instanceof Error ? r.message : String(r);
423
365
  throw new TypeError(
424
- `Unsupported binding value type: ${typeof t}`
366
+ `QuickJS ${t} binding must be valid DV: ${o}`
425
367
  );
426
368
  }
427
- createReturnHandle(e, t) {
428
- if (t === void 0)
429
- return e.undefined;
430
- if (t === null)
431
- return e.null;
432
- if (typeof t == "boolean")
433
- return t ? e.true : e.false;
434
- if (typeof t == "number")
435
- return e.newNumber(t);
436
- if (typeof t == "string")
437
- return e.newString(t);
438
- if (typeof t == "bigint")
439
- return e.newBigInt(t);
440
- if (Array.isArray(t) || typeof t == "object") {
441
- const n = JSON.stringify(t);
442
- if (n === void 0)
443
- return e.undefined;
444
- const r = e.evalCode(`(${n})`);
445
- return e.unwrapResult(r);
369
+ return n;
370
+ }
371
+ function Ie(i) {
372
+ return i ? (e) => {
373
+ try {
374
+ const t = i(e);
375
+ return {
376
+ ok: t === void 0 ? null : t,
377
+ units: O
378
+ };
379
+ } catch {
380
+ return {
381
+ err: { code: "INVALID_PATH", tag: "host/invalid_path" },
382
+ units: O
383
+ };
446
384
  }
447
- throw new TypeError(
448
- `Unsupported binding return type: ${typeof t}`
449
- );
450
- }
451
- async resolveHandle(e, t, n, r) {
452
- let s = n;
453
- for (; ; ) {
454
- const o = e.getPromiseState(s);
455
- if (o.type === "pending") {
456
- if (r !== void 0 && Date.now() > r)
457
- throw s.dispose(), new Error("QuickJS execution timed out while awaiting Promise");
458
- const a = t.executePendingJobs();
459
- let c = 0;
460
- try {
461
- c = e.unwrapResult(a);
462
- } finally {
463
- a.dispose();
464
- }
465
- if (c === 0) {
466
- if (r !== void 0 && Date.now() > r)
467
- throw s.dispose(), new Error(
468
- "QuickJS execution timed out while awaiting Promise"
469
- );
470
- await new Promise((l) => setTimeout(l, 0));
471
- }
472
- continue;
473
- }
474
- if (o.type === "fulfilled") {
475
- if (o.notAPromise)
476
- return s;
477
- s.dispose(), s = o.value;
478
- continue;
479
- }
480
- if (o.type === "rejected")
481
- try {
482
- const a = e.dump(o.error);
483
- throw a instanceof Error ? a : a && typeof a == "object" && "message" in a ? new Error(
484
- String(a.message)
485
- ) : new Error(
486
- typeof a == "string" ? a : JSON.stringify(a)
487
- );
488
- } finally {
489
- o.error.dispose(), s.dispose();
490
- }
385
+ } : () => ({ ok: null, units: O });
386
+ }
387
+ function Jt(i) {
388
+ return i ? (e) => {
389
+ try {
390
+ if (i(j(e)) instanceof Promise)
391
+ throw new Error("Async emit handlers are not supported");
392
+ return { ok: null, units: O };
393
+ } catch {
394
+ return {
395
+ err: { code: "LIMIT_EXCEEDED", tag: "host/limit" },
396
+ units: O
397
+ };
491
398
  }
399
+ } : () => ({ ok: null, units: O });
400
+ }
401
+ function j(i) {
402
+ if (i == null)
403
+ return i;
404
+ if (Array.isArray(i))
405
+ return i.map((e) => j(e));
406
+ if (typeof i == "object") {
407
+ const e = Object.getPrototypeOf(i);
408
+ if (e !== Object.prototype && e !== null)
409
+ return i;
410
+ const t = {};
411
+ for (const [n, r] of Object.entries(i))
412
+ t[n] = j(r);
413
+ return t;
414
+ }
415
+ return i;
416
+ }
417
+ function jt(i) {
418
+ if (i.ok)
419
+ return new Error("Unexpected evaluation result");
420
+ if (i.type === "invalid-output") {
421
+ const r = new Error(i.message);
422
+ return r.name = "InvalidOutputError", r;
423
+ }
424
+ const e = i.error;
425
+ if (e.kind === "out-of-gas") {
426
+ const r = new Error(
427
+ `OutOfGas: ${e.message || "out of gas"}`
428
+ );
429
+ return r.name = "OutOfGasError", r;
492
430
  }
431
+ const t = e.message || i.message, n = new Error(t);
432
+ return e.kind === "js-exception" ? (n.name = e.name || "Error", n) : e.kind === "host-error" ? (n.name = "HostError", n) : e.kind === "manifest-error" ? (n.name = "ManifestError", n) : (e.kind === "unknown" && e.name && (n.name = e.name), n);
493
433
  }
494
- const be = 120;
495
434
  function Qt(i) {
496
- return i.length <= be ? i : `${i.slice(0, be - 3)}...`;
435
+ return i instanceof Error ? i : new Error(String(i ?? "Unknown error"));
436
+ }
437
+ const Te = 120;
438
+ function Xt(i) {
439
+ return i.length <= Te ? i : `${i.slice(0, Te - 3)}...`;
497
440
  }
498
- class We extends Error {
441
+ class tt extends Error {
499
442
  constructor(e, t) {
500
- super(`Failed to evaluate code block: ${Qt(e)}`, { cause: t }), this.code = e, this.cause = t, this.name = "CodeBlockEvaluationError";
443
+ super(`Failed to evaluate code block: ${Xt(e)}`, { cause: t }), this.code = e, this.cause = t, this.name = "CodeBlockEvaluationError";
501
444
  }
502
445
  }
503
- const Ge = /^\$\{([\s\S]*)\}$/, Yt = /\$\{([\s\S]+?)\}/, qe = /\$\{([\s\S]+?)\}/g;
504
- function G(i) {
505
- if (typeof i != "string" || !Ge.test(i))
446
+ const nt = /^\$\{([\s\S]*)\}$/, Yt = /\$\{([\s\S]+?)\}/, Zt = /\$\{([\s\S]+?)\}/g;
447
+ function Q(i) {
448
+ if (typeof i != "string" || !nt.test(i))
506
449
  return !1;
507
450
  const e = i.indexOf("${"), t = i.lastIndexOf("${");
508
451
  return e === t;
509
452
  }
510
- function Zt(i) {
511
- return typeof i != "string" ? !1 : Ge.test(i) ? !0 : Yt.test(i);
453
+ function en(i) {
454
+ return typeof i != "string" ? !1 : nt.test(i) ? !0 : Yt.test(i);
512
455
  }
513
- function Xt(i) {
514
- if (!G(i))
456
+ function tn(i) {
457
+ if (!Q(i))
515
458
  throw new Error(`Invalid expression: ${i}`);
516
459
  return i.slice(2, -1);
517
460
  }
518
- async function Je(i, e, t) {
519
- const n = `return await (${e});`;
461
+ async function rt(i, e, t, n, r) {
462
+ const o = `return (${e});`;
520
463
  try {
521
- return await i.evaluate({ code: n, bindings: t });
522
- } catch (r) {
523
- throw new We(e, r);
464
+ return await i.evaluate({
465
+ code: o,
466
+ bindings: t,
467
+ wasmGasLimit: n,
468
+ onWasmGasUsed: r
469
+ });
470
+ } catch (s) {
471
+ throw new tt(e, s);
524
472
  }
525
473
  }
526
- async function en(i, e, t) {
527
- let n = "", r = 0;
528
- for (const s of e.matchAll(qe)) {
529
- const o = s[0], a = s[1], c = s.index ?? 0;
530
- n += e.slice(r, c);
531
- const l = await Je(
474
+ async function nn(i, e, t, n, r) {
475
+ let o = "", s = 0;
476
+ for (const a of e.matchAll(Zt)) {
477
+ const c = a[0], u = a[1], d = a.index ?? 0;
478
+ o += e.slice(s, d);
479
+ const f = await rt(
532
480
  i,
533
- a,
534
- t
481
+ u,
482
+ t,
483
+ n,
484
+ r
535
485
  );
536
- n += l == null ? "" : String(l), r = c + o.length;
486
+ o += f == null ? "" : String(f), s = d + c.length;
537
487
  }
538
- return n += e.slice(r), n;
488
+ return o += e.slice(s), o;
539
489
  }
540
- function je({
490
+ function it({
541
491
  include: i,
542
492
  exclude: e = [],
543
493
  options: t
544
494
  }) {
545
495
  const n = { dot: !0, ...t ?? {} }, r = i.map(
546
- (o) => fe(o, n)
547
- ), s = e.map(
548
- (o) => fe(o, n)
496
+ (s) => we(s, n)
497
+ ), o = e.map(
498
+ (s) => we(s, n)
549
499
  );
550
- return (o) => r.some((a) => a(o)) && !s.some((a) => a(o));
500
+ return (s) => r.some((a) => a(s)) && !o.some((a) => a(s));
551
501
  }
552
- async function q(i) {
502
+ async function X(i) {
553
503
  const {
554
504
  evaluator: e,
555
505
  node: t,
556
506
  bindings: n,
557
507
  shouldResolve: r,
558
- shouldDescend: s = () => !0,
559
- context: o,
508
+ shouldDescend: o = () => !0,
509
+ context: s,
560
510
  pointer: a = "/"
561
- } = i, c = t.clone();
562
- if (!s(a, c))
563
- return c;
564
- const l = c.getValue();
565
- if (l !== void 0) {
566
- if (typeof l == "string" && r(a)) {
567
- if (G(l)) {
568
- const h = Xt(l);
569
- o.gasMeter().chargeExpression(h);
570
- const p = await Je(
511
+ } = i, c = Gt, u = ({
512
+ used: I
513
+ }) => {
514
+ s.gasMeter().chargeWasmGas(I);
515
+ }, d = t.clone();
516
+ if (!o(a, d))
517
+ return d;
518
+ const f = d.getValue();
519
+ if (f !== void 0) {
520
+ if (typeof f == "string" && r(a)) {
521
+ if (Q(f)) {
522
+ const I = tn(f), P = await rt(
571
523
  e,
572
- h,
573
- n
524
+ I,
525
+ n,
526
+ c,
527
+ u
574
528
  );
575
- return o.blue.jsonValueToNode(p ?? null);
576
- } else if (Zt(l)) {
577
- const h = new RegExp(qe);
578
- let p = 0;
579
- for (h.lastIndex = 0; h.exec(l); )
580
- p += 1;
581
- o.gasMeter().chargeTemplate(p, l);
582
- const I = await en(
529
+ return s.blue.jsonValueToNode(P ?? null);
530
+ } else if (en(f)) {
531
+ const I = await nn(
583
532
  e,
584
- l,
585
- n
533
+ f,
534
+ n,
535
+ c,
536
+ u
586
537
  );
587
- return new d().setValue(I);
538
+ return new h().setValue(I);
588
539
  }
589
540
  }
590
- return c;
541
+ return d;
591
542
  }
592
- const u = c.getItems?.();
593
- if (Array.isArray(u)) {
594
- const h = await Promise.all(
595
- u.map(
596
- (p, I) => q({
543
+ const y = d.getItems?.();
544
+ if (Array.isArray(y)) {
545
+ const I = await Promise.all(
546
+ y.map(
547
+ (P, ie) => X({
597
548
  ...i,
598
- node: p,
599
- pointer: `${a}/${I}`
549
+ node: P,
550
+ pointer: `${a}/${ie}`
600
551
  })
601
552
  )
602
553
  );
603
- return c.setItems(h), c;
604
- }
605
- const f = c.getProperties?.();
606
- if (f) {
607
- const h = {};
608
- for (const [p, I] of Object.entries(f)) {
609
- const Z = a === "/" ? `/${p}` : `${a}/${p}`;
610
- h[p] = await q({
554
+ return d.setItems(I), d;
555
+ }
556
+ const w = d.getProperties?.();
557
+ if (w) {
558
+ const I = {};
559
+ for (const [P, ie] of Object.entries(w)) {
560
+ const gt = a === "/" ? `/${P}` : `${a}/${P}`;
561
+ I[P] = await X({
611
562
  ...i,
612
- node: I,
613
- pointer: Z
563
+ node: ie,
564
+ pointer: gt
614
565
  });
615
566
  }
616
- c.setProperties(h);
567
+ d.setProperties(I);
617
568
  }
618
- return c;
569
+ return d;
619
570
  }
620
- const le = nt, _ = rt.merge(
621
- le
571
+ const te = m(p["Core/Contract"])(l.object({
572
+ description: l.string().optional(),
573
+ name: l.string().optional(),
574
+ order: l.number().optional()
575
+ })), Ee = te, U = m(p["Core/Channel"])(te.extend({
576
+ description: l.string().optional(),
577
+ event: v().optional(),
578
+ name: l.string().optional()
579
+ })), z = U.merge(
580
+ Ee
622
581
  ).extend({
623
- path: b.string().optional(),
624
- definition: V().optional()
625
- }), Qe = it.merge(le), C = st.merge(le), tn = b.object({
626
- op: b.enum(["ADD", "REPLACE", "REMOVE"]),
627
- path: b.string(),
628
- val: V().optional()
629
- }), Ri = gt("JsonPatch")(
630
- tn
582
+ path: l.string().optional(),
583
+ definition: v().optional()
584
+ }), ot = m(p["Core/Handler"])(te.extend({
585
+ channel: l.string().optional(),
586
+ description: l.string().optional(),
587
+ event: v().optional(),
588
+ name: l.string().optional()
589
+ })), st = ot.merge(Ee), $ = m(p["Core/Marker"])(te.extend({
590
+ description: l.string().optional(),
591
+ name: l.string().optional()
592
+ })), M = $.merge(Ee), rn = l.object({
593
+ op: l.enum(["ADD", "REPLACE", "REMOVE"]),
594
+ path: l.string(),
595
+ val: v().optional()
596
+ }), Ki = m("JsonPatch")(
597
+ rn
631
598
  ).superRefine((i, e) => {
632
599
  i.op === "REMOVE" && i.val !== void 0 && e.addIssue({
633
- code: b.ZodIssueCode.custom,
600
+ code: l.ZodIssueCode.custom,
634
601
  message: "REMOVE operations cannot include a value",
635
602
  path: ["val"]
636
603
  }), i.op !== "REMOVE" && i.val === void 0 && e.addIssue({
637
- code: b.ZodIssueCode.custom,
604
+ code: l.ZodIssueCode.custom,
638
605
  message: `${i.op} operations must include a value`,
639
606
  path: ["val"]
640
607
  });
641
- }), nn = ot.merge(
642
- _
643
- ), rn = at.merge(
644
- _
645
- ), sn = ct.merge(
646
- _
647
- ), on = lt.merge(_), an = wt.merge(
648
- _
649
- ), cn = It.merge(_), ln = ut.merge(C).extend({
650
- lastSignatures: b.record(b.string()).optional()
651
- }), un = dt.merge(C), dn = ht.merge(
652
- C
653
- ), hn = ft.merge(C), fn = z.merge(
654
- C
655
- ), pn = vt.merge(C), mn = kt.merge(
656
- C
657
- ), gn = Tt.merge(C), En = Rt.merge(C), yn = Pt.merge(
658
- C
659
- ), Pi = V(), wn = St.merge(Qe).extend({
660
- steps: b.array(V()).optional()
661
- }), Sn = bt.merge(
662
- Qe
608
+ }), on = m(p["Core/Document Update Channel"])(U.extend({
609
+ description: l.string().optional(),
610
+ name: l.string().optional(),
611
+ path: l.string().optional()
612
+ })), sn = on.merge(
613
+ z
614
+ ), an = m(p["Core/Embedded Node Channel"])(U.extend({
615
+ childPath: l.string().optional(),
616
+ description: l.string().optional(),
617
+ name: l.string().optional()
618
+ })), cn = an.merge(
619
+ z
620
+ ), ln = m(p["Core/Lifecycle Event Channel"])(U.extend({
621
+ description: l.string().optional(),
622
+ name: l.string().optional()
623
+ })), un = ln.merge(
624
+ z
625
+ ), dn = m(p["Core/Triggered Event Channel"])(U.extend({
626
+ description: l.string().optional(),
627
+ name: l.string().optional()
628
+ })), hn = dn.merge(z), C = {
629
+ "Conversation/Actor": "CN5efWVizJbRsMCw8YWRfT2q9vM9XfeGDN9wFvYcvMnQ",
630
+ "Conversation/JavaScript Code": "3hYcmWMtMUPAzXBLFLb7BpuG9537tuTJPCr7pxWXvTZK",
631
+ "Conversation/Operation": "BoAiqVUZv9Fum3wFqaX2JnQMBHJLxJSo2V9U2UBmCfsC",
632
+ "Conversation/Operation Request": "HM4Ku4LFcjC5MxnhPMRwQ8w3BbHmJKKZfHTTzsd4jbJq",
633
+ "Conversation/Sequential Workflow": "7X3LkN54Yp88JgZbppPhP6hM3Jqiqv8Z2i4kS7phXtQe",
634
+ "Conversation/Sequential Workflow Operation": "CGdxkNjPcsdescqLPz6SNLsMyak6demQQr7RoKNHbCyv",
635
+ "Conversation/Sequential Workflow Step": "HYsLiqsqk7t98d5fK6YxKEQGeqBaHNVjM4rRNdxK4yUW",
636
+ "Conversation/Timeline": "3Ge54FsGJaaeZmm8nTKJdS6HVdYhiR3g18fDwg3Ev1Sa",
637
+ "Conversation/Timeline Channel": "EvuCWsG1E6WJQg8QXmk6rwMANYTZjoLWVZ1vYQWUwdTH",
638
+ "Conversation/Timeline Entry": "EzDiC9Frs8V5yQBMtDYh1DobVnWtWpFemXDX5fGUULBn",
639
+ "Conversation/Trigger Event": "GxUtWr3eH9a6YQeioQkujEnsPjD5s9RU8ZhEfmsV1vuU",
640
+ "Conversation/Update Document": "BnnNLCnKF49TUJ1bRfZ5rSMaFw8SVfUNfnE4kJFG7HtM"
641
+ }, at = m(C["Conversation/Timeline Channel"])(U.extend({
642
+ description: l.string().optional(),
643
+ name: l.string().optional(),
644
+ timelineId: l.string().optional()
645
+ })), pn = at.merge(
646
+ z
647
+ ), k = {
648
+ "MyOS/Document Anchor": "HS9yo34TGEAM2LGcNbLh7XPN4goPRhqdGZQkiyh473Wb",
649
+ "MyOS/Document Anchors": "7Usvk6dZMVqas3yqs23ZEXn1zu1YDPjgYiZFNYaw3puH",
650
+ "MyOS/Document Links": "4cmrbevB6K23ZenjqwmNxpnaw6RF4VB3wkP7XB59V7W5",
651
+ "MyOS/Link": "D2ERUvbpn6R6PR7hjFsGofwQsu9bkRfc6wbSYHcfJtMD",
652
+ "MyOS/MyOS Participants Orchestration": "6tzp2YX1rei3aAXg22SqYbeiiteGthj1LesTNCWm7wbU",
653
+ "MyOS/MyOS Session Interaction": "CeWyRmXAMZqvWBvby2KbRUZWcS7Pdxs42vnMXgn9gg6H",
654
+ "MyOS/MyOS Timeline": "2gyToM86KgFJpB8inz8TBVEMZk8UVGYdRozF4mfvxtuk",
655
+ "MyOS/MyOS Timeline Channel": "HCF8mXnX3dFjQ8osjxb4Wzm2Nm1DoXnTYuA5sPnV7NTs",
656
+ "MyOS/MyOS Timeline Entry": "Furgmg5xcJVMDmaQXZRfZ1XehSf7PWctrioo8etRYJHQ",
657
+ "MyOS/MyOS Worker Agency": "4Lix4AKXvBDvrwxw2htSdYFKxL4wugEQzqoSEYet5Dh1"
658
+ }, mn = m(k["MyOS/MyOS Timeline Channel"])(at.extend({
659
+ accountId: l.string().optional(),
660
+ description: l.string().optional(),
661
+ email: l.string().optional(),
662
+ name: l.string().optional()
663
+ })), fn = mn.merge(z), gn = m(p["Core/Channel Event Checkpoint"])($.extend({
664
+ description: l.string().optional(),
665
+ lastEvents: l.record(l.string(), v()).optional(),
666
+ name: l.string().optional()
667
+ })), En = gn.merge(M).extend({
668
+ lastSignatures: l.record(l.string()).optional()
669
+ }), yn = m(p["Core/Processing Initialized Marker"])($.extend({
670
+ description: l.string().optional(),
671
+ documentId: l.string().optional(),
672
+ name: l.string().optional()
673
+ })), Sn = yn.merge(M), Cn = m(p["Core/Process Embedded"])($.extend({
674
+ description: l.string().optional(),
675
+ name: l.string().optional(),
676
+ paths: l.array(l.string()).optional()
677
+ })), wn = Cn.merge(
678
+ M
679
+ ), vn = m(p["Core/Processing Terminated Marker"])($.extend({
680
+ cause: l.string().optional(),
681
+ description: l.string().optional(),
682
+ name: l.string().optional(),
683
+ reason: l.string().optional()
684
+ })), kn = vn.merge(M), G = m(C["Conversation/Operation"])($.extend({
685
+ channel: l.string().optional(),
686
+ description: l.string().optional(),
687
+ name: l.string().optional(),
688
+ request: v().optional()
689
+ })), bn = G.merge(
690
+ M
691
+ ), In = m(k["MyOS/Document Anchor"])(l.object({
692
+ description: l.string().optional(),
693
+ name: l.string().optional(),
694
+ template: v().optional()
695
+ })), Tn = m(k["MyOS/Document Anchors"])(l.object({}).catchall(In)), Rn = Tn.merge(M), Mn = m(k["MyOS/Link"])(l.object({
696
+ anchor: l.string().optional(),
697
+ description: l.string().optional(),
698
+ name: l.string().optional()
699
+ })), Pn = m(k["MyOS/Document Links"])(l.object({}).catchall(Mn)), On = Pn.merge(
700
+ M
701
+ ), Nn = m(k["MyOS/MyOS Participants Orchestration"])(l.object({
702
+ name: l.string().optional()
703
+ })), An = Nn.merge(M), Dn = m(k["MyOS/MyOS Session Interaction"])(l.object({
704
+ name: l.string().optional()
705
+ })), xn = Dn.merge(M), Bn = m(k["MyOS/MyOS Worker Agency"])(l.object({
706
+ name: l.string().optional()
707
+ })), Ln = Bn.merge(
708
+ M
709
+ ), ne = m(C["Conversation/Sequential Workflow Step"])(l.object({
710
+ description: l.string().optional(),
711
+ name: l.string().optional()
712
+ })), ct = m(C["Conversation/Sequential Workflow"])(ot.extend({
713
+ description: l.string().optional(),
714
+ name: l.string().optional(),
715
+ steps: l.array(ne).optional()
716
+ })), qi = v(), _n = ct.merge(st).extend({
717
+ steps: l.array(v()).optional()
718
+ }), Fn = m(C["Conversation/Sequential Workflow Operation"])(ct.extend({
719
+ description: l.string().optional(),
720
+ name: l.string().optional(),
721
+ operation: l.string().optional()
722
+ })), Un = Fn.merge(
723
+ st
663
724
  ).extend({
664
- steps: b.array(V()).optional()
725
+ steps: l.array(v()).optional()
665
726
  });
666
- function bn(i) {
727
+ function zn(i) {
667
728
  if (!Array.isArray(i.blueIds) || i.blueIds.length === 0)
668
729
  throw new Error("Contract processors must declare at least one BlueId");
669
730
  for (const e of i.blueIds)
670
731
  if (typeof e != "string" || e.trim().length === 0)
671
732
  throw new Error("Contract processor BlueIds must be non-empty strings");
672
733
  }
673
- function K(i, e) {
674
- bn(i);
734
+ function q(i, e) {
735
+ zn(i);
675
736
  for (const t of i.blueIds)
676
737
  e.set(t, i);
677
738
  }
678
- class Cn {
739
+ class $n {
679
740
  processorsByBlueId = /* @__PURE__ */ new Map();
680
741
  handlerProcessors = /* @__PURE__ */ new Map();
681
742
  channelProcessors = /* @__PURE__ */ new Map();
682
743
  markerProcessors = /* @__PURE__ */ new Map();
683
744
  registerHandler(e) {
684
- K(e, this.handlerProcessors), this.registerProcessorMap(e);
745
+ q(e, this.handlerProcessors), this.registerProcessorMap(e);
685
746
  }
686
747
  registerChannel(e) {
687
- K(e, this.channelProcessors), this.registerProcessorMap(e);
748
+ q(e, this.channelProcessors), this.registerProcessorMap(e);
688
749
  }
689
750
  registerMarker(e) {
690
- K(e, this.markerProcessors), this.registerProcessorMap(e);
751
+ q(e, this.markerProcessors), this.registerProcessorMap(e);
691
752
  }
692
753
  register(e) {
693
754
  switch (e.kind) {
@@ -721,67 +782,96 @@ class Cn {
721
782
  return new Map(this.processorsByBlueId);
722
783
  }
723
784
  registerProcessorMap(e) {
724
- K(e, this.processorsByBlueId);
725
- }
726
- }
727
- function Ce(i, e) {
728
- return e && i.isTypeOf(e, v, { checkSchemaExtensions: !0 }) ? i.nodeToSchemaOutput(e, v) : null;
729
- }
730
- function Ye(i, e, t) {
731
- const n = Ce(i, e), r = Ce(i, t);
785
+ q(e, this.processorsByBlueId);
786
+ }
787
+ }
788
+ const Vn = m(C["Conversation/Actor"])(l.object({
789
+ description: l.string().optional(),
790
+ name: l.string().optional()
791
+ })), lt = m(C["Conversation/Timeline"])(l.object({
792
+ description: l.string().optional(),
793
+ name: l.string().optional(),
794
+ timelineId: l.string().optional()
795
+ })), R = m(C["Conversation/Timeline Entry"])(l.object({
796
+ actor: Vn.optional(),
797
+ description: l.string().optional(),
798
+ message: v().optional(),
799
+ name: l.string().optional(),
800
+ prevEntry: v().optional(),
801
+ timeline: lt.optional(),
802
+ timestamp: l.number().optional()
803
+ })), Hn = m(k["MyOS/MyOS Timeline"])(lt.extend({
804
+ accountId: l.string().optional(),
805
+ description: l.string().optional(),
806
+ name: l.string().optional()
807
+ })), Re = m(k["MyOS/MyOS Timeline Entry"])(R.extend({
808
+ description: l.string().optional(),
809
+ name: l.string().optional(),
810
+ timeline: Hn.optional()
811
+ }));
812
+ function Me(i, e) {
813
+ return e && i.isTypeOf(e, R, { checkSchemaExtensions: !0 }) ? i.nodeToSchemaOutput(e, R) : null;
814
+ }
815
+ function ut(i, e, t) {
816
+ const n = Me(i, e), r = Me(i, t);
732
817
  if (!n || !r)
733
818
  return !0;
734
- const s = n.timestamp, o = r.timestamp;
735
- return typeof s != "number" || typeof o != "number" ? !0 : s >= o;
819
+ const o = n.timestamp, s = r.timestamp;
820
+ return typeof o != "number" || typeof s != "number" ? !0 : o >= s;
736
821
  }
737
- function Ie(i, e) {
738
- return i.isTypeOf(e, Ee) ? i.nodeToSchemaOutput(e, Ee) : i.isTypeOf(e, v) ? i.nodeToSchemaOutput(e, v) : null;
822
+ function Pe(i, e) {
823
+ return i.isTypeOf(e, Re) ? i.nodeToSchemaOutput(e, Re) : i.isTypeOf(e, R) ? i.nodeToSchemaOutput(e, R) : null;
739
824
  }
740
- class In {
825
+ class Wn {
741
826
  kind = "channel";
742
- blueIds = [D["MyOS Timeline Channel"]];
743
- schema = cn;
827
+ blueIds = [k["MyOS/MyOS Timeline Channel"]];
828
+ schema = fn;
744
829
  matches(e, t) {
745
830
  const { event: n, blue: r } = t;
746
831
  if (!n)
747
832
  return !1;
748
- const s = Ie(r, n);
749
- if (!s)
833
+ const o = Pe(r, n);
834
+ if (!o)
750
835
  return !1;
751
- const o = s.timeline?.timelineId;
752
- return !o || !e.timelineId ? !1 : o === e.timelineId;
836
+ const s = o.timeline?.timelineId;
837
+ return !s || !e.timelineId ? !1 : s === e.timelineId;
753
838
  }
754
839
  channelize(e, t) {
755
840
  const { event: n, blue: r } = t;
756
- return !n || !Ie(r, n) ? null : n.clone();
841
+ return !n || !Pe(r, n) ? null : n.clone();
757
842
  }
758
843
  isNewerEvent(e, t, n) {
759
- const { event: r, blue: s } = t;
760
- return r ? Ye(s, r, n) : !0;
844
+ const { event: r, blue: o } = t;
845
+ return r ? ut(o, r, n) : !0;
761
846
  }
762
847
  }
763
- class vn {
848
+ class Gn {
764
849
  kind = "channel";
765
- blueIds = [R["Timeline Channel"]];
766
- schema = an;
850
+ blueIds = [C["Conversation/Timeline Channel"]];
851
+ schema = pn;
767
852
  matches(e, t) {
768
853
  const { event: n, blue: r } = t;
769
- if (!n || !r.isTypeOf(n, v))
854
+ if (!n || !r.isTypeOf(n, R))
770
855
  return !1;
771
- const o = r.nodeToSchemaOutput(n, v).timeline?.timelineId;
772
- return !(!o || !e.timelineId || o !== e.timelineId);
856
+ const s = r.nodeToSchemaOutput(n, R).timeline?.timelineId;
857
+ return !(!s || !e.timelineId || s !== e.timelineId);
773
858
  }
774
859
  channelize(e, t) {
775
860
  const { event: n, blue: r } = t;
776
- return !n || !r.isTypeOf(n, v) ? null : n.clone();
861
+ return !n || !r.isTypeOf(n, R) ? null : n.clone();
777
862
  }
778
863
  isNewerEvent(e, t, n) {
779
- const { event: r, blue: s } = t;
780
- return r ? Ye(s, r, n) : !0;
864
+ const { event: r, blue: o } = t;
865
+ return r ? ut(o, r, n) : !0;
781
866
  }
782
867
  }
783
- function ue(i) {
784
- const { context: e, eventNode: t, stepResults: n } = i, r = Tn(e);
868
+ const Oe = m(C["Conversation/Trigger Event"])(ne.extend({
869
+ description: l.string().optional(),
870
+ event: v().optional(),
871
+ name: l.string().optional()
872
+ }));
873
+ function ye(i) {
874
+ const { context: e, eventNode: t, stepResults: n } = i, r = qn(e);
785
875
  return {
786
876
  event: e.blue.nodeToJson(t, "simple"),
787
877
  eventCanonical: e.blue.nodeToJson(t, "official"),
@@ -789,85 +879,99 @@ function ue(i) {
789
879
  document: r
790
880
  };
791
881
  }
792
- const kn = /* @__PURE__ */ new Set(["blueId", "name", "description", "value"]);
793
- function Tn(i) {
794
- const e = (s) => {
795
- if (s === "/")
882
+ const Kn = /* @__PURE__ */ new Set(["blueId", "name", "description", "value"]);
883
+ function qn(i) {
884
+ const e = (o) => {
885
+ if (o === "/")
796
886
  return !1;
797
- const o = s.lastIndexOf("/"), a = s.substring(o + 1);
798
- return kn.has(a);
799
- }, t = (s) => {
800
- const o = s == null ? "/" : typeof s == "string" ? s : (() => {
887
+ const s = o.lastIndexOf("/"), a = o.substring(s + 1);
888
+ return Kn.has(a);
889
+ }, t = (o) => {
890
+ const s = o == null ? "/" : typeof o == "string" ? o : (() => {
801
891
  throw new TypeError("document() expects a string pointer");
802
- })(), a = o.startsWith("/") ? o : i.resolvePointer(o), c = S(a), l = i.documentAt(c);
803
- return i.gasMeter().chargeDocumentSnapshot(c, l), { snapshot: l, normalizedPointer: c };
804
- }, n = (s, o) => {
805
- const { snapshot: a, normalizedPointer: c } = t(s);
892
+ })(), a = s.startsWith("/") ? s : i.resolvePointer(s), c = T(a), u = i.documentAt(c);
893
+ return i.gasMeter().chargeDocumentSnapshot(c, u), { snapshot: u, normalizedPointer: c };
894
+ }, n = (o, s) => {
895
+ const { snapshot: a, normalizedPointer: c } = t(o);
806
896
  if (a)
807
- return e(c) ? i.blue.nodeToJson(a, "simple") : i.blue.nodeToJson(a, o);
808
- }, r = (s) => n(s, "simple");
809
- return r.canonical = (s) => n(s, "official"), r;
897
+ return e(c) ? i.blue.nodeToJson(a, "simple") : i.blue.nodeToJson(a, s);
898
+ }, r = ((o) => n(o, "simple"));
899
+ return r.canonical = (o) => n(o, "official"), r;
810
900
  }
811
- class Rn {
812
- supportedBlueIds = [R["Trigger Event"]];
813
- evaluator = new ce();
901
+ class Jn {
902
+ supportedBlueIds = [
903
+ C["Conversation/Trigger Event"]
904
+ ];
905
+ evaluator = new ge();
814
906
  async execute(e) {
815
907
  const { stepNode: t, context: n } = e;
816
- if (!n.blue.isTypeOf(t, pe))
908
+ if (!n.blue.isTypeOf(t, Oe))
817
909
  return n.throwFatal("Trigger Event step payload is invalid");
818
910
  n.gasMeter().chargeTriggerEventBase();
819
- const r = await q({
911
+ const r = await X({
820
912
  evaluator: this.evaluator,
821
913
  node: t,
822
- bindings: ue(e),
823
- shouldResolve: je({
914
+ bindings: ye(e),
915
+ shouldResolve: it({
824
916
  include: ["/event", "/event/**"]
825
917
  }),
826
- shouldDescend: Pn(),
918
+ shouldDescend: jn(),
827
919
  context: n
828
- }), o = n.blue.nodeToSchemaOutput(
920
+ }), s = n.blue.nodeToSchemaOutput(
829
921
  r,
830
- pe
922
+ Oe
831
923
  ).event;
832
- if (re(o))
924
+ if (le(s))
833
925
  return n.throwFatal(
834
926
  "Trigger Event step must declare event payload"
835
927
  );
836
- n.emitEvent(o.clone());
928
+ n.emitEvent(s.clone());
837
929
  }
838
930
  }
839
- function Pn() {
840
- return (i, e) => i === "/event" || !i.startsWith("/event/") ? !0 : !Nn(e);
931
+ function jn() {
932
+ return (i, e) => i === "/event" || !i.startsWith("/event/") ? !0 : !Qn(e);
841
933
  }
842
- function Nn(i) {
934
+ function Qn(i) {
843
935
  const e = i.getProperties?.();
844
936
  return e ? !!e.contracts : !1;
845
937
  }
846
- class Mn {
847
- supportedBlueIds = [R["JavaScript Code"]];
848
- evaluator = new ce();
938
+ const Ne = m(C["Conversation/JavaScript Code"])(ne.extend({
939
+ code: l.string().optional(),
940
+ description: l.string().optional(),
941
+ name: l.string().optional()
942
+ }));
943
+ class Xn {
944
+ supportedBlueIds = [
945
+ C["Conversation/JavaScript Code"]
946
+ ];
947
+ evaluator = new ge();
948
+ wasmGasLimit;
949
+ constructor(e = {}) {
950
+ this.wasmGasLimit = e.wasmGasLimit ?? et;
951
+ }
849
952
  async execute(e) {
850
953
  const { context: t, stepNode: n } = e, { blue: r } = t;
851
- if (!r.isTypeOf(n, me))
954
+ if (!r.isTypeOf(n, Ne))
852
955
  return t.throwFatal("JavaScript Code step payload is invalid");
853
- const o = r.nodeToSchemaOutput(
956
+ const s = r.nodeToSchemaOutput(
854
957
  n,
855
- me
958
+ Ne
856
959
  ).code;
857
- if (!o)
960
+ if (!s)
858
961
  return t.throwFatal(
859
962
  "JavaScript Code step must include code to execute"
860
963
  );
861
- t.gasMeter().chargeJavaScriptCodeBase(o);
862
- const a = ue(e);
964
+ const a = ye(e);
863
965
  try {
864
966
  const c = await this.evaluator.evaluate({
865
- code: o,
866
- bindings: a
967
+ code: s,
968
+ bindings: a,
969
+ wasmGasLimit: this.wasmGasLimit,
970
+ onWasmGasUsed: ({ used: u }) => t.gasMeter().chargeWasmGas(u)
867
971
  });
868
972
  return this.handleEvents(c, t), c;
869
973
  } catch (c) {
870
- throw new We(o, c);
974
+ throw new tt(s, c);
871
975
  }
872
976
  }
873
977
  handleEvents(e, t) {
@@ -876,29 +980,42 @@ class Mn {
876
980
  const n = e;
877
981
  if (Array.isArray(n.events))
878
982
  for (const r of n.events) {
879
- const s = t.blue.jsonValueToNode(r);
880
- t.emitEvent(s);
983
+ const o = t.blue.jsonValueToNode(r);
984
+ t.emitEvent(o);
881
985
  }
882
986
  }
883
987
  }
884
- class On {
885
- supportedBlueIds = [R["Update Document"]];
886
- evaluator = new ce();
988
+ const Yn = m(p["Core/Json Patch Entry"])(l.object({
989
+ description: l.string().optional(),
990
+ name: l.string().optional(),
991
+ op: l.string().optional(),
992
+ path: l.string().optional(),
993
+ val: v().optional()
994
+ })), Ae = m(C["Conversation/Update Document"])(ne.extend({
995
+ changeset: l.array(Yn).optional(),
996
+ description: l.string().optional(),
997
+ name: l.string().optional()
998
+ }));
999
+ class Zn {
1000
+ supportedBlueIds = [
1001
+ C["Conversation/Update Document"]
1002
+ ];
1003
+ evaluator = new ge();
887
1004
  async execute(e) {
888
1005
  const { context: t, stepNode: n } = e, { blue: r } = t;
889
- if (!r.isTypeOf(n, ge))
1006
+ if (!r.isTypeOf(n, Ae))
890
1007
  return t.throwFatal("Update Document step payload is invalid");
891
- const s = await q({
1008
+ const o = await X({
892
1009
  evaluator: this.evaluator,
893
1010
  node: n,
894
- bindings: ue(e),
895
- shouldResolve: je({
1011
+ bindings: ye(e),
1012
+ shouldResolve: it({
896
1013
  include: ["/changeset", "/changeset/**"]
897
1014
  }),
898
1015
  context: t
899
- }), o = this.extractChanges(s, t);
900
- t.gasMeter().chargeUpdateDocumentBase(o.length);
901
- for (const a of o) {
1016
+ }), s = this.extractChanges(o, t);
1017
+ t.gasMeter().chargeUpdateDocumentBase(s.length);
1018
+ for (const a of s) {
902
1019
  const c = this.createPatch(a, t);
903
1020
  await t.applyPatch(c);
904
1021
  }
@@ -906,12 +1023,12 @@ class On {
906
1023
  extractChanges(e, t) {
907
1024
  return t.blue.nodeToSchemaOutput(
908
1025
  e,
909
- ge
1026
+ Ae
910
1027
  ).changeset ?? [];
911
1028
  }
912
1029
  createPatch(e, t) {
913
- const n = this.normalizeOperation(e.op, t), r = this.normalizePath(e.path, t), s = t.resolvePointer(r);
914
- return n === "REMOVE" ? { op: n, path: s } : { op: n, path: s, val: e.val };
1030
+ const n = this.normalizeOperation(e.op, t), r = this.normalizePath(e.path, t), o = t.resolvePointer(r);
1031
+ return n === "REMOVE" ? { op: n, path: o } : { op: n, path: o, val: e.val };
915
1032
  }
916
1033
  normalizeOperation(e, t) {
917
1034
  const n = typeof e == "string" ? e : void 0, r = (n ?? "REPLACE").toUpperCase();
@@ -926,14 +1043,14 @@ class On {
926
1043
  return n.length === 0 ? t.throwFatal("Update Document path cannot be empty") : n;
927
1044
  }
928
1045
  }
929
- const de = [
930
- new Rn(),
931
- new Mn(),
932
- new On()
1046
+ const Se = [
1047
+ new Jn(),
1048
+ new Xn(),
1049
+ new Zn()
933
1050
  ];
934
- class Ze {
1051
+ class dt {
935
1052
  executorIndex;
936
- constructor(e = de) {
1053
+ constructor(e = Se) {
937
1054
  const t = /* @__PURE__ */ new Map();
938
1055
  for (const n of e)
939
1056
  for (const r of n.supportedBlueIds)
@@ -941,21 +1058,21 @@ class Ze {
941
1058
  this.executorIndex = t;
942
1059
  }
943
1060
  async run(e) {
944
- const { workflow: t, eventNode: n, context: r } = e, s = t.steps ?? [];
945
- if (s.length === 0)
1061
+ const { workflow: t, eventNode: n, context: r } = e, o = t.steps ?? [];
1062
+ if (o.length === 0)
946
1063
  return {};
947
- const o = {};
948
- for (const [a, c] of s.entries()) {
949
- const l = c.getType?.()?.getBlueId();
950
- if (re(l))
1064
+ const s = {};
1065
+ for (const [a, c] of o.entries()) {
1066
+ const u = c.getType?.()?.getBlueId();
1067
+ if (le(u))
951
1068
  return r.throwFatal(
952
1069
  "Sequential workflow step is missing type metadata"
953
1070
  );
954
- const u = this.executorIndex.get(l);
955
- if (re(u)) {
956
- const p = c.getType?.()?.getName?.() ?? l;
1071
+ const d = this.executorIndex.get(u);
1072
+ if (le(d)) {
1073
+ const w = c.getType?.()?.getName?.() ?? u;
957
1074
  return r.throwFatal(
958
- `Unsupported workflow step type "${p}"`
1075
+ `Unsupported workflow step type "${w}"`
959
1076
  );
960
1077
  }
961
1078
  const f = {
@@ -963,28 +1080,30 @@ class Ze {
963
1080
  stepNode: c,
964
1081
  eventNode: n,
965
1082
  context: r,
966
- stepResults: o,
1083
+ stepResults: s,
967
1084
  stepIndex: a
968
- }, h = await u.execute(f);
969
- if (h !== void 0) {
970
- const p = this.stepResultKey(c, a);
971
- o[p] = h;
1085
+ }, y = await d.execute(f);
1086
+ if (y !== void 0) {
1087
+ const w = this.stepResultKey(c, a);
1088
+ s[w] = y;
972
1089
  }
973
1090
  }
974
- return o;
1091
+ return s;
975
1092
  }
976
1093
  stepResultKey(e, t) {
977
1094
  const n = e.getName?.();
978
1095
  return n && typeof n == "string" && n.length > 0 ? n : `Step${t + 1}`;
979
1096
  }
980
1097
  }
981
- class An {
1098
+ class er {
982
1099
  kind = "handler";
983
- blueIds = [R["Sequential Workflow"]];
984
- schema = wn;
1100
+ blueIds = [
1101
+ C["Conversation/Sequential Workflow"]
1102
+ ];
1103
+ schema = _n;
985
1104
  runner;
986
- constructor(e = de) {
987
- this.runner = new Ze(e);
1105
+ constructor(e = Se) {
1106
+ this.runner = new dt(e);
988
1107
  }
989
1108
  async matches(e, t) {
990
1109
  const n = t.event();
@@ -995,12 +1114,20 @@ class An {
995
1114
  n && await this.runner.run({ workflow: e, eventNode: n, context: t });
996
1115
  }
997
1116
  }
998
- class Dn {
1117
+ class tr {
999
1118
  kind = "marker";
1000
- blueIds = [R.Operation];
1001
- schema = fn;
1002
- }
1003
- function Xe(i) {
1119
+ blueIds = [C["Conversation/Operation"]];
1120
+ schema = bn;
1121
+ }
1122
+ const he = m(C["Conversation/Operation Request"])(l.object({
1123
+ allowNewerVersion: l.boolean().optional(),
1124
+ description: l.string().optional(),
1125
+ document: v().optional(),
1126
+ name: l.string().optional(),
1127
+ operation: l.string().optional(),
1128
+ request: v().optional()
1129
+ }));
1130
+ function ht(i) {
1004
1131
  const e = i.channel;
1005
1132
  if (typeof e == "string") {
1006
1133
  const t = e.trim();
@@ -1009,49 +1136,49 @@ function Xe(i) {
1009
1136
  }
1010
1137
  return null;
1011
1138
  }
1012
- function Bn(i, e) {
1139
+ function nr(i, e) {
1013
1140
  const t = i.getProperties()?.document;
1014
- return t instanceof d ? e.blue.calculateBlueIdSync(t) : null;
1141
+ return t instanceof h ? e.blue.calculateBlueIdSync(t) : null;
1015
1142
  }
1016
- function _n(i, e) {
1017
- if (e.isTypeOf(i, ne, {
1143
+ function rr(i, e) {
1144
+ if (e.isTypeOf(i, he, {
1018
1145
  checkSchemaExtensions: !0
1019
1146
  }))
1020
1147
  return i;
1021
- if (e.isTypeOf(i, v, {
1148
+ if (e.isTypeOf(i, R, {
1022
1149
  checkSchemaExtensions: !0
1023
1150
  })) {
1024
- const n = e.nodeToSchemaOutput(i, v).message;
1025
- if (n && e.isTypeOf(n, ne, {
1151
+ const n = e.nodeToSchemaOutput(i, R).message;
1152
+ if (n && e.isTypeOf(n, he, {
1026
1153
  checkSchemaExtensions: !0
1027
1154
  }))
1028
1155
  return n;
1029
1156
  }
1030
1157
  return null;
1031
1158
  }
1032
- function Ln(i, e, t, n) {
1033
- const { blue: r } = n, s = i.operation;
1034
- return !(!s || t.operation !== s || i.event && !r.isTypeOfNode(e, i.event));
1159
+ function ir(i, e, t, n) {
1160
+ const { blue: r } = n, o = i.operation;
1161
+ return !(!o || t.operation !== o || i.event && !r.isTypeOfNode(e, i.event));
1035
1162
  }
1036
- function $n(i, e) {
1163
+ function or(i, e) {
1037
1164
  const t = i.operation;
1038
1165
  if (!t)
1039
1166
  return null;
1040
1167
  const n = e.resolvePointer(`/contracts/${t}`), r = e.documentAt(n);
1041
- if (!r || !e.blue.isTypeOf(r, z))
1168
+ if (!r || !e.blue.isTypeOf(r, G))
1042
1169
  return null;
1043
- const s = e.blue.nodeToSchemaOutput(
1170
+ const o = e.blue.nodeToSchemaOutput(
1044
1171
  r,
1045
- z
1046
- ), o = Xe(s);
1047
- return { operationNode: r, operation: s, channelKey: o };
1172
+ G
1173
+ ), s = ht(o);
1174
+ return { operationNode: r, operation: o, channelKey: s };
1048
1175
  }
1049
- function xn(i, e) {
1176
+ function sr(i, e) {
1050
1177
  return !(i && e && i !== e);
1051
1178
  }
1052
- function Fn(i, e, t) {
1179
+ function ar(i, e, t) {
1053
1180
  const n = i.getProperties()?.request, r = e.getProperties()?.request;
1054
- if (!(n instanceof d) || !(r instanceof d))
1181
+ if (!(n instanceof h) || !(r instanceof h))
1055
1182
  return !1;
1056
1183
  try {
1057
1184
  if (!t.isTypeOfNode(n, r))
@@ -1061,65 +1188,65 @@ function Fn(i, e, t) {
1061
1188
  }
1062
1189
  return !0;
1063
1190
  }
1064
- function zn(i, e, t) {
1191
+ function cr(i, e, t) {
1065
1192
  if (!i || i.allowNewerVersion !== !1)
1066
1193
  return !0;
1067
- const n = Bn(e, t);
1194
+ const n = nr(e, t);
1068
1195
  if (!n)
1069
1196
  return !0;
1070
- const r = t.resolvePointer("/"), s = t.documentAt(r);
1071
- if (!s)
1197
+ const r = t.resolvePointer("/"), o = t.documentAt(r);
1198
+ if (!o)
1072
1199
  return !1;
1073
- const c = (s.getContracts()?.initialized ?? null)?.get("/documentId") ?? null, l = typeof c == "string" && c.length > 0 ? c : t.blue.calculateBlueIdSync(s);
1074
- return n === l;
1200
+ const c = (o.getContracts()?.initialized ?? null)?.get("/documentId") ?? null, u = typeof c == "string" && c.length > 0 ? c : t.blue.calculateBlueIdSync(o);
1201
+ return n === u;
1075
1202
  }
1076
- class Un {
1203
+ class lr {
1077
1204
  kind = "handler";
1078
1205
  blueIds = [
1079
- R["Sequential Workflow Operation"]
1206
+ C["Conversation/Sequential Workflow Operation"]
1080
1207
  ];
1081
- schema = Sn;
1208
+ schema = Un;
1082
1209
  runner;
1083
- constructor(e = de) {
1084
- this.runner = new Ze(e);
1210
+ constructor(e = Se) {
1211
+ this.runner = new dt(e);
1085
1212
  }
1086
1213
  deriveChannel(e, t) {
1087
1214
  const n = e.operation;
1088
1215
  if (!n)
1089
1216
  return null;
1090
1217
  const r = t.scopeContracts.get(n);
1091
- if (!r || !t.blue.isTypeOf(r.node, z, {
1218
+ if (!r || !t.blue.isTypeOf(r.node, G, {
1092
1219
  checkSchemaExtensions: !0
1093
1220
  }))
1094
1221
  return null;
1095
- const s = t.blue.nodeToSchemaOutput(r.node, z);
1096
- return s ? Xe(s) : null;
1222
+ const o = t.blue.nodeToSchemaOutput(r.node, G);
1223
+ return o ? ht(o) : null;
1097
1224
  }
1098
1225
  async matches(e, t) {
1099
1226
  const n = t.event();
1100
1227
  if (!n)
1101
1228
  return !1;
1102
- const r = _n(
1229
+ const r = rr(
1103
1230
  n,
1104
1231
  t.blue
1105
1232
  );
1106
1233
  if (!r)
1107
1234
  return !1;
1108
- const s = t.blue.nodeToSchemaOutput(
1235
+ const o = t.blue.nodeToSchemaOutput(
1109
1236
  r,
1110
- ne
1237
+ he
1111
1238
  );
1112
- if (!s || !Ln(e, n, s, t))
1239
+ if (!o || !ir(e, n, o, t))
1113
1240
  return !1;
1114
- const o = $n(e, t);
1115
- if (!o)
1241
+ const s = or(e, t);
1242
+ if (!s)
1116
1243
  return !1;
1117
1244
  const a = typeof e.channel == "string" ? e.channel.trim() : "", c = a.length > 0 ? a : null;
1118
- return !(!xn(o.channelKey, c) || !Fn(
1245
+ return !(!sr(s.channelKey, c) || !ar(
1119
1246
  r,
1120
- o.operationNode,
1247
+ s.operationNode,
1121
1248
  t.blue
1122
- ) || s?.allowNewerVersion === !1 && !zn(s, r, t));
1249
+ ) || o?.allowNewerVersion === !1 && !cr(o, r, t));
1123
1250
  }
1124
1251
  async execute(e, t) {
1125
1252
  const n = t.event();
@@ -1130,17 +1257,17 @@ class Un {
1130
1257
  });
1131
1258
  }
1132
1259
  }
1133
- class Y {
1260
+ class re {
1134
1261
  constructor(e) {
1135
1262
  this.registry = e;
1136
1263
  }
1137
1264
  static create() {
1138
- return new Y(
1139
- new Cn()
1265
+ return new re(
1266
+ new $n()
1140
1267
  );
1141
1268
  }
1142
1269
  registerDefaults() {
1143
- return this.registry.register(new In()), this.registry.register(new vn()), this.registry.register(new An()), this.registry.register(new Dn()), this.registry.register(new Un()), this;
1270
+ return this.registry.register(new Wn()), this.registry.register(new Gn()), this.registry.register(new er()), this.registry.register(new tr()), this.registry.register(new lr()), this;
1144
1271
  }
1145
1272
  register(e) {
1146
1273
  return this.registry.register(e), this;
@@ -1149,11 +1276,11 @@ class Y {
1149
1276
  return this.registry;
1150
1277
  }
1151
1278
  }
1152
- const se = m["Channel Event Checkpoint"];
1153
- function et(i) {
1279
+ const pe = p["Core/Channel Event Checkpoint"];
1280
+ function pt(i) {
1154
1281
  return typeof i.order == "number" ? i.order : 0;
1155
1282
  }
1156
- class Vn {
1283
+ class ur {
1157
1284
  constructor(e, t, n) {
1158
1285
  this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n;
1159
1286
  }
@@ -1167,10 +1294,10 @@ class Vn {
1167
1294
  return this.bindingBlueId;
1168
1295
  }
1169
1296
  order() {
1170
- return et(this.bindingContract);
1297
+ return pt(this.bindingContract);
1171
1298
  }
1172
1299
  }
1173
- class Hn {
1300
+ class dr {
1174
1301
  constructor(e, t, n) {
1175
1302
  this.bindingKey = e, this.bindingContract = t, this.bindingBlueId = n;
1176
1303
  }
@@ -1184,28 +1311,28 @@ class Hn {
1184
1311
  return this.bindingBlueId;
1185
1312
  }
1186
1313
  order() {
1187
- return et(this.bindingContract);
1314
+ return pt(this.bindingContract);
1188
1315
  }
1189
1316
  }
1190
- class A {
1191
- constructor(e, t, n, r, s) {
1192
- this.channels = e, this.handlersByChannel = t, this.markerStore = n, this.embeddedPathsInternal = r, this.checkpointDeclared = s;
1317
+ class _ {
1318
+ constructor(e, t, n, r, o) {
1319
+ this.channels = e, this.handlersByChannel = t, this.markerStore = n, this.embeddedPathsInternal = r, this.checkpointDeclared = o;
1193
1320
  }
1194
1321
  checkpointDeclared;
1195
- static fromComponents(e, t, n, r, s) {
1196
- return new A(
1322
+ static fromComponents(e, t, n, r, o) {
1323
+ return new _(
1197
1324
  e,
1198
1325
  t,
1199
1326
  n,
1200
1327
  r,
1201
- s
1328
+ o
1202
1329
  );
1203
1330
  }
1204
1331
  static builder() {
1205
- return new Kn();
1332
+ return new hr();
1206
1333
  }
1207
1334
  static empty() {
1208
- return A.builder().build();
1335
+ return _.builder().build();
1209
1336
  }
1210
1337
  markers() {
1211
1338
  return new Map(
@@ -1235,32 +1362,32 @@ class A {
1235
1362
  throw new Error(
1236
1363
  "Duplicate Channel Event Checkpoint markers detected in same contracts map"
1237
1364
  );
1238
- this.markerStore.set(T, {
1239
- key: T,
1365
+ this.markerStore.set(A, {
1366
+ key: A,
1240
1367
  contract: e,
1241
- blueId: se
1368
+ blueId: pe
1242
1369
  }), this.checkpointDeclared = !0;
1243
1370
  }
1244
1371
  handlersFor(e) {
1245
1372
  const t = this.handlersByChannel.get(e);
1246
1373
  return !t || t.length === 0 ? [] : [...t].map(
1247
- (n) => new Hn(n.key, n.contract, n.blueId)
1374
+ (n) => new dr(n.key, n.contract, n.blueId)
1248
1375
  ).sort((n, r) => {
1249
- const s = n.order() - r.order();
1250
- return s !== 0 ? s : n.key().localeCompare(r.key());
1376
+ const o = n.order() - r.order();
1377
+ return o !== 0 ? o : n.key().localeCompare(r.key());
1251
1378
  });
1252
1379
  }
1253
1380
  channelsOfType(...e) {
1254
1381
  const t = e.length > 0 ? new Set(e) : null, n = Array.from(this.channels.values()).filter((r) => !t || t.has(r.blueId)).map(
1255
- (r) => new Vn(r.key, r.contract, r.blueId)
1382
+ (r) => new ur(r.key, r.contract, r.blueId)
1256
1383
  );
1257
- return n.sort((r, s) => {
1258
- const o = r.order() - s.order();
1259
- return o !== 0 ? o : r.key().localeCompare(s.key());
1384
+ return n.sort((r, o) => {
1385
+ const s = r.order() - o.order();
1386
+ return s !== 0 ? s : r.key().localeCompare(o.key());
1260
1387
  }), n;
1261
1388
  }
1262
1389
  }
1263
- class Kn {
1390
+ class hr {
1264
1391
  channels = /* @__PURE__ */ new Map();
1265
1392
  handlersByChannel = /* @__PURE__ */ new Map();
1266
1393
  markerStore = /* @__PURE__ */ new Map();
@@ -1274,8 +1401,8 @@ class Kn {
1274
1401
  const r = t.channel;
1275
1402
  if (!r)
1276
1403
  throw new Error(`Handler ${e} must declare channel`);
1277
- const s = this.handlersByChannel.get(r) ?? [];
1278
- return s.push({ key: e, contract: t, blueId: n }), this.handlersByChannel.set(r, s), this;
1404
+ const o = this.handlersByChannel.get(r) ?? [];
1405
+ return o.push({ key: e, contract: t, blueId: n }), this.handlersByChannel.set(r, o), this;
1279
1406
  }
1280
1407
  setEmbedded(e) {
1281
1408
  if (this.embeddedDeclared)
@@ -1285,12 +1412,12 @@ class Kn {
1285
1412
  return this.embeddedDeclared = !0, this.embeddedPaths = e.paths ? [...e.paths] : [], this;
1286
1413
  }
1287
1414
  addMarker(e, t, n) {
1288
- if (e === T && n !== se)
1415
+ if (e === A && n !== pe)
1289
1416
  throw new Error(
1290
1417
  "Reserved key 'checkpoint' must contain a Channel Event Checkpoint"
1291
1418
  );
1292
- if (n === se) {
1293
- if (e !== T)
1419
+ if (n === pe) {
1420
+ if (e !== A)
1294
1421
  throw new Error(
1295
1422
  `Channel Event Checkpoint must use reserved key 'checkpoint' at key '${e}'`
1296
1423
  );
@@ -1303,7 +1430,7 @@ class Kn {
1303
1430
  return this.markerStore.set(e, { key: e, contract: t, blueId: n }), this;
1304
1431
  }
1305
1432
  build() {
1306
- return A.fromComponents(
1433
+ return _.fromComponents(
1307
1434
  new Map(this.channels),
1308
1435
  new Map(
1309
1436
  Array.from(this.handlersByChannel.entries(), ([e, t]) => [
@@ -1322,7 +1449,7 @@ class g extends Error {
1322
1449
  super(e || "Processor fatal error"), this.processorError = t, this.name = "ProcessorFatalError";
1323
1450
  }
1324
1451
  }
1325
- class Wn {
1452
+ class pr {
1326
1453
  constructor(e, t, n) {
1327
1454
  this.blue = e, this.registry = t, this.builtinChannelSchemas = n;
1328
1455
  }
@@ -1331,44 +1458,44 @@ class Wn {
1331
1458
  key: t,
1332
1459
  node: n,
1333
1460
  processor: r,
1334
- blueId: s,
1335
- scopeContracts: o
1461
+ blueId: o,
1462
+ scopeContracts: s
1336
1463
  }) {
1337
1464
  try {
1338
1465
  const a = r.schema, c = this.blue.nodeToSchemaOutput(
1339
1466
  n,
1340
1467
  a
1341
- ), l = this.resolveChannelKey({
1468
+ ), u = this.resolveChannelKey({
1342
1469
  contract: c,
1343
1470
  processor: r,
1344
- scopeContracts: o,
1471
+ scopeContracts: s,
1345
1472
  handlerKey: t
1346
- }), u = o.get(l);
1347
- if (!u)
1473
+ }), d = s.get(u);
1474
+ if (!d)
1348
1475
  throw new g(
1349
- `Handler ${t} references unknown channel '${l}'`,
1476
+ `Handler ${t} references unknown channel '${u}'`,
1350
1477
  E.invalidContract(
1351
- s,
1352
- `Channel '${l}' is not declared in this scope`,
1353
- `/contracts/${l}`
1478
+ o,
1479
+ `Channel '${u}' is not declared in this scope`,
1480
+ `/contracts/${u}`
1354
1481
  )
1355
1482
  );
1356
- if (!this.isRegisteredChannel(u.nodeTypeBlueId))
1483
+ if (!this.isRegisteredChannel(d.nodeTypeBlueId))
1357
1484
  throw new g(
1358
- `Contract '${l}' is not a channel`,
1485
+ `Contract '${u}' is not a channel`,
1359
1486
  E.invalidContract(
1360
- u.nodeTypeBlueId,
1361
- `Contract '${l}' is not a channel`,
1362
- `/contracts/${l}`
1487
+ d.nodeTypeBlueId,
1488
+ `Contract '${u}' is not a channel`,
1489
+ `/contracts/${u}`
1363
1490
  )
1364
1491
  );
1365
- e.addHandler(t, { ...c, channel: l }, s);
1492
+ e.addHandler(t, { ...c, channel: u }, o);
1366
1493
  } catch (a) {
1367
1494
  if (this.isZodError(a))
1368
1495
  throw new g(
1369
1496
  "Failed to parse handler contract",
1370
1497
  E.invalidContract(
1371
- s,
1498
+ o,
1372
1499
  "Failed to parse handler contract",
1373
1500
  t,
1374
1501
  a
@@ -1387,109 +1514,109 @@ class Wn {
1387
1514
  scopeContracts: n,
1388
1515
  handlerKey: r
1389
1516
  }) {
1390
- let s = typeof e.channel == "string" ? e.channel.trim() : null;
1391
- if (s && s.length === 0 && (s = null), !s) {
1392
- const o = t.deriveChannel?.call(t, e, {
1517
+ let o = typeof e.channel == "string" ? e.channel.trim() : null;
1518
+ if (o && o.length === 0 && (o = null), !o) {
1519
+ const s = t.deriveChannel?.call(t, e, {
1393
1520
  blue: this.blue,
1394
1521
  scopeContracts: n
1395
1522
  }) ?? null;
1396
- if (typeof o == "string") {
1397
- const a = o.trim();
1398
- a.length > 0 && (s = a);
1523
+ if (typeof s == "string") {
1524
+ const a = s.trim();
1525
+ a.length > 0 && (o = a);
1399
1526
  }
1400
1527
  }
1401
- if (!s)
1528
+ if (!o)
1402
1529
  throw new g(
1403
1530
  `Handler ${r} must declare channel (missing explicit channel and derivation failed)`,
1404
1531
  E.illegalState(
1405
1532
  `Handler ${r} must declare channel (missing explicit channel and derivation failed)`
1406
1533
  )
1407
1534
  );
1408
- return s;
1535
+ return o;
1409
1536
  }
1410
1537
  isRegisteredChannel(e) {
1411
1538
  return this.builtinChannelSchemas.has(e) ? !0 : this.registry.lookupChannel(e) != null;
1412
1539
  }
1413
1540
  isZodError(e) {
1414
- return e instanceof Me;
1541
+ return e instanceof Ue;
1415
1542
  }
1416
1543
  }
1417
- class U extends Error {
1544
+ class K extends Error {
1418
1545
  constructor(e) {
1419
1546
  super(e ?? "MustUnderstand failure"), this.name = "MustUnderstandFailure";
1420
1547
  }
1421
1548
  }
1422
- const Gn = m["Document Update Channel"], qn = m["Embedded Node Channel"], Jn = m["Lifecycle Event Channel"], jn = m["Triggered Event Channel"], ve = m["Process Embedded"], Qn = m["Processing Initialized Marker"], Yn = m["Processing Terminated Marker"], Zn = m["Channel Event Checkpoint"], Xn = D["Document Anchors"], er = D["Document Links"], tr = D["MyOS Participants Orchestration"], nr = D["MyOS Session Interaction"], rr = D["MyOS Worker Agency"], ke = /* @__PURE__ */ new Map([
1549
+ const mr = p["Core/Document Update Channel"], fr = p["Core/Embedded Node Channel"], gr = p["Core/Lifecycle Event Channel"], Er = p["Core/Triggered Event Channel"], De = p["Core/Process Embedded"], yr = p["Core/Processing Initialized Marker"], Sr = p["Core/Processing Terminated Marker"], Cr = p["Core/Channel Event Checkpoint"], wr = k["MyOS/Document Anchors"], vr = k["MyOS/Document Links"], kr = k["MyOS/MyOS Participants Orchestration"], br = k["MyOS/MyOS Session Interaction"], Ir = k["MyOS/MyOS Worker Agency"], xe = /* @__PURE__ */ new Map([
1423
1550
  [
1424
- Gn,
1425
- nn
1551
+ mr,
1552
+ sn
1426
1553
  ],
1427
1554
  [
1428
- qn,
1429
- rn
1555
+ fr,
1556
+ cn
1430
1557
  ],
1431
1558
  [
1432
- Jn,
1433
- sn
1559
+ gr,
1560
+ un
1434
1561
  ],
1435
1562
  [
1436
- jn,
1437
- on
1563
+ Er,
1564
+ hn
1438
1565
  ]
1439
- ]), ir = /* @__PURE__ */ new Map([
1566
+ ]), Tr = /* @__PURE__ */ new Map([
1440
1567
  [
1441
- Qn,
1442
- un
1568
+ yr,
1569
+ Sn
1443
1570
  ],
1444
1571
  [
1445
- Yn,
1446
- hn
1572
+ Sr,
1573
+ kn
1447
1574
  ],
1448
1575
  [
1449
- Zn,
1450
- ln
1576
+ Cr,
1577
+ En
1451
1578
  ],
1452
1579
  [
1453
- Xn,
1454
- pn
1580
+ wr,
1581
+ Rn
1455
1582
  ],
1456
1583
  [
1457
- er,
1458
- mn
1584
+ vr,
1585
+ On
1459
1586
  ],
1460
1587
  [
1461
- tr,
1462
- gn
1588
+ kr,
1589
+ An
1463
1590
  ],
1464
1591
  [
1465
- nr,
1466
- En
1592
+ br,
1593
+ xn
1467
1594
  ],
1468
1595
  [
1469
- rr,
1470
- yn
1596
+ Ir,
1597
+ Ln
1471
1598
  ]
1472
1599
  ]);
1473
- class sr {
1600
+ class Rr {
1474
1601
  constructor(e, t) {
1475
- this.registry = e, this.blue = t, this.handlerRegistration = new Wn(
1602
+ this.registry = e, this.blue = t, this.handlerRegistration = new pr(
1476
1603
  this.blue,
1477
1604
  this.registry,
1478
- ke
1605
+ xe
1479
1606
  );
1480
1607
  }
1481
1608
  handlerRegistration;
1482
1609
  load(e, t) {
1483
1610
  try {
1484
- const n = A.builder(), r = e.getContracts();
1611
+ const n = _.builder(), r = e.getContracts();
1485
1612
  if (!r)
1486
1613
  return n.build();
1487
- const s = this.buildScopeContractsIndex(r);
1488
- for (const [o, a] of Object.entries(r))
1489
- a && this.processContract(n, o, a, s);
1614
+ const o = this.buildScopeContractsIndex(r);
1615
+ for (const [s, a] of Object.entries(r))
1616
+ a && this.processContract(n, s, a, o);
1490
1617
  return n.build();
1491
1618
  } catch (n) {
1492
- if (n instanceof U || n instanceof g)
1619
+ if (n instanceof K || n instanceof g)
1493
1620
  throw n;
1494
1621
  const r = n?.message ?? "Failed to load contracts";
1495
1622
  throw new g(
@@ -1502,78 +1629,78 @@ class sr {
1502
1629
  }
1503
1630
  }
1504
1631
  processContract(e, t, n, r) {
1505
- const s = n.getType()?.getBlueId();
1506
- if (!s)
1632
+ const o = n.getType()?.getBlueId();
1633
+ if (!o)
1507
1634
  return;
1508
- if (s === ve) {
1635
+ if (o === De) {
1509
1636
  this.handleProcessEmbedded(e, t, n);
1510
1637
  return;
1511
1638
  }
1512
- const o = ir.get(s);
1513
- if (o) {
1514
- this.handleMarker(e, t, n, o, s);
1639
+ const s = Tr.get(o);
1640
+ if (s) {
1641
+ this.handleMarker(e, t, n, s, o);
1515
1642
  return;
1516
1643
  }
1517
- const a = ke.get(s);
1644
+ const a = xe.get(o);
1518
1645
  if (a) {
1519
- this.handleChannel(e, t, n, a, s);
1646
+ this.handleChannel(e, t, n, a, o);
1520
1647
  return;
1521
1648
  }
1522
- const c = this.registry.lookupChannel(s);
1649
+ const c = this.registry.lookupChannel(o);
1523
1650
  if (c) {
1524
1651
  this.handleChannel(
1525
1652
  e,
1526
1653
  t,
1527
1654
  n,
1528
1655
  c.schema,
1529
- s
1656
+ o
1530
1657
  );
1531
1658
  return;
1532
1659
  }
1533
- const l = this.registry.lookupHandler(s);
1534
- if (l) {
1660
+ const u = this.registry.lookupHandler(o);
1661
+ if (u) {
1535
1662
  this.handlerRegistration.register({
1536
1663
  builder: e,
1537
1664
  key: t,
1538
1665
  node: n,
1539
- processor: l,
1540
- blueId: s,
1666
+ processor: u,
1667
+ blueId: o,
1541
1668
  scopeContracts: r
1542
1669
  });
1543
1670
  return;
1544
1671
  }
1545
- const u = this.registry.lookupMarker(s);
1546
- if (u) {
1672
+ const d = this.registry.lookupMarker(o);
1673
+ if (d) {
1547
1674
  this.handleMarker(
1548
1675
  e,
1549
1676
  t,
1550
1677
  n,
1551
- u.schema,
1552
- s
1678
+ d.schema,
1679
+ o
1553
1680
  );
1554
1681
  return;
1555
1682
  }
1556
- throw ae(s) ? new g(
1683
+ throw fe(o) ? new g(
1557
1684
  "Built-in processor-managed channel is missing schema registration",
1558
1685
  E.invalidContract(
1559
- s,
1686
+ o,
1560
1687
  "Built-in processor-managed channel is missing schema registration",
1561
1688
  t
1562
1689
  )
1563
- ) : new U(`Unsupported contract type: ${s}`);
1690
+ ) : new K(`Unsupported contract type: ${o}`);
1564
1691
  }
1565
1692
  handleProcessEmbedded(e, t, n) {
1566
1693
  try {
1567
1694
  const r = this.convert(
1568
1695
  n,
1569
- dn
1696
+ wn
1570
1697
  );
1571
1698
  e.setEmbedded(r);
1572
1699
  } catch (r) {
1573
- throw ee(r) ? new g(
1700
+ throw ae(r) ? new g(
1574
1701
  "Failed to parse ProcessEmbedded marker",
1575
1702
  E.invalidContract(
1576
- ve,
1703
+ De,
1577
1704
  "Failed to parse ProcessEmbedded marker",
1578
1705
  t,
1579
1706
  r
@@ -1586,44 +1713,44 @@ class sr {
1586
1713
  );
1587
1714
  }
1588
1715
  }
1589
- handleChannel(e, t, n, r, s) {
1716
+ handleChannel(e, t, n, r, o) {
1590
1717
  try {
1591
- const o = this.convert(n, r);
1592
- e.addChannel(t, o, s);
1593
- } catch (o) {
1594
- if (ee(o))
1718
+ const s = this.convert(n, r);
1719
+ e.addChannel(t, s, o);
1720
+ } catch (s) {
1721
+ if (ae(s))
1595
1722
  throw new g(
1596
1723
  "Failed to parse channel contract",
1597
1724
  E.invalidContract(
1598
- s,
1725
+ o,
1599
1726
  "Failed to parse channel contract",
1600
1727
  t,
1601
- o
1728
+ s
1602
1729
  )
1603
1730
  );
1604
- const a = o?.message ?? "Failed to register channel contract";
1731
+ const a = s?.message ?? "Failed to register channel contract";
1605
1732
  throw new g(
1606
1733
  a,
1607
1734
  E.illegalState(a)
1608
1735
  );
1609
1736
  }
1610
1737
  }
1611
- handleMarker(e, t, n, r, s) {
1738
+ handleMarker(e, t, n, r, o) {
1612
1739
  try {
1613
- const o = this.convert(n, r);
1614
- e.addMarker(t, o, s);
1615
- } catch (o) {
1616
- if (ee(o))
1740
+ const s = this.convert(n, r);
1741
+ e.addMarker(t, s, o);
1742
+ } catch (s) {
1743
+ if (ae(s))
1617
1744
  throw new g(
1618
1745
  "Failed to parse marker contract",
1619
1746
  E.invalidContract(
1620
- s,
1747
+ o,
1621
1748
  "Failed to parse marker contract",
1622
1749
  t,
1623
- o
1750
+ s
1624
1751
  )
1625
1752
  );
1626
- const a = o?.message ?? "Failed to register marker contract";
1753
+ const a = s?.message ?? "Failed to register marker contract";
1627
1754
  throw new g(
1628
1755
  a,
1629
1756
  E.illegalState(a)
@@ -1635,8 +1762,8 @@ class sr {
1635
1762
  for (const [n, r] of Object.entries(e)) {
1636
1763
  if (!r)
1637
1764
  continue;
1638
- const s = r.getType()?.getBlueId();
1639
- typeof s == "string" && s.trim().length > 0 && t.set(n, { node: r, nodeTypeBlueId: s });
1765
+ const o = r.getType()?.getBlueId();
1766
+ typeof o == "string" && o.trim().length > 0 && t.set(n, { node: r, nodeTypeBlueId: o });
1640
1767
  }
1641
1768
  return t;
1642
1769
  }
@@ -1644,29 +1771,29 @@ class sr {
1644
1771
  return this.blue.nodeToSchemaOutput(e, t);
1645
1772
  }
1646
1773
  }
1647
- function ee(i) {
1648
- return i instanceof Me;
1774
+ function ae(i) {
1775
+ return i instanceof Ue;
1649
1776
  }
1650
- const or = m["Channel Event Checkpoint"];
1651
- function ar(i) {
1777
+ const Mr = p["Core/Channel Event Checkpoint"];
1778
+ function Pr(i) {
1652
1779
  return i.jsonValueToNode({
1653
- type: { blueId: or },
1780
+ type: { blueId: Mr },
1654
1781
  lastEvents: {},
1655
1782
  lastSignatures: {}
1656
1783
  });
1657
1784
  }
1658
- function cr() {
1785
+ function Or() {
1659
1786
  return {
1660
1787
  lastEvents: {},
1661
1788
  lastSignatures: {}
1662
1789
  };
1663
1790
  }
1664
- function Te(i) {
1791
+ function Be(i) {
1665
1792
  return i != null && Object.prototype.hasOwnProperty.call(i, "lastEvents") && Object.prototype.hasOwnProperty.call(i, "lastSignatures");
1666
1793
  }
1667
- class lr {
1668
- constructor(e, t, n, r, s) {
1669
- this.markerKey = e, this.checkpoint = t, this.channelKey = n, this.lastEventNode = r, this.lastEventSignature = s;
1794
+ class Nr {
1795
+ constructor(e, t, n, r, o) {
1796
+ this.markerKey = e, this.checkpoint = t, this.channelKey = n, this.lastEventNode = r, this.lastEventSignature = o;
1670
1797
  }
1671
1798
  lastEventNode;
1672
1799
  lastEventSignature;
@@ -1674,32 +1801,32 @@ class lr {
1674
1801
  return e != null && e === this.lastEventSignature;
1675
1802
  }
1676
1803
  }
1677
- class ur {
1804
+ class Ar {
1678
1805
  constructor(e, t) {
1679
1806
  this.runtime = e, this.signatureFn = t;
1680
1807
  }
1681
1808
  ensureCheckpointMarker(e, t) {
1682
- const n = t.marker(T), r = w(e, $e);
1809
+ const n = t.marker(A), r = b(e, Ke);
1683
1810
  if (!n) {
1684
- const s = ar(this.runtime.blue());
1685
- this.runtime.directWrite(r, s), t.registerCheckpointMarker(cr());
1811
+ const o = Pr(this.runtime.blue());
1812
+ this.runtime.directWrite(r, o), t.registerCheckpointMarker(Or());
1686
1813
  return;
1687
1814
  }
1688
- if (!Te(n))
1815
+ if (!Be(n))
1689
1816
  throw new Error(
1690
1817
  `Reserved key 'checkpoint' must contain a Channel Event Checkpoint at ${r}`
1691
1818
  );
1692
1819
  }
1693
1820
  findCheckpoint(e, t) {
1694
1821
  for (const [n, r] of e.markerEntries()) {
1695
- if (!Te(r))
1822
+ if (!Be(r))
1696
1823
  continue;
1697
- const o = (r.lastEvents?.[t] ?? null)?.clone() ?? null, c = r.lastSignatures?.[t] ?? null ?? this.signatureFn(o);
1698
- return new lr(
1824
+ const s = (r.lastEvents?.[t] ?? null)?.clone() ?? null, c = r.lastSignatures?.[t] ?? null ?? this.signatureFn(s);
1825
+ return new Nr(
1699
1826
  n,
1700
1827
  r,
1701
1828
  t,
1702
- o,
1829
+ s,
1703
1830
  c
1704
1831
  );
1705
1832
  }
@@ -1708,22 +1835,22 @@ class ur {
1708
1835
  isDuplicate(e, t) {
1709
1836
  return e != null && e.matches(t);
1710
1837
  }
1711
- persist(e, t, n, r, s) {
1838
+ persist(e, t, n, r, o) {
1712
1839
  if (!n)
1713
1840
  return;
1714
- const o = w(
1841
+ const s = b(
1715
1842
  e,
1716
- ze(n.markerKey, n.channelKey)
1717
- ), a = s?.clone() ?? null;
1718
- this.runtime.gasMeter().chargeCheckpointUpdate(), this.runtime.directWrite(o, a), n.checkpoint.lastEvents || (n.checkpoint.lastEvents = {}), a ? n.checkpoint.lastEvents[n.channelKey] = a.clone() ?? null : delete n.checkpoint.lastEvents[n.channelKey], n.lastEventNode = a?.clone() ?? null;
1719
- const c = w(
1843
+ je(n.markerKey, n.channelKey)
1844
+ ), a = o?.clone() ?? null;
1845
+ this.runtime.gasMeter().chargeCheckpointUpdate(), this.runtime.directWrite(s, a), n.checkpoint.lastEvents || (n.checkpoint.lastEvents = {}), a ? n.checkpoint.lastEvents[n.channelKey] = a.clone() ?? null : delete n.checkpoint.lastEvents[n.channelKey], n.lastEventNode = a?.clone() ?? null;
1846
+ const c = b(
1720
1847
  e,
1721
- Ue(n.markerKey, n.channelKey)
1722
- ), l = r == null ? null : new d().setValue(r);
1723
- this.runtime.directWrite(c, l), n.checkpoint.lastSignatures || (n.checkpoint.lastSignatures = {}), r == null ? delete n.checkpoint.lastSignatures[n.channelKey] : n.checkpoint.lastSignatures[n.channelKey] = r, n.lastEventSignature = r ?? null;
1848
+ Qe(n.markerKey, n.channelKey)
1849
+ ), u = r == null ? null : new h().setValue(r);
1850
+ this.runtime.directWrite(c, u), n.checkpoint.lastSignatures || (n.checkpoint.lastSignatures = {}), r == null ? delete n.checkpoint.lastSignatures[n.channelKey] : n.checkpoint.lastSignatures[n.channelKey] = r, n.lastEventSignature = r ?? null;
1724
1851
  }
1725
1852
  }
1726
- class dr {
1853
+ class Dr {
1727
1854
  constructor(e, t, n) {
1728
1855
  this.runtime = e, this.checkpointManager = t, this.deps = n;
1729
1856
  }
@@ -1731,25 +1858,25 @@ class dr {
1731
1858
  if (this.deps.isScopeInactive(e))
1732
1859
  return;
1733
1860
  this.runtime.gasMeter().chargeChannelMatchAttempt();
1734
- const s = r, o = await this.deps.evaluateChannel(
1861
+ const o = r, s = await this.deps.evaluateChannel(
1735
1862
  n,
1736
1863
  t,
1737
1864
  e,
1738
1865
  r
1739
1866
  );
1740
- if (!o.matches)
1867
+ if (!s.matches)
1741
1868
  return;
1742
- const a = o.eventNode ?? r;
1869
+ const a = s.eventNode ?? r;
1743
1870
  this.checkpointManager.ensureCheckpointMarker(e, t);
1744
1871
  const c = this.checkpointManager.findCheckpoint(
1745
1872
  t,
1746
1873
  n.key()
1747
- ), l = o.eventId ?? this.deps.canonicalSignature(s);
1748
- this.checkpointManager.isDuplicate(c, l) || !await this.shouldProcessRelativeToCheckpoint(
1874
+ ), u = s.eventId ?? this.deps.canonicalSignature(o);
1875
+ this.checkpointManager.isDuplicate(c, u) || !await this.shouldProcessRelativeToCheckpoint(
1749
1876
  e,
1750
1877
  t,
1751
1878
  n,
1752
- s,
1879
+ o,
1753
1880
  c
1754
1881
  ) || (await this.runHandlers(
1755
1882
  e,
@@ -1761,26 +1888,26 @@ class dr {
1761
1888
  e,
1762
1889
  t,
1763
1890
  c,
1764
- l ?? null,
1765
- s
1891
+ u ?? null,
1892
+ o
1766
1893
  ));
1767
1894
  }
1768
- async runHandlers(e, t, n, r, s) {
1769
- const o = t.handlersFor(n);
1770
- if (o.length !== 0)
1771
- for (const a of o) {
1772
- if (!s && this.deps.isScopeInactive(e))
1895
+ async runHandlers(e, t, n, r, o) {
1896
+ const s = t.handlersFor(n);
1897
+ if (s.length !== 0)
1898
+ for (const a of s) {
1899
+ if (!o && this.deps.isScopeInactive(e))
1773
1900
  break;
1774
1901
  try {
1775
1902
  const c = this.deps.createContext(
1776
1903
  e,
1777
1904
  t,
1778
1905
  r,
1779
- s
1906
+ o
1780
1907
  );
1781
1908
  if (!await this.deps.shouldRunHandler(a, c))
1782
1909
  continue;
1783
- if (this.runtime.gasMeter().chargeHandlerOverhead(), await this.deps.executeHandler(a, c), !s && this.deps.isScopeInactive(e))
1910
+ if (this.runtime.gasMeter().chargeHandlerOverhead(), await this.deps.executeHandler(a, c), !o && this.deps.isScopeInactive(e))
1784
1911
  break;
1785
1912
  } catch (c) {
1786
1913
  await this.deps.handleHandlerError(e, t, c);
@@ -1788,11 +1915,11 @@ class dr {
1788
1915
  }
1789
1916
  }
1790
1917
  }
1791
- async shouldProcessRelativeToCheckpoint(e, t, n, r, s) {
1792
- if (!s?.lastEventNode)
1918
+ async shouldProcessRelativeToCheckpoint(e, t, n, r, o) {
1919
+ if (!o?.lastEventNode)
1793
1920
  return !0;
1794
- const o = this.deps.channelProcessorFor(n.blueId());
1795
- if (!o || typeof o.isNewerEvent != "function")
1921
+ const s = this.deps.channelProcessorFor(n.blueId());
1922
+ if (!s || typeof s.isNewerEvent != "function")
1796
1923
  return !0;
1797
1924
  const a = {
1798
1925
  scopePath: e,
@@ -1801,28 +1928,28 @@ class dr {
1801
1928
  markers: t.markers(),
1802
1929
  bindingKey: n.key()
1803
1930
  };
1804
- return await o.isNewerEvent(
1931
+ return await s.isNewerEvent(
1805
1932
  n.contract(),
1806
1933
  a,
1807
- s.lastEventNode.clone()
1934
+ o.lastEventNode.clone()
1808
1935
  );
1809
1936
  }
1810
1937
  }
1811
- function hr(i, e) {
1938
+ function xr(i, e) {
1812
1939
  return e.isResolved() ? i.createResolvedNode(e) : i.resolve(e);
1813
1940
  }
1814
- class O extends g {
1941
+ class L extends g {
1815
1942
  constructor(e) {
1816
1943
  super(e, E.illegalState(e)), this.name = "IllegalStateException";
1817
1944
  }
1818
1945
  }
1819
- class N extends Error {
1946
+ class x extends Error {
1820
1947
  constructor(e) {
1821
1948
  super(e), this.name = "BoundaryViolationException";
1822
1949
  }
1823
1950
  }
1824
- const fr = m["Document Update Channel"], pr = m["Embedded Node Channel"], mr = m["Triggered Event Channel"], gr = m["Lifecycle Event Channel"], Re = m["Processing Initialized Marker"], Er = m["Document Processing Initiated"];
1825
- class yr {
1951
+ const Br = p["Core/Document Update Channel"], Lr = p["Core/Embedded Node Channel"], _r = p["Core/Triggered Event Channel"], Fr = p["Core/Lifecycle Event Channel"], Le = p["Core/Processing Initialized Marker"], Ur = p["Core/Document Processing Initiated"];
1952
+ class zr {
1826
1953
  runtime;
1827
1954
  contractLoader;
1828
1955
  channelRunner;
@@ -1836,74 +1963,74 @@ class yr {
1836
1963
  this.runtime = e.runtime, this.contractLoader = e.contractLoader, this.channelRunner = e.channelRunner, this.bundles = e.bundles, this.hooks = e.hooks, this.blueId = e.blueId, this.nodeAt = e.nodeAt, this.createDocumentUpdateEvent = e.createDocumentUpdateEvent, this.matchesDocumentUpdate = e.matchesDocumentUpdate;
1837
1964
  }
1838
1965
  async initializeScope(e, t) {
1839
- const n = y(e), r = /* @__PURE__ */ new Set();
1840
- let s = null, o = null;
1966
+ const n = S(e), r = /* @__PURE__ */ new Set();
1967
+ let o = null, s = null;
1841
1968
  for (t && this.runtime.gasMeter().chargeScopeEntry(n); ; ) {
1842
1969
  const f = this.nodeAt(n);
1843
1970
  if (!f)
1844
1971
  return;
1845
- o || (o = f.clone()), s = this.loadBundle(f, n), this.bundles.set(n, s);
1846
- const h = s.embeddedPaths().find((Z) => !r.has(Z)) ?? null;
1847
- if (!h)
1972
+ s || (s = f.clone()), o = this.loadBundle(f, n), this.bundles.set(n, o);
1973
+ const y = o.embeddedPaths().find((P) => !r.has(P)) ?? null;
1974
+ if (!y)
1848
1975
  break;
1849
- r.add(h);
1850
- const p = w(n, h);
1851
- this.nodeAt(p) && await this.initializeScope(p, !0);
1976
+ r.add(y);
1977
+ const w = b(n, y);
1978
+ this.nodeAt(w) && await this.initializeScope(w, !0);
1852
1979
  }
1853
- if (!s)
1980
+ if (!o)
1854
1981
  return;
1855
1982
  const a = this.hasInitializationMarker(n);
1856
- if (!a && s.hasCheckpoint())
1857
- throw new O(
1983
+ if (!a && o.hasCheckpoint())
1984
+ throw new L(
1858
1985
  `Reserved key 'checkpoint' must not appear before initialization at scope ${n}`
1859
1986
  );
1860
1987
  if (a)
1861
1988
  return;
1862
1989
  this.runtime.gasMeter().chargeInitialization();
1863
- const c = this.blueId(o ?? new d()), l = this.createLifecycleEvent(c), u = this.hooks.createContext(
1990
+ const c = this.blueId(s ?? new h()), u = this.createLifecycleEvent(c), d = this.hooks.createContext(
1864
1991
  n,
1865
- s,
1866
- l,
1992
+ o,
1993
+ u,
1867
1994
  !1,
1868
1995
  !0
1869
1996
  );
1870
- await this.deliverLifecycle(n, s, l, !0), await this.addInitializationMarker(u, c);
1997
+ await this.deliverLifecycle(n, o, u, !0), await this.addInitializationMarker(d, c);
1871
1998
  }
1872
1999
  loadBundles(e) {
1873
- const t = y(e);
2000
+ const t = S(e);
1874
2001
  if (this.bundles.has(t))
1875
2002
  return;
1876
- const n = this.nodeAt(t), r = n ? this.loadBundle(n, t) : A.empty();
2003
+ const n = this.nodeAt(t), r = n ? this.loadBundle(n, t) : _.empty();
1877
2004
  this.bundles.set(t, r);
1878
- for (const s of r.embeddedPaths()) {
1879
- const o = w(t, s);
1880
- this.loadBundles(o);
2005
+ for (const o of r.embeddedPaths()) {
2006
+ const s = b(t, o);
2007
+ this.loadBundles(s);
1881
2008
  }
1882
2009
  }
1883
2010
  async processExternalEvent(e, t) {
1884
- const n = hr(this.runtime.blue(), t);
2011
+ const n = xr(this.runtime.blue(), t);
1885
2012
  await this.processPreparedExternalEvent(e, n);
1886
2013
  }
1887
2014
  async processPreparedExternalEvent(e, t) {
1888
- const n = y(e);
2015
+ const n = S(e);
1889
2016
  if (this.hooks.isScopeInactive(n))
1890
2017
  return;
1891
2018
  this.runtime.gasMeter().chargeScopeEntry(n);
1892
2019
  const r = await this.processEmbeddedChildren(n, t);
1893
2020
  if (!r)
1894
2021
  return;
1895
- const s = r.channelsOfType();
1896
- if (s.length === 0) {
2022
+ const o = r.channelsOfType();
2023
+ if (o.length === 0) {
1897
2024
  this.finalizeScope(n, r);
1898
2025
  return;
1899
2026
  }
1900
- for (const o of s) {
2027
+ for (const s of o) {
1901
2028
  if (this.hooks.isScopeInactive(n))
1902
2029
  break;
1903
- ae(o.blueId()) || await this.channelRunner.runExternalChannel(
2030
+ fe(s.blueId()) || await this.channelRunner.runExternalChannel(
1904
2031
  n,
1905
2032
  r,
1906
- o,
2033
+ s,
1907
2034
  t
1908
2035
  );
1909
2036
  }
@@ -1918,13 +2045,13 @@ class yr {
1918
2045
  n,
1919
2046
  r
1920
2047
  );
1921
- } catch (s) {
1922
- if (s instanceof N) {
1923
- const o = this.hooks.fatalReason(s, "Boundary violation");
1924
- await this.hooks.enterFatalTermination(e, t, o);
2048
+ } catch (o) {
2049
+ if (o instanceof x) {
2050
+ const s = this.hooks.fatalReason(o, "Boundary violation");
2051
+ await this.hooks.enterFatalTermination(e, t, s);
1925
2052
  return;
1926
2053
  }
1927
- throw s;
2054
+ throw o;
1928
2055
  }
1929
2056
  try {
1930
2057
  switch (n.op) {
@@ -1938,59 +2065,59 @@ class yr {
1938
2065
  default:
1939
2066
  break;
1940
2067
  }
1941
- const s = this.runtime.applyPatch(e, n);
1942
- if (!s)
2068
+ const o = this.runtime.applyPatch(e, n);
2069
+ if (!o)
1943
2070
  return;
1944
- await this.markCutOffChildrenIfNeeded(e, t, s), this.runtime.gasMeter().chargeCascadeRouting(s.cascadeScopes.length);
1945
- for (const o of s.cascadeScopes) {
1946
- const a = this.bundles.get(o);
1947
- if (!a || this.hooks.isScopeInactive(o))
2071
+ await this.markCutOffChildrenIfNeeded(e, t, o), this.runtime.gasMeter().chargeCascadeRouting(o.cascadeScopes.length);
2072
+ for (const s of o.cascadeScopes) {
2073
+ const a = this.bundles.get(s);
2074
+ if (!a || this.hooks.isScopeInactive(s))
1948
2075
  continue;
1949
- const c = this.createDocumentUpdateEvent(s, o), l = a.channelsOfType(
1950
- fr
2076
+ const c = this.createDocumentUpdateEvent(o, s), u = a.channelsOfType(
2077
+ Br
1951
2078
  );
1952
- for (const u of l) {
1953
- const f = u.contract();
2079
+ for (const d of u) {
2080
+ const f = d.contract();
1954
2081
  if (this.matchesDocumentUpdate(
1955
- o,
2082
+ s,
1956
2083
  f.path ?? null,
1957
- s.path
2084
+ o.path
1958
2085
  ) && (await this.channelRunner.runHandlers(
1959
- o,
2086
+ s,
1960
2087
  a,
1961
- u.key(),
2088
+ d.key(),
1962
2089
  c,
1963
2090
  !1
1964
- ), this.hooks.isScopeInactive(o)))
2091
+ ), this.hooks.isScopeInactive(s)))
1965
2092
  break;
1966
2093
  }
1967
2094
  }
1968
- } catch (s) {
1969
- if (s instanceof N) {
1970
- const o = this.hooks.fatalReason(s, "Boundary violation");
1971
- await this.hooks.enterFatalTermination(e, t, o);
2095
+ } catch (o) {
2096
+ if (o instanceof x) {
2097
+ const s = this.hooks.fatalReason(o, "Boundary violation");
2098
+ await this.hooks.enterFatalTermination(e, t, s);
1972
2099
  return;
1973
2100
  }
1974
- if (s instanceof O || s instanceof Error && !(s instanceof g)) {
1975
- const o = this.hooks.fatalReason(s, "Runtime fatal");
1976
- await this.hooks.enterFatalTermination(e, t, o);
2101
+ if (o instanceof L || o instanceof Error && !(o instanceof g)) {
2102
+ const s = this.hooks.fatalReason(o, "Runtime fatal");
2103
+ await this.hooks.enterFatalTermination(e, t, s);
1977
2104
  return;
1978
2105
  }
1979
- throw s;
2106
+ throw o;
1980
2107
  }
1981
2108
  }
1982
2109
  }
1983
2110
  async deliverLifecycle(e, t, n, r) {
1984
2111
  if (this.runtime.gasMeter().chargeLifecycleDelivery(), await this.hooks.recordLifecycleForBridging(e, n), !t)
1985
2112
  return;
1986
- const s = t.channelsOfType(
1987
- gr
2113
+ const o = t.channelsOfType(
2114
+ Fr
1988
2115
  );
1989
- for (const o of s)
2116
+ for (const s of o)
1990
2117
  if (await this.channelRunner.runHandlers(
1991
2118
  e,
1992
2119
  t,
1993
- o.key(),
2120
+ s.key(),
1994
2121
  n,
1995
2122
  !0
1996
2123
  ), this.hooks.isScopeInactive(e))
@@ -1998,24 +2125,24 @@ class yr {
1998
2125
  r && await this.finalizeScope(e, t);
1999
2126
  }
2000
2127
  async processEmbeddedChildren(e, t) {
2001
- const n = y(e), r = /* @__PURE__ */ new Set();
2002
- let s = this.refreshBundle(n);
2003
- for (; s; ) {
2004
- const o = this.nextEmbeddedPath(s, r);
2005
- if (!o)
2006
- return s;
2007
- r.add(o);
2008
- const a = w(n, o);
2128
+ const n = S(e), r = /* @__PURE__ */ new Set();
2129
+ let o = this.refreshBundle(n);
2130
+ for (; o; ) {
2131
+ const s = this.nextEmbeddedPath(o, r);
2132
+ if (!s)
2133
+ return o;
2134
+ r.add(s);
2135
+ const a = b(n, s);
2009
2136
  if (a === n || this.hooks.isScopeInactive(a)) {
2010
- s = this.refreshBundle(n);
2137
+ o = this.refreshBundle(n);
2011
2138
  continue;
2012
2139
  }
2013
- this.nodeAt(a) && (await this.initializeScope(a, !1), await this.processPreparedExternalEvent(a, t)), s = this.refreshBundle(n);
2140
+ this.nodeAt(a) && (await this.initializeScope(a, !1), await this.processPreparedExternalEvent(a, t)), o = this.refreshBundle(n);
2014
2141
  }
2015
2142
  return null;
2016
2143
  }
2017
2144
  refreshBundle(e) {
2018
- const t = y(e), n = this.nodeAt(t);
2145
+ const t = S(e), n = this.nodeAt(t);
2019
2146
  if (!n)
2020
2147
  return this.bundles.delete(t), null;
2021
2148
  const r = this.loadBundle(n, t);
@@ -2033,7 +2160,7 @@ class yr {
2033
2160
  try {
2034
2161
  return this.contractLoader.load(e, t);
2035
2162
  } catch (n) {
2036
- if (n instanceof g || n instanceof U)
2163
+ if (n instanceof g || n instanceof K)
2037
2164
  throw n;
2038
2165
  const r = n?.message ?? "Failed to load contracts";
2039
2166
  throw new g(
@@ -2046,7 +2173,7 @@ class yr {
2046
2173
  }
2047
2174
  }
2048
2175
  async addInitializationMarker(e, t) {
2049
- const n = new d().setType(new d().setBlueId(Re)).addProperty("documentId", new d().setValue(t)), r = e.resolvePointer(ie);
2176
+ const n = new h().setType(new h().setBlueId(Le)).addProperty("documentId", new h().setValue(t)), r = e.resolvePointer(ue);
2050
2177
  await e.applyPatch({
2051
2178
  op: "ADD",
2052
2179
  path: r,
@@ -2060,20 +2187,20 @@ class yr {
2060
2187
  if (this.hooks.isScopeInactive(e) || t.embeddedPaths().length === 0)
2061
2188
  return;
2062
2189
  const n = t.channelsOfType(
2063
- pr
2190
+ Lr
2064
2191
  );
2065
2192
  if (n.length !== 0)
2066
2193
  for (const r of t.embeddedPaths()) {
2067
- const s = w(e, r), a = this.runtime.scope(s).drainBridgeableEvents();
2194
+ const o = b(e, r), a = this.runtime.scope(o).drainBridgeableEvents();
2068
2195
  if (a.length !== 0)
2069
2196
  for (const c of a) {
2070
- let l = !1;
2071
- for (const u of n) {
2072
- const h = u.contract().childPath ?? "/";
2073
- w(e, h) === s && (l || (this.runtime.gasMeter().chargeBridge(), l = !0), await this.channelRunner.runHandlers(
2197
+ let u = !1;
2198
+ for (const d of n) {
2199
+ const y = d.contract().childPath ?? "/";
2200
+ b(e, y) === o && (u || (this.runtime.gasMeter().chargeBridge(), u = !0), await this.channelRunner.runHandlers(
2074
2201
  e,
2075
2202
  t,
2076
- u.key(),
2203
+ d.key(),
2077
2204
  c.clone(),
2078
2205
  !1
2079
2206
  ));
@@ -2085,18 +2212,18 @@ class yr {
2085
2212
  if (this.hooks.isScopeInactive(e))
2086
2213
  return;
2087
2214
  const n = this.runtime.scope(e), r = t.channelsOfType(
2088
- mr
2215
+ _r
2089
2216
  );
2090
2217
  if (r.length === 0) {
2091
2218
  n.clearTriggered();
2092
2219
  return;
2093
2220
  }
2094
2221
  for (; !n.triggeredIsEmpty(); ) {
2095
- const s = n.pollTriggered();
2096
- if (!s)
2222
+ const o = n.pollTriggered();
2223
+ if (!o)
2097
2224
  break;
2098
2225
  this.runtime.gasMeter().chargeDrainEvent();
2099
- for (const o of r) {
2226
+ for (const s of r) {
2100
2227
  if (this.hooks.isScopeInactive(e)) {
2101
2228
  n.clearTriggered();
2102
2229
  return;
@@ -2104,8 +2231,8 @@ class yr {
2104
2231
  if (await this.channelRunner.runHandlers(
2105
2232
  e,
2106
2233
  t,
2107
- o.key(),
2108
- s.clone(),
2234
+ s.key(),
2235
+ o.clone(),
2109
2236
  !1
2110
2237
  ), this.hooks.isScopeInactive(e)) {
2111
2238
  n.clearTriggered();
@@ -2115,185 +2242,185 @@ class yr {
2115
2242
  }
2116
2243
  }
2117
2244
  validatePatchBoundary(e, t, n) {
2118
- const r = y(e), s = S(n.path);
2119
- if (s === r)
2120
- throw new N(
2245
+ const r = S(e), o = T(n.path);
2246
+ if (o === r)
2247
+ throw new x(
2121
2248
  `Self-root mutation is forbidden at scope ${r}`
2122
2249
  );
2123
- if (r !== "/" && !s.startsWith(`${r}/`))
2124
- throw new N(
2125
- `Patch path ${s} is outside scope ${r}`
2250
+ if (r !== "/" && !o.startsWith(`${r}/`))
2251
+ throw new x(
2252
+ `Patch path ${o} is outside scope ${r}`
2126
2253
  );
2127
- for (const o of t.embeddedPaths()) {
2128
- const a = w(r, o);
2129
- if (s.startsWith(`${a}/`))
2130
- throw new N(
2131
- `Boundary violation: patch ${s} enters embedded scope ${a}`
2254
+ for (const s of t.embeddedPaths()) {
2255
+ const a = b(r, s);
2256
+ if (o.startsWith(`${a}/`))
2257
+ throw new x(
2258
+ `Boundary violation: patch ${o} enters embedded scope ${a}`
2132
2259
  );
2133
2260
  }
2134
2261
  }
2135
2262
  enforceReservedKeyWriteProtection(e, t, n) {
2136
2263
  if (n)
2137
2264
  return;
2138
- const r = y(e), s = S(t.path);
2139
- for (const o of oe) {
2140
- const a = w(
2265
+ const r = S(e), o = T(t.path);
2266
+ for (const s of me) {
2267
+ const a = b(
2141
2268
  r,
2142
- Q(o)
2269
+ ee(s)
2143
2270
  );
2144
- if (s === a || s.startsWith(`${a}/`))
2145
- throw new N(
2146
- `Reserved key '${o}' is write-protected at ${a}`
2271
+ if (o === a || o.startsWith(`${a}/`))
2272
+ throw new x(
2273
+ `Reserved key '${s}' is write-protected at ${a}`
2147
2274
  );
2148
2275
  }
2149
2276
  }
2150
2277
  async markCutOffChildrenIfNeeded(e, t, n) {
2151
2278
  if (t.embeddedPaths().length === 0)
2152
2279
  return;
2153
- const r = S(n.path);
2154
- for (const s of t.embeddedPaths()) {
2155
- const o = w(e, s);
2156
- r === o && (n.op === "remove" || n.op === "replace") && await this.hooks.markCutOff(o);
2280
+ const r = T(n.path);
2281
+ for (const o of t.embeddedPaths()) {
2282
+ const s = b(e, o);
2283
+ r === s && (n.op === "remove" || n.op === "replace") && await this.hooks.markCutOff(s);
2157
2284
  }
2158
2285
  }
2159
2286
  hasInitializationMarker(e) {
2160
- const t = w(e, ie), n = this.nodeAt(t);
2287
+ const t = b(e, ue), n = this.nodeAt(t);
2161
2288
  if (!n)
2162
2289
  return !1;
2163
- if (!(n instanceof d)) {
2164
- const s = `Reserved key 'initialized' must contain a Processing Initialized Marker at ${t}`;
2165
- throw new O(s);
2290
+ if (!(n instanceof h)) {
2291
+ const o = `Reserved key 'initialized' must contain a Processing Initialized Marker at ${t}`;
2292
+ throw new L(o);
2166
2293
  }
2167
- if (n.getType()?.getBlueId() !== Re) {
2168
- const s = `Reserved key 'initialized' must contain a Processing Initialized Marker at ${t}`;
2169
- throw new O(s);
2294
+ if (n.getType()?.getBlueId() !== Le) {
2295
+ const o = `Reserved key 'initialized' must contain a Processing Initialized Marker at ${t}`;
2296
+ throw new L(o);
2170
2297
  }
2171
2298
  return !0;
2172
2299
  }
2173
2300
  createLifecycleEvent(e) {
2174
- return new d().setType(new d().setBlueId(Er)).setProperties({
2175
- type: new d().setValue("Document Processing Initiated"),
2176
- documentId: new d().setValue(e)
2301
+ return new h().setType(new h().setBlueId(Ur)).setProperties({
2302
+ type: new h().setValue("Core/Document Processing Initiated"),
2303
+ documentId: new h().setValue(e)
2177
2304
  });
2178
2305
  }
2179
2306
  }
2180
- class J extends Error {
2307
+ class Y extends Error {
2181
2308
  constructor(e) {
2182
2309
  super(
2183
2310
  e ? "Processing terminated due to fatal error" : "Processing terminated"
2184
2311
  ), this.fatal = e, this.name = "RunTerminationError";
2185
2312
  }
2186
2313
  }
2187
- const wr = m["Processing Terminated Marker"], Sr = m["Document Processing Terminated"];
2188
- class br {
2314
+ const $r = p["Core/Processing Terminated Marker"], Vr = p["Core/Document Processing Terminated"];
2315
+ class Hr {
2189
2316
  constructor(e) {
2190
2317
  this.runtime = e;
2191
2318
  }
2192
- async terminateScope(e, t, n, r, s) {
2193
- e.recordPendingTermination(t, r, s ?? null);
2194
- const o = e.normalizeScope(t), a = w(o, Le);
2319
+ async terminateScope(e, t, n, r, o) {
2320
+ e.recordPendingTermination(t, r, o ?? null);
2321
+ const s = e.normalizeScope(t), a = b(s, Ge);
2195
2322
  this.runtime.directWrite(
2196
2323
  a,
2197
- Cr(this.runtime.blue(), r, s)
2324
+ Wr(this.runtime.blue(), r, o)
2198
2325
  ), this.runtime.gasMeter().chargeTerminationMarker();
2199
- const c = n ?? e.bundleForScope(o) ?? null, l = Ir(r, s);
2326
+ const c = n ?? e.bundleForScope(s) ?? null, u = Gr(r, o);
2200
2327
  if (await e.deliverLifecycle(
2201
- o,
2328
+ s,
2202
2329
  c,
2203
- l,
2330
+ u,
2204
2331
  !1
2205
- ), this.runtime.scope(o).finalizeTermination(r, s ?? null), e.clearPendingTermination(t), r === "FATAL" && this.runtime.gasMeter().chargeFatalTerminationOverhead(), r === "FATAL" && o === "/")
2206
- throw this.runtime.markRunTerminated(), new J(!0);
2207
- if (r === "GRACEFUL" && o === "/")
2208
- throw this.runtime.markRunTerminated(), new J(!1);
2332
+ ), this.runtime.scope(s).finalizeTermination(r, o ?? null), e.clearPendingTermination(t), r === "FATAL" && this.runtime.gasMeter().chargeFatalTerminationOverhead(), r === "FATAL" && s === "/")
2333
+ throw this.runtime.markRunTerminated(), new Y(!0);
2334
+ if (r === "GRACEFUL" && s === "/")
2335
+ throw this.runtime.markRunTerminated(), new Y(!1);
2209
2336
  }
2210
2337
  }
2211
- function Cr(i, e, t) {
2212
- return vr(i, {
2213
- type: { blueId: wr },
2338
+ function Wr(i, e, t) {
2339
+ return Kr(i, {
2340
+ type: { blueId: $r },
2214
2341
  cause: e === "GRACEFUL" ? "graceful" : "fatal",
2215
2342
  ...t ? { reason: t } : {}
2216
2343
  });
2217
2344
  }
2218
- function Ir(i, e) {
2219
- const t = new d().setType(
2220
- new d().setBlueId(Sr)
2345
+ function Gr(i, e) {
2346
+ const t = new h().setType(
2347
+ new h().setBlueId(Vr)
2221
2348
  );
2222
2349
  return t.addProperty(
2223
2350
  "cause",
2224
- new d().setValue(i === "GRACEFUL" ? "graceful" : "fatal")
2225
- ), e && t.addProperty("reason", new d().setValue(e)), t;
2351
+ new h().setValue(i === "GRACEFUL" ? "graceful" : "fatal")
2352
+ ), e && t.addProperty("reason", new h().setValue(e)), t;
2226
2353
  }
2227
- function vr(i, e) {
2354
+ function Kr(i, e) {
2228
2355
  return i.jsonValueToNode(e);
2229
2356
  }
2230
- const F = "-";
2231
- class kr {
2357
+ const W = "-";
2358
+ class qr {
2232
2359
  constructor(e) {
2233
2360
  this.document = e;
2234
2361
  }
2235
2362
  applyPatch(e, t) {
2236
- const n = y(e), r = S(t.path), s = Ne(r), o = Pe(this.document, s, "before", r);
2363
+ const n = S(e), r = T(t.path), o = Fe(r), s = _e(this.document, o, "before", r);
2237
2364
  switch (t.op) {
2238
2365
  case "ADD":
2239
- this.applyAdd(s, r, t.val ?? null);
2366
+ this.applyAdd(o, r, t.val ?? null);
2240
2367
  break;
2241
2368
  case "REPLACE":
2242
- this.applyReplace(s, r, t.val ?? null);
2369
+ this.applyReplace(o, r, t.val ?? null);
2243
2370
  break;
2244
2371
  case "REMOVE":
2245
- this.applyRemove(s, r);
2372
+ this.applyRemove(o, r);
2246
2373
  break;
2247
2374
  }
2248
- const a = t.op === "REMOVE" ? null : Pe(this.document, s, "after", r);
2375
+ const a = t.op === "REMOVE" ? null : _e(this.document, o, "after", r);
2249
2376
  return {
2250
2377
  path: r,
2251
- before: o,
2378
+ before: s,
2252
2379
  after: a,
2253
2380
  op: t.op.toLowerCase(),
2254
2381
  originScope: n,
2255
- cascadeScopes: Tr(n)
2382
+ cascadeScopes: Jr(n)
2256
2383
  };
2257
2384
  }
2258
2385
  directWrite(e, t) {
2259
- const n = S(e);
2386
+ const n = T(e);
2260
2387
  if (n === "/")
2261
2388
  throw new Error("Direct write cannot target root document");
2262
- const r = Ne(n), { parent: s, leaf: o } = this.resolveParent(r);
2263
- if (o === F)
2389
+ const r = Fe(n), { parent: o, leaf: s } = this.resolveParent(r);
2390
+ if (s === W)
2264
2391
  throw new Error(
2265
2392
  `Direct write does not support append token '-' for path ${n}`
2266
2393
  );
2267
- const a = s.getItems();
2268
- if (a && M(o)) {
2269
- this.directWriteArray(s, a, o, t, n);
2394
+ const a = o.getItems();
2395
+ if (a && B(s)) {
2396
+ this.directWriteArray(o, a, s, t, n);
2270
2397
  return;
2271
2398
  }
2272
- this.directWriteObject(s, o, t);
2399
+ this.directWriteObject(o, s, t);
2273
2400
  }
2274
- directWriteArray(e, t, n, r, s) {
2275
- const o = te(e, t), a = k(n, s);
2401
+ directWriteArray(e, t, n, r, o) {
2402
+ const s = ce(e, t), a = N(n, o);
2276
2403
  if (r == null) {
2277
- if (a < 0 || a >= o.length)
2404
+ if (a < 0 || a >= s.length)
2278
2405
  return;
2279
- o.splice(a, 1), e.setItems(o);
2406
+ s.splice(a, 1), e.setItems(s);
2280
2407
  return;
2281
2408
  }
2282
2409
  const c = r.clone();
2283
- if (a === o.length) {
2284
- o.push(c), e.setItems(o);
2410
+ if (a === s.length) {
2411
+ s.push(c), e.setItems(s);
2285
2412
  return;
2286
2413
  }
2287
- if (a >= 0 && a < o.length) {
2288
- o[a] = c, e.setItems(o);
2414
+ if (a >= 0 && a < s.length) {
2415
+ s[a] = c, e.setItems(s);
2289
2416
  return;
2290
2417
  }
2291
2418
  throw new Error(
2292
- `Array index out of bounds for direct write: ${s}`
2419
+ `Array index out of bounds for direct write: ${o}`
2293
2420
  );
2294
2421
  }
2295
2422
  directWriteObject(e, t, n) {
2296
- const r = W(e);
2423
+ const r = J(e);
2297
2424
  if (n == null) {
2298
2425
  delete r[t], e.setProperties(
2299
2426
  Object.keys(r).length > 0 ? r : void 0
@@ -2313,55 +2440,55 @@ class kr {
2313
2440
  return { parent: t, leaf: e[e.length - 1] };
2314
2441
  }
2315
2442
  getOrCreateChild(e, t, n, r) {
2316
- if (t === F)
2443
+ if (t === W)
2317
2444
  throw new Error(
2318
- `Append token '-' must be final segment: ${L(n, r)}`
2445
+ `Append token '-' must be final segment: ${V(n, r)}`
2319
2446
  );
2320
- const s = e.getItems();
2321
- if (s && M(t)) {
2322
- const c = k(t, L(n, r));
2323
- if (c < 0 || c >= s.length)
2447
+ const o = e.getItems();
2448
+ if (o && B(t)) {
2449
+ const c = N(t, V(n, r));
2450
+ if (c < 0 || c >= o.length)
2324
2451
  throw new Error(
2325
- `Array index out of bounds: ${L(n, r)}`
2452
+ `Array index out of bounds: ${V(n, r)}`
2326
2453
  );
2327
- const l = s[c];
2328
- if (!l)
2454
+ const u = o[c];
2455
+ if (!u)
2329
2456
  throw new Error(
2330
- `Path does not exist: ${L(n, r)}`
2457
+ `Path does not exist: ${V(n, r)}`
2331
2458
  );
2332
- return l;
2459
+ return u;
2333
2460
  }
2334
- const o = W(e);
2335
- let a = o[t];
2336
- return a || (a = new d(), o[t] = a, e.setProperties(o)), a;
2461
+ const s = J(e);
2462
+ let a = s[t];
2463
+ return a || (a = new h(), s[t] = a, e.setProperties(s)), a;
2337
2464
  }
2338
2465
  applyAdd(e, t, n) {
2339
2466
  if (t === "/" || t.length === 0)
2340
2467
  throw new Error("ADD operation cannot target document root");
2341
- const { parent: r, key: s, pointer: o, created: a } = this.resolveParentForPatch(
2468
+ const { parent: r, key: o, pointer: s, created: a } = this.resolveParentForPatch(
2342
2469
  e,
2343
2470
  t,
2344
2471
  "ADD"
2345
2472
  );
2346
2473
  try {
2347
- if (M(s)) {
2348
- const l = r.getItems(), u = s === F;
2349
- if (!l)
2474
+ if (B(o)) {
2475
+ const u = r.getItems(), d = o === W;
2476
+ if (!u)
2350
2477
  throw new Error(
2351
- u ? `Append token '-' requires array at ${o}` : `Array index segment requires array at ${o}`
2478
+ d ? `Append token '-' requires array at ${s}` : `Array index segment requires array at ${s}`
2352
2479
  );
2353
- if (u) {
2354
- te(r, l).push($(n));
2480
+ if (d) {
2481
+ ce(r, u).push(H(n));
2355
2482
  return;
2356
2483
  }
2357
- const f = k(s, t);
2358
- if (f < 0 || f > l.length)
2484
+ const f = N(o, t);
2485
+ if (f < 0 || f > u.length)
2359
2486
  throw new Error(`Array index out of bounds in path: ${t}`);
2360
- te(r, l).splice(f, 0, $(n));
2487
+ ce(r, u).splice(f, 0, H(n));
2361
2488
  return;
2362
2489
  }
2363
- const c = W(r);
2364
- c[s] = $(n), r.setProperties(c);
2490
+ const c = J(r);
2491
+ c[o] = H(n), r.setProperties(c);
2365
2492
  } catch (c) {
2366
2493
  throw this.rollbackCreated(a), c;
2367
2494
  }
@@ -2369,26 +2496,26 @@ class kr {
2369
2496
  applyReplace(e, t, n) {
2370
2497
  if (t === "/" || t.length === 0)
2371
2498
  throw new Error("REPLACE operation cannot target document root");
2372
- const { parent: r, key: s, created: o } = this.resolveParentForPatch(
2499
+ const { parent: r, key: o, created: s } = this.resolveParentForPatch(
2373
2500
  e,
2374
2501
  t,
2375
2502
  "REPLACE"
2376
2503
  );
2377
2504
  try {
2378
- if (M(s)) {
2505
+ if (B(o)) {
2379
2506
  const c = r.getItems();
2380
2507
  if (!c)
2381
2508
  throw new Error(`Array index segment requires array at ${t}`);
2382
- const l = k(s, t);
2383
- if (l < 0 || l >= c.length)
2509
+ const u = N(o, t);
2510
+ if (u < 0 || u >= c.length)
2384
2511
  throw new Error(`Array index out of bounds in path: ${t}`);
2385
- c[l] = $(n), r.setItems(c);
2512
+ c[u] = H(n), r.setItems(c);
2386
2513
  return;
2387
2514
  }
2388
- const a = W(r);
2389
- a[s] = $(n), r.setProperties(a);
2515
+ const a = J(r);
2516
+ a[o] = H(n), r.setProperties(a);
2390
2517
  } catch (a) {
2391
- throw this.rollbackCreated(o), a;
2518
+ throw this.rollbackCreated(s), a;
2392
2519
  }
2393
2520
  }
2394
2521
  applyRemove(e, t) {
@@ -2399,61 +2526,61 @@ class kr {
2399
2526
  t,
2400
2527
  "REMOVE"
2401
2528
  );
2402
- if (M(r)) {
2529
+ if (B(r)) {
2403
2530
  const a = n.getItems();
2404
2531
  if (!a)
2405
2532
  throw new Error(`Array index segment requires array at ${t}`);
2406
- const c = k(r, t);
2533
+ const c = N(r, t);
2407
2534
  if (c < 0 || c >= a.length)
2408
2535
  throw new Error(`Array index out of bounds in path: ${t}`);
2409
2536
  a.splice(c, 1), n.setItems(a);
2410
2537
  return;
2411
2538
  }
2412
- const s = n.getProperties();
2413
- if (!s || !Object.prototype.hasOwnProperty.call(s, r))
2539
+ const o = n.getProperties();
2540
+ if (!o || !Object.prototype.hasOwnProperty.call(o, r))
2414
2541
  throw new Error(`Path does not exist: ${t}`);
2415
- const o = { ...s };
2416
- delete o[r], n.setProperties(o);
2542
+ const s = { ...o };
2543
+ delete s[r], n.setProperties(s);
2417
2544
  }
2418
2545
  resolveParentForPatch(e, t, n) {
2419
2546
  if (e.length === 0)
2420
2547
  throw new Error(`${n} operation cannot target document root`);
2421
2548
  let r = this.document;
2422
- const s = [];
2549
+ const o = [];
2423
2550
  for (let a = 0; a < e.length - 1; a += 1) {
2424
- const c = e[a], l = L(e, a + 1);
2425
- if (M(c)) {
2426
- const h = r.getItems();
2427
- if (!h)
2428
- throw new Error(`Array index segment requires array at ${l}`);
2429
- const p = k(c, l);
2430
- if (p < 0 || p >= h.length)
2431
- throw new Error(`Array index out of bounds in path: ${l}`);
2432
- const I = h[p];
2433
- if (!(I instanceof d))
2434
- throw new Error(`Array index out of bounds in path: ${l}`);
2551
+ const c = e[a], u = V(e, a + 1);
2552
+ if (B(c)) {
2553
+ const y = r.getItems();
2554
+ if (!y)
2555
+ throw new Error(`Array index segment requires array at ${u}`);
2556
+ const w = N(c, u);
2557
+ if (w < 0 || w >= y.length)
2558
+ throw new Error(`Array index out of bounds in path: ${u}`);
2559
+ const I = y[w];
2560
+ if (!(I instanceof h))
2561
+ throw new Error(`Array index out of bounds in path: ${u}`);
2435
2562
  r = I;
2436
2563
  continue;
2437
2564
  }
2438
- let u = r.getProperties(), f = u?.[c] ?? null;
2439
- if (!(f instanceof d)) {
2565
+ let d = r.getProperties(), f = d?.[c] ?? null;
2566
+ if (!(f instanceof h)) {
2440
2567
  if (n === "REMOVE")
2441
- throw new Error(`Path does not exist: ${l}`);
2442
- f = new d(), u || (u = {}), u[c] = f, r.setProperties(u), s.push({ owner: r, key: c });
2568
+ throw new Error(`Path does not exist: ${u}`);
2569
+ f = new h(), d || (d = {}), d[c] = f, r.setProperties(d), o.push({ owner: r, key: c });
2443
2570
  }
2444
2571
  r = f;
2445
2572
  }
2446
- const o = e[e.length - 1];
2447
- return { parent: r, key: o, pointer: t, created: s };
2573
+ const s = e[e.length - 1];
2574
+ return { parent: r, key: s, pointer: t, created: o };
2448
2575
  }
2449
2576
  rollbackCreated(e) {
2450
2577
  for (let t = e.length - 1; t >= 0; t -= 1) {
2451
- const { owner: n, key: r } = e[t], s = n.getProperties();
2452
- s && (delete s[r], Object.keys(s).length === 0 ? n.setProperties(void 0) : n.setProperties(s));
2578
+ const { owner: n, key: r } = e[t], o = n.getProperties();
2579
+ o && (delete o[r], Object.keys(o).length === 0 ? n.setProperties(void 0) : n.setProperties(o));
2453
2580
  }
2454
2581
  }
2455
2582
  }
2456
- function Tr(i) {
2583
+ function Jr(i) {
2457
2584
  const e = [];
2458
2585
  let t = i;
2459
2586
  for (; e.push(t), t !== "/"; ) {
@@ -2462,51 +2589,51 @@ function Tr(i) {
2462
2589
  }
2463
2590
  return e;
2464
2591
  }
2465
- function Pe(i, e, t, n) {
2592
+ function _e(i, e, t, n) {
2466
2593
  try {
2467
2594
  if (e.length === 0)
2468
2595
  return i.clone();
2469
- const r = Rr(i, e, t, n);
2596
+ const r = jr(i, e, t, n);
2470
2597
  return r ? r.clone() : null;
2471
2598
  } catch {
2472
2599
  return null;
2473
2600
  }
2474
2601
  }
2475
- function Rr(i, e, t, n) {
2602
+ function jr(i, e, t, n) {
2476
2603
  let r = i;
2477
- for (let s = 0; s < e.length; s += 1) {
2478
- const o = e[s] ?? "", a = s === e.length - 1;
2479
- if (r = Pr(r, o, a, t, n), !r)
2604
+ for (let o = 0; o < e.length; o += 1) {
2605
+ const s = e[o] ?? "", a = o === e.length - 1;
2606
+ if (r = Qr(r, s, a, t, n), !r)
2480
2607
  return null;
2481
2608
  }
2482
2609
  return r;
2483
2610
  }
2484
- function Pr(i, e, t, n, r) {
2611
+ function Qr(i, e, t, n, r) {
2485
2612
  if (!i)
2486
2613
  return null;
2487
- const s = i.getItems();
2488
- if (s) {
2489
- if (e === F) {
2614
+ const o = i.getItems();
2615
+ if (o) {
2616
+ if (e === W) {
2490
2617
  if (!t)
2491
2618
  throw new Error(`Append token '-' must be final segment: ${r}`);
2492
- return n === "before" || s.length === 0 ? null : s[s.length - 1] ?? null;
2619
+ return n === "before" || o.length === 0 ? null : o[o.length - 1] ?? null;
2493
2620
  }
2494
- const c = k(e, r);
2495
- return c < 0 || c >= s.length ? null : s[c] ?? null;
2621
+ const c = N(e, r);
2622
+ return c < 0 || c >= o.length ? null : o[c] ?? null;
2496
2623
  }
2497
- const o = i.getProperties();
2498
- if (!o)
2624
+ const s = i.getProperties();
2625
+ if (!s)
2499
2626
  return null;
2500
- const a = o[e];
2501
- return a instanceof d ? a : null;
2627
+ const a = s[e];
2628
+ return a instanceof h ? a : null;
2502
2629
  }
2503
- function Ne(i) {
2630
+ function Fe(i) {
2504
2631
  if (i === "/" || i === "")
2505
2632
  return [];
2506
2633
  const e = i.startsWith("/") ? i.slice(1) : i;
2507
2634
  return e.length === 0 ? [] : e.split("/");
2508
2635
  }
2509
- function k(i, e) {
2636
+ function N(i, e) {
2510
2637
  const t = Number.parseInt(i, 10);
2511
2638
  if (Number.isNaN(t))
2512
2639
  throw new Error(`Expected numeric array index in path: ${e}`);
@@ -2514,7 +2641,7 @@ function k(i, e) {
2514
2641
  throw new Error(`Negative array index in path: ${e}`);
2515
2642
  return t;
2516
2643
  }
2517
- function L(i, e) {
2644
+ function V(i, e) {
2518
2645
  if (e <= 0)
2519
2646
  return "/";
2520
2647
  const t = Math.min(e, i.length);
@@ -2523,11 +2650,11 @@ function L(i, e) {
2523
2650
  n += `/${i[r] ?? ""}`;
2524
2651
  return n === "" ? "/" : n;
2525
2652
  }
2526
- function te(i, e) {
2653
+ function ce(i, e) {
2527
2654
  const t = [...e];
2528
2655
  return i.setItems(t), t;
2529
2656
  }
2530
- function W(i) {
2657
+ function J(i) {
2531
2658
  const e = i.getProperties();
2532
2659
  if (!e) {
2533
2660
  const n = {};
@@ -2536,13 +2663,13 @@ function W(i) {
2536
2663
  const t = { ...e };
2537
2664
  return i.setProperties(t), t;
2538
2665
  }
2539
- function M(i) {
2540
- return i === F || /^\d+$/.test(i);
2666
+ function B(i) {
2667
+ return i === W || /^\d+$/.test(i);
2541
2668
  }
2542
- function $(i) {
2543
- return i == null ? new d().setValue(null) : i.clone();
2669
+ function H(i) {
2670
+ return i == null ? new h().setValue(null) : i.clone();
2544
2671
  }
2545
- class Nr {
2672
+ class Xr {
2546
2673
  constructor(e) {
2547
2674
  this.path = e;
2548
2675
  }
@@ -2604,7 +2731,7 @@ class Nr {
2604
2731
  return this.cutOff;
2605
2732
  }
2606
2733
  }
2607
- class Mr {
2734
+ class Yr {
2608
2735
  scopesMap = /* @__PURE__ */ new Map();
2609
2736
  rootEmissionList = [];
2610
2737
  scopes() {
@@ -2612,7 +2739,7 @@ class Mr {
2612
2739
  }
2613
2740
  scope(e) {
2614
2741
  let t = this.scopesMap.get(e);
2615
- return t || (t = new Nr(e), this.scopesMap.set(e, t)), t;
2742
+ return t || (t = new Xr(e), this.scopesMap.set(e, t)), t;
2616
2743
  }
2617
2744
  existingScope(e) {
2618
2745
  return this.scopesMap.get(e);
@@ -2630,45 +2757,33 @@ class Mr {
2630
2757
  this.scopesMap.delete(e);
2631
2758
  }
2632
2759
  }
2633
- function H(i) {
2760
+ function mt(i) {
2634
2761
  return Math.floor((i + 99) / 100);
2635
2762
  }
2636
- function he(i) {
2637
- return new TextEncoder().encode(i).length;
2638
- }
2639
- function Or(i) {
2640
- const e = S(i);
2763
+ function Zr(i) {
2764
+ const e = T(i);
2641
2765
  return e === "/" ? 0 : e.split("/").length - 1;
2642
2766
  }
2643
- function Ar(i) {
2644
- return 100 + H(he(i));
2645
- }
2646
- function Dr(i) {
2767
+ function ei(i) {
2647
2768
  return 40 + 5 * Math.max(0, i);
2648
2769
  }
2649
- function Br(i) {
2650
- return 5 + H(he(i));
2651
- }
2652
- function _r(i, e) {
2653
- return 3 * Math.max(0, i) + H(he(e));
2770
+ function ti(i, e) {
2771
+ return 8 + Zr(i) + mt(e);
2654
2772
  }
2655
- function Lr(i, e) {
2656
- return 8 + Or(i) + H(e);
2657
- }
2658
- const $r = 1e3, xr = 5, Fr = 50, zr = 2, Ur = 10, Vr = 10, Hr = 10, Kr = 20, Wr = 20, Gr = 30, qr = 30, Jr = 100;
2659
- function jr(i) {
2773
+ const ni = 1e3, ri = 5, ii = 50, oi = 2, si = 10, ai = 10, ci = 10, li = 20, ui = 20, di = 30, hi = 30, pi = 100;
2774
+ function mi(i) {
2660
2775
  return 50 + 10 * i;
2661
2776
  }
2662
- function Qr(i) {
2777
+ function fi(i) {
2663
2778
  return 20 + i;
2664
2779
  }
2665
- function Yr(i) {
2780
+ function gi(i) {
2666
2781
  return 10 * i;
2667
2782
  }
2668
- function Zr(i) {
2783
+ function Ei(i) {
2669
2784
  return 20 + i;
2670
2785
  }
2671
- class Xr {
2786
+ class yi {
2672
2787
  constructor(e) {
2673
2788
  this.blue = e;
2674
2789
  }
@@ -2680,77 +2795,72 @@ class Xr {
2680
2795
  this.total += e;
2681
2796
  }
2682
2797
  chargeScopeEntry(e) {
2683
- this.add(jr(this.scopeDepth(e)));
2798
+ this.add(mi(this.scopeDepth(e)));
2684
2799
  }
2685
2800
  chargeInitialization() {
2686
- this.add($r);
2801
+ this.add(ni);
2687
2802
  }
2688
2803
  chargeChannelMatchAttempt() {
2689
- this.add(xr);
2804
+ this.add(ri);
2690
2805
  }
2691
2806
  chargeHandlerOverhead() {
2692
- this.add(Fr);
2807
+ this.add(ii);
2693
2808
  }
2694
2809
  chargeBoundaryCheck() {
2695
- this.add(zr);
2810
+ this.add(oi);
2696
2811
  }
2697
2812
  chargePatchAddOrReplace(e) {
2698
- this.add(Qr(this.payloadSizeCharge(e)));
2813
+ this.add(fi(this.payloadSizeCharge(e)));
2699
2814
  }
2700
2815
  chargePatchRemove() {
2701
- this.add(Ur);
2816
+ this.add(si);
2702
2817
  }
2703
2818
  chargeCascadeRouting(e) {
2704
- e > 0 && this.add(Yr(e));
2819
+ e > 0 && this.add(gi(e));
2705
2820
  }
2706
2821
  chargeEmitEvent(e) {
2707
- this.add(Zr(this.payloadSizeCharge(e)));
2822
+ this.add(Ei(this.payloadSizeCharge(e)));
2708
2823
  }
2709
2824
  chargeBridge() {
2710
- this.add(Vr);
2825
+ this.add(ai);
2711
2826
  }
2712
2827
  chargeDrainEvent() {
2713
- this.add(Hr);
2828
+ this.add(ci);
2714
2829
  }
2715
2830
  chargeCheckpointUpdate() {
2716
- this.add(Kr);
2831
+ this.add(li);
2717
2832
  }
2718
2833
  chargeTerminationMarker() {
2719
- this.add(Wr);
2834
+ this.add(ui);
2720
2835
  }
2721
2836
  chargeLifecycleDelivery() {
2722
- this.add(Gr);
2837
+ this.add(di);
2723
2838
  }
2724
2839
  chargeFatalTerminationOverhead() {
2725
- this.add(Jr);
2726
- }
2727
- chargeJavaScriptCodeBase(e) {
2728
- this.add(Ar(e));
2840
+ this.add(pi);
2729
2841
  }
2730
2842
  chargeTriggerEventBase() {
2731
- this.add(qr);
2843
+ this.add(hi);
2732
2844
  }
2733
2845
  chargeUpdateDocumentBase(e) {
2734
- this.add(Dr(e));
2735
- }
2736
- chargeExpression(e) {
2737
- this.add(Br(e));
2738
- }
2739
- chargeTemplate(e, t) {
2740
- this.add(_r(e, t));
2846
+ this.add(ei(e));
2741
2847
  }
2742
2848
  chargeDocumentSnapshot(e, t) {
2743
- const n = t ? Se(this.blue, t) : 0;
2744
- this.add(Lr(e, n));
2849
+ const n = t ? be(this.blue, t) : 0;
2850
+ this.add(ti(e, n));
2851
+ }
2852
+ chargeWasmGas(e) {
2853
+ const t = Wt(e);
2854
+ t > 0 && this.add(t);
2745
2855
  }
2746
2856
  payloadSizeCharge(e) {
2747
2857
  if (!e)
2748
2858
  return 0;
2749
- const t = Se(this.blue, e);
2750
- return H(t);
2859
+ const t = be(this.blue, e);
2860
+ return mt(t);
2751
2861
  }
2752
2862
  scopeDepth(e) {
2753
- const t = y(e);
2863
+ const t = S(e);
2754
2864
  if (t === "/" || t.length <= 1)
2755
2865
  return 0;
2756
2866
  let n = 1;
@@ -2759,12 +2869,12 @@ class Xr {
2759
2869
  return n;
2760
2870
  }
2761
2871
  }
2762
- class ei {
2872
+ class Si {
2763
2873
  constructor(e, t) {
2764
- this.documentRef = e, this.blueRef = t, this.patchEngine = new kr(this.documentRef), this.meter = new Xr(this.blueRef);
2874
+ this.documentRef = e, this.blueRef = t, this.patchEngine = new qr(this.documentRef), this.meter = new yi(this.blueRef);
2765
2875
  }
2766
2876
  patchEngine;
2767
- emissionRegistry = new Mr();
2877
+ emissionRegistry = new Yr();
2768
2878
  meter;
2769
2879
  runTerminated = !1;
2770
2880
  document() {
@@ -2813,67 +2923,67 @@ class ei {
2813
2923
  return this.patchEngine.applyPatch(e, t);
2814
2924
  }
2815
2925
  }
2816
- const ti = m["Processing Initialized Marker"], ni = m["Document Update"];
2817
- class ri {
2926
+ const Ci = p["Core/Processing Initialized Marker"], wi = p["Core/Document Update"];
2927
+ class vi {
2818
2928
  constructor(e, t, n, r) {
2819
- this.contractLoader = e, this.registry = t, this.runtimeRef = new ei(r, n);
2820
- const s = (o) => He(this.runtimeRef.blue(), o);
2821
- this.checkpointManager = new ur(
2929
+ this.contractLoader = e, this.registry = t, this.runtimeRef = new Si(r, n);
2930
+ const o = (s) => Ye(this.runtimeRef.blue(), s);
2931
+ this.checkpointManager = new Ar(
2822
2932
  this.runtimeRef,
2823
- s
2824
- ), this.terminationService = new br(this.runtimeRef), this.channelRunner = new dr(
2933
+ o
2934
+ ), this.terminationService = new Hr(this.runtimeRef), this.channelRunner = new Dr(
2825
2935
  this.runtimeRef,
2826
2936
  this.checkpointManager,
2827
2937
  {
2828
- evaluateChannel: async (o, a, c, l) => this.evaluateChannel(o, a, c, l),
2829
- isScopeInactive: (o) => this.isScopeInactive(o),
2830
- createContext: (o, a, c, l) => this.createContext(
2831
- o,
2938
+ evaluateChannel: async (s, a, c, u) => this.evaluateChannel(s, a, c, u),
2939
+ isScopeInactive: (s) => this.isScopeInactive(s),
2940
+ createContext: (s, a, c, u) => this.createContext(
2941
+ s,
2832
2942
  a,
2833
2943
  c,
2834
- l,
2944
+ u,
2835
2945
  !1
2836
2946
  ),
2837
- shouldRunHandler: async (o, a) => {
2838
- const c = this.registry.lookupHandler(o.blueId());
2947
+ shouldRunHandler: async (s, a) => {
2948
+ const c = this.registry.lookupHandler(s.blueId());
2839
2949
  if (!c) {
2840
- const u = `No processor registered for handler contract ${o.blueId()}`;
2950
+ const d = `No processor registered for handler contract ${s.blueId()}`;
2841
2951
  throw new g(
2842
- u,
2843
- E.illegalState(u)
2952
+ d,
2953
+ E.illegalState(d)
2844
2954
  );
2845
2955
  }
2846
- const l = c.matches;
2847
- return typeof l != "function" ? !0 : await l.call(c, o.contract(), a);
2956
+ const u = c.matches;
2957
+ return typeof u != "function" ? !0 : await u.call(c, s.contract(), a);
2848
2958
  },
2849
- executeHandler: async (o, a) => this.executeHandler(o, a),
2850
- handleHandlerError: async (o, a, c) => this.handleHandlerError(o, a, c),
2851
- canonicalSignature: s,
2852
- channelProcessorFor: (o) => this.registry.lookupChannel(o) ?? null
2959
+ executeHandler: async (s, a) => this.executeHandler(s, a),
2960
+ handleHandlerError: async (s, a, c) => this.handleHandlerError(s, a, c),
2961
+ canonicalSignature: o,
2962
+ channelProcessorFor: (s) => this.registry.lookupChannel(s) ?? null
2853
2963
  }
2854
- ), this.scopeExecutor = new yr({
2964
+ ), this.scopeExecutor = new zr({
2855
2965
  runtime: this.runtimeRef,
2856
2966
  contractLoader: this.contractLoader,
2857
2967
  channelRunner: this.channelRunner,
2858
2968
  bundles: this.bundles,
2859
2969
  hooks: {
2860
- isScopeInactive: (o) => this.isScopeInactive(o),
2861
- createContext: (o, a, c, l, u) => this.createContext(
2862
- o,
2970
+ isScopeInactive: (s) => this.isScopeInactive(s),
2971
+ createContext: (s, a, c, u, d) => this.createContext(
2972
+ s,
2863
2973
  a,
2864
2974
  c,
2865
- l,
2866
- u ?? !1
2975
+ u,
2976
+ d ?? !1
2867
2977
  ),
2868
- recordLifecycleForBridging: (o, a) => this.recordLifecycleForBridging(o, a),
2869
- enterFatalTermination: (o, a, c) => this.enterFatalTermination(o, a, c ?? null),
2870
- fatalReason: (o, a) => this.fatalReason(o, a),
2871
- markCutOff: (o) => this.markCutOff(o)
2978
+ recordLifecycleForBridging: (s, a) => this.recordLifecycleForBridging(s, a),
2979
+ enterFatalTermination: (s, a, c) => this.enterFatalTermination(s, a, c ?? null),
2980
+ fatalReason: (s, a) => this.fatalReason(s, a),
2981
+ markCutOff: (s) => this.markCutOff(s)
2872
2982
  },
2873
- blueId: (o) => this.runtimeRef.blue().calculateBlueIdSync(o),
2874
- nodeAt: (o) => this.nodeAt(o),
2875
- createDocumentUpdateEvent: (o, a) => this.createDocumentUpdateEvent(o, a),
2876
- matchesDocumentUpdate: (o, a, c) => this.matchesDocumentUpdate(o, a, c)
2983
+ blueId: (s) => this.runtimeRef.blue().calculateBlueIdSync(s),
2984
+ nodeAt: (s) => this.nodeAt(s),
2985
+ createDocumentUpdateEvent: (s, a) => this.createDocumentUpdateEvent(s, a),
2986
+ matchesDocumentUpdate: (s, a, c) => this.matchesDocumentUpdate(s, a, c)
2877
2987
  });
2878
2988
  }
2879
2989
  runtimeRef;
@@ -2901,19 +3011,19 @@ class ri {
2901
3011
  r
2902
3012
  );
2903
3013
  }
2904
- createContext(e, t, n, r = !1, s = !1) {
2905
- return new ii(
3014
+ createContext(e, t, n, r = !1, o = !1) {
3015
+ return new ki(
2906
3016
  this,
2907
3017
  t,
2908
3018
  e,
2909
3019
  n.clone(),
2910
3020
  r,
2911
- s
3021
+ o
2912
3022
  );
2913
3023
  }
2914
3024
  result() {
2915
3025
  const e = this.runtimeRef.document().clone(), t = this.runtimeRef.rootEmissions().map((n) => n.clone());
2916
- return Oe.of(
3026
+ return ze.of(
2917
3027
  e,
2918
3028
  t,
2919
3029
  this.runtimeRef.totalGas()
@@ -2923,10 +3033,10 @@ class ri {
2923
3033
  return this.runtimeRef;
2924
3034
  }
2925
3035
  bundleForScope(e) {
2926
- return this.bundles.get(y(e));
3036
+ return this.bundles.get(S(e));
2927
3037
  }
2928
3038
  isScopeInactive(e) {
2929
- const t = y(e);
3039
+ const t = S(e);
2930
3040
  return this.cutOffScopes.has(t) || this.pendingTerminations.has(t) || this.runtimeRef.isScopeTerminated(t);
2931
3041
  }
2932
3042
  async enterGracefulTermination(e, t, n) {
@@ -2936,13 +3046,13 @@ class ri {
2936
3046
  await this.terminate(e, t, "FATAL", n);
2937
3047
  }
2938
3048
  recordPendingTermination(e, t, n) {
2939
- this.pendingTerminations.set(y(e), { kind: t, reason: n });
3049
+ this.pendingTerminations.set(S(e), { kind: t, reason: n });
2940
3050
  }
2941
3051
  clearPendingTermination(e) {
2942
- this.pendingTerminations.delete(y(e));
3052
+ this.pendingTerminations.delete(S(e));
2943
3053
  }
2944
3054
  async markCutOff(e) {
2945
- const t = y(e);
3055
+ const t = S(e);
2946
3056
  this.cutOffScopes.add(t) && this.runtimeRef.existingScope(t)?.markCutOff();
2947
3057
  }
2948
3058
  async deliverLifecycle(e, t, n, r) {
@@ -2957,14 +3067,14 @@ class ri {
2957
3067
  this.runtimeRef.scope(e).recordBridgeable(t.clone()), e === "/" && this.runtimeRef.recordRootEmission(t.clone());
2958
3068
  }
2959
3069
  normalizeScope(e) {
2960
- return y(e);
3070
+ return S(e);
2961
3071
  }
2962
3072
  resolvePointer(e, t) {
2963
- return w(e, t);
3073
+ return b(e, t);
2964
3074
  }
2965
3075
  async terminate(e, t, n, r) {
2966
- const s = y(e);
2967
- this.pendingTerminations.has(s) || this.runtimeRef.isScopeTerminated(s) || (this.pendingTerminations.set(s, { kind: n, reason: r }), await this.terminationService.terminateScope(
3076
+ const o = S(e);
3077
+ this.pendingTerminations.has(o) || this.runtimeRef.isScopeTerminated(o) || (this.pendingTerminations.set(o, { kind: n, reason: r }), await this.terminationService.terminateScope(
2968
3078
  this,
2969
3079
  e,
2970
3080
  t,
@@ -2973,32 +3083,32 @@ class ri {
2973
3083
  ));
2974
3084
  }
2975
3085
  nodeAt(e) {
2976
- const t = y(e);
2977
- return j.nodeAt(this.runtimeRef.document(), t, {
3086
+ const t = S(e);
3087
+ return Z.nodeAt(this.runtimeRef.document(), t, {
2978
3088
  calculateBlueId: (n) => this.runtimeRef.blue().calculateBlueIdSync(n)
2979
3089
  });
2980
3090
  }
2981
3091
  async evaluateChannel(e, t, n, r) {
2982
- const s = this.registry.lookupChannel(e.blueId());
2983
- if (!s)
3092
+ const o = this.registry.lookupChannel(e.blueId());
3093
+ if (!o)
2984
3094
  return { matches: !1 };
2985
- const o = this.runtimeRef.blue().calculateBlueIdSync(r), a = r.clone(), c = e.contract(), l = c.event;
2986
- if (l && !this.runtimeRef.blue().isTypeOfNode(a, l))
3095
+ const s = this.runtimeRef.blue().calculateBlueIdSync(r), a = r.clone(), c = e.contract(), u = c.event;
3096
+ if (u && !this.runtimeRef.blue().isTypeOfNode(a, u))
2987
3097
  return { matches: !1 };
2988
- const u = {
3098
+ const d = {
2989
3099
  scopePath: n,
2990
3100
  blue: this.runtimeRef.blue(),
2991
3101
  event: a,
2992
3102
  markers: t.markers(),
2993
3103
  bindingKey: e.key()
2994
3104
  };
2995
- if (!await s.matches(c, u))
3105
+ if (!await o.matches(c, d))
2996
3106
  return { matches: !1 };
2997
- const h = s.channelize, p = h ? h.call(s, c, u) : void 0;
3107
+ const y = o.channelize, w = y ? y.call(o, c, d) : void 0;
2998
3108
  return {
2999
3109
  matches: !0,
3000
- eventId: o,
3001
- eventNode: p ?? a.clone()
3110
+ eventId: s,
3111
+ eventNode: w ?? a.clone()
3002
3112
  };
3003
3113
  }
3004
3114
  async executeHandler(e, t) {
@@ -3018,7 +3128,7 @@ class ri {
3018
3128
  * the outer run logic can react according to spec (§22).
3019
3129
  */
3020
3130
  async handleHandlerError(e, t, n) {
3021
- if (n instanceof J || n instanceof U)
3131
+ if (n instanceof Y || n instanceof K)
3022
3132
  throw n;
3023
3133
  const r = this.fatalReason(n, "Runtime fatal");
3024
3134
  await this.enterFatalTermination(e, t, r);
@@ -3027,30 +3137,30 @@ class ri {
3027
3137
  return e instanceof Error && typeof e.message == "string" ? e.message : t;
3028
3138
  }
3029
3139
  createDocumentUpdateEvent(e, t) {
3030
- const n = xt(t, e.path), r = e.before != null ? e.before.clone() : new d().setValue(null), s = e.after != null ? e.after.clone() : new d().setValue(null), o = new d().setType(
3031
- new d().setBlueId(ni)
3140
+ const n = Dt(t, e.path), r = e.before != null ? e.before.clone() : new h().setValue(null), o = e.after != null ? e.after.clone() : new h().setValue(null), s = new h().setType(
3141
+ new h().setBlueId(wi)
3032
3142
  );
3033
- return o.setProperties({
3034
- op: new d().setValue(e.op),
3035
- path: new d().setValue(n),
3143
+ return s.setProperties({
3144
+ op: new h().setValue(e.op),
3145
+ path: new h().setValue(n),
3036
3146
  before: r,
3037
- after: s
3038
- }), o;
3147
+ after: o
3148
+ }), s;
3039
3149
  }
3040
3150
  matchesDocumentUpdate(e, t, n) {
3041
3151
  if (!t || t.length === 0)
3042
3152
  return !1;
3043
- const r = S(w(e, t)), s = S(n);
3044
- return r === "/" || s === r ? !0 : s.startsWith(`${r}/`);
3153
+ const r = T(b(e, t)), o = T(n);
3154
+ return r === "/" || o === r ? !0 : o.startsWith(`${r}/`);
3045
3155
  }
3046
3156
  }
3047
- class j {
3157
+ class Z {
3048
3158
  constructor(e, t, n) {
3049
3159
  this.contractLoader = e, this.registry = t, this.blue = n;
3050
3160
  }
3051
3161
  async initializeDocument(e) {
3052
3162
  if (this.isInitialized(e))
3053
- throw new O("Document already initialized");
3163
+ throw new L("Document already initialized");
3054
3164
  const t = this.createExecution(e.clone());
3055
3165
  return this.run(e, t, async () => {
3056
3166
  await t.initializeScope("/", !0);
@@ -3058,7 +3168,7 @@ class j {
3058
3168
  }
3059
3169
  async processDocument(e, t) {
3060
3170
  if (!this.isInitialized(e))
3061
- throw new O("Document not initialized");
3171
+ throw new L("Document not initialized");
3062
3172
  const n = this.createExecution(e.clone()), r = t.clone();
3063
3173
  return this.run(e, n, async () => {
3064
3174
  n.loadBundles("/"), await n.processExternalEvent("/", r);
@@ -3068,7 +3178,7 @@ class j {
3068
3178
  return this.initializationMarker(e) != null;
3069
3179
  }
3070
3180
  createExecution(e) {
3071
- return new ri(
3181
+ return new vi(
3072
3182
  this.contractLoader,
3073
3183
  this.registry,
3074
3184
  this.blue,
@@ -3079,12 +3189,12 @@ class j {
3079
3189
  try {
3080
3190
  await n();
3081
3191
  } catch (r) {
3082
- if (r instanceof J)
3192
+ if (r instanceof Y)
3083
3193
  return t.result();
3084
- if (r instanceof U) {
3085
- const s = e.clone();
3086
- return Oe.capabilityFailure(
3087
- s,
3194
+ if (r instanceof K) {
3195
+ const o = e.clone();
3196
+ return ze.capabilityFailure(
3197
+ o,
3088
3198
  r.message ?? null
3089
3199
  );
3090
3200
  }
@@ -3093,17 +3203,17 @@ class j {
3093
3203
  return t.result();
3094
3204
  }
3095
3205
  initializationMarker(e) {
3096
- const n = e.getProperties()?.contracts?.getProperties()?.initialized ?? null;
3206
+ const n = e.getProperties()?.[Ce.OBJECT_CONTRACTS]?.getProperties()?.initialized ?? null;
3097
3207
  if (!n)
3098
3208
  return null;
3099
- if (!(n instanceof d))
3209
+ if (!(n instanceof h))
3100
3210
  throw new g(
3101
3211
  "Initialization Marker must be a BlueNode",
3102
3212
  E.illegalState(
3103
3213
  "Initialization Marker must be a BlueNode"
3104
3214
  )
3105
3215
  );
3106
- if (n.getType()?.getBlueId() !== ti)
3216
+ if (n.getType()?.getBlueId() !== Ci)
3107
3217
  throw new g(
3108
3218
  "Initialization Marker must declare type 'Processing Initialized Marker'",
3109
3219
  E.illegalState(
@@ -3113,47 +3223,47 @@ class j {
3113
3223
  return n;
3114
3224
  }
3115
3225
  static nodeAt(e, t, n) {
3116
- if (!(e instanceof d))
3226
+ if (!(e instanceof h))
3117
3227
  return null;
3118
- const r = S(t);
3228
+ const r = T(t);
3119
3229
  if (r === "/")
3120
3230
  return e;
3121
- const s = r.slice(1).split("/");
3122
- let o = e;
3123
- for (const a of s) {
3124
- if (!o)
3231
+ const o = r.slice(1).split("/");
3232
+ let s = e;
3233
+ for (const a of o) {
3234
+ if (!s)
3125
3235
  return null;
3126
3236
  if (!a)
3127
3237
  continue;
3128
- const c = o.getItems();
3238
+ const c = s.getItems();
3129
3239
  if (c && /^\d+$/.test(a)) {
3130
3240
  const f = Number.parseInt(a, 10);
3131
- o = c[f] ?? null;
3241
+ s = c[f] ?? null;
3132
3242
  continue;
3133
3243
  }
3134
- const l = o.getProperties();
3135
- if (l && a in l) {
3136
- const f = l[a];
3137
- if (!(f instanceof d))
3244
+ const u = s.getProperties();
3245
+ if (u && a in u) {
3246
+ const f = u[a];
3247
+ if (!(f instanceof h))
3138
3248
  return null;
3139
- o = f;
3249
+ s = f;
3140
3250
  continue;
3141
3251
  }
3142
- const u = this.specialSegmentNode(o, a, n);
3143
- if (u !== void 0) {
3144
- o = u;
3252
+ const d = this.specialSegmentNode(s, a, n);
3253
+ if (d !== void 0) {
3254
+ s = d;
3145
3255
  continue;
3146
3256
  }
3147
3257
  return null;
3148
3258
  }
3149
- return o;
3259
+ return s;
3150
3260
  }
3151
3261
  static specialSegmentNode(e, t, n) {
3152
3262
  switch (t) {
3153
3263
  case "name":
3154
- return new d().setValue(e.getName() ?? null);
3264
+ return new h().setValue(e.getName() ?? null);
3155
3265
  case "description":
3156
- return new d().setValue(e.getDescription() ?? null);
3266
+ return new h().setValue(e.getDescription() ?? null);
3157
3267
  case "type":
3158
3268
  return e.getType() ?? null;
3159
3269
  case "itemType":
@@ -3163,23 +3273,23 @@ class j {
3163
3273
  case "valueType":
3164
3274
  return e.getValueType() ?? null;
3165
3275
  case "value":
3166
- return new d().setValue(e.getValue() ?? null);
3276
+ return new h().setValue(e.getValue() ?? null);
3167
3277
  case "blue":
3168
3278
  return e.getBlue() ?? null;
3169
- case "contracts":
3170
- return new d().setContracts(e.getContracts());
3279
+ case Ce.OBJECT_CONTRACTS:
3280
+ return new h().setContracts(e.getContracts());
3171
3281
  case "blueId": {
3172
- const r = e.getBlueId() ?? n?.calculateBlueId?.(e) ?? Et.calculateBlueIdSync(e);
3173
- return new d().setValue(r ?? null);
3282
+ const r = e.getBlueId() ?? n?.calculateBlueId?.(e) ?? vt.calculateBlueIdSync(e);
3283
+ return new h().setValue(r ?? null);
3174
3284
  }
3175
3285
  default:
3176
3286
  return;
3177
3287
  }
3178
3288
  }
3179
3289
  }
3180
- class ii {
3181
- constructor(e, t, n, r, s, o) {
3182
- this.execution = e, this.bundle = t, this.scopePathValue = n, this.eventNode = r, this.allowTerminatedWork = s, this.allowReservedMutation = o;
3290
+ class ki {
3291
+ constructor(e, t, n, r, o, s) {
3292
+ this.execution = e, this.bundle = t, this.scopePathValue = n, this.eventNode = r, this.allowTerminatedWork = o, this.allowReservedMutation = s;
3183
3293
  }
3184
3294
  get scopePath() {
3185
3295
  return this.scopePathValue;
@@ -3232,7 +3342,7 @@ class ii {
3232
3342
  if (!e)
3233
3343
  return !1;
3234
3344
  try {
3235
- return j.nodeAt(
3345
+ return Z.nodeAt(
3236
3346
  this.execution.runtime().document(),
3237
3347
  e,
3238
3348
  {
@@ -3244,14 +3354,14 @@ class ii {
3244
3354
  }
3245
3355
  }
3246
3356
  documentNodeAt(e) {
3247
- const t = j.nodeAt(
3357
+ const t = Z.nodeAt(
3248
3358
  this.execution.runtime().document(),
3249
3359
  e,
3250
3360
  {
3251
3361
  calculateBlueId: (n) => this.execution.runtime().blue().calculateBlueIdSync(n)
3252
3362
  }
3253
3363
  );
3254
- return t instanceof d ? t : null;
3364
+ return t instanceof h ? t : null;
3255
3365
  }
3256
3366
  async terminateGracefully(e) {
3257
3367
  await this.execution.enterGracefulTermination(
@@ -3271,16 +3381,16 @@ class ii {
3271
3381
  return !this.allowTerminatedWork && this.execution.isScopeInactive(this.scopePathValue);
3272
3382
  }
3273
3383
  }
3274
- const si = new yt({
3275
- repositories: [pt, Ct, Nt]
3384
+ const bi = new kt({
3385
+ repositories: [bt]
3276
3386
  });
3277
- class oi {
3387
+ class Ii {
3278
3388
  blue;
3279
3389
  registryRef;
3280
3390
  contractLoaderRef;
3281
3391
  engine;
3282
3392
  constructor(e) {
3283
- this.registryRef = e?.registry ?? Y.create().registerDefaults().build(), this.blue = e?.blue ?? si, this.contractLoaderRef = new sr(this.registryRef, this.blue), this.engine = new j(
3393
+ this.registryRef = e?.registry ?? re.create().registerDefaults().build(), this.blue = e?.blue ?? bi, this.contractLoaderRef = new Rr(this.registryRef, this.blue), this.engine = new Z(
3284
3394
  this.contractLoaderRef,
3285
3395
  this.registryRef,
3286
3396
  this.blue
@@ -3313,14 +3423,14 @@ class oi {
3313
3423
  return this.contractLoaderRef;
3314
3424
  }
3315
3425
  static builder() {
3316
- return new ai();
3426
+ return new Ti();
3317
3427
  }
3318
3428
  }
3319
- class ai {
3429
+ class Ti {
3320
3430
  contractRegistry;
3321
3431
  blueInstance;
3322
3432
  constructor() {
3323
- this.contractRegistry = Y.create().registerDefaults().build();
3433
+ this.contractRegistry = re.create().registerDefaults().build();
3324
3434
  }
3325
3435
  withRegistry(e) {
3326
3436
  return this.contractRegistry = e, this;
@@ -3332,16 +3442,16 @@ class ai {
3332
3442
  return this.blueInstance = e, this;
3333
3443
  }
3334
3444
  build() {
3335
- return new oi({
3445
+ return new Ii({
3336
3446
  registry: this.contractRegistry,
3337
3447
  blue: this.blueInstance
3338
3448
  });
3339
3449
  }
3340
3450
  }
3341
- class tt {
3451
+ class ft {
3342
3452
  process(e, t) {
3343
3453
  const n = t.getValue();
3344
- if (G(n)) {
3454
+ if (Q(n)) {
3345
3455
  const r = t.clone();
3346
3456
  return r.setValue(n), r.setProperties(void 0), r.setItems(void 0), r.setType(void 0), r;
3347
3457
  }
@@ -3352,123 +3462,123 @@ class tt {
3352
3462
  */
3353
3463
  postProcess(e, t) {
3354
3464
  const n = t.getValue();
3355
- if (G(n) && e.getValue() !== n && n !== void 0) {
3465
+ if (Q(n) && e.getValue() !== n && n !== void 0) {
3356
3466
  const r = e.clone();
3357
3467
  return r.setValue(n), r;
3358
3468
  }
3359
3469
  return e;
3360
3470
  }
3361
3471
  }
3362
- const Ni = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3472
+ const Ji = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3363
3473
  __proto__: null,
3364
- ExpressionPreserver: tt
3474
+ ExpressionPreserver: ft
3365
3475
  }, Symbol.toStringTag, { value: "Module" }));
3366
- function Mi() {
3367
- return new P.SequentialMergingProcessor([
3368
- new P.ValuePropagator(),
3369
- new tt(),
3370
- new P.TypeAssigner(),
3371
- new P.ListProcessor(),
3372
- new P.DictionaryProcessor(),
3373
- new P.BasicTypesVerifier()
3476
+ function ji() {
3477
+ return new D.SequentialMergingProcessor([
3478
+ new D.ValuePropagator(),
3479
+ new ft(),
3480
+ new D.TypeAssigner(),
3481
+ new D.ListProcessor(),
3482
+ new D.DictionaryProcessor(),
3483
+ new D.BasicTypesVerifier()
3374
3484
  ]);
3375
3485
  }
3376
3486
  export {
3377
- Vn as ChannelBinding,
3378
- dr as ChannelRunner,
3379
- ur as CheckpointManager,
3380
- lr as CheckpointRecord,
3381
- We as CodeBlockEvaluationError,
3382
- A as ContractBundle,
3383
- Kn as ContractBundleBuilder,
3384
- sr as ContractLoader,
3385
- Cn as ContractProcessorRegistry,
3386
- Y as ContractProcessorRegistryBuilder,
3387
- Oe as DocumentProcessingResult,
3388
- ei as DocumentProcessingRuntime,
3389
- oi as DocumentProcessor,
3390
- ai as DocumentProcessorBuilder,
3391
- Mr as EmissionRegistry,
3392
- Xr as GasMeter,
3393
- Hn as HandlerBinding,
3394
- T as KEY_CHECKPOINT,
3395
- Ae as KEY_EMBEDDED,
3396
- De as KEY_INITIALIZED,
3397
- Be as KEY_TERMINATED,
3398
- Ni as MergingProcessors,
3399
- _e as PROCESSOR_MANAGED_CHANNEL_BLUE_IDS,
3400
- kr as PatchEngine,
3401
- vi as ProcessorContractConstants,
3402
- j as ProcessorEngine,
3487
+ ur as ChannelBinding,
3488
+ Dr as ChannelRunner,
3489
+ Ar as CheckpointManager,
3490
+ Nr as CheckpointRecord,
3491
+ tt as CodeBlockEvaluationError,
3492
+ _ as ContractBundle,
3493
+ hr as ContractBundleBuilder,
3494
+ Rr as ContractLoader,
3495
+ $n as ContractProcessorRegistry,
3496
+ re as ContractProcessorRegistryBuilder,
3497
+ ze as DocumentProcessingResult,
3498
+ Si as DocumentProcessingRuntime,
3499
+ Ii as DocumentProcessor,
3500
+ Ti as DocumentProcessorBuilder,
3501
+ Yr as EmissionRegistry,
3502
+ yi as GasMeter,
3503
+ dr as HandlerBinding,
3504
+ A as KEY_CHECKPOINT,
3505
+ $e as KEY_EMBEDDED,
3506
+ Ve as KEY_INITIALIZED,
3507
+ He as KEY_TERMINATED,
3508
+ Ji as MergingProcessors,
3509
+ We as PROCESSOR_MANAGED_CHANNEL_BLUE_IDS,
3510
+ qr as PatchEngine,
3511
+ Hi as ProcessorContractConstants,
3512
+ Z as ProcessorEngine,
3403
3513
  E as ProcessorErrors,
3404
- ri as ProcessorExecution,
3405
- ii as ProcessorExecutionContext,
3514
+ vi as ProcessorExecution,
3515
+ ki as ProcessorExecutionContext,
3406
3516
  g as ProcessorFatalError,
3407
- ki as ProcessorPointerConstants,
3408
- ce as QuickJSEvaluator,
3409
- $e as RELATIVE_CHECKPOINT,
3410
- B as RELATIVE_CONTRACTS,
3411
- $t as RELATIVE_EMBEDDED,
3412
- ie as RELATIVE_INITIALIZED,
3413
- Le as RELATIVE_TERMINATED,
3414
- oe as RESERVED_CONTRACT_KEYS,
3415
- J as RunTerminationError,
3416
- yr as ScopeExecutor,
3417
- Nr as ScopeRuntimeContext,
3418
- br as TerminationService,
3419
- Si as andThen,
3420
- He as canonicalSignature,
3421
- Se as canonicalSize,
3422
- _ as channelContractBaseSchema,
3423
- ln as channelEventCheckpointSchema,
3424
- Zt as containsExpression,
3425
- le as contractBaseSchema,
3426
- Mi as createDefaultMergingProcessor,
3427
- je as createPicomatchShouldResolve,
3428
- pn as documentAnchorsMarkerSchema,
3429
- mn as documentLinksMarkerSchema,
3430
- nn as documentUpdateChannelSchema,
3431
- rn as embeddedNodeChannelSchema,
3432
- Ot as err,
3433
- Je as evaluateQuickJSExpression,
3434
- Xt as extractExpressionContent,
3435
- Qe as handlerContractBaseSchema,
3436
- un as initializationMarkerSchema,
3437
- Ei as isErr,
3438
- G as isExpression,
3439
- gi as isOk,
3440
- ae as isProcessorManagedChannelBlueId,
3441
- Lt as isReservedContractKey,
3442
- Ti as joinRelativePointers,
3443
- Ri as jsonPatchSchema,
3444
- sn as lifecycleChannelSchema,
3445
- yi as map,
3446
- wi as mapErr,
3447
- C as markerContractBaseSchema,
3448
- Ii as match,
3449
- gn as myosParticipantsOrchestrationMarkerSchema,
3450
- En as myosSessionInteractionMarkerSchema,
3451
- cn as myosTimelineChannelSchema,
3452
- yn as myosWorkerAgencyMarkerSchema,
3453
- S as normalizePointer,
3454
- y as normalizeScope,
3455
- Mt as ok,
3456
- fn as operationMarkerSchema,
3457
- dn as processEmbeddedMarkerSchema,
3458
- hn as processingTerminatedMarkerSchema,
3459
- ze as relativeCheckpointLastEvent,
3460
- Ue as relativeCheckpointLastSignature,
3461
- Q as relativeContractsEntry,
3462
- xt as relativizePointer,
3463
- q as resolveNodeExpressions,
3464
- w as resolvePointer,
3465
- en as resolveTemplateString,
3466
- Sn as sequentialWorkflowOperationSchema,
3467
- wn as sequentialWorkflowSchema,
3468
- Pi as sequentialWorkflowStepSchema,
3469
- ye as stripSlashes,
3470
- an as timelineChannelSchema,
3471
- on as triggeredEventChannelSchema,
3472
- bi as unwrapOr,
3473
- Ci as unwrapOrElse
3517
+ Wi as ProcessorPointerConstants,
3518
+ ge as QuickJSEvaluator,
3519
+ Ke as RELATIVE_CHECKPOINT,
3520
+ F as RELATIVE_CONTRACTS,
3521
+ At as RELATIVE_EMBEDDED,
3522
+ ue as RELATIVE_INITIALIZED,
3523
+ Ge as RELATIVE_TERMINATED,
3524
+ me as RESERVED_CONTRACT_KEYS,
3525
+ Y as RunTerminationError,
3526
+ zr as ScopeExecutor,
3527
+ Xr as ScopeRuntimeContext,
3528
+ Hr as TerminationService,
3529
+ Ui as andThen,
3530
+ Ye as canonicalSignature,
3531
+ be as canonicalSize,
3532
+ z as channelContractBaseSchema,
3533
+ En as channelEventCheckpointSchema,
3534
+ en as containsExpression,
3535
+ Ee as contractBaseSchema,
3536
+ ji as createDefaultMergingProcessor,
3537
+ it as createPicomatchShouldResolve,
3538
+ Rn as documentAnchorsMarkerSchema,
3539
+ On as documentLinksMarkerSchema,
3540
+ sn as documentUpdateChannelSchema,
3541
+ cn as embeddedNodeChannelSchema,
3542
+ Tt as err,
3543
+ rt as evaluateQuickJSExpression,
3544
+ tn as extractExpressionContent,
3545
+ st as handlerContractBaseSchema,
3546
+ Sn as initializationMarkerSchema,
3547
+ Li as isErr,
3548
+ Q as isExpression,
3549
+ Bi as isOk,
3550
+ fe as isProcessorManagedChannelBlueId,
3551
+ Nt as isReservedContractKey,
3552
+ Gi as joinRelativePointers,
3553
+ Ki as jsonPatchSchema,
3554
+ un as lifecycleChannelSchema,
3555
+ _i as map,
3556
+ Fi as mapErr,
3557
+ M as markerContractBaseSchema,
3558
+ Vi as match,
3559
+ An as myosParticipantsOrchestrationMarkerSchema,
3560
+ xn as myosSessionInteractionMarkerSchema,
3561
+ fn as myosTimelineChannelSchema,
3562
+ Ln as myosWorkerAgencyMarkerSchema,
3563
+ T as normalizePointer,
3564
+ S as normalizeScope,
3565
+ It as ok,
3566
+ bn as operationMarkerSchema,
3567
+ wn as processEmbeddedMarkerSchema,
3568
+ kn as processingTerminatedMarkerSchema,
3569
+ je as relativeCheckpointLastEvent,
3570
+ Qe as relativeCheckpointLastSignature,
3571
+ ee as relativeContractsEntry,
3572
+ Dt as relativizePointer,
3573
+ X as resolveNodeExpressions,
3574
+ b as resolvePointer,
3575
+ nn as resolveTemplateString,
3576
+ Un as sequentialWorkflowOperationSchema,
3577
+ _n as sequentialWorkflowSchema,
3578
+ qi as sequentialWorkflowStepSchema,
3579
+ ve as stripSlashes,
3580
+ pn as timelineChannelSchema,
3581
+ hn as triggeredEventChannelSchema,
3582
+ zi as unwrapOr,
3583
+ $i as unwrapOrElse
3474
3584
  };