@milaboratories/pl-middle-layer 1.14.26 → 1.14.28

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,101 +1,101 @@
1
1
  var zt = Object.defineProperty;
2
- var Yt = (o, e, t) => e in o ? zt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var d = (o, e, t) => Yt(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { executePSpecPredicate as qt, mapPObjectData as Z, mapValueInVOE as Qt, mapPTableDef as ht, isFunctionHandle as ft, normalizeBlockConfig as Ie, DefaultNavigationState as Zt } from "@platforma-sdk/model";
2
+ var Yt = (s, e, t) => e in s ? zt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var d = (s, e, t) => Yt(s, typeof e != "symbol" ? e + "" : e, t);
4
+ import { executePSpecPredicate as qt, mapPObjectData as Q, mapValueInVOE as Qt, mapPTableDef as ht, isFunctionHandle as ft, normalizeBlockConfig as Ae, DefaultNavigationState as Zt } from "@platforma-sdk/model";
5
5
  export * from "@platforma-sdk/model";
6
- import { blockPackIdEquals as ve } from "@milaboratories/pl-model-middle-layer";
6
+ import { blockPackIdEquals as me } from "@milaboratories/pl-model-middle-layer";
7
7
  export * from "@milaboratories/pl-model-middle-layer";
8
8
  import { request as M, RetryAgent as Xt } from "undici";
9
- import { RegistryV1 as _, tryLoadPackDescription as mt, BlockPackMetaEmbedAbsoluteBytes as er, RegistryV2Reader as tr, folderReaderByUrl as rr, loadPackDescription as qe } from "@platforma-sdk/block-tools";
9
+ import { RegistryV1 as _, tryLoadPackDescription as mt, BlockPackMetaEmbedAbsoluteBytes as er, RegistryV2Reader as tr, folderReaderByUrl as rr, loadPackDescription as Ye } from "@platforma-sdk/block-tools";
10
10
  import A from "node:fs";
11
- import T from "node:path";
12
- import sr from "yaml";
13
- import { assertNever as D, notEmpty as w, ConsoleLoggerAdapter as or, ConcurrencyLimitingExecutor as nr, HmacSha256Signer as vt } from "@milaboratories/ts-helpers";
11
+ import j from "node:path";
12
+ import or from "yaml";
13
+ import { assertNever as D, notEmpty as w, ConsoleLoggerAdapter as sr, ConcurrencyLimitingExecutor as nr, HmacSha256Signer as vt } from "@milaboratories/ts-helpers";
14
14
  import * as yt from "node:fs/promises";
15
15
  import { tryResolve as ir } from "@milaboratories/resolve-helper";
16
- import { resourceTypesEqual as $, field as S, Pl as b, PlClient as ar, isNullResourceId as ue, ensureResourceIdNotNull as Pe, isResource as cr, isResourceRef as ur, isNotNullResourceId as Qe, resourceType as se, resourceTypeToString as lr, resourceIdToString as bt, isNotFoundError as dr, isTimeoutOrCancelError as pr, toGlobalResourceId as gr, plAddressToConfig as hr, UnauthenticatedPlClient as Ze } from "@milaboratories/pl-client";
16
+ import { resourceTypesEqual as $, field as S, Pl as y, PlClient as ar, isNullResourceId as ce, ensureResourceIdNotNull as Ce, isResource as cr, isResourceRef as ur, isNotNullResourceId as qe, resourceType as re, resourceTypeToString as lr, resourceIdToString as bt, isNotFoundError as dr, isTimeoutOrCancelError as pr, toGlobalResourceId as gr, plAddressToConfig as hr, UnauthenticatedPlClient as Qe } from "@milaboratories/pl-client";
17
17
  export * from "@milaboratories/pl-client";
18
18
  import { SynchronizedTreeState as wt, PlError as fr } from "@milaboratories/pl-tree";
19
- import { Computable as F, ChangeSource as Xe, PollComputablePool as mr, WatchableValue as vr } from "@milaboratories/computable";
20
- import { randomUUID as ee, createHash as he } from "node:crypto";
19
+ import { Computable as F, ChangeSource as Ze, PollComputablePool as mr, WatchableValue as vr } from "@milaboratories/computable";
20
+ import { randomUUID as X, createHash as ge } from "node:crypto";
21
21
  import St from "denque";
22
22
  import { Templates as yr } from "@platforma-sdk/workflow-tengo";
23
- import Ve from "canonicalize";
23
+ import Ie from "canonicalize";
24
24
  import br from "node:assert";
25
- import { Scope as Fe, getQuickJS as wr } from "quickjs-emscripten";
25
+ import { Scope as Pe, getQuickJS as wr } from "quickjs-emscripten";
26
26
  import { setTimeout as kt } from "node:timers/promises";
27
27
  import { createDownloadClient as Sr, createLogsClient as kr, createUploadBlobClient as Cr, createUploadProgressClient as Pr, DownloadDriver as Fr, UploadDriver as Rr, LogsStreamDriver as Br, LogsDriver as Or, LsDriver as Dr, DownloadUrlDriver as xr } from "@milaboratories/pl-drivers";
28
- import { PFrame as jr } from "@milaboratories/pframes-node";
29
- import { LRUCache as Tr } from "lru-cache";
30
- async function et(o) {
28
+ import { PFrame as Tr } from "@milaboratories/pframes-node";
29
+ import { LRUCache as jr } from "lru-cache";
30
+ async function Xe(s) {
31
31
  try {
32
- return await yt.stat(o, { bigint: !0 });
32
+ return await yt.stat(s, { bigint: !0 });
33
33
  } catch (e) {
34
34
  if (e.code === "ENOENT")
35
35
  return;
36
36
  throw e;
37
37
  }
38
38
  }
39
- const Er = [_.PlPackageYamlConfigFile], Ar = [_.PlPackageJsonConfigFile], Ne = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Le = ["config", "dist", "config.json"], Ct = ["frontend", "dist"], tt = "block-model/dist/config.json", Ir = "block-ui/package.json", Vr = [
39
+ const Er = [_.PlPackageYamlConfigFile], Ar = [_.PlPackageJsonConfigFile], Ve = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Ne = ["config", "dist", "config.json"], Ct = ["frontend", "dist"], et = "block-model/dist/config.json", Ir = "block-ui/package.json", Vr = [
40
+ Ve,
40
41
  Ne,
41
- Le,
42
42
  Er,
43
43
  Ar,
44
44
  Ct
45
45
  ];
46
- async function Nr(o) {
47
- return await et(T.join(o, ...Le)) !== void 0 || await et(T.join(o, ...Ne)) !== void 0;
46
+ async function Nr(s) {
47
+ return await Xe(j.join(s, ...Ne)) !== void 0 || await Xe(j.join(s, ...Ve)) !== void 0;
48
48
  }
49
- function ye(o, e) {
50
- const t = ir(o, e);
51
- if (t === void 0) throw new Error(`Can't resolve ${e} against ${o}`);
49
+ function ve(s, e) {
50
+ const t = ir(s, e);
51
+ if (t === void 0) throw new Error(`Can't resolve ${e} against ${s}`);
52
52
  return t;
53
53
  }
54
- async function rt(o, e) {
55
- if (T.isAbsolute(o) || (o = T.resolve(o)), await Nr(o))
54
+ async function tt(s, e) {
55
+ if (j.isAbsolute(s) || (s = j.resolve(s)), await Nr(s))
56
56
  return {
57
- workflow: T.join(o, ...Ne),
58
- config: T.join(o, ...Le),
59
- ui: T.join(o, ...Ct)
57
+ workflow: j.join(s, ...Ve),
58
+ config: j.join(s, ...Ne),
59
+ ui: j.join(s, ...Ct)
60
60
  };
61
61
  {
62
- const t = ye(o, tt), r = ye(o, tt), s = ye(o, Ir);
63
- return { workflow: t, config: r, ui: T.resolve(s, "..", "dist") };
62
+ const t = ve(s, et), r = ve(s, et), o = ve(s, Ir);
63
+ return { workflow: t, config: r, ui: j.resolve(o, "..", "dist") };
64
64
  }
65
65
  }
66
- async function Lr(o) {
66
+ async function Lr(s) {
67
67
  try {
68
- return await A.promises.readFile(o, "utf8");
68
+ return await A.promises.readFile(s, "utf8");
69
69
  } catch (e) {
70
70
  if (e.code === "ENOENT")
71
71
  return;
72
72
  throw e;
73
73
  }
74
74
  }
75
- async function Jr(o) {
75
+ async function Jr(s) {
76
76
  try {
77
- return await A.promises.stat(o, { bigint: !0 });
77
+ return await A.promises.stat(s, { bigint: !0 });
78
78
  } catch (e) {
79
79
  if (e.code === "ENOENT")
80
80
  return;
81
81
  throw e;
82
82
  }
83
83
  }
84
- async function Pt(o) {
84
+ async function Pt(s) {
85
85
  let e = 0n;
86
86
  for (const t of Vr) {
87
- const r = T.join(o, ...t), s = await Jr(r);
88
- s !== void 0 && e < s.mtimeNs && (e = s.mtimeNs);
87
+ const r = j.join(s, ...t), o = await Jr(r);
88
+ o !== void 0 && e < o.mtimeNs && (e = o.mtimeNs);
89
89
  }
90
90
  return e.toString();
91
91
  }
92
- async function Je(o) {
93
- const e = await A.promises.stat(o.components.workflow.main.file, {
92
+ async function Le(s) {
93
+ const e = await A.promises.stat(s.components.workflow.main.file, {
94
94
  bigint: !0
95
- }), t = await A.promises.stat(o.components.model.file, { bigint: !0 });
95
+ }), t = await A.promises.stat(s.components.model.file, { bigint: !0 });
96
96
  return (e.mtimeNs > t.mtimeNs ? e.mtimeNs : t.mtimeNs).toString();
97
97
  }
98
- class dn {
98
+ class pn {
99
99
  constructor(e, t, r) {
100
100
  this.v2Provider = e, this.registries = t, this.http = r;
101
101
  }
@@ -103,9 +103,9 @@ class dn {
103
103
  const t = [], r = e.spec;
104
104
  switch (r.type) {
105
105
  case "remote-v1":
106
- const s = this.http !== void 0 ? { dispatcher: this.http } : {}, i = await (await M(
106
+ const o = this.http !== void 0 ? { dispatcher: this.http } : {}, i = await (await M(
107
107
  `${r.url}/${_.GlobalOverviewPath}`,
108
- s
108
+ o
109
109
  )).body.json();
110
110
  for (const a of i) {
111
111
  const { organization: c, package: u, latestMeta: l, latestVersion: p } = a, g = {
@@ -141,11 +141,11 @@ class dn {
141
141
  case "local-dev":
142
142
  for (const a of await A.promises.readdir(r.path, { withFileTypes: !0 })) {
143
143
  if (!a.isDirectory()) continue;
144
- const c = T.join(r.path, a.name), u = await Lr(
145
- T.join(c, _.PlPackageYamlConfigFile)
144
+ const c = j.join(r.path, a.name), u = await Lr(
145
+ j.join(c, _.PlPackageYamlConfigFile)
146
146
  );
147
147
  if (u !== void 0) {
148
- const l = _.PlPackageConfigData.parse(sr.parse(u)), p = await Pt(c), g = {
148
+ const l = _.PlPackageConfigData.parse(or.parse(u)), p = await Pt(c), g = {
149
149
  organization: l.organization,
150
150
  name: l.package,
151
151
  version: "DEV"
@@ -171,7 +171,7 @@ class dn {
171
171
  } else {
172
172
  const l = await mt(c);
173
173
  if (l !== void 0) {
174
- const p = await Je(l);
174
+ const p = await Le(l);
175
175
  t.push({
176
176
  registryId: e.id,
177
177
  id: l.id,
@@ -210,54 +210,54 @@ class Mr {
210
210
  return this.registries.set(e, r), r;
211
211
  }
212
212
  }
213
- const pn = {
213
+ const gn = {
214
214
  type: "remote-v2",
215
215
  url: "https://blocks.pl-open.science/"
216
- }, gn = {
216
+ }, hn = {
217
217
  type: "remote-v1",
218
218
  url: "https://block.registry.platforma.bio/releases"
219
- }, hn = {
219
+ }, fn = {
220
220
  type: "remote-v1",
221
221
  url: "https://block.registry.platforma.bio/dev"
222
- }, Ur = {
223
- groups: [{ id: "default", label: "Default", blocks: [] }]
224
222
  }, Kr = {
223
+ groups: [{ id: "default", label: "Default", blocks: [] }]
224
+ }, Ur = {
225
225
  stagingRefreshTimestamp: 0,
226
226
  blocksInLimbo: []
227
227
  }, $r = {
228
228
  label: "New Project"
229
- }, Gr = { name: "UserProject", version: "2" }, Ft = "SchemaVersion", Rt = "1", Me = "ProjectCreated", te = "ProjectLastModified", re = "ProjectMeta", W = "ProjectStructure", le = "BlockRenderingState", Hr = "BlockFrontendState/", _r = /^BlockFrontendState\/(?<blockid>.*)$/;
230
- function Re(o) {
231
- return `${Hr}${o}`;
229
+ }, Gr = { name: "UserProject", version: "2" }, Ft = "SchemaVersion", Rt = "1", Je = "ProjectCreated", ee = "ProjectLastModified", te = "ProjectMeta", W = "ProjectStructure", ue = "BlockRenderingState", Hr = "BlockFrontendState/", _r = /^BlockFrontendState\/(?<blockid>.*)$/;
230
+ function Fe(s) {
231
+ return `${Hr}${s}`;
232
232
  }
233
233
  const Wr = "BlockArgsAuthor/";
234
- function Be(o) {
235
- return `${Wr}${o}`;
234
+ function Re(s) {
235
+ return `${Wr}${s}`;
236
236
  }
237
- const Oe = "ProjectStructureAuthor";
238
- function zr(o) {
239
- const e = o.match(_r);
237
+ const Be = "ProjectStructureAuthor";
238
+ function zr(s) {
239
+ const e = s.match(_r);
240
240
  if (e !== null)
241
241
  return e.groups.blockid;
242
242
  }
243
243
  const Yr = "__serviceTemplate_";
244
- function De(o) {
245
- return `${Yr}${o}`;
244
+ function Oe(s) {
245
+ return `${Yr}${s}`;
246
246
  }
247
- function P(o, e) {
248
- return `${o}-${e}`;
247
+ function P(s, e) {
248
+ return `${s}-${e}`;
249
249
  }
250
250
  const qr = /^(?<blockId>.*)-(?<fieldName>blockPack|prodArgs|currentArgs|prodCtx|prodUiCtx|prodOutput|prodCtxPrevious|prodUiCtxPrevious|prodOutputPrevious|stagingCtx|stagingUiCtx|stagingOutput|stagingCtxPrevious|stagingUiCtxPrevious|stagingOutputPrevious)$/;
251
- function Qr(o) {
252
- const e = o.match(qr);
251
+ function Qr(s) {
252
+ const e = s.match(qr);
253
253
  if (e === null) return;
254
254
  const { blockId: t, fieldName: r } = e.groups;
255
255
  return { blockId: t, fieldName: r };
256
256
  }
257
- const Zr = "projects", Bt = { name: "Projects", version: "1" }, Xr = (o) => $(o.type, Bt) ? o.fields : [];
258
- async function es(o, e, t, r) {
259
- const s = await wt.init(
260
- o,
257
+ const Zr = "projects", Bt = { name: "Projects", version: "1" }, Xr = (s) => $(s.type, Bt) ? s.fields : [];
258
+ async function eo(s, e, t, r) {
259
+ const o = await wt.init(
260
+ s,
261
261
  e,
262
262
  {
263
263
  ...r.ops.defaultTreeOptions,
@@ -266,86 +266,86 @@ async function es(o, e, t, r) {
266
266
  r.logger
267
267
  );
268
268
  return { computable: F.make((i) => {
269
- const a = i.accessor(s.entry()).node(), c = t.getValue(i);
269
+ const a = i.accessor(o.entry()).node(), c = t.getValue(i);
270
270
  if (a === void 0) return;
271
271
  const u = [];
272
272
  for (const l of a.listDynamicFields()) {
273
273
  const p = a.traverse(l);
274
274
  if (p === void 0) continue;
275
- const g = w(p.getKeyValueAsJson(re)), m = w(p.getKeyValueAsJson(Me)), h = w(p.getKeyValueAsJson(te));
275
+ const g = w(p.getKeyValueAsJson(te)), f = w(p.getKeyValueAsJson(Je)), b = w(p.getKeyValueAsJson(ee));
276
276
  u.push({
277
277
  id: l,
278
278
  rid: p.id,
279
- created: new Date(m),
280
- lastModified: new Date(h),
279
+ created: new Date(f),
280
+ lastModified: new Date(b),
281
281
  opened: c.indexOf(p.id) >= 0,
282
282
  meta: g
283
283
  });
284
284
  }
285
285
  return u.sort((l) => -l.lastModified.valueOf()), u;
286
- }).withStableType(), tree: s };
286
+ }).withStableType(), tree: o };
287
287
  }
288
- const ts = {
288
+ const to = {
289
289
  name: "EphRenderTemplate",
290
290
  version: "1"
291
- }, rs = {
291
+ }, ro = {
292
292
  name: "RenderTemplate",
293
293
  version: "1"
294
294
  };
295
- function Ot(o, e, t, r, s) {
296
- if (s.length === 0) throw new Error("Zero output names provided");
297
- const n = t ? o.createEphemeral(ts) : o.createStruct(rs), i = S(n, "template"), a = S(n, "inputs");
298
- return o.createField(i, "Input", e), o.createField(a, "Input", b.createPlMap(o, r, t)), o.lockInputs(n), b.futureRecord(o, n, s, "Output", "outputs/");
295
+ function Ot(s, e, t, r, o) {
296
+ if (o.length === 0) throw new Error("Zero output names provided");
297
+ const n = t ? s.createEphemeral(to) : s.createStruct(ro), i = S(n, "template"), a = S(n, "inputs");
298
+ return s.createField(i, "Input", e), s.createField(a, "Input", y.createPlMap(s, r, t)), s.lockInputs(n), y.futureRecord(s, n, o, "Output", "outputs/");
299
299
  }
300
- const ss = { name: "BContextEnd", version: "1" }, os = { name: "BContext", version: "1" }, ns = "id", is = "parent/", as = ["context", "result"];
301
- function st(o, e, t) {
302
- return Ot(o, e, !0, t, as);
300
+ const oo = { name: "BContextEnd", version: "1" }, so = { name: "BContext", version: "1" }, no = "id", io = "parent/", ao = ["context", "result"];
301
+ function rt(s, e, t) {
302
+ return Ot(s, e, !0, t, ao);
303
303
  }
304
- function cs(o) {
305
- const e = o.createEphemeral(ss);
306
- return o.lock(e), e;
304
+ function co(s) {
305
+ const e = s.createEphemeral(oo);
306
+ return s.lock(e), e;
307
307
  }
308
- function us(o, e) {
309
- if (e.length === 0) return cs(o);
308
+ function uo(s, e) {
309
+ if (e.length === 0) return co(s);
310
310
  if (e.length === 1) return e[0];
311
- const t = o.createEphemeral(os);
312
- o.createField(S(t, ns), "Input", b.createPlString(o, ee()));
311
+ const t = s.createEphemeral(so);
312
+ s.createField(S(t, no), "Input", y.createPlString(s, X()));
313
313
  for (let r = 0; r < e.length; r++)
314
- o.createField(S(t, `${is}${r}`), "Input", e[r]);
315
- return o.lock(t), t;
314
+ s.createField(S(t, `${io}${r}`), "Input", e[r]);
315
+ return s.lock(t), t;
316
316
  }
317
- const ls = { name: "TengoTemplateGet", version: "1" }, ds = "registry", ps = "templateURI", gs = "template", hs = { name: "TengoTemplatePack", version: "1" }, fs = {
317
+ const lo = { name: "TengoTemplateGet", version: "1" }, po = "registry", go = "templateURI", ho = "template", fo = { name: "TengoTemplatePack", version: "1" }, mo = {
318
318
  name: "TengoTemplatePackConvert",
319
319
  version: "1"
320
- }, ms = "templatePack", vs = "template";
321
- async function ys(o) {
322
- switch (o.type) {
320
+ }, vo = "templatePack", yo = "template";
321
+ async function bo(s) {
322
+ switch (s.type) {
323
323
  case "from-file":
324
324
  return {
325
325
  type: "explicit",
326
- content: await A.promises.readFile(o.path)
326
+ content: await A.promises.readFile(s.path)
327
327
  };
328
328
  case "from-registry":
329
329
  case "explicit":
330
- return o;
330
+ return s;
331
331
  default:
332
- return D(o);
332
+ return D(s);
333
333
  }
334
334
  }
335
- function bs(o, e) {
336
- const t = o.createStruct(ls), r = S(t, ds), s = S(t, ps), n = S(t, gs);
337
- return o.setField(r, o.createValue(b.JsonString, Buffer.from(JSON.stringify(e.registry)))), o.setField(s, o.createValue(b.JsonString, Buffer.from(JSON.stringify(e.path)))), n;
335
+ function wo(s, e) {
336
+ const t = s.createStruct(lo), r = S(t, po), o = S(t, go), n = S(t, ho);
337
+ return s.setField(r, s.createValue(y.JsonString, Buffer.from(JSON.stringify(e.registry)))), s.setField(o, s.createValue(y.JsonString, Buffer.from(JSON.stringify(e.path)))), n;
338
338
  }
339
- function ws(o, e) {
340
- const t = o.createValue(hs, e.content), r = o.createStruct(fs), s = S(r, ms), n = S(r, vs);
341
- return o.setField(s, t), n;
339
+ function So(s, e) {
340
+ const t = s.createValue(fo, e.content), r = s.createStruct(mo), o = S(r, vo), n = S(r, yo);
341
+ return s.setField(o, t), n;
342
342
  }
343
- function Ue(o, e) {
343
+ function Me(s, e) {
344
344
  switch (e.type) {
345
345
  case "from-registry":
346
- return bs(o, e);
346
+ return wo(s, e);
347
347
  case "explicit":
348
- return ws(o, e);
348
+ return So(s, e);
349
349
  default:
350
350
  return D(e);
351
351
  }
@@ -354,15 +354,15 @@ const Dt = { name: "Frontend/FromUrl", version: "1" }, xt = {
354
354
  name: "Frontend/FromFolder",
355
355
  version: "1"
356
356
  };
357
- function Ss(o, e) {
357
+ function ko(s, e) {
358
358
  switch (e.type) {
359
359
  case "url":
360
- return o.createValue(
360
+ return s.createValue(
361
361
  Dt,
362
362
  JSON.stringify({ url: e.url })
363
363
  );
364
364
  case "local":
365
- return o.createValue(
365
+ return s.createValue(
366
366
  xt,
367
367
  JSON.stringify({
368
368
  path: e.path,
@@ -373,11 +373,11 @@ function Ss(o, e) {
373
373
  return D(e);
374
374
  }
375
375
  }
376
- const ks = { name: "BlockPackCustom", version: "1" }, jt = "template", Tt = "frontend";
377
- function ot(o) {
378
- return o.endsWith("/") ? o : `${o}/`;
376
+ const Co = { name: "BlockPackCustom", version: "1" }, Tt = "template", jt = "frontend";
377
+ function ot(s) {
378
+ return s.endsWith("/") ? s : `${s}/`;
379
379
  }
380
- class Cs {
380
+ class Po {
381
381
  constructor(e, t, r) {
382
382
  this.v2RegistryProvider = e, this.signer = t, this.http = r;
383
383
  }
@@ -386,11 +386,11 @@ class Cs {
386
386
  case "explicit":
387
387
  return e.config;
388
388
  case "dev-v1": {
389
- const t = await rt(e.folder), r = await A.promises.readFile(t.config, { encoding: "utf-8" });
389
+ const t = await tt(e.folder), r = await A.promises.readFile(t.config, { encoding: "utf-8" });
390
390
  return JSON.parse(r);
391
391
  }
392
392
  case "dev-v2": {
393
- const t = await qe(e.folder), r = await A.promises.readFile(t.components.model.file, {
393
+ const t = await Ye(e.folder), r = await A.promises.readFile(t.components.model.file, {
394
394
  encoding: "utf-8"
395
395
  });
396
396
  return JSON.parse(r);
@@ -400,8 +400,8 @@ class Cs {
400
400
  return await (await M(`${r}/config.json`, t)).body.json();
401
401
  }
402
402
  case "from-registry-v2": {
403
- const t = this.http !== void 0 ? { dispatcher: this.http } : {}, s = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id);
404
- return await (await M(s.model.url, t)).body.json();
403
+ const t = this.http !== void 0 ? { dispatcher: this.http } : {}, o = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id);
404
+ return await (await M(o.model.url, t)).body.json();
405
405
  }
406
406
  default:
407
407
  return D(e);
@@ -412,7 +412,7 @@ class Cs {
412
412
  case "explicit":
413
413
  return e;
414
414
  case "dev-v1": {
415
- const t = await rt(e.folder), r = await A.promises.readFile(t.workflow), s = JSON.parse(
415
+ const t = await tt(e.folder), r = await A.promises.readFile(t.workflow), o = JSON.parse(
416
416
  await A.promises.readFile(t.config, "utf-8")
417
417
  ), n = t.ui;
418
418
  return {
@@ -421,7 +421,7 @@ class Cs {
421
421
  type: "explicit",
422
422
  content: r
423
423
  },
424
- config: s,
424
+ config: o,
425
425
  frontend: {
426
426
  type: "local",
427
427
  path: n,
@@ -431,18 +431,18 @@ class Cs {
431
431
  };
432
432
  }
433
433
  case "dev-v2": {
434
- const t = await qe(e.folder), r = JSON.parse(
434
+ const t = await Ye(e.folder), r = JSON.parse(
435
435
  await A.promises.readFile(t.components.model.file, {
436
436
  encoding: "utf-8"
437
437
  })
438
- ), s = await A.promises.readFile(
438
+ ), o = await A.promises.readFile(
439
439
  t.components.workflow.main.file
440
440
  ), n = t.components.ui.folder, i = { ...e };
441
- return e.mtime === void 0 && (i.mtime = await Je(t)), {
441
+ return e.mtime === void 0 && (i.mtime = await Le(t)), {
442
442
  type: "explicit",
443
443
  template: {
444
444
  type: "explicit",
445
- content: s
445
+ content: o
446
446
  },
447
447
  config: r,
448
448
  frontend: {
@@ -454,10 +454,10 @@ class Cs {
454
454
  };
455
455
  }
456
456
  case "from-registry-v1": {
457
- const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${ot(e.registryUrl)}${_.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`, s = `${r}/template.plj.gz`, n = await M(s, t);
457
+ const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${ot(e.registryUrl)}${_.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`, o = `${r}/template.plj.gz`, n = await M(o, t);
458
458
  if (n.statusCode !== 200)
459
459
  throw new Error(
460
- `Block not found in registry (url = ${s} ; code = ${n.statusCode}): ` + JSON.stringify(e)
460
+ `Block not found in registry (url = ${o} ; code = ${n.statusCode}): ` + JSON.stringify(e)
461
461
  );
462
462
  const i = new Uint8Array(await n.body.arrayBuffer()), c = await (await M(`${r}/config.json`, t)).body.json();
463
463
  return {
@@ -475,7 +475,7 @@ class Cs {
475
475
  };
476
476
  }
477
477
  case "from-registry-v2": {
478
- const t = this.http !== void 0 ? { dispatcher: this.http } : {}, s = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id), n = async () => await (await M(s.model.url, t)).body.json(), i = async () => await (await M(s.workflow.main.url, t)).body.arrayBuffer(), [a, c] = await Promise.all([n(), i()]);
478
+ const t = this.http !== void 0 ? { dispatcher: this.http } : {}, o = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id), n = async () => await (await M(o.model.url, t)).body.json(), i = async () => await (await M(o.workflow.main.url, t)).body.arrayBuffer(), [a, c] = await Promise.all([n(), i()]);
479
479
  return {
480
480
  type: "explicit",
481
481
  template: {
@@ -485,7 +485,7 @@ class Cs {
485
485
  config: a,
486
486
  frontend: {
487
487
  type: "url",
488
- url: s.ui.url
488
+ url: o.ui.url
489
489
  },
490
490
  source: e
491
491
  };
@@ -495,25 +495,25 @@ class Cs {
495
495
  }
496
496
  }
497
497
  }
498
- function Ps(o, e) {
499
- const t = { config: e.config, source: e.source }, r = o.createStruct(ks, JSON.stringify(t));
500
- return o.createField(S(r, jt), "Input", Ue(o, e.template)), o.createField(S(r, Tt), "Input", Ss(o, e.frontend)), o.lock(r), r;
498
+ function Fo(s, e) {
499
+ const t = { config: e.config, source: e.source }, r = s.createStruct(Co, JSON.stringify(t));
500
+ return s.createField(S(r, Tt), "Input", Me(s, e.template)), s.createField(S(r, jt), "Input", ko(s, e.frontend)), s.lock(r), r;
501
501
  }
502
- function nt(o, e) {
502
+ function st(s, e) {
503
503
  switch (e.type) {
504
504
  case "explicit":
505
- return Ps(o, e);
505
+ return Fo(s, e);
506
506
  default:
507
507
  return D(e.type);
508
508
  }
509
509
  }
510
- function ie(o, e) {
511
- return { __isRef: !0, blockId: o, name: e };
510
+ function ne(s, e) {
511
+ return { __isRef: !0, blockId: s, name: e };
512
512
  }
513
- function Fs(o) {
514
- return typeof o == "object" && o !== null && o.__isRef === !0 && "blockId" in o && "name" in o;
513
+ function Ro(s) {
514
+ return typeof s == "object" && s !== null && s.__isRef === !0 && "blockId" in s && "name" in s;
515
515
  }
516
- function xe(o, e, t) {
516
+ function De(s, e, t) {
517
517
  const r = typeof e;
518
518
  switch (r) {
519
519
  case "function":
@@ -526,26 +526,26 @@ function xe(o, e, t) {
526
526
  return;
527
527
  case "object":
528
528
  if (e === null) return;
529
- if (Fs(e))
530
- t === void 0 || t.has(e.blockId) ? o.upstreams.add(e.blockId) : o.missingReferences = !0;
529
+ if (Ro(e))
530
+ t === void 0 || t.has(e.blockId) ? s.upstreams.add(e.blockId) : s.missingReferences = !0;
531
531
  else if (Array.isArray(e))
532
- for (const s of e) xe(o, s, t);
532
+ for (const o of e) De(s, o, t);
533
533
  else
534
- for (const [, s] of Object.entries(e))
535
- xe(o, s, t);
534
+ for (const [, o] of Object.entries(e))
535
+ De(s, o, t);
536
536
  return;
537
537
  default:
538
538
  D(r);
539
539
  }
540
540
  }
541
- function Rs(o, e) {
541
+ function Bo(s, e) {
542
542
  const t = { upstreams: /* @__PURE__ */ new Set(), missingReferences: !1 };
543
- return xe(t, o, e), t;
543
+ return De(t, s, e), t;
544
544
  }
545
- function N(o) {
545
+ function N(s) {
546
546
  return {
547
547
  *[Symbol.iterator]() {
548
- for (const e of o.groups) for (const t of e.blocks) yield t;
548
+ for (const e of s.groups) for (const t of e.blocks) yield t;
549
549
  }
550
550
  };
551
551
  }
@@ -557,104 +557,104 @@ class Et {
557
557
  }
558
558
  traverseIds(e, ...t) {
559
559
  const r = /* @__PURE__ */ new Set();
560
- return this.traverse(e, t, (s) => r.add(s.id)), r;
560
+ return this.traverse(e, t, (o) => r.add(o.id)), r;
561
561
  }
562
562
  traverseIdsExcludingRoots(e, ...t) {
563
563
  const r = this.traverseIds(e, ...t);
564
- for (const s of t) r.delete(s);
564
+ for (const o of t) r.delete(o);
565
565
  return r;
566
566
  }
567
567
  traverse(e, t, r) {
568
- let s = [...t];
569
- const n = new Set(s);
570
- for (; s.length > 0; ) {
568
+ let o = [...t];
569
+ const n = new Set(o);
570
+ for (; o.length > 0; ) {
571
571
  let i = [];
572
- for (const a of s) {
572
+ for (const a of o) {
573
573
  const c = this.nodes.get(a);
574
574
  r(c), c[e].forEach((u) => {
575
575
  n.has(u) || (n.add(u), i.push(u));
576
576
  });
577
577
  }
578
- s = i;
578
+ o = i;
579
579
  }
580
580
  }
581
581
  }
582
- function je(o) {
582
+ function xe(s) {
583
583
  const e = /* @__PURE__ */ new Map();
584
584
  let t;
585
- for (const { id: r } of N(o)) {
586
- const s = {
585
+ for (const { id: r } of N(s)) {
586
+ const o = {
587
587
  id: r,
588
588
  missingReferences: !1
589
589
  };
590
- e.set(r, s), t === void 0 ? s.upstream = /* @__PURE__ */ new Set() : (s.upstream = /* @__PURE__ */ new Set([t.id]), t.downstream = /* @__PURE__ */ new Set([s.id])), t = s;
590
+ e.set(r, o), t === void 0 ? o.upstream = /* @__PURE__ */ new Set() : (o.upstream = /* @__PURE__ */ new Set([t.id]), t.downstream = /* @__PURE__ */ new Set([o.id])), t = o;
591
591
  }
592
592
  return t !== void 0 && (t.downstream = /* @__PURE__ */ new Set()), new Et(e);
593
593
  }
594
- function ae(o, e) {
594
+ function ie(s, e) {
595
595
  const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
596
- for (const { id: s } of N(o)) {
597
- const n = e(s);
596
+ for (const { id: o } of N(s)) {
597
+ const n = e(o);
598
598
  if (n === void 0) continue;
599
- const i = Rs(n, r), a = {
600
- id: s,
599
+ const i = Bo(n, r), a = {
600
+ id: o,
601
601
  missingReferences: i.missingReferences,
602
602
  upstream: i.upstreams,
603
603
  downstream: /* @__PURE__ */ new Set()
604
604
  // will be populated from downstream blocks
605
605
  };
606
- t.set(s, a), i.upstreams.forEach((c) => t.get(c).downstream.add(s)), r.add(s);
606
+ t.set(o, a), i.upstreams.forEach((c) => t.get(c).downstream.add(o)), r.add(o);
607
607
  }
608
608
  return new Et(t);
609
609
  }
610
- function Bs(o, e) {
611
- if (o.size !== e.size) return !1;
612
- for (const t of o) if (!e.has(t)) return !1;
610
+ function Oo(s, e) {
611
+ if (s.size !== e.size) return !1;
612
+ for (const t of s) if (!e.has(t)) return !1;
613
613
  return !0;
614
614
  }
615
- function Te(o, e) {
616
- if (o.size > e.size) return Te(e, o);
617
- for (const t of o) if (e.has(t)) return !0;
615
+ function Te(s, e) {
616
+ if (s.size > e.size) return Te(e, s);
617
+ for (const t of s) if (e.has(t)) return !0;
618
618
  return !1;
619
619
  }
620
- function it(o, e) {
621
- const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
622
- return o.nodes.forEach((n) => {
620
+ function nt(s, e) {
621
+ const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
622
+ return s.nodes.forEach((n) => {
623
623
  const i = e.nodes.get(n.id);
624
- i === void 0 ? t.add(n.id) : (!Bs(n.upstream, i.upstream) || Te(n.upstream, s)) && s.add(n.id);
624
+ i === void 0 ? t.add(n.id) : (!Oo(n.upstream, i.upstream) || Te(n.upstream, o)) && o.add(n.id);
625
625
  }), e.nodes.forEach((n) => {
626
- o.nodes.has(n.id) ? Te(n.upstream, s) && s.add(n.id) : r.add(n.id);
627
- }), { onlyInA: t, onlyInB: r, different: s };
626
+ s.nodes.has(n.id) ? Te(n.upstream, o) && o.add(n.id) : r.add(n.id);
627
+ }), { onlyInA: t, onlyInB: r, different: o };
628
628
  }
629
- let be;
629
+ let ye;
630
630
  async function At() {
631
- if (be === void 0) {
632
- const o = await ys(yr["pframes.export-pframe"]);
633
- if (o.type !== "explicit") throw new Error("Unexpected prepared template type.");
634
- const e = he("sha256").update(o.content).digest("hex");
635
- be = { spec: o, hash: e };
631
+ if (ye === void 0) {
632
+ const s = await bo(yr["pframes.export-pframe"]);
633
+ if (s.type !== "explicit") throw new Error("Unexpected prepared template type.");
634
+ const e = ge("sha256").update(s.content).digest("hex");
635
+ ye = { spec: s, hash: e };
636
636
  }
637
- return be;
637
+ return ye;
638
638
  }
639
- function Os(o, e, t) {
640
- return Ot(o, e, !0, { pf: t }, ["result"]).result;
639
+ function Do(s, e, t) {
640
+ return Ot(s, e, !0, { pf: t }, ["result"]).result;
641
641
  }
642
- function we(o, e) {
643
- let t = !1, r, s;
642
+ function be(s, e) {
643
+ let t = !1, r, o;
644
644
  return () => {
645
645
  if (!t)
646
- return t = !0, r = o(), s = e(), s;
647
- const n = o();
648
- return r !== n && (r = n, s = e()), e();
646
+ return t = !0, r = s(), o = e(), o;
647
+ const n = s();
648
+ return r !== n && (r = n, o = e()), e();
649
649
  };
650
650
  }
651
- class at {
651
+ class it {
652
652
  constructor(e, t) {
653
- d(this, "currentInputsC", we(
653
+ d(this, "currentInputsC", be(
654
654
  () => this.fields.currentArgs.modCount,
655
655
  () => JSON.parse(Buffer.from(this.fields.currentArgs.value).toString())
656
656
  ));
657
- d(this, "actualProductionInputsC", we(
657
+ d(this, "actualProductionInputsC", be(
658
658
  () => {
659
659
  var e;
660
660
  return (e = this.fields.prodArgs) == null ? void 0 : e.modCount;
@@ -666,7 +666,7 @@ class at {
666
666
  return JSON.parse(Buffer.from(e).toString());
667
667
  }
668
668
  ));
669
- d(this, "productionStaleC", we(
669
+ d(this, "productionStaleC", be(
670
670
  () => {
671
671
  var e;
672
672
  return `${this.fields.currentArgs.modCount}_${(e = this.fields.prodArgs) == null ? void 0 : e.modCount}`;
@@ -707,17 +707,17 @@ class at {
707
707
  }
708
708
  getTemplate(e) {
709
709
  return e.getFutureFieldValue(
710
- b.unwrapHolder(e, this.fields.blockPack.ref),
711
- jt,
710
+ y.unwrapHolder(e, this.fields.blockPack.ref),
711
+ Tt,
712
712
  "Input"
713
713
  );
714
714
  }
715
715
  }
716
- const Ds = (o) => {
717
- throw new Error(`No new block info for ${o}`);
716
+ const xo = (s) => {
717
+ throw new Error(`No new block info for ${s}`);
718
718
  };
719
- class de {
720
- constructor(e, t, r, s, n, i, a, c, u, l, p, g) {
719
+ class le {
720
+ constructor(e, t, r, o, n, i, a, c, u, l, p, g) {
721
721
  d(this, "globalModCount", 0);
722
722
  d(this, "fieldsChanged", !1);
723
723
  //
@@ -736,7 +736,7 @@ class de {
736
736
  d(this, "stagingGraph");
737
737
  d(this, "pendingProductionGraph");
738
738
  d(this, "actualProductionGraph");
739
- this.rid = e, this.tx = t, this.author = r, this.schema = s, this.lastModified = n, this.meta = i, this.struct = a, this.renderingState = c, this.blocksInLimbo = u, this.blockInfos = l, this.blockFrontendStates = p, this.ctxExportTplHolder = g;
739
+ 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 = p, this.ctxExportTplHolder = g;
740
740
  }
741
741
  fixProblems() {
742
742
  this.blockInfos.forEach((e) => {
@@ -750,16 +750,16 @@ class de {
750
750
  return JSON.parse(JSON.stringify(this.struct));
751
751
  }
752
752
  getStagingGraph() {
753
- return this.stagingGraph === void 0 && (this.stagingGraph = je(this.struct)), this.stagingGraph;
753
+ return this.stagingGraph === void 0 && (this.stagingGraph = xe(this.struct)), this.stagingGraph;
754
754
  }
755
755
  getPendingProductionGraph() {
756
- return this.pendingProductionGraph === void 0 && (this.pendingProductionGraph = ae(
756
+ return this.pendingProductionGraph === void 0 && (this.pendingProductionGraph = ie(
757
757
  this.struct,
758
758
  (e) => this.getBlockInfo(e).currentInputs
759
759
  )), this.pendingProductionGraph;
760
760
  }
761
761
  getActualProductionGraph() {
762
- return this.actualProductionGraph === void 0 && (this.actualProductionGraph = ae(
762
+ return this.actualProductionGraph === void 0 && (this.actualProductionGraph = ie(
763
763
  this.struct,
764
764
  (e) => this.getBlockInfo(e).actualProductionInputs
765
765
  )), this.actualProductionGraph;
@@ -775,21 +775,21 @@ class de {
775
775
  throw new Error("block not found");
776
776
  }
777
777
  setBlockFieldObj(e, t, r) {
778
- const s = S(this.rid, P(e, t));
778
+ const o = S(this.rid, P(e, t));
779
779
  if (r.ref === void 0) throw new Error("Can't set value with empty ref");
780
- this.getBlockInfo(e).fields[t] === void 0 ? this.tx.createField(s, "Dynamic", r.ref) : this.tx.setField(s, r.ref), this.getBlockInfo(e).fields[t] = {
780
+ this.getBlockInfo(e).fields[t] === void 0 ? this.tx.createField(o, "Dynamic", r.ref) : this.tx.setField(o, r.ref), this.getBlockInfo(e).fields[t] = {
781
781
  modCount: this.globalModCount++,
782
782
  ...r
783
783
  }, this.fieldsChanged = !0;
784
784
  }
785
- setBlockField(e, t, r, s, n) {
786
- this.setBlockFieldObj(e, t, { ref: r, status: s, value: n });
785
+ setBlockField(e, t, r, o, n) {
786
+ this.setBlockFieldObj(e, t, { ref: r, status: o, value: n });
787
787
  }
788
788
  deleteBlockFields(e, ...t) {
789
789
  let r = !1;
790
- const s = this.getBlockInfo(e);
790
+ const o = this.getBlockInfo(e);
791
791
  for (const n of t) {
792
- const i = s.fields;
792
+ const i = o.fields;
793
793
  n in i && (this.tx.removeField(S(this.rid, P(e, n))), delete i[n], this.fieldsChanged = !0, r = !0);
794
794
  }
795
795
  return r;
@@ -804,31 +804,31 @@ class de {
804
804
  this.renderingState.stagingRefreshTimestamp = Date.now(), this.renderingStateChanged = !0;
805
805
  }
806
806
  resetStaging(e) {
807
- var r, s, n;
807
+ var r, o, n;
808
808
  const t = this.getBlockInfo(e).fields;
809
- ((r = t.stagingOutput) == null ? void 0 : r.status) === "Ready" && ((s = t.stagingCtx) == null ? void 0 : s.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();
809
+ ((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();
810
810
  }
811
811
  resetProduction(e) {
812
- var r, s, n;
812
+ var r, o, n;
813
813
  const t = this.getBlockInfo(e).fields;
814
- ((r = t.prodOutput) == null ? void 0 : r.status) === "Ready" && ((s = t.prodCtx) == null ? void 0 : s.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");
814
+ ((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");
815
815
  }
816
816
  /** Running blocks are reset, already computed moved to limbo. Returns if
817
817
  * either of the actions were actually performed. */
818
818
  resetOrLimboProduction(e) {
819
- var r, s;
819
+ var r, o;
820
820
  const t = this.getBlockInfo(e).fields;
821
- return ((r = t.prodOutput) == null ? void 0 : r.status) === "Ready" && ((s = t.prodCtx) == null ? void 0 : s.status) === "Ready" ? this.blocksInLimbo.has(e) ? !1 : (this.blocksInLimbo.add(e), this.renderingStateChanged = !0, this.deleteBlockFields(e, "prodOutputPrevious", "prodCtxPrevious", "prodUiCtxPrevious"), !0) : this.deleteBlockFields(e, "prodOutput", "prodCtx", "prodUiCtx", "prodArgs");
821
+ return ((r = t.prodOutput) == null ? void 0 : r.status) === "Ready" && ((o = t.prodCtx) == null ? void 0 : o.status) === "Ready" ? this.blocksInLimbo.has(e) ? !1 : (this.blocksInLimbo.add(e), this.renderingStateChanged = !0, this.deleteBlockFields(e, "prodOutputPrevious", "prodCtxPrevious", "prodUiCtxPrevious"), !0) : this.deleteBlockFields(e, "prodOutput", "prodCtx", "prodUiCtx", "prodArgs");
822
822
  }
823
823
  /** Optimally sets inputs for multiple blocks in one go */
824
824
  setArgs(e) {
825
825
  const t = [];
826
- for (const { blockId: r, args: s } of e) {
826
+ for (const { blockId: r, args: o } of e) {
827
827
  const n = this.getBlockInfo(r);
828
- JSON.parse(s);
829
- const i = Buffer.from(s);
828
+ JSON.parse(o);
829
+ const i = Buffer.from(o);
830
830
  if (Buffer.compare(n.fields.currentArgs.value, i) === 0) continue;
831
- const a = this.tx.createValue(b.JsonObject, i);
831
+ const a = this.tx.createValue(y.JsonObject, i);
832
832
  this.setBlockField(r, "currentArgs", a, "Ready", i), this.blocksWithChangedInputs.add(r), t.push(r);
833
833
  }
834
834
  this.getStagingGraph().traverse("downstream", t, ({ id: r }) => this.resetStaging(r)), t.length > 0 && this.updateLastModified();
@@ -840,41 +840,41 @@ class de {
840
840
  /** Update block label */
841
841
  setBlockLabel(e, t) {
842
842
  const r = this.structure;
843
- let s = !1;
843
+ let o = !1;
844
844
  for (const n of N(r))
845
845
  if (n.id === e) {
846
- n.label = t, s = !0;
846
+ n.label = t, o = !0;
847
847
  break;
848
848
  }
849
- if (!s) throw new Error(`block ${e} not found`);
849
+ if (!o) throw new Error(`block ${e} not found`);
850
850
  this.updateStructure(r), this.updateLastModified();
851
851
  }
852
852
  createCtx(e, t) {
853
853
  const r = [];
854
- return e.forEach((s) => {
855
- const n = this.getBlockInfo(s);
854
+ return e.forEach((o) => {
855
+ const n = this.getBlockInfo(o);
856
856
  if (n.fields[t] === void 0 || n.fields[t].ref === void 0)
857
857
  throw new Error("One of the upstreams staging is not rendered.");
858
- r.push(b.unwrapHolder(this.tx, n.fields[t].ref));
859
- }), us(this.tx, r);
858
+ r.push(y.unwrapHolder(this.tx, n.fields[t].ref));
859
+ }), uo(this.tx, r);
860
860
  }
861
861
  exportCtx(e) {
862
- return Os(this.tx, b.unwrapHolder(this.tx, this.ctxExportTplHolder), e);
862
+ return Do(this.tx, y.unwrapHolder(this.tx, this.ctxExportTplHolder), e);
863
863
  }
864
864
  renderStagingFor(e) {
865
865
  this.resetStaging(e);
866
866
  const t = this.getBlockInfo(e), r = this.createCtx(this.getStagingGraph().nodes.get(e).upstream, "stagingCtx");
867
867
  if (this.getBlock(e).renderingMode !== "Heavy") throw new Error("not supported yet");
868
- const s = t.getTemplate(this.tx), n = st(this.tx, s, {
868
+ const o = t.getTemplate(this.tx), n = rt(this.tx, o, {
869
869
  args: t.fields.currentArgs.ref,
870
- blockId: this.tx.createValue(b.JsonString, JSON.stringify(e)),
871
- isProduction: this.tx.createValue(b.JsonBool, JSON.stringify(!1)),
870
+ blockId: this.tx.createValue(y.JsonString, JSON.stringify(e)),
871
+ isProduction: this.tx.createValue(y.JsonBool, JSON.stringify(!1)),
872
872
  context: r
873
873
  });
874
874
  this.setBlockField(
875
875
  e,
876
876
  "stagingCtx",
877
- b.wrapInEphHolder(this.tx, n.context),
877
+ y.wrapInEphHolder(this.tx, n.context),
878
878
  "NotReady"
879
879
  ), this.setBlockField(e, "stagingUiCtx", this.exportCtx(n.context), "NotReady"), this.setBlockField(e, "stagingOutput", n.result, "NotReady");
880
880
  }
@@ -886,16 +886,16 @@ class de {
886
886
  );
887
887
  if (this.getBlock(e).renderingMode === "Light")
888
888
  throw new Error("Can't render production for light block.");
889
- const s = t.getTemplate(this.tx), n = st(this.tx, s, {
889
+ const o = t.getTemplate(this.tx), n = rt(this.tx, o, {
890
890
  args: t.fields.currentArgs.ref,
891
- blockId: this.tx.createValue(b.JsonString, JSON.stringify(e)),
892
- isProduction: this.tx.createValue(b.JsonBool, JSON.stringify(!0)),
891
+ blockId: this.tx.createValue(y.JsonString, JSON.stringify(e)),
892
+ isProduction: this.tx.createValue(y.JsonBool, JSON.stringify(!0)),
893
893
  context: r
894
894
  });
895
895
  this.setBlockField(
896
896
  e,
897
897
  "prodCtx",
898
- b.wrapInEphHolder(this.tx, n.context),
898
+ y.wrapInEphHolder(this.tx, n.context),
899
899
  "NotReady"
900
900
  ), 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);
901
901
  }
@@ -903,28 +903,28 @@ class de {
903
903
  // Structure changes
904
904
  //
905
905
  /** Very generic method, better check for more specialized case-specific methods first. */
906
- updateStructure(e, t = Ds) {
907
- const r = this.getStagingGraph(), s = this.getActualProductionGraph(), n = je(e), i = ae(
906
+ updateStructure(e, t = xo) {
907
+ const r = this.getStagingGraph(), o = this.getActualProductionGraph(), n = xe(e), i = ie(
908
908
  e,
909
909
  (u) => {
910
910
  var l;
911
911
  return (l = this.blockInfos.get(u)) == null ? void 0 : l.actualProductionInputs;
912
912
  }
913
- ), a = it(r, n), c = it(s, i);
913
+ ), a = nt(r, n), c = nt(o, i);
914
914
  for (const u of a.onlyInA) {
915
915
  const { fields: l } = this.getBlockInfo(u);
916
916
  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);
917
917
  }
918
918
  for (const u of a.onlyInB) {
919
- const l = new at(u, {});
919
+ const l = new it(u, {});
920
920
  this.blockInfos.set(u, l);
921
- const p = t(u), g = nt(this.tx, p.blockPack);
922
- this.setBlockField(u, "blockPack", b.wrapInHolder(this.tx, g), "NotReady");
923
- const m = Buffer.from(p.args), h = this.tx.createValue(b.JsonObject, m);
924
- this.setBlockField(u, "currentArgs", h, "Ready", m), l.check();
921
+ const p = t(u), g = st(this.tx, p.blockPack);
922
+ this.setBlockField(u, "blockPack", y.wrapInHolder(this.tx, g), "NotReady");
923
+ const f = Buffer.from(p.args), b = this.tx.createValue(y.JsonObject, f);
924
+ this.setBlockField(u, "currentArgs", b, "Ready", f), l.check();
925
925
  }
926
926
  for (const u of a.different) this.resetStaging(u);
927
- s.traverse("downstream", [...c.different], (u) => {
927
+ o.traverse("downstream", [...c.different], (u) => {
928
928
  this.resetOrLimboProduction(u.id);
929
929
  }), (a.onlyInB.size > 0 || a.onlyInA.size > 0 || a.different.size > 0) && this.resetStagingRefreshTimestamp(), this.struct = e, this.structureChanged = !0, this.stagingGraph = void 0, this.pendingProductionGraph = void 0, this.actualProductionGraph = void 0, this.updateLastModified();
930
930
  }
@@ -932,12 +932,12 @@ class de {
932
932
  // Structure change helpers
933
933
  //
934
934
  addBlock(e, t, r) {
935
- const s = this.structure;
935
+ const o = this.structure;
936
936
  if (r === void 0)
937
- s.groups[s.groups.length - 1].blocks.push(e);
937
+ o.groups[o.groups.length - 1].blocks.push(e);
938
938
  else {
939
939
  let n = !1;
940
- for (const i of s.groups) {
940
+ for (const i of o.groups) {
941
941
  const a = i.blocks.findIndex((c) => c.id === r);
942
942
  if (!(a < 0)) {
943
943
  i.blocks.splice(a, 0, e), n = !0;
@@ -946,7 +946,7 @@ class de {
946
946
  }
947
947
  if (!n) throw new Error(`Can't find element with id: ${r}`);
948
948
  }
949
- this.updateStructure(s, (n) => {
949
+ this.updateStructure(o, (n) => {
950
950
  if (n !== e.id) throw new Error("Unexpected");
951
951
  return t;
952
952
  });
@@ -954,10 +954,10 @@ class de {
954
954
  deleteBlock(e) {
955
955
  const t = this.structure;
956
956
  let r = !1;
957
- for (const s of t.groups) {
958
- const n = s.blocks.findIndex((i) => i.id === e);
957
+ for (const o of t.groups) {
958
+ const n = o.blocks.findIndex((i) => i.id === e);
959
959
  if (!(n < 0)) {
960
- s.blocks.splice(n, 1), r = !0;
960
+ o.blocks.splice(n, 1), r = !0;
961
961
  break;
962
962
  }
963
963
  }
@@ -968,13 +968,13 @@ class de {
968
968
  // Block-pack migration
969
969
  //
970
970
  migrateBlockPack(e, t, r) {
971
- const s = this.getBlockInfo(e);
971
+ const o = this.getBlockInfo(e);
972
972
  this.setBlockField(
973
973
  e,
974
974
  "blockPack",
975
- b.wrapInHolder(this.tx, nt(this.tx, t)),
975
+ y.wrapInHolder(this.tx, st(this.tx, t)),
976
976
  "NotReady"
977
- ), r !== void 0 ? (this.setArgs([{ blockId: e, args: r }]), this.setUiState(e, void 0)) : this.getStagingGraph().traverse("downstream", [e], ({ id: n }) => this.resetStaging(n)), s.productionRendered && this.getActualProductionGraph().traverse(
977
+ ), 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(
978
978
  "downstream",
979
979
  [e],
980
980
  ({ id: n }) => this.resetOrLimboProduction(n)
@@ -984,14 +984,14 @@ class de {
984
984
  // Render
985
985
  //
986
986
  renderProduction(e, t = !1) {
987
- const r = new Set(e), s = this.getPendingProductionGraph();
987
+ const r = new Set(e), o = this.getPendingProductionGraph();
988
988
  if (t)
989
- s.traverse("upstream", e, (i) => {
989
+ o.traverse("upstream", e, (i) => {
990
990
  r.add(i.id);
991
991
  });
992
992
  else
993
993
  for (const i of r) {
994
- const a = s.nodes.get(i);
994
+ const a = o.nodes.get(i);
995
995
  if (a === void 0) throw new Error(`Can't find block with id: ${i}`);
996
996
  for (const c of a.upstream)
997
997
  if (!r.has(c))
@@ -1002,7 +1002,7 @@ class de {
1002
1002
  if (!r.has(i.id)) continue;
1003
1003
  let a = this.getBlockInfo(i.id).requireProductionRendering || this.blocksInLimbo.has(i.id);
1004
1004
  if (!a) {
1005
- for (const c of s.nodes.get(i.id).upstream)
1005
+ for (const c of o.nodes.get(i.id).upstream)
1006
1006
  if (n.has(c)) {
1007
1007
  a = !0;
1008
1008
  break;
@@ -1010,7 +1010,7 @@ class de {
1010
1010
  }
1011
1011
  a && (this.renderProductionFor(i.id), n.add(i.id));
1012
1012
  }
1013
- return s.traverse("downstream", [...n], (i) => {
1013
+ return o.traverse("downstream", [...n], (i) => {
1014
1014
  n.has(i.id) || this.resetOrLimboProduction(i.id);
1015
1015
  }), n.size > 0 && this.updateLastModified(), n;
1016
1016
  }
@@ -1018,13 +1018,13 @@ class de {
1018
1018
  * accordingly */
1019
1019
  stopProduction(...e) {
1020
1020
  var i, a;
1021
- const t = this.getActualProductionGraph(), r = new St(e), s = new Set(e), n = [];
1021
+ const t = this.getActualProductionGraph(), r = new St(e), o = new Set(e), n = [];
1022
1022
  for (; !r.isEmpty(); ) {
1023
1023
  const c = r.shift(), u = this.getBlockInfo(c).fields;
1024
1024
  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")) {
1025
1025
  n.push(c);
1026
1026
  for (const l of t.traverseIdsExcludingRoots("downstream", c))
1027
- s.has(l) || (r.push(l), s.add(l));
1027
+ o.has(l) || (r.push(l), o.add(l));
1028
1028
  }
1029
1029
  }
1030
1030
  for (const c of t.traverseIdsExcludingRoots("downstream", ...n))
@@ -1032,21 +1032,21 @@ class de {
1032
1032
  }
1033
1033
  traverseWithStagingLag(e) {
1034
1034
  const t = /* @__PURE__ */ new Map();
1035
- this.getStagingGraph().nodes.forEach((s) => {
1036
- let i = this.getBlockInfo(s.id).stagingRendered ? 0 : 1;
1037
- s.upstream.forEach((a) => {
1035
+ this.getStagingGraph().nodes.forEach((o) => {
1036
+ let i = this.getBlockInfo(o.id).stagingRendered ? 0 : 1;
1037
+ o.upstream.forEach((a) => {
1038
1038
  const c = t.get(a);
1039
1039
  c !== 0 && (i = Math.max(c + 1, i));
1040
- }), e(s.id, i), t.set(s.id, i);
1040
+ }), e(o.id, i), t.set(o.id, i);
1041
1041
  });
1042
1042
  }
1043
1043
  /** @param stagingRenderingRate rate in blocks per second */
1044
1044
  refreshStagings(e) {
1045
1045
  const t = Date.now() - this.renderingState.stagingRefreshTimestamp, r = e === void 0 ? void 0 : 1 + Math.max(0, t * e / 1e3);
1046
- let s = 0;
1046
+ let o = 0;
1047
1047
  this.traverseWithStagingLag((n, i) => {
1048
- i !== 0 && (r === void 0 || i <= r) && (this.renderStagingFor(n), s++);
1049
- }), s > 0 && this.resetStagingRefreshTimestamp();
1048
+ i !== 0 && (r === void 0 || i <= r) && (this.renderStagingFor(n), o++);
1049
+ }), o > 0 && this.resetStagingRefreshTimestamp();
1050
1050
  }
1051
1051
  //
1052
1052
  // Meta
@@ -1061,8 +1061,8 @@ class de {
1061
1061
  /** @param stagingRenderingRate rate in blocks per second */
1062
1062
  doRefresh(e) {
1063
1063
  this.refreshStagings(e), this.blockInfos.forEach((t) => {
1064
- var r, s, n, i;
1065
- ((r = t.fields.prodCtx) == null ? void 0 : r.status) === "Ready" && ((s = t.fields.prodOutput) == null ? void 0 : s.status) === "Ready" && this.deleteBlockFields(
1064
+ var r, o, n, i;
1065
+ ((r = t.fields.prodCtx) == null ? void 0 : r.status) === "Ready" && ((o = t.fields.prodOutput) == null ? void 0 : o.status) === "Ready" && this.deleteBlockFields(
1066
1066
  t.id,
1067
1067
  "prodOutputPrevious",
1068
1068
  "prodCtxPrevious",
@@ -1078,37 +1078,37 @@ class de {
1078
1078
  assignAuthorMarkers() {
1079
1079
  const e = this.author ? JSON.stringify(this.author) : void 0;
1080
1080
  for (const t of this.blocksWithChangedInputs)
1081
- e === void 0 ? this.tx.deleteKValue(this.rid, Be(t)) : this.tx.setKValue(this.rid, Be(t), e);
1082
- (this.metaChanged || this.structureChanged) && (e === void 0 ? this.tx.deleteKValue(this.rid, Oe) : this.tx.setKValue(this.rid, Oe, e));
1081
+ e === void 0 ? this.tx.deleteKValue(this.rid, Re(t)) : this.tx.setKValue(this.rid, Re(t), e);
1082
+ (this.metaChanged || this.structureChanged) && (e === void 0 ? this.tx.deleteKValue(this.rid, Be) : this.tx.setKValue(this.rid, Be, e));
1083
1083
  }
1084
1084
  save() {
1085
1085
  if (this.wasModified) {
1086
- this.lastModifiedChanged && this.tx.setKValue(this.rid, te, JSON.stringify(this.lastModified)), this.structureChanged && this.tx.setKValue(this.rid, W, JSON.stringify(this.struct)), this.renderingStateChanged && this.tx.setKValue(
1086
+ this.lastModifiedChanged && this.tx.setKValue(this.rid, ee, JSON.stringify(this.lastModified)), this.structureChanged && this.tx.setKValue(this.rid, W, JSON.stringify(this.struct)), this.renderingStateChanged && this.tx.setKValue(
1087
1087
  this.rid,
1088
- le,
1088
+ ue,
1089
1089
  JSON.stringify({
1090
1090
  ...this.renderingState,
1091
1091
  blocksInLimbo: [...this.blocksInLimbo]
1092
1092
  })
1093
- ), this.metaChanged && this.tx.setKValue(this.rid, re, JSON.stringify(this.meta));
1093
+ ), this.metaChanged && this.tx.setKValue(this.rid, te, JSON.stringify(this.meta));
1094
1094
  for (const e of this.changedBlockFrontendStates) {
1095
1095
  const t = this.blockFrontendStates.get(e);
1096
- t === void 0 ? this.tx.deleteKValue(this.rid, Re(e)) : this.tx.setKValue(this.rid, Re(e), t);
1096
+ t === void 0 ? this.tx.deleteKValue(this.rid, Fe(e)) : this.tx.setKValue(this.rid, Fe(e), t);
1097
1097
  }
1098
1098
  this.assignAuthorMarkers();
1099
1099
  }
1100
1100
  }
1101
1101
  static async load(e, t, r) {
1102
- const s = e.getResourceData(t, !0), n = e.getKValueJson(t, Ft), i = e.getKValueJson(t, te), a = e.getKValueJson(t, re), c = e.getKValueJson(t, W), u = e.getKValueJson(t, le), l = e.listKeyValuesString(t), [
1102
+ const o = e.getResourceData(t, !0), n = e.getKValueJson(t, Ft), i = e.getKValueJson(t, ee), a = e.getKValueJson(t, te), c = e.getKValueJson(t, W), u = e.getKValueJson(t, ue), l = e.listKeyValuesString(t), [
1103
1103
  p,
1104
1104
  g,
1105
- m,
1106
- h,
1105
+ f,
1106
+ b,
1107
1107
  C,
1108
1108
  { stagingRefreshTimestamp: I, blocksInLimbo: G },
1109
- U
1109
+ K
1110
1110
  ] = await Promise.all([
1111
- s,
1111
+ o,
1112
1112
  n,
1113
1113
  i,
1114
1114
  a,
@@ -1121,31 +1121,31 @@ class de {
1121
1121
  `Can't act on this project resource because it has a wrong schema version: ${g}`
1122
1122
  );
1123
1123
  const H = /* @__PURE__ */ new Map();
1124
- for (const y of p.fields) {
1125
- const O = Qr(y.name);
1124
+ for (const v of p.fields) {
1125
+ const O = Qr(v.name);
1126
1126
  if (O === void 0) continue;
1127
1127
  let R = H.get(O.blockId);
1128
1128
  R === void 0 && (R = {
1129
1129
  id: O.blockId,
1130
1130
  fields: {}
1131
- }, H.set(O.blockId, R)), R.fields[O.fieldName] = ue(y.value) ? { modCount: 0 } : { modCount: 0, ref: y.value };
1131
+ }, H.set(O.blockId, R)), R.fields[O.fieldName] = ce(v.value) ? { modCount: 0 } : { modCount: 0, ref: v.value };
1132
1132
  }
1133
- const z = await At(), oe = De(z.hash), k = p.fields.find(
1134
- (y) => y.name === oe
1133
+ const z = await At(), oe = Oe(z.hash), k = p.fields.find(
1134
+ (v) => v.name === oe
1135
1135
  );
1136
1136
  let J;
1137
- k !== void 0 ? J = Pe(k.value) : (J = b.wrapInHolder(e, Ue(e, z.spec)), e.createField(
1138
- S(t, De(z.hash)),
1137
+ k !== void 0 ? J = Ce(k.value) : (J = y.wrapInHolder(e, Me(e, z.spec)), e.createField(
1138
+ S(t, Oe(z.hash)),
1139
1139
  "Dynamic",
1140
1140
  J
1141
1141
  ));
1142
1142
  const Y = { stagingRefreshTimestamp: I }, E = new Set(G), x = /* @__PURE__ */ new Map();
1143
- for (const y of U) {
1144
- const O = zr(y.key);
1145
- O !== void 0 && x.set(O, y.value);
1143
+ for (const v of K) {
1144
+ const O = zr(v.key);
1145
+ O !== void 0 && x.set(O, v.value);
1146
1146
  }
1147
1147
  const B = [];
1148
- H.forEach(({ id: y, fields: O }) => {
1148
+ H.forEach(({ id: v, fields: O }) => {
1149
1149
  for (const [, R] of Object.entries(O))
1150
1150
  if (R.ref !== void 0) {
1151
1151
  if (!cr(R.ref) || ur(R.ref))
@@ -1153,139 +1153,139 @@ class de {
1153
1153
  B.push([R, e.getResourceData(R.ref, !1)]);
1154
1154
  }
1155
1155
  });
1156
- for (const [y, O] of B) {
1156
+ for (const [v, O] of B) {
1157
1157
  const R = await O;
1158
- y.value = R.data, Qe(R.error) ? y.status = "Error" : R.resourceReady || Qe(R.originalResourceId) ? y.status = "Ready" : y.status = "NotReady";
1158
+ v.value = R.data, qe(R.error) ? v.status = "Error" : R.resourceReady || qe(R.originalResourceId) ? v.status = "Ready" : v.status = "NotReady";
1159
1159
  }
1160
- const K = /* @__PURE__ */ new Map();
1161
- H.forEach(({ id: y, fields: O }) => K.set(y, new at(y, O)));
1160
+ const U = /* @__PURE__ */ new Map();
1161
+ H.forEach(({ id: v, fields: O }) => U.set(v, new it(v, O)));
1162
1162
  const L = /* @__PURE__ */ new Set();
1163
- for (const y of N(C)) {
1164
- if (!K.has(y.id))
1165
- throw new Error(`Inconsistent project structure: no inputs for ${y.id}`);
1166
- L.add(y.id);
1163
+ for (const v of N(C)) {
1164
+ if (!U.has(v.id))
1165
+ throw new Error(`Inconsistent project structure: no inputs for ${v.id}`);
1166
+ L.add(v.id);
1167
1167
  }
1168
- K.forEach((y) => {
1169
- if (!L.has(y.id))
1170
- throw new Error(`Inconsistent project structure: no structure entry for ${y.id}`);
1171
- y.check();
1168
+ U.forEach((v) => {
1169
+ if (!L.has(v.id))
1170
+ throw new Error(`Inconsistent project structure: no structure entry for ${v.id}`);
1171
+ v.check();
1172
1172
  });
1173
- const ne = new de(
1173
+ const se = new le(
1174
1174
  t,
1175
1175
  e,
1176
1176
  r,
1177
1177
  g,
1178
- m,
1179
- h,
1178
+ f,
1179
+ b,
1180
1180
  C,
1181
1181
  Y,
1182
1182
  E,
1183
- K,
1183
+ U,
1184
1184
  x,
1185
1185
  J
1186
1186
  );
1187
- return ne.fixProblems(), ne;
1187
+ return se.fixProblems(), se;
1188
1188
  }
1189
1189
  }
1190
- async function xs(o, e = $r) {
1191
- const t = o.createEphemeral(Gr);
1192
- o.lock(t);
1190
+ async function To(s, e = $r) {
1191
+ const t = s.createEphemeral(Gr);
1192
+ s.lock(t);
1193
1193
  const r = String(Date.now());
1194
- o.setKValue(t, Ft, JSON.stringify(Rt)), o.setKValue(t, Me, r), o.setKValue(t, te, r), o.setKValue(t, re, JSON.stringify(e)), o.setKValue(t, W, JSON.stringify(Ur)), o.setKValue(t, le, JSON.stringify(Kr));
1195
- const s = await At();
1196
- return o.createField(
1197
- S(t, De(s.hash)),
1194
+ s.setKValue(t, Ft, JSON.stringify(Rt)), s.setKValue(t, Je, r), s.setKValue(t, ee, r), s.setKValue(t, te, JSON.stringify(e)), s.setKValue(t, W, JSON.stringify(Kr)), s.setKValue(t, ue, JSON.stringify(Ur));
1195
+ const o = await At();
1196
+ return s.createField(
1197
+ S(t, Oe(o.hash)),
1198
1198
  "Dynamic",
1199
- b.wrapInHolder(o, Ue(o, s.spec))
1199
+ y.wrapInHolder(s, Me(s, o.spec))
1200
1200
  ), t;
1201
1201
  }
1202
- async function Se(o, e, t) {
1203
- return V(o, e, void 0, t);
1202
+ async function we(s, e, t) {
1203
+ return V(s, e, void 0, t);
1204
1204
  }
1205
- async function V(o, e, t, r) {
1206
- if (o instanceof ar)
1207
- return await o.withWriteTx("ProjectAction", async (s) => {
1208
- const n = await de.load(s, e, t), i = await r(n);
1209
- return n.wasModified && (n.save(), await s.commit()), i;
1205
+ async function V(s, e, t, r) {
1206
+ if (s instanceof ar)
1207
+ return await s.withWriteTx("ProjectAction", async (o) => {
1208
+ const n = await le.load(o, e, t), i = await r(n);
1209
+ return n.wasModified && (n.save(), await o.commit()), i;
1210
1210
  });
1211
1211
  {
1212
- const s = await de.load(o, e, t), n = await r(s);
1213
- return s.save(), n;
1212
+ const o = await le.load(s, e, t), n = await r(o);
1213
+ return o.save(), n;
1214
1214
  }
1215
1215
  }
1216
- function* js(o) {
1217
- switch (o.type) {
1216
+ function* jo(s) {
1217
+ switch (s.type) {
1218
1218
  case "Json":
1219
1219
  return;
1220
1220
  case "JsonPartitioned":
1221
- for (const [, e] of Object.entries(o.parts)) yield e;
1221
+ for (const [, e] of Object.entries(s.parts)) yield e;
1222
1222
  return;
1223
1223
  case "BinaryPartitioned":
1224
- for (const [, { index: e, values: t }] of Object.entries(o.parts))
1224
+ for (const [, { index: e, values: t }] of Object.entries(s.parts))
1225
1225
  yield e, yield t;
1226
1226
  return;
1227
1227
  default:
1228
- D(o);
1228
+ D(s);
1229
1229
  }
1230
1230
  }
1231
- function ct(o, e) {
1231
+ function at(s, e) {
1232
1232
  return Object.fromEntries(
1233
- Object.entries(o).map(([t, r]) => [t, e(r, t)])
1233
+ Object.entries(s).map(([t, r]) => [t, e(r, t)])
1234
1234
  );
1235
1235
  }
1236
- function Ts(o, e) {
1237
- switch (o.type) {
1236
+ function Eo(s, e) {
1237
+ switch (s.type) {
1238
1238
  case "Json":
1239
- return { ...o };
1239
+ return { ...s };
1240
1240
  case "JsonPartitioned":
1241
- return { ...o, parts: ct(o.parts, e) };
1241
+ return { ...s, parts: at(s.parts, e) };
1242
1242
  case "BinaryPartitioned":
1243
1243
  return {
1244
- ...o,
1245
- parts: ct(o.parts, (t) => ({
1244
+ ...s,
1245
+ parts: at(s.parts, (t) => ({
1246
1246
  index: e(t.index),
1247
1247
  values: e(t.values)
1248
1248
  }))
1249
1249
  };
1250
1250
  default:
1251
- D(o);
1251
+ D(s);
1252
1252
  }
1253
1253
  }
1254
- const Es = se("PColumnData/JsonPartitioned", "1"), As = se(
1254
+ const Ao = re("PColumnData/JsonPartitioned", "1"), Io = re(
1255
1255
  "PColumnData/Partitioned/JsonPartitioned",
1256
1256
  "1"
1257
- ), Is = se("PColumnData/BinaryPartitioned", "1"), Vs = se(
1257
+ ), Vo = re("PColumnData/BinaryPartitioned", "1"), No = re(
1258
1258
  "PColumnData/Partitioned/BinaryPartitioned",
1259
1259
  "1"
1260
- ), Ns = se("PColumnData/Json", "1");
1261
- function Ls(o) {
1262
- if (!o.getIsReadyOrError()) throw new Error("Data not ready.");
1263
- const e = o.getDataAsJson();
1260
+ ), Lo = re("PColumnData/Json", "1");
1261
+ function Jo(s) {
1262
+ if (!s.getIsReadyOrError()) throw new Error("Data not ready.");
1263
+ const e = s.getDataAsJson();
1264
1264
  if (e === void 0)
1265
1265
  throw new Error("unexpected data info structure, no resource data");
1266
- if ($(o.resourceType, Ns)) {
1266
+ if ($(s.resourceType, Lo)) {
1267
1267
  const t = e;
1268
1268
  return {
1269
1269
  type: "Json",
1270
1270
  keyLength: t.keyLength,
1271
1271
  data: t.data
1272
1272
  };
1273
- } else if ($(o.resourceType, Es)) {
1273
+ } else if ($(s.resourceType, Ao)) {
1274
1274
  const t = e, r = Object.fromEntries(
1275
- o.listInputFields().map((s) => [s, o.traverse({ field: s, errorIfFieldNotSet: !0 }).resourceInfo])
1275
+ s.listInputFields().map((o) => [o, s.traverse({ field: o, errorIfFieldNotSet: !0 }).resourceInfo])
1276
1276
  );
1277
1277
  return {
1278
1278
  type: "JsonPartitioned",
1279
1279
  partitionKeyLength: t.partitionKeyLength,
1280
1280
  parts: r
1281
1281
  };
1282
- } else if ($(o.resourceType, As)) {
1282
+ } else if ($(s.resourceType, Io)) {
1283
1283
  const t = e, r = {};
1284
- for (const s of o.listInputFields()) {
1285
- const n = o.traverse({ field: s, errorIfFieldNotSet: !0 }), i = n.listInputFields();
1286
- if (i === void 0) throw new Error(`no partition keys for super key ${s}`);
1284
+ for (const o of s.listInputFields()) {
1285
+ const n = s.traverse({ field: o, errorIfFieldNotSet: !0 }), i = n.listInputFields();
1286
+ if (i === void 0) throw new Error(`no partition keys for super key ${o}`);
1287
1287
  for (const a of i) {
1288
- const c = JSON.stringify([...JSON.parse(s), ...JSON.parse(a)]);
1288
+ const c = JSON.stringify([...JSON.parse(o), ...JSON.parse(a)]);
1289
1289
  r[c] = n.traverse({ field: a, errorIfFieldNotSet: !0 }).resourceInfo;
1290
1290
  }
1291
1291
  }
@@ -1294,42 +1294,42 @@ function Ls(o) {
1294
1294
  partitionKeyLength: t.superPartitionKeyLength + t.partitionKeyLength,
1295
1295
  parts: r
1296
1296
  };
1297
- } else if ($(o.resourceType, Is)) {
1297
+ } else if ($(s.resourceType, Vo)) {
1298
1298
  const t = e, r = {};
1299
- for (const s of o.listInputFields())
1300
- if (s.endsWith(".index")) {
1301
- const n = s.slice(0, s.length - 6);
1299
+ for (const o of s.listInputFields())
1300
+ if (o.endsWith(".index")) {
1301
+ const n = o.slice(0, o.length - 6);
1302
1302
  let i = r[n];
1303
- i === void 0 && (i = {}, r[n] = i), i.index = o.traverse({ field: s, errorIfFieldNotSet: !0 }).resourceInfo;
1304
- } else if (s.endsWith(".values")) {
1305
- const n = s.slice(0, s.length - 7);
1303
+ i === void 0 && (i = {}, r[n] = i), i.index = s.traverse({ field: o, errorIfFieldNotSet: !0 }).resourceInfo;
1304
+ } else if (o.endsWith(".values")) {
1305
+ const n = o.slice(0, o.length - 7);
1306
1306
  let i = r[n];
1307
- i === void 0 && (i = {}, r[n] = i), i.values = o.traverse({ field: s, errorIfFieldNotSet: !0 }).resourceInfo;
1308
- } else throw new Error(`unrecognized part field name: ${s}`);
1309
- for (const [s, n] of Object.entries(r)) {
1310
- if (n.index === void 0) throw new Error(`no index for part ${s}`);
1311
- if (n.values === void 0) throw new Error(`no values for part ${s}`);
1307
+ i === void 0 && (i = {}, r[n] = i), i.values = s.traverse({ field: o, errorIfFieldNotSet: !0 }).resourceInfo;
1308
+ } else throw new Error(`unrecognized part field name: ${o}`);
1309
+ for (const [o, n] of Object.entries(r)) {
1310
+ if (n.index === void 0) throw new Error(`no index for part ${o}`);
1311
+ if (n.values === void 0) throw new Error(`no values for part ${o}`);
1312
1312
  }
1313
1313
  return {
1314
1314
  type: "BinaryPartitioned",
1315
1315
  partitionKeyLength: t.partitionKeyLength,
1316
1316
  parts: r
1317
1317
  };
1318
- } else if ($(o.resourceType, Vs)) {
1318
+ } else if ($(s.resourceType, No)) {
1319
1319
  const t = e, r = {};
1320
- for (const s of o.listInputFields()) {
1321
- const n = o.traverse({ field: s, errorIfFieldNotSet: !0 }), i = n.listInputFields();
1322
- if (i === void 0) throw new Error(`no partition keys for super key ${s}`);
1320
+ for (const o of s.listInputFields()) {
1321
+ const n = s.traverse({ field: o, errorIfFieldNotSet: !0 }), i = n.listInputFields();
1322
+ if (i === void 0) throw new Error(`no partition keys for super key ${o}`);
1323
1323
  for (const a of i)
1324
1324
  if (a.endsWith(".index")) {
1325
- const c = a.slice(0, a.length - 6), u = JSON.stringify([...JSON.parse(s), ...JSON.parse(c)]);
1325
+ const c = a.slice(0, a.length - 6), u = JSON.stringify([...JSON.parse(o), ...JSON.parse(c)]);
1326
1326
  let l = r[u];
1327
1327
  l === void 0 && (l = {}, r[u] = l), r[u].index = n.traverse({
1328
1328
  field: a,
1329
1329
  errorIfFieldNotSet: !0
1330
1330
  }).resourceInfo;
1331
1331
  } else if (a.endsWith(".values")) {
1332
- const c = a.slice(0, a.length - 7), u = JSON.stringify([...JSON.parse(s), ...JSON.parse(c)]);
1332
+ const c = a.slice(0, a.length - 7), u = JSON.stringify([...JSON.parse(o), ...JSON.parse(c)]);
1333
1333
  let l = r[u];
1334
1334
  l === void 0 && (l = {}, r[u] = l), r[u].values = n.traverse({
1335
1335
  field: a,
@@ -1343,17 +1343,17 @@ function Ls(o) {
1343
1343
  parts: r
1344
1344
  };
1345
1345
  }
1346
- throw new Error(`unsupported resource type: ${lr(o.resourceType)}`);
1346
+ throw new Error(`unsupported resource type: ${lr(s.resourceType)}`);
1347
1347
  }
1348
- function It(o, e) {
1349
- const t = he("sha256");
1350
- return t.update(Ve(o)), t.update(String(ue(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
1348
+ function It(s, e) {
1349
+ const t = ge("sha256");
1350
+ return t.update(Ie(s)), t.update(String(ce(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
1351
1351
  }
1352
- function Vt(o, e = !0, t = !1, r = "") {
1352
+ function Vt(s, e = !0, t = !1, r = "") {
1353
1353
  var a, c, u;
1354
- const s = /^(?<name>.*)\.(?<type>spec|data)$/, n = /* @__PURE__ */ new Map();
1355
- for (const l of o.listInputFields()) {
1356
- const p = l.match(s);
1354
+ const o = /^(?<name>.*)\.(?<type>spec|data)$/, n = /* @__PURE__ */ new Map();
1355
+ for (const l of s.listInputFields()) {
1356
+ const p = l.match(o);
1357
1357
  if (!p) {
1358
1358
  if (e) throw new Error(`unexpected field name ${l}`);
1359
1359
  continue;
@@ -1364,18 +1364,18 @@ function Vt(o, e = !0, t = !1, r = "") {
1364
1364
  continue;
1365
1365
  }
1366
1366
  g = g.slice(r.length);
1367
- const m = w((c = p.groups) == null ? void 0 : c.type);
1368
- let h = n.get(g);
1369
- switch (h === void 0 && (h = {}, n.set(g, h)), m) {
1367
+ const f = w((c = p.groups) == null ? void 0 : c.type);
1368
+ let b = n.get(g);
1369
+ switch (b === void 0 && (b = {}, n.set(g, b)), f) {
1370
1370
  case "spec":
1371
- h.spec = (u = o.traverse({
1371
+ b.spec = (u = s.traverse({
1372
1372
  field: l,
1373
1373
  ignoreError: t,
1374
1374
  pureFieldErrorToUndefined: t
1375
1375
  })) == null ? void 0 : u.getDataAsJson();
1376
1376
  break;
1377
1377
  case "data":
1378
- h.hasData = !0, h.data = () => o.traverseOrError({
1378
+ b.hasData = !0, b.data = () => s.traverseOrError({
1379
1379
  field: l,
1380
1380
  ignoreError: t
1381
1381
  });
@@ -1383,16 +1383,16 @@ function Vt(o, e = !0, t = !1, r = "") {
1383
1383
  continue;
1384
1384
  }
1385
1385
  }
1386
- const i = o.getInputsLocked();
1386
+ const i = s.getInputsLocked();
1387
1387
  if (i)
1388
1388
  for (const [, l] of n) l.data === void 0 && (l.hasData = !1);
1389
1389
  return { locked: i, results: n };
1390
1390
  }
1391
- function Js(o, e = !0, t = "") {
1392
- if (!o.getIsReadyOrError()) throw new Error("resource is not ready");
1393
- const r = Vt(o, e, !1, t);
1391
+ function Mo(s, e = !0, t = "") {
1392
+ if (!s.getIsReadyOrError()) throw new Error("resource is not ready");
1393
+ const r = Vt(s, e, !1, t);
1394
1394
  br(r.locked);
1395
- const s = {};
1395
+ const o = {};
1396
1396
  for (const [n, i] of r.results) {
1397
1397
  if (i.spec === void 0) throw new Error(`no spec for key ${n}`);
1398
1398
  if (i.hasData !== !0 || i.data === void 0)
@@ -1400,21 +1400,21 @@ function Js(o, e = !0, t = "") {
1400
1400
  const a = i.data();
1401
1401
  if (a === void 0) throw new Error(`no data for key ${n}`);
1402
1402
  if (!a.ok) throw new fr(a.error);
1403
- s[n] = {
1403
+ o[n] = {
1404
1404
  id: It(i.spec, a.value),
1405
1405
  spec: i.spec,
1406
1406
  data: a.value
1407
1407
  };
1408
1408
  }
1409
- return s;
1409
+ return o;
1410
1410
  }
1411
1411
  class Ke {
1412
1412
  constructor(e, t) {
1413
1413
  d(this, "allSpecsAvailable");
1414
1414
  this.ctx = e, this.blocks = t;
1415
1415
  let r = !0;
1416
- e: for (const s of t.values())
1417
- for (const n of [s.prod, s.staging])
1416
+ e: for (const o of t.values())
1417
+ for (const n of [o.prod, o.staging])
1418
1418
  if (n !== void 0) {
1419
1419
  if (!n.locked) {
1420
1420
  r = !1;
@@ -1452,30 +1452,30 @@ class Ke {
1452
1452
  getDataWithErrors() {
1453
1453
  const e = [];
1454
1454
  let t = !0, r;
1455
- const s = (i) => {
1455
+ const o = (i) => {
1456
1456
  r === void 0 && (r = i), t = !1;
1457
1457
  }, n = (i, a, c) => {
1458
1458
  if (c.spec !== void 0 && c.hasData === !0 && c.data !== void 0) {
1459
1459
  const u = c.data();
1460
1460
  u !== void 0 ? e.push({
1461
- ref: ie(i, a),
1461
+ ref: ne(i, a),
1462
1462
  obj: {
1463
1463
  id: u.ok ? It(c.spec, u.value) : void 0,
1464
1464
  spec: c.spec,
1465
1465
  data: u
1466
1466
  }
1467
- }) : s(`no_data:${i}:${a}`);
1467
+ }) : o(`no_data:${i}:${a}`);
1468
1468
  }
1469
1469
  };
1470
1470
  for (const [i, a] of this.blocks) {
1471
1471
  const c = /* @__PURE__ */ new Set();
1472
1472
  if (a.prod !== void 0) {
1473
- a.prod.locked || s(`prod_not_locked:${i}`);
1473
+ a.prod.locked || o(`prod_not_locked:${i}`);
1474
1474
  for (const [u, l] of a.prod.results)
1475
1475
  c.add(u), n(i, u, l);
1476
1476
  }
1477
1477
  if (a.staging !== void 0) {
1478
- a.staging.locked || s(`staging_not_locked:${i}`);
1478
+ a.staging.locked || o(`staging_not_locked:${i}`);
1479
1479
  for (const [u, l] of a.staging.results)
1480
1480
  c.has(u) || n(i, u, l);
1481
1481
  }
@@ -1485,24 +1485,24 @@ class Ke {
1485
1485
  getSpecs() {
1486
1486
  const e = [];
1487
1487
  let t = !0, r;
1488
- const s = (n) => {
1488
+ const o = (n) => {
1489
1489
  r === void 0 && (r = n), t = !1;
1490
1490
  };
1491
1491
  for (const [n, i] of this.blocks) {
1492
1492
  const a = /* @__PURE__ */ new Set();
1493
1493
  if (i.staging !== void 0) {
1494
- i.staging.locked || s(`staging_not_locked:${n}`);
1494
+ i.staging.locked || o(`staging_not_locked:${n}`);
1495
1495
  for (const [c, u] of i.staging.results)
1496
1496
  u.spec !== void 0 && (e.push({
1497
- ref: ie(n, c),
1497
+ ref: ne(n, c),
1498
1498
  obj: u.spec
1499
1499
  }), a.add(c));
1500
- } else s(`staging_not_rendered:${n}`);
1500
+ } else o(`staging_not_rendered:${n}`);
1501
1501
  if (i.prod !== void 0) {
1502
- i.prod.locked || s(`prod_not_locked:${n}`);
1502
+ i.prod.locked || o(`prod_not_locked:${n}`);
1503
1503
  for (const [c, u] of i.prod.results)
1504
1504
  a.has(c) || u.spec !== void 0 && e.push({
1505
- ref: ie(n, c),
1505
+ ref: ne(n, c),
1506
1506
  obj: u.spec
1507
1507
  });
1508
1508
  }
@@ -1512,11 +1512,11 @@ class Ke {
1512
1512
  calculateOptions(e) {
1513
1513
  const t = [];
1514
1514
  for (const r of this.blocks.values()) {
1515
- const s = /* @__PURE__ */ new Set(), n = (i) => {
1515
+ const o = /* @__PURE__ */ new Set(), n = (i) => {
1516
1516
  for (const [a, c] of i.results)
1517
- s.has(a) || c.spec === void 0 || (s.add(a), qt(e, c.spec) && t.push({
1517
+ o.has(a) || c.spec === void 0 || (o.add(a), qt(e, c.spec) && t.push({
1518
1518
  label: r.info.label + " / " + a,
1519
- ref: ie(r.info.id, a),
1519
+ ref: ne(r.info.id, a),
1520
1520
  spec: c.spec
1521
1521
  }));
1522
1522
  };
@@ -1525,27 +1525,27 @@ class Ke {
1525
1525
  return t;
1526
1526
  }
1527
1527
  static create(e, t, r) {
1528
- const s = e.accessor(t).node(), n = w(s.getKeyValueAsJson(W)), a = je(n).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
1528
+ const o = e.accessor(t).node(), n = w(o.getKeyValueAsJson(W)), a = xe(n).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
1529
1529
  for (const u of N(n)) {
1530
1530
  if (!a.has(u.id)) continue;
1531
- const l = ut(
1532
- s.traverse({
1531
+ const l = ct(
1532
+ o.traverse({
1533
1533
  field: P(u.id, "prodCtx"),
1534
1534
  ignoreError: !0,
1535
1535
  pureFieldErrorToUndefined: !0,
1536
1536
  stableIfNotFound: !0
1537
1537
  }) !== void 0,
1538
- s.traverseOrError({
1538
+ o.traverseOrError({
1539
1539
  field: P(u.id, "prodUiCtx"),
1540
1540
  stableIfNotFound: !0
1541
1541
  })
1542
- ), p = ut(
1543
- s.traverse({
1542
+ ), p = ct(
1543
+ o.traverse({
1544
1544
  field: P(u.id, "stagingCtx"),
1545
1545
  ignoreError: !0,
1546
1546
  pureFieldErrorToUndefined: !0
1547
1547
  }) !== void 0,
1548
- s.traverseOrError({
1548
+ o.traverseOrError({
1549
1549
  field: P(u.id, "stagingUiCtx")
1550
1550
  })
1551
1551
  );
@@ -1554,22 +1554,22 @@ class Ke {
1554
1554
  return new Ke(e, c);
1555
1555
  }
1556
1556
  }
1557
- function ut(o, e) {
1557
+ function ct(s, e) {
1558
1558
  if (e === void 0)
1559
- return o ? { locked: !1, results: /* @__PURE__ */ new Map() } : void 0;
1559
+ return s ? { locked: !1, results: /* @__PURE__ */ new Map() } : void 0;
1560
1560
  if (e.ok) return Vt(e.value, !1, !0);
1561
1561
  }
1562
- function $e(o, e) {
1563
- const t = o.persist(), r = w(
1564
- o.traverse({
1562
+ function Ue(s, e) {
1563
+ const t = s.persist(), r = w(
1564
+ s.traverse({
1565
1565
  field: P(e, "currentArgs"),
1566
1566
  errorIfFieldNotSet: !0
1567
1567
  }).getDataAsString()
1568
- ), s = o.getKeyValueAsString(Re(e));
1568
+ ), o = s.getKeyValueAsString(Fe(e));
1569
1569
  return {
1570
1570
  blockId: e,
1571
1571
  args: r,
1572
- uiState: s,
1572
+ uiState: o,
1573
1573
  blockMeta: (n) => {
1574
1574
  const i = n.accessor(t).node(), a = w(i.getKeyValueAsJson(W)), c = /* @__PURE__ */ new Map();
1575
1575
  for (const u of N(a)) c.set(u.id, u);
@@ -1577,51 +1577,51 @@ function $e(o, e) {
1577
1577
  }
1578
1578
  };
1579
1579
  }
1580
- function Nt(o, e) {
1581
- const t = o.persist();
1580
+ function Nt(s, e) {
1581
+ const t = s.persist();
1582
1582
  return {
1583
- ...$e(o, e),
1583
+ ...Ue(s, e),
1584
1584
  prod: (r) => {
1585
- var s;
1586
- return (s = r.accessor(t).node({ ignoreError: !0 }).traverse({
1585
+ var o;
1586
+ return (o = r.accessor(t).node({ ignoreError: !0 }).traverse({
1587
1587
  field: P(e, "prodOutput"),
1588
1588
  stableIfNotFound: !0,
1589
1589
  ignoreError: !0
1590
- })) == null ? void 0 : s.persist();
1590
+ })) == null ? void 0 : o.persist();
1591
1591
  },
1592
1592
  staging: (r) => {
1593
1593
  var n;
1594
- const s = (n = r.accessor(t).node({ ignoreError: !0 }).traverse({
1594
+ const o = (n = r.accessor(t).node({ ignoreError: !0 }).traverse({
1595
1595
  field: P(e, "stagingOutput"),
1596
1596
  ignoreError: !0
1597
1597
  })) == null ? void 0 : n.persist();
1598
- return s === void 0 && r.markUnstable("staging_not_rendered"), s;
1598
+ return o === void 0 && r.markUnstable("staging_not_rendered"), o;
1599
1599
  },
1600
1600
  getResultsPool: (r) => Ke.create(r, t, e)
1601
1601
  };
1602
1602
  }
1603
- function* j(o, e) {
1604
- switch (yield o, o.type) {
1603
+ function* T(s, e) {
1604
+ switch (yield s, s.type) {
1605
1605
  case "GetFromCtx":
1606
1606
  case "Immediate":
1607
1607
  return;
1608
1608
  case "Isolate":
1609
- yield* j(o.cfg);
1609
+ yield* T(s.cfg);
1610
1610
  return;
1611
1611
  case "MakeObject":
1612
- for (const [, t] of Object.entries(o.template)) yield* j(t);
1612
+ for (const [, t] of Object.entries(s.template)) yield* T(t);
1613
1613
  return;
1614
1614
  case "MakeArray":
1615
- for (const t of o.template) yield* j(t);
1615
+ for (const t of s.template) yield* T(t);
1616
1616
  return;
1617
1617
  case "GetJsonField":
1618
1618
  case "GetResourceField":
1619
- yield* j(o.source), yield* j(o.field);
1619
+ yield* T(s.source), yield* T(s.field);
1620
1620
  return;
1621
1621
  case "MapRecordValues":
1622
1622
  case "MapArrayValues":
1623
1623
  case "MapResourceFields":
1624
- yield* j(o.source), yield* j(o.mapping);
1624
+ yield* T(s.source), yield* T(s.mapping);
1625
1625
  return;
1626
1626
  case "Flatten":
1627
1627
  case "GetResourceValueAsJson":
@@ -1634,153 +1634,153 @@ function* j(o, e) {
1634
1634
  case "GetLastLogs":
1635
1635
  case "GetProgressLog":
1636
1636
  case "GetLogHandle":
1637
- yield* j(o.source);
1637
+ yield* T(s.source);
1638
1638
  return;
1639
1639
  case "IsEmpty":
1640
- yield* j(o.arg);
1640
+ yield* T(s.arg);
1641
1641
  return;
1642
1642
  case "Not":
1643
- yield* j(o.operand);
1643
+ yield* T(s.operand);
1644
1644
  return;
1645
1645
  case "And":
1646
1646
  case "Or":
1647
- yield* j(o.operand1), yield* j(o.operand2);
1647
+ yield* T(s.operand1), yield* T(s.operand2);
1648
1648
  return;
1649
1649
  default:
1650
- D(o);
1650
+ D(s);
1651
1651
  }
1652
1652
  }
1653
- function Ms(o, e) {
1653
+ function Ko(s, e) {
1654
1654
  const t = {};
1655
- for (const [r, s] of Object.entries(o)) t[r] = e(s);
1655
+ for (const [r, o] of Object.entries(s)) t[r] = e(o);
1656
1656
  return t;
1657
1657
  }
1658
- function pe(o, e) {
1659
- return o === void 0 ? void 0 : e(o);
1658
+ function de(s, e) {
1659
+ return s === void 0 ? void 0 : e(s);
1660
1660
  }
1661
- function Us(o) {
1662
- switch (o.type) {
1661
+ function Uo(s) {
1662
+ switch (s.type) {
1663
1663
  case "GetImportProgress":
1664
1664
  return !0;
1665
1665
  default:
1666
1666
  return !1;
1667
1667
  }
1668
1668
  }
1669
- function Ks(o) {
1670
- for (const e of j(o)) if (Us(e)) return !0;
1669
+ function $o(s) {
1670
+ for (const e of T(s)) if (Uo(e)) return !0;
1671
1671
  return !1;
1672
1672
  }
1673
- function fe(o) {
1673
+ function he(s) {
1674
1674
  return {
1675
1675
  type: "ReturnResult",
1676
- result: o
1676
+ result: s
1677
1677
  };
1678
1678
  }
1679
- function f(o) {
1680
- return () => fe(o);
1679
+ function h(s) {
1680
+ return () => he(s);
1681
1681
  }
1682
- const $s = (o) => {
1682
+ const Go = (s) => {
1683
1683
  const e = {};
1684
- for (const [t, r] of Object.entries(o)) e[t] = r;
1685
- return f(e);
1686
- }, Gs = (o) => {
1687
- const e = o.source;
1688
- if (e === void 0) return f(void 0);
1684
+ for (const [t, r] of Object.entries(s)) e[t] = r;
1685
+ return h(e);
1686
+ }, Ho = (s) => {
1687
+ const e = s.source;
1688
+ if (e === void 0) return h(void 0);
1689
1689
  const t = [];
1690
1690
  for (const r of e)
1691
1691
  r instanceof Array ? t.push(...r) : t.push(r);
1692
- return f(t);
1693
- }, Hs = (o) => {
1694
- const e = o.source, t = o.field;
1695
- return e === void 0 || t === void 0 ? f(void 0) : ({ cCtx: r }) => {
1696
- var s;
1697
- return fe((s = r.accessor(e).node().traverse(t)) == null ? void 0 : s.persist());
1692
+ return h(t);
1693
+ }, _o = (s) => {
1694
+ const e = s.source, t = s.field;
1695
+ return e === void 0 || t === void 0 ? h(void 0) : ({ cCtx: r }) => {
1696
+ var o;
1697
+ return he((o = r.accessor(e).node().traverse(t)) == null ? void 0 : o.persist());
1698
1698
  };
1699
1699
  };
1700
- function Lt(o, e) {
1701
- const t = {}, r = o.length;
1702
- for (let s = 0; s < r; s++) t[String(s)] = e(o[s]);
1700
+ function Lt(s, e) {
1701
+ const t = {}, r = s.length;
1702
+ for (let o = 0; o < r; o++) t[String(o)] = e(s[o]);
1703
1703
  return t;
1704
1704
  }
1705
- function _s(o, e) {
1705
+ function Wo(s, e) {
1706
1706
  return (t) => {
1707
1707
  const r = t.source;
1708
- return r === void 0 ? f(void 0) : () => ({
1708
+ return r === void 0 ? h(void 0) : () => ({
1709
1709
  type: "ScheduleSubroutine",
1710
1710
  subroutine: Jt(r.length),
1711
- args: Lt(r, (s) => v({ ...o, [e.itVar]: s }, e.mapping))
1711
+ args: Lt(r, (o) => m({ ...s, [e.itVar]: o }, e.mapping))
1712
1712
  });
1713
1713
  };
1714
1714
  }
1715
- function Jt(o) {
1715
+ function Jt(s) {
1716
1716
  return (e) => {
1717
1717
  const t = [];
1718
- for (let r = 0; r < o; r++) t.push(e[String(r)]);
1719
- return f(t);
1718
+ for (let r = 0; r < s; r++) t.push(e[String(r)]);
1719
+ return h(t);
1720
1720
  };
1721
1721
  }
1722
- function Ws(o, e) {
1722
+ function zo(s, e) {
1723
1723
  return (t) => {
1724
1724
  const r = t.source;
1725
- if (r === void 0) return f(void 0);
1726
- const s = {};
1725
+ if (r === void 0) return h(void 0);
1726
+ const o = {};
1727
1727
  for (const [n, i] of Object.entries(r)) {
1728
- const a = { ...o, [e.itVar]: i };
1729
- s[n] = v(a, e.mapping);
1728
+ const a = { ...s, [e.itVar]: i };
1729
+ o[n] = m(a, e.mapping);
1730
1730
  }
1731
1731
  return () => ({
1732
1732
  type: "ScheduleSubroutine",
1733
- subroutine: zs,
1734
- args: s
1733
+ subroutine: Yo,
1734
+ args: o
1735
1735
  });
1736
1736
  };
1737
1737
  }
1738
- const zs = (o) => f(o), Ys = (o) => {
1739
- const e = o.arg;
1740
- return f(e === void 0 ? void 0 : e.length === 0);
1741
- }, qs = (o) => {
1742
- const e = o.operand;
1743
- return f(e === void 0 ? void 0 : !e);
1744
- }, Qs = (o) => {
1745
- const e = o.operand1, t = o.operand2;
1746
- return f(e === void 0 || t === void 0 ? void 0 : e && t);
1747
- }, Zs = (o) => {
1748
- const e = o.operand1, t = o.operand2;
1749
- return f(e === void 0 || t === void 0 ? void 0 : e || t);
1750
- }, Xs = (o) => {
1751
- const e = o.source;
1752
- return e === void 0 ? f(void 0) : ({ cCtx: t }) => {
1738
+ const Yo = (s) => h(s), qo = (s) => {
1739
+ const e = s.arg;
1740
+ return h(e === void 0 ? void 0 : e.length === 0);
1741
+ }, Qo = (s) => {
1742
+ const e = s.operand;
1743
+ return h(e === void 0 ? void 0 : !e);
1744
+ }, Zo = (s) => {
1745
+ const e = s.operand1, t = s.operand2;
1746
+ return h(e === void 0 || t === void 0 ? void 0 : e && t);
1747
+ }, Xo = (s) => {
1748
+ const e = s.operand1, t = s.operand2;
1749
+ return h(e === void 0 || t === void 0 ? void 0 : e || t);
1750
+ }, es = (s) => {
1751
+ const e = s.source;
1752
+ return e === void 0 ? h(void 0) : ({ cCtx: t }) => {
1753
1753
  var r;
1754
- return fe((r = t.accessor(e).node()) == null ? void 0 : r.getDataAsJson());
1754
+ return he((r = t.accessor(e).node()) == null ? void 0 : r.getDataAsJson());
1755
1755
  };
1756
- }, eo = (o) => {
1757
- const e = o.source, t = o.field;
1758
- return f(e === void 0 || t === void 0 ? void 0 : e[t]);
1756
+ }, ts = (s) => {
1757
+ const e = s.source, t = s.field;
1758
+ return h(e === void 0 || t === void 0 ? void 0 : e[t]);
1759
1759
  };
1760
- function to(o, e) {
1760
+ function rs(s, e) {
1761
1761
  return (t) => {
1762
1762
  const r = t.source;
1763
- return r === void 0 ? f(void 0) : ({ cCtx: s }) => {
1764
- const n = s.accessor(r).node(), i = {};
1763
+ return r === void 0 ? h(void 0) : ({ cCtx: o }) => {
1764
+ const n = o.accessor(r).node(), i = {};
1765
1765
  for (const a of n.listInputFields()) {
1766
1766
  const c = n.traverse(a);
1767
- if (c === void 0) i[a] = f(void 0);
1767
+ if (c === void 0) i[a] = h(void 0);
1768
1768
  else {
1769
- const u = { ...o, [e.itVar]: c.persist() };
1770
- i[a] = v(u, e.mapping);
1769
+ const u = { ...s, [e.itVar]: c.persist() };
1770
+ i[a] = m(u, e.mapping);
1771
1771
  }
1772
1772
  }
1773
1773
  return {
1774
1774
  type: "ScheduleSubroutine",
1775
- subroutine: ro,
1775
+ subroutine: os,
1776
1776
  args: i
1777
1777
  };
1778
1778
  };
1779
1779
  };
1780
1780
  }
1781
- const ro = (o) => f(o), so = (o) => {
1782
- const e = o.source;
1783
- return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
1781
+ const os = (s) => h(s), ss = (s) => {
1782
+ const e = s.source;
1783
+ return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1784
1784
  type: "ScheduleComputable",
1785
1785
  computable: F.make(
1786
1786
  (r) => t.blobDriver.getDownloadedBlob(r.accessor(e).node().resourceInfo),
@@ -1792,292 +1792,292 @@ const ro = (o) => f(o), so = (o) => {
1792
1792
  }
1793
1793
  )
1794
1794
  });
1795
- }, oo = (o) => {
1796
- const e = o.source;
1797
- return e === void 0 ? f(void 0) : ({ cCtx: t, drivers: r }) => {
1798
- const s = t.accessor(e).node().resourceInfo;
1795
+ }, ns = (s) => {
1796
+ const e = s.source;
1797
+ return e === void 0 ? h(void 0) : ({ cCtx: t, drivers: r }) => {
1798
+ const o = t.accessor(e).node().resourceInfo;
1799
1799
  return {
1800
1800
  type: "ScheduleComputable",
1801
- computable: F.make(() => r.blobDriver.getDownloadedBlob(s), {
1801
+ computable: F.make(() => r.blobDriver.getDownloadedBlob(o), {
1802
1802
  postprocessValue: async (n) => n === void 0 ? void 0 : (await r.blobDriver.getContent(n.handle)).toString()
1803
1803
  })
1804
1804
  };
1805
1805
  };
1806
- }, no = (o) => {
1807
- const e = o.source;
1808
- return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
1806
+ }, is = (s) => {
1807
+ const e = s.source;
1808
+ return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1809
1809
  type: "ScheduleComputable",
1810
1810
  computable: F.make(
1811
1811
  (r) => t.blobDriver.getDownloadedBlob(r.accessor(e).node().resourceInfo),
1812
1812
  {
1813
1813
  postprocessValue: async (r) => {
1814
1814
  if (r == null) return;
1815
- const s = await t.blobDriver.getContent(r.handle);
1816
- if (s != null)
1817
- return JSON.parse(Buffer.from(s).toString());
1815
+ const o = await t.blobDriver.getContent(r.handle);
1816
+ if (o != null)
1817
+ return JSON.parse(Buffer.from(o).toString());
1818
1818
  }
1819
1819
  }
1820
1820
  )
1821
1821
  });
1822
- }, io = (o) => {
1823
- const e = o.source;
1824
- return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
1822
+ }, as = (s) => {
1823
+ const e = s.source;
1824
+ return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1825
1825
  type: "ScheduleComputable",
1826
1826
  computable: t.blobDriver.getDownloadedBlob(e)
1827
1827
  });
1828
- }, ao = (o) => {
1829
- const e = o.source;
1830
- return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
1828
+ }, cs = (s) => {
1829
+ const e = s.source;
1830
+ return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1831
1831
  type: "ScheduleComputable",
1832
1832
  computable: t.blobDriver.getOnDemandBlob(e)
1833
1833
  });
1834
- }, co = (o) => {
1835
- const e = o.source;
1836
- return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
1834
+ }, us = (s) => {
1835
+ const e = s.source;
1836
+ return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1837
1837
  type: "ScheduleComputable",
1838
1838
  computable: t.uploadDriver.getProgressId(e)
1839
1839
  });
1840
- }, uo = (o) => (e) => {
1840
+ }, ls = (s) => (e) => {
1841
1841
  const t = e.source;
1842
- return t === void 0 ? f(void 0) : ({ drivers: r }) => ({
1842
+ return t === void 0 ? h(void 0) : ({ drivers: r }) => ({
1843
1843
  type: "ScheduleComputable",
1844
- computable: r.logDriver.getLastLogs(t, o)
1844
+ computable: r.logDriver.getLastLogs(t, s)
1845
1845
  });
1846
- }, lo = (o) => (e) => {
1846
+ }, ds = (s) => (e) => {
1847
1847
  const t = e.source;
1848
- return t === void 0 ? f(void 0) : ({ drivers: r }) => ({
1848
+ return t === void 0 ? h(void 0) : ({ drivers: r }) => ({
1849
1849
  type: "ScheduleComputable",
1850
- computable: r.logDriver.getProgressLog(t, o)
1850
+ computable: r.logDriver.getProgressLog(t, s)
1851
1851
  });
1852
- }, po = (o) => {
1853
- const e = o.source;
1854
- return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
1852
+ }, ps = (s) => {
1853
+ const e = s.source;
1854
+ return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1855
1855
  type: "ScheduleComputable",
1856
1856
  computable: t.logDriver.getLogHandle(e)
1857
1857
  });
1858
1858
  };
1859
- function v(o, e) {
1859
+ function m(s, e) {
1860
1860
  switch (e.type) {
1861
1861
  case "GetFromCtx":
1862
- const t = o[e.variable];
1863
- return typeof t == "function" ? (r) => fe(t(r.cCtx)) : (t === void 0 && console.log("asdasd"), f(t));
1862
+ const t = s[e.variable];
1863
+ return typeof t == "function" ? (r) => he(t(r.cCtx)) : (t === void 0 && console.log("asdasd"), h(t));
1864
1864
  case "Isolate":
1865
1865
  return ({ drivers: r }) => ({
1866
1866
  type: "ScheduleComputable",
1867
- computable: $t(r, o, e.cfg)
1867
+ computable: $t(r, s, e.cfg)
1868
1868
  });
1869
1869
  case "Immediate":
1870
- return f(e.value);
1870
+ return h(e.value);
1871
1871
  case "GetJsonField":
1872
1872
  return () => ({
1873
1873
  type: "ScheduleSubroutine",
1874
- subroutine: eo,
1874
+ subroutine: ts,
1875
1875
  args: {
1876
- source: v(o, e.source),
1877
- field: v(o, e.field)
1876
+ source: m(s, e.source),
1877
+ field: m(s, e.field)
1878
1878
  }
1879
1879
  });
1880
1880
  case "MapArrayValues":
1881
1881
  return () => ({
1882
1882
  type: "ScheduleSubroutine",
1883
- subroutine: _s(o, e),
1883
+ subroutine: Wo(s, e),
1884
1884
  args: {
1885
- source: v(o, e.source)
1885
+ source: m(s, e.source)
1886
1886
  }
1887
1887
  });
1888
1888
  case "MapRecordValues":
1889
1889
  return () => ({
1890
1890
  type: "ScheduleSubroutine",
1891
- subroutine: Ws(o, e),
1891
+ subroutine: zo(s, e),
1892
1892
  args: {
1893
- source: v(o, e.source)
1893
+ source: m(s, e.source)
1894
1894
  }
1895
1895
  });
1896
1896
  case "MakeObject":
1897
1897
  return () => ({
1898
1898
  type: "ScheduleSubroutine",
1899
- subroutine: $s,
1900
- args: Ms(e.template, (r) => v(o, r))
1899
+ subroutine: Go,
1900
+ args: Ko(e.template, (r) => m(s, r))
1901
1901
  });
1902
1902
  case "MakeArray":
1903
1903
  return () => ({
1904
1904
  type: "ScheduleSubroutine",
1905
1905
  subroutine: Jt(e.template.length),
1906
- args: Lt(e.template, (r) => v(o, r))
1906
+ args: Lt(e.template, (r) => m(s, r))
1907
1907
  });
1908
1908
  case "Flatten":
1909
1909
  return () => ({
1910
1910
  type: "ScheduleSubroutine",
1911
- subroutine: Gs,
1911
+ subroutine: Ho,
1912
1912
  args: {
1913
- source: v(o, e.source)
1913
+ source: m(s, e.source)
1914
1914
  }
1915
1915
  });
1916
1916
  case "IsEmpty":
1917
1917
  return () => ({
1918
1918
  type: "ScheduleSubroutine",
1919
- subroutine: Ys,
1919
+ subroutine: qo,
1920
1920
  args: {
1921
- arg: v(o, e.arg)
1921
+ arg: m(s, e.arg)
1922
1922
  }
1923
1923
  });
1924
1924
  case "Not":
1925
1925
  return () => ({
1926
1926
  type: "ScheduleSubroutine",
1927
- subroutine: qs,
1927
+ subroutine: Qo,
1928
1928
  args: {
1929
- operand: v(o, e.operand)
1929
+ operand: m(s, e.operand)
1930
1930
  }
1931
1931
  });
1932
1932
  case "And":
1933
1933
  return () => ({
1934
1934
  type: "ScheduleSubroutine",
1935
- subroutine: Qs,
1935
+ subroutine: Zo,
1936
1936
  args: {
1937
- operand1: v(o, e.operand1),
1938
- operand2: v(o, e.operand2)
1937
+ operand1: m(s, e.operand1),
1938
+ operand2: m(s, e.operand2)
1939
1939
  }
1940
1940
  });
1941
1941
  case "Or":
1942
1942
  return () => ({
1943
1943
  type: "ScheduleSubroutine",
1944
- subroutine: Zs,
1944
+ subroutine: Xo,
1945
1945
  args: {
1946
- operand1: v(o, e.operand1),
1947
- operand2: v(o, e.operand2)
1946
+ operand1: m(s, e.operand1),
1947
+ operand2: m(s, e.operand2)
1948
1948
  }
1949
1949
  });
1950
1950
  case "MapResourceFields":
1951
1951
  return () => ({
1952
1952
  type: "ScheduleSubroutine",
1953
- subroutine: to(o, e),
1953
+ subroutine: rs(s, e),
1954
1954
  args: {
1955
- source: v(o, e.source)
1955
+ source: m(s, e.source)
1956
1956
  }
1957
1957
  });
1958
1958
  case "GetResourceField":
1959
1959
  return () => ({
1960
1960
  type: "ScheduleSubroutine",
1961
- subroutine: Hs,
1961
+ subroutine: _o,
1962
1962
  args: {
1963
- source: v(o, e.source),
1964
- field: v(o, e.field)
1963
+ source: m(s, e.source),
1964
+ field: m(s, e.field)
1965
1965
  }
1966
1966
  });
1967
1967
  case "GetResourceValueAsJson":
1968
1968
  return () => ({
1969
1969
  type: "ScheduleSubroutine",
1970
- subroutine: Xs,
1970
+ subroutine: es,
1971
1971
  args: {
1972
- source: v(o, e.source)
1972
+ source: m(s, e.source)
1973
1973
  }
1974
1974
  });
1975
1975
  case "GetBlobContent":
1976
1976
  return () => ({
1977
1977
  type: "ScheduleSubroutine",
1978
- subroutine: so,
1978
+ subroutine: ss,
1979
1979
  args: {
1980
- source: v(o, e.source)
1980
+ source: m(s, e.source)
1981
1981
  }
1982
1982
  });
1983
1983
  case "GetBlobContentAsString":
1984
1984
  return () => ({
1985
1985
  type: "ScheduleSubroutine",
1986
- subroutine: oo,
1986
+ subroutine: ns,
1987
1987
  args: {
1988
- source: v(o, e.source)
1988
+ source: m(s, e.source)
1989
1989
  }
1990
1990
  });
1991
1991
  case "GetBlobContentAsJson":
1992
1992
  return () => ({
1993
1993
  type: "ScheduleSubroutine",
1994
- subroutine: no,
1994
+ subroutine: is,
1995
1995
  args: {
1996
- source: v(o, e.source)
1996
+ source: m(s, e.source)
1997
1997
  }
1998
1998
  });
1999
1999
  case "GetDownloadedBlobContent":
2000
2000
  return () => ({
2001
2001
  type: "ScheduleSubroutine",
2002
- subroutine: io,
2002
+ subroutine: as,
2003
2003
  args: {
2004
- source: v(o, e.source)
2004
+ source: m(s, e.source)
2005
2005
  }
2006
2006
  });
2007
2007
  case "GetOnDemandBlobContent":
2008
2008
  return () => ({
2009
2009
  type: "ScheduleSubroutine",
2010
- subroutine: ao,
2010
+ subroutine: cs,
2011
2011
  args: {
2012
- source: v(o, e.source)
2012
+ source: m(s, e.source)
2013
2013
  }
2014
2014
  });
2015
2015
  case "GetImportProgress":
2016
2016
  return () => ({
2017
2017
  type: "ScheduleSubroutine",
2018
- subroutine: co,
2018
+ subroutine: us,
2019
2019
  args: {
2020
- source: v(o, e.source)
2020
+ source: m(s, e.source)
2021
2021
  }
2022
2022
  });
2023
2023
  case "GetLastLogs":
2024
2024
  return () => ({
2025
2025
  type: "ScheduleSubroutine",
2026
- subroutine: uo(e.lines),
2026
+ subroutine: ls(e.lines),
2027
2027
  args: {
2028
- source: v(o, e.source)
2028
+ source: m(s, e.source)
2029
2029
  }
2030
2030
  });
2031
2031
  case "GetProgressLog":
2032
2032
  return () => ({
2033
2033
  type: "ScheduleSubroutine",
2034
- subroutine: lo(e.patternToSearch),
2034
+ subroutine: ds(e.patternToSearch),
2035
2035
  args: {
2036
- source: v(o, e.source)
2036
+ source: m(s, e.source)
2037
2037
  }
2038
2038
  });
2039
2039
  case "GetLogHandle":
2040
2040
  return () => ({
2041
2041
  type: "ScheduleSubroutine",
2042
- subroutine: po,
2042
+ subroutine: ps,
2043
2043
  args: {
2044
- source: v(o, e.source)
2044
+ source: m(s, e.source)
2045
2045
  }
2046
2046
  });
2047
2047
  default:
2048
2048
  return D(e);
2049
2049
  }
2050
2050
  }
2051
- const go = ["$prod", "$staging"];
2052
- function ho(o) {
2051
+ const gs = ["$prod", "$staging"];
2052
+ function hs(s) {
2053
2053
  return {
2054
- $blockId: o.blockId,
2055
- $args: JSON.parse(o.args),
2056
- $ui: o.uiState !== void 0 ? JSON.parse(o.uiState) : void 0,
2057
- $prod: o.prod,
2058
- $staging: o.staging
2054
+ $blockId: s.blockId,
2055
+ $args: JSON.parse(s.args),
2056
+ $ui: s.uiState !== void 0 ? JSON.parse(s.uiState) : void 0,
2057
+ $prod: s.prod,
2058
+ $staging: s.staging
2059
2059
  };
2060
2060
  }
2061
- const Mt = Symbol(), Ut = "return", fo = { op: Mt, arg: Ut };
2062
- function mo(o) {
2063
- return o.op == Mt && o.arg == Ut;
2061
+ const Mt = Symbol(), Kt = "return", fs = { op: Mt, arg: Kt };
2062
+ function ms(s) {
2063
+ return s.op == Mt && s.arg == Kt;
2064
2064
  }
2065
- function vo() {
2065
+ function vs() {
2066
2066
  return { pendingSubroutines: /* @__PURE__ */ new Map() };
2067
2067
  }
2068
- function lt(o, e, t, r) {
2069
- const s = new St(t), n = (a, c) => {
2070
- if (mo(a))
2068
+ function ut(s, e, t, r) {
2069
+ const o = new St(t), n = (a, c) => {
2070
+ if (ms(a))
2071
2071
  return e.result = c, !1;
2072
2072
  const u = w(e.pendingSubroutines.get(a.op));
2073
2073
  if (a.arg in u.args) throw new Error("argument already set");
2074
- return u.args[a.arg] = c, u.argCounter--, u.argCounter === 0 && (e.pendingSubroutines.delete(a.op), s.push({
2074
+ return u.args[a.arg] = c, u.argCounter--, u.argCounter === 0 && (e.pendingSubroutines.delete(a.op), o.push({
2075
2075
  destination: u.destination,
2076
2076
  operation: u.subroutine(u.args)
2077
2077
  })), !0;
2078
2078
  }, i = [];
2079
- e: for (; s.length > 0; ) {
2080
- const a = s.shift(), c = a.operation(o);
2079
+ e: for (; o.length > 0; ) {
2080
+ const a = o.shift(), c = a.operation(s);
2081
2081
  switch (c.type) {
2082
2082
  case "ReturnResult":
2083
2083
  if (!n(a.destination, c.result)) break e;
@@ -2085,15 +2085,15 @@ function lt(o, e, t, r) {
2085
2085
  case "ScheduleSubroutine":
2086
2086
  const u = Symbol(), l = Object.entries(c.args), p = l.length;
2087
2087
  if (p === 0)
2088
- s.push({
2088
+ o.push({
2089
2089
  destination: a.destination,
2090
2090
  operation: c.subroutine({})
2091
2091
  });
2092
2092
  else {
2093
- for (const [g, m] of l)
2094
- s.push({
2093
+ for (const [g, f] of l)
2094
+ o.push({
2095
2095
  destination: { op: u, arg: g },
2096
- operation: m
2096
+ operation: f
2097
2097
  });
2098
2098
  e.pendingSubroutines.set(u, {
2099
2099
  argCounter: p,
@@ -2117,25 +2117,25 @@ function lt(o, e, t, r) {
2117
2117
  }
2118
2118
  return i;
2119
2119
  }
2120
- function Kt(o, e, t, r = {}) {
2121
- return $t(o, ho(e), t, r);
2120
+ function Ut(s, e, t, r = {}) {
2121
+ return $t(s, hs(e), t, r);
2122
2122
  }
2123
- function $t(o, e, t, r = {}) {
2124
- const s = Ve({
2125
- ctx: Object.fromEntries(Object.entries(e).filter(([n]) => go.indexOf(n) === -1)),
2123
+ function $t(s, e, t, r = {}) {
2124
+ const o = Ie({
2125
+ ctx: Object.fromEntries(Object.entries(e).filter(([n]) => gs.indexOf(n) === -1)),
2126
2126
  cfg: t
2127
2127
  });
2128
2128
  return F.makeRaw(
2129
2129
  (n) => {
2130
- const i = { drivers: o, cCtx: n }, a = vo();
2130
+ const i = { drivers: s, cCtx: n }, a = vs();
2131
2131
  return {
2132
- ir: lt(
2132
+ ir: ut(
2133
2133
  i,
2134
2134
  a,
2135
2135
  [
2136
2136
  {
2137
- destination: fo,
2138
- operation: v(e, t)
2137
+ destination: fs,
2138
+ operation: m(e, t)
2139
2139
  }
2140
2140
  ],
2141
2141
  !0
@@ -2143,36 +2143,36 @@ function $t(o, e, t, r = {}) {
2143
2143
  async postprocessValue(u, l) {
2144
2144
  const p = [];
2145
2145
  for (const C of u)
2146
- p.push({ destination: C.destination, operation: f(C.computable) });
2146
+ p.push({ destination: C.destination, operation: h(C.computable) });
2147
2147
  const g = {
2148
- drivers: o,
2148
+ drivers: s,
2149
2149
  get cCtx() {
2150
2150
  throw new Error("asynchronous operations are forbidden in this context");
2151
2151
  }
2152
- }, m = /* @__PURE__ */ new Map();
2152
+ }, f = /* @__PURE__ */ new Map();
2153
2153
  for (const [C, I] of a.pendingSubroutines)
2154
- m.set(C, { ...I, args: { ...I.args } });
2155
- const h = {
2154
+ f.set(C, { ...I, args: { ...I.args } });
2155
+ const b = {
2156
2156
  result: a.result,
2157
- pendingSubroutines: m
2157
+ pendingSubroutines: f
2158
2158
  };
2159
- if (lt(g, h, p, !1), !("result" in h))
2159
+ if (ut(g, b, p, !1), !("result" in b))
2160
2160
  throw new Error("illegal cfg rendering stack state, no result");
2161
- return h.result;
2161
+ return b.result;
2162
2162
  }
2163
2163
  };
2164
2164
  },
2165
- { ...r, key: s }
2165
+ { ...r, key: o }
2166
2166
  );
2167
2167
  }
2168
- function yo(o) {
2169
- return o instanceof ArrayBuffer || ArrayBuffer.isView(o);
2168
+ function ys(s) {
2169
+ return s instanceof ArrayBuffer || ArrayBuffer.isView(s);
2170
2170
  }
2171
- function dt(o) {
2172
- return o !== void 0 ? Buffer.from(o).toString("base64") : void 0;
2171
+ function lt(s) {
2172
+ return s !== void 0 ? Buffer.from(s).toString("base64") : void 0;
2173
2173
  }
2174
- class ge {
2175
- constructor(e, t, r, s, n) {
2174
+ class pe {
2175
+ constructor(e, t, r, o, n) {
2176
2176
  d(this, "callbackRegistry");
2177
2177
  d(this, "fnJSONStringify");
2178
2178
  d(this, "fnJSONParse");
@@ -2184,7 +2184,7 @@ class ge {
2184
2184
  // Result Pool
2185
2185
  //
2186
2186
  d(this, "_resultPool");
2187
- if (this.scope = e, this.vm = t, this.blockCtx = r, this.env = s, this.computableCtx = n, this.callbackRegistry = this.scope.manage(this.vm.newObject()), this.fnJSONStringify = e.manage(
2187
+ 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(
2188
2188
  t.getProp(t.global, "JSON").consume((i) => t.getProp(i, "stringify"))
2189
2189
  ), t.typeof(this.fnJSONStringify) !== "function")
2190
2190
  throw new Error("JSON.stringify() not found.");
@@ -2203,19 +2203,19 @@ class ge {
2203
2203
  try {
2204
2204
  this.vm.unwrapResult(this.vm.evalCode(e, "bundle.js", { type: "global" })).dispose();
2205
2205
  } catch (t) {
2206
- throw ge.cleanErrorContext(t), t;
2206
+ throw pe.cleanErrorContext(t), t;
2207
2207
  }
2208
2208
  }
2209
2209
  runCallback(e, ...t) {
2210
2210
  try {
2211
- return Fe.withScope((r) => {
2212
- const s = r.manage(this.vm.getProp(this.callbackRegistry, e));
2213
- if (this.vm.typeof(s) !== "function")
2211
+ return Pe.withScope((r) => {
2212
+ const o = r.manage(this.vm.getProp(this.callbackRegistry, e));
2213
+ if (this.vm.typeof(o) !== "function")
2214
2214
  throw new Error(`No such callback: ${e}`);
2215
2215
  return this.scope.manage(
2216
2216
  this.vm.unwrapResult(
2217
2217
  this.vm.callFunction(
2218
- s,
2218
+ o,
2219
2219
  this.vm.undefined,
2220
2220
  ...t.map((n) => this.exportObjectUniversal(n, r))
2221
2221
  )
@@ -2223,7 +2223,7 @@ class ge {
2223
2223
  );
2224
2224
  });
2225
2225
  } catch (r) {
2226
- throw ge.cleanErrorContext(r), r;
2226
+ throw pe.cleanErrorContext(r), r;
2227
2227
  }
2228
2228
  }
2229
2229
  //
@@ -2232,9 +2232,9 @@ class ge {
2232
2232
  getAccessorHandleByName(e) {
2233
2233
  if (this.computableCtx === void 0)
2234
2234
  throw new Error("Accessors can't be used in this context");
2235
- const t = (r, s) => {
2235
+ const t = (r, o) => {
2236
2236
  if (!this.accessors.has(r)) {
2237
- const n = this.blockCtx[s];
2237
+ const n = this.blockCtx[o];
2238
2238
  if (n === void 0) throw new Error("Staging context not available");
2239
2239
  const i = n(this.computableCtx);
2240
2240
  i ? this.accessors.set(r, this.computableCtx.accessor(i).node({ ignoreError: !0 })) : this.accessors.set(r, void 0);
@@ -2278,13 +2278,13 @@ class ge {
2278
2278
  return this.getAccessor(e).listDynamicFields();
2279
2279
  }
2280
2280
  getKeyValueBase64(e, t) {
2281
- return dt(this.getAccessor(e).getKeyValue(t));
2281
+ return lt(this.getAccessor(e).getKeyValue(t));
2282
2282
  }
2283
2283
  getKeyValueAsString(e, t) {
2284
2284
  return this.getAccessor(e).getKeyValueAsString(t);
2285
2285
  }
2286
2286
  getDataBase64(e) {
2287
- return dt(this.getAccessor(e).getData());
2287
+ return lt(this.getAccessor(e).getData());
2288
2288
  }
2289
2289
  getDataAsString(e) {
2290
2290
  return this.getAccessor(e).getDataAsString();
@@ -2293,18 +2293,18 @@ class ge {
2293
2293
  // Accessor helpers
2294
2294
  //
2295
2295
  parsePObjectCollection(e, t, r) {
2296
- const s = this.getAccessor(e);
2297
- if (!s.getIsReadyOrError()) return;
2298
- const n = Js(s, t, r), i = {};
2296
+ const o = this.getAccessor(e);
2297
+ if (!o.getIsReadyOrError()) return;
2298
+ const n = Mo(o, t, r), i = {};
2299
2299
  for (const [a, c] of Object.entries(n))
2300
- i[a] = Z(c, (u) => this.wrapAccessor(u));
2300
+ i[a] = Q(c, (u) => this.wrapAccessor(u));
2301
2301
  return i;
2302
2302
  }
2303
2303
  //
2304
2304
  // Blobs
2305
2305
  //
2306
2306
  registerComputable(e, t) {
2307
- const r = `${e}_${ee()}`;
2307
+ const r = `${e}_${X()}`;
2308
2308
  return this.computablesToResolve[r] = t, r;
2309
2309
  }
2310
2310
  getBlobContentAsString(e) {
@@ -2413,7 +2413,7 @@ class ge {
2413
2413
  isComplete: e.isComplete,
2414
2414
  entries: e.entries.map((t) => ({
2415
2415
  ref: t.ref,
2416
- obj: Z(t.obj, (r) => this.wrapAccessor(r))
2416
+ obj: Q(t.obj, (r) => this.wrapAccessor(r))
2417
2417
  }))
2418
2418
  };
2419
2419
  }
@@ -2444,7 +2444,7 @@ class ge {
2444
2444
  "can't instantiate PFrames from this context (most porbably called from the future mapper)"
2445
2445
  );
2446
2446
  return this.env.driverKit.pFrameDriver.createPFrame(
2447
- e.map((t) => Z(t, (r) => this.getAccessor(r))),
2447
+ e.map((t) => Q(t, (r) => this.getAccessor(r))),
2448
2448
  this.computableCtx
2449
2449
  );
2450
2450
  }
@@ -2454,7 +2454,7 @@ class ge {
2454
2454
  "can't instantiate PTable from this context (most porbably called from the future mapper)"
2455
2455
  );
2456
2456
  return this.env.driverKit.pFrameDriver.createPTable(
2457
- ht(e, (t) => Z(t, (r) => this.getAccessor(r))),
2457
+ ht(e, (t) => Q(t, (r) => this.getAccessor(r))),
2458
2458
  this.computableCtx
2459
2459
  );
2460
2460
  }
@@ -2468,7 +2468,7 @@ class ge {
2468
2468
  }
2469
2469
  wrapAccessor(e) {
2470
2470
  if (e !== void 0) {
2471
- const t = ee();
2471
+ const t = X();
2472
2472
  return this.accessors.set(t, e), t;
2473
2473
  }
2474
2474
  }
@@ -2481,13 +2481,13 @@ class ge {
2481
2481
  return r;
2482
2482
  }
2483
2483
  tryExportSingleValue(e, t) {
2484
- let r, s = !1;
2484
+ let r, o = !1;
2485
2485
  switch (typeof e) {
2486
2486
  case "string":
2487
- r = this.vm.newString(e), s = !0;
2487
+ r = this.vm.newString(e), o = !0;
2488
2488
  break;
2489
2489
  case "number":
2490
- r = this.vm.newNumber(e), s = !0;
2490
+ r = this.vm.newNumber(e), o = !0;
2491
2491
  break;
2492
2492
  case "undefined":
2493
2493
  r = this.vm.undefined;
@@ -2500,13 +2500,13 @@ class ge {
2500
2500
  r = this.vm.null;
2501
2501
  break;
2502
2502
  }
2503
- if (yo(e)) {
2504
- r = this.vm.newArrayBuffer(e), s = !0;
2503
+ if (ys(e)) {
2504
+ r = this.vm.newArrayBuffer(e), o = !0;
2505
2505
  break;
2506
2506
  }
2507
2507
  return;
2508
2508
  }
2509
- return s && t != null ? t.manage(r) : r;
2509
+ return o && t != null ? t.manage(r) : r;
2510
2510
  }
2511
2511
  exportObjectUniversal(e, t) {
2512
2512
  const r = this.tryExportSingleValue(e, t);
@@ -2514,7 +2514,7 @@ class ge {
2514
2514
  }
2515
2515
  exportObjectViaJson(e, t) {
2516
2516
  const r = this.vm.newString(JSON.stringify(e)).consume(
2517
- (s) => this.vm.unwrapResult(this.vm.callFunction(this.fnJSONParse, this.vm.undefined, s))
2517
+ (o) => this.vm.unwrapResult(this.vm.callFunction(this.fnJSONParse, this.vm.undefined, o))
2518
2518
  );
2519
2519
  return t !== void 0 ? t.manage(r) : r;
2520
2520
  }
@@ -2536,121 +2536,121 @@ class ge {
2536
2536
  return JSON.parse(t);
2537
2537
  }
2538
2538
  injectCtx() {
2539
- Fe.withScope((e) => {
2539
+ Pe.withScope((e) => {
2540
2540
  const t = e.manage(this.vm.newObject());
2541
2541
  this.vm.setProp(t, "args", e.manage(this.vm.newString(this.blockCtx.args))), this.blockCtx.uiState !== void 0 && this.vm.setProp(
2542
2542
  t,
2543
2543
  "uiState",
2544
2544
  e.manage(this.vm.newString(this.blockCtx.uiState))
2545
2545
  ), this.vm.setProp(t, "callbackRegistry", this.callbackRegistry);
2546
- const r = (s, n) => {
2547
- this.vm.newFunction(s, n).consume((i) => this.vm.setProp(t, s, i));
2546
+ const r = (o, n) => {
2547
+ this.vm.newFunction(o, n).consume((i) => this.vm.setProp(t, o, i));
2548
2548
  };
2549
- r("getAccessorHandleByName", (s) => this.exportSingleValue(
2550
- this.getAccessorHandleByName(this.vm.getString(s)),
2549
+ r("getAccessorHandleByName", (o) => this.exportSingleValue(
2550
+ this.getAccessorHandleByName(this.vm.getString(o)),
2551
2551
  void 0
2552
- )), r("resolveWithCommon", (s, n, ...i) => this.exportSingleValue(
2552
+ )), r("resolveWithCommon", (o, n, ...i) => this.exportSingleValue(
2553
2553
  this.resolveWithCommon(
2554
- this.vm.getString(s),
2554
+ this.vm.getString(o),
2555
2555
  this.importObjectViaJson(n),
2556
2556
  ...i.map(
2557
2557
  (a) => this.importObjectViaJson(a)
2558
2558
  )
2559
2559
  ),
2560
2560
  void 0
2561
- )), r("getResourceType", (s) => this.exportObjectViaJson(this.getResourceType(this.vm.getString(s)), void 0)), r("getInputsLocked", (s) => this.exportSingleValue(this.getInputsLocked(this.vm.getString(s)), void 0)), r("getOutputsLocked", (s) => this.exportSingleValue(this.getOutputsLocked(this.vm.getString(s)), void 0)), r("getIsReadyOrError", (s) => this.exportSingleValue(this.getIsReadyOrError(this.vm.getString(s)), void 0)), r("getIsFinal", (s) => this.exportSingleValue(this.getIsFinal(this.vm.getString(s)), void 0)), r("getError", (s) => this.exportSingleValue(this.getError(this.vm.getString(s)), void 0)), r("listInputFields", (s) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(s)), void 0)), r("listOutputFields", (s) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(s)), void 0)), r("listDynamicFields", (s) => this.exportObjectViaJson(this.listInputFields(this.vm.getString(s)), void 0)), r("getKeyValueBase64", (s, n) => this.exportSingleValue(
2562
- this.getKeyValueBase64(this.vm.getString(s), this.vm.getString(n)),
2561
+ )), 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(
2562
+ this.getKeyValueBase64(this.vm.getString(o), this.vm.getString(n)),
2563
2563
  void 0
2564
- )), r("getKeyValueAsString", (s, n) => this.exportSingleValue(
2565
- this.getKeyValueAsString(this.vm.getString(s), this.vm.getString(n)),
2564
+ )), r("getKeyValueAsString", (o, n) => this.exportSingleValue(
2565
+ this.getKeyValueAsString(this.vm.getString(o), this.vm.getString(n)),
2566
2566
  void 0
2567
- )), r("getDataBase64", (s) => this.exportSingleValue(this.getDataBase64(this.vm.getString(s)), void 0)), r("getDataAsString", (s) => this.exportSingleValue(this.getDataAsString(this.vm.getString(s)), void 0)), r("parsePObjectCollection", (s, n, i) => this.exportObjectUniversal(
2567
+ )), 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(
2568
2568
  this.parsePObjectCollection(
2569
- this.vm.getString(s),
2569
+ this.vm.getString(o),
2570
2570
  this.vm.dump(n),
2571
2571
  this.vm.getString(i)
2572
2572
  ),
2573
2573
  void 0
2574
- )), r("getBlobContentAsBase64", (s) => this.exportSingleValue(
2575
- this.getBlobContentAsBase64(this.vm.getString(s)),
2574
+ )), r("getBlobContentAsBase64", (o) => this.exportSingleValue(
2575
+ this.getBlobContentAsBase64(this.vm.getString(o)),
2576
2576
  void 0
2577
- )), r("getBlobContentAsString", (s) => this.exportSingleValue(
2578
- this.getBlobContentAsString(this.vm.getString(s)),
2577
+ )), r("getBlobContentAsString", (o) => this.exportSingleValue(
2578
+ this.getBlobContentAsString(this.vm.getString(o)),
2579
2579
  void 0
2580
- )), r("getDownloadedBlobContentHandle", (s) => this.exportSingleValue(
2581
- this.getDownloadedBlobContentHandle(this.vm.getString(s)),
2580
+ )), r("getDownloadedBlobContentHandle", (o) => this.exportSingleValue(
2581
+ this.getDownloadedBlobContentHandle(this.vm.getString(o)),
2582
2582
  void 0
2583
- )), r("getOnDemandBlobContentHandle", (s) => this.exportSingleValue(
2584
- this.getOnDemandBlobContentHandle(this.vm.getString(s)),
2583
+ )), r("getOnDemandBlobContentHandle", (o) => this.exportSingleValue(
2584
+ this.getOnDemandBlobContentHandle(this.vm.getString(o)),
2585
2585
  void 0
2586
- )), r("getImportProgress", (s) => this.exportSingleValue(this.getImportProgress(this.vm.getString(s)), void 0)), r("getLastLogs", (s, n) => this.exportSingleValue(
2587
- this.getLastLogs(this.vm.getString(s), this.vm.getNumber(n)),
2586
+ )), r("getImportProgress", (o) => this.exportSingleValue(this.getImportProgress(this.vm.getString(o)), void 0)), r("getLastLogs", (o, n) => this.exportSingleValue(
2587
+ this.getLastLogs(this.vm.getString(o), this.vm.getNumber(n)),
2588
2588
  void 0
2589
- )), r("getProgressLog", (s, n) => this.exportSingleValue(
2590
- this.getProgressLog(this.vm.getString(s), this.vm.getString(n)),
2589
+ )), r("getProgressLog", (o, n) => this.exportSingleValue(
2590
+ this.getProgressLog(this.vm.getString(o), this.vm.getString(n)),
2591
2591
  void 0
2592
- )), r("getLogHandle", (s) => this.exportSingleValue(this.getLogHandle(this.vm.getString(s)), void 0)), r("getBlockLabel", (s) => this.exportSingleValue(this.getBlockLabel(this.vm.getString(s)), void 0)), r("getDataFromResultPool", (s) => this.exportObjectUniversal(this.getDataFromResultPool(), void 0)), r("getDataWithErrorsFromResultPool", (s) => this.exportObjectUniversal(this.getDataWithErrorsFromResultPool(), void 0)), r("getSpecsFromResultPool", (s) => this.exportObjectUniversal(this.getSpecsFromResultPool(), void 0)), r("calculateOptions", (s) => this.exportObjectUniversal(
2593
- this.calculateOptions(this.importObjectViaJson(s)),
2592
+ )), 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(
2593
+ this.calculateOptions(this.importObjectViaJson(o)),
2594
2594
  void 0
2595
- )), r("createPFrame", (s) => this.exportSingleValue(
2596
- this.createPFrame(this.importObjectViaJson(s)),
2595
+ )), r("createPFrame", (o) => this.exportSingleValue(
2596
+ this.createPFrame(this.importObjectViaJson(o)),
2597
2597
  void 0
2598
- )), r("createPTable", (s) => this.exportSingleValue(
2599
- this.createPTable(this.importObjectViaJson(s)),
2598
+ )), r("createPTable", (o) => this.exportSingleValue(
2599
+ this.createPTable(this.importObjectViaJson(o)),
2600
2600
  void 0
2601
2601
  )), this.vm.setProp(this.vm.global, "cfgRenderCtx", t);
2602
2602
  });
2603
2603
  }
2604
2604
  }
2605
- function bo(o, e, t, r, s = {}) {
2605
+ function bs(s, e, t, r, o = {}) {
2606
2606
  return F.makeRaw((n) => {
2607
- const i = new Fe();
2607
+ const i = new Pe();
2608
2608
  n.addOnDestroy(() => i.dispose());
2609
- const a = i.manage(o.quickJs.newRuntime());
2609
+ const a = i.manage(s.quickJs.newRuntime());
2610
2610
  a.setMemoryLimit(1024 * 640), a.setMaxStackSize(1024 * 320);
2611
- const c = i.manage(a.newContext()), u = new ge(i, c, e, o, n);
2611
+ const c = i.manage(a.newContext()), u = new pe(i, c, e, s, n);
2612
2612
  u.evaluateBundle(r.content);
2613
2613
  const l = u.runCallback(t);
2614
2614
  return u.resetComputableCtx(), {
2615
2615
  ir: u.computablesToResolve,
2616
2616
  postprocessValue: async (p) => {
2617
- for (const [g, m] of Object.entries(p)) u.runCallback(g, m);
2617
+ for (const [g, f] of Object.entries(p)) u.runCallback(g, f);
2618
2618
  return u.importObjectUniversal(l);
2619
2619
  }
2620
2620
  };
2621
- }, s);
2621
+ }, o);
2622
2622
  }
2623
- function Ee(o, e, t, r, s = {}) {
2623
+ function je(s, e, t, r, o = {}) {
2624
2624
  if (ft(t)) {
2625
2625
  if (r === void 0) throw new Error("No code bundle.");
2626
- return bo(o, e, t, r, s);
2627
- } else return Kt(o.driverKit, e, t, s);
2626
+ return bs(s, e, t, r, o);
2627
+ } else return Ut(s.driverKit, e, t, o);
2628
2628
  }
2629
- function wo(o, e, t) {
2629
+ function ws(s, e, t) {
2630
2630
  return F.make(
2631
2631
  (r) => {
2632
- var h, C, I, G, U, H, z, oe;
2633
- const s = r.accessor(o).node(), n = w(s.getKeyValueAsJson(Me)), i = w(s.getKeyValueAsJson(te)), a = w(s.getKeyValueAsJson(re)), c = w(s.getKeyValueAsJson(W)), u = w(
2634
- s.getKeyValueAsJson(le)
2632
+ var b, C, I, G, K, H, z, oe;
2633
+ const o = r.accessor(s).node(), n = w(o.getKeyValueAsJson(Je)), i = w(o.getKeyValueAsJson(ee)), a = w(o.getKeyValueAsJson(te)), c = w(o.getKeyValueAsJson(W)), u = w(
2634
+ o.getKeyValueAsJson(ue)
2635
2635
  ), l = /* @__PURE__ */ new Map();
2636
2636
  for (const { id: k } of N(c)) {
2637
- const J = s.traverse({
2637
+ const J = o.traverse({
2638
2638
  field: P(k, "currentArgs"),
2639
2639
  assertFieldType: "Dynamic",
2640
2640
  errorIfFieldNotSet: !0
2641
2641
  });
2642
2642
  let Y;
2643
- const E = s.traverse({
2643
+ const E = o.traverse({
2644
2644
  field: P(k, "prodArgs"),
2645
2645
  assertFieldType: "Dynamic",
2646
2646
  stableIfNotFound: !0
2647
2647
  });
2648
2648
  if (E !== void 0) {
2649
- const x = s.getField({
2649
+ const x = o.getField({
2650
2650
  field: P(k, "prodOutput"),
2651
2651
  assertFieldType: "Dynamic",
2652
2652
  errorIfFieldNotFound: !0
2653
- }), B = s.getField({
2653
+ }), B = o.getField({
2654
2654
  field: P(k, "prodUiCtx"),
2655
2655
  assertFieldType: "Dynamic",
2656
2656
  errorIfFieldNotFound: !0
@@ -2658,61 +2658,61 @@ function wo(o, e, t) {
2658
2658
  Y = {
2659
2659
  arguments: E.getDataAsJson(),
2660
2660
  stale: J.id !== E.id,
2661
- outputError: x.error !== void 0 || B.error !== void 0 || ((h = x.value) == null ? void 0 : h.getError()) !== void 0 || ((C = B.value) == null ? void 0 : C.getError()) !== void 0,
2662
- outputsError: ((I = x.error) == null ? void 0 : I.getDataAsString()) ?? ((U = (G = x.value) == null ? void 0 : G.getError()) == null ? void 0 : U.getDataAsString()),
2661
+ outputError: x.error !== void 0 || B.error !== void 0 || ((b = x.value) == null ? void 0 : b.getError()) !== void 0 || ((C = B.value) == null ? void 0 : C.getError()) !== void 0,
2662
+ outputsError: ((I = x.error) == null ? void 0 : I.getDataAsString()) ?? ((K = (G = x.value) == null ? void 0 : G.getError()) == null ? void 0 : K.getDataAsString()),
2663
2663
  exportsError: ((H = B.error) == null ? void 0 : H.getDataAsString()) ?? ((oe = (z = B.value) == null ? void 0 : z.getError()) == null ? void 0 : oe.getDataAsString()),
2664
2664
  finished: (x.value !== void 0 && x.value.getIsReadyOrError() || x.error !== void 0 && x.error.getIsReadyOrError()) && (B.value !== void 0 && B.value.getIsReadyOrError() || B.error !== void 0 && B.error.getIsReadyOrError())
2665
2665
  };
2666
2666
  }
2667
2667
  l.set(k, { currentArguments: J.getDataAsJson(), prod: Y });
2668
2668
  }
2669
- const p = ae(c, (k) => l.get(k).currentArguments), g = new Set(u.blocksInLimbo), m = [...N(c)].map(({ id: k, label: J, renderingMode: Y }) => {
2670
- var He, _e, We, ze;
2669
+ const p = ie(c, (k) => l.get(k).currentArguments), g = new Set(u.blocksInLimbo), f = [...N(c)].map(({ id: k, label: J, renderingMode: Y }) => {
2670
+ var Ge, He, _e, We;
2671
2671
  const E = w(l.get(k)), x = w(p.nodes.get(k));
2672
2672
  let B = "NotCalculated";
2673
2673
  E.prod !== void 0 && (g.has(k) ? B = "Limbo" : B = E.prod.finished ? "Done" : "Running");
2674
- const K = s.traverse(
2674
+ const U = o.traverse(
2675
2675
  {
2676
2676
  field: P(k, "blockPack"),
2677
2677
  assertFieldType: "Dynamic",
2678
2678
  errorIfFieldNotSet: !0
2679
2679
  },
2680
- { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2681
- ), L = K == null ? void 0 : K.getDataAsJson(), { sections: ne, inputsValid: y, sdkVersion: O } = pe(L == null ? void 0 : L.config, (me) => {
2682
- const q = Ie(me), Ye = $e(s, k);
2680
+ { field: y.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2681
+ ), L = U == null ? void 0 : U.getDataAsJson(), { sections: se, inputsValid: v, sdkVersion: O } = de(L == null ? void 0 : L.config, (fe) => {
2682
+ const q = Ae(fe), ze = Ue(o, k);
2683
2683
  return {
2684
- sections: Ee(
2684
+ sections: je(
2685
2685
  t,
2686
- Ye,
2686
+ ze,
2687
2687
  q.sections,
2688
2688
  q.code
2689
2689
  ),
2690
- inputsValid: Ee(
2690
+ inputsValid: je(
2691
2691
  t,
2692
- Ye,
2692
+ ze,
2693
2693
  q.inputsValid,
2694
2694
  q.code
2695
2695
  ),
2696
2696
  sdkVersion: q.sdkVersion
2697
2697
  };
2698
- }) || {}, R = pe(
2698
+ }) || {}, R = de(
2699
2699
  L,
2700
- (me) => t.blockUpdateWatcher.get(me.source)
2700
+ (fe) => t.blockUpdateWatcher.get(fe.source)
2701
2701
  );
2702
2702
  return {
2703
2703
  id: k,
2704
2704
  label: J,
2705
2705
  renderingMode: Y,
2706
- stale: ((He = E.prod) == null ? void 0 : He.stale) !== !1 || B === "Limbo",
2706
+ stale: ((Ge = E.prod) == null ? void 0 : Ge.stale) !== !1 || B === "Limbo",
2707
2707
  missingReference: x.missingReferences,
2708
2708
  upstreams: [...p.traverseIdsExcludingRoots("upstream", k)],
2709
2709
  downstreams: [...p.traverseIdsExcludingRoots("downstream", k)],
2710
2710
  calculationStatus: B,
2711
- outputErrors: ((_e = E.prod) == null ? void 0 : _e.outputError) === !0,
2712
- outputsError: (We = E.prod) == null ? void 0 : We.outputsError,
2713
- exportsError: (ze = E.prod) == null ? void 0 : ze.exportsError,
2714
- sections: ne,
2715
- inputsValid: y,
2711
+ outputErrors: ((He = E.prod) == null ? void 0 : He.outputError) === !0,
2712
+ outputsError: (_e = E.prod) == null ? void 0 : _e.outputsError,
2713
+ exportsError: (We = E.prod) == null ? void 0 : We.exportsError,
2714
+ sections: se,
2715
+ inputsValid: v,
2716
2716
  currentBlockPack: L == null ? void 0 : L.source,
2717
2717
  updatedBlockPack: R,
2718
2718
  sdkVersion: O,
@@ -2723,18 +2723,18 @@ function wo(o, e, t) {
2723
2723
  meta: a,
2724
2724
  created: new Date(n),
2725
2725
  lastModified: new Date(i),
2726
- authorMarker: s.getKeyValueAsJson(Oe),
2727
- blocks: m
2726
+ authorMarker: o.getKeyValueAsJson(Be),
2727
+ blocks: f
2728
2728
  };
2729
2729
  },
2730
2730
  {
2731
2731
  postprocessValue: (r) => {
2732
- const s = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
2732
+ const o = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
2733
2733
  return {
2734
2734
  ...r,
2735
2735
  blocks: r.blocks.map((i) => {
2736
- i.inputsValid || s.add(i.id), i.stale && n.add(i.id);
2737
- const a = i.stale || i.upstreams.findIndex((u) => n.has(u)) !== -1, c = (a || i.outputErrors) && !!i.inputsValid && !i.missingReference && i.upstreams.findIndex((u) => s.has(u)) === -1;
2736
+ i.inputsValid || o.add(i.id), i.stale && n.add(i.id);
2737
+ 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;
2738
2738
  return { ...i, canRun: c, stale: a };
2739
2739
  })
2740
2740
  };
@@ -2742,22 +2742,22 @@ function wo(o, e, t) {
2742
2742
  }
2743
2743
  ).withStableType();
2744
2744
  }
2745
- function Gt(o, e) {
2745
+ function Gt(s, e) {
2746
2746
  var t, r;
2747
- return pe(
2748
- (r = (t = o.traverse(
2747
+ return de(
2748
+ (r = (t = s.traverse(
2749
2749
  {
2750
2750
  field: P(e, "blockPack"),
2751
2751
  assertFieldType: "Dynamic",
2752
2752
  errorIfFieldNotSet: !0
2753
2753
  },
2754
- { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2754
+ { field: y.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2755
2755
  )) == null ? void 0 : t.getDataAsJson()) == null ? void 0 : r.config,
2756
- (s) => Ie(s)
2756
+ (o) => Ae(o)
2757
2757
  );
2758
2758
  }
2759
- function So(o, e) {
2760
- const t = o.node();
2759
+ function Ss(s, e) {
2760
+ const t = s.node();
2761
2761
  if ($(t.resourceType, Dt)) {
2762
2762
  const r = t.getDataAsJson();
2763
2763
  if (r === void 0) throw new Error("No resource data.");
@@ -2773,10 +2773,10 @@ function So(o, e) {
2773
2773
  } else
2774
2774
  throw new Error(`Unsupported resource type: ${JSON.stringify(t.resourceType)}`);
2775
2775
  }
2776
- function ko(o, e) {
2777
- if (o !== void 0)
2776
+ function ks(s, e) {
2777
+ if (s !== void 0)
2778
2778
  return F.make(
2779
- (t) => So(t.accessor(o), e),
2779
+ (t) => Ss(t.accessor(s), e),
2780
2780
  {
2781
2781
  postprocessValue: (t) => {
2782
2782
  if (t !== void 0) {
@@ -2788,89 +2788,89 @@ function ko(o, e) {
2788
2788
  }
2789
2789
  ).withStableType();
2790
2790
  }
2791
- function Co(o, e, t) {
2791
+ function Cs(s, e, t) {
2792
2792
  return F.make(
2793
2793
  (r) => {
2794
2794
  var a;
2795
- const s = r.accessor(o).node(), n = Gt(s, e), i = (a = s.traverse(
2795
+ const o = r.accessor(s).node(), n = Gt(o, e), i = (a = o.traverse(
2796
2796
  {
2797
2797
  field: P(e, "blockPack"),
2798
2798
  assertFieldType: "Dynamic"
2799
2799
  },
2800
- { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 },
2801
- { field: Tt, assertFieldType: "Input" }
2800
+ { field: y.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 },
2801
+ { field: jt, assertFieldType: "Input" }
2802
2802
  )) == null ? void 0 : a.persist();
2803
- return { path: ko(i, t), sdkVersion: n == null ? void 0 : n.sdkVersion };
2803
+ return { path: ks(i, t), sdkVersion: n == null ? void 0 : n.sdkVersion };
2804
2804
  },
2805
2805
  { mode: "StableOnlyLive" }
2806
2806
  );
2807
2807
  }
2808
- function Po(o, e, t) {
2808
+ function Ps(s, e, t) {
2809
2809
  return F.make(
2810
2810
  (r) => {
2811
- const s = r.accessor(o).node(), n = $e(s, e);
2811
+ const o = r.accessor(s).node(), n = Ue(o, e);
2812
2812
  return {
2813
- author: s.getKeyValueAsJson(Be(e)),
2813
+ author: o.getKeyValueAsJson(Re(e)),
2814
2814
  args: JSON.parse(n.args),
2815
2815
  ui: n.uiState !== void 0 ? JSON.parse(n.uiState) : void 0
2816
2816
  };
2817
2817
  },
2818
- { key: "inputs#" + bt(o.rid) + e }
2818
+ { key: "inputs#" + bt(s.rid) + e }
2819
2819
  );
2820
2820
  }
2821
- function Fo(o, e, t) {
2821
+ function Fs(s, e, t) {
2822
2822
  return F.make(
2823
2823
  (r) => {
2824
- const s = r.accessor(o).node(), n = Nt(s, e), i = Gt(s, e);
2825
- return pe(i, (a) => {
2824
+ const o = r.accessor(s).node(), n = Nt(o, e), i = Gt(o, e);
2825
+ return de(i, (a) => {
2826
2826
  const c = {};
2827
2827
  for (const [u, l] of Object.entries(a.outputs))
2828
2828
  c[u] = F.wrapError(
2829
- Ee(t, n, l, a.code)
2829
+ je(t, n, l, a.code)
2830
2830
  );
2831
2831
  return c;
2832
2832
  });
2833
2833
  },
2834
- { key: "outputs#" + bt(o.rid) + e }
2834
+ { key: "outputs#" + bt(s.rid) + e }
2835
2835
  ).withStableType();
2836
2836
  }
2837
- function Ro(o, e) {
2837
+ function Rs(s, e) {
2838
2838
  return F.make((t) => {
2839
- const r = t.accessor(o).node(), s = w(r.getKeyValueAsJson(W)), n = [];
2840
- for (const { id: i, renderingMode: a } of N(s)) {
2839
+ const r = t.accessor(s).node(), o = w(r.getKeyValueAsJson(W)), n = [];
2840
+ for (const { id: i, renderingMode: a } of N(o)) {
2841
2841
  const c = r.traverse(
2842
2842
  {
2843
2843
  field: P(i, "blockPack"),
2844
2844
  assertFieldType: "Dynamic",
2845
2845
  errorIfFieldNotSet: !0
2846
2846
  },
2847
- { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2847
+ { field: y.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2848
2848
  ), u = c == null ? void 0 : c.getDataAsJson();
2849
2849
  if ((u == null ? void 0 : u.config) === void 0) continue;
2850
- const l = Ie(u.config), p = Object.entries(l.outputs).map(([, m]) => m).filter((m) => !ft(m) && Ks(m)).map((m) => m);
2850
+ const l = Ae(u.config), p = Object.entries(l.outputs).map(([, f]) => f).filter((f) => !ft(f) && $o(f)).map((f) => f);
2851
2851
  if (p.length === 0) continue;
2852
2852
  const g = Nt(r, i);
2853
- for (const m of p)
2854
- n.push(F.wrapError(Kt(e.driverKit, g, m)));
2853
+ for (const f of p)
2854
+ n.push(F.wrapError(Ut(e.driverKit, g, f)));
2855
2855
  }
2856
2856
  return n;
2857
2857
  });
2858
2858
  }
2859
- class Bo {
2859
+ class Bs {
2860
2860
  constructor() {
2861
2861
  d(this, "states", /* @__PURE__ */ new Map());
2862
2862
  }
2863
2863
  setState(e, t) {
2864
2864
  const r = this.states.get(e);
2865
2865
  if (r === void 0) {
2866
- this.states.set(e, { state: t, change: new Xe() });
2866
+ this.states.set(e, { state: t, change: new Ze() });
2867
2867
  return;
2868
2868
  }
2869
2869
  r.state = { ...t }, r.change.markChanged();
2870
2870
  }
2871
2871
  readState(e, t) {
2872
2872
  let r = this.states.get(t);
2873
- return r === void 0 && (r = { state: { ...Zt }, change: new Xe() }, this.states.set(t, r)), r.change.attachWatcher(e.watcher), r.state;
2873
+ return r === void 0 && (r = { state: { ...Zt }, change: new Ze() }, this.states.set(t, r)), r.change.attachWatcher(e.watcher), r.state;
2874
2874
  }
2875
2875
  getState(e) {
2876
2876
  return F.make(
@@ -2883,29 +2883,29 @@ class Bo {
2883
2883
  t !== void 0 && (this.states.delete(e), t.change.markChanged());
2884
2884
  }
2885
2885
  }
2886
- class Ge {
2886
+ class $e {
2887
2887
  constructor(e, t, r) {
2888
2888
  /** Underlying pl resource id */
2889
2889
  d(this, "rid");
2890
2890
  /** Data for the left panel, contain basic information about block status. */
2891
2891
  d(this, "overview");
2892
- d(this, "navigationStates", new Bo());
2892
+ d(this, "navigationStates", new Bs());
2893
2893
  d(this, "blockComputables", /* @__PURE__ */ new Map());
2894
2894
  d(this, "blockFrontends", /* @__PURE__ */ new Map());
2895
2895
  d(this, "activeConfigs");
2896
2896
  d(this, "refreshLoopResult");
2897
2897
  d(this, "abortController", new AbortController());
2898
2898
  d(this, "destroyed", !1);
2899
- this.env = e, this.projectTree = r, this.overview = wo(
2899
+ this.env = e, this.projectTree = r, this.overview = ws(
2900
2900
  r.entry(),
2901
2901
  this.navigationStates,
2902
2902
  e
2903
- ).withPreCalculatedValueTree(), this.rid = t, this.refreshLoopResult = this.refreshLoop(), this.activeConfigs = Ro(r.entry(), e);
2903
+ ).withPreCalculatedValueTree(), this.rid = t, this.refreshLoopResult = this.refreshLoop(), this.activeConfigs = Rs(r.entry(), e);
2904
2904
  }
2905
2905
  async refreshLoop() {
2906
2906
  for (; !this.destroyed; )
2907
2907
  try {
2908
- await Se(this.env.pl, this.rid, (e) => {
2908
+ await we(this.env.pl, this.rid, (e) => {
2909
2909
  e.doRefresh(this.env.ops.stagingRenderingRate);
2910
2910
  }), await this.activeConfigs.getValue(), await kt(this.env.ops.projectRefreshInterval, this.abortController.signal);
2911
2911
  } catch (e) {
@@ -2929,12 +2929,12 @@ class Ge {
2929
2929
  *
2930
2930
  * @return returns newly created block id
2931
2931
  * */
2932
- async addBlock(e, t, r, s = void 0, n = ee()) {
2932
+ async addBlock(e, t, r, o = void 0, n = X()) {
2933
2933
  const i = await this.env.bpPreparer.prepare(t), a = await this.env.bpPreparer.getBlockConfig(t);
2934
2934
  return await V(
2935
2935
  this.env.pl,
2936
2936
  this.rid,
2937
- s,
2937
+ o,
2938
2938
  (c) => c.addBlock(
2939
2939
  {
2940
2940
  id: n,
@@ -2953,12 +2953,12 @@ class Ge {
2953
2953
  * Update block to new block pack, optionally resetting args and ui state to
2954
2954
  * initial values
2955
2955
  * */
2956
- async updateBlockPack(e, t, r = !1, s) {
2956
+ async updateBlockPack(e, t, r = !1, o) {
2957
2957
  const n = await this.env.bpPreparer.prepare(t), i = await this.env.bpPreparer.getBlockConfig(t);
2958
2958
  await V(
2959
2959
  this.env.pl,
2960
2960
  this.rid,
2961
- s,
2961
+ o,
2962
2962
  (a) => a.migrateBlockPack(
2963
2963
  e,
2964
2964
  n,
@@ -2978,10 +2978,10 @@ class Ge {
2978
2978
  */
2979
2979
  async reorderBlocks(e, t) {
2980
2980
  await V(this.env.pl, this.rid, t, (r) => {
2981
- const s = r.structure;
2982
- if (s.groups.length !== 1)
2981
+ const o = r.structure;
2982
+ if (o.groups.length !== 1)
2983
2983
  throw new Error("Unexpected project structure, non-sinular block group");
2984
- const n = s.groups[0];
2984
+ const n = o.groups[0];
2985
2985
  if (n.blocks.length !== e.length)
2986
2986
  throw new Error(`Lengh mismatch: ${n.blocks.length} !== ${e.length}`);
2987
2987
  if (new Set(e).size !== e.length) throw new Error("Repeated block ids");
@@ -3007,7 +3007,7 @@ class Ge {
3007
3007
  * stale state.
3008
3008
  * */
3009
3009
  async runBlock(e) {
3010
- await Se(this.env.pl, this.rid, (t) => t.renderProduction([e], !0)), await this.projectTree.refreshState();
3010
+ await we(this.env.pl, this.rid, (t) => t.renderProduction([e], !0)), await this.projectTree.refreshState();
3011
3011
  }
3012
3012
  /**
3013
3013
  * Stops the block if it is running by destroying its production state. All
@@ -3015,12 +3015,12 @@ class Ge {
3015
3015
  * calculated.
3016
3016
  * */
3017
3017
  async stopBlock(e) {
3018
- await Se(this.env.pl, this.rid, (t) => t.stopProduction(e)), await this.projectTree.refreshState();
3018
+ await we(this.env.pl, this.rid, (t) => t.stopProduction(e)), await this.projectTree.refreshState();
3019
3019
  }
3020
3020
  /** Update block label. */
3021
3021
  async setBlockLabel(e, t, r) {
3022
- await V(this.env.pl, this.rid, r, (s) => {
3023
- s.setBlockLabel(e, t);
3022
+ await V(this.env.pl, this.rid, r, (o) => {
3023
+ o.setBlockLabel(e, t);
3024
3024
  }), await this.projectTree.refreshState();
3025
3025
  }
3026
3026
  /**
@@ -3034,7 +3034,7 @@ class Ge {
3034
3034
  this.env.pl,
3035
3035
  this.rid,
3036
3036
  r,
3037
- (s) => s.setArgs([{ blockId: e, args: JSON.stringify(t) }])
3037
+ (o) => o.setArgs([{ blockId: e, args: JSON.stringify(t) }])
3038
3038
  ), await this.projectTree.refreshState();
3039
3039
  }
3040
3040
  /**
@@ -3048,7 +3048,7 @@ class Ge {
3048
3048
  this.env.pl,
3049
3049
  this.rid,
3050
3050
  r,
3051
- (s) => s.setUiState(e, t === void 0 ? void 0 : JSON.stringify(t))
3051
+ (o) => o.setUiState(e, t === void 0 ? void 0 : JSON.stringify(t))
3052
3052
  ), await this.projectTree.refreshState();
3053
3053
  }
3054
3054
  /**
@@ -3063,18 +3063,18 @@ class Ge {
3063
3063
  * transactionally associated with the block, to facilitate conflict resolution
3064
3064
  * in collaborative editing scenario.
3065
3065
  * */
3066
- async setBlockArgsAndUiState(e, t, r, s) {
3067
- await V(this.env.pl, this.rid, s, (n) => {
3066
+ async setBlockArgsAndUiState(e, t, r, o) {
3067
+ await V(this.env.pl, this.rid, o, (n) => {
3068
3068
  n.setArgs([{ blockId: e, args: JSON.stringify(t) }]), n.setUiState(e, JSON.stringify(r));
3069
3069
  }), await this.projectTree.refreshState();
3070
3070
  }
3071
3071
  /** Resets arguments and ui state of the block to initial state */
3072
3072
  async resetBlockArgsAndUiState(e, t) {
3073
3073
  await this.env.pl.withWriteTx("BlockInputsReset", async (r) => {
3074
- const s = Pe(
3074
+ const o = Ce(
3075
3075
  (await r.getField(S(this.rid, P(e, "blockPack")))).value
3076
- ), n = Pe(
3077
- (await r.getField(S(s, b.HolderRefField))).value
3076
+ ), n = Ce(
3077
+ (await r.getField(S(o, y.HolderRefField))).value
3078
3078
  ), i = await r.getResourceData(n, !1), a = JSON.parse(
3079
3079
  Buffer.from(w(i.data)).toString("utf-8")
3080
3080
  );
@@ -3086,10 +3086,10 @@ class Ge {
3086
3086
  getBlockComputables(e) {
3087
3087
  const t = this.blockComputables.get(e);
3088
3088
  if (t === void 0) {
3089
- const r = Fo(this.projectTree.entry(), e, this.env), n = {
3089
+ const r = Fs(this.projectTree.entry(), e, this.env), n = {
3090
3090
  fullState: F.make(
3091
3091
  (i) => ({
3092
- argsAndUiState: Po(this.projectTree.entry(), e),
3092
+ argsAndUiState: Ps(this.projectTree.entry(), e),
3093
3093
  outputs: r,
3094
3094
  navigationState: this.navigationStates.getState(e)
3095
3095
  }),
@@ -3120,7 +3120,7 @@ class Ge {
3120
3120
  getBlockFrontend(e) {
3121
3121
  const t = this.blockFrontends.get(e);
3122
3122
  if (t === void 0) {
3123
- const r = Co(
3123
+ const r = Cs(
3124
3124
  this.projectTree.entry(),
3125
3125
  e,
3126
3126
  this.env
@@ -3145,27 +3145,27 @@ class Ge {
3145
3145
  t,
3146
3146
  {
3147
3147
  ...e.ops.defaultTreeOptions,
3148
- pruning: Oo
3148
+ pruning: Os
3149
3149
  },
3150
3150
  e.logger
3151
3151
  );
3152
- return new Ge(e, t, r);
3152
+ return new $e(e, t, r);
3153
3153
  }
3154
3154
  }
3155
- function Oo(o) {
3156
- switch (o.type.name) {
3155
+ function Os(s) {
3156
+ switch (s.type.name) {
3157
3157
  case "BlockPackCustom":
3158
- return o.fields.filter((e) => e.name !== "template");
3158
+ return s.fields.filter((e) => e.name !== "template");
3159
3159
  case "UserProject":
3160
- return o.fields.filter((e) => !e.name.startsWith("__serviceTemplate"));
3160
+ return s.fields.filter((e) => !e.name.startsWith("__serviceTemplate"));
3161
3161
  case "Blob":
3162
3162
  return [];
3163
3163
  default:
3164
- return o.fields;
3164
+ return s.fields;
3165
3165
  }
3166
3166
  }
3167
3167
  const Ht = {
3168
- logger: new or(),
3168
+ logger: new sr(),
3169
3169
  blobDriverOps: {
3170
3170
  cacheSoftSizeBytes: 100 * 1024 * 1024,
3171
3171
  // 100MB
@@ -3183,12 +3183,12 @@ const Ht = {
3183
3183
  stopPollingDelay: 1e3
3184
3184
  }
3185
3185
  };
3186
- function _t(o) {
3186
+ function _t(s) {
3187
3187
  return {
3188
- blobDownloadPath: T.join(o, "download")
3188
+ blobDownloadPath: j.join(s, "download")
3189
3189
  };
3190
3190
  }
3191
- const Do = {
3191
+ const Ds = {
3192
3192
  ...Ht,
3193
3193
  defaultTreeOptions: {
3194
3194
  pollingInterval: 350,
@@ -3198,20 +3198,20 @@ const Do = {
3198
3198
  projectRefreshInterval: 700,
3199
3199
  stagingRenderingRate: 5
3200
3200
  };
3201
- function xo(o) {
3201
+ function xs(s) {
3202
3202
  return {
3203
- ..._t(o),
3204
- frontendDownloadPath: T.join(o, "frontend")
3203
+ ..._t(s),
3204
+ frontendDownloadPath: j.join(s, "frontend")
3205
3205
  };
3206
3206
  }
3207
- const jo = {
3207
+ const Ts = {
3208
3208
  minDelay: 1500
3209
- }, To = "__no_updates__";
3210
- class Eo extends mr {
3211
- constructor(t, r, s = {}) {
3212
- super({ ...s, ...jo }, r);
3209
+ }, js = "__no_updates__";
3210
+ class Es extends mr {
3211
+ constructor(t, r, o = {}) {
3212
+ super({ ...o, ...Ts }, r);
3213
3213
  d(this, "http");
3214
- this.registryProvider = t, this.http = s.http;
3214
+ this.registryProvider = t, this.http = o.http;
3215
3215
  }
3216
3216
  getKey(t) {
3217
3217
  switch (t.type) {
@@ -3222,7 +3222,7 @@ class Eo extends mr {
3222
3222
  case "from-registry-v2":
3223
3223
  return `from_registry_v2_${t.registryUrl}_${t.id.organization}_${t.id.name}_${t.id.version}`;
3224
3224
  default:
3225
- return To;
3225
+ return js;
3226
3226
  }
3227
3227
  }
3228
3228
  async readValue(t) {
@@ -3231,42 +3231,42 @@ class Eo extends mr {
3231
3231
  switch (t.type) {
3232
3232
  case "dev-v1":
3233
3233
  try {
3234
- const s = await Pt(t.folder);
3235
- return s === t.mtime ? void 0 : { ...t, mtime: s };
3236
- } catch (s) {
3237
- this.logger.warn(s);
3234
+ const o = await Pt(t.folder);
3235
+ return o === t.mtime ? void 0 : { ...t, mtime: o };
3236
+ } catch (o) {
3237
+ this.logger.warn(o);
3238
3238
  return;
3239
3239
  }
3240
3240
  case "dev-v2":
3241
3241
  try {
3242
- const s = await mt(t.folder, this.logger);
3243
- if (s === void 0) return;
3244
- const n = await Je(s);
3242
+ const o = await mt(t.folder, this.logger);
3243
+ if (o === void 0) return;
3244
+ const n = await Le(o);
3245
3245
  return n === t.mtime ? void 0 : { ...t, mtime: n };
3246
- } catch (s) {
3247
- this.logger.warn(s);
3246
+ } catch (o) {
3247
+ this.logger.warn(o);
3248
3248
  return;
3249
3249
  }
3250
3250
  case "from-registry-v2":
3251
3251
  try {
3252
- const s = this.registryProvider.getRegistry(t.registryUrl), n = (r = await s.getOverviewForSpec(t.id)) == null ? void 0 : r.spec;
3252
+ const o = this.registryProvider.getRegistry(t.registryUrl), n = (r = await o.getOverviewForSpec(t.id)) == null ? void 0 : r.spec;
3253
3253
  if ((n == null ? void 0 : n.type) !== "from-registry-v2") throw new Error("Unexpected");
3254
- return ve(n.id, t.id) ? void 0 : ((async () => {
3254
+ return me(n.id, t.id) ? void 0 : ((async () => {
3255
3255
  try {
3256
- await s.getComponents(n.id);
3256
+ await o.getComponents(n.id);
3257
3257
  } catch (i) {
3258
3258
  this.logger.warn(i);
3259
3259
  }
3260
3260
  })(), n);
3261
- } catch (s) {
3262
- this.logger.warn(s);
3261
+ } catch (o) {
3262
+ this.logger.warn(o);
3263
3263
  return;
3264
3264
  }
3265
3265
  default:
3266
3266
  return;
3267
3267
  }
3268
- } catch (s) {
3269
- this.logger.warn(s);
3268
+ } catch (o) {
3269
+ this.logger.warn(o);
3270
3270
  return;
3271
3271
  }
3272
3272
  }
@@ -3275,9 +3275,9 @@ class Eo extends mr {
3275
3275
  if (t === void 0 || r === void 0 || t.type !== r.type) return !1;
3276
3276
  switch (t.type) {
3277
3277
  case "from-registry-v1":
3278
- return r.type !== "from-registry-v1" ? !1 : t.registryUrl === r.registryUrl && ve(t.id, r.id);
3278
+ return r.type !== "from-registry-v1" ? !1 : t.registryUrl === r.registryUrl && me(t.id, r.id);
3279
3279
  case "from-registry-v2":
3280
- return r.type !== "from-registry-v2" ? !1 : t.registryUrl === r.registryUrl && ve(t.id, r.id);
3280
+ return r.type !== "from-registry-v2" ? !1 : t.registryUrl === r.registryUrl && me(t.id, r.id);
3281
3281
  case "dev-v1":
3282
3282
  return r.type !== "dev-v1" ? !1 : t.folder === r.folder && t.mtime === r.mtime;
3283
3283
  case "dev-v2":
@@ -3287,7 +3287,7 @@ class Eo extends mr {
3287
3287
  }
3288
3288
  }
3289
3289
  }
3290
- class pt {
3290
+ class dt {
3291
3291
  constructor() {
3292
3292
  d(this, "resources", /* @__PURE__ */ new Map());
3293
3293
  }
@@ -3304,12 +3304,12 @@ class pt {
3304
3304
  const t = this.calculateParamsKey(e);
3305
3305
  let r = this.resources.get(t);
3306
3306
  r === void 0 && (r = { refCount: 0, resource: this.createNewResource(e) }, this.resources.set(t, r)), r.refCount++;
3307
- let s = !1;
3307
+ let o = !1;
3308
3308
  return {
3309
3309
  resource: r.resource,
3310
3310
  key: t,
3311
3311
  unref: () => {
3312
- s || (r.refCount--, s = !0, this.check(t));
3312
+ o || (r.refCount--, o = !0, this.check(t));
3313
3313
  }
3314
3314
  };
3315
3315
  }
@@ -3322,12 +3322,12 @@ class pt {
3322
3322
  return (t = this.resources.get(e)) == null ? void 0 : t.resource;
3323
3323
  }
3324
3324
  }
3325
- function gt(o) {
3326
- return String(o.id);
3325
+ function pt(s) {
3326
+ return String(s.id);
3327
3327
  }
3328
- class Ao {
3328
+ class As {
3329
3329
  constructor(e, t, r) {
3330
- d(this, "pFrame", new jr());
3330
+ d(this, "pFrame", new Tr());
3331
3331
  d(this, "blobIdToResource", /* @__PURE__ */ new Map());
3332
3332
  d(this, "blobHandleComputables", /* @__PURE__ */ new Map());
3333
3333
  d(this, "preloadBlob", async (e) => {
@@ -3343,14 +3343,14 @@ class Ao {
3343
3343
  return await this.blobContentCache.forceFetch(r);
3344
3344
  });
3345
3345
  this.blobDriver = e, this.blobContentCache = t, this.columns = r, this.pFrame.setDataSource(this);
3346
- for (const s of r) {
3347
- for (const i of js(s.data)) this.blobIdToResource.set(gt(i), i);
3348
- const n = Ts(s.data, gt);
3346
+ for (const o of r) {
3347
+ for (const i of jo(o.data)) this.blobIdToResource.set(pt(i), i);
3348
+ const n = Eo(o.data, pt);
3349
3349
  try {
3350
- this.pFrame.addColumnSpec(s.id, s.spec), this.pFrame.setColumnData(s.id, n);
3350
+ this.pFrame.addColumnSpec(o.id, o.spec), this.pFrame.setColumnData(o.id, n);
3351
3351
  } catch (i) {
3352
3352
  throw new Error(
3353
- `Adding column ${s.id} to PFrame failed: ${i}; Spec: ${s.spec}, DataInfo: ${n}.`
3353
+ `Adding column ${o.id} to PFrame failed: ${i}; Spec: ${o.spec}, DataInfo: ${n}.`
3354
3354
  );
3355
3355
  }
3356
3356
  }
@@ -3367,7 +3367,7 @@ class Ao {
3367
3367
  this.pFrame.dispose();
3368
3368
  }
3369
3369
  }
3370
- class Io {
3370
+ class Is {
3371
3371
  constructor(e) {
3372
3372
  d(this, "pFrames");
3373
3373
  d(this, "pTables");
@@ -3375,37 +3375,37 @@ class Io {
3375
3375
  /** Limits concurrent requests to PFrame API to prevent deadlock with Node's IO threads */
3376
3376
  d(this, "concurrencyLimiter");
3377
3377
  this.blobDriver = e;
3378
- const t = new Tr({
3378
+ const t = new jr({
3379
3379
  maxSize: 1e9,
3380
3380
  // 1Gb
3381
- fetchMethod: async (s) => await yt.readFile(s),
3382
- sizeCalculation: (s) => s.length
3381
+ fetchMethod: async (o) => await yt.readFile(o),
3382
+ sizeCalculation: (o) => o.length
3383
3383
  }), r = new nr(1);
3384
- this.blobContentCache = t, this.concurrencyLimiter = r, this.pFrames = new class extends pt {
3385
- constructor(s) {
3386
- super(), this.blobDriver = s;
3384
+ this.blobContentCache = t, this.concurrencyLimiter = r, this.pFrames = new class extends dt {
3385
+ constructor(o) {
3386
+ super(), this.blobDriver = o;
3387
3387
  }
3388
- createNewResource(s) {
3389
- return new Ao(this.blobDriver, t, s);
3388
+ createNewResource(o) {
3389
+ return new As(this.blobDriver, t, o);
3390
3390
  }
3391
- calculateParamsKey(s) {
3392
- return No(s);
3391
+ calculateParamsKey(o) {
3392
+ return Ns(o);
3393
3393
  }
3394
- }(this.blobDriver), this.pTables = new class extends pt {
3395
- constructor(s) {
3396
- super(), this.pFrames = s;
3394
+ }(this.blobDriver), this.pTables = new class extends dt {
3395
+ constructor(o) {
3396
+ super(), this.pFrames = o;
3397
3397
  }
3398
- async createNewResource(s) {
3399
- const n = this.pFrames.getByKey(s.pFrameHandle), i = await r.run(
3398
+ async createNewResource(o) {
3399
+ const n = this.pFrames.getByKey(o.pFrameHandle), i = await r.run(
3400
3400
  async () => await n.pFrame.createTable({
3401
- src: X(s.def.src),
3402
- filters: s.def.filters
3401
+ src: Z(o.def.src),
3402
+ filters: o.def.filters
3403
3403
  })
3404
3404
  );
3405
- return s.def.sorting.length !== 0 ? i.sort(s.def.sorting) : i;
3405
+ return o.def.sorting.length !== 0 ? i.sort(o.def.sorting) : i;
3406
3406
  }
3407
- calculateParamsKey(s) {
3408
- return Vo(s);
3407
+ calculateParamsKey(o) {
3408
+ return Vs(o);
3409
3409
  }
3410
3410
  }(this.pFrames);
3411
3411
  }
@@ -3413,11 +3413,11 @@ class Io {
3413
3413
  // Internal / Config API Methods
3414
3414
  //
3415
3415
  createPFrame(e, t) {
3416
- const r = e.map((n) => Z(n, (i) => Ls(i))), s = this.pFrames.acquire(r);
3417
- return t.addOnDestroy(s.unref), s.key;
3416
+ const r = e.map((n) => Q(n, (i) => Jo(i))), o = this.pFrames.acquire(r);
3417
+ return t.addOnDestroy(o.unref), o.key;
3418
3418
  }
3419
3419
  createPTable(e, t) {
3420
- const r = this.createPFrame(Lo(e.src), t), s = ht(e, (i) => i.id), n = this.pTables.acquire({ def: s, pFrameHandle: r });
3420
+ const r = this.createPFrame(Ls(e.src), t), o = ht(e, (i) => i.id), n = this.pTables.acquire({ def: o, pFrameHandle: r });
3421
3421
  return t.addOnDestroy(n.unref), n.key;
3422
3422
  }
3423
3423
  //
@@ -3431,7 +3431,7 @@ class Io {
3431
3431
  return {
3432
3432
  hits: (await this.concurrencyLimiter.run(
3433
3433
  async () => await this.pFrames.getByKey(e).pFrame.findColumns(r)
3434
- )).hits.map((s) => s.hit)
3434
+ )).hits.map((o) => o.hit)
3435
3435
  };
3436
3436
  }
3437
3437
  async getColumnSpec(e, t) {
@@ -3447,7 +3447,7 @@ class Io {
3447
3447
  async calculateTableData(e, t) {
3448
3448
  let r = await this.concurrencyLimiter.run(
3449
3449
  async () => await this.pFrames.getByKey(e).pFrame.createTable({
3450
- src: X(t.src),
3450
+ src: Z(t.src),
3451
3451
  filters: t.filters
3452
3452
  })
3453
3453
  );
@@ -3457,10 +3457,10 @@ class Io {
3457
3457
  );
3458
3458
  r.dispose(), r = i;
3459
3459
  }
3460
- const s = r.getSpec(), n = await this.concurrencyLimiter.run(
3461
- async () => await r.getData([...s.keys()])
3460
+ const o = r.getSpec(), n = await this.concurrencyLimiter.run(
3461
+ async () => await r.getData([...o.keys()])
3462
3462
  );
3463
- return r.dispose(), s.map((i, a) => ({
3463
+ return r.dispose(), o.map((i, a) => ({
3464
3464
  spec: i,
3465
3465
  data: n[a]
3466
3466
  }));
@@ -3480,105 +3480,105 @@ class Io {
3480
3480
  return (await this.pTables.getByKey(e)).getSpec();
3481
3481
  }
3482
3482
  async getData(e, t, r) {
3483
- const s = await this.pTables.getByKey(e);
3483
+ const o = await this.pTables.getByKey(e);
3484
3484
  return await this.concurrencyLimiter.run(
3485
- async () => await s.getData(t, r)
3485
+ async () => await o.getData(t, r)
3486
3486
  );
3487
3487
  }
3488
3488
  }
3489
- function X(o) {
3490
- switch (o.type) {
3489
+ function Z(s) {
3490
+ switch (s.type) {
3491
3491
  case "column":
3492
3492
  return {
3493
3493
  type: "column",
3494
- columnId: o.column,
3494
+ columnId: s.column,
3495
3495
  qualifications: []
3496
3496
  };
3497
3497
  case "inner":
3498
3498
  case "full":
3499
3499
  return {
3500
- type: o.type,
3501
- entries: o.entries.map((e) => X(e))
3500
+ type: s.type,
3501
+ entries: s.entries.map((e) => Z(e))
3502
3502
  };
3503
3503
  case "outer":
3504
3504
  return {
3505
3505
  type: "outer",
3506
- primary: X(o.primary),
3507
- secondary: o.secondary.map((e) => X(e))
3506
+ primary: Z(s.primary),
3507
+ secondary: s.secondary.map((e) => Z(e))
3508
3508
  };
3509
3509
  default:
3510
- D(o);
3510
+ D(s);
3511
3511
  }
3512
3512
  }
3513
- function Vo(o) {
3514
- const e = he("sha256");
3515
- return e.update(o.pFrameHandle), e.update(Ve(o.def)), e.digest().toString("hex");
3513
+ function Vs(s) {
3514
+ const e = ge("sha256");
3515
+ return e.update(s.pFrameHandle), e.update(Ie(s.def)), e.digest().toString("hex");
3516
3516
  }
3517
- function No(o) {
3518
- const e = o.map((s) => s.id).sort(), t = he("sha256");
3517
+ function Ns(s) {
3518
+ const e = s.map((o) => o.id).sort(), t = ge("sha256");
3519
3519
  let r = "";
3520
- for (const s of e)
3521
- r !== s && (t.update(s), r = s);
3520
+ for (const o of e)
3521
+ r !== o && (t.update(o), r = o);
3522
3522
  return t.digest().toString("hex");
3523
3523
  }
3524
- function Lo(o) {
3524
+ function Ls(s) {
3525
3525
  const e = /* @__PURE__ */ new Map();
3526
- return ce(o, e), [...e.values()];
3526
+ return ae(s, e), [...e.values()];
3527
3527
  }
3528
- function ce(o, e) {
3529
- switch (o.type) {
3528
+ function ae(s, e) {
3529
+ switch (s.type) {
3530
3530
  case "column":
3531
- e.set(o.column.id, o.column);
3531
+ e.set(s.column.id, s.column);
3532
3532
  return;
3533
3533
  case "full":
3534
3534
  case "inner":
3535
- for (const t of o.entries) ce(t, e);
3535
+ for (const t of s.entries) ae(t, e);
3536
3536
  return;
3537
3537
  case "outer":
3538
- ce(o.primary, e);
3539
- for (const t of o.secondary) ce(t, e);
3538
+ ae(s.primary, e);
3539
+ for (const t of s.secondary) ae(t, e);
3540
3540
  return;
3541
3541
  default:
3542
- D(o);
3542
+ D(s);
3543
3543
  }
3544
3544
  }
3545
- async function Jo(o, e, t) {
3545
+ async function Js(s, e, t) {
3546
3546
  const r = {
3547
3547
  ...Ht,
3548
3548
  ..._t(e),
3549
3549
  ...t
3550
- }, s = new vt(r.localSecret), n = Sr(r.logger, o, r.localProjections), i = kr(o, r.logger), a = Cr(o, r.logger), c = Pr(o, r.logger), u = new Fr(
3550
+ }, o = new vt(r.localSecret), n = Sr(r.logger, s, r.localProjections), i = kr(s, r.logger), a = Cr(s, r.logger), c = Pr(s, r.logger), u = new Fr(
3551
3551
  r.logger,
3552
3552
  n,
3553
3553
  i,
3554
3554
  r.blobDownloadPath,
3555
- s,
3555
+ o,
3556
3556
  r.blobDriverOps
3557
3557
  ), l = new Rr(
3558
3558
  r.logger,
3559
- s,
3559
+ o,
3560
3560
  a,
3561
3561
  c,
3562
3562
  r.uploadDriverOps
3563
- ), p = new Br(r.logger, i, r.logStreamDriverOps), g = new Or(r.logger, p, u), m = await Dr.init(
3563
+ ), p = new Br(r.logger, i, r.logStreamDriverOps), g = new Or(r.logger, p, u), f = await Dr.init(
3564
3564
  r.logger,
3565
- o,
3566
3565
  s,
3566
+ o,
3567
3567
  r.localProjections,
3568
3568
  r.openFileDialogCallback,
3569
3569
  r.virtualLocalStoragesOverride
3570
- ), h = new Io(u);
3570
+ ), b = new Is(u);
3571
3571
  return {
3572
3572
  blobDriver: u,
3573
3573
  logDriver: g,
3574
- lsDriver: m,
3575
- signer: s,
3574
+ lsDriver: f,
3575
+ signer: o,
3576
3576
  uploadDriver: l,
3577
- pFrameDriver: h
3577
+ pFrameDriver: b
3578
3578
  };
3579
3579
  }
3580
3580
  class Wt {
3581
- constructor(e, t, r, s, n, i, a, c) {
3581
+ constructor(e, t, r, o, n, i, a, c) {
3582
3582
  d(this, "pl");
3583
3583
  /** Contains a reactive list of projects along with their meta information. */
3584
3584
  d(this, "projectList");
@@ -3586,7 +3586,7 @@ class Wt {
3586
3586
  // Projects
3587
3587
  //
3588
3588
  d(this, "openedProjectsByRid", /* @__PURE__ */ new Map());
3589
- this.env = e, this.driverKit = t, this.signer = r, this.projectListResourceId = s, this.openedProjectsList = n, this.projectListTree = i, this.blockRegistryProvider = a, this.projectList = c, this.pl = this.env.pl;
3589
+ 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;
3590
3590
  }
3591
3591
  /** Returns extended API driver kit used internally by middle layer. */
3592
3592
  get internalDriverKit() {
@@ -3596,17 +3596,17 @@ class Wt {
3596
3596
  // Project List Manipulation
3597
3597
  //
3598
3598
  /** Creates a project with initial state and adds it to project list. */
3599
- async createProject(e, t = ee()) {
3600
- const r = await this.pl.withWriteTx("MLCreateProject", async (s) => {
3601
- const n = await xs(s, e);
3602
- return s.createField(S(this.projectListResourceId, t), "Dynamic", n), await s.commit(), await gr(n);
3599
+ async createProject(e, t = X()) {
3600
+ const r = await this.pl.withWriteTx("MLCreateProject", async (o) => {
3601
+ const n = await To(o, e);
3602
+ return o.createField(S(this.projectListResourceId, t), "Dynamic", n), await o.commit(), await gr(n);
3603
3603
  });
3604
3604
  return await this.projectListTree.refreshState(), r;
3605
3605
  }
3606
3606
  /** Updates project metadata */
3607
3607
  async setProjectMeta(e, t, r) {
3608
- await V(this.pl, e, r, async (s) => {
3609
- s.setMeta(t);
3608
+ await V(this.pl, e, r, async (o) => {
3609
+ o.setMeta(t);
3610
3610
  }), await this.projectListTree.refreshState();
3611
3611
  }
3612
3612
  /** Permanently deletes project from the project list, this will result in
@@ -3619,7 +3619,7 @@ class Wt {
3619
3619
  async projectIdToResourceId(e) {
3620
3620
  return await this.pl.withReadTx("Project id to resource id", async (t) => {
3621
3621
  const r = (await t.getField(S(this.projectListResourceId, e))).value;
3622
- if (ue(r)) throw new Error("Unexpected project list structure.");
3622
+ if (ce(r)) throw new Error("Unexpected project list structure.");
3623
3623
  return r;
3624
3624
  });
3625
3625
  }
@@ -3630,7 +3630,7 @@ class Wt {
3630
3630
  async openProject(e) {
3631
3631
  const t = await this.ensureProjectRid(e);
3632
3632
  if (this.openedProjectsByRid.has(t)) throw new Error(`Project ${t} already opened`);
3633
- this.openedProjectsByRid.set(t, await Ge.init(this.env, t)), this.openedProjectsList.setValue([...this.openedProjectsByRid.keys()]);
3633
+ this.openedProjectsByRid.set(t, await $e.init(this.env, t)), this.openedProjectsList.setValue([...this.openedProjectsByRid.keys()]);
3634
3634
  }
3635
3635
  /** Closes the project, and deallocate all corresponding resources. */
3636
3636
  async closeProject(e) {
@@ -3662,61 +3662,61 @@ class Wt {
3662
3662
  }
3663
3663
  /** Initialize middle layer */
3664
3664
  static async init(e, t, r) {
3665
- const s = {
3666
- ...Do,
3667
- ...xo(t),
3665
+ const o = {
3666
+ ...Ds,
3667
+ ...xs(t),
3668
3668
  ...r
3669
3669
  };
3670
- process.env.MI_LOG_TREE_STAT && (s.defaultTreeOptions.logStat = process.env.MI_LOG_TREE_STAT === "cumulative" ? "cumulative" : "per-request");
3670
+ process.env.MI_LOG_TREE_STAT && (o.defaultTreeOptions.logStat = process.env.MI_LOG_TREE_STAT === "cumulative" ? "cumulative" : "per-request");
3671
3671
  const n = await e.withWriteTx("MLInitialization", async (C) => {
3672
3672
  const I = S(C.clientRoot, Zr);
3673
3673
  C.createField(I, "Dynamic");
3674
3674
  const G = await C.getField(I);
3675
- if (ue(G.value)) {
3676
- const U = C.createEphemeral(Bt);
3677
- return C.lock(U), C.setField(I, U), await C.commit(), await U.globalId;
3675
+ if (ce(G.value)) {
3676
+ const K = C.createEphemeral(Bt);
3677
+ return C.lock(K), C.setField(I, K), await C.commit(), await K.globalId;
3678
3678
  } else
3679
3679
  return G.value;
3680
- }), i = s.logger, a = await Jo(e, t, s), c = new Xt(e.httpDispatcher, {
3680
+ }), i = o.logger, a = await Js(e, t, o), c = new Xt(e.httpDispatcher, {
3681
3681
  minTimeout: 250,
3682
3682
  maxRetries: 4
3683
- }), u = new Mr(c), l = new Cs(
3683
+ }), u = new Mr(c), l = new Po(
3684
3684
  u,
3685
3685
  a.signer,
3686
3686
  c
3687
3687
  ), p = new xr(
3688
3688
  i,
3689
3689
  e.httpDispatcher,
3690
- s.frontendDownloadPath
3690
+ o.frontendDownloadPath
3691
3691
  ), g = {
3692
3692
  pl: e,
3693
3693
  signer: a.signer,
3694
3694
  logger: i,
3695
3695
  httpDispatcher: e.httpDispatcher,
3696
3696
  retryHttpDispatcher: c,
3697
- ops: s,
3697
+ ops: o,
3698
3698
  bpPreparer: l,
3699
3699
  frontendDownloadDriver: p,
3700
3700
  driverKit: a,
3701
- blockUpdateWatcher: new Eo(u, i, {
3702
- minDelay: s.devBlockUpdateRecheckInterval,
3701
+ blockUpdateWatcher: new Es(u, i, {
3702
+ minDelay: o.devBlockUpdateRecheckInterval,
3703
3703
  http: c
3704
3704
  }),
3705
3705
  quickJs: await wr()
3706
- }, m = new vr([]), h = await es(e, n, m, g);
3706
+ }, f = new vr([]), b = await eo(e, n, f, g);
3707
3707
  return new Wt(
3708
3708
  g,
3709
3709
  a,
3710
3710
  a.signer,
3711
3711
  n,
3712
- m,
3713
- h.tree,
3712
+ f,
3713
+ b.tree,
3714
3714
  u,
3715
- h.computable
3715
+ b.computable
3716
3716
  );
3717
3717
  }
3718
3718
  }
3719
- async function fn(o, e = {}) {
3719
+ async function mn(s, e = {}) {
3720
3720
  const t = {
3721
3721
  pingCheckDurationMs: 1e4,
3722
3722
  pingTimeoutMs: 3e3,
@@ -3733,25 +3733,19 @@ async function fn(o, e = {}) {
3733
3733
  plPings: [],
3734
3734
  blockRegistryChecks: [],
3735
3735
  autoUpdateCdnChecks: []
3736
- }, s = hr(
3737
- o,
3738
- { defaultRequestTimeout: t.pingTimeoutMs }
3739
- );
3740
- r.plPings = await ke(
3741
- t.pingCheckDurationMs,
3742
- t.maxPingsPerSecond,
3743
- async () => {
3744
- const c = await new Ze(s).ping();
3745
- return JSON.stringify(c).slice(0, 100) + "...";
3746
- }
3747
- );
3748
- const i = new Ze(s).ll.httpDispatcher;
3749
- return r.blockRegistryChecks = await ke(
3736
+ }, o = hr(s, { defaultRequestTimeout: t.pingTimeoutMs });
3737
+ r.plPings = await Se(t.pingCheckDurationMs, t.maxPingsPerSecond, async () => {
3738
+ const c = await new Qe(o).ping();
3739
+ return JSON.stringify(c).slice(0, 100) + "...";
3740
+ });
3741
+ const i = new Qe(o).ll.httpDispatcher;
3742
+ return r.blockRegistryChecks = await Se(
3750
3743
  t.blockRegistryDurationMs,
3751
3744
  t.maxRegistryChecksPerSecond,
3752
3745
  async () => {
3753
3746
  const { body: a, statusCode: c } = await M(t.blockRegistryUrl, {
3754
3747
  dispatcher: i,
3748
+ headersTimeout: t.httpTimeoutMs,
3755
3749
  bodyTimeout: t.httpTimeoutMs
3756
3750
  }), u = await a.text();
3757
3751
  return {
@@ -3759,12 +3753,13 @@ async function fn(o, e = {}) {
3759
3753
  beginningOfBody: u.slice(0, 100) + "..."
3760
3754
  };
3761
3755
  }
3762
- ), r.autoUpdateCdnChecks = await ke(
3756
+ ), r.autoUpdateCdnChecks = await Se(
3763
3757
  t.autoUpdateCdnDurationMs,
3764
3758
  t.maxAutoUpdateCdnChecksPerSecond,
3765
3759
  async () => {
3766
3760
  const { body: a, statusCode: c } = await M(t.autoUpdateCdnUrl, {
3767
3761
  dispatcher: i,
3762
+ headersTimeout: t.httpTimeoutMs,
3768
3763
  bodyTimeout: t.httpTimeoutMs
3769
3764
  }), u = await a.text();
3770
3765
  return {
@@ -3772,112 +3767,109 @@ async function fn(o, e = {}) {
3772
3767
  beginningOfBody: u.slice(0, 100) + "..."
3773
3768
  };
3774
3769
  }
3775
- ), Mo(r, o, t);
3770
+ ), Ms(r, s, t);
3776
3771
  }
3777
- async function ke(o, e, t) {
3778
- const r = Ae(), s = [];
3779
- for (; Q(r) < o; ) {
3780
- const n = Ae();
3772
+ async function Se(s, e, t) {
3773
+ const r = Ee(), o = [];
3774
+ for (; gt(r) < s; ) {
3775
+ const n = Ee();
3776
+ let i;
3781
3777
  try {
3782
- const i = await t();
3783
- s.push({
3784
- elapsedMs: Q(n),
3785
- response: { ok: !0, value: i }
3786
- });
3787
- } catch (i) {
3788
- s.push({
3789
- elapsedMs: Q(n),
3790
- response: { ok: !1, error: i }
3791
- });
3778
+ i = { ok: !0, value: await t() };
3779
+ } catch (u) {
3780
+ i = { ok: !1, error: u };
3792
3781
  }
3793
- Q(n) < 1e3 / e && await kt(1e3 / e - Q(n));
3782
+ const a = gt(n);
3783
+ o.push({
3784
+ elapsedMs: a,
3785
+ response: i
3786
+ });
3787
+ const c = 1e3 / e - a;
3788
+ c > 0 && await kt(c);
3794
3789
  }
3795
- return s;
3790
+ return o;
3796
3791
  }
3797
- function Mo(o, e, t) {
3798
- const r = o.plPings.filter((h) => h.response.ok), s = o.plPings.filter((h) => !h.response.ok), { mean: n, median: i } = Ce(o.plPings), a = [...new Set(r.map((h) => JSON.stringify(h.response.value)))], c = o.blockRegistryChecks.filter((h) => h.response.ok).length, { mean: u, median: l } = Ce(o.blockRegistryChecks), p = o.autoUpdateCdnChecks.filter((h) => h.response.ok).length, { mean: g, median: m } = Ce(o.autoUpdateCdnChecks);
3792
+ function Ms(s, e, t) {
3793
+ const r = s.plPings.filter((i) => i.response.ok), o = s.plPings.filter((i) => !i.response.ok), n = [
3794
+ ...new Set(r.map((i) => JSON.stringify(i.response.value)))
3795
+ ];
3799
3796
  return `
3800
3797
  Network report:
3801
3798
  pl endpoint: ${e};
3802
3799
  options: ${JSON.stringify(t, null, 2)}.
3803
3800
 
3804
- Platforma pings:
3805
- total: ${o.plPings.length};
3806
- successes: ${r.length};
3807
- errors: ${o.plPings.length - r.length};
3808
- mean in ms: ${n};
3809
- median in ms: ${i};
3801
+ Platforma pings: ${ke(s.plPings)}
3810
3802
 
3811
- Block registry responses:
3812
- total: ${o.blockRegistryChecks.length};
3813
- successes: ${c};
3814
- errors: ${o.blockRegistryChecks.length - c};
3815
- mean in ms: ${u};
3816
- median in ms: ${l};
3803
+ Block registry responses: ${ke(s.blockRegistryChecks)}
3817
3804
 
3818
- Auto-update CDN responses:
3819
- total: ${o.autoUpdateCdnChecks.length};
3820
- successes: ${p};
3821
- errors: ${o.autoUpdateCdnChecks.length - p};
3822
- mean in ms: ${g};
3823
- median in ms: ${m};
3805
+ Auto-update CDN responses: ${ke(s.autoUpdateCdnChecks)}
3824
3806
 
3825
3807
  Block registry dumps:
3826
- ${JSON.stringify(o.blockRegistryChecks, null, 2)}
3808
+ ${JSON.stringify(s.blockRegistryChecks, null, 2)}
3827
3809
 
3828
3810
  Auto-update CDN dumps:
3829
- ${JSON.stringify(o.autoUpdateCdnChecks, null, 2)}
3811
+ ${JSON.stringify(s.autoUpdateCdnChecks, null, 2)}
3830
3812
 
3831
3813
  Platforma pings error dumps:
3832
- ${JSON.stringify(s, null, 2)}
3814
+ ${JSON.stringify(o, null, 2)}
3833
3815
 
3834
3816
  Platforma pings success dump examples:
3835
- ${JSON.stringify(a, null, 2)}
3817
+ ${JSON.stringify(n, null, 2)}
3818
+ `;
3819
+ }
3820
+ function ke(s) {
3821
+ const e = s.filter((o) => o.response.ok), { mean: t, median: r } = Ks(s);
3822
+ return `
3823
+ total: ${s.length};
3824
+ successes: ${e.length};
3825
+ errors: ${s.length - e.length};
3826
+ mean in ms: ${t};
3827
+ median in ms: ${r};
3836
3828
  `;
3837
3829
  }
3838
- function Ce(o) {
3839
- const e = o.map((s) => s.elapsedMs), t = e.reduce((s, n) => s + n) / e.length;
3830
+ function Ks(s) {
3831
+ const e = s.map((o) => o.elapsedMs), t = e.reduce((o, n) => o + n) / e.length;
3840
3832
  let r;
3841
3833
  if (e.length > 0) {
3842
- const s = Math.floor(e.length / 2);
3843
- r = e.length % 2 ? e[s] : (e[s - 1] + e[s]) / 2;
3834
+ const o = Math.floor(e.length / 2);
3835
+ r = e.length % 2 ? e[o] : (e[o - 1] + e[o]) / 2;
3844
3836
  }
3845
3837
  return { mean: t, median: r };
3846
3838
  }
3847
- function Ae() {
3839
+ function Ee() {
3848
3840
  return Date.now();
3849
3841
  }
3850
- function Q(o) {
3851
- return Ae() - o;
3842
+ function gt(s) {
3843
+ return Ee() - s;
3852
3844
  }
3853
3845
  export {
3854
- dn as BlockPackRegistry,
3855
- pn as CentralBlockRegistry,
3846
+ pn as BlockPackRegistry,
3847
+ gn as CentralBlockRegistry,
3856
3848
  _t as DefaultDriverKitOpsPaths,
3857
3849
  Ht as DefaultDriverKitOpsSettings,
3858
- xo as DefaultMiddleLayerOpsPaths,
3859
- Do as DefaultMiddleLayerOpsSettings,
3850
+ xs as DefaultMiddleLayerOpsPaths,
3851
+ Ds as DefaultMiddleLayerOpsSettings,
3860
3852
  xt as FrontendFromFolderResourceType,
3861
3853
  Dt as FrontendFromUrlResourceType,
3862
3854
  Wt as MiddleLayer,
3863
- Ge as Project,
3864
- ls as TengoTemplateGet,
3865
- ds as TengoTemplateGetRegistry,
3866
- gs as TengoTemplateGetTemplate,
3867
- ps as TengoTemplateGetTemplateURI,
3868
- hs as TengoTemplatePack,
3869
- fs as TengoTemplatePackConvert,
3870
- vs as TengoTemplatePackConvertTemplate,
3871
- ms as TengoTemplatePackConvertTemplatePack,
3872
- hn as V1CentralDevSnapshotRegistry,
3873
- gn as V1CentralRegistry,
3855
+ $e as Project,
3856
+ lo as TengoTemplateGet,
3857
+ po as TengoTemplateGetRegistry,
3858
+ ho as TengoTemplateGetTemplate,
3859
+ go as TengoTemplateGetTemplateURI,
3860
+ fo as TengoTemplatePack,
3861
+ mo as TengoTemplatePackConvert,
3862
+ yo as TengoTemplatePackConvertTemplate,
3863
+ vo as TengoTemplatePackConvertTemplatePack,
3864
+ fn as V1CentralDevSnapshotRegistry,
3865
+ hn as V1CentralRegistry,
3874
3866
  Mr as V2RegistryProvider,
3875
- fn as checkNetwork,
3867
+ mn as checkNetwork,
3876
3868
  Ot as createRenderTemplate,
3877
3869
  Pt as getDevV1PacketMtime,
3878
- Je as getDevV2PacketMtime,
3879
- Jo as initDriverKit,
3880
- Ue as loadTemplate,
3881
- ys as prepareTemplateSpec
3870
+ Le as getDevV2PacketMtime,
3871
+ Js as initDriverKit,
3872
+ Me as loadTemplate,
3873
+ bo as prepareTemplateSpec
3882
3874
  };
3883
3875
  //# sourceMappingURL=index.mjs.map