@milaboratories/pl-middle-layer 1.15.4 → 1.15.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,69 +1,70 @@
1
- var Qt = Object.defineProperty;
2
- var Zt = (s, e, t) => e in s ? Qt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var p = (s, e, t) => Zt(s, typeof e != "symbol" ? e + "" : e, t);
4
- import { mapValueInVOE as vt, executePSpecPredicate as Xt, mapPObjectData as Q, mapPTableDef as yt, extractConfig as he, isConfigLambda as bt, DefaultNavigationState as er } from "@platforma-sdk/model";
1
+ var Zt = Object.defineProperty;
2
+ var Xt = (s, e, t) => e in s ? Zt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var p = (s, e, t) => Xt(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { mapValueInVOE as yt, executePSpecPredicate as er, mapPObjectData as X, mapPTableDef as bt, extractConfig as ve, isConfigLambda as wt, DefaultNavigationState as tr } from "@platforma-sdk/model";
5
5
  export * from "@platforma-sdk/model";
6
- import { blockPackIdEquals as be } from "@milaboratories/pl-model-middle-layer";
6
+ import { blockPackIdEquals as ke } from "@milaboratories/pl-model-middle-layer";
7
7
  export * from "@milaboratories/pl-model-middle-layer";
8
- import { request as U, RetryAgent as tr } from "undici";
9
- import { RegistryV1 as W, tryLoadPackDescription as Fe, BlockPackMetaEmbedAbsoluteBytes as rr, RegistryV2Reader as or, folderReaderByUrl as sr, loadPackDescription as Qe } from "@platforma-sdk/block-tools";
8
+ import { request as K, RetryAgent as rr } from "undici";
9
+ import { RegistryV1 as W, tryLoadPackDescription as Be, BlockPackMetaEmbedAbsoluteBytes as or, RegistryV2Reader as sr, folderReaderByUrl as ir, loadPackDescription as Ze } from "@platforma-sdk/block-tools";
10
10
  import E from "node:fs";
11
11
  import x from "node:path";
12
12
  import nr from "yaml";
13
- import { assertNever as D, notEmpty as C, ConsoleLoggerAdapter as ir, ConcurrencyLimitingExecutor as ar, HmacSha256Signer as wt } from "@milaboratories/ts-helpers";
14
- import * as St from "node:fs/promises";
15
- import { tryResolve as cr } from "@milaboratories/resolve-helper";
16
- import { resourceTypesEqual as G, field as w, Pl as b, PlClient as ur, isNullResourceId as le, ensureResourceIdNotNull as Be, isResource as lr, isResourceRef as dr, isNotNullResourceId as Ze, resourceType as se, resourceTypeToString as pr, resourceIdToString as kt, isNotFoundError as gr, isTimeoutOrCancelError as hr, toGlobalResourceId as fr, plAddressToConfig as mr, UnauthenticatedPlClient as Xe } from "@milaboratories/pl-client";
13
+ import { assertNever as D, notEmpty as C, ConsoleLoggerAdapter as ar, ConcurrencyLimitingExecutor as cr, HmacSha256Signer as St } from "@milaboratories/ts-helpers";
14
+ import * as kt from "node:fs/promises";
15
+ import { tryResolve as ur } from "@milaboratories/resolve-helper";
16
+ import { resourceTypesEqual as G, field as w, Pl as b, PlClient as lr, isNullResourceId as ge, ensureResourceIdNotNull as Oe, isResource as dr, isResourceRef as pr, isNotNullResourceId as Xe, resourceType as ae, resourceTypeToString as gr, resourceIdToString as Ct, isNotFoundError as hr, isTimeoutOrCancelError as fr, toGlobalResourceId as mr, plAddressToConfig as vr, UnauthenticatedPlClient as et } from "@milaboratories/pl-client";
17
17
  export * from "@milaboratories/pl-client";
18
- import { SynchronizedTreeState as Ct, PlError as vr } from "@milaboratories/pl-tree";
19
- import { Computable as R, ChangeSource as et, PollComputablePool as yr, WatchableValue as br } from "@milaboratories/computable";
20
- import { randomUUID as te, createHash as fe } from "node:crypto";
21
- import Pt from "denque";
22
- import { Templates as wr } from "@platforma-sdk/workflow-tengo";
23
- import Le from "canonicalize";
24
- import Sr from "node:assert";
25
- import { Scope as Oe, getQuickJS as kr } from "quickjs-emscripten";
26
- import { setTimeout as Rt } from "node:timers/promises";
27
- import { createDownloadClient as Cr, createLogsClient as Pr, createUploadBlobClient as Rr, createUploadProgressClient as Fr, DownloadDriver as Br, UploadDriver as Or, LogsStreamDriver as Dr, LogsDriver as xr, LsDriver as Tr, DownloadUrlDriver as jr } from "@milaboratories/pl-drivers";
28
- import { PFrame as Ar } from "@milaboratories/pframes-node";
29
- import { LRUCache as Er } from "lru-cache";
30
- async function tt(s) {
18
+ import { SynchronizedTreeState as Pt, PlError as yr } from "@milaboratories/pl-tree";
19
+ import { Computable as R, ChangeSource as tt, PollComputablePool as br, WatchableValue as wr } from "@milaboratories/computable";
20
+ import { randomUUID as se, createHash as ye } from "node:crypto";
21
+ import Rt from "denque";
22
+ import { Templates as Sr } from "@platforma-sdk/workflow-tengo";
23
+ import Je from "canonicalize";
24
+ import kr from "node:assert";
25
+ import { Scope as De, getQuickJS as Cr } from "quickjs-emscripten";
26
+ import { setTimeout as Ft } from "node:timers/promises";
27
+ import { createDownloadClient as Pr, createLogsClient as Rr, createUploadBlobClient as Fr, createUploadProgressClient as Br, DownloadDriver as Or, UploadDriver as Dr, LogsStreamDriver as xr, LogsDriver as Ar, LsDriver as jr, DownloadUrlDriver as Tr } from "@milaboratories/pl-drivers";
28
+ import { PFrame as Er } from "@milaboratories/pframes-node";
29
+ import { LRUCache as Ir } from "lru-cache";
30
+ import { channel as Nr } from "node:diagnostics_channel";
31
+ async function rt(s) {
31
32
  try {
32
- return await St.stat(s, { bigint: !0 });
33
+ return await kt.stat(s, { bigint: !0 });
33
34
  } catch (e) {
34
35
  if (e.code === "ENOENT")
35
36
  return;
36
37
  throw e;
37
38
  }
38
39
  }
39
- const Ir = [W.PlPackageYamlConfigFile], Vr = [W.PlPackageJsonConfigFile], Je = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Me = ["config", "dist", "config.json"], Ft = ["frontend", "dist"], rt = "block-model/dist/config.json", Nr = "block-ui/package.json", Lr = [
40
- Je,
40
+ const Vr = [W.PlPackageYamlConfigFile], Lr = [W.PlPackageJsonConfigFile], Ue = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Me = ["config", "dist", "config.json"], Bt = ["frontend", "dist"], ot = "block-model/dist/config.json", Jr = "block-ui/package.json", Ur = [
41
+ Ue,
41
42
  Me,
42
- Ir,
43
43
  Vr,
44
- Ft
44
+ Lr,
45
+ Bt
45
46
  ];
46
- async function Jr(s) {
47
- return await tt(x.join(s, ...Me)) !== void 0 || await tt(x.join(s, ...Je)) !== void 0;
47
+ async function Mr(s) {
48
+ return await rt(x.join(s, ...Me)) !== void 0 || await rt(x.join(s, ...Ue)) !== void 0;
48
49
  }
49
- function we(s, e) {
50
- const t = cr(s, e);
50
+ function Ce(s, e) {
51
+ const t = ur(s, e);
51
52
  if (t === void 0) throw new Error(`Can't resolve ${e} against ${s}`);
52
53
  return t;
53
54
  }
54
- async function ot(s, e) {
55
- if (x.isAbsolute(s) || (s = x.resolve(s)), await Jr(s))
55
+ async function st(s, e) {
56
+ if (x.isAbsolute(s) || (s = x.resolve(s)), await Mr(s))
56
57
  return {
57
- workflow: x.join(s, ...Je),
58
+ workflow: x.join(s, ...Ue),
58
59
  config: x.join(s, ...Me),
59
- ui: x.join(s, ...Ft)
60
+ ui: x.join(s, ...Bt)
60
61
  };
61
62
  {
62
- const t = we(s, rt), r = we(s, rt), o = we(s, Nr);
63
+ const t = Ce(s, ot), r = Ce(s, ot), o = Ce(s, Jr);
63
64
  return { workflow: t, config: r, ui: x.resolve(o, "..", "dist") };
64
65
  }
65
66
  }
66
- async function Mr(s) {
67
+ async function $r(s) {
67
68
  try {
68
69
  return await E.promises.readFile(s, "utf8");
69
70
  } catch (e) {
@@ -72,7 +73,7 @@ async function Mr(s) {
72
73
  throw e;
73
74
  }
74
75
  }
75
- async function Ur(s) {
76
+ async function Kr(s) {
76
77
  try {
77
78
  return await E.promises.stat(s, { bigint: !0 });
78
79
  } catch (e) {
@@ -81,21 +82,21 @@ async function Ur(s) {
81
82
  throw e;
82
83
  }
83
84
  }
84
- async function Bt(s) {
85
+ async function Ot(s) {
85
86
  let e = 0n;
86
- for (const t of Lr) {
87
- const r = x.join(s, ...t), o = await Ur(r);
87
+ for (const t of Ur) {
88
+ const r = x.join(s, ...t), o = await Kr(r);
88
89
  o !== void 0 && e < o.mtimeNs && (e = o.mtimeNs);
89
90
  }
90
91
  return e.toString();
91
92
  }
92
- async function Ue(s) {
93
+ async function $e(s) {
93
94
  const e = await E.promises.stat(s.components.workflow.main.file, {
94
95
  bigint: !0
95
96
  }), t = await E.promises.stat(s.components.model.file, { bigint: !0 });
96
97
  return (e.mtimeNs > t.mtimeNs ? e.mtimeNs : t.mtimeNs).toString();
97
98
  }
98
- class mn {
99
+ class bi {
99
100
  constructor(e, t, r) {
100
101
  this.v2Provider = e, this.registries = t, this.http = r;
101
102
  }
@@ -103,11 +104,11 @@ class mn {
103
104
  const t = [], r = e.spec;
104
105
  switch (r.type) {
105
106
  case "remote-v1":
106
- const o = this.http !== void 0 ? { dispatcher: this.http } : {}, i = await (await U(
107
+ const o = this.http !== void 0 ? { dispatcher: this.http } : {}, n = await (await K(
107
108
  `${r.url}/${W.GlobalOverviewPath}`,
108
109
  o
109
110
  )).body.json();
110
- for (const a of i) {
111
+ for (const a of n) {
111
112
  const { organization: c, package: u, latestMeta: l, latestVersion: d } = a, g = {
112
113
  organization: c,
113
114
  name: u,
@@ -141,11 +142,11 @@ class mn {
141
142
  case "local-dev":
142
143
  for (const a of await E.promises.readdir(r.path, { withFileTypes: !0 })) {
143
144
  if (!a.isDirectory()) continue;
144
- const c = x.join(r.path, a.name), u = await Mr(
145
+ const c = x.join(r.path, a.name), u = await $r(
145
146
  x.join(c, W.PlPackageYamlConfigFile)
146
147
  );
147
148
  if (u !== void 0) {
148
- const l = W.PlPackageConfigData.parse(nr.parse(u)), d = await Bt(c), g = {
149
+ const l = W.PlPackageConfigData.parse(nr.parse(u)), d = await Ot(c), g = {
149
150
  organization: l.organization,
150
151
  name: l.package,
151
152
  version: "DEV"
@@ -169,17 +170,17 @@ class mn {
169
170
  otherVersions: []
170
171
  });
171
172
  } else {
172
- let l = c, d = await Fe(l);
173
+ let l = c, d = await Be(l);
173
174
  if (d === void 0) {
174
175
  for (const g of ["block", "meta"])
175
- if (l = x.join(c, g), d = await Fe(l), d !== void 0) break;
176
+ if (l = x.join(c, g), d = await Be(l), d !== void 0) break;
176
177
  }
177
178
  if (d !== void 0) {
178
- const g = await Ue(d);
179
+ const g = await $e(d);
179
180
  t.push({
180
181
  registryId: e.id,
181
182
  id: d.id,
182
- meta: await rr.parseAsync(d.meta),
183
+ meta: await or.parseAsync(d.meta),
183
184
  spec: {
184
185
  type: "dev-v2",
185
186
  folder: l,
@@ -202,7 +203,7 @@ class mn {
202
203
  return { registries: t, blockPacks: e };
203
204
  }
204
205
  }
205
- class $r {
206
+ class Gr {
206
207
  constructor(e) {
207
208
  p(this, "registries", /* @__PURE__ */ new Map());
208
209
  this.http = e;
@@ -210,73 +211,73 @@ class $r {
210
211
  getRegistry(e) {
211
212
  const t = this.registries.get(e);
212
213
  if (t) return t;
213
- const r = new or(sr(e, this.http));
214
+ const r = new sr(ir(e, this.http));
214
215
  return this.registries.set(e, r), r;
215
216
  }
216
217
  }
217
- const vn = {
218
+ const wi = {
218
219
  type: "remote-v2",
219
220
  url: "https://blocks.pl-open.science/"
220
- }, yn = {
221
+ }, Si = {
221
222
  type: "remote-v1",
222
223
  url: "https://block.registry.platforma.bio/releases"
223
- }, bn = {
224
+ }, ki = {
224
225
  type: "remote-v1",
225
226
  url: "https://block.registry.platforma.bio/dev"
226
- }, Kr = {
227
+ }, _r = {
227
228
  groups: [{ id: "default", label: "Default", blocks: [] }]
228
- }, Gr = {
229
+ }, Hr = {
229
230
  stagingRefreshTimestamp: 0,
230
231
  blocksInLimbo: []
231
- }, _r = {
232
+ }, Wr = {
232
233
  label: "New Project"
233
- }, Hr = { name: "UserProject", version: "2" }, Ot = "SchemaVersion", Dt = "1", $e = "ProjectCreated", re = "ProjectLastModified", oe = "ProjectMeta", z = "ProjectStructure", de = "BlockRenderingState", Wr = "BlockFrontendState/", zr = /^BlockFrontendState\/(?<blockid>.*)$/;
234
- function De(s) {
235
- return `${Wr}${s}`;
236
- }
237
- const Yr = "BlockArgsAuthor/";
234
+ }, zr = { name: "UserProject", version: "2" }, Dt = "SchemaVersion", xt = "1", Ke = "ProjectCreated", ie = "ProjectLastModified", ne = "ProjectMeta", z = "ProjectStructure", he = "BlockRenderingState", qr = "BlockFrontendState/", Yr = /^BlockFrontendState\/(?<blockid>.*)$/;
238
235
  function xe(s) {
239
- return `${Yr}${s}`;
236
+ return `${qr}${s}`;
237
+ }
238
+ const Qr = "BlockArgsAuthor/";
239
+ function Ae(s) {
240
+ return `${Qr}${s}`;
240
241
  }
241
- const Te = "ProjectStructureAuthor";
242
- function qr(s) {
243
- const e = s.match(zr);
242
+ const je = "ProjectStructureAuthor";
243
+ function Zr(s) {
244
+ const e = s.match(Yr);
244
245
  if (e !== null)
245
246
  return e.groups.blockid;
246
247
  }
247
- const Qr = "__serviceTemplate_";
248
- function je(s) {
249
- return `${Qr}${s}`;
248
+ const Xr = "__serviceTemplate_";
249
+ function Te(s) {
250
+ return `${Xr}${s}`;
250
251
  }
251
252
  function P(s, e) {
252
253
  return `${s}-${e}`;
253
254
  }
254
- const Zr = /^(?<blockId>.*)-(?<fieldName>blockPack|prodArgs|currentArgs|prodCtx|prodUiCtx|prodOutput|prodCtxPrevious|prodUiCtxPrevious|prodOutputPrevious|stagingCtx|stagingUiCtx|stagingOutput|stagingCtxPrevious|stagingUiCtxPrevious|stagingOutputPrevious)$/;
255
- function Xr(s) {
256
- const e = s.match(Zr);
255
+ const eo = /^(?<blockId>.*)-(?<fieldName>blockPack|prodArgs|currentArgs|prodCtx|prodUiCtx|prodOutput|prodCtxPrevious|prodUiCtxPrevious|prodOutputPrevious|stagingCtx|stagingUiCtx|stagingOutput|stagingCtxPrevious|stagingUiCtxPrevious|stagingOutputPrevious)$/;
256
+ function to(s) {
257
+ const e = s.match(eo);
257
258
  if (e === null) return;
258
259
  const { blockId: t, fieldName: r } = e.groups;
259
260
  return { blockId: t, fieldName: r };
260
261
  }
261
- const eo = "projects", xt = { name: "Projects", version: "1" }, to = (s) => G(s.type, xt) ? s.fields : [];
262
- async function ro(s, e, t, r) {
263
- const o = await Ct.init(
262
+ const ro = "projects", At = { name: "Projects", version: "1" }, oo = (s) => G(s.type, At) ? s.fields : [];
263
+ async function so(s, e, t, r) {
264
+ const o = await Pt.init(
264
265
  s,
265
266
  e,
266
267
  {
267
268
  ...r.ops.defaultTreeOptions,
268
- pruning: to
269
+ pruning: oo
269
270
  },
270
271
  r.logger
271
272
  );
272
- return { computable: R.make((i) => {
273
- const a = i.accessor(o.entry()).node(), c = t.getValue(i);
273
+ return { computable: R.make((n) => {
274
+ const a = n.accessor(o.entry()).node(), c = t.getValue(n);
274
275
  if (a === void 0) return;
275
276
  const u = [];
276
277
  for (const l of a.listDynamicFields()) {
277
278
  const d = a.traverse(l);
278
279
  if (d === void 0) continue;
279
- const g = C(d.getKeyValueAsJson(oe)), f = C(d.getKeyValueAsJson($e)), v = C(d.getKeyValueAsJson(re));
280
+ const g = C(d.getKeyValueAsJson(ne)), f = C(d.getKeyValueAsJson(Ke)), v = C(d.getKeyValueAsJson(ie));
280
281
  u.push({
281
282
  id: l,
282
283
  rid: d.id,
@@ -289,40 +290,40 @@ async function ro(s, e, t, r) {
289
290
  return u.sort((l) => -l.lastModified.valueOf()), u;
290
291
  }).withStableType(), tree: o };
291
292
  }
292
- const oo = {
293
+ const io = {
293
294
  name: "EphRenderTemplate",
294
295
  version: "1"
295
- }, so = {
296
+ }, no = {
296
297
  name: "RenderTemplate",
297
298
  version: "1"
298
299
  };
299
- function Tt(s, e, t, r, o) {
300
+ function jt(s, e, t, r, o) {
300
301
  if (o.length === 0) throw new Error("Zero output names provided");
301
- const n = t ? s.createEphemeral(oo) : s.createStruct(so), i = w(n, "template"), a = w(n, "inputs");
302
- return s.createField(i, "Input", e), s.createField(a, "Input", b.createPlMap(s, r, t)), s.lockInputs(n), b.futureRecord(s, n, o, "Output", "outputs/");
302
+ const i = t ? s.createEphemeral(io) : s.createStruct(no), n = w(i, "template"), a = w(i, "inputs");
303
+ return s.createField(n, "Input", e), s.createField(a, "Input", b.createPlMap(s, r, t)), s.lockInputs(i), b.futureRecord(s, i, o, "Output", "outputs/");
303
304
  }
304
- const no = { name: "BContextEnd", version: "1" }, io = { name: "BContext", version: "1" }, ao = "id", co = "parent/", uo = ["context", "result"];
305
- function st(s, e, t) {
306
- return Tt(s, e, !0, t, uo);
305
+ const ao = { name: "BContextEnd", version: "1" }, co = { name: "BContext", version: "1" }, uo = "id", lo = "parent/", po = ["context", "result"];
306
+ function it(s, e, t) {
307
+ return jt(s, e, !0, t, po);
307
308
  }
308
- function lo(s) {
309
- const e = s.createEphemeral(no);
309
+ function go(s) {
310
+ const e = s.createEphemeral(ao);
310
311
  return s.lock(e), e;
311
312
  }
312
- function po(s, e) {
313
- if (e.length === 0) return lo(s);
313
+ function ho(s, e) {
314
+ if (e.length === 0) return go(s);
314
315
  if (e.length === 1) return e[0];
315
- const t = s.createEphemeral(io);
316
- s.createField(w(t, ao), "Input", b.createPlString(s, te()));
316
+ const t = s.createEphemeral(co);
317
+ s.createField(w(t, uo), "Input", b.createPlString(s, se()));
317
318
  for (let r = 0; r < e.length; r++)
318
- s.createField(w(t, `${co}${r}`), "Input", e[r]);
319
+ s.createField(w(t, `${lo}${r}`), "Input", e[r]);
319
320
  return s.lock(t), t;
320
321
  }
321
- const go = { name: "TengoTemplateGet", version: "1" }, ho = "registry", fo = "templateURI", mo = "template", vo = { name: "TengoTemplatePack", version: "1" }, yo = {
322
+ const fo = { name: "TengoTemplateGet", version: "1" }, mo = "registry", vo = "templateURI", yo = "template", bo = { name: "TengoTemplatePack", version: "1" }, wo = {
322
323
  name: "TengoTemplatePackConvert",
323
324
  version: "1"
324
- }, bo = "templatePack", wo = "template";
325
- async function So(s) {
325
+ }, So = "templatePack", ko = "template";
326
+ async function Co(s) {
326
327
  switch (s.type) {
327
328
  case "from-file":
328
329
  return {
@@ -336,38 +337,38 @@ async function So(s) {
336
337
  return D(s);
337
338
  }
338
339
  }
339
- function ko(s, e) {
340
- const t = s.createStruct(go), r = w(t, ho), o = w(t, fo), n = w(t, mo);
341
- return s.setField(r, s.createValue(b.JsonString, Buffer.from(JSON.stringify(e.registry)))), s.setField(o, s.createValue(b.JsonString, Buffer.from(JSON.stringify(e.path)))), n;
340
+ function Po(s, e) {
341
+ const t = s.createStruct(fo), r = w(t, mo), o = w(t, vo), i = w(t, yo);
342
+ return s.setField(r, s.createValue(b.JsonString, Buffer.from(JSON.stringify(e.registry)))), s.setField(o, s.createValue(b.JsonString, Buffer.from(JSON.stringify(e.path)))), i;
342
343
  }
343
- function Co(s, e) {
344
- const t = s.createValue(vo, e.content), r = s.createStruct(yo), o = w(r, bo), n = w(r, wo);
345
- return s.setField(o, t), n;
344
+ function Ro(s, e) {
345
+ const t = s.createValue(bo, e.content), r = s.createStruct(wo), o = w(r, So), i = w(r, ko);
346
+ return s.setField(o, t), i;
346
347
  }
347
- function Ke(s, e) {
348
+ function Ge(s, e) {
348
349
  switch (e.type) {
349
350
  case "from-registry":
350
- return ko(s, e);
351
+ return Po(s, e);
351
352
  case "explicit":
352
- return Co(s, e);
353
+ return Ro(s, e);
353
354
  default:
354
355
  return D(e);
355
356
  }
356
357
  }
357
- const jt = { name: "Frontend/FromUrl", version: "1" }, At = {
358
+ const Tt = { name: "Frontend/FromUrl", version: "1" }, Et = {
358
359
  name: "Frontend/FromFolder",
359
360
  version: "1"
360
361
  };
361
- function Po(s, e) {
362
+ function Fo(s, e) {
362
363
  switch (e.type) {
363
364
  case "url":
364
365
  return s.createValue(
365
- jt,
366
+ Tt,
366
367
  JSON.stringify({ url: e.url })
367
368
  );
368
369
  case "local":
369
370
  return s.createValue(
370
- At,
371
+ Et,
371
372
  JSON.stringify({
372
373
  path: e.path,
373
374
  signature: e.signature
@@ -377,11 +378,11 @@ function Po(s, e) {
377
378
  return D(e);
378
379
  }
379
380
  }
380
- const Ro = { name: "BlockPackCustom", version: "1" }, Et = "template", It = "frontend";
381
+ const Bo = { name: "BlockPackCustom", version: "1" }, It = "template", Nt = "frontend";
381
382
  function nt(s) {
382
383
  return s.endsWith("/") ? s : `${s}/`;
383
384
  }
384
- class Fo {
385
+ class Oo {
385
386
  constructor(e, t, r) {
386
387
  this.v2RegistryProvider = e, this.signer = t, this.http = r;
387
388
  }
@@ -390,22 +391,22 @@ class Fo {
390
391
  case "explicit":
391
392
  return e.config;
392
393
  case "dev-v1": {
393
- const t = await ot(e.folder), r = await E.promises.readFile(t.config, { encoding: "utf-8" });
394
+ const t = await st(e.folder), r = await E.promises.readFile(t.config, { encoding: "utf-8" });
394
395
  return JSON.parse(r);
395
396
  }
396
397
  case "dev-v2": {
397
- const t = await Qe(e.folder), r = await E.promises.readFile(t.components.model.file, {
398
+ const t = await Ze(e.folder), r = await E.promises.readFile(t.components.model.file, {
398
399
  encoding: "utf-8"
399
400
  });
400
401
  return JSON.parse(r);
401
402
  }
402
403
  case "from-registry-v1": {
403
404
  const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${nt(e.registryUrl)}${W.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`;
404
- return await (await U(`${r}/config.json`, t)).body.json();
405
+ return await (await K(`${r}/config.json`, t)).body.json();
405
406
  }
406
407
  case "from-registry-v2": {
407
408
  const t = this.http !== void 0 ? { dispatcher: this.http } : {}, o = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id);
408
- return await (await U(o.model.url, t)).body.json();
409
+ return await (await K(o.model.url, t)).body.json();
409
410
  }
410
411
  default:
411
412
  return D(e);
@@ -416,9 +417,9 @@ class Fo {
416
417
  case "explicit":
417
418
  return e;
418
419
  case "dev-v1": {
419
- const t = await ot(e.folder), r = await E.promises.readFile(t.workflow), o = JSON.parse(
420
+ const t = await st(e.folder), r = await E.promises.readFile(t.workflow), o = JSON.parse(
420
421
  await E.promises.readFile(t.config, "utf-8")
421
- ), n = t.ui;
422
+ ), i = t.ui;
422
423
  return {
423
424
  type: "explicit",
424
425
  template: {
@@ -428,21 +429,21 @@ class Fo {
428
429
  config: o,
429
430
  frontend: {
430
431
  type: "local",
431
- path: n,
432
- signature: this.signer.sign(n)
432
+ path: i,
433
+ signature: this.signer.sign(i)
433
434
  },
434
435
  source: e
435
436
  };
436
437
  }
437
438
  case "dev-v2": {
438
- const t = await Qe(e.folder), r = JSON.parse(
439
+ const t = await Ze(e.folder), r = JSON.parse(
439
440
  await E.promises.readFile(t.components.model.file, {
440
441
  encoding: "utf-8"
441
442
  })
442
443
  ), o = await E.promises.readFile(
443
444
  t.components.workflow.main.file
444
- ), n = t.components.ui.folder, i = { ...e };
445
- return e.mtime === void 0 && (i.mtime = await Ue(t)), {
445
+ ), i = t.components.ui.folder, n = { ...e };
446
+ return e.mtime === void 0 && (n.mtime = await $e(t)), {
446
447
  type: "explicit",
447
448
  template: {
448
449
  type: "explicit",
@@ -451,24 +452,24 @@ class Fo {
451
452
  config: r,
452
453
  frontend: {
453
454
  type: "local",
454
- path: n,
455
- signature: this.signer.sign(n)
455
+ path: i,
456
+ signature: this.signer.sign(i)
456
457
  },
457
- source: i
458
+ source: n
458
459
  };
459
460
  }
460
461
  case "from-registry-v1": {
461
- const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${nt(e.registryUrl)}${W.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`, o = `${r}/template.plj.gz`, n = await U(o, t);
462
- if (n.statusCode !== 200)
462
+ const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${nt(e.registryUrl)}${W.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`, o = `${r}/template.plj.gz`, i = await K(o, t);
463
+ if (i.statusCode !== 200)
463
464
  throw new Error(
464
- `Block not found in registry (url = ${o} ; code = ${n.statusCode}): ` + JSON.stringify(e)
465
+ `Block not found in registry (url = ${o} ; code = ${i.statusCode}): ` + JSON.stringify(e)
465
466
  );
466
- const i = new Uint8Array(await n.body.arrayBuffer()), c = await (await U(`${r}/config.json`, t)).body.json();
467
+ const n = new Uint8Array(await i.body.arrayBuffer()), c = await (await K(`${r}/config.json`, t)).body.json();
467
468
  return {
468
469
  type: "explicit",
469
470
  template: {
470
471
  type: "explicit",
471
- content: i
472
+ content: n
472
473
  },
473
474
  config: c,
474
475
  frontend: {
@@ -479,7 +480,7 @@ class Fo {
479
480
  };
480
481
  }
481
482
  case "from-registry-v2": {
482
- const t = this.http !== void 0 ? { dispatcher: this.http } : {}, o = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id), n = async () => await (await U(o.model.url, t)).body.json(), i = async () => await (await U(o.workflow.main.url, t)).body.arrayBuffer(), [a, c] = await Promise.all([n(), i()]);
483
+ const t = this.http !== void 0 ? { dispatcher: this.http } : {}, o = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id), i = async () => await (await K(o.model.url, t)).body.json(), n = async () => await (await K(o.workflow.main.url, t)).body.arrayBuffer(), [a, c] = await Promise.all([i(), n()]);
483
484
  return {
484
485
  type: "explicit",
485
486
  template: {
@@ -499,25 +500,25 @@ class Fo {
499
500
  }
500
501
  }
501
502
  }
502
- function Bo(s, e) {
503
- const t = { config: e.config, source: e.source }, r = s.createStruct(Ro, JSON.stringify(t));
504
- return s.createField(w(r, Et), "Input", Ke(s, e.template)), s.createField(w(r, It), "Input", Po(s, e.frontend)), s.lock(r), r;
503
+ function Do(s, e) {
504
+ const t = { config: e.config, source: e.source }, r = s.createStruct(Bo, JSON.stringify(t));
505
+ return s.createField(w(r, It), "Input", Ge(s, e.template)), s.createField(w(r, Nt), "Input", Fo(s, e.frontend)), s.lock(r), r;
505
506
  }
506
- function it(s, e) {
507
+ function at(s, e) {
507
508
  switch (e.type) {
508
509
  case "explicit":
509
- return Bo(s, e);
510
+ return Do(s, e);
510
511
  default:
511
512
  return D(e.type);
512
513
  }
513
514
  }
514
- function ae(s, e) {
515
+ function le(s, e) {
515
516
  return { __isRef: !0, blockId: s, name: e };
516
517
  }
517
- function Oo(s) {
518
+ function xo(s) {
518
519
  return typeof s == "object" && s !== null && s.__isRef === !0 && "blockId" in s && "name" in s;
519
520
  }
520
- function Ae(s, e, t) {
521
+ function Ee(s, e, t) {
521
522
  const r = typeof e;
522
523
  switch (r) {
523
524
  case "function":
@@ -530,21 +531,21 @@ function Ae(s, e, t) {
530
531
  return;
531
532
  case "object":
532
533
  if (e === null) return;
533
- if (Oo(e))
534
+ if (xo(e))
534
535
  t === void 0 || t.has(e.blockId) ? s.upstreams.add(e.blockId) : s.missingReferences = !0;
535
536
  else if (Array.isArray(e))
536
- for (const o of e) Ae(s, o, t);
537
+ for (const o of e) Ee(s, o, t);
537
538
  else
538
539
  for (const [, o] of Object.entries(e))
539
- Ae(s, o, t);
540
+ Ee(s, o, t);
540
541
  return;
541
542
  default:
542
543
  D(r);
543
544
  }
544
545
  }
545
- function Do(s, e) {
546
+ function Ao(s, e) {
546
547
  const t = { upstreams: /* @__PURE__ */ new Set(), missingReferences: !1 };
547
- return Ae(t, s, e), t;
548
+ return Ee(t, s, e), t;
548
549
  }
549
550
  function J(s) {
550
551
  return {
@@ -570,20 +571,20 @@ class Vt {
570
571
  }
571
572
  traverse(e, t, r) {
572
573
  let o = [...t];
573
- const n = new Set(o);
574
+ const i = new Set(o);
574
575
  for (; o.length > 0; ) {
575
- let i = [];
576
+ let n = [];
576
577
  for (const a of o) {
577
578
  const c = this.nodes.get(a);
578
579
  r(c), c[e].forEach((u) => {
579
- n.has(u) || (n.add(u), i.push(u));
580
+ i.has(u) || (i.add(u), n.push(u));
580
581
  });
581
582
  }
582
- o = i;
583
+ o = n;
583
584
  }
584
585
  }
585
586
  }
586
- function Ee(s) {
587
+ function Ie(s) {
587
588
  const e = /* @__PURE__ */ new Map();
588
589
  let t;
589
590
  for (const { id: r } of J(s)) {
@@ -595,70 +596,70 @@ function Ee(s) {
595
596
  }
596
597
  return t !== void 0 && (t.downstream = /* @__PURE__ */ new Set()), new Vt(e);
597
598
  }
598
- function ce(s, e) {
599
+ function de(s, e) {
599
600
  const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
600
601
  for (const { id: o } of J(s)) {
601
- const n = e(o);
602
- if (n === void 0) continue;
603
- const i = Do(n, r), a = {
602
+ const i = e(o);
603
+ if (i === void 0) continue;
604
+ const n = Ao(i, r), a = {
604
605
  id: o,
605
- missingReferences: i.missingReferences,
606
- upstream: i.upstreams,
606
+ missingReferences: n.missingReferences,
607
+ upstream: n.upstreams,
607
608
  downstream: /* @__PURE__ */ new Set()
608
609
  // will be populated from downstream blocks
609
610
  };
610
- t.set(o, a), i.upstreams.forEach((c) => t.get(c).downstream.add(o)), r.add(o);
611
+ t.set(o, a), n.upstreams.forEach((c) => t.get(c).downstream.add(o)), r.add(o);
611
612
  }
612
613
  return new Vt(t);
613
614
  }
614
- function xo(s, e) {
615
+ function jo(s, e) {
615
616
  if (s.size !== e.size) return !1;
616
617
  for (const t of s) if (!e.has(t)) return !1;
617
618
  return !0;
618
619
  }
619
- function Ie(s, e) {
620
- if (s.size > e.size) return Ie(e, s);
620
+ function Ne(s, e) {
621
+ if (s.size > e.size) return Ne(e, s);
621
622
  for (const t of s) if (e.has(t)) return !0;
622
623
  return !1;
623
624
  }
624
- function at(s, e) {
625
+ function ct(s, e) {
625
626
  const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
626
- return s.nodes.forEach((n) => {
627
- const i = e.nodes.get(n.id);
628
- i === void 0 ? t.add(n.id) : (!xo(n.upstream, i.upstream) || Ie(n.upstream, o)) && o.add(n.id);
629
- }), e.nodes.forEach((n) => {
630
- s.nodes.has(n.id) ? Ie(n.upstream, o) && o.add(n.id) : r.add(n.id);
627
+ return s.nodes.forEach((i) => {
628
+ const n = e.nodes.get(i.id);
629
+ n === void 0 ? t.add(i.id) : (!jo(i.upstream, n.upstream) || Ne(i.upstream, o)) && o.add(i.id);
630
+ }), e.nodes.forEach((i) => {
631
+ s.nodes.has(i.id) ? Ne(i.upstream, o) && o.add(i.id) : r.add(i.id);
631
632
  }), { onlyInA: t, onlyInB: r, different: o };
632
633
  }
633
- let Se;
634
- async function Nt() {
635
- if (Se === void 0) {
636
- const s = await So(wr["pframes.export-pframe"]);
634
+ let Pe;
635
+ async function Lt() {
636
+ if (Pe === void 0) {
637
+ const s = await Co(Sr["pframes.export-pframe"]);
637
638
  if (s.type !== "explicit") throw new Error("Unexpected prepared template type.");
638
- const e = fe("sha256").update(s.content).digest("hex");
639
- Se = { spec: s, hash: e };
639
+ const e = ye("sha256").update(s.content).digest("hex");
640
+ Pe = { spec: s, hash: e };
640
641
  }
641
- return Se;
642
+ return Pe;
642
643
  }
643
644
  function To(s, e, t) {
644
- return Tt(s, e, !0, { pf: t }, ["result"]).result;
645
+ return jt(s, e, !0, { pf: t }, ["result"]).result;
645
646
  }
646
- function ke(s, e) {
647
+ function Re(s, e) {
647
648
  let t = !1, r, o;
648
649
  return () => {
649
650
  if (!t)
650
651
  return t = !0, r = s(), o = e(), o;
651
- const n = s();
652
- return r !== n && (r = n, o = e()), e();
652
+ const i = s();
653
+ return r !== i && (r = i, o = e()), e();
653
654
  };
654
655
  }
655
- class ct {
656
+ class ut {
656
657
  constructor(e, t) {
657
- p(this, "currentInputsC", ke(
658
+ p(this, "currentInputsC", Re(
658
659
  () => this.fields.currentArgs.modCount,
659
660
  () => JSON.parse(Buffer.from(this.fields.currentArgs.value).toString())
660
661
  ));
661
- p(this, "actualProductionInputsC", ke(
662
+ p(this, "actualProductionInputsC", Re(
662
663
  () => {
663
664
  var e;
664
665
  return (e = this.fields.prodArgs) == null ? void 0 : e.modCount;
@@ -670,7 +671,7 @@ class ct {
670
671
  return JSON.parse(Buffer.from(e).toString());
671
672
  }
672
673
  ));
673
- p(this, "productionStaleC", ke(
674
+ p(this, "productionStaleC", Re(
674
675
  () => {
675
676
  var e;
676
677
  return `${this.fields.currentArgs.modCount}_${(e = this.fields.prodArgs) == null ? void 0 : e.modCount}`;
@@ -712,16 +713,16 @@ class ct {
712
713
  getTemplate(e) {
713
714
  return e.getFutureFieldValue(
714
715
  b.unwrapHolder(e, this.fields.blockPack.ref),
715
- Et,
716
+ It,
716
717
  "Input"
717
718
  );
718
719
  }
719
720
  }
720
- const jo = (s) => {
721
+ const Eo = (s) => {
721
722
  throw new Error(`No new block info for ${s}`);
722
723
  };
723
- class pe {
724
- constructor(e, t, r, o, n, i, a, c, u, l, d, g) {
724
+ class fe {
725
+ constructor(e, t, r, o, i, n, a, c, u, l, d, g) {
725
726
  p(this, "globalModCount", 0);
726
727
  p(this, "fieldsChanged", !1);
727
728
  //
@@ -740,7 +741,7 @@ class pe {
740
741
  p(this, "stagingGraph");
741
742
  p(this, "pendingProductionGraph");
742
743
  p(this, "actualProductionGraph");
743
- this.rid = e, this.tx = t, this.author = r, this.schema = o, this.lastModified = n, this.meta = i, this.struct = a, this.renderingState = c, this.blocksInLimbo = u, this.blockInfos = l, this.blockFrontendStates = d, this.ctxExportTplHolder = g;
744
+ this.rid = e, this.tx = t, this.author = r, this.schema = o, this.lastModified = i, this.meta = n, this.struct = a, this.renderingState = c, this.blocksInLimbo = u, this.blockInfos = l, this.blockFrontendStates = d, this.ctxExportTplHolder = g;
744
745
  }
745
746
  fixProblems() {
746
747
  this.blockInfos.forEach((e) => {
@@ -754,16 +755,16 @@ class pe {
754
755
  return JSON.parse(JSON.stringify(this.struct));
755
756
  }
756
757
  getStagingGraph() {
757
- return this.stagingGraph === void 0 && (this.stagingGraph = Ee(this.struct)), this.stagingGraph;
758
+ return this.stagingGraph === void 0 && (this.stagingGraph = Ie(this.struct)), this.stagingGraph;
758
759
  }
759
760
  getPendingProductionGraph() {
760
- return this.pendingProductionGraph === void 0 && (this.pendingProductionGraph = ce(
761
+ return this.pendingProductionGraph === void 0 && (this.pendingProductionGraph = de(
761
762
  this.struct,
762
763
  (e) => this.getBlockInfo(e).currentInputs
763
764
  )), this.pendingProductionGraph;
764
765
  }
765
766
  getActualProductionGraph() {
766
- return this.actualProductionGraph === void 0 && (this.actualProductionGraph = ce(
767
+ return this.actualProductionGraph === void 0 && (this.actualProductionGraph = de(
767
768
  this.struct,
768
769
  (e) => this.getBlockInfo(e).actualProductionInputs
769
770
  )), this.actualProductionGraph;
@@ -786,15 +787,15 @@ class pe {
786
787
  ...r
787
788
  }, this.fieldsChanged = !0;
788
789
  }
789
- setBlockField(e, t, r, o, n) {
790
- this.setBlockFieldObj(e, t, { ref: r, status: o, value: n });
790
+ setBlockField(e, t, r, o, i) {
791
+ this.setBlockFieldObj(e, t, { ref: r, status: o, value: i });
791
792
  }
792
793
  deleteBlockFields(e, ...t) {
793
794
  let r = !1;
794
795
  const o = this.getBlockInfo(e);
795
- for (const n of t) {
796
- const i = o.fields;
797
- n in i && (this.tx.removeField(w(this.rid, P(e, n))), delete i[n], this.fieldsChanged = !0, r = !0);
796
+ for (const i of t) {
797
+ const n = o.fields;
798
+ i in n && (this.tx.removeField(w(this.rid, P(e, i))), delete n[i], this.fieldsChanged = !0, r = !0);
798
799
  }
799
800
  return r;
800
801
  }
@@ -808,14 +809,14 @@ class pe {
808
809
  this.renderingState.stagingRefreshTimestamp = Date.now(), this.renderingStateChanged = !0;
809
810
  }
810
811
  resetStaging(e) {
811
- var r, o, n;
812
+ var r, o, i;
812
813
  const t = this.getBlockInfo(e).fields;
813
- ((r = t.stagingOutput) == null ? void 0 : r.status) === "Ready" && ((o = t.stagingCtx) == null ? void 0 : o.status) === "Ready" && ((n = t.stagingUiCtx) == null ? void 0 : n.status) === "Ready" && (this.setBlockFieldObj(e, "stagingOutputPrevious", t.stagingOutput), this.setBlockFieldObj(e, "stagingCtxPrevious", t.stagingCtx), this.setBlockFieldObj(e, "stagingUiCtxPrevious", t.stagingUiCtx)), this.deleteBlockFields(e, "stagingOutput", "stagingCtx", "stagingUiCtx") && this.resetStagingRefreshTimestamp();
814
+ ((r = t.stagingOutput) == null ? void 0 : r.status) === "Ready" && ((o = t.stagingCtx) == null ? void 0 : o.status) === "Ready" && ((i = t.stagingUiCtx) == null ? void 0 : i.status) === "Ready" && (this.setBlockFieldObj(e, "stagingOutputPrevious", t.stagingOutput), this.setBlockFieldObj(e, "stagingCtxPrevious", t.stagingCtx), this.setBlockFieldObj(e, "stagingUiCtxPrevious", t.stagingUiCtx)), this.deleteBlockFields(e, "stagingOutput", "stagingCtx", "stagingUiCtx") && this.resetStagingRefreshTimestamp();
814
815
  }
815
816
  resetProduction(e) {
816
- var r, o, n;
817
+ var r, o, i;
817
818
  const t = this.getBlockInfo(e).fields;
818
- ((r = t.prodOutput) == null ? void 0 : r.status) === "Ready" && ((o = t.prodCtx) == null ? void 0 : o.status) === "Ready" && ((n = t.prodUiCtx) == null ? void 0 : n.status) === "Ready" && (this.setBlockFieldObj(e, "prodOutputPrevious", t.prodOutput), this.setBlockFieldObj(e, "prodCtxPrevious", t.prodCtx), this.setBlockFieldObj(e, "prodUiCtxPrevious", t.prodUiCtx)), this.deleteBlockFields(e, "prodOutput", "prodCtx", "prodUiCtx", "prodArgs");
819
+ ((r = t.prodOutput) == null ? void 0 : r.status) === "Ready" && ((o = t.prodCtx) == null ? void 0 : o.status) === "Ready" && ((i = t.prodUiCtx) == null ? void 0 : i.status) === "Ready" && (this.setBlockFieldObj(e, "prodOutputPrevious", t.prodOutput), this.setBlockFieldObj(e, "prodCtxPrevious", t.prodCtx), this.setBlockFieldObj(e, "prodUiCtxPrevious", t.prodUiCtx)), this.deleteBlockFields(e, "prodOutput", "prodCtx", "prodUiCtx", "prodArgs");
819
820
  }
820
821
  /** Running blocks are reset, already computed moved to limbo. Returns if
821
822
  * either of the actions were actually performed. */
@@ -828,12 +829,12 @@ class pe {
828
829
  setArgs(e) {
829
830
  const t = [];
830
831
  for (const { blockId: r, args: o } of e) {
831
- const n = this.getBlockInfo(r);
832
+ const i = this.getBlockInfo(r);
832
833
  JSON.parse(o);
833
- const i = Buffer.from(o);
834
- if (Buffer.compare(n.fields.currentArgs.value, i) === 0) continue;
835
- const a = this.tx.createValue(b.JsonObject, i);
836
- this.setBlockField(r, "currentArgs", a, "Ready", i), this.blocksWithChangedInputs.add(r), t.push(r);
834
+ const n = Buffer.from(o);
835
+ if (Buffer.compare(i.fields.currentArgs.value, n) === 0) continue;
836
+ const a = this.tx.createValue(b.JsonObject, n);
837
+ this.setBlockField(r, "currentArgs", a, "Ready", n), this.blocksWithChangedInputs.add(r), t.push(r);
837
838
  }
838
839
  this.getStagingGraph().traverse("downstream", t, ({ id: r }) => this.resetStaging(r)), t.length > 0 && this.updateLastModified();
839
840
  }
@@ -858,11 +859,11 @@ class pe {
858
859
  createCtx(e, t) {
859
860
  const r = [];
860
861
  return e.forEach((o) => {
861
- const n = this.getBlockInfo(o);
862
- if (n.fields[t] === void 0 || n.fields[t].ref === void 0)
862
+ const i = this.getBlockInfo(o);
863
+ if (i.fields[t] === void 0 || i.fields[t].ref === void 0)
863
864
  throw new Error("One of the upstreams staging is not rendered.");
864
- r.push(b.unwrapHolder(this.tx, n.fields[t].ref));
865
- }), po(this.tx, r);
865
+ r.push(b.unwrapHolder(this.tx, i.fields[t].ref));
866
+ }), ho(this.tx, r);
866
867
  }
867
868
  exportCtx(e) {
868
869
  return To(this.tx, b.unwrapHolder(this.tx, this.ctxExportTplHolder), e);
@@ -871,7 +872,7 @@ class pe {
871
872
  this.resetStaging(e);
872
873
  const t = this.getBlockInfo(e), r = this.createCtx(this.getStagingGraph().nodes.get(e).upstream, "stagingCtx");
873
874
  if (this.getBlock(e).renderingMode !== "Heavy") throw new Error("not supported yet");
874
- const o = t.getTemplate(this.tx), n = st(this.tx, o, {
875
+ const o = t.getTemplate(this.tx), i = it(this.tx, o, {
875
876
  args: t.fields.currentArgs.ref,
876
877
  blockId: this.tx.createValue(b.JsonString, JSON.stringify(e)),
877
878
  isProduction: this.tx.createValue(b.JsonBool, JSON.stringify(!1)),
@@ -880,9 +881,9 @@ class pe {
880
881
  this.setBlockField(
881
882
  e,
882
883
  "stagingCtx",
883
- b.wrapInEphHolder(this.tx, n.context),
884
+ b.wrapInEphHolder(this.tx, i.context),
884
885
  "NotReady"
885
- ), this.setBlockField(e, "stagingUiCtx", this.exportCtx(n.context), "NotReady"), this.setBlockField(e, "stagingOutput", n.result, "NotReady");
886
+ ), this.setBlockField(e, "stagingUiCtx", this.exportCtx(i.context), "NotReady"), this.setBlockField(e, "stagingOutput", i.result, "NotReady");
886
887
  }
887
888
  renderProductionFor(e) {
888
889
  this.resetProduction(e);
@@ -892,7 +893,7 @@ class pe {
892
893
  );
893
894
  if (this.getBlock(e).renderingMode === "Light")
894
895
  throw new Error("Can't render production for light block.");
895
- const o = t.getTemplate(this.tx), n = st(this.tx, o, {
896
+ const o = t.getTemplate(this.tx), i = it(this.tx, o, {
896
897
  args: t.fields.currentArgs.ref,
897
898
  blockId: this.tx.createValue(b.JsonString, JSON.stringify(e)),
898
899
  isProduction: this.tx.createValue(b.JsonBool, JSON.stringify(!0)),
@@ -901,30 +902,30 @@ class pe {
901
902
  this.setBlockField(
902
903
  e,
903
904
  "prodCtx",
904
- b.wrapInEphHolder(this.tx, n.context),
905
+ b.wrapInEphHolder(this.tx, i.context),
905
906
  "NotReady"
906
- ), this.setBlockField(e, "prodUiCtx", this.exportCtx(n.context), "NotReady"), this.setBlockField(e, "prodOutput", n.result, "NotReady"), this.setBlockFieldObj(e, "prodArgs", t.fields.currentArgs), this.blocksInLimbo.delete(e) && (this.renderingStateChanged = !0);
907
+ ), this.setBlockField(e, "prodUiCtx", this.exportCtx(i.context), "NotReady"), this.setBlockField(e, "prodOutput", i.result, "NotReady"), this.setBlockFieldObj(e, "prodArgs", t.fields.currentArgs), this.blocksInLimbo.delete(e) && (this.renderingStateChanged = !0);
907
908
  }
908
909
  //
909
910
  // Structure changes
910
911
  //
911
912
  /** Very generic method, better check for more specialized case-specific methods first. */
912
- updateStructure(e, t = jo) {
913
- const r = this.getStagingGraph(), o = this.getActualProductionGraph(), n = Ee(e), i = ce(
913
+ updateStructure(e, t = Eo) {
914
+ const r = this.getStagingGraph(), o = this.getActualProductionGraph(), i = Ie(e), n = de(
914
915
  e,
915
916
  (u) => {
916
917
  var l;
917
918
  return (l = this.blockInfos.get(u)) == null ? void 0 : l.actualProductionInputs;
918
919
  }
919
- ), a = at(r, n), c = at(o, i);
920
+ ), a = ct(r, i), c = ct(o, n);
920
921
  for (const u of a.onlyInA) {
921
922
  const { fields: l } = this.getBlockInfo(u);
922
923
  this.deleteBlockFields(u, ...Object.keys(l)), this.blockInfos.delete(u), this.blocksInLimbo.delete(u) && (this.renderingStateChanged = !0), this.blockFrontendStates.delete(u) && this.changedBlockFrontendStates.add(u);
923
924
  }
924
925
  for (const u of a.onlyInB) {
925
- const l = new ct(u, {});
926
+ const l = new ut(u, {});
926
927
  this.blockInfos.set(u, l);
927
- const d = t(u), g = it(this.tx, d.blockPack);
928
+ const d = t(u), g = at(this.tx, d.blockPack);
928
929
  this.setBlockField(u, "blockPack", b.wrapInHolder(this.tx, g), "NotReady");
929
930
  const f = Buffer.from(d.args), v = this.tx.createValue(b.JsonObject, f);
930
931
  this.setBlockField(u, "currentArgs", v, "Ready", f), d.uiState && (this.blockFrontendStates.set(u, d.uiState), this.changedBlockFrontendStates.add(u)), l.check();
@@ -942,18 +943,18 @@ class pe {
942
943
  if (r === void 0)
943
944
  o.groups[o.groups.length - 1].blocks.push(e);
944
945
  else {
945
- let n = !1;
946
- for (const i of o.groups) {
947
- const a = i.blocks.findIndex((c) => c.id === r);
946
+ let i = !1;
947
+ for (const n of o.groups) {
948
+ const a = n.blocks.findIndex((c) => c.id === r);
948
949
  if (!(a < 0)) {
949
- i.blocks.splice(a, 0, e), n = !0;
950
+ n.blocks.splice(a, 0, e), i = !0;
950
951
  break;
951
952
  }
952
953
  }
953
- if (!n) throw new Error(`Can't find element with id: ${r}`);
954
+ if (!i) throw new Error(`Can't find element with id: ${r}`);
954
955
  }
955
- this.updateStructure(o, (n) => {
956
- if (n !== e.id) throw new Error("Unexpected");
956
+ this.updateStructure(o, (i) => {
957
+ if (i !== e.id) throw new Error("Unexpected");
957
958
  return t;
958
959
  });
959
960
  }
@@ -961,9 +962,9 @@ class pe {
961
962
  const t = this.structure;
962
963
  let r = !1;
963
964
  for (const o of t.groups) {
964
- const n = o.blocks.findIndex((i) => i.id === e);
965
- if (!(n < 0)) {
966
- o.blocks.splice(n, 1), r = !0;
965
+ const i = o.blocks.findIndex((n) => n.id === e);
966
+ if (!(i < 0)) {
967
+ o.blocks.splice(i, 1), r = !0;
967
968
  break;
968
969
  }
969
970
  }
@@ -978,12 +979,12 @@ class pe {
978
979
  this.setBlockField(
979
980
  e,
980
981
  "blockPack",
981
- b.wrapInHolder(this.tx, it(this.tx, t)),
982
+ b.wrapInHolder(this.tx, at(this.tx, t)),
982
983
  "NotReady"
983
- ), r !== void 0 ? (this.setArgs([{ blockId: e, args: r }]), this.setUiState(e, void 0)) : this.getStagingGraph().traverse("downstream", [e], ({ id: n }) => this.resetStaging(n)), o.productionRendered && this.getActualProductionGraph().traverse(
984
+ ), r !== void 0 ? (this.setArgs([{ blockId: e, args: r }]), this.setUiState(e, void 0)) : this.getStagingGraph().traverse("downstream", [e], ({ id: i }) => this.resetStaging(i)), o.productionRendered && this.getActualProductionGraph().traverse(
984
985
  "downstream",
985
986
  [e],
986
- ({ id: n }) => this.resetOrLimboProduction(n)
987
+ ({ id: i }) => this.resetOrLimboProduction(i)
987
988
  ), this.updateLastModified();
988
989
  }
989
990
  //
@@ -992,66 +993,66 @@ class pe {
992
993
  renderProduction(e, t = !1) {
993
994
  const r = new Set(e), o = this.getPendingProductionGraph();
994
995
  if (t)
995
- o.traverse("upstream", e, (i) => {
996
- r.add(i.id);
996
+ o.traverse("upstream", e, (n) => {
997
+ r.add(n.id);
997
998
  });
998
999
  else
999
- for (const i of r) {
1000
- const a = o.nodes.get(i);
1001
- if (a === void 0) throw new Error(`Can't find block with id: ${i}`);
1000
+ for (const n of r) {
1001
+ const a = o.nodes.get(n);
1002
+ if (a === void 0) throw new Error(`Can't find block with id: ${n}`);
1002
1003
  for (const c of a.upstream)
1003
1004
  if (!r.has(c))
1004
1005
  throw new Error("Can't render blocks not including all upstreams.");
1005
1006
  }
1006
- const n = /* @__PURE__ */ new Set();
1007
- for (const i of J(this.structure)) {
1008
- if (!r.has(i.id)) continue;
1009
- let a = this.getBlockInfo(i.id).requireProductionRendering || this.blocksInLimbo.has(i.id);
1007
+ const i = /* @__PURE__ */ new Set();
1008
+ for (const n of J(this.structure)) {
1009
+ if (!r.has(n.id)) continue;
1010
+ let a = this.getBlockInfo(n.id).requireProductionRendering || this.blocksInLimbo.has(n.id);
1010
1011
  if (!a) {
1011
- for (const c of o.nodes.get(i.id).upstream)
1012
- if (n.has(c)) {
1012
+ for (const c of o.nodes.get(n.id).upstream)
1013
+ if (i.has(c)) {
1013
1014
  a = !0;
1014
1015
  break;
1015
1016
  }
1016
1017
  }
1017
- a && (this.renderProductionFor(i.id), n.add(i.id));
1018
+ a && (this.renderProductionFor(n.id), i.add(n.id));
1018
1019
  }
1019
- return o.traverse("downstream", [...n], (i) => {
1020
- n.has(i.id) || this.resetOrLimboProduction(i.id);
1021
- }), n.size > 0 && this.updateLastModified(), n;
1020
+ return o.traverse("downstream", [...i], (n) => {
1021
+ i.has(n.id) || this.resetOrLimboProduction(n.id);
1022
+ }), i.size > 0 && this.updateLastModified(), i;
1022
1023
  }
1023
1024
  /** Stops running blocks from the list and modify states of other blocks
1024
1025
  * accordingly */
1025
1026
  stopProduction(...e) {
1026
- var i, a;
1027
- const t = this.getActualProductionGraph(), r = new Pt(e), o = new Set(e), n = [];
1027
+ var n, a;
1028
+ const t = this.getActualProductionGraph(), r = new Rt(e), o = new Set(e), i = [];
1028
1029
  for (; !r.isEmpty(); ) {
1029
1030
  const c = r.shift(), u = this.getBlockInfo(c).fields;
1030
- if (!(((i = u.prodOutput) == null ? void 0 : i.status) === "Ready" && ((a = u.prodCtx) == null ? void 0 : a.status) === "Ready") && this.deleteBlockFields(c, "prodOutput", "prodCtx", "prodUiCtx", "prodArgs")) {
1031
- n.push(c);
1031
+ if (!(((n = u.prodOutput) == null ? void 0 : n.status) === "Ready" && ((a = u.prodCtx) == null ? void 0 : a.status) === "Ready") && this.deleteBlockFields(c, "prodOutput", "prodCtx", "prodUiCtx", "prodArgs")) {
1032
+ i.push(c);
1032
1033
  for (const l of t.traverseIdsExcludingRoots("downstream", c))
1033
1034
  o.has(l) || (r.push(l), o.add(l));
1034
1035
  }
1035
1036
  }
1036
- for (const c of t.traverseIdsExcludingRoots("downstream", ...n))
1037
+ for (const c of t.traverseIdsExcludingRoots("downstream", ...i))
1037
1038
  this.resetOrLimboProduction(c);
1038
1039
  }
1039
1040
  traverseWithStagingLag(e) {
1040
1041
  const t = /* @__PURE__ */ new Map();
1041
1042
  this.getStagingGraph().nodes.forEach((o) => {
1042
- let i = this.getBlockInfo(o.id).stagingRendered ? 0 : 1;
1043
+ let n = this.getBlockInfo(o.id).stagingRendered ? 0 : 1;
1043
1044
  o.upstream.forEach((a) => {
1044
1045
  const c = t.get(a);
1045
- c !== 0 && (i = Math.max(c + 1, i));
1046
- }), e(o.id, i), t.set(o.id, i);
1046
+ c !== 0 && (n = Math.max(c + 1, n));
1047
+ }), e(o.id, n), t.set(o.id, n);
1047
1048
  });
1048
1049
  }
1049
1050
  /** @param stagingRenderingRate rate in blocks per second */
1050
1051
  refreshStagings(e) {
1051
1052
  const t = Date.now() - this.renderingState.stagingRefreshTimestamp, r = e === void 0 ? void 0 : 1 + Math.max(0, t * e / 1e3);
1052
1053
  let o = 0;
1053
- this.traverseWithStagingLag((n, i) => {
1054
- i !== 0 && (r === void 0 || i <= r) && (this.renderStagingFor(n), o++);
1054
+ this.traverseWithStagingLag((i, n) => {
1055
+ n !== 0 && (r === void 0 || n <= r) && (this.renderStagingFor(i), o++);
1055
1056
  }), o > 0 && this.resetStagingRefreshTimestamp();
1056
1057
  }
1057
1058
  //
@@ -1067,13 +1068,13 @@ class pe {
1067
1068
  /** @param stagingRenderingRate rate in blocks per second */
1068
1069
  doRefresh(e) {
1069
1070
  this.refreshStagings(e), this.blockInfos.forEach((t) => {
1070
- var r, o, n, i;
1071
+ var r, o, i, n;
1071
1072
  ((r = t.fields.prodCtx) == null ? void 0 : r.status) === "Ready" && ((o = t.fields.prodOutput) == null ? void 0 : o.status) === "Ready" && this.deleteBlockFields(
1072
1073
  t.id,
1073
1074
  "prodOutputPrevious",
1074
1075
  "prodCtxPrevious",
1075
1076
  "prodUiCtxPrevious"
1076
- ), ((n = t.fields.stagingCtx) == null ? void 0 : n.status) === "Ready" && ((i = t.fields.stagingOutput) == null ? void 0 : i.status) === "Ready" && this.deleteBlockFields(
1077
+ ), ((i = t.fields.stagingCtx) == null ? void 0 : i.status) === "Ready" && ((n = t.fields.stagingOutput) == null ? void 0 : n.status) === "Ready" && this.deleteBlockFields(
1077
1078
  t.id,
1078
1079
  "stagingOutputPrevious",
1079
1080
  "stagingCtxPrevious",
@@ -1084,99 +1085,99 @@ class pe {
1084
1085
  assignAuthorMarkers() {
1085
1086
  const e = this.author ? JSON.stringify(this.author) : void 0;
1086
1087
  for (const t of this.blocksWithChangedInputs)
1087
- e === void 0 ? this.tx.deleteKValue(this.rid, xe(t)) : this.tx.setKValue(this.rid, xe(t), e);
1088
- (this.metaChanged || this.structureChanged) && (e === void 0 ? this.tx.deleteKValue(this.rid, Te) : this.tx.setKValue(this.rid, Te, e));
1088
+ e === void 0 ? this.tx.deleteKValue(this.rid, Ae(t)) : this.tx.setKValue(this.rid, Ae(t), e);
1089
+ (this.metaChanged || this.structureChanged) && (e === void 0 ? this.tx.deleteKValue(this.rid, je) : this.tx.setKValue(this.rid, je, e));
1089
1090
  }
1090
1091
  save() {
1091
1092
  if (this.wasModified) {
1092
- this.lastModifiedChanged && this.tx.setKValue(this.rid, re, JSON.stringify(this.lastModified)), this.structureChanged && this.tx.setKValue(this.rid, z, JSON.stringify(this.struct)), this.renderingStateChanged && this.tx.setKValue(
1093
+ this.lastModifiedChanged && this.tx.setKValue(this.rid, ie, JSON.stringify(this.lastModified)), this.structureChanged && this.tx.setKValue(this.rid, z, JSON.stringify(this.struct)), this.renderingStateChanged && this.tx.setKValue(
1093
1094
  this.rid,
1094
- de,
1095
+ he,
1095
1096
  JSON.stringify({
1096
1097
  ...this.renderingState,
1097
1098
  blocksInLimbo: [...this.blocksInLimbo]
1098
1099
  })
1099
- ), this.metaChanged && this.tx.setKValue(this.rid, oe, JSON.stringify(this.meta));
1100
+ ), this.metaChanged && this.tx.setKValue(this.rid, ne, JSON.stringify(this.meta));
1100
1101
  for (const e of this.changedBlockFrontendStates) {
1101
1102
  const t = this.blockFrontendStates.get(e);
1102
- t === void 0 ? this.tx.deleteKValue(this.rid, De(e)) : this.tx.setKValue(this.rid, De(e), t);
1103
+ t === void 0 ? this.tx.deleteKValue(this.rid, xe(e)) : this.tx.setKValue(this.rid, xe(e), t);
1103
1104
  }
1104
1105
  this.assignAuthorMarkers();
1105
1106
  }
1106
1107
  }
1107
1108
  static async load(e, t, r) {
1108
- const o = e.getResourceData(t, !0), n = e.getKValueJson(t, Ot), i = e.getKValueJson(t, re), a = e.getKValueJson(t, oe), c = e.getKValueJson(t, z), u = e.getKValueJson(t, de), l = e.listKeyValuesString(t), [
1109
+ const o = e.getResourceData(t, !0), i = e.getKValueJson(t, Dt), n = e.getKValueJson(t, ie), a = e.getKValueJson(t, ne), c = e.getKValueJson(t, z), u = e.getKValueJson(t, he), l = e.listKeyValuesString(t), [
1109
1110
  d,
1110
1111
  g,
1111
1112
  f,
1112
1113
  v,
1113
1114
  S,
1114
- { stagingRefreshTimestamp: I, blocksInLimbo: M },
1115
- $
1115
+ { stagingRefreshTimestamp: I, blocksInLimbo: U },
1116
+ M
1116
1117
  ] = await Promise.all([
1117
1118
  o,
1118
- n,
1119
1119
  i,
1120
+ n,
1120
1121
  a,
1121
1122
  c,
1122
1123
  u,
1123
1124
  l
1124
1125
  ]);
1125
- if (g !== Dt)
1126
+ if (g !== xt)
1126
1127
  throw new Error(
1127
1128
  `Can't act on this project resource because it has a wrong schema version: ${g}`
1128
1129
  );
1129
1130
  const _ = /* @__PURE__ */ new Map();
1130
1131
  for (const y of d.fields) {
1131
- const O = Xr(y.name);
1132
+ const O = to(y.name);
1132
1133
  if (O === void 0) continue;
1133
1134
  let F = _.get(O.blockId);
1134
1135
  F === void 0 && (F = {
1135
1136
  id: O.blockId,
1136
1137
  fields: {}
1137
- }, _.set(O.blockId, F)), F.fields[O.fieldName] = le(y.value) ? { modCount: 0 } : { modCount: 0, ref: y.value };
1138
+ }, _.set(O.blockId, F)), F.fields[O.fieldName] = ge(y.value) ? { modCount: 0 } : { modCount: 0, ref: y.value };
1138
1139
  }
1139
- const Y = await Nt(), ne = je(Y.hash), k = d.fields.find(
1140
- (y) => y.name === ne
1140
+ const q = await Lt(), ce = Te(q.hash), k = d.fields.find(
1141
+ (y) => y.name === ce
1141
1142
  );
1142
- let V;
1143
- k !== void 0 ? V = Be(k.value) : (V = b.wrapInHolder(e, Ke(e, Y.spec)), e.createField(
1144
- w(t, je(Y.hash)),
1143
+ let N;
1144
+ k !== void 0 ? N = Oe(k.value) : (N = b.wrapInHolder(e, Ge(e, q.spec)), e.createField(
1145
+ w(t, Te(q.hash)),
1145
1146
  "Dynamic",
1146
- V
1147
+ N
1147
1148
  ));
1148
- const q = { stagingRefreshTimestamp: I }, A = new Set(M), T = /* @__PURE__ */ new Map();
1149
- for (const y of $) {
1150
- const O = qr(y.key);
1151
- O !== void 0 && T.set(O, y.value);
1149
+ const Y = { stagingRefreshTimestamp: I }, T = new Set(U), A = /* @__PURE__ */ new Map();
1150
+ for (const y of M) {
1151
+ const O = Zr(y.key);
1152
+ O !== void 0 && A.set(O, y.value);
1152
1153
  }
1153
1154
  const B = [];
1154
1155
  _.forEach(({ id: y, fields: O }) => {
1155
1156
  for (const [, F] of Object.entries(O))
1156
1157
  if (F.ref !== void 0) {
1157
- if (!lr(F.ref) || dr(F.ref))
1158
+ if (!dr(F.ref) || pr(F.ref))
1158
1159
  throw new Error("unexpected behaviour");
1159
1160
  B.push([F, e.getResourceData(F.ref, !1)]);
1160
1161
  }
1161
1162
  });
1162
1163
  for (const [y, O] of B) {
1163
1164
  const F = await O;
1164
- y.value = F.data, Ze(F.error) ? y.status = "Error" : F.resourceReady || Ze(F.originalResourceId) ? y.status = "Ready" : y.status = "NotReady";
1165
+ y.value = F.data, Xe(F.error) ? y.status = "Error" : F.resourceReady || Xe(F.originalResourceId) ? y.status = "Ready" : y.status = "NotReady";
1165
1166
  }
1166
- const K = /* @__PURE__ */ new Map();
1167
- _.forEach(({ id: y, fields: O }) => K.set(y, new ct(y, O)));
1168
- const N = /* @__PURE__ */ new Set();
1167
+ const $ = /* @__PURE__ */ new Map();
1168
+ _.forEach(({ id: y, fields: O }) => $.set(y, new ut(y, O)));
1169
+ const V = /* @__PURE__ */ new Set();
1169
1170
  for (const y of J(S)) {
1170
- if (!K.has(y.id))
1171
+ if (!$.has(y.id))
1171
1172
  throw new Error(`Inconsistent project structure: no inputs for ${y.id}`);
1172
- N.add(y.id);
1173
+ V.add(y.id);
1173
1174
  }
1174
- K.forEach((y) => {
1175
- if (!N.has(y.id))
1175
+ $.forEach((y) => {
1176
+ if (!V.has(y.id))
1176
1177
  throw new Error(`Inconsistent project structure: no structure entry for ${y.id}`);
1177
1178
  y.check();
1178
1179
  });
1179
- const ie = new pe(
1180
+ const ue = new fe(
1180
1181
  t,
1181
1182
  e,
1182
1183
  r,
@@ -1184,42 +1185,42 @@ class pe {
1184
1185
  f,
1185
1186
  v,
1186
1187
  S,
1187
- q,
1188
- A,
1189
- K,
1188
+ Y,
1190
1189
  T,
1191
- V
1190
+ $,
1191
+ A,
1192
+ N
1192
1193
  );
1193
- return ie.fixProblems(), ie;
1194
+ return ue.fixProblems(), ue;
1194
1195
  }
1195
1196
  }
1196
- async function Ao(s, e = _r) {
1197
- const t = s.createEphemeral(Hr);
1197
+ async function Io(s, e = Wr) {
1198
+ const t = s.createEphemeral(zr);
1198
1199
  s.lock(t);
1199
1200
  const r = String(Date.now());
1200
- s.setKValue(t, Ot, JSON.stringify(Dt)), s.setKValue(t, $e, r), s.setKValue(t, re, r), s.setKValue(t, oe, JSON.stringify(e)), s.setKValue(t, z, JSON.stringify(Kr)), s.setKValue(t, de, JSON.stringify(Gr));
1201
- const o = await Nt();
1201
+ s.setKValue(t, Dt, JSON.stringify(xt)), s.setKValue(t, Ke, r), s.setKValue(t, ie, r), s.setKValue(t, ne, JSON.stringify(e)), s.setKValue(t, z, JSON.stringify(_r)), s.setKValue(t, he, JSON.stringify(Hr));
1202
+ const o = await Lt();
1202
1203
  return s.createField(
1203
- w(t, je(o.hash)),
1204
+ w(t, Te(o.hash)),
1204
1205
  "Dynamic",
1205
- b.wrapInHolder(s, Ke(s, o.spec))
1206
+ b.wrapInHolder(s, Ge(s, o.spec))
1206
1207
  ), t;
1207
1208
  }
1208
- async function Ce(s, e, t) {
1209
+ async function Fe(s, e, t) {
1209
1210
  return L(s, e, void 0, t);
1210
1211
  }
1211
1212
  async function L(s, e, t, r) {
1212
- if (s instanceof ur)
1213
+ if (s instanceof lr)
1213
1214
  return await s.withWriteTx("ProjectAction", async (o) => {
1214
- const n = await pe.load(o, e, t), i = await r(n);
1215
- return n.wasModified && (n.save(), await o.commit()), i;
1215
+ const i = await fe.load(o, e, t), n = await r(i);
1216
+ return i.wasModified && (i.save(), await o.commit()), n;
1216
1217
  });
1217
1218
  {
1218
- const o = await pe.load(s, e, t), n = await r(o);
1219
- return o.save(), n;
1219
+ const o = await fe.load(s, e, t), i = await r(o);
1220
+ return o.save(), i;
1220
1221
  }
1221
1222
  }
1222
- function* Eo(s) {
1223
+ function* No(s) {
1223
1224
  switch (s.type) {
1224
1225
  case "Json":
1225
1226
  return;
@@ -1234,21 +1235,21 @@ function* Eo(s) {
1234
1235
  D(s);
1235
1236
  }
1236
1237
  }
1237
- function ut(s, e) {
1238
+ function lt(s, e) {
1238
1239
  return Object.fromEntries(
1239
1240
  Object.entries(s).map(([t, r]) => [t, e(r, t)])
1240
1241
  );
1241
1242
  }
1242
- function Io(s, e) {
1243
+ function Vo(s, e) {
1243
1244
  switch (s.type) {
1244
1245
  case "Json":
1245
1246
  return { ...s };
1246
1247
  case "JsonPartitioned":
1247
- return { ...s, parts: ut(s.parts, e) };
1248
+ return { ...s, parts: lt(s.parts, e) };
1248
1249
  case "BinaryPartitioned":
1249
1250
  return {
1250
1251
  ...s,
1251
- parts: ut(s.parts, (t) => ({
1252
+ parts: lt(s.parts, (t) => ({
1252
1253
  index: e(t.index),
1253
1254
  values: e(t.values)
1254
1255
  }))
@@ -1257,26 +1258,26 @@ function Io(s, e) {
1257
1258
  D(s);
1258
1259
  }
1259
1260
  }
1260
- const Vo = se("PColumnData/JsonPartitioned", "1"), No = se(
1261
+ const Lo = ae("PColumnData/JsonPartitioned", "1"), Jo = ae(
1261
1262
  "PColumnData/Partitioned/JsonPartitioned",
1262
1263
  "1"
1263
- ), Lo = se("PColumnData/BinaryPartitioned", "1"), Jo = se(
1264
+ ), Uo = ae("PColumnData/BinaryPartitioned", "1"), Mo = ae(
1264
1265
  "PColumnData/Partitioned/BinaryPartitioned",
1265
1266
  "1"
1266
- ), Mo = se("PColumnData/Json", "1");
1267
- function Uo(s) {
1267
+ ), $o = ae("PColumnData/Json", "1");
1268
+ function Ko(s) {
1268
1269
  if (!s.getIsReadyOrError()) throw new Error("Data not ready.");
1269
1270
  const e = s.getDataAsJson();
1270
1271
  if (e === void 0)
1271
1272
  throw new Error("unexpected data info structure, no resource data");
1272
- if (G(s.resourceType, Mo)) {
1273
+ if (G(s.resourceType, $o)) {
1273
1274
  const t = e;
1274
1275
  return {
1275
1276
  type: "Json",
1276
1277
  keyLength: t.keyLength,
1277
1278
  data: t.data
1278
1279
  };
1279
- } else if (G(s.resourceType, Vo)) {
1280
+ } else if (G(s.resourceType, Lo)) {
1280
1281
  const t = e, r = Object.fromEntries(
1281
1282
  s.listInputFields().map((o) => [o, s.traverse({ field: o, errorIfFieldNotSet: !0 }).resourceInfo])
1282
1283
  );
@@ -1285,14 +1286,14 @@ function Uo(s) {
1285
1286
  partitionKeyLength: t.partitionKeyLength,
1286
1287
  parts: r
1287
1288
  };
1288
- } else if (G(s.resourceType, No)) {
1289
+ } else if (G(s.resourceType, Jo)) {
1289
1290
  const t = e, r = {};
1290
1291
  for (const o of s.listInputFields()) {
1291
- const n = s.traverse({ field: o, errorIfFieldNotSet: !0 }), i = n.listInputFields();
1292
- if (i === void 0) throw new Error(`no partition keys for super key ${o}`);
1293
- for (const a of i) {
1292
+ const i = s.traverse({ field: o, errorIfFieldNotSet: !0 }), n = i.listInputFields();
1293
+ if (n === void 0) throw new Error(`no partition keys for super key ${o}`);
1294
+ for (const a of n) {
1294
1295
  const c = JSON.stringify([...JSON.parse(o), ...JSON.parse(a)]);
1295
- r[c] = n.traverse({ field: a, errorIfFieldNotSet: !0 }).resourceInfo;
1296
+ r[c] = i.traverse({ field: a, errorIfFieldNotSet: !0 }).resourceInfo;
1296
1297
  }
1297
1298
  }
1298
1299
  return {
@@ -1300,44 +1301,44 @@ function Uo(s) {
1300
1301
  partitionKeyLength: t.superPartitionKeyLength + t.partitionKeyLength,
1301
1302
  parts: r
1302
1303
  };
1303
- } else if (G(s.resourceType, Lo)) {
1304
+ } else if (G(s.resourceType, Uo)) {
1304
1305
  const t = e, r = {};
1305
1306
  for (const o of s.listInputFields())
1306
1307
  if (o.endsWith(".index")) {
1307
- const n = o.slice(0, o.length - 6);
1308
- let i = r[n];
1309
- i === void 0 && (i = {}, r[n] = i), i.index = s.traverse({ field: o, errorIfFieldNotSet: !0 }).resourceInfo;
1308
+ const i = o.slice(0, o.length - 6);
1309
+ let n = r[i];
1310
+ n === void 0 && (n = {}, r[i] = n), n.index = s.traverse({ field: o, errorIfFieldNotSet: !0 }).resourceInfo;
1310
1311
  } else if (o.endsWith(".values")) {
1311
- const n = o.slice(0, o.length - 7);
1312
- let i = r[n];
1313
- i === void 0 && (i = {}, r[n] = i), i.values = s.traverse({ field: o, errorIfFieldNotSet: !0 }).resourceInfo;
1312
+ const i = o.slice(0, o.length - 7);
1313
+ let n = r[i];
1314
+ n === void 0 && (n = {}, r[i] = n), n.values = s.traverse({ field: o, errorIfFieldNotSet: !0 }).resourceInfo;
1314
1315
  } else throw new Error(`unrecognized part field name: ${o}`);
1315
- for (const [o, n] of Object.entries(r)) {
1316
- if (n.index === void 0) throw new Error(`no index for part ${o}`);
1317
- if (n.values === void 0) throw new Error(`no values for part ${o}`);
1316
+ for (const [o, i] of Object.entries(r)) {
1317
+ if (i.index === void 0) throw new Error(`no index for part ${o}`);
1318
+ if (i.values === void 0) throw new Error(`no values for part ${o}`);
1318
1319
  }
1319
1320
  return {
1320
1321
  type: "BinaryPartitioned",
1321
1322
  partitionKeyLength: t.partitionKeyLength,
1322
1323
  parts: r
1323
1324
  };
1324
- } else if (G(s.resourceType, Jo)) {
1325
+ } else if (G(s.resourceType, Mo)) {
1325
1326
  const t = e, r = {};
1326
1327
  for (const o of s.listInputFields()) {
1327
- const n = s.traverse({ field: o, errorIfFieldNotSet: !0 }), i = n.listInputFields();
1328
- if (i === void 0) throw new Error(`no partition keys for super key ${o}`);
1329
- for (const a of i)
1328
+ const i = s.traverse({ field: o, errorIfFieldNotSet: !0 }), n = i.listInputFields();
1329
+ if (n === void 0) throw new Error(`no partition keys for super key ${o}`);
1330
+ for (const a of n)
1330
1331
  if (a.endsWith(".index")) {
1331
1332
  const c = a.slice(0, a.length - 6), u = JSON.stringify([...JSON.parse(o), ...JSON.parse(c)]);
1332
1333
  let l = r[u];
1333
- l === void 0 && (l = {}, r[u] = l), r[u].index = n.traverse({
1334
+ l === void 0 && (l = {}, r[u] = l), r[u].index = i.traverse({
1334
1335
  field: a,
1335
1336
  errorIfFieldNotSet: !0
1336
1337
  }).resourceInfo;
1337
1338
  } else if (a.endsWith(".values")) {
1338
1339
  const c = a.slice(0, a.length - 7), u = JSON.stringify([...JSON.parse(o), ...JSON.parse(c)]);
1339
1340
  let l = r[u];
1340
- l === void 0 && (l = {}, r[u] = l), r[u].values = n.traverse({
1341
+ l === void 0 && (l = {}, r[u] = l), r[u].values = i.traverse({
1341
1342
  field: a,
1342
1343
  errorIfFieldNotSet: !0
1343
1344
  }).resourceInfo;
@@ -1349,15 +1350,15 @@ function Uo(s) {
1349
1350
  parts: r
1350
1351
  };
1351
1352
  }
1352
- throw new Error(`unsupported resource type: ${pr(s.resourceType)}`);
1353
+ throw new Error(`unsupported resource type: ${gr(s.resourceType)}`);
1353
1354
  }
1354
1355
  function Ve(s, e) {
1355
- const t = fe("sha256");
1356
- return t.update(Le(s)), t.update(String(le(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
1356
+ const t = ye("sha256");
1357
+ return t.update(Je(s)), t.update(String(ge(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
1357
1358
  }
1358
- function Lt(s, e = !0, t = !1, r = "") {
1359
+ function Jt(s, e = !0, t = !1, r = "") {
1359
1360
  var a, c, u;
1360
- const o = /^(?<name>.*)\.(?<type>spec|data)$/, n = /* @__PURE__ */ new Map();
1361
+ const o = /^(?<name>.*)\.(?<type>spec|data)$/, i = /* @__PURE__ */ new Map();
1361
1362
  for (const l of s.listInputFields()) {
1362
1363
  const d = l.match(o);
1363
1364
  if (!d) {
@@ -1371,8 +1372,8 @@ function Lt(s, e = !0, t = !1, r = "") {
1371
1372
  }
1372
1373
  g = g.slice(r.length);
1373
1374
  const f = C((c = d.groups) == null ? void 0 : c.type);
1374
- let v = n.get(g);
1375
- switch (v === void 0 && (v = {}, n.set(g, v)), f) {
1375
+ let v = i.get(g);
1376
+ switch (v === void 0 && (v = {}, i.set(g, v)), f) {
1376
1377
  case "spec":
1377
1378
  v.spec = (u = s.traverse({
1378
1379
  field: l,
@@ -1389,45 +1390,45 @@ function Lt(s, e = !0, t = !1, r = "") {
1389
1390
  continue;
1390
1391
  }
1391
1392
  }
1392
- const i = s.getInputsLocked();
1393
- if (i)
1394
- for (const [, l] of n) l.data === void 0 && (l.hasData = !1);
1395
- return { locked: i, results: n };
1393
+ const n = s.getInputsLocked();
1394
+ if (n)
1395
+ for (const [, l] of i) l.data === void 0 && (l.hasData = !1);
1396
+ return { locked: n, results: i };
1396
1397
  }
1397
- function $o(s, e = !0, t = "") {
1398
+ function Go(s, e = !0, t = "") {
1398
1399
  if (!s.getIsReadyOrError()) throw new Error("resource is not ready");
1399
- const r = Lt(s, e, !1, t);
1400
- Sr(r.locked);
1400
+ const r = Jt(s, e, !1, t);
1401
+ kr(r.locked);
1401
1402
  const o = {};
1402
- for (const [n, i] of r.results) {
1403
- if (i.spec === void 0) throw new Error(`no spec for key ${n}`);
1404
- if (i.hasData !== !0 || i.data === void 0)
1405
- throw new Error(`no data for key ${n}`);
1406
- const a = i.data();
1407
- if (a === void 0) throw new Error(`no data for key ${n}`);
1408
- if (!a.ok) throw new vr(a.error);
1409
- o[n] = {
1410
- id: Ve(i.spec, a.value),
1411
- spec: i.spec,
1403
+ for (const [i, n] of r.results) {
1404
+ if (n.spec === void 0) throw new Error(`no spec for key ${i}`);
1405
+ if (n.hasData !== !0 || n.data === void 0)
1406
+ throw new Error(`no data for key ${i}`);
1407
+ const a = n.data();
1408
+ if (a === void 0) throw new Error(`no data for key ${i}`);
1409
+ if (!a.ok) throw new yr(a.error);
1410
+ o[i] = {
1411
+ id: Ve(n.spec, a.value),
1412
+ spec: n.spec,
1412
1413
  data: a.value
1413
1414
  };
1414
1415
  }
1415
1416
  return o;
1416
1417
  }
1417
- class Ge {
1418
+ class _e {
1418
1419
  constructor(e, t) {
1419
1420
  p(this, "allSpecsAvailable");
1420
1421
  this.ctx = e, this.blocks = t;
1421
1422
  let r = !0;
1422
1423
  e: for (const o of t.values())
1423
- for (const n of [o.prod, o.staging])
1424
- if (n !== void 0) {
1425
- if (!n.locked) {
1424
+ for (const i of [o.prod, o.staging])
1425
+ if (i !== void 0) {
1426
+ if (!i.locked) {
1426
1427
  r = !1;
1427
1428
  break e;
1428
1429
  }
1429
- for (const i of n.results.values())
1430
- if (i.spec === void 0) {
1430
+ for (const n of i.results.values())
1431
+ if (n.spec === void 0) {
1431
1432
  r = !1;
1432
1433
  break e;
1433
1434
  }
@@ -1435,20 +1436,20 @@ class Ge {
1435
1436
  this.allSpecsAvailable = r;
1436
1437
  }
1437
1438
  getSpecByRef(e, t) {
1438
- var n, i, a, c, u, l;
1439
+ var i, n, a, c, u, l;
1439
1440
  const r = this.blocks.get(e);
1440
1441
  if (r === void 0) return;
1441
- let o = (a = (i = (n = r.prod) == null ? void 0 : n.results) == null ? void 0 : i.get(t)) == null ? void 0 : a.spec;
1442
+ let o = (a = (n = (i = r.prod) == null ? void 0 : i.results) == null ? void 0 : n.get(t)) == null ? void 0 : a.spec;
1442
1443
  if (o !== void 0 || (o = (l = (u = (c = r.staging) == null ? void 0 : c.results) == null ? void 0 : u.get(t)) == null ? void 0 : l.spec, o !== void 0)) return o;
1443
1444
  r.staging === void 0 ? this.ctx.markUnstable(`staging_not_rendered:${e}`) : r.staging.locked ? r.prod !== void 0 && !r.prod.locked && this.ctx.markUnstable(`prod_not_locked:${e}`) : this.ctx.markUnstable(`staging_not_locked:${e}`);
1444
1445
  }
1445
1446
  getDataOrErrorByRef(e, t) {
1446
- var i, a, c;
1447
+ var n, a, c;
1447
1448
  const r = this.blocks.get(e);
1448
1449
  if (r === void 0) return;
1449
- let o = (a = (i = r.prod) == null ? void 0 : i.results) == null ? void 0 : a.get(t), n = (c = o == null ? void 0 : o.data) == null ? void 0 : c.call(o);
1450
- if (o !== void 0 && o.spec !== void 0 && n !== void 0)
1451
- return vt(n, (u) => ({
1450
+ let o = (a = (n = r.prod) == null ? void 0 : n.results) == null ? void 0 : a.get(t), i = (c = o == null ? void 0 : o.data) == null ? void 0 : c.call(o);
1451
+ if (o !== void 0 && o.spec !== void 0 && i !== void 0)
1452
+ return yt(i, (u) => ({
1452
1453
  id: Ve(o.spec, u),
1453
1454
  spec: o.spec,
1454
1455
  data: u
@@ -1480,32 +1481,32 @@ class Ge {
1480
1481
  getDataWithErrors() {
1481
1482
  const e = [];
1482
1483
  let t = !0, r;
1483
- const o = (i) => {
1484
- r === void 0 && (r = i), t = !1;
1485
- }, n = (i, a, c) => {
1484
+ const o = (n) => {
1485
+ r === void 0 && (r = n), t = !1;
1486
+ }, i = (n, a, c) => {
1486
1487
  if (c.spec !== void 0 && c.hasData === !0 && c.data !== void 0) {
1487
1488
  const u = c.data();
1488
1489
  u !== void 0 ? e.push({
1489
- ref: ae(i, a),
1490
+ ref: le(n, a),
1490
1491
  obj: {
1491
1492
  id: u.ok ? Ve(c.spec, u.value) : void 0,
1492
1493
  spec: c.spec,
1493
1494
  data: u
1494
1495
  }
1495
- }) : o(`no_data:${i}:${a}`);
1496
+ }) : o(`no_data:${n}:${a}`);
1496
1497
  }
1497
1498
  };
1498
- for (const [i, a] of this.blocks) {
1499
+ for (const [n, a] of this.blocks) {
1499
1500
  const c = /* @__PURE__ */ new Set();
1500
1501
  if (a.prod !== void 0) {
1501
- a.prod.locked || o(`prod_not_locked:${i}`);
1502
+ a.prod.locked || o(`prod_not_locked:${n}`);
1502
1503
  for (const [u, l] of a.prod.results)
1503
- c.add(u), n(i, u, l);
1504
+ c.add(u), i(n, u, l);
1504
1505
  }
1505
1506
  if (a.staging !== void 0) {
1506
- a.staging.locked || o(`staging_not_locked:${i}`);
1507
+ a.staging.locked || o(`staging_not_locked:${n}`);
1507
1508
  for (const [u, l] of a.staging.results)
1508
- c.has(u) || n(i, u, l);
1509
+ c.has(u) || i(n, u, l);
1509
1510
  }
1510
1511
  }
1511
1512
  return { entries: e, isComplete: t, instabilityMarker: r };
@@ -1513,24 +1514,24 @@ class Ge {
1513
1514
  getSpecs() {
1514
1515
  const e = [];
1515
1516
  let t = !0, r;
1516
- const o = (n) => {
1517
- r === void 0 && (r = n), t = !1;
1517
+ const o = (i) => {
1518
+ r === void 0 && (r = i), t = !1;
1518
1519
  };
1519
- for (const [n, i] of this.blocks) {
1520
+ for (const [i, n] of this.blocks) {
1520
1521
  const a = /* @__PURE__ */ new Set();
1521
- if (i.staging !== void 0) {
1522
- i.staging.locked || o(`staging_not_locked:${n}`);
1523
- for (const [c, u] of i.staging.results)
1522
+ if (n.staging !== void 0) {
1523
+ n.staging.locked || o(`staging_not_locked:${i}`);
1524
+ for (const [c, u] of n.staging.results)
1524
1525
  u.spec !== void 0 && (e.push({
1525
- ref: ae(n, c),
1526
+ ref: le(i, c),
1526
1527
  obj: u.spec
1527
1528
  }), a.add(c));
1528
- } else o(`staging_not_rendered:${n}`);
1529
- if (i.prod !== void 0) {
1530
- i.prod.locked || o(`prod_not_locked:${n}`);
1531
- for (const [c, u] of i.prod.results)
1529
+ } else o(`staging_not_rendered:${i}`);
1530
+ if (n.prod !== void 0) {
1531
+ n.prod.locked || o(`prod_not_locked:${i}`);
1532
+ for (const [c, u] of n.prod.results)
1532
1533
  a.has(c) || u.spec !== void 0 && e.push({
1533
- ref: ae(n, c),
1534
+ ref: le(i, c),
1534
1535
  obj: u.spec
1535
1536
  });
1536
1537
  }
@@ -1540,23 +1541,23 @@ class Ge {
1540
1541
  calculateOptions(e) {
1541
1542
  const t = [];
1542
1543
  for (const r of this.blocks.values()) {
1543
- const o = /* @__PURE__ */ new Set(), n = (i) => {
1544
- for (const [a, c] of i.results)
1545
- o.has(a) || c.spec === void 0 || (o.add(a), Xt(e, c.spec) && t.push({
1544
+ const o = /* @__PURE__ */ new Set(), i = (n) => {
1545
+ for (const [a, c] of n.results)
1546
+ o.has(a) || c.spec === void 0 || (o.add(a), er(e, c.spec) && t.push({
1546
1547
  label: r.info.label + " / " + a,
1547
- ref: ae(r.info.id, a),
1548
+ ref: le(r.info.id, a),
1548
1549
  spec: c.spec
1549
1550
  }));
1550
1551
  };
1551
- r.staging !== void 0 && n(r.staging), r.prod !== void 0 && n(r.prod);
1552
+ r.staging !== void 0 && i(r.staging), r.prod !== void 0 && i(r.prod);
1552
1553
  }
1553
1554
  return t;
1554
1555
  }
1555
1556
  static create(e, t, r) {
1556
- const o = e.accessor(t).node(), n = C(o.getKeyValueAsJson(z)), a = Ee(n).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
1557
- for (const u of J(n)) {
1557
+ const o = e.accessor(t).node(), i = C(o.getKeyValueAsJson(z)), a = Ie(i).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
1558
+ for (const u of J(i)) {
1558
1559
  if (!a.has(u.id)) continue;
1559
- const l = lt(
1560
+ const l = dt(
1560
1561
  o.traverse({
1561
1562
  field: P(u.id, "prodCtx"),
1562
1563
  ignoreError: !0,
@@ -1567,7 +1568,7 @@ class Ge {
1567
1568
  field: P(u.id, "prodUiCtx"),
1568
1569
  stableIfNotFound: !0
1569
1570
  })
1570
- ), d = lt(
1571
+ ), d = dt(
1571
1572
  o.traverse({
1572
1573
  field: P(u.id, "stagingCtx"),
1573
1574
  ignoreError: !0,
@@ -1579,36 +1580,36 @@ class Ge {
1579
1580
  );
1580
1581
  c.set(u.id, { info: u, prod: l, staging: d });
1581
1582
  }
1582
- return new Ge(e, c);
1583
+ return new _e(e, c);
1583
1584
  }
1584
1585
  }
1585
- function lt(s, e) {
1586
+ function dt(s, e) {
1586
1587
  if (e === void 0)
1587
1588
  return s ? { locked: !1, results: /* @__PURE__ */ new Map() } : void 0;
1588
- if (e.ok) return Lt(e.value, !1, !0);
1589
+ if (e.ok) return Jt(e.value, !1, !0);
1589
1590
  }
1590
- function _e(s, e) {
1591
+ function He(s, e) {
1591
1592
  const t = s.persist(), r = C(
1592
1593
  s.traverse({
1593
1594
  field: P(e, "currentArgs"),
1594
1595
  errorIfFieldNotSet: !0
1595
1596
  }).getDataAsString()
1596
- ), o = s.getKeyValueAsString(De(e));
1597
+ ), o = s.getKeyValueAsString(xe(e));
1597
1598
  return {
1598
1599
  blockId: e,
1599
1600
  args: r,
1600
1601
  uiState: o,
1601
- blockMeta: (n) => {
1602
- const i = n.accessor(t).node(), a = C(i.getKeyValueAsJson(z)), c = /* @__PURE__ */ new Map();
1602
+ blockMeta: (i) => {
1603
+ const n = i.accessor(t).node(), a = C(n.getKeyValueAsJson(z)), c = /* @__PURE__ */ new Map();
1603
1604
  for (const u of J(a)) c.set(u.id, u);
1604
1605
  return c;
1605
1606
  }
1606
1607
  };
1607
1608
  }
1608
- function Jt(s, e) {
1609
+ function Ut(s, e) {
1609
1610
  const t = s.persist();
1610
1611
  return {
1611
- ..._e(s, e),
1612
+ ...He(s, e),
1612
1613
  prod: (r) => {
1613
1614
  var o;
1614
1615
  return (o = r.accessor(t).node({ ignoreError: !0 }).traverse({
@@ -1618,14 +1619,14 @@ function Jt(s, e) {
1618
1619
  })) == null ? void 0 : o.persist();
1619
1620
  },
1620
1621
  staging: (r) => {
1621
- var n;
1622
- const o = (n = r.accessor(t).node({ ignoreError: !0 }).traverse({
1622
+ var i;
1623
+ const o = (i = r.accessor(t).node({ ignoreError: !0 }).traverse({
1623
1624
  field: P(e, "stagingOutput"),
1624
1625
  ignoreError: !0
1625
- })) == null ? void 0 : n.persist();
1626
+ })) == null ? void 0 : i.persist();
1626
1627
  return o === void 0 && r.markUnstable("staging_not_rendered"), o;
1627
1628
  },
1628
- getResultsPool: (r) => Ge.create(r, t, e)
1629
+ getResultsPool: (r) => _e.create(r, t, e)
1629
1630
  };
1630
1631
  }
1631
1632
  function* j(s, e) {
@@ -1678,15 +1679,15 @@ function* j(s, e) {
1678
1679
  D(s);
1679
1680
  }
1680
1681
  }
1681
- function Ko(s, e) {
1682
+ function _o(s, e) {
1682
1683
  const t = {};
1683
1684
  for (const [r, o] of Object.entries(s)) t[r] = e(o);
1684
1685
  return t;
1685
1686
  }
1686
- function Z(s, e) {
1687
+ function te(s, e) {
1687
1688
  return s === void 0 ? void 0 : e(s);
1688
1689
  }
1689
- function Go(s) {
1690
+ function Ho(s) {
1690
1691
  switch (s.type) {
1691
1692
  case "GetImportProgress":
1692
1693
  return !0;
@@ -1694,35 +1695,35 @@ function Go(s) {
1694
1695
  return !1;
1695
1696
  }
1696
1697
  }
1697
- function _o(s) {
1698
- for (const e of j(s)) if (Go(e)) return !0;
1698
+ function Wo(s) {
1699
+ for (const e of j(s)) if (Ho(e)) return !0;
1699
1700
  return !1;
1700
1701
  }
1701
- function me(s) {
1702
+ function be(s) {
1702
1703
  return {
1703
1704
  type: "ReturnResult",
1704
1705
  result: s
1705
1706
  };
1706
1707
  }
1707
1708
  function h(s) {
1708
- return () => me(s);
1709
+ return () => be(s);
1709
1710
  }
1710
- const Ho = (s) => {
1711
+ const zo = (s) => {
1711
1712
  const e = {};
1712
1713
  for (const [t, r] of Object.entries(s)) e[t] = r;
1713
1714
  return h(e);
1714
- }, Wo = (s) => {
1715
+ }, qo = (s) => {
1715
1716
  const e = s.source;
1716
1717
  if (e === void 0) return h(void 0);
1717
1718
  const t = [];
1718
1719
  for (const r of e)
1719
1720
  r instanceof Array ? t.push(...r) : t.push(r);
1720
1721
  return h(t);
1721
- }, zo = (s) => {
1722
+ }, Yo = (s) => {
1722
1723
  const e = s.source, t = s.field;
1723
1724
  return e === void 0 || t === void 0 ? h(void 0) : ({ cCtx: r }) => {
1724
1725
  var o;
1725
- return me((o = r.accessor(e).node().traverse(t)) == null ? void 0 : o.persist());
1726
+ return be((o = r.accessor(e).node().traverse(t)) == null ? void 0 : o.persist());
1726
1727
  };
1727
1728
  };
1728
1729
  function Mt(s, e) {
@@ -1730,83 +1731,83 @@ function Mt(s, e) {
1730
1731
  for (let o = 0; o < r; o++) t[String(o)] = e(s[o]);
1731
1732
  return t;
1732
1733
  }
1733
- function Yo(s, e) {
1734
+ function Qo(s, e) {
1734
1735
  return (t) => {
1735
1736
  const r = t.source;
1736
1737
  return r === void 0 ? h(void 0) : () => ({
1737
1738
  type: "ScheduleSubroutine",
1738
- subroutine: Ut(r.length),
1739
+ subroutine: $t(r.length),
1739
1740
  args: Mt(r, (o) => m({ ...s, [e.itVar]: o }, e.mapping))
1740
1741
  });
1741
1742
  };
1742
1743
  }
1743
- function Ut(s) {
1744
+ function $t(s) {
1744
1745
  return (e) => {
1745
1746
  const t = [];
1746
1747
  for (let r = 0; r < s; r++) t.push(e[String(r)]);
1747
1748
  return h(t);
1748
1749
  };
1749
1750
  }
1750
- function qo(s, e) {
1751
+ function Zo(s, e) {
1751
1752
  return (t) => {
1752
1753
  const r = t.source;
1753
1754
  if (r === void 0) return h(void 0);
1754
1755
  const o = {};
1755
- for (const [n, i] of Object.entries(r)) {
1756
- const a = { ...s, [e.itVar]: i };
1757
- o[n] = m(a, e.mapping);
1756
+ for (const [i, n] of Object.entries(r)) {
1757
+ const a = { ...s, [e.itVar]: n };
1758
+ o[i] = m(a, e.mapping);
1758
1759
  }
1759
1760
  return () => ({
1760
1761
  type: "ScheduleSubroutine",
1761
- subroutine: Qo,
1762
+ subroutine: Xo,
1762
1763
  args: o
1763
1764
  });
1764
1765
  };
1765
1766
  }
1766
- const Qo = (s) => h(s), Zo = (s) => {
1767
+ const Xo = (s) => h(s), es = (s) => {
1767
1768
  const e = s.arg;
1768
1769
  return h(e === void 0 ? void 0 : e.length === 0);
1769
- }, Xo = (s) => {
1770
+ }, ts = (s) => {
1770
1771
  const e = s.operand;
1771
1772
  return h(e === void 0 ? void 0 : !e);
1772
- }, es = (s) => {
1773
+ }, rs = (s) => {
1773
1774
  const e = s.operand1, t = s.operand2;
1774
1775
  return h(e === void 0 || t === void 0 ? void 0 : e && t);
1775
- }, ts = (s) => {
1776
+ }, os = (s) => {
1776
1777
  const e = s.operand1, t = s.operand2;
1777
1778
  return h(e === void 0 || t === void 0 ? void 0 : e || t);
1778
- }, rs = (s) => {
1779
+ }, ss = (s) => {
1779
1780
  const e = s.source;
1780
1781
  return e === void 0 ? h(void 0) : ({ cCtx: t }) => {
1781
1782
  var r;
1782
- return me((r = t.accessor(e).node()) == null ? void 0 : r.getDataAsJson());
1783
+ return be((r = t.accessor(e).node()) == null ? void 0 : r.getDataAsJson());
1783
1784
  };
1784
- }, os = (s) => {
1785
+ }, is = (s) => {
1785
1786
  const e = s.source, t = s.field;
1786
1787
  return h(e === void 0 || t === void 0 ? void 0 : e[t]);
1787
1788
  };
1788
- function ss(s, e) {
1789
+ function ns(s, e) {
1789
1790
  return (t) => {
1790
1791
  const r = t.source;
1791
1792
  return r === void 0 ? h(void 0) : ({ cCtx: o }) => {
1792
- const n = o.accessor(r).node(), i = {};
1793
- for (const a of n.listInputFields()) {
1794
- const c = n.traverse(a);
1795
- if (c === void 0) i[a] = h(void 0);
1793
+ const i = o.accessor(r).node(), n = {};
1794
+ for (const a of i.listInputFields()) {
1795
+ const c = i.traverse(a);
1796
+ if (c === void 0) n[a] = h(void 0);
1796
1797
  else {
1797
1798
  const u = { ...s, [e.itVar]: c.persist() };
1798
- i[a] = m(u, e.mapping);
1799
+ n[a] = m(u, e.mapping);
1799
1800
  }
1800
1801
  }
1801
1802
  return {
1802
1803
  type: "ScheduleSubroutine",
1803
- subroutine: ns,
1804
- args: i
1804
+ subroutine: as,
1805
+ args: n
1805
1806
  };
1806
1807
  };
1807
1808
  };
1808
1809
  }
1809
- const ns = (s) => h(s), is = (s) => {
1810
+ const as = (s) => h(s), cs = (s) => {
1810
1811
  const e = s.source;
1811
1812
  return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1812
1813
  type: "ScheduleComputable",
@@ -1820,18 +1821,18 @@ const ns = (s) => h(s), is = (s) => {
1820
1821
  }
1821
1822
  )
1822
1823
  });
1823
- }, as = (s) => {
1824
+ }, us = (s) => {
1824
1825
  const e = s.source;
1825
1826
  return e === void 0 ? h(void 0) : ({ cCtx: t, drivers: r }) => {
1826
1827
  const o = t.accessor(e).node().resourceInfo;
1827
1828
  return {
1828
1829
  type: "ScheduleComputable",
1829
1830
  computable: R.make(() => r.blobDriver.getDownloadedBlob(o), {
1830
- postprocessValue: async (n) => n === void 0 ? void 0 : (await r.blobDriver.getContent(n.handle)).toString()
1831
+ postprocessValue: async (i) => i === void 0 ? void 0 : (await r.blobDriver.getContent(i.handle)).toString()
1831
1832
  })
1832
1833
  };
1833
1834
  };
1834
- }, cs = (s) => {
1835
+ }, ls = (s) => {
1835
1836
  const e = s.source;
1836
1837
  return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1837
1838
  type: "ScheduleComputable",
@@ -1847,37 +1848,37 @@ const ns = (s) => h(s), is = (s) => {
1847
1848
  }
1848
1849
  )
1849
1850
  });
1850
- }, us = (s) => {
1851
+ }, ds = (s) => {
1851
1852
  const e = s.source;
1852
1853
  return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1853
1854
  type: "ScheduleComputable",
1854
1855
  computable: t.blobDriver.getDownloadedBlob(e)
1855
1856
  });
1856
- }, ls = (s) => {
1857
+ }, ps = (s) => {
1857
1858
  const e = s.source;
1858
1859
  return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1859
1860
  type: "ScheduleComputable",
1860
1861
  computable: t.blobDriver.getOnDemandBlob(e)
1861
1862
  });
1862
- }, ds = (s) => {
1863
+ }, gs = (s) => {
1863
1864
  const e = s.source;
1864
1865
  return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1865
1866
  type: "ScheduleComputable",
1866
1867
  computable: t.uploadDriver.getProgressId(e)
1867
1868
  });
1868
- }, ps = (s) => (e) => {
1869
+ }, hs = (s) => (e) => {
1869
1870
  const t = e.source;
1870
1871
  return t === void 0 ? h(void 0) : ({ drivers: r }) => ({
1871
1872
  type: "ScheduleComputable",
1872
1873
  computable: r.logDriver.getLastLogs(t, s)
1873
1874
  });
1874
- }, gs = (s) => (e) => {
1875
+ }, fs = (s) => (e) => {
1875
1876
  const t = e.source;
1876
1877
  return t === void 0 ? h(void 0) : ({ drivers: r }) => ({
1877
1878
  type: "ScheduleComputable",
1878
1879
  computable: r.logDriver.getProgressLog(t, s)
1879
1880
  });
1880
- }, hs = (s) => {
1881
+ }, ms = (s) => {
1881
1882
  const e = s.source;
1882
1883
  return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1883
1884
  type: "ScheduleComputable",
@@ -1888,18 +1889,18 @@ function m(s, e) {
1888
1889
  switch (e.type) {
1889
1890
  case "GetFromCtx":
1890
1891
  const t = s[e.variable];
1891
- return typeof t == "function" ? (r) => me(t(r.cCtx)) : (t === void 0 && console.log("asdasd"), h(t));
1892
+ return typeof t == "function" ? (r) => be(t(r.cCtx)) : (t === void 0 && console.log("asdasd"), h(t));
1892
1893
  case "Isolate":
1893
1894
  return ({ drivers: r }) => ({
1894
1895
  type: "ScheduleComputable",
1895
- computable: Gt(r, s, e.cfg)
1896
+ computable: _t(r, s, e.cfg)
1896
1897
  });
1897
1898
  case "Immediate":
1898
1899
  return h(e.value);
1899
1900
  case "GetJsonField":
1900
1901
  return () => ({
1901
1902
  type: "ScheduleSubroutine",
1902
- subroutine: os,
1903
+ subroutine: is,
1903
1904
  args: {
1904
1905
  source: m(s, e.source),
1905
1906
  field: m(s, e.field)
@@ -1908,7 +1909,7 @@ function m(s, e) {
1908
1909
  case "MapArrayValues":
1909
1910
  return () => ({
1910
1911
  type: "ScheduleSubroutine",
1911
- subroutine: Yo(s, e),
1912
+ subroutine: Qo(s, e),
1912
1913
  args: {
1913
1914
  source: m(s, e.source)
1914
1915
  }
@@ -1916,7 +1917,7 @@ function m(s, e) {
1916
1917
  case "MapRecordValues":
1917
1918
  return () => ({
1918
1919
  type: "ScheduleSubroutine",
1919
- subroutine: qo(s, e),
1920
+ subroutine: Zo(s, e),
1920
1921
  args: {
1921
1922
  source: m(s, e.source)
1922
1923
  }
@@ -1924,19 +1925,19 @@ function m(s, e) {
1924
1925
  case "MakeObject":
1925
1926
  return () => ({
1926
1927
  type: "ScheduleSubroutine",
1927
- subroutine: Ho,
1928
- args: Ko(e.template, (r) => m(s, r))
1928
+ subroutine: zo,
1929
+ args: _o(e.template, (r) => m(s, r))
1929
1930
  });
1930
1931
  case "MakeArray":
1931
1932
  return () => ({
1932
1933
  type: "ScheduleSubroutine",
1933
- subroutine: Ut(e.template.length),
1934
+ subroutine: $t(e.template.length),
1934
1935
  args: Mt(e.template, (r) => m(s, r))
1935
1936
  });
1936
1937
  case "Flatten":
1937
1938
  return () => ({
1938
1939
  type: "ScheduleSubroutine",
1939
- subroutine: Wo,
1940
+ subroutine: qo,
1940
1941
  args: {
1941
1942
  source: m(s, e.source)
1942
1943
  }
@@ -1944,7 +1945,7 @@ function m(s, e) {
1944
1945
  case "IsEmpty":
1945
1946
  return () => ({
1946
1947
  type: "ScheduleSubroutine",
1947
- subroutine: Zo,
1948
+ subroutine: es,
1948
1949
  args: {
1949
1950
  arg: m(s, e.arg)
1950
1951
  }
@@ -1952,7 +1953,7 @@ function m(s, e) {
1952
1953
  case "Not":
1953
1954
  return () => ({
1954
1955
  type: "ScheduleSubroutine",
1955
- subroutine: Xo,
1956
+ subroutine: ts,
1956
1957
  args: {
1957
1958
  operand: m(s, e.operand)
1958
1959
  }
@@ -1960,7 +1961,7 @@ function m(s, e) {
1960
1961
  case "And":
1961
1962
  return () => ({
1962
1963
  type: "ScheduleSubroutine",
1963
- subroutine: es,
1964
+ subroutine: rs,
1964
1965
  args: {
1965
1966
  operand1: m(s, e.operand1),
1966
1967
  operand2: m(s, e.operand2)
@@ -1969,7 +1970,7 @@ function m(s, e) {
1969
1970
  case "Or":
1970
1971
  return () => ({
1971
1972
  type: "ScheduleSubroutine",
1972
- subroutine: ts,
1973
+ subroutine: os,
1973
1974
  args: {
1974
1975
  operand1: m(s, e.operand1),
1975
1976
  operand2: m(s, e.operand2)
@@ -1978,7 +1979,7 @@ function m(s, e) {
1978
1979
  case "MapResourceFields":
1979
1980
  return () => ({
1980
1981
  type: "ScheduleSubroutine",
1981
- subroutine: ss(s, e),
1982
+ subroutine: ns(s, e),
1982
1983
  args: {
1983
1984
  source: m(s, e.source)
1984
1985
  }
@@ -1986,7 +1987,7 @@ function m(s, e) {
1986
1987
  case "GetResourceField":
1987
1988
  return () => ({
1988
1989
  type: "ScheduleSubroutine",
1989
- subroutine: zo,
1990
+ subroutine: Yo,
1990
1991
  args: {
1991
1992
  source: m(s, e.source),
1992
1993
  field: m(s, e.field)
@@ -1995,7 +1996,7 @@ function m(s, e) {
1995
1996
  case "GetResourceValueAsJson":
1996
1997
  return () => ({
1997
1998
  type: "ScheduleSubroutine",
1998
- subroutine: rs,
1999
+ subroutine: ss,
1999
2000
  args: {
2000
2001
  source: m(s, e.source)
2001
2002
  }
@@ -2003,7 +2004,7 @@ function m(s, e) {
2003
2004
  case "GetBlobContent":
2004
2005
  return () => ({
2005
2006
  type: "ScheduleSubroutine",
2006
- subroutine: is,
2007
+ subroutine: cs,
2007
2008
  args: {
2008
2009
  source: m(s, e.source)
2009
2010
  }
@@ -2011,7 +2012,7 @@ function m(s, e) {
2011
2012
  case "GetBlobContentAsString":
2012
2013
  return () => ({
2013
2014
  type: "ScheduleSubroutine",
2014
- subroutine: as,
2015
+ subroutine: us,
2015
2016
  args: {
2016
2017
  source: m(s, e.source)
2017
2018
  }
@@ -2019,7 +2020,7 @@ function m(s, e) {
2019
2020
  case "GetBlobContentAsJson":
2020
2021
  return () => ({
2021
2022
  type: "ScheduleSubroutine",
2022
- subroutine: cs,
2023
+ subroutine: ls,
2023
2024
  args: {
2024
2025
  source: m(s, e.source)
2025
2026
  }
@@ -2027,7 +2028,7 @@ function m(s, e) {
2027
2028
  case "GetDownloadedBlobContent":
2028
2029
  return () => ({
2029
2030
  type: "ScheduleSubroutine",
2030
- subroutine: us,
2031
+ subroutine: ds,
2031
2032
  args: {
2032
2033
  source: m(s, e.source)
2033
2034
  }
@@ -2035,7 +2036,7 @@ function m(s, e) {
2035
2036
  case "GetOnDemandBlobContent":
2036
2037
  return () => ({
2037
2038
  type: "ScheduleSubroutine",
2038
- subroutine: ls,
2039
+ subroutine: ps,
2039
2040
  args: {
2040
2041
  source: m(s, e.source)
2041
2042
  }
@@ -2043,7 +2044,7 @@ function m(s, e) {
2043
2044
  case "GetImportProgress":
2044
2045
  return () => ({
2045
2046
  type: "ScheduleSubroutine",
2046
- subroutine: ds,
2047
+ subroutine: gs,
2047
2048
  args: {
2048
2049
  source: m(s, e.source)
2049
2050
  }
@@ -2051,7 +2052,7 @@ function m(s, e) {
2051
2052
  case "GetLastLogs":
2052
2053
  return () => ({
2053
2054
  type: "ScheduleSubroutine",
2054
- subroutine: ps(e.lines),
2055
+ subroutine: hs(e.lines),
2055
2056
  args: {
2056
2057
  source: m(s, e.source)
2057
2058
  }
@@ -2059,7 +2060,7 @@ function m(s, e) {
2059
2060
  case "GetProgressLog":
2060
2061
  return () => ({
2061
2062
  type: "ScheduleSubroutine",
2062
- subroutine: gs(e.patternToSearch),
2063
+ subroutine: fs(e.patternToSearch),
2063
2064
  args: {
2064
2065
  source: m(s, e.source)
2065
2066
  }
@@ -2067,7 +2068,7 @@ function m(s, e) {
2067
2068
  case "GetLogHandle":
2068
2069
  return () => ({
2069
2070
  type: "ScheduleSubroutine",
2070
- subroutine: hs,
2071
+ subroutine: ms,
2071
2072
  args: {
2072
2073
  source: m(s, e.source)
2073
2074
  }
@@ -2076,8 +2077,8 @@ function m(s, e) {
2076
2077
  return D(e);
2077
2078
  }
2078
2079
  }
2079
- const fs = ["$prod", "$staging"];
2080
- function ms(s) {
2080
+ const vs = ["$prod", "$staging"];
2081
+ function ys(s) {
2081
2082
  return {
2082
2083
  $blockId: s.blockId,
2083
2084
  $args: JSON.parse(s.args),
@@ -2086,16 +2087,16 @@ function ms(s) {
2086
2087
  $staging: s.staging
2087
2088
  };
2088
2089
  }
2089
- const $t = Symbol(), Kt = "return", vs = { op: $t, arg: Kt };
2090
- function ys(s) {
2091
- return s.op == $t && s.arg == Kt;
2090
+ const Kt = Symbol(), Gt = "return", bs = { op: Kt, arg: Gt };
2091
+ function ws(s) {
2092
+ return s.op == Kt && s.arg == Gt;
2092
2093
  }
2093
- function bs() {
2094
+ function Ss() {
2094
2095
  return { pendingSubroutines: /* @__PURE__ */ new Map() };
2095
2096
  }
2096
- function dt(s, e, t, r) {
2097
- const o = new Pt(t), n = (a, c) => {
2098
- if (ys(a))
2097
+ function pt(s, e, t, r) {
2098
+ const o = new Rt(t), i = (a, c) => {
2099
+ if (ws(a))
2099
2100
  return e.result = c, !1;
2100
2101
  const u = C(e.pendingSubroutines.get(a.op));
2101
2102
  if (a.arg in u.args) throw new Error("argument already set");
@@ -2103,12 +2104,12 @@ function dt(s, e, t, r) {
2103
2104
  destination: u.destination,
2104
2105
  operation: u.subroutine(u.args)
2105
2106
  })), !0;
2106
- }, i = [];
2107
+ }, n = [];
2107
2108
  e: for (; o.length > 0; ) {
2108
2109
  const a = o.shift(), c = a.operation(s);
2109
2110
  switch (c.type) {
2110
2111
  case "ReturnResult":
2111
- if (!n(a.destination, c.result)) break e;
2112
+ if (!i(a.destination, c.result)) break e;
2112
2113
  break;
2113
2114
  case "ScheduleSubroutine":
2114
2115
  const u = Symbol(), l = Object.entries(c.args), d = l.length;
@@ -2134,7 +2135,7 @@ function dt(s, e, t, r) {
2134
2135
  case "ScheduleComputable":
2135
2136
  if (!r)
2136
2137
  throw new Error("asynchronous operations are forbidden in this context");
2137
- i.push({
2138
+ n.push({
2138
2139
  destination: a.destination,
2139
2140
  computable: c.computable
2140
2141
  });
@@ -2143,26 +2144,26 @@ function dt(s, e, t, r) {
2143
2144
  D(c);
2144
2145
  }
2145
2146
  }
2146
- return i;
2147
+ return n;
2147
2148
  }
2148
- function ws(s, e, t, r = {}) {
2149
- return Gt(s, ms(e), t, r);
2149
+ function ks(s, e, t, r = {}) {
2150
+ return _t(s, ys(e), t, r);
2150
2151
  }
2151
- function Gt(s, e, t, r = {}) {
2152
- const o = Le({
2153
- ctx: Object.fromEntries(Object.entries(e).filter(([n]) => fs.indexOf(n) === -1)),
2152
+ function _t(s, e, t, r = {}) {
2153
+ const o = Je({
2154
+ ctx: Object.fromEntries(Object.entries(e).filter(([i]) => vs.indexOf(i) === -1)),
2154
2155
  cfg: t
2155
2156
  });
2156
2157
  return R.makeRaw(
2157
- (n) => {
2158
- const i = { drivers: s, cCtx: n }, a = bs();
2158
+ (i) => {
2159
+ const n = { drivers: s, cCtx: i }, a = Ss();
2159
2160
  return {
2160
- ir: dt(
2161
- i,
2161
+ ir: pt(
2162
+ n,
2162
2163
  a,
2163
2164
  [
2164
2165
  {
2165
- destination: vs,
2166
+ destination: bs,
2166
2167
  operation: m(e, t)
2167
2168
  }
2168
2169
  ],
@@ -2184,7 +2185,7 @@ function Gt(s, e, t, r = {}) {
2184
2185
  result: a.result,
2185
2186
  pendingSubroutines: g
2186
2187
  };
2187
- if (dt(d, f, l, !1), !("result" in f))
2188
+ if (pt(d, f, l, !1), !("result" in f))
2188
2189
  throw new Error("illegal cfg rendering stack state, no result");
2189
2190
  return f.result;
2190
2191
  }
@@ -2193,14 +2194,14 @@ function Gt(s, e, t, r = {}) {
2193
2194
  { ...r, key: o }
2194
2195
  );
2195
2196
  }
2196
- function Ss(s) {
2197
+ function Cs(s) {
2197
2198
  return s instanceof ArrayBuffer || ArrayBuffer.isView(s);
2198
2199
  }
2199
- function pt(s) {
2200
+ function gt(s) {
2200
2201
  return s !== void 0 ? Buffer.from(s).toString("base64") : void 0;
2201
2202
  }
2202
- class ge {
2203
- constructor(e, t, r, o, n) {
2203
+ class me {
2204
+ constructor(e, t, r, o, i) {
2204
2205
  p(this, "callbackRegistry");
2205
2206
  p(this, "fnJSONStringify");
2206
2207
  p(this, "fnJSONParse");
@@ -2212,14 +2213,14 @@ class ge {
2212
2213
  // Result Pool
2213
2214
  //
2214
2215
  p(this, "_resultPool");
2215
- if (this.scope = e, this.vm = t, this.blockCtx = r, this.env = o, this.computableCtx = n, this.callbackRegistry = this.scope.manage(this.vm.newObject()), this.fnJSONStringify = e.manage(
2216
- t.getProp(t.global, "JSON").consume((i) => t.getProp(i, "stringify"))
2216
+ if (this.scope = e, this.vm = t, this.blockCtx = r, this.env = o, this.computableCtx = i, this.callbackRegistry = this.scope.manage(this.vm.newObject()), this.fnJSONStringify = e.manage(
2217
+ t.getProp(t.global, "JSON").consume((n) => t.getProp(n, "stringify"))
2217
2218
  ), t.typeof(this.fnJSONStringify) !== "function")
2218
2219
  throw new Error("JSON.stringify() not found.");
2219
2220
  if (this.fnJSONParse = e.manage(
2220
- t.getProp(t.global, "JSON").consume((i) => t.getProp(i, "parse"))
2221
+ t.getProp(t.global, "JSON").consume((n) => t.getProp(n, "parse"))
2221
2222
  ), t.typeof(this.fnJSONParse) !== "function") throw new Error("JSON.parse() not found.");
2222
- this.meta = r.blockMeta(n), this.injectCtx();
2223
+ this.meta = r.blockMeta(i), this.injectCtx();
2223
2224
  }
2224
2225
  resetComputableCtx() {
2225
2226
  this.computableCtx = void 0, this.accessors.clear();
@@ -2231,12 +2232,12 @@ class ge {
2231
2232
  try {
2232
2233
  this.vm.unwrapResult(this.vm.evalCode(e, "bundle.js", { type: "global" })).dispose();
2233
2234
  } catch (t) {
2234
- throw ge.cleanErrorContext(t), t;
2235
+ throw me.cleanErrorContext(t), t;
2235
2236
  }
2236
2237
  }
2237
2238
  runCallback(e, ...t) {
2238
2239
  try {
2239
- return Oe.withScope((r) => {
2240
+ return De.withScope((r) => {
2240
2241
  const o = r.manage(this.vm.getProp(this.callbackRegistry, e));
2241
2242
  if (this.vm.typeof(o) !== "function")
2242
2243
  throw new Error(`No such callback: ${e}`);
@@ -2245,13 +2246,13 @@ class ge {
2245
2246
  this.vm.callFunction(
2246
2247
  o,
2247
2248
  this.vm.undefined,
2248
- ...t.map((n) => this.exportObjectUniversal(n, r))
2249
+ ...t.map((i) => this.exportObjectUniversal(i, r))
2249
2250
  )
2250
2251
  )
2251
2252
  );
2252
2253
  });
2253
2254
  } catch (r) {
2254
- throw ge.cleanErrorContext(r), r;
2255
+ throw me.cleanErrorContext(r), r;
2255
2256
  }
2256
2257
  }
2257
2258
  //
@@ -2262,10 +2263,10 @@ class ge {
2262
2263
  throw new Error("Accessors can't be used in this context");
2263
2264
  const t = (r, o) => {
2264
2265
  if (!this.accessors.has(r)) {
2265
- const n = this.blockCtx[o];
2266
- if (n === void 0) throw new Error("Staging context not available");
2267
- const i = n(this.computableCtx);
2268
- i ? this.accessors.set(r, this.computableCtx.accessor(i).node({ ignoreError: !0 })) : this.accessors.set(r, void 0);
2266
+ const i = this.blockCtx[o];
2267
+ if (i === void 0) throw new Error("Staging context not available");
2268
+ const n = i(this.computableCtx);
2269
+ n ? this.accessors.set(r, this.computableCtx.accessor(n).node({ ignoreError: !0 })) : this.accessors.set(r, void 0);
2269
2270
  }
2270
2271
  return this.accessors.get(r) ? r : void 0;
2271
2272
  };
@@ -2306,13 +2307,13 @@ class ge {
2306
2307
  return this.getAccessor(e).listDynamicFields();
2307
2308
  }
2308
2309
  getKeyValueBase64(e, t) {
2309
- return pt(this.getAccessor(e).getKeyValue(t));
2310
+ return gt(this.getAccessor(e).getKeyValue(t));
2310
2311
  }
2311
2312
  getKeyValueAsString(e, t) {
2312
2313
  return this.getAccessor(e).getKeyValueAsString(t);
2313
2314
  }
2314
2315
  getDataBase64(e) {
2315
- return pt(this.getAccessor(e).getData());
2316
+ return gt(this.getAccessor(e).getData());
2316
2317
  }
2317
2318
  getDataAsString(e) {
2318
2319
  return this.getAccessor(e).getDataAsString();
@@ -2323,16 +2324,16 @@ class ge {
2323
2324
  parsePObjectCollection(e, t, r) {
2324
2325
  const o = this.getAccessor(e);
2325
2326
  if (!o.getIsReadyOrError()) return;
2326
- const n = $o(o, t, r), i = {};
2327
- for (const [a, c] of Object.entries(n))
2328
- i[a] = Q(c, (u) => this.wrapAccessor(u));
2329
- return i;
2327
+ const i = Go(o, t, r), n = {};
2328
+ for (const [a, c] of Object.entries(i))
2329
+ n[a] = X(c, (u) => this.wrapAccessor(u));
2330
+ return n;
2330
2331
  }
2331
2332
  //
2332
2333
  // Blobs
2333
2334
  //
2334
2335
  registerComputable(e, t) {
2335
- const r = `${e}_${te()}`;
2336
+ const r = `${e}_${se()}`;
2336
2337
  return this.computablesToResolve[r] = t, r;
2337
2338
  }
2338
2339
  getBlobContentAsString(e) {
@@ -2441,7 +2442,7 @@ class ge {
2441
2442
  isComplete: e.isComplete,
2442
2443
  entries: e.entries.map((t) => ({
2443
2444
  ref: t.ref,
2444
- obj: Q(t.obj, (r) => this.wrapAccessor(r))
2445
+ obj: X(t.obj, (r) => this.wrapAccessor(r))
2445
2446
  }))
2446
2447
  };
2447
2448
  }
@@ -2454,7 +2455,7 @@ class ge {
2454
2455
  obj: {
2455
2456
  id: t.obj.id,
2456
2457
  spec: t.obj.spec,
2457
- data: vt(t.obj.data, (r) => this.wrapAccessor(r))
2458
+ data: yt(t.obj.data, (r) => this.wrapAccessor(r))
2458
2459
  }
2459
2460
  }))
2460
2461
  };
@@ -2467,7 +2468,7 @@ class ge {
2467
2468
  return this.resultPool.getSpecByRef(e, t);
2468
2469
  }
2469
2470
  getDataFromResultPoolByRef(e, t) {
2470
- return Q(
2471
+ return X(
2471
2472
  this.resultPool.getDataByRef(e, t),
2472
2473
  (r) => this.wrapAccessor(r)
2473
2474
  );
@@ -2481,7 +2482,7 @@ class ge {
2481
2482
  "can't instantiate PFrames from this context (most porbably called from the future mapper)"
2482
2483
  );
2483
2484
  return this.env.driverKit.pFrameDriver.createPFrame(
2484
- e.map((t) => Q(t, (r) => this.getAccessor(r))),
2485
+ e.map((t) => X(t, (r) => this.getAccessor(r))),
2485
2486
  this.computableCtx
2486
2487
  );
2487
2488
  }
@@ -2491,7 +2492,7 @@ class ge {
2491
2492
  "can't instantiate PTable from this context (most porbably called from the future mapper)"
2492
2493
  );
2493
2494
  return this.env.driverKit.pFrameDriver.createPTable(
2494
- yt(e, (t) => Q(t, (r) => this.getAccessor(r))),
2495
+ bt(e, (t) => X(t, (r) => this.getAccessor(r))),
2495
2496
  this.computableCtx
2496
2497
  );
2497
2498
  }
@@ -2512,7 +2513,7 @@ class ge {
2512
2513
  }
2513
2514
  wrapAccessor(e) {
2514
2515
  if (e !== void 0) {
2515
- const t = te();
2516
+ const t = se();
2516
2517
  return this.accessors.set(t, e), t;
2517
2518
  }
2518
2519
  }
@@ -2544,7 +2545,7 @@ class ge {
2544
2545
  r = this.vm.null;
2545
2546
  break;
2546
2547
  }
2547
- if (Ss(e)) {
2548
+ if (Cs(e)) {
2548
2549
  r = this.vm.newArrayBuffer(e), o = !0;
2549
2550
  break;
2550
2551
  }
@@ -2580,39 +2581,39 @@ class ge {
2580
2581
  return JSON.parse(t);
2581
2582
  }
2582
2583
  injectCtx() {
2583
- Oe.withScope((e) => {
2584
+ De.withScope((e) => {
2584
2585
  const t = e.manage(this.vm.newObject());
2585
2586
  this.vm.setProp(t, "args", e.manage(this.vm.newString(this.blockCtx.args))), this.blockCtx.uiState !== void 0 && this.vm.setProp(
2586
2587
  t,
2587
2588
  "uiState",
2588
2589
  e.manage(this.vm.newString(this.blockCtx.uiState))
2589
2590
  ), this.vm.setProp(t, "callbackRegistry", this.callbackRegistry);
2590
- const r = (o, n) => {
2591
- this.vm.newFunction(o, n).consume((i) => this.vm.setProp(t, o, i));
2591
+ const r = (o, i) => {
2592
+ this.vm.newFunction(o, i).consume((n) => this.vm.setProp(t, o, n));
2592
2593
  };
2593
2594
  r("getAccessorHandleByName", (o) => this.exportSingleValue(
2594
2595
  this.getAccessorHandleByName(this.vm.getString(o)),
2595
2596
  void 0
2596
- )), r("resolveWithCommon", (o, n, ...i) => this.exportSingleValue(
2597
+ )), r("resolveWithCommon", (o, i, ...n) => this.exportSingleValue(
2597
2598
  this.resolveWithCommon(
2598
2599
  this.vm.getString(o),
2599
- this.importObjectViaJson(n),
2600
- ...i.map(
2600
+ this.importObjectViaJson(i),
2601
+ ...n.map(
2601
2602
  (a) => this.importObjectViaJson(a)
2602
2603
  )
2603
2604
  ),
2604
2605
  void 0
2605
- )), r("getResourceType", (o) => this.exportObjectViaJson(this.getResourceType(this.vm.getString(o)), void 0)), r("getInputsLocked", (o) => this.exportSingleValue(this.getInputsLocked(this.vm.getString(o)), void 0)), r("getOutputsLocked", (o) => this.exportSingleValue(this.getOutputsLocked(this.vm.getString(o)), void 0)), r("getIsReadyOrError", (o) => this.exportSingleValue(this.getIsReadyOrError(this.vm.getString(o)), void 0)), r("getIsFinal", (o) => this.exportSingleValue(this.getIsFinal(this.vm.getString(o)), void 0)), r("getError", (o) => this.exportSingleValue(this.getError(this.vm.getString(o)), void 0)), r("listInputFields", (o) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(o)), void 0)), r("listOutputFields", (o) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(o)), void 0)), r("listDynamicFields", (o) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(o)), void 0)), r("getKeyValueBase64", (o, n) => this.exportSingleValue(
2606
- this.getKeyValueBase64(this.vm.getString(o), this.vm.getString(n)),
2606
+ )), r("getResourceType", (o) => this.exportObjectViaJson(this.getResourceType(this.vm.getString(o)), void 0)), r("getInputsLocked", (o) => this.exportSingleValue(this.getInputsLocked(this.vm.getString(o)), void 0)), r("getOutputsLocked", (o) => this.exportSingleValue(this.getOutputsLocked(this.vm.getString(o)), void 0)), r("getIsReadyOrError", (o) => this.exportSingleValue(this.getIsReadyOrError(this.vm.getString(o)), void 0)), r("getIsFinal", (o) => this.exportSingleValue(this.getIsFinal(this.vm.getString(o)), void 0)), r("getError", (o) => this.exportSingleValue(this.getError(this.vm.getString(o)), void 0)), r("listInputFields", (o) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(o)), void 0)), r("listOutputFields", (o) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(o)), void 0)), r("listDynamicFields", (o) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(o)), void 0)), r("getKeyValueBase64", (o, i) => this.exportSingleValue(
2607
+ this.getKeyValueBase64(this.vm.getString(o), this.vm.getString(i)),
2607
2608
  void 0
2608
- )), r("getKeyValueAsString", (o, n) => this.exportSingleValue(
2609
- this.getKeyValueAsString(this.vm.getString(o), this.vm.getString(n)),
2609
+ )), r("getKeyValueAsString", (o, i) => this.exportSingleValue(
2610
+ this.getKeyValueAsString(this.vm.getString(o), this.vm.getString(i)),
2610
2611
  void 0
2611
- )), r("getDataBase64", (o) => this.exportSingleValue(this.getDataBase64(this.vm.getString(o)), void 0)), r("getDataAsString", (o) => this.exportSingleValue(this.getDataAsString(this.vm.getString(o)), void 0)), r("parsePObjectCollection", (o, n, i) => this.exportObjectUniversal(
2612
+ )), r("getDataBase64", (o) => this.exportSingleValue(this.getDataBase64(this.vm.getString(o)), void 0)), r("getDataAsString", (o) => this.exportSingleValue(this.getDataAsString(this.vm.getString(o)), void 0)), r("parsePObjectCollection", (o, i, n) => this.exportObjectUniversal(
2612
2613
  this.parsePObjectCollection(
2613
2614
  this.vm.getString(o),
2614
- this.vm.dump(n),
2615
- this.vm.getString(i)
2615
+ this.vm.dump(i),
2616
+ this.vm.getString(n)
2616
2617
  ),
2617
2618
  void 0
2618
2619
  )), r("getBlobContentAsBase64", (o) => this.exportSingleValue(
@@ -2627,25 +2628,25 @@ class ge {
2627
2628
  )), r("getOnDemandBlobContentHandle", (o) => this.exportSingleValue(
2628
2629
  this.getOnDemandBlobContentHandle(this.vm.getString(o)),
2629
2630
  void 0
2630
- )), r("getImportProgress", (o) => this.exportSingleValue(this.getImportProgress(this.vm.getString(o)), void 0)), r("getLastLogs", (o, n) => this.exportSingleValue(
2631
- this.getLastLogs(this.vm.getString(o), this.vm.getNumber(n)),
2631
+ )), r("getImportProgress", (o) => this.exportSingleValue(this.getImportProgress(this.vm.getString(o)), void 0)), r("getLastLogs", (o, i) => this.exportSingleValue(
2632
+ this.getLastLogs(this.vm.getString(o), this.vm.getNumber(i)),
2632
2633
  void 0
2633
- )), r("getProgressLog", (o, n) => this.exportSingleValue(
2634
- this.getProgressLog(this.vm.getString(o), this.vm.getString(n)),
2634
+ )), r("getProgressLog", (o, i) => this.exportSingleValue(
2635
+ this.getProgressLog(this.vm.getString(o), this.vm.getString(i)),
2635
2636
  void 0
2636
2637
  )), r("getLogHandle", (o) => this.exportSingleValue(this.getLogHandle(this.vm.getString(o)), void 0)), r("getBlockLabel", (o) => this.exportSingleValue(this.getBlockLabel(this.vm.getString(o)), void 0)), r("getDataFromResultPool", (o) => this.exportObjectUniversal(this.getDataFromResultPool(), void 0)), r("getDataWithErrorsFromResultPool", (o) => this.exportObjectUniversal(this.getDataWithErrorsFromResultPool(), void 0)), r("getSpecsFromResultPool", (o) => this.exportObjectUniversal(this.getSpecsFromResultPool(), void 0)), r("calculateOptions", (o) => this.exportObjectUniversal(
2637
2638
  this.calculateOptions(this.importObjectViaJson(o)),
2638
2639
  void 0
2639
- )), r("getSpecFromResultPoolByRef", (o, n) => this.exportObjectUniversal(
2640
+ )), r("getSpecFromResultPoolByRef", (o, i) => this.exportObjectUniversal(
2640
2641
  this.getSpecFromResultPoolByRef(
2641
2642
  this.vm.getString(o),
2642
- this.vm.getString(n)
2643
+ this.vm.getString(i)
2643
2644
  ),
2644
2645
  void 0
2645
- )), r("getDataFromResultPoolByRef", (o, n) => this.exportObjectUniversal(
2646
+ )), r("getDataFromResultPoolByRef", (o, i) => this.exportObjectUniversal(
2646
2647
  this.getDataFromResultPoolByRef(
2647
2648
  this.vm.getString(o),
2648
- this.vm.getString(n)
2649
+ this.vm.getString(i)
2649
2650
  ),
2650
2651
  void 0
2651
2652
  )), r("createPFrame", (o) => this.exportSingleValue(
@@ -2658,9 +2659,9 @@ class ge {
2658
2659
  });
2659
2660
  }
2660
2661
  }
2661
- function _t(s, e) {
2662
+ function Ht(s, e) {
2662
2663
  var t, r;
2663
- return Z(
2664
+ return te(
2664
2665
  (r = (t = s.traverse(
2665
2666
  {
2666
2667
  field: P(e, "blockPack"),
@@ -2669,62 +2670,62 @@ function _t(s, e) {
2669
2670
  },
2670
2671
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2671
2672
  )) == null ? void 0 : t.getDataAsJson()) == null ? void 0 : r.config,
2672
- (o) => he(o)
2673
+ (o) => ve(o)
2673
2674
  );
2674
2675
  }
2675
- const gt = process.env.MI_LOG_OUTPUT_STATUS;
2676
- function ks(s, e, t, r, o = {}) {
2677
- const n = `lambda#${t.handle}`;
2678
- return o = { ...o, key: n }, o.mode === void 0 && t.retentive === !0 && (o.mode = "StableOnlyRetentive"), R.makeRaw((i) => {
2679
- const a = new Oe();
2680
- i.addOnDestroy(() => a.dispose());
2676
+ const ht = process.env.MI_LOG_OUTPUT_STATUS;
2677
+ function Ps(s, e, t, r, o = {}) {
2678
+ const i = `lambda#${t.handle}`;
2679
+ return o = { ...o, key: i }, o.mode === void 0 && t.retentive === !0 && (o.mode = "StableOnlyRetentive"), R.makeRaw((n) => {
2680
+ const a = new De();
2681
+ n.addOnDestroy(() => a.dispose());
2681
2682
  const c = a.manage(s.quickJs.newRuntime());
2682
2683
  c.setMemoryLimit(1024 * 640), c.setMaxStackSize(1024 * 320);
2683
- const u = a.manage(c.newContext()), l = new ge(a, u, e, s, i);
2684
+ const u = a.manage(c.newContext()), l = new me(a, u, e, s, n);
2684
2685
  l.evaluateBundle(r.content);
2685
2686
  const d = l.runCallback(t.handle);
2686
2687
  return l.resetComputableCtx(), {
2687
2688
  ir: l.computablesToResolve,
2688
2689
  postprocessValue: async (g, { unstableMarker: f, stable: v }) => {
2689
- for (const [I, M] of Object.entries(g)) l.runCallback(I, M);
2690
+ for (const [I, U] of Object.entries(g)) l.runCallback(I, U);
2690
2691
  const S = l.importObjectUniversal(d);
2691
- return gt && (gt !== "unstable-only" || !v) && console.log(
2692
+ return ht && (ht !== "unstable-only" || !v) && console.log(
2692
2693
  v ? `Stable output ${t.handle} calculated ${S !== void 0 ? "defined" : "undefined"}` : `Unstable output ${t.handle}; marker = ${f}; ${S !== void 0 ? "defined" : "undefined"}`
2693
2694
  ), S;
2694
2695
  }
2695
2696
  };
2696
2697
  }, o);
2697
2698
  }
2698
- function Cs(s) {
2699
- return bt(s) ? s.isActive === !0 : _o(s);
2699
+ function Rs(s) {
2700
+ return wt(s) ? s.isActive === !0 : Wo(s);
2700
2701
  }
2701
- function X(s, e, t, r, o = {}) {
2702
- if (bt(t)) {
2702
+ function re(s, e, t, r, o = {}) {
2703
+ if (wt(t)) {
2703
2704
  if (r === void 0) throw new Error("No code bundle.");
2704
- return ks(s, e, t, r, o);
2705
- } else return ws(s.driverKit, e, t, o);
2705
+ return Ps(s, e, t, r, o);
2706
+ } else return ks(s.driverKit, e, t, o);
2706
2707
  }
2707
- function Ps(s, e, t) {
2708
+ function Fs(s, e, t) {
2708
2709
  return R.make(
2709
2710
  (r) => {
2710
- var v, S, I, M, $, _, Y, ne;
2711
- const o = r.accessor(s).node(), n = C(o.getKeyValueAsJson($e)), i = C(o.getKeyValueAsJson(re)), a = C(o.getKeyValueAsJson(oe)), c = C(o.getKeyValueAsJson(z)), u = C(
2712
- o.getKeyValueAsJson(de)
2711
+ var v, S, I, U, M, _, q, ce;
2712
+ const o = r.accessor(s).node(), i = C(o.getKeyValueAsJson(Ke)), n = C(o.getKeyValueAsJson(ie)), a = C(o.getKeyValueAsJson(ne)), c = C(o.getKeyValueAsJson(z)), u = C(
2713
+ o.getKeyValueAsJson(he)
2713
2714
  ), l = /* @__PURE__ */ new Map();
2714
2715
  for (const { id: k } of J(c)) {
2715
- const V = o.traverse({
2716
+ const N = o.traverse({
2716
2717
  field: P(k, "currentArgs"),
2717
2718
  assertFieldType: "Dynamic",
2718
2719
  errorIfFieldNotSet: !0
2719
2720
  });
2720
- let q;
2721
- const A = o.traverse({
2721
+ let Y;
2722
+ const T = o.traverse({
2722
2723
  field: P(k, "prodArgs"),
2723
2724
  assertFieldType: "Dynamic",
2724
2725
  stableIfNotFound: !0
2725
2726
  });
2726
- if (A !== void 0) {
2727
- const T = o.getField({
2727
+ if (T !== void 0) {
2728
+ const A = o.getField({
2728
2729
  field: P(k, "prodOutput"),
2729
2730
  assertFieldType: "Dynamic",
2730
2731
  errorIfFieldNotFound: !0
@@ -2733,75 +2734,75 @@ function Ps(s, e, t) {
2733
2734
  assertFieldType: "Dynamic",
2734
2735
  errorIfFieldNotFound: !0
2735
2736
  });
2736
- q = {
2737
- arguments: A.getDataAsJson(),
2738
- stale: V.id !== A.id,
2739
- outputError: T.error !== void 0 || B.error !== void 0 || ((v = T.value) == null ? void 0 : v.getError()) !== void 0 || ((S = B.value) == null ? void 0 : S.getError()) !== void 0,
2740
- outputsError: ((I = T.error) == null ? void 0 : I.getDataAsString()) ?? (($ = (M = T.value) == null ? void 0 : M.getError()) == null ? void 0 : $.getDataAsString()),
2741
- exportsError: ((_ = B.error) == null ? void 0 : _.getDataAsString()) ?? ((ne = (Y = B.value) == null ? void 0 : Y.getError()) == null ? void 0 : ne.getDataAsString()),
2742
- finished: (T.value !== void 0 && T.value.getIsReadyOrError() || T.error !== void 0 && T.error.getIsReadyOrError()) && (B.value !== void 0 && B.value.getIsReadyOrError() || B.error !== void 0 && B.error.getIsReadyOrError())
2737
+ Y = {
2738
+ arguments: T.getDataAsJson(),
2739
+ stale: N.id !== T.id,
2740
+ outputError: A.error !== void 0 || B.error !== void 0 || ((v = A.value) == null ? void 0 : v.getError()) !== void 0 || ((S = B.value) == null ? void 0 : S.getError()) !== void 0,
2741
+ outputsError: ((I = A.error) == null ? void 0 : I.getDataAsString()) ?? ((M = (U = A.value) == null ? void 0 : U.getError()) == null ? void 0 : M.getDataAsString()),
2742
+ exportsError: ((_ = B.error) == null ? void 0 : _.getDataAsString()) ?? ((ce = (q = B.value) == null ? void 0 : q.getError()) == null ? void 0 : ce.getDataAsString()),
2743
+ finished: (A.value !== void 0 && A.value.getIsReadyOrError() || A.error !== void 0 && A.error.getIsReadyOrError()) && (B.value !== void 0 && B.value.getIsReadyOrError() || B.error !== void 0 && B.error.getIsReadyOrError())
2743
2744
  };
2744
2745
  }
2745
- l.set(k, { currentArguments: V.getDataAsJson(), prod: q });
2746
+ l.set(k, { currentArguments: N.getDataAsJson(), prod: Y });
2746
2747
  }
2747
- const d = ce(c, (k) => l.get(k).currentArguments), g = new Set(u.blocksInLimbo), f = [...J(c)].map(({ id: k, label: V, renderingMode: q }) => {
2748
- var We, ze, Ye, qe;
2749
- const A = C(l.get(k)), T = C(d.nodes.get(k));
2748
+ const d = de(c, (k) => l.get(k).currentArguments), g = new Set(u.blocksInLimbo), f = [...J(c)].map(({ id: k, label: N, renderingMode: Y }) => {
2749
+ var ze, qe, Ye, Qe;
2750
+ const T = C(l.get(k)), A = C(d.nodes.get(k));
2750
2751
  let B = "NotCalculated";
2751
- A.prod !== void 0 && (g.has(k) ? B = "Limbo" : B = A.prod.finished ? "Done" : "Running");
2752
- const K = o.traverse(
2752
+ T.prod !== void 0 && (g.has(k) ? B = "Limbo" : B = T.prod.finished ? "Done" : "Running");
2753
+ const $ = o.traverse(
2753
2754
  {
2754
2755
  field: P(k, "blockPack"),
2755
2756
  assertFieldType: "Dynamic",
2756
2757
  errorIfFieldNotSet: !0
2757
2758
  },
2758
2759
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2759
- ), N = K == null ? void 0 : K.getDataAsJson(), { sections: ie, title: y, inputsValid: O, sdkVersion: F } = Z(N == null ? void 0 : N.config, (ve) => {
2760
- const H = he(ve), ye = _e(o, k);
2760
+ ), V = $ == null ? void 0 : $.getDataAsJson(), { sections: ue, title: y, inputsValid: O, sdkVersion: F } = te(V == null ? void 0 : V.config, (we) => {
2761
+ const H = ve(we), Se = He(o, k);
2761
2762
  return {
2762
- sections: X(
2763
+ sections: re(
2763
2764
  t,
2764
- ye,
2765
+ Se,
2765
2766
  H.sections,
2766
2767
  H.code
2767
2768
  ),
2768
- title: Z(
2769
+ title: te(
2769
2770
  H.title,
2770
- (qt) => X(
2771
+ (Qt) => re(
2771
2772
  t,
2772
- ye,
2773
- qt,
2773
+ Se,
2774
+ Qt,
2774
2775
  H.code
2775
2776
  )
2776
2777
  ),
2777
- inputsValid: X(
2778
+ inputsValid: re(
2778
2779
  t,
2779
- ye,
2780
+ Se,
2780
2781
  H.inputsValid,
2781
2782
  H.code
2782
2783
  ),
2783
2784
  sdkVersion: H.sdkVersion
2784
2785
  };
2785
- }) || {}, Yt = Z(
2786
- N,
2787
- (ve) => t.blockUpdateWatcher.get(ve.source)
2786
+ }) || {}, Yt = te(
2787
+ V,
2788
+ (we) => t.blockUpdateWatcher.get(we.source)
2788
2789
  );
2789
2790
  return {
2790
2791
  id: k,
2791
- label: y ?? V,
2792
- title: y ?? V,
2793
- renderingMode: q,
2794
- stale: ((We = A.prod) == null ? void 0 : We.stale) !== !1 || B === "Limbo",
2795
- missingReference: T.missingReferences,
2792
+ label: y ?? N,
2793
+ title: y ?? N,
2794
+ renderingMode: Y,
2795
+ stale: ((ze = T.prod) == null ? void 0 : ze.stale) !== !1 || B === "Limbo",
2796
+ missingReference: A.missingReferences,
2796
2797
  upstreams: [...d.traverseIdsExcludingRoots("upstream", k)],
2797
2798
  downstreams: [...d.traverseIdsExcludingRoots("downstream", k)],
2798
2799
  calculationStatus: B,
2799
- outputErrors: ((ze = A.prod) == null ? void 0 : ze.outputError) === !0,
2800
- outputsError: (Ye = A.prod) == null ? void 0 : Ye.outputsError,
2801
- exportsError: (qe = A.prod) == null ? void 0 : qe.exportsError,
2802
- sections: ie,
2800
+ outputErrors: ((qe = T.prod) == null ? void 0 : qe.outputError) === !0,
2801
+ outputsError: (Ye = T.prod) == null ? void 0 : Ye.outputsError,
2802
+ exportsError: (Qe = T.prod) == null ? void 0 : Qe.exportsError,
2803
+ sections: ue,
2803
2804
  inputsValid: O,
2804
- currentBlockPack: N == null ? void 0 : N.source,
2805
+ currentBlockPack: V == null ? void 0 : V.source,
2805
2806
  updatedBlockPack: Yt,
2806
2807
  sdkVersion: F,
2807
2808
  navigationState: e.getState(k)
@@ -2809,34 +2810,34 @@ function Ps(s, e, t) {
2809
2810
  });
2810
2811
  return {
2811
2812
  meta: a,
2812
- created: new Date(n),
2813
- lastModified: new Date(i),
2814
- authorMarker: o.getKeyValueAsJson(Te),
2813
+ created: new Date(i),
2814
+ lastModified: new Date(n),
2815
+ authorMarker: o.getKeyValueAsJson(je),
2815
2816
  blocks: f
2816
2817
  };
2817
2818
  },
2818
2819
  {
2819
2820
  postprocessValue: (r) => {
2820
- const o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
2821
+ const o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
2821
2822
  return {
2822
2823
  ...r,
2823
- blocks: r.blocks.map((i) => {
2824
- i.inputsValid || o.add(i.id), i.stale && n.add(i.id);
2825
- const a = i.stale || i.upstreams.findIndex((u) => n.has(u)) !== -1, c = (a || i.outputErrors) && !!i.inputsValid && !i.missingReference && i.upstreams.findIndex((u) => o.has(u)) === -1;
2826
- return { ...i, canRun: c, stale: a };
2824
+ blocks: r.blocks.map((n) => {
2825
+ n.inputsValid || o.add(n.id), n.stale && i.add(n.id);
2826
+ const a = n.stale || n.upstreams.findIndex((u) => i.has(u)) !== -1, c = (a || n.outputErrors) && !!n.inputsValid && !n.missingReference && n.upstreams.findIndex((u) => o.has(u)) === -1;
2827
+ return { ...n, canRun: c, stale: a };
2827
2828
  })
2828
2829
  };
2829
2830
  }
2830
2831
  }
2831
2832
  ).withStableType();
2832
2833
  }
2833
- function Rs(s, e) {
2834
+ function Bs(s, e) {
2834
2835
  const t = s.node();
2835
- if (G(t.resourceType, jt)) {
2836
+ if (G(t.resourceType, Tt)) {
2836
2837
  const r = t.getDataAsJson();
2837
2838
  if (r === void 0) throw new Error("No resource data.");
2838
2839
  return e.frontendDownloadDriver.getPath(new URL(r.url)).withStableType();
2839
- } else if (G(t.resourceType, At)) {
2840
+ } else if (G(t.resourceType, Et)) {
2840
2841
  const r = t.getDataAsJson();
2841
2842
  if (r === void 0) throw new Error("No resource data.");
2842
2843
  return e.signer.verify(
@@ -2847,10 +2848,10 @@ function Rs(s, e) {
2847
2848
  } else
2848
2849
  throw new Error(`Unsupported resource type: ${JSON.stringify(t.resourceType)}`);
2849
2850
  }
2850
- function Fs(s, e) {
2851
+ function Os(s, e) {
2851
2852
  if (s !== void 0)
2852
2853
  return R.make(
2853
- (t) => Rs(t.accessor(s), e),
2854
+ (t) => Bs(t.accessor(s), e),
2854
2855
  {
2855
2856
  postprocessValue: (t) => {
2856
2857
  if (t !== void 0) {
@@ -2862,72 +2863,72 @@ function Fs(s, e) {
2862
2863
  }
2863
2864
  ).withStableType();
2864
2865
  }
2865
- function Bs(s, e, t) {
2866
+ function Ds(s, e, t) {
2866
2867
  return R.make(
2867
2868
  (r) => {
2868
2869
  var a;
2869
- const o = r.accessor(s).node(), n = _t(o, e), i = (a = o.traverse(
2870
+ const o = r.accessor(s).node(), i = Ht(o, e), n = (a = o.traverse(
2870
2871
  {
2871
2872
  field: P(e, "blockPack"),
2872
2873
  assertFieldType: "Dynamic"
2873
2874
  },
2874
2875
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 },
2875
- { field: It, assertFieldType: "Input" }
2876
+ { field: Nt, assertFieldType: "Input" }
2876
2877
  )) == null ? void 0 : a.persist();
2877
- return { path: Fs(i, t), sdkVersion: n == null ? void 0 : n.sdkVersion };
2878
+ return { path: Os(n, t), sdkVersion: i == null ? void 0 : i.sdkVersion };
2878
2879
  },
2879
2880
  { mode: "StableOnlyLive" }
2880
2881
  );
2881
2882
  }
2882
- function Os(s, e, t) {
2883
+ function xs(s, e, t) {
2883
2884
  return R.make(
2884
2885
  (r) => {
2885
- const o = r.accessor(s).node(), n = _e(o, e);
2886
+ const o = r.accessor(s).node(), i = He(o, e);
2886
2887
  return {
2887
- author: o.getKeyValueAsJson(xe(e)),
2888
- args: JSON.parse(n.args),
2889
- ui: n.uiState !== void 0 ? JSON.parse(n.uiState) : void 0
2888
+ author: o.getKeyValueAsJson(Ae(e)),
2889
+ args: JSON.parse(i.args),
2890
+ ui: i.uiState !== void 0 ? JSON.parse(i.uiState) : void 0
2890
2891
  };
2891
2892
  },
2892
- { key: "inputs#" + kt(s.rid) + e }
2893
+ { key: "inputs#" + Ct(s.rid) + e }
2893
2894
  );
2894
2895
  }
2895
- function Ds(s, e, t) {
2896
+ function As(s, e, t) {
2896
2897
  return R.make(
2897
2898
  (r) => {
2898
- const o = r.accessor(s).node(), n = Jt(o, e), i = _t(o, e);
2899
- return Z(i, (a) => {
2899
+ const o = r.accessor(s).node(), i = Ut(o, e), n = Ht(o, e);
2900
+ return te(n, (a) => {
2900
2901
  const c = {};
2901
2902
  for (const [u, l] of Object.entries(a.outputs))
2902
2903
  c[u] = R.wrapError(
2903
- X(t, n, l, a.code)
2904
+ re(t, i, l, a.code)
2904
2905
  );
2905
2906
  return c;
2906
2907
  });
2907
2908
  },
2908
- { key: "outputs#" + kt(s.rid) + "#" + e }
2909
+ { key: "outputs#" + Ct(s.rid) + "#" + e }
2909
2910
  ).withStableType();
2910
2911
  }
2911
- function xs(s, e) {
2912
+ function js(s, e) {
2912
2913
  return R.make((t) => {
2913
- const r = t.accessor(s).node(), o = C(r.getKeyValueAsJson(z)), n = [];
2914
- for (const { id: i, renderingMode: a } of J(o)) {
2914
+ const r = t.accessor(s).node(), o = C(r.getKeyValueAsJson(z)), i = [];
2915
+ for (const { id: n, renderingMode: a } of J(o)) {
2915
2916
  const c = r.traverse(
2916
2917
  {
2917
- field: P(i, "blockPack"),
2918
+ field: P(n, "blockPack"),
2918
2919
  assertFieldType: "Dynamic",
2919
2920
  errorIfFieldNotSet: !0
2920
2921
  },
2921
2922
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2922
2923
  ), u = c == null ? void 0 : c.getDataAsJson();
2923
2924
  if ((u == null ? void 0 : u.config) === void 0) continue;
2924
- const l = he(u.config), d = Object.entries(l.outputs).map(([, f]) => f).filter((f) => Cs(f)).map((f) => f);
2925
+ const l = ve(u.config), d = Object.entries(l.outputs).map(([, f]) => f).filter((f) => Rs(f)).map((f) => f);
2925
2926
  if (d.length === 0) continue;
2926
- const g = Jt(r, i);
2927
+ const g = Ut(r, n);
2927
2928
  for (const f of d)
2928
- n.push(R.wrapError(X(e, g, f, l.code)));
2929
+ i.push(R.wrapError(re(e, g, f, l.code)));
2929
2930
  }
2930
- return n;
2931
+ return i;
2931
2932
  });
2932
2933
  }
2933
2934
  class Ts {
@@ -2937,14 +2938,14 @@ class Ts {
2937
2938
  setState(e, t) {
2938
2939
  const r = this.states.get(e);
2939
2940
  if (r === void 0) {
2940
- this.states.set(e, { state: t, change: new et() });
2941
+ this.states.set(e, { state: t, change: new tt() });
2941
2942
  return;
2942
2943
  }
2943
2944
  r.state = { ...t }, r.change.markChanged();
2944
2945
  }
2945
2946
  readState(e, t) {
2946
2947
  let r = this.states.get(t);
2947
- return r === void 0 && (r = { state: { ...er }, change: new et() }, this.states.set(t, r)), r.change.attachWatcher(e.watcher), r.state;
2948
+ return r === void 0 && (r = { state: { ...tr }, change: new tt() }, this.states.set(t, r)), r.change.attachWatcher(e.watcher), r.state;
2948
2949
  }
2949
2950
  getState(e) {
2950
2951
  return R.make(
@@ -2957,7 +2958,7 @@ class Ts {
2957
2958
  t !== void 0 && (this.states.delete(e), t.change.markChanged());
2958
2959
  }
2959
2960
  }
2960
- class He {
2961
+ class We {
2961
2962
  constructor(e, t, r) {
2962
2963
  /** Underlying pl resource id */
2963
2964
  p(this, "rid");
@@ -2970,25 +2971,25 @@ class He {
2970
2971
  p(this, "refreshLoopResult");
2971
2972
  p(this, "abortController", new AbortController());
2972
2973
  p(this, "destroyed", !1);
2973
- this.env = e, this.projectTree = r, this.overview = Ps(
2974
+ this.env = e, this.projectTree = r, this.overview = Fs(
2974
2975
  r.entry(),
2975
2976
  this.navigationStates,
2976
2977
  e
2977
- ).withPreCalculatedValueTree(), this.rid = t, this.refreshLoopResult = this.refreshLoop(), this.activeConfigs = xs(r.entry(), e);
2978
+ ).withPreCalculatedValueTree(), this.rid = t, this.refreshLoopResult = this.refreshLoop(), this.activeConfigs = js(r.entry(), e);
2978
2979
  }
2979
2980
  async refreshLoop() {
2980
2981
  for (; !this.destroyed; )
2981
2982
  try {
2982
- await Ce(this.env.pl, this.rid, (e) => {
2983
+ await Fe(this.env.pl, this.rid, (e) => {
2983
2984
  e.doRefresh(this.env.ops.stagingRenderingRate);
2984
- }), await this.activeConfigs.getValue(), await Rt(this.env.ops.projectRefreshInterval, this.abortController.signal);
2985
+ }), await this.activeConfigs.getValue(), await Ft(this.env.ops.projectRefreshInterval, this.abortController.signal);
2985
2986
  } catch (e) {
2986
- if (gr(e)) {
2987
+ if (hr(e)) {
2987
2988
  console.warn(
2988
2989
  "project refresh routine terminated, because project was externally deleted"
2989
2990
  );
2990
2991
  break;
2991
- } else if (!hr(e))
2992
+ } else if (!fr(e))
2992
2993
  throw new Error("Unexpected exception", { cause: e });
2993
2994
  }
2994
2995
  }
@@ -3003,41 +3004,41 @@ class He {
3003
3004
  *
3004
3005
  * @return returns newly created block id
3005
3006
  * */
3006
- async addBlock(e, t, r, o = void 0, n = te()) {
3007
- const i = await this.env.bpPreparer.prepare(t), a = await this.env.bpPreparer.getBlockConfigContainer(t), c = he(a);
3007
+ async addBlock(e, t, r, o = void 0, i = se()) {
3008
+ const n = await this.env.bpPreparer.prepare(t), a = await this.env.bpPreparer.getBlockConfigContainer(t), c = ve(a);
3008
3009
  return await L(
3009
3010
  this.env.pl,
3010
3011
  this.rid,
3011
3012
  o,
3012
3013
  (u) => u.addBlock(
3013
3014
  {
3014
- id: n,
3015
+ id: i,
3015
3016
  label: e,
3016
3017
  renderingMode: c.renderingMode
3017
3018
  },
3018
3019
  {
3019
3020
  args: JSON.stringify(c.initialArgs),
3020
3021
  uiState: JSON.stringify(c.initialUiState),
3021
- blockPack: i
3022
+ blockPack: n
3022
3023
  },
3023
3024
  r
3024
3025
  )
3025
- ), await this.projectTree.refreshState(), n;
3026
+ ), await this.projectTree.refreshState(), i;
3026
3027
  }
3027
3028
  /**
3028
3029
  * Update block to new block pack, optionally resetting args and ui state to
3029
3030
  * initial values
3030
3031
  * */
3031
3032
  async updateBlockPack(e, t, r = !1, o) {
3032
- const n = await this.env.bpPreparer.prepare(t), i = await this.env.bpPreparer.getBlockConfigContainer(t);
3033
+ const i = await this.env.bpPreparer.prepare(t), n = await this.env.bpPreparer.getBlockConfigContainer(t);
3033
3034
  await L(
3034
3035
  this.env.pl,
3035
3036
  this.rid,
3036
3037
  o,
3037
3038
  (a) => a.migrateBlockPack(
3038
3039
  e,
3039
- n,
3040
- r ? JSON.stringify(i.initialArgs) : void 0
3040
+ i,
3041
+ r ? JSON.stringify(n.initialArgs) : void 0
3041
3042
  )
3042
3043
  ), await this.projectTree.refreshState();
3043
3044
  }
@@ -3056,24 +3057,24 @@ class He {
3056
3057
  const o = r.structure;
3057
3058
  if (o.groups.length !== 1)
3058
3059
  throw new Error("Unexpected project structure, non-sinular block group");
3059
- const n = o.groups[0];
3060
- if (n.blocks.length !== e.length)
3061
- throw new Error(`Lengh mismatch: ${n.blocks.length} !== ${e.length}`);
3060
+ const i = o.groups[0];
3061
+ if (i.blocks.length !== e.length)
3062
+ throw new Error(`Lengh mismatch: ${i.blocks.length} !== ${e.length}`);
3062
3063
  if (new Set(e).size !== e.length) throw new Error("Repeated block ids");
3063
- const i = {
3064
+ const n = {
3064
3065
  groups: [
3065
3066
  {
3066
- id: n.id,
3067
- label: n.label,
3067
+ id: i.id,
3068
+ label: i.label,
3068
3069
  blocks: e.map((a) => {
3069
- const c = n.blocks.find((u) => u.id === a);
3070
+ const c = i.blocks.find((u) => u.id === a);
3070
3071
  if (c === void 0) throw new Error(`Can't find block: ${a}`);
3071
3072
  return c;
3072
3073
  })
3073
3074
  }
3074
3075
  ]
3075
3076
  };
3076
- r.updateStructure(i);
3077
+ r.updateStructure(n);
3077
3078
  }), await this.projectTree.refreshState();
3078
3079
  }
3079
3080
  /**
@@ -3082,7 +3083,7 @@ class He {
3082
3083
  * stale state.
3083
3084
  * */
3084
3085
  async runBlock(e) {
3085
- await Ce(this.env.pl, this.rid, (t) => t.renderProduction([e], !0)), await this.projectTree.refreshState();
3086
+ await Fe(this.env.pl, this.rid, (t) => t.renderProduction([e], !0)), await this.projectTree.refreshState();
3086
3087
  }
3087
3088
  /**
3088
3089
  * Stops the block if it is running by destroying its production state. All
@@ -3090,7 +3091,7 @@ class He {
3090
3091
  * calculated.
3091
3092
  * */
3092
3093
  async stopBlock(e) {
3093
- await Ce(this.env.pl, this.rid, (t) => t.stopProduction(e)), await this.projectTree.refreshState();
3094
+ await Fe(this.env.pl, this.rid, (t) => t.stopProduction(e)), await this.projectTree.refreshState();
3094
3095
  }
3095
3096
  // /** Update block label. */
3096
3097
  // public async setBlockLabel(blockId: string, label: string, author?: AuthorMarker) {
@@ -3140,19 +3141,19 @@ class He {
3140
3141
  * in collaborative editing scenario.
3141
3142
  * */
3142
3143
  async setBlockArgsAndUiState(e, t, r, o) {
3143
- await L(this.env.pl, this.rid, o, (n) => {
3144
- n.setArgs([{ blockId: e, args: JSON.stringify(t) }]), n.setUiState(e, JSON.stringify(r));
3144
+ await L(this.env.pl, this.rid, o, (i) => {
3145
+ i.setArgs([{ blockId: e, args: JSON.stringify(t) }]), i.setUiState(e, JSON.stringify(r));
3145
3146
  }), await this.projectTree.refreshState();
3146
3147
  }
3147
3148
  /** Resets arguments and ui state of the block to initial state */
3148
3149
  async resetBlockArgsAndUiState(e, t) {
3149
3150
  await this.env.pl.withWriteTx("BlockInputsReset", async (r) => {
3150
- const o = Be(
3151
+ const o = Oe(
3151
3152
  (await r.getField(w(this.rid, P(e, "blockPack")))).value
3152
- ), n = Be(
3153
+ ), i = Oe(
3153
3154
  (await r.getField(w(o, b.HolderRefField))).value
3154
- ), i = await r.getResourceData(n, !1), a = JSON.parse(
3155
- Buffer.from(C(i.data)).toString("utf-8")
3155
+ ), n = await r.getResourceData(i, !1), a = JSON.parse(
3156
+ Buffer.from(C(n.data)).toString("utf-8")
3156
3157
  );
3157
3158
  await L(r, this.rid, t, (c) => {
3158
3159
  c.setArgs([{ blockId: e, args: JSON.stringify(a.config.initialArgs) }]), c.setUiState(e, void 0);
@@ -3162,23 +3163,23 @@ class He {
3162
3163
  getBlockComputables(e) {
3163
3164
  const t = this.blockComputables.get(e);
3164
3165
  if (t === void 0) {
3165
- const r = Ds(this.projectTree.entry(), e, this.env), n = {
3166
+ const r = As(this.projectTree.entry(), e, this.env), i = {
3166
3167
  fullState: R.make(
3167
- (i) => ({
3168
- argsAndUiState: Os(this.projectTree.entry(), e),
3168
+ (n) => ({
3169
+ argsAndUiState: xs(this.projectTree.entry(), e),
3169
3170
  outputs: r,
3170
3171
  navigationState: this.navigationStates.getState(e)
3171
3172
  }),
3172
3173
  {
3173
- postprocessValue: (i) => ({
3174
- ...i.argsAndUiState,
3175
- outputs: i.outputs,
3176
- navigationState: i.navigationState
3174
+ postprocessValue: (n) => ({
3175
+ ...n.argsAndUiState,
3176
+ outputs: n.outputs,
3177
+ navigationState: n.navigationState
3177
3178
  })
3178
3179
  }
3179
3180
  ).withPreCalculatedValueTree()
3180
3181
  };
3181
- return this.blockComputables.set(e, n), n;
3182
+ return this.blockComputables.set(e, i), i;
3182
3183
  }
3183
3184
  return t;
3184
3185
  }
@@ -3196,7 +3197,7 @@ class He {
3196
3197
  getBlockFrontend(e) {
3197
3198
  const t = this.blockFrontends.get(e);
3198
3199
  if (t === void 0) {
3199
- const r = Bs(
3200
+ const r = Ds(
3200
3201
  this.projectTree.entry(),
3201
3202
  e,
3202
3203
  this.env
@@ -3216,19 +3217,19 @@ class He {
3216
3217
  await this.destroy();
3217
3218
  }
3218
3219
  static async init(e, t) {
3219
- const r = await Ct.init(
3220
+ const r = await Pt.init(
3220
3221
  e.pl,
3221
3222
  t,
3222
3223
  {
3223
3224
  ...e.ops.defaultTreeOptions,
3224
- pruning: js
3225
+ pruning: Es
3225
3226
  },
3226
3227
  e.logger
3227
3228
  );
3228
- return new He(e, t, r);
3229
+ return new We(e, t, r);
3229
3230
  }
3230
3231
  }
3231
- function js(s) {
3232
+ function Es(s) {
3232
3233
  switch (s.type.name) {
3233
3234
  case "BlockPackCustom":
3234
3235
  return s.fields.filter((e) => e.name !== "template");
@@ -3240,8 +3241,8 @@ function js(s) {
3240
3241
  return s.fields;
3241
3242
  }
3242
3243
  }
3243
- const Ht = {
3244
- logger: new ir(),
3244
+ const Wt = {
3245
+ logger: new ar(),
3245
3246
  blobDriverOps: {
3246
3247
  cacheSoftSizeBytes: 100 * 1024 * 1024,
3247
3248
  // 100MB
@@ -3259,13 +3260,13 @@ const Ht = {
3259
3260
  stopPollingDelay: 1e3
3260
3261
  }
3261
3262
  };
3262
- function Wt(s) {
3263
+ function zt(s) {
3263
3264
  return {
3264
3265
  blobDownloadPath: x.join(s, "download")
3265
3266
  };
3266
3267
  }
3267
- const As = {
3268
- ...Ht,
3268
+ const Is = {
3269
+ ...Wt,
3269
3270
  defaultTreeOptions: {
3270
3271
  pollingInterval: 350,
3271
3272
  stopPollingDelay: 2500
@@ -3274,18 +3275,18 @@ const As = {
3274
3275
  projectRefreshInterval: 700,
3275
3276
  stagingRenderingRate: 5
3276
3277
  };
3277
- function Es(s) {
3278
+ function Ns(s) {
3278
3279
  return {
3279
- ...Wt(s),
3280
+ ...zt(s),
3280
3281
  frontendDownloadPath: x.join(s, "frontend")
3281
3282
  };
3282
3283
  }
3283
- const Is = {
3284
+ const Vs = {
3284
3285
  minDelay: 1500
3285
- }, Vs = "__no_updates__";
3286
- class Ns extends yr {
3286
+ }, Ls = "__no_updates__";
3287
+ class Js extends br {
3287
3288
  constructor(t, r, o = {}) {
3288
- super({ ...o, ...Is }, r);
3289
+ super({ ...o, ...Vs }, r);
3289
3290
  p(this, "http");
3290
3291
  this.registryProvider = t, this.http = o.http;
3291
3292
  }
@@ -3298,7 +3299,7 @@ class Ns extends yr {
3298
3299
  case "from-registry-v2":
3299
3300
  return `from_registry_v2_${t.registryUrl}_${t.id.organization}_${t.id.name}_${t.id.version}`;
3300
3301
  default:
3301
- return Vs;
3302
+ return Ls;
3302
3303
  }
3303
3304
  }
3304
3305
  async readValue(t) {
@@ -3307,7 +3308,7 @@ class Ns extends yr {
3307
3308
  switch (t.type) {
3308
3309
  case "dev-v1":
3309
3310
  try {
3310
- const o = await Bt(t.folder);
3311
+ const o = await Ot(t.folder);
3311
3312
  return o === t.mtime ? void 0 : { ...t, mtime: o };
3312
3313
  } catch (o) {
3313
3314
  this.logger.warn(o);
@@ -3315,25 +3316,25 @@ class Ns extends yr {
3315
3316
  }
3316
3317
  case "dev-v2":
3317
3318
  try {
3318
- const o = await Fe(t.folder, this.logger);
3319
+ const o = await Be(t.folder, this.logger);
3319
3320
  if (o === void 0) return;
3320
- const n = await Ue(o);
3321
- return n === t.mtime ? void 0 : { ...t, mtime: n };
3321
+ const i = await $e(o);
3322
+ return i === t.mtime ? void 0 : { ...t, mtime: i };
3322
3323
  } catch (o) {
3323
3324
  this.logger.warn(o);
3324
3325
  return;
3325
3326
  }
3326
3327
  case "from-registry-v2":
3327
3328
  try {
3328
- const o = this.registryProvider.getRegistry(t.registryUrl), n = (r = await o.getOverviewForSpec(t.id)) == null ? void 0 : r.spec;
3329
- if ((n == null ? void 0 : n.type) !== "from-registry-v2") throw new Error("Unexpected");
3330
- return be(n.id, t.id) ? void 0 : ((async () => {
3329
+ const o = this.registryProvider.getRegistry(t.registryUrl), i = (r = await o.getOverviewForSpec(t.id)) == null ? void 0 : r.spec;
3330
+ if ((i == null ? void 0 : i.type) !== "from-registry-v2") throw new Error("Unexpected");
3331
+ return ke(i.id, t.id) ? void 0 : ((async () => {
3331
3332
  try {
3332
- await o.getComponents(n.id);
3333
- } catch (i) {
3334
- this.logger.warn(i);
3333
+ await o.getComponents(i.id);
3334
+ } catch (n) {
3335
+ this.logger.warn(n);
3335
3336
  }
3336
- })(), n);
3337
+ })(), i);
3337
3338
  } catch (o) {
3338
3339
  this.logger.warn(o);
3339
3340
  return;
@@ -3351,9 +3352,9 @@ class Ns extends yr {
3351
3352
  if (t === void 0 || r === void 0 || t.type !== r.type) return !1;
3352
3353
  switch (t.type) {
3353
3354
  case "from-registry-v1":
3354
- return r.type !== "from-registry-v1" ? !1 : t.registryUrl === r.registryUrl && be(t.id, r.id);
3355
+ return r.type !== "from-registry-v1" ? !1 : t.registryUrl === r.registryUrl && ke(t.id, r.id);
3355
3356
  case "from-registry-v2":
3356
- return r.type !== "from-registry-v2" ? !1 : t.registryUrl === r.registryUrl && be(t.id, r.id);
3357
+ return r.type !== "from-registry-v2" ? !1 : t.registryUrl === r.registryUrl && ke(t.id, r.id);
3357
3358
  case "dev-v1":
3358
3359
  return r.type !== "dev-v1" ? !1 : t.folder === r.folder && t.mtime === r.mtime;
3359
3360
  case "dev-v2":
@@ -3363,7 +3364,7 @@ class Ns extends yr {
3363
3364
  }
3364
3365
  }
3365
3366
  }
3366
- class ht {
3367
+ class ft {
3367
3368
  constructor() {
3368
3369
  p(this, "resources", /* @__PURE__ */ new Map());
3369
3370
  }
@@ -3398,12 +3399,12 @@ class ht {
3398
3399
  return (t = this.resources.get(e)) == null ? void 0 : t.resource;
3399
3400
  }
3400
3401
  }
3401
- function ft(s) {
3402
+ function mt(s) {
3402
3403
  return String(s.id);
3403
3404
  }
3404
- class Ls {
3405
+ class Us {
3405
3406
  constructor(e, t, r) {
3406
- p(this, "pFrame", new Ar());
3407
+ p(this, "pFrame", new Er());
3407
3408
  p(this, "blobIdToResource", /* @__PURE__ */ new Map());
3408
3409
  p(this, "blobHandleComputables", /* @__PURE__ */ new Map());
3409
3410
  p(this, "preloadBlob", async (e) => {
@@ -3420,13 +3421,13 @@ class Ls {
3420
3421
  });
3421
3422
  this.blobDriver = e, this.blobContentCache = t, this.columns = r, this.pFrame.setDataSource(this);
3422
3423
  for (const o of r) {
3423
- for (const i of Eo(o.data)) this.blobIdToResource.set(ft(i), i);
3424
- const n = Io(o.data, ft);
3424
+ for (const n of No(o.data)) this.blobIdToResource.set(mt(n), n);
3425
+ const i = Vo(o.data, mt);
3425
3426
  try {
3426
- this.pFrame.addColumnSpec(o.id, o.spec), this.pFrame.setColumnData(o.id, n);
3427
- } catch (i) {
3427
+ this.pFrame.addColumnSpec(o.id, o.spec), this.pFrame.setColumnData(o.id, i);
3428
+ } catch (n) {
3428
3429
  throw new Error(
3429
- `Adding column ${o.id} to PFrame failed: ${i}; Spec: ${o.spec}, DataInfo: ${n}.`
3430
+ `Adding column ${o.id} to PFrame failed: ${n}; Spec: ${o.spec}, DataInfo: ${i}.`
3430
3431
  );
3431
3432
  }
3432
3433
  }
@@ -3443,7 +3444,7 @@ class Ls {
3443
3444
  this.pFrame.dispose();
3444
3445
  }
3445
3446
  }
3446
- class Js {
3447
+ class Ms {
3447
3448
  constructor(e) {
3448
3449
  p(this, "pFrames");
3449
3450
  p(this, "pTables");
@@ -3451,37 +3452,37 @@ class Js {
3451
3452
  /** Limits concurrent requests to PFrame API to prevent deadlock with Node's IO threads */
3452
3453
  p(this, "concurrencyLimiter");
3453
3454
  this.blobDriver = e;
3454
- const t = new Er({
3455
+ const t = new Ir({
3455
3456
  maxSize: 1e9,
3456
3457
  // 1Gb
3457
- fetchMethod: async (o) => await St.readFile(o),
3458
+ fetchMethod: async (o) => await kt.readFile(o),
3458
3459
  sizeCalculation: (o) => o.length
3459
- }), r = new ar(1);
3460
- this.blobContentCache = t, this.concurrencyLimiter = r, this.pFrames = new class extends ht {
3460
+ }), r = new cr(1);
3461
+ this.blobContentCache = t, this.concurrencyLimiter = r, this.pFrames = new class extends ft {
3461
3462
  constructor(o) {
3462
3463
  super(), this.blobDriver = o;
3463
3464
  }
3464
3465
  createNewResource(o) {
3465
- return new Ls(this.blobDriver, t, o);
3466
+ return new Us(this.blobDriver, t, o);
3466
3467
  }
3467
3468
  calculateParamsKey(o) {
3468
- return Us(o);
3469
+ return Ks(o);
3469
3470
  }
3470
- }(this.blobDriver), this.pTables = new class extends ht {
3471
+ }(this.blobDriver), this.pTables = new class extends ft {
3471
3472
  constructor(o) {
3472
3473
  super(), this.pFrames = o;
3473
3474
  }
3474
3475
  async createNewResource(o) {
3475
- const n = this.pFrames.getByKey(o.pFrameHandle), i = await r.run(
3476
- async () => await n.pFrame.createTable({
3477
- src: ee(o.def.src),
3476
+ const i = this.pFrames.getByKey(o.pFrameHandle), n = await r.run(
3477
+ async () => await i.pFrame.createTable({
3478
+ src: oe(o.def.src),
3478
3479
  filters: o.def.filters
3479
3480
  })
3480
3481
  );
3481
- return o.def.sorting.length !== 0 ? i.sort(o.def.sorting) : i;
3482
+ return o.def.sorting.length !== 0 ? n.sort(o.def.sorting) : n;
3482
3483
  }
3483
3484
  calculateParamsKey(o) {
3484
- return Ms(o);
3485
+ return $s(o);
3485
3486
  }
3486
3487
  }(this.pFrames);
3487
3488
  }
@@ -3489,12 +3490,12 @@ class Js {
3489
3490
  // Internal / Config API Methods
3490
3491
  //
3491
3492
  createPFrame(e, t) {
3492
- const r = e.map((n) => Q(n, (i) => Uo(i))), o = this.pFrames.acquire(r);
3493
+ const r = e.map((i) => X(i, (n) => Ko(n))), o = this.pFrames.acquire(r);
3493
3494
  return t.addOnDestroy(o.unref), o.key;
3494
3495
  }
3495
3496
  createPTable(e, t) {
3496
- const r = this.createPFrame($s(e.src), t), o = yt(e, (i) => i.id), n = this.pTables.acquire({ def: o, pFrameHandle: r });
3497
- return t.addOnDestroy(n.unref), n.key;
3497
+ const r = this.createPFrame(Gs(e.src), t), o = bt(e, (n) => n.id), i = this.pTables.acquire({ def: o, pFrameHandle: r });
3498
+ return t.addOnDestroy(i.unref), i.key;
3498
3499
  }
3499
3500
  //
3500
3501
  // PFrame istance methods
@@ -3523,22 +3524,22 @@ class Js {
3523
3524
  async calculateTableData(e, t) {
3524
3525
  let r = await this.concurrencyLimiter.run(
3525
3526
  async () => await this.pFrames.getByKey(e).pFrame.createTable({
3526
- src: ee(t.src),
3527
+ src: oe(t.src),
3527
3528
  filters: t.filters
3528
3529
  })
3529
3530
  );
3530
3531
  if (t.sorting.length > 0) {
3531
- const i = await this.concurrencyLimiter.run(
3532
+ const n = await this.concurrencyLimiter.run(
3532
3533
  async () => await r.sort(t.sorting)
3533
3534
  );
3534
- r.dispose(), r = i;
3535
+ r.dispose(), r = n;
3535
3536
  }
3536
- const o = r.getSpec(), n = await this.concurrencyLimiter.run(
3537
+ const o = r.getSpec(), i = await this.concurrencyLimiter.run(
3537
3538
  async () => await r.getData([...o.keys()])
3538
3539
  );
3539
- return r.dispose(), o.map((i, a) => ({
3540
- spec: i,
3541
- data: n[a]
3540
+ return r.dispose(), o.map((n, a) => ({
3541
+ spec: n,
3542
+ data: i[a]
3542
3543
  }));
3543
3544
  }
3544
3545
  async getUniqueValues(e, t) {
@@ -3562,7 +3563,7 @@ class Js {
3562
3563
  );
3563
3564
  }
3564
3565
  }
3565
- function ee(s) {
3566
+ function oe(s) {
3566
3567
  switch (s.type) {
3567
3568
  case "column":
3568
3569
  return {
@@ -3574,76 +3575,76 @@ function ee(s) {
3574
3575
  case "full":
3575
3576
  return {
3576
3577
  type: s.type,
3577
- entries: s.entries.map((e) => ee(e))
3578
+ entries: s.entries.map((e) => oe(e))
3578
3579
  };
3579
3580
  case "outer":
3580
3581
  return {
3581
3582
  type: "outer",
3582
- primary: ee(s.primary),
3583
- secondary: s.secondary.map((e) => ee(e))
3583
+ primary: oe(s.primary),
3584
+ secondary: s.secondary.map((e) => oe(e))
3584
3585
  };
3585
3586
  default:
3586
3587
  D(s);
3587
3588
  }
3588
3589
  }
3589
- function Ms(s) {
3590
- const e = fe("sha256");
3591
- return e.update(s.pFrameHandle), e.update(Le(s.def)), e.digest().toString("hex");
3590
+ function $s(s) {
3591
+ const e = ye("sha256");
3592
+ return e.update(s.pFrameHandle), e.update(Je(s.def)), e.digest().toString("hex");
3592
3593
  }
3593
- function Us(s) {
3594
- const e = s.map((o) => o.id).sort(), t = fe("sha256");
3594
+ function Ks(s) {
3595
+ const e = s.map((o) => o.id).sort(), t = ye("sha256");
3595
3596
  let r = "";
3596
3597
  for (const o of e)
3597
3598
  r !== o && (t.update(o), r = o);
3598
3599
  return t.digest().toString("hex");
3599
3600
  }
3600
- function $s(s) {
3601
+ function Gs(s) {
3601
3602
  const e = /* @__PURE__ */ new Map();
3602
- return ue(s, e), [...e.values()];
3603
+ return pe(s, e), [...e.values()];
3603
3604
  }
3604
- function ue(s, e) {
3605
+ function pe(s, e) {
3605
3606
  switch (s.type) {
3606
3607
  case "column":
3607
3608
  e.set(s.column.id, s.column);
3608
3609
  return;
3609
3610
  case "full":
3610
3611
  case "inner":
3611
- for (const t of s.entries) ue(t, e);
3612
+ for (const t of s.entries) pe(t, e);
3612
3613
  return;
3613
3614
  case "outer":
3614
- ue(s.primary, e);
3615
- for (const t of s.secondary) ue(t, e);
3615
+ pe(s.primary, e);
3616
+ for (const t of s.secondary) pe(t, e);
3616
3617
  return;
3617
3618
  default:
3618
3619
  D(s);
3619
3620
  }
3620
3621
  }
3621
- async function Ks(s, e, t) {
3622
+ async function _s(s, e, t) {
3622
3623
  const r = {
3623
- ...Ht,
3624
- ...Wt(e),
3624
+ ...Wt,
3625
+ ...zt(e),
3625
3626
  ...t
3626
- }, o = new wt(r.localSecret), n = Cr(r.logger, s, r.localProjections), i = Pr(s, r.logger), a = Rr(s, r.logger), c = Fr(s, r.logger), u = new Br(
3627
+ }, o = new St(r.localSecret), i = Pr(r.logger, s, r.localProjections), n = Rr(s, r.logger), a = Fr(s, r.logger), c = Br(s, r.logger), u = new Or(
3627
3628
  r.logger,
3628
- n,
3629
3629
  i,
3630
+ n,
3630
3631
  r.blobDownloadPath,
3631
3632
  o,
3632
3633
  r.blobDriverOps
3633
- ), l = new Or(
3634
+ ), l = new Dr(
3634
3635
  r.logger,
3635
3636
  o,
3636
3637
  a,
3637
3638
  c,
3638
3639
  r.uploadDriverOps
3639
- ), d = new Dr(r.logger, i, r.logStreamDriverOps), g = new xr(r.logger, d, u), f = await Tr.init(
3640
+ ), d = new xr(r.logger, n, r.logStreamDriverOps), g = new Ar(r.logger, d, u), f = await jr.init(
3640
3641
  r.logger,
3641
3642
  s,
3642
3643
  o,
3643
3644
  r.localProjections,
3644
3645
  r.openFileDialogCallback,
3645
3646
  r.virtualLocalStoragesOverride
3646
- ), v = new Js(u);
3647
+ ), v = new Ms(u);
3647
3648
  return {
3648
3649
  blobDriver: u,
3649
3650
  logDriver: g,
@@ -3653,8 +3654,8 @@ async function Ks(s, e, t) {
3653
3654
  pFrameDriver: v
3654
3655
  };
3655
3656
  }
3656
- class zt {
3657
- constructor(e, t, r, o, n, i, a, c) {
3657
+ class qt {
3658
+ constructor(e, t, r, o, i, n, a, c) {
3658
3659
  p(this, "pl");
3659
3660
  /** Contains a reactive list of projects along with their meta information. */
3660
3661
  p(this, "projectList");
@@ -3662,7 +3663,7 @@ class zt {
3662
3663
  // Projects
3663
3664
  //
3664
3665
  p(this, "openedProjectsByRid", /* @__PURE__ */ new Map());
3665
- this.env = e, this.driverKit = t, this.signer = r, this.projectListResourceId = o, this.openedProjectsList = n, this.projectListTree = i, this.blockRegistryProvider = a, this.projectList = c, this.pl = this.env.pl;
3666
+ this.env = e, this.driverKit = t, this.signer = r, this.projectListResourceId = o, this.openedProjectsList = i, this.projectListTree = n, this.blockRegistryProvider = a, this.projectList = c, this.pl = this.env.pl;
3666
3667
  }
3667
3668
  /** Returns extended API driver kit used internally by middle layer. */
3668
3669
  get internalDriverKit() {
@@ -3672,10 +3673,10 @@ class zt {
3672
3673
  // Project List Manipulation
3673
3674
  //
3674
3675
  /** Creates a project with initial state and adds it to project list. */
3675
- async createProject(e, t = te()) {
3676
+ async createProject(e, t = se()) {
3676
3677
  const r = await this.pl.withWriteTx("MLCreateProject", async (o) => {
3677
- const n = await Ao(o, e);
3678
- return o.createField(w(this.projectListResourceId, t), "Dynamic", n), await o.commit(), await fr(n);
3678
+ const i = await Io(o, e);
3679
+ return o.createField(w(this.projectListResourceId, t), "Dynamic", i), await o.commit(), await mr(i);
3679
3680
  });
3680
3681
  return await this.projectListTree.refreshState(), r;
3681
3682
  }
@@ -3695,7 +3696,7 @@ class zt {
3695
3696
  async projectIdToResourceId(e) {
3696
3697
  return await this.pl.withReadTx("Project id to resource id", async (t) => {
3697
3698
  const r = (await t.getField(w(this.projectListResourceId, e))).value;
3698
- if (le(r)) throw new Error("Unexpected project list structure.");
3699
+ if (ge(r)) throw new Error("Unexpected project list structure.");
3699
3700
  return r;
3700
3701
  });
3701
3702
  }
@@ -3706,7 +3707,7 @@ class zt {
3706
3707
  async openProject(e) {
3707
3708
  const t = await this.ensureProjectRid(e);
3708
3709
  if (this.openedProjectsByRid.has(t)) throw new Error(`Project ${t} already opened`);
3709
- this.openedProjectsByRid.set(t, await He.init(this.env, t)), this.openedProjectsList.setValue([...this.openedProjectsByRid.keys()]);
3710
+ this.openedProjectsByRid.set(t, await We.init(this.env, t)), this.openedProjectsList.setValue([...this.openedProjectsByRid.keys()]);
3710
3711
  }
3711
3712
  /** Closes the project, and deallocate all corresponding resources. */
3712
3713
  async closeProject(e) {
@@ -3734,57 +3735,57 @@ class zt {
3734
3735
  /** Generates sufficiently random string to be used as local secret for the
3735
3736
  * middle layer */
3736
3737
  static generateLocalSecret() {
3737
- return wt.generateSecret();
3738
+ return St.generateSecret();
3738
3739
  }
3739
3740
  /** Initialize middle layer */
3740
3741
  static async init(e, t, r) {
3741
3742
  const o = {
3742
- ...As,
3743
- ...Es(t),
3743
+ ...Is,
3744
+ ...Ns(t),
3744
3745
  ...r
3745
3746
  };
3746
3747
  process.env.MI_LOG_TREE_STAT && (o.defaultTreeOptions.logStat = process.env.MI_LOG_TREE_STAT === "cumulative" ? "cumulative" : "per-request");
3747
- const n = await e.withWriteTx("MLInitialization", async (S) => {
3748
- const I = w(S.clientRoot, eo);
3748
+ const i = await e.withWriteTx("MLInitialization", async (S) => {
3749
+ const I = w(S.clientRoot, ro);
3749
3750
  S.createField(I, "Dynamic");
3750
- const M = await S.getField(I);
3751
- if (le(M.value)) {
3752
- const $ = S.createEphemeral(xt);
3753
- return S.lock($), S.setField(I, $), await S.commit(), await $.globalId;
3751
+ const U = await S.getField(I);
3752
+ if (ge(U.value)) {
3753
+ const M = S.createEphemeral(At);
3754
+ return S.lock(M), S.setField(I, M), await S.commit(), await M.globalId;
3754
3755
  } else
3755
- return M.value;
3756
- }), i = o.logger, a = await Ks(e, t, o), c = new tr(e.httpDispatcher, {
3756
+ return U.value;
3757
+ }), n = o.logger, a = await _s(e, t, o), c = new rr(e.httpDispatcher, {
3757
3758
  minTimeout: 250,
3758
3759
  maxRetries: 4
3759
- }), u = new $r(c), l = new Fo(
3760
+ }), u = new Gr(c), l = new Oo(
3760
3761
  u,
3761
3762
  a.signer,
3762
3763
  c
3763
- ), d = new jr(
3764
- i,
3764
+ ), d = new Tr(
3765
+ n,
3765
3766
  e.httpDispatcher,
3766
3767
  o.frontendDownloadPath
3767
3768
  ), g = {
3768
3769
  pl: e,
3769
3770
  signer: a.signer,
3770
- logger: i,
3771
+ logger: n,
3771
3772
  httpDispatcher: e.httpDispatcher,
3772
3773
  retryHttpDispatcher: c,
3773
3774
  ops: o,
3774
3775
  bpPreparer: l,
3775
3776
  frontendDownloadDriver: d,
3776
3777
  driverKit: a,
3777
- blockUpdateWatcher: new Ns(u, i, {
3778
+ blockUpdateWatcher: new Js(u, n, {
3778
3779
  minDelay: o.devBlockUpdateRecheckInterval,
3779
3780
  http: c
3780
3781
  }),
3781
- quickJs: await kr()
3782
- }, f = new br([]), v = await ro(e, n, f, g);
3783
- return new zt(
3782
+ quickJs: await Cr()
3783
+ }, f = new wr([]), v = await so(e, i, f, g);
3784
+ return new qt(
3784
3785
  g,
3785
3786
  a,
3786
3787
  a.signer,
3787
- n,
3788
+ i,
3788
3789
  f,
3789
3790
  v.tree,
3790
3791
  u,
@@ -3792,109 +3793,190 @@ class zt {
3792
3793
  );
3793
3794
  }
3794
3795
  }
3795
- async function wn(s, e = {}) {
3796
+ const Hs = [
3797
+ "undici:request:create",
3798
+ // When a new request is created
3799
+ "undici:request:bodySent",
3800
+ // When the request body is sent
3801
+ "undici:request:headers",
3802
+ // When request headers are sent
3803
+ "undici:request:error",
3804
+ // When a request encounters an error
3805
+ "undici:request:trailers",
3806
+ // When a response completes.
3807
+ "undici:client:sendHeaders",
3808
+ "undici:client:beforeConnect",
3809
+ "undici:client:connected",
3810
+ "undici:client:connectError",
3811
+ "undici:socket:close",
3812
+ // When a socket is closed
3813
+ "undici:socket:connect",
3814
+ // When a socket connects
3815
+ "undici:socket:error",
3816
+ // When a socket encounters an error
3817
+ "undici:pool:request",
3818
+ // When a request is added to the pool
3819
+ "undici:pool:connect",
3820
+ // When a pool creates a new connection
3821
+ "undici:pool:disconnect",
3822
+ // When a pool connection is closed
3823
+ "undici:pool:destroy",
3824
+ // When a pool is destroyed
3825
+ "undici:dispatcher:request",
3826
+ // When a dispatcher processes a request
3827
+ "undici:dispatcher:connect",
3828
+ // When a dispatcher connects
3829
+ "undici:dispatcher:disconnect",
3830
+ // When a dispatcher disconnects
3831
+ "undici:dispatcher:retry"
3832
+ // When a dispatcher retries a request
3833
+ ];
3834
+ async function Ci(s, e = {}) {
3796
3835
  const t = {
3797
3836
  pingCheckDurationMs: 1e4,
3798
3837
  pingTimeoutMs: 3e3,
3799
3838
  maxPingsPerSecond: 50,
3800
3839
  httpTimeoutMs: 3e3,
3801
- blockRegistryDurationMs: 5e3,
3840
+ blockRegistryDurationMs: 3e3,
3802
3841
  maxRegistryChecksPerSecond: 1,
3803
- blockRegistryUrl: "https://blocks.pl-open.science/v2/overview.json",
3842
+ blockRegistryUrl: "https://blocks.pl-open.science",
3843
+ blockGARegistryUrl: "https://blocks-ga.pl-open.science",
3844
+ blockOverviewPath: "v2/overview.json",
3845
+ blockUiPath: "v2/milaboratories/samples-and-data/1.7.0/ui.tgz",
3804
3846
  autoUpdateCdnDurationMs: 5e3,
3805
3847
  maxAutoUpdateCdnChecksPerSecond: 1,
3806
3848
  autoUpdateCdnUrl: "https://cdn.platforma.bio/software/platforma-desktop-v2/windows/amd64/latest.yml",
3849
+ bodyLimit: 300,
3807
3850
  ...e
3808
- }, r = {
3851
+ }, r = [];
3852
+ Hs.forEach((c) => {
3853
+ Nr(c).subscribe((l) => {
3854
+ var g;
3855
+ const d = (/* @__PURE__ */ new Date()).toISOString();
3856
+ (g = l == null ? void 0 : l.response) != null && g.headers && (l.response.headers = l.response.headers.map((f) => f.toString())), r.push(
3857
+ JSON.stringify({
3858
+ timestamp: d,
3859
+ event: c,
3860
+ data: l
3861
+ })
3862
+ );
3863
+ });
3864
+ });
3865
+ const o = {
3809
3866
  plPings: [],
3810
- blockRegistryChecks: [],
3867
+ blockRegistryOverviewChecks: [],
3868
+ blockGARegistryOverviewChecks: [],
3869
+ blockRegistryUiChecks: [],
3870
+ blockGARegistryUiChecks: [],
3811
3871
  autoUpdateCdnChecks: []
3812
- }, o = mr(s, { defaultRequestTimeout: t.pingTimeoutMs });
3813
- r.plPings = await Pe(t.pingCheckDurationMs, t.maxPingsPerSecond, async () => {
3814
- const c = await new Xe(o).ping();
3815
- return JSON.stringify(c).slice(0, 100) + "...";
3872
+ }, i = vr(s, { defaultRequestTimeout: t.pingTimeoutMs });
3873
+ o.plPings = await Q(t.pingCheckDurationMs, t.maxPingsPerSecond, async () => {
3874
+ const u = await new et(i).ping();
3875
+ return JSON.stringify(u).slice(0, t.bodyLimit) + "...";
3816
3876
  });
3817
- const i = new Xe(o).ll.httpDispatcher;
3818
- return r.blockRegistryChecks = await Pe(
3877
+ const a = new et(i).ll.httpDispatcher;
3878
+ return o.blockRegistryOverviewChecks = await Q(
3819
3879
  t.blockRegistryDurationMs,
3820
3880
  t.maxRegistryChecksPerSecond,
3821
- async () => {
3822
- const { body: a, statusCode: c } = await U(t.blockRegistryUrl, {
3823
- dispatcher: i,
3824
- headersTimeout: t.httpTimeoutMs,
3825
- bodyTimeout: t.httpTimeoutMs
3826
- }), u = await a.text();
3827
- return {
3828
- statusCode: c,
3829
- beginningOfBody: u.slice(0, 100) + "..."
3830
- };
3831
- }
3832
- ), r.autoUpdateCdnChecks = await Pe(
3881
+ async () => await ee(new URL(t.blockOverviewPath, t.blockRegistryUrl), t, a)
3882
+ ), o.blockGARegistryOverviewChecks = await Q(
3883
+ t.blockRegistryDurationMs,
3884
+ t.maxRegistryChecksPerSecond,
3885
+ async () => await ee(new URL(t.blockOverviewPath, t.blockGARegistryUrl), t, a)
3886
+ ), o.blockRegistryUiChecks = await Q(
3887
+ t.blockRegistryDurationMs,
3888
+ t.maxRegistryChecksPerSecond,
3889
+ async () => await ee(new URL(t.blockUiPath, t.blockRegistryUrl), t, a)
3890
+ ), o.blockGARegistryUiChecks = await Q(
3891
+ t.blockRegistryDurationMs,
3892
+ t.maxRegistryChecksPerSecond,
3893
+ async () => await ee(new URL(t.blockUiPath, t.blockGARegistryUrl), t, a)
3894
+ ), o.autoUpdateCdnChecks = await Q(
3833
3895
  t.autoUpdateCdnDurationMs,
3834
3896
  t.maxAutoUpdateCdnChecksPerSecond,
3835
- async () => {
3836
- const { body: a, statusCode: c } = await U(t.autoUpdateCdnUrl, {
3837
- dispatcher: i,
3838
- headersTimeout: t.httpTimeoutMs,
3839
- bodyTimeout: t.httpTimeoutMs
3840
- }), u = await a.text();
3841
- return {
3842
- statusCode: c,
3843
- beginningOfBody: u.slice(0, 100) + "..."
3844
- };
3845
- }
3846
- ), Gs(r, s, t);
3847
- }
3848
- async function Pe(s, e, t) {
3849
- const r = Ne(), o = [];
3850
- for (; mt(r) < s; ) {
3851
- const n = Ne();
3852
- let i;
3897
+ async () => await ee(t.autoUpdateCdnUrl, t, a)
3898
+ ), Ws(o, s, t, r);
3899
+ }
3900
+ async function Q(s, e, t) {
3901
+ const r = Le(), o = [];
3902
+ for (; vt(r) < s; ) {
3903
+ const i = Le();
3904
+ let n;
3853
3905
  try {
3854
- i = { ok: !0, value: await t() };
3906
+ n = { ok: !0, value: await t() };
3855
3907
  } catch (u) {
3856
- i = { ok: !1, error: u };
3908
+ n = { ok: !1, error: u };
3857
3909
  }
3858
- const a = mt(n);
3910
+ const a = vt(i);
3859
3911
  o.push({
3860
3912
  elapsedMs: a,
3861
- response: i
3913
+ response: n
3862
3914
  });
3863
3915
  const c = 1e3 / e - a;
3864
- c > 0 && await Rt(c);
3916
+ c > 0 && await Ft(c);
3865
3917
  }
3866
3918
  return o;
3867
3919
  }
3868
- function Gs(s, e, t) {
3869
- const r = s.plPings.filter((i) => i.response.ok), o = s.plPings.filter((i) => !i.response.ok), n = [
3870
- ...new Set(r.map((i) => JSON.stringify(i.response.value)))
3920
+ async function ee(s, e, t) {
3921
+ const { body: r, statusCode: o } = await K(s, {
3922
+ dispatcher: t,
3923
+ headersTimeout: e.httpTimeoutMs,
3924
+ bodyTimeout: e.httpTimeoutMs
3925
+ }), i = await r.text();
3926
+ return {
3927
+ statusCode: o,
3928
+ beginningOfBody: i.slice(0, e.bodyLimit) + "..."
3929
+ };
3930
+ }
3931
+ function Ws(s, e, t, r) {
3932
+ const o = s.plPings.filter((a) => a.response.ok), i = s.plPings.filter((a) => !a.response.ok), n = [
3933
+ ...new Set(o.map((a) => JSON.stringify(a.response.value)))
3871
3934
  ];
3872
3935
  return `
3873
3936
  Network report:
3874
3937
  pl endpoint: ${e};
3875
3938
  options: ${JSON.stringify(t, null, 2)}.
3876
3939
 
3877
- Platforma pings: ${Re(s.plPings)}
3940
+ Platforma pings: ${Z(s.plPings)}
3941
+
3942
+ Block registry overview responses: ${Z(s.blockRegistryOverviewChecks)}
3878
3943
 
3879
- Block registry responses: ${Re(s.blockRegistryChecks)}
3944
+ Block ga registry overview responses: ${Z(s.blockGARegistryOverviewChecks)}
3880
3945
 
3881
- Auto-update CDN responses: ${Re(s.autoUpdateCdnChecks)}
3946
+ Block registry ui responses: ${Z(s.blockRegistryUiChecks)}
3882
3947
 
3883
- Block registry dumps:
3884
- ${JSON.stringify(s.blockRegistryChecks, null, 2)}
3948
+ Block ga registry ui responses: ${Z(s.blockGARegistryUiChecks)}
3949
+
3950
+ Auto-update CDN responses: ${Z(s.autoUpdateCdnChecks)}
3951
+
3952
+ Block registry overview dumps:
3953
+ ${JSON.stringify(s.blockRegistryOverviewChecks, null, 2)}
3954
+
3955
+ Block ga registry overview dumps:
3956
+ ${JSON.stringify(s.blockGARegistryOverviewChecks, null, 2)}
3957
+
3958
+ Block registry ui dumps:
3959
+ ${JSON.stringify(s.blockRegistryUiChecks, null, 2)}
3960
+
3961
+ Block ga registry ui dumps:
3962
+ ${JSON.stringify(s.blockGARegistryUiChecks, null, 2)}
3885
3963
 
3886
3964
  Auto-update CDN dumps:
3887
3965
  ${JSON.stringify(s.autoUpdateCdnChecks, null, 2)}
3888
3966
 
3889
3967
  Platforma pings error dumps:
3890
- ${JSON.stringify(o, null, 2)}
3968
+ ${JSON.stringify(i, null, 2)}
3891
3969
 
3892
3970
  Platforma pings success dump examples:
3893
3971
  ${JSON.stringify(n, null, 2)}
3972
+
3973
+ Undici logs:
3974
+ ${r.join(`
3975
+ `)}
3894
3976
  `;
3895
3977
  }
3896
- function Re(s) {
3897
- const e = s.filter((o) => o.response.ok), { mean: t, median: r } = _s(s);
3978
+ function Z(s) {
3979
+ const e = s.filter((o) => o.response.ok), { mean: t, median: r } = zs(s);
3898
3980
  return `
3899
3981
  total: ${s.length};
3900
3982
  successes: ${e.length};
@@ -3903,8 +3985,8 @@ mean in ms: ${t};
3903
3985
  median in ms: ${r};
3904
3986
  `;
3905
3987
  }
3906
- function _s(s) {
3907
- const e = s.map((o) => o.elapsedMs), t = e.reduce((o, n) => o + n) / e.length;
3988
+ function zs(s) {
3989
+ const e = s.map((o) => o.elapsedMs), t = e.reduce((o, i) => o + i) / e.length;
3908
3990
  let r;
3909
3991
  if (e.length > 0) {
3910
3992
  const o = Math.floor(e.length / 2);
@@ -3912,40 +3994,40 @@ function _s(s) {
3912
3994
  }
3913
3995
  return { mean: t, median: r };
3914
3996
  }
3915
- function Ne() {
3997
+ function Le() {
3916
3998
  return Date.now();
3917
3999
  }
3918
- function mt(s) {
3919
- return Ne() - s;
4000
+ function vt(s) {
4001
+ return Le() - s;
3920
4002
  }
3921
4003
  export {
3922
- mn as BlockPackRegistry,
3923
- vn as CentralBlockRegistry,
3924
- Wt as DefaultDriverKitOpsPaths,
3925
- Ht as DefaultDriverKitOpsSettings,
3926
- Es as DefaultMiddleLayerOpsPaths,
3927
- As as DefaultMiddleLayerOpsSettings,
3928
- At as FrontendFromFolderResourceType,
3929
- jt as FrontendFromUrlResourceType,
3930
- zt as MiddleLayer,
3931
- He as Project,
3932
- go as TengoTemplateGet,
3933
- ho as TengoTemplateGetRegistry,
3934
- mo as TengoTemplateGetTemplate,
3935
- fo as TengoTemplateGetTemplateURI,
3936
- vo as TengoTemplatePack,
3937
- yo as TengoTemplatePackConvert,
3938
- wo as TengoTemplatePackConvertTemplate,
3939
- bo as TengoTemplatePackConvertTemplatePack,
3940
- bn as V1CentralDevSnapshotRegistry,
3941
- yn as V1CentralRegistry,
3942
- $r as V2RegistryProvider,
3943
- wn as checkNetwork,
3944
- Tt as createRenderTemplate,
3945
- Bt as getDevV1PacketMtime,
3946
- Ue as getDevV2PacketMtime,
3947
- Ks as initDriverKit,
3948
- Ke as loadTemplate,
3949
- So as prepareTemplateSpec
4004
+ bi as BlockPackRegistry,
4005
+ wi as CentralBlockRegistry,
4006
+ zt as DefaultDriverKitOpsPaths,
4007
+ Wt as DefaultDriverKitOpsSettings,
4008
+ Ns as DefaultMiddleLayerOpsPaths,
4009
+ Is as DefaultMiddleLayerOpsSettings,
4010
+ Et as FrontendFromFolderResourceType,
4011
+ Tt as FrontendFromUrlResourceType,
4012
+ qt as MiddleLayer,
4013
+ We as Project,
4014
+ fo as TengoTemplateGet,
4015
+ mo as TengoTemplateGetRegistry,
4016
+ yo as TengoTemplateGetTemplate,
4017
+ vo as TengoTemplateGetTemplateURI,
4018
+ bo as TengoTemplatePack,
4019
+ wo as TengoTemplatePackConvert,
4020
+ ko as TengoTemplatePackConvertTemplate,
4021
+ So as TengoTemplatePackConvertTemplatePack,
4022
+ ki as V1CentralDevSnapshotRegistry,
4023
+ Si as V1CentralRegistry,
4024
+ Gr as V2RegistryProvider,
4025
+ Ci as checkNetwork,
4026
+ jt as createRenderTemplate,
4027
+ Ot as getDevV1PacketMtime,
4028
+ $e as getDevV2PacketMtime,
4029
+ _s as initDriverKit,
4030
+ Ge as loadTemplate,
4031
+ Co as prepareTemplateSpec
3950
4032
  };
3951
4033
  //# sourceMappingURL=index.mjs.map