@milaboratories/pl-middle-layer 1.18.0 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,70 +1,70 @@
1
- var er = Object.defineProperty;
2
- var tr = (o, e, t) => e in o ? er(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var p = (o, e, t) => tr(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { mapValueInVOE as wt, executePSpecPredicate as rr, mapPObjectData as Z, mapPTableDef as St, extractConfig as kt, isConfigLambda as Ct, DefaultNavigationState as or } from "@platforma-sdk/model";
1
+ var or = Object.defineProperty;
2
+ var sr = (o, e, t) => e in o ? or(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var p = (o, e, t) => sr(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { mapValueInVOE as Ct, executePSpecPredicate as ir, mapPObjectData as X, mapPTableDef as Pt, extractConfig as Rt, isConfigLambda as Bt, DefaultNavigationState as nr } from "@platforma-sdk/model";
5
5
  export * from "@platforma-sdk/model";
6
- import { blockPackIdEquals as Ce } from "@milaboratories/pl-model-middle-layer";
6
+ import { AnyChannel as ee, StableChannel as K, blockPackIdToString as ot, blockPackIdEquals as Re } from "@milaboratories/pl-model-middle-layer";
7
7
  export * from "@milaboratories/pl-model-middle-layer";
8
- import { request as K, RetryAgent as sr } from "undici";
9
- import { RegistryV1 as H, tryLoadPackDescription as De, BlockPackMetaEmbedAbsoluteBytes as ir, RegistryV2Reader as nr, folderReaderByUrl as ar, loadPackDescription as tt } from "@platforma-sdk/block-tools";
8
+ import { request as G, RetryAgent as ar } from "undici";
9
+ import { RegistryV1 as W, tryLoadPackDescription as Ae, BlockPackMetaEmbedAbsoluteBytes as cr, RegistryV2Reader as lr, folderReaderByUrl as ur, loadPackDescription as st } from "@platforma-sdk/block-tools";
10
10
  import E from "node:fs";
11
11
  import x from "node:path";
12
- import cr from "yaml";
13
- import { assertNever as D, notEmpty as k, ConsoleLoggerAdapter as ur, ConcurrencyLimitingExecutor as lr, HmacSha256Signer as Pt } from "@milaboratories/ts-helpers";
14
- import * as Rt from "node:fs/promises";
15
- import { tryResolve as dr } from "@milaboratories/resolve-helper";
16
- import { resourceTypesEqual as G, field as w, Pl as b, PlClient as pr, isNullResourceId as fe, ensureResourceIdNotNull as xe, isResource as gr, isResourceRef as hr, isNotNullResourceId as rt, resourceType as ce, resourceTypeToString as fr, resourceIdToString as Bt, isNotFoundError as mr, isTimeoutOrCancelError as vr, toGlobalResourceId as yr, plAddressToConfig as br, UnauthenticatedPlClient as ot } from "@milaboratories/pl-client";
12
+ import dr from "yaml";
13
+ import { assertNever as D, notEmpty as k, ConsoleLoggerAdapter as pr, ConcurrencyLimitingExecutor as gr, HmacSha256Signer as Ot } from "@milaboratories/ts-helpers";
14
+ import * as Ft from "node:fs/promises";
15
+ import { tryResolve as hr } from "@milaboratories/resolve-helper";
16
+ import { resourceTypesEqual as _, field as w, Pl as b, PlClient as fr, isNullResourceId as ve, ensureResourceIdNotNull as Te, isResource as mr, isResourceRef as vr, isNotNullResourceId as it, resourceType as ue, resourceTypeToString as yr, resourceIdToString as Dt, isNotFoundError as br, isTimeoutOrCancelError as wr, toGlobalResourceId as Sr, plAddressToConfig as kr, UnauthenticatedPlClient as nt } from "@milaboratories/pl-client";
17
17
  export * from "@milaboratories/pl-client";
18
- import { SynchronizedTreeState as Ft, PlError as wr } from "@milaboratories/pl-tree";
19
- import { Computable as P, ChangeSource as st, PollComputablePool as Sr, WatchableValue as kr } from "@milaboratories/computable";
20
- import { randomUUID as ie, createHash as be } from "node:crypto";
21
- import Ot from "denque";
22
- import { Templates as Cr } from "@platforma-sdk/workflow-tengo";
23
- import Me from "canonicalize";
24
- import Pr from "node:assert";
25
- import { Scope as Ae, getQuickJS as Rr } from "quickjs-emscripten";
26
- import { setTimeout as Dt } from "node:timers/promises";
27
- import { createDownloadClient as Br, createLogsClient as Fr, createUploadBlobClient as Or, createUploadProgressClient as Dr, DownloadDriver as xr, UploadDriver as Ar, LogsStreamDriver as Tr, LogsDriver as jr, LsDriver as Er, DownloadUrlDriver as Ir } from "@milaboratories/pl-drivers";
28
- import { PFrame as Vr } from "@milaboratories/pframes-node";
29
- import { LRUCache as Nr } from "lru-cache";
30
- import { channel as Lr } from "node:diagnostics_channel";
31
- async function it(o) {
18
+ import { SynchronizedTreeState as xt, PlError as Cr } from "@milaboratories/pl-tree";
19
+ import { Computable as P, ChangeSource as at, PollComputablePool as Pr, WatchableValue as Rr } from "@milaboratories/computable";
20
+ import { randomUUID as ae, createHash as Se } from "node:crypto";
21
+ import At from "denque";
22
+ import { Templates as Br } from "@platforma-sdk/workflow-tengo";
23
+ import Ke from "canonicalize";
24
+ import Or from "node:assert";
25
+ import { Scope as je, getQuickJS as Fr } from "quickjs-emscripten";
26
+ import { setTimeout as Tt } from "node:timers/promises";
27
+ import { createDownloadClient as Dr, createLogsClient as xr, createUploadBlobClient as Ar, createUploadProgressClient as Tr, DownloadDriver as jr, UploadDriver as Er, LogsStreamDriver as Ir, LogsDriver as Vr, LsDriver as Lr, DownloadUrlDriver as Nr } from "@milaboratories/pl-drivers";
28
+ import { PFrame as Jr } from "@milaboratories/pframes-node";
29
+ import { LRUCache as Ur } from "lru-cache";
30
+ import { channel as Mr } from "node:diagnostics_channel";
31
+ async function ct(o) {
32
32
  try {
33
- return await Rt.stat(o, { bigint: !0 });
33
+ return await Ft.stat(o, { bigint: !0 });
34
34
  } catch (e) {
35
35
  if (e.code === "ENOENT")
36
36
  return;
37
37
  throw e;
38
38
  }
39
39
  }
40
- const Jr = [H.PlPackageYamlConfigFile], Ur = [H.PlPackageJsonConfigFile], $e = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Ke = ["config", "dist", "config.json"], xt = ["frontend", "dist"], nt = "block-model/dist/config.json", Mr = "block-ui/package.json", $r = [
41
- $e,
42
- Ke,
43
- Jr,
44
- Ur,
45
- xt
40
+ const $r = [W.PlPackageYamlConfigFile], Kr = [W.PlPackageJsonConfigFile], Ge = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], _e = ["config", "dist", "config.json"], jt = ["frontend", "dist"], lt = "block-model/dist/config.json", Gr = "block-ui/package.json", _r = [
41
+ Ge,
42
+ _e,
43
+ $r,
44
+ Kr,
45
+ jt
46
46
  ];
47
- async function Kr(o) {
48
- return await it(x.join(o, ...Ke)) !== void 0 || await it(x.join(o, ...$e)) !== void 0;
47
+ async function Hr(o) {
48
+ return await ct(x.join(o, ..._e)) !== void 0 || await ct(x.join(o, ...Ge)) !== void 0;
49
49
  }
50
- function Pe(o, e) {
51
- const t = dr(o, e);
50
+ function Be(o, e) {
51
+ const t = hr(o, e);
52
52
  if (t === void 0) throw new Error(`Can't resolve ${e} against ${o}`);
53
53
  return t;
54
54
  }
55
- async function at(o, e) {
56
- if (x.isAbsolute(o) || (o = x.resolve(o)), await Kr(o))
55
+ async function ut(o, e) {
56
+ if (x.isAbsolute(o) || (o = x.resolve(o)), await Hr(o))
57
57
  return {
58
- workflow: x.join(o, ...$e),
59
- config: x.join(o, ...Ke),
60
- ui: x.join(o, ...xt)
58
+ workflow: x.join(o, ...Ge),
59
+ config: x.join(o, ..._e),
60
+ ui: x.join(o, ...jt)
61
61
  };
62
62
  {
63
- const t = Pe(o, nt), r = Pe(o, nt), s = Pe(o, Mr);
63
+ const t = Be(o, lt), r = Be(o, lt), s = Be(o, Gr);
64
64
  return { workflow: t, config: r, ui: x.resolve(s, "..", "dist") };
65
65
  }
66
66
  }
67
- async function Gr(o) {
67
+ async function Wr(o) {
68
68
  try {
69
69
  return await E.promises.readFile(o, "utf8");
70
70
  } catch (e) {
@@ -73,7 +73,7 @@ async function Gr(o) {
73
73
  throw e;
74
74
  }
75
75
  }
76
- async function _r(o) {
76
+ async function zr(o) {
77
77
  try {
78
78
  return await E.promises.stat(o, { bigint: !0 });
79
79
  } catch (e) {
@@ -82,21 +82,21 @@ async function _r(o) {
82
82
  throw e;
83
83
  }
84
84
  }
85
- async function At(o) {
85
+ async function Et(o) {
86
86
  let e = 0n;
87
- for (const t of $r) {
88
- const r = x.join(o, ...t), s = await _r(r);
87
+ for (const t of _r) {
88
+ const r = x.join(o, ...t), s = await zr(r);
89
89
  s !== void 0 && e < s.mtimeNs && (e = s.mtimeNs);
90
90
  }
91
91
  return e.toString();
92
92
  }
93
- async function Ge(o) {
93
+ async function He(o) {
94
94
  const e = await E.promises.stat(o.components.workflow.main.file, {
95
95
  bigint: !0
96
96
  }), t = await E.promises.stat(o.components.model.file, { bigint: !0 });
97
97
  return (e.mtimeNs > t.mtimeNs ? e.mtimeNs : t.mtimeNs).toString();
98
98
  }
99
- class ki {
99
+ class Ri {
100
100
  constructor(e, t, r) {
101
101
  this.v2Provider = e, this.registries = t, this.http = r;
102
102
  }
@@ -104,22 +104,20 @@ class ki {
104
104
  const t = [], r = e.spec;
105
105
  switch (r.type) {
106
106
  case "remote-v1":
107
- const s = this.http !== void 0 ? { dispatcher: this.http } : {}, n = await (await K(
108
- `${r.url}/${H.GlobalOverviewPath}`,
107
+ const s = this.http !== void 0 ? { dispatcher: this.http } : {}, n = await (await G(
108
+ `${r.url}/${W.GlobalOverviewPath}`,
109
109
  s
110
110
  )).body.json();
111
111
  for (const a of n) {
112
- const { organization: c, package: u, latestMeta: l, latestVersion: d } = a, g = {
112
+ const { organization: c, package: l, latestMeta: u, latestVersion: d } = a, g = {
113
113
  organization: c,
114
- name: u,
114
+ name: l,
115
115
  version: d
116
- };
117
- t.push({
118
- registryId: e.id,
116
+ }, h = {
119
117
  id: g,
120
118
  meta: {
121
- title: l.title ?? "No title",
122
- description: l.description ?? "No Description",
119
+ title: u.title ?? "No title",
120
+ description: u.description ?? "No Description",
123
121
  organization: {
124
122
  name: c,
125
123
  url: "https://unknown.com"
@@ -129,36 +127,51 @@ class ki {
129
127
  type: "from-registry-v1",
130
128
  id: g,
131
129
  registryUrl: r.url
130
+ }
131
+ };
132
+ t.push({
133
+ registryId: e.id,
134
+ id: g,
135
+ latestByChannel: {
136
+ [ee]: h,
137
+ [K]: h
132
138
  },
133
- otherVersions: a.allVersions
139
+ allVersions: a.allVersions.map((v) => ({ version: v, channels: [] }))
134
140
  });
135
141
  }
136
142
  return t;
137
143
  case "remote-v2":
138
- return (await this.v2Provider.getRegistry(r.url).listBlockPacks()).map((a) => ({
139
- ...a,
140
- registryId: e.id
141
- }));
144
+ return (await this.v2Provider.getRegistry(r.url).listBlockPacks()).map(
145
+ (a) => a.latestByChannel[K] ? {
146
+ ...a,
147
+ registryId: e.id
148
+ } : {
149
+ ...a,
150
+ latestByChannel: {
151
+ ...a.latestByChannel,
152
+ [K]: a.latestByChannel[ee]
153
+ },
154
+ registryId: e.id
155
+ }
156
+ );
142
157
  case "local-dev":
143
158
  for (const a of await E.promises.readdir(r.path, { withFileTypes: !0 })) {
144
159
  if (!a.isDirectory()) continue;
145
- const c = x.join(r.path, a.name), u = await Gr(
146
- x.join(c, H.PlPackageYamlConfigFile)
160
+ const c = x.join(r.path, a.name), l = await Wr(
161
+ x.join(c, W.PlPackageYamlConfigFile)
147
162
  );
148
- if (u !== void 0) {
149
- const l = H.PlPackageConfigData.parse(cr.parse(u)), d = await At(c), g = {
150
- organization: l.organization,
151
- name: l.package,
163
+ if (l !== void 0) {
164
+ const u = W.PlPackageConfigData.parse(dr.parse(l)), d = await Et(c), g = {
165
+ organization: u.organization,
166
+ name: u.package,
152
167
  version: "DEV"
153
- };
154
- t.push({
155
- registryId: e.id,
168
+ }, h = {
156
169
  id: g,
157
170
  meta: {
158
- title: l.meta.title ?? "No title",
159
- description: l.meta.description ?? "No Description",
171
+ title: u.meta.title ?? "No title",
172
+ description: u.meta.description ?? "No Description",
160
173
  organization: {
161
- name: l.organization,
174
+ name: u.organization,
162
175
  url: "https://unknown.com"
163
176
  }
164
177
  },
@@ -166,27 +179,41 @@ class ki {
166
179
  type: "dev-v2",
167
180
  folder: c,
168
181
  mtime: d
182
+ }
183
+ };
184
+ t.push({
185
+ registryId: e.id,
186
+ id: g,
187
+ latestByChannel: {
188
+ [ee]: h,
189
+ [K]: h
169
190
  },
170
- otherVersions: []
191
+ allVersions: []
171
192
  });
172
193
  } else {
173
- let l = c, d = await De(l);
194
+ let u = c, d = await Ae(u);
174
195
  if (d === void 0) {
175
196
  for (const g of ["block", "meta"])
176
- if (l = x.join(c, g), d = await De(l), d !== void 0) break;
197
+ if (u = x.join(c, g), d = await Ae(u), d !== void 0) break;
177
198
  }
178
199
  if (d !== void 0) {
179
- const g = await Ge(d);
180
- t.push({
181
- registryId: e.id,
200
+ const g = await He(d), h = {
182
201
  id: d.id,
183
- meta: await ir.parseAsync(d.meta),
202
+ meta: await cr.parseAsync(d.meta),
184
203
  spec: {
185
204
  type: "dev-v2",
186
- folder: l,
205
+ folder: c,
187
206
  mtime: g
207
+ }
208
+ };
209
+ t.push({
210
+ registryId: e.id,
211
+ id: d.id,
212
+ latestByChannel: {
213
+ [ee]: h,
214
+ [K]: h
188
215
  },
189
- otherVersions: []
216
+ allVersions: []
190
217
  });
191
218
  }
192
219
  }
@@ -203,7 +230,7 @@ class ki {
203
230
  return { registries: t, blockPacks: e };
204
231
  }
205
232
  }
206
- class Hr {
233
+ class Yr {
207
234
  constructor(e) {
208
235
  p(this, "registries", /* @__PURE__ */ new Map());
209
236
  this.http = e;
@@ -211,119 +238,119 @@ class Hr {
211
238
  getRegistry(e) {
212
239
  const t = this.registries.get(e);
213
240
  if (t) return t;
214
- const r = new nr(ar(e, this.http));
241
+ const r = new lr(ur(e, this.http));
215
242
  return this.registries.set(e, r), r;
216
243
  }
217
244
  }
218
- const Ci = {
245
+ const Bi = {
219
246
  type: "remote-v2",
220
247
  url: "https://blocks.pl-open.science/"
221
- }, Pi = {
248
+ }, Oi = {
222
249
  type: "remote-v1",
223
250
  url: "https://block.registry.platforma.bio/releases"
224
- }, Ri = {
251
+ }, Fi = {
225
252
  type: "remote-v1",
226
253
  url: "https://block.registry.platforma.bio/dev"
227
- }, Wr = {
254
+ }, qr = {
228
255
  groups: [{ id: "default", label: "Default", blocks: [] }]
229
- }, zr = {
256
+ }, Qr = {
230
257
  stagingRefreshTimestamp: 0,
231
258
  blocksInLimbo: []
232
- }, qr = {
259
+ }, Zr = {
233
260
  label: "New Project"
234
- }, Yr = { name: "UserProject", version: "2" }, Tt = "SchemaVersion", jt = "1", _e = "ProjectCreated", ne = "ProjectLastModified", ae = "ProjectMeta", W = "ProjectStructure", me = "BlockRenderingState", Qr = "BlockFrontendState/", Zr = /^BlockFrontendState\/(?<blockid>.*)$/;
235
- function Te(o) {
236
- return `${Qr}${o}`;
261
+ }, Xr = { name: "UserProject", version: "2" }, It = "SchemaVersion", Vt = "1", We = "ProjectCreated", ce = "ProjectLastModified", le = "ProjectMeta", z = "ProjectStructure", ye = "BlockRenderingState", eo = "BlockFrontendState/", to = /^BlockFrontendState\/(?<blockid>.*)$/;
262
+ function Ee(o) {
263
+ return `${eo}${o}`;
237
264
  }
238
- const Xr = "BlockArgsAuthor/";
239
- function je(o) {
240
- return `${Xr}${o}`;
265
+ const ro = "BlockArgsAuthor/";
266
+ function Ie(o) {
267
+ return `${ro}${o}`;
241
268
  }
242
- const Ee = "ProjectStructureAuthor";
243
- function eo(o) {
244
- const e = o.match(Zr);
269
+ const Ve = "ProjectStructureAuthor";
270
+ function oo(o) {
271
+ const e = o.match(to);
245
272
  if (e !== null)
246
273
  return e.groups.blockid;
247
274
  }
248
- const to = "__serviceTemplate_";
249
- function Ie(o) {
250
- return `${to}${o}`;
275
+ const so = "__serviceTemplate_";
276
+ function Le(o) {
277
+ return `${so}${o}`;
251
278
  }
252
- function O(o, e) {
279
+ function F(o, e) {
253
280
  return `${o}-${e}`;
254
281
  }
255
- const ro = /^(?<blockId>.*)-(?<fieldName>blockPack|prodArgs|currentArgs|prodCtx|prodUiCtx|prodOutput|prodCtxPrevious|prodUiCtxPrevious|prodOutputPrevious|stagingCtx|stagingUiCtx|stagingOutput|stagingCtxPrevious|stagingUiCtxPrevious|stagingOutputPrevious)$/;
256
- function oo(o) {
257
- const e = o.match(ro);
282
+ const io = /^(?<blockId>.*)-(?<fieldName>blockPack|prodArgs|currentArgs|prodCtx|prodUiCtx|prodOutput|prodCtxPrevious|prodUiCtxPrevious|prodOutputPrevious|stagingCtx|stagingUiCtx|stagingOutput|stagingCtxPrevious|stagingUiCtxPrevious|stagingOutputPrevious)$/;
283
+ function no(o) {
284
+ const e = o.match(io);
258
285
  if (e === null) return;
259
286
  const { blockId: t, fieldName: r } = e.groups;
260
287
  return { blockId: t, fieldName: r };
261
288
  }
262
- const so = "projects", Et = { name: "Projects", version: "1" }, io = (o) => G(o.type, Et) ? o.fields : [];
263
- async function no(o, e, t, r) {
264
- const s = await Ft.init(
289
+ const ao = "projects", Lt = { name: "Projects", version: "1" }, co = (o) => _(o.type, Lt) ? o.fields : [];
290
+ async function lo(o, e, t, r) {
291
+ const s = await xt.init(
265
292
  o,
266
293
  e,
267
294
  {
268
295
  ...r.ops.defaultTreeOptions,
269
- pruning: io
296
+ pruning: co
270
297
  },
271
298
  r.logger
272
299
  );
273
300
  return { computable: P.make((n) => {
274
301
  const a = n.accessor(s.entry()).node(), c = t.getValue(n);
275
302
  if (a === void 0) return;
276
- const u = [];
277
- for (const l of a.listDynamicFields()) {
278
- const d = a.traverse(l);
303
+ const l = [];
304
+ for (const u of a.listDynamicFields()) {
305
+ const d = a.traverse(u);
279
306
  if (d === void 0) continue;
280
- const g = k(d.getKeyValueAsJson(ae)), m = k(d.getKeyValueAsJson(_e)), v = k(d.getKeyValueAsJson(ne));
281
- u.push({
282
- id: l,
307
+ const g = k(d.getKeyValueAsJson(le)), h = k(d.getKeyValueAsJson(We)), v = k(d.getKeyValueAsJson(ce));
308
+ l.push({
309
+ id: u,
283
310
  rid: d.id,
284
- created: new Date(m),
311
+ created: new Date(h),
285
312
  lastModified: new Date(v),
286
313
  opened: c.indexOf(d.id) >= 0,
287
314
  meta: g
288
315
  });
289
316
  }
290
- return u.sort((l) => -l.lastModified.valueOf()), u;
317
+ return l.sort((u) => -u.lastModified.valueOf()), l;
291
318
  }).withStableType(), tree: s };
292
319
  }
293
- const ao = {
320
+ const uo = {
294
321
  name: "EphRenderTemplate",
295
322
  version: "1"
296
- }, co = {
323
+ }, po = {
297
324
  name: "RenderTemplate",
298
325
  version: "1"
299
326
  };
300
- function It(o, e, t, r, s) {
327
+ function Nt(o, e, t, r, s) {
301
328
  if (s.length === 0) throw new Error("Zero output names provided");
302
- const i = t ? o.createEphemeral(ao) : o.createStruct(co), n = w(i, "template"), a = w(i, "inputs");
329
+ const i = t ? o.createEphemeral(uo) : o.createStruct(po), n = w(i, "template"), a = w(i, "inputs");
303
330
  return o.createField(n, "Input", e), o.createField(a, "Input", b.createPlMap(o, r, t)), o.lockInputs(i), b.futureRecord(o, i, s, "Output", "outputs/");
304
331
  }
305
- const uo = { name: "BContextEnd", version: "1" }, lo = { name: "BContext", version: "1" }, po = "id", go = "parent/", ho = ["context", "result"];
306
- function ct(o, e, t) {
307
- return It(o, e, !0, t, ho);
332
+ const go = { name: "BContextEnd", version: "1" }, ho = { name: "BContext", version: "1" }, fo = "id", mo = "parent/", vo = ["context", "result"];
333
+ function dt(o, e, t) {
334
+ return Nt(o, e, !0, t, vo);
308
335
  }
309
- function fo(o) {
310
- const e = o.createEphemeral(uo);
336
+ function yo(o) {
337
+ const e = o.createEphemeral(go);
311
338
  return o.lock(e), e;
312
339
  }
313
- function mo(o, e) {
314
- if (e.length === 0) return fo(o);
340
+ function bo(o, e) {
341
+ if (e.length === 0) return yo(o);
315
342
  if (e.length === 1) return e[0];
316
- const t = o.createEphemeral(lo);
317
- o.createField(w(t, po), "Input", b.createPlString(o, ie()));
343
+ const t = o.createEphemeral(ho);
344
+ o.createField(w(t, fo), "Input", b.createPlString(o, ae()));
318
345
  for (let r = 0; r < e.length; r++)
319
- o.createField(w(t, `${go}${r}`), "Input", e[r]);
346
+ o.createField(w(t, `${mo}${r}`), "Input", e[r]);
320
347
  return o.lock(t), t;
321
348
  }
322
- const vo = { name: "TengoTemplateGet", version: "1" }, yo = "registry", bo = "templateURI", wo = "template", So = { name: "TengoTemplatePack", version: "1" }, ko = {
349
+ const wo = { name: "TengoTemplateGet", version: "1" }, So = "registry", ko = "templateURI", Co = "template", Po = { name: "TengoTemplatePack", version: "1" }, Ro = {
323
350
  name: "TengoTemplatePackConvert",
324
351
  version: "1"
325
- }, Co = "templatePack", Po = "template";
326
- async function Ro(o) {
352
+ }, Bo = "templatePack", Oo = "template";
353
+ async function Fo(o) {
327
354
  switch (o.type) {
328
355
  case "from-file":
329
356
  return {
@@ -337,38 +364,38 @@ async function Ro(o) {
337
364
  return D(o);
338
365
  }
339
366
  }
340
- function Bo(o, e) {
341
- const t = o.createStruct(vo), r = w(t, yo), s = w(t, bo), i = w(t, wo);
367
+ function Do(o, e) {
368
+ const t = o.createStruct(wo), r = w(t, So), s = w(t, ko), i = w(t, Co);
342
369
  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)))), i;
343
370
  }
344
- function Fo(o, e) {
345
- const t = o.createValue(So, e.content), r = o.createStruct(ko), s = w(r, Co), i = w(r, Po);
371
+ function xo(o, e) {
372
+ const t = o.createValue(Po, e.content), r = o.createStruct(Ro), s = w(r, Bo), i = w(r, Oo);
346
373
  return o.setField(s, t), i;
347
374
  }
348
- function He(o, e) {
375
+ function ze(o, e) {
349
376
  switch (e.type) {
350
377
  case "from-registry":
351
- return Bo(o, e);
378
+ return Do(o, e);
352
379
  case "explicit":
353
- return Fo(o, e);
380
+ return xo(o, e);
354
381
  default:
355
382
  return D(e);
356
383
  }
357
384
  }
358
- const Vt = { name: "Frontend/FromUrl", version: "1" }, Nt = {
385
+ const Jt = { name: "Frontend/FromUrl", version: "1" }, Ut = {
359
386
  name: "Frontend/FromFolder",
360
387
  version: "1"
361
388
  };
362
- function Oo(o, e) {
389
+ function Ao(o, e) {
363
390
  switch (e.type) {
364
391
  case "url":
365
392
  return o.createValue(
366
- Vt,
393
+ Jt,
367
394
  JSON.stringify({ url: e.url })
368
395
  );
369
396
  case "local":
370
397
  return o.createValue(
371
- Nt,
398
+ Ut,
372
399
  JSON.stringify({
373
400
  path: e.path,
374
401
  signature: e.signature
@@ -378,11 +405,11 @@ function Oo(o, e) {
378
405
  return D(e);
379
406
  }
380
407
  }
381
- const Do = { name: "BlockPackCustom", version: "1" }, Lt = "template", Jt = "frontend";
382
- function ut(o) {
408
+ const To = { name: "BlockPackCustom", version: "1" }, Mt = "template", $t = "frontend";
409
+ function pt(o) {
383
410
  return o.endsWith("/") ? o : `${o}/`;
384
411
  }
385
- class xo {
412
+ class jo {
386
413
  constructor(e, t, r) {
387
414
  this.v2RegistryProvider = e, this.signer = t, this.http = r;
388
415
  }
@@ -391,22 +418,22 @@ class xo {
391
418
  case "explicit":
392
419
  return e.config;
393
420
  case "dev-v1": {
394
- const t = await at(e.folder), r = await E.promises.readFile(t.config, { encoding: "utf-8" });
421
+ const t = await ut(e.folder), r = await E.promises.readFile(t.config, { encoding: "utf-8" });
395
422
  return JSON.parse(r);
396
423
  }
397
424
  case "dev-v2": {
398
- const t = await tt(e.folder), r = await E.promises.readFile(t.components.model.file, {
425
+ const t = await st(e.folder), r = await E.promises.readFile(t.components.model.file, {
399
426
  encoding: "utf-8"
400
427
  });
401
428
  return JSON.parse(r);
402
429
  }
403
430
  case "from-registry-v1": {
404
- const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${ut(e.registryUrl)}${H.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`;
405
- return await (await K(`${r}/config.json`, t)).body.json();
431
+ const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${pt(e.registryUrl)}${W.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`;
432
+ return await (await G(`${r}/config.json`, t)).body.json();
406
433
  }
407
434
  case "from-registry-v2": {
408
435
  const t = this.http !== void 0 ? { dispatcher: this.http } : {}, s = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id);
409
- return await (await K(s.model.url, t)).body.json();
436
+ return await (await G(s.model.url, t)).body.json();
410
437
  }
411
438
  default:
412
439
  return D(e);
@@ -417,7 +444,7 @@ class xo {
417
444
  case "explicit":
418
445
  return e;
419
446
  case "dev-v1": {
420
- const t = await at(e.folder), r = await E.promises.readFile(t.workflow), s = JSON.parse(
447
+ const t = await ut(e.folder), r = await E.promises.readFile(t.workflow), s = JSON.parse(
421
448
  await E.promises.readFile(t.config, "utf-8")
422
449
  ), i = t.ui;
423
450
  return {
@@ -436,14 +463,14 @@ class xo {
436
463
  };
437
464
  }
438
465
  case "dev-v2": {
439
- const t = await tt(e.folder), r = JSON.parse(
466
+ const t = await st(e.folder), r = JSON.parse(
440
467
  await E.promises.readFile(t.components.model.file, {
441
468
  encoding: "utf-8"
442
469
  })
443
470
  ), s = await E.promises.readFile(
444
471
  t.components.workflow.main.file
445
472
  ), i = t.components.ui.folder, n = { ...e };
446
- return e.mtime === void 0 && (n.mtime = await Ge(t)), {
473
+ return e.mtime === void 0 && (n.mtime = await He(t)), {
447
474
  type: "explicit",
448
475
  template: {
449
476
  type: "explicit",
@@ -459,12 +486,12 @@ class xo {
459
486
  };
460
487
  }
461
488
  case "from-registry-v1": {
462
- const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${ut(e.registryUrl)}${H.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`, s = `${r}/template.plj.gz`, i = await K(s, t);
489
+ const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${pt(e.registryUrl)}${W.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`, s = `${r}/template.plj.gz`, i = await G(s, t);
463
490
  if (i.statusCode !== 200)
464
491
  throw new Error(
465
492
  `Block not found in registry (url = ${s} ; code = ${i.statusCode}): ` + JSON.stringify(e)
466
493
  );
467
- const n = new Uint8Array(await i.body.arrayBuffer()), c = await (await K(`${r}/config.json`, t)).body.json();
494
+ const n = new Uint8Array(await i.body.arrayBuffer()), c = await (await G(`${r}/config.json`, t)).body.json();
468
495
  return {
469
496
  type: "explicit",
470
497
  template: {
@@ -480,7 +507,7 @@ class xo {
480
507
  };
481
508
  }
482
509
  case "from-registry-v2": {
483
- const t = this.http !== void 0 ? { dispatcher: this.http } : {}, s = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id), i = async () => await (await K(s.model.url, t)).body.json(), n = async () => await (await K(s.workflow.main.url, t)).body.arrayBuffer(), [a, c] = await Promise.all([i(), n()]);
510
+ const t = this.http !== void 0 ? { dispatcher: this.http } : {}, s = await this.v2RegistryProvider.getRegistry(e.registryUrl).getComponents(e.id), i = async () => await (await G(s.model.url, t)).body.json(), n = async () => await (await G(s.workflow.main.url, t)).body.arrayBuffer(), [a, c] = await Promise.all([i(), n()]);
484
511
  return {
485
512
  type: "explicit",
486
513
  template: {
@@ -500,25 +527,25 @@ class xo {
500
527
  }
501
528
  }
502
529
  }
503
- function Ao(o, e) {
504
- const t = { config: e.config, source: e.source }, r = o.createStruct(Do, JSON.stringify(t));
505
- return o.createField(w(r, Lt), "Input", He(o, e.template)), o.createField(w(r, Jt), "Input", Oo(o, e.frontend)), o.lock(r), r;
530
+ function Eo(o, e) {
531
+ const t = { config: e.config, source: e.source }, r = o.createStruct(To, JSON.stringify(t));
532
+ return o.createField(w(r, Mt), "Input", ze(o, e.template)), o.createField(w(r, $t), "Input", Ao(o, e.frontend)), o.lock(r), r;
506
533
  }
507
- function lt(o, e) {
534
+ function gt(o, e) {
508
535
  switch (e.type) {
509
536
  case "explicit":
510
- return Ao(o, e);
537
+ return Eo(o, e);
511
538
  default:
512
539
  return D(e.type);
513
540
  }
514
541
  }
515
- function de(o, e) {
542
+ function ge(o, e) {
516
543
  return { __isRef: !0, blockId: o, name: e };
517
544
  }
518
- function To(o) {
545
+ function Io(o) {
519
546
  return typeof o == "object" && o !== null && o.__isRef === !0 && "blockId" in o && "name" in o;
520
547
  }
521
- function Ve(o, e, t) {
548
+ function Ne(o, e, t) {
522
549
  const r = typeof e;
523
550
  switch (r) {
524
551
  case "function":
@@ -531,21 +558,21 @@ function Ve(o, e, t) {
531
558
  return;
532
559
  case "object":
533
560
  if (e === null) return;
534
- if (To(e))
561
+ if (Io(e))
535
562
  t === void 0 || t.has(e.blockId) ? o.upstreams.add(e.blockId) : o.missingReferences = !0;
536
563
  else if (Array.isArray(e))
537
- for (const s of e) Ve(o, s, t);
564
+ for (const s of e) Ne(o, s, t);
538
565
  else
539
566
  for (const [, s] of Object.entries(e))
540
- Ve(o, s, t);
567
+ Ne(o, s, t);
541
568
  return;
542
569
  default:
543
570
  D(r);
544
571
  }
545
572
  }
546
- function jo(o, e) {
573
+ function Vo(o, e) {
547
574
  const t = { upstreams: /* @__PURE__ */ new Set(), missingReferences: !1 };
548
- return Ve(t, o, e), t;
575
+ return Ne(t, o, e), t;
549
576
  }
550
577
  function M(o) {
551
578
  return {
@@ -554,7 +581,7 @@ function M(o) {
554
581
  }
555
582
  };
556
583
  }
557
- class Ut {
584
+ class Kt {
558
585
  constructor(e) {
559
586
  /** Nodes are stored in the map in topological order */
560
587
  p(this, "nodes");
@@ -576,15 +603,15 @@ class Ut {
576
603
  let n = [];
577
604
  for (const a of s) {
578
605
  const c = this.nodes.get(a);
579
- r(c), c[e].forEach((u) => {
580
- i.has(u) || (i.add(u), n.push(u));
606
+ r(c), c[e].forEach((l) => {
607
+ i.has(l) || (i.add(l), n.push(l));
581
608
  });
582
609
  }
583
610
  s = n;
584
611
  }
585
612
  }
586
613
  }
587
- function Ne(o) {
614
+ function Je(o) {
588
615
  const e = /* @__PURE__ */ new Map();
589
616
  let t;
590
617
  for (const { id: r } of M(o)) {
@@ -594,14 +621,14 @@ function Ne(o) {
594
621
  };
595
622
  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;
596
623
  }
597
- return t !== void 0 && (t.downstream = /* @__PURE__ */ new Set()), new Ut(e);
624
+ return t !== void 0 && (t.downstream = /* @__PURE__ */ new Set()), new Kt(e);
598
625
  }
599
- function ge(o, e) {
626
+ function fe(o, e) {
600
627
  const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
601
628
  for (const { id: s } of M(o)) {
602
629
  const i = e(s);
603
630
  if (i === void 0) continue;
604
- const n = jo(i, r), a = {
631
+ const n = Vo(i, r), a = {
605
632
  id: s,
606
633
  missingReferences: n.missingReferences,
607
634
  upstream: n.upstreams,
@@ -610,41 +637,41 @@ function ge(o, e) {
610
637
  };
611
638
  t.set(s, a), n.upstreams.forEach((c) => t.get(c).downstream.add(s)), r.add(s);
612
639
  }
613
- return new Ut(t);
640
+ return new Kt(t);
614
641
  }
615
- function Eo(o, e) {
642
+ function Lo(o, e) {
616
643
  if (o.size !== e.size) return !1;
617
644
  for (const t of o) if (!e.has(t)) return !1;
618
645
  return !0;
619
646
  }
620
- function Le(o, e) {
621
- if (o.size > e.size) return Le(e, o);
647
+ function Ue(o, e) {
648
+ if (o.size > e.size) return Ue(e, o);
622
649
  for (const t of o) if (e.has(t)) return !0;
623
650
  return !1;
624
651
  }
625
- function dt(o, e) {
652
+ function ht(o, e) {
626
653
  const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
627
654
  return o.nodes.forEach((i) => {
628
655
  const n = e.nodes.get(i.id);
629
- n === void 0 ? t.add(i.id) : (!Eo(i.upstream, n.upstream) || Le(i.upstream, s)) && s.add(i.id);
656
+ n === void 0 ? t.add(i.id) : (!Lo(i.upstream, n.upstream) || Ue(i.upstream, s)) && s.add(i.id);
630
657
  }), e.nodes.forEach((i) => {
631
- o.nodes.has(i.id) ? Le(i.upstream, s) && s.add(i.id) : r.add(i.id);
658
+ o.nodes.has(i.id) ? Ue(i.upstream, s) && s.add(i.id) : r.add(i.id);
632
659
  }), { onlyInA: t, onlyInB: r, different: s };
633
660
  }
634
- let Re;
635
- async function Mt() {
636
- if (Re === void 0) {
637
- const o = await Ro(Cr["pframes.export-pframe"]);
661
+ let Oe;
662
+ async function Gt() {
663
+ if (Oe === void 0) {
664
+ const o = await Fo(Br["pframes.export-pframe"]);
638
665
  if (o.type !== "explicit") throw new Error("Unexpected prepared template type.");
639
- const e = be("sha256").update(o.content).digest("hex");
640
- Re = { spec: o, hash: e };
666
+ const e = Se("sha256").update(o.content).digest("hex");
667
+ Oe = { spec: o, hash: e };
641
668
  }
642
- return Re;
669
+ return Oe;
643
670
  }
644
- function Io(o, e, t) {
645
- return It(o, e, !0, { pf: t }, ["result"]).result;
671
+ function No(o, e, t) {
672
+ return Nt(o, e, !0, { pf: t }, ["result"]).result;
646
673
  }
647
- function Be(o, e) {
674
+ function Fe(o, e) {
648
675
  let t = !1, r, s;
649
676
  return () => {
650
677
  if (!t)
@@ -653,13 +680,13 @@ function Be(o, e) {
653
680
  return r !== i && (r = i, s = e()), e();
654
681
  };
655
682
  }
656
- class pt {
683
+ class ft {
657
684
  constructor(e, t) {
658
- p(this, "currentInputsC", Be(
685
+ p(this, "currentInputsC", Fe(
659
686
  () => this.fields.currentArgs.modCount,
660
687
  () => JSON.parse(Buffer.from(this.fields.currentArgs.value).toString())
661
688
  ));
662
- p(this, "actualProductionInputsC", Be(
689
+ p(this, "actualProductionInputsC", Fe(
663
690
  () => {
664
691
  var e;
665
692
  return (e = this.fields.prodArgs) == null ? void 0 : e.modCount;
@@ -671,7 +698,7 @@ class pt {
671
698
  return JSON.parse(Buffer.from(e).toString());
672
699
  }
673
700
  ));
674
- p(this, "productionStaleC", Be(
701
+ p(this, "productionStaleC", Fe(
675
702
  () => {
676
703
  var e;
677
704
  return `${this.fields.currentArgs.modCount}_${(e = this.fields.prodArgs) == null ? void 0 : e.modCount}`;
@@ -713,16 +740,16 @@ class pt {
713
740
  getTemplate(e) {
714
741
  return e.getFutureFieldValue(
715
742
  b.unwrapHolder(e, this.fields.blockPack.ref),
716
- Lt,
743
+ Mt,
717
744
  "Input"
718
745
  );
719
746
  }
720
747
  }
721
- const Vo = (o) => {
748
+ const Jo = (o) => {
722
749
  throw new Error(`No new block info for ${o}`);
723
750
  };
724
- class ve {
725
- constructor(e, t, r, s, i, n, a, c, u, l, d, g) {
751
+ class be {
752
+ constructor(e, t, r, s, i, n, a, c, l, u, d, g) {
726
753
  p(this, "globalModCount", 0);
727
754
  p(this, "fieldsChanged", !1);
728
755
  //
@@ -741,7 +768,7 @@ class ve {
741
768
  p(this, "stagingGraph");
742
769
  p(this, "pendingProductionGraph");
743
770
  p(this, "actualProductionGraph");
744
- this.rid = e, this.tx = t, this.author = r, this.schema = s, this.lastModified = i, this.meta = n, this.struct = a, this.renderingState = c, this.blocksInLimbo = u, this.blockInfos = l, this.blockFrontendStates = d, this.ctxExportTplHolder = g;
771
+ this.rid = e, this.tx = t, this.author = r, this.schema = s, this.lastModified = i, this.meta = n, this.struct = a, this.renderingState = c, this.blocksInLimbo = l, this.blockInfos = u, this.blockFrontendStates = d, this.ctxExportTplHolder = g;
745
772
  }
746
773
  fixProblems() {
747
774
  this.blockInfos.forEach((e) => {
@@ -755,16 +782,16 @@ class ve {
755
782
  return JSON.parse(JSON.stringify(this.struct));
756
783
  }
757
784
  getStagingGraph() {
758
- return this.stagingGraph === void 0 && (this.stagingGraph = Ne(this.struct)), this.stagingGraph;
785
+ return this.stagingGraph === void 0 && (this.stagingGraph = Je(this.struct)), this.stagingGraph;
759
786
  }
760
787
  getPendingProductionGraph() {
761
- return this.pendingProductionGraph === void 0 && (this.pendingProductionGraph = ge(
788
+ return this.pendingProductionGraph === void 0 && (this.pendingProductionGraph = fe(
762
789
  this.struct,
763
790
  (e) => this.getBlockInfo(e).currentInputs
764
791
  )), this.pendingProductionGraph;
765
792
  }
766
793
  getActualProductionGraph() {
767
- return this.actualProductionGraph === void 0 && (this.actualProductionGraph = ge(
794
+ return this.actualProductionGraph === void 0 && (this.actualProductionGraph = fe(
768
795
  this.struct,
769
796
  (e) => this.getBlockInfo(e).actualProductionInputs
770
797
  )), this.actualProductionGraph;
@@ -780,7 +807,7 @@ class ve {
780
807
  throw new Error("block not found");
781
808
  }
782
809
  setBlockFieldObj(e, t, r) {
783
- const s = w(this.rid, O(e, t));
810
+ const s = w(this.rid, F(e, t));
784
811
  if (r.ref === void 0) throw new Error("Can't set value with empty ref");
785
812
  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] = {
786
813
  modCount: this.globalModCount++,
@@ -795,7 +822,7 @@ class ve {
795
822
  const s = this.getBlockInfo(e);
796
823
  for (const i of t) {
797
824
  const n = s.fields;
798
- i in n && (this.tx.removeField(w(this.rid, O(e, i))), delete n[i], this.fieldsChanged = !0, r = !0);
825
+ i in n && (this.tx.removeField(w(this.rid, F(e, i))), delete n[i], this.fieldsChanged = !0, r = !0);
799
826
  }
800
827
  return r;
801
828
  }
@@ -863,16 +890,16 @@ class ve {
863
890
  if (i.fields[t] === void 0 || i.fields[t].ref === void 0)
864
891
  throw new Error("One of the upstreams staging is not rendered.");
865
892
  r.push(b.unwrapHolder(this.tx, i.fields[t].ref));
866
- }), mo(this.tx, r);
893
+ }), bo(this.tx, r);
867
894
  }
868
895
  exportCtx(e) {
869
- return Io(this.tx, b.unwrapHolder(this.tx, this.ctxExportTplHolder), e);
896
+ return No(this.tx, b.unwrapHolder(this.tx, this.ctxExportTplHolder), e);
870
897
  }
871
898
  renderStagingFor(e) {
872
899
  this.resetStaging(e);
873
900
  const t = this.getBlockInfo(e), r = this.createCtx(this.getStagingGraph().nodes.get(e).upstream, "stagingCtx");
874
901
  if (this.getBlock(e).renderingMode !== "Heavy") throw new Error("not supported yet");
875
- const s = t.getTemplate(this.tx), i = ct(this.tx, s, {
902
+ const s = t.getTemplate(this.tx), i = dt(this.tx, s, {
876
903
  args: t.fields.currentArgs.ref,
877
904
  blockId: this.tx.createValue(b.JsonString, JSON.stringify(e)),
878
905
  isProduction: this.tx.createValue(b.JsonBool, JSON.stringify(!1)),
@@ -893,7 +920,7 @@ class ve {
893
920
  );
894
921
  if (this.getBlock(e).renderingMode === "Light")
895
922
  throw new Error("Can't render production for light block.");
896
- const s = t.getTemplate(this.tx), i = ct(this.tx, s, {
923
+ const s = t.getTemplate(this.tx), i = dt(this.tx, s, {
897
924
  args: t.fields.currentArgs.ref,
898
925
  blockId: this.tx.createValue(b.JsonString, JSON.stringify(e)),
899
926
  isProduction: this.tx.createValue(b.JsonBool, JSON.stringify(!0)),
@@ -910,29 +937,29 @@ class ve {
910
937
  // Structure changes
911
938
  //
912
939
  /** Very generic method, better check for more specialized case-specific methods first. */
913
- updateStructure(e, t = Vo) {
914
- const r = this.getStagingGraph(), s = this.getActualProductionGraph(), i = Ne(e), n = ge(
940
+ updateStructure(e, t = Jo) {
941
+ const r = this.getStagingGraph(), s = this.getActualProductionGraph(), i = Je(e), n = fe(
915
942
  e,
916
- (u) => {
917
- var l;
918
- return (l = this.blockInfos.get(u)) == null ? void 0 : l.actualProductionInputs;
943
+ (l) => {
944
+ var u;
945
+ return (u = this.blockInfos.get(l)) == null ? void 0 : u.actualProductionInputs;
919
946
  }
920
- ), a = dt(r, i), c = dt(s, n);
921
- for (const u of a.onlyInA) {
922
- const { fields: l } = this.getBlockInfo(u);
923
- this.deleteBlockFields(u, ...Object.keys(l)), this.blockInfos.delete(u), this.blocksInLimbo.delete(u) && (this.renderingStateChanged = !0), this.blockFrontendStates.delete(u) && this.changedBlockFrontendStates.add(u);
947
+ ), a = ht(r, i), c = ht(s, n);
948
+ for (const l of a.onlyInA) {
949
+ const { fields: u } = this.getBlockInfo(l);
950
+ this.deleteBlockFields(l, ...Object.keys(u)), this.blockInfos.delete(l), this.blocksInLimbo.delete(l) && (this.renderingStateChanged = !0), this.blockFrontendStates.delete(l) && this.changedBlockFrontendStates.add(l);
924
951
  }
925
- for (const u of a.onlyInB) {
926
- const l = new pt(u, {});
927
- this.blockInfos.set(u, l);
928
- const d = t(u), g = lt(this.tx, d.blockPack);
929
- this.setBlockField(u, "blockPack", b.wrapInHolder(this.tx, g), "NotReady");
930
- const m = Buffer.from(d.args), v = this.tx.createValue(b.JsonObject, m);
931
- this.setBlockField(u, "currentArgs", v, "Ready", m), d.uiState && (this.blockFrontendStates.set(u, d.uiState), this.changedBlockFrontendStates.add(u)), l.check();
952
+ for (const l of a.onlyInB) {
953
+ const u = new ft(l, {});
954
+ this.blockInfos.set(l, u);
955
+ const d = t(l), g = gt(this.tx, d.blockPack);
956
+ this.setBlockField(l, "blockPack", b.wrapInHolder(this.tx, g), "NotReady");
957
+ const h = Buffer.from(d.args), v = this.tx.createValue(b.JsonObject, h);
958
+ this.setBlockField(l, "currentArgs", v, "Ready", h), d.uiState && (this.blockFrontendStates.set(l, d.uiState), this.changedBlockFrontendStates.add(l)), u.check();
932
959
  }
933
- for (const u of a.different) this.resetStaging(u);
934
- s.traverse("downstream", [...c.different], (u) => {
935
- this.resetOrLimboProduction(u.id);
960
+ for (const l of a.different) this.resetStaging(l);
961
+ s.traverse("downstream", [...c.different], (l) => {
962
+ this.resetOrLimboProduction(l.id);
936
963
  }), (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();
937
964
  }
938
965
  //
@@ -979,7 +1006,7 @@ class ve {
979
1006
  this.setBlockField(
980
1007
  e,
981
1008
  "blockPack",
982
- b.wrapInHolder(this.tx, lt(this.tx, t)),
1009
+ b.wrapInHolder(this.tx, gt(this.tx, t)),
983
1010
  "NotReady"
984
1011
  ), r !== void 0 ? (this.setArgs([{ blockId: e, args: r }]), this.setUiState(e, void 0)) : this.getStagingGraph().traverse("downstream", [e], ({ id: i }) => this.resetStaging(i)), s.productionRendered && this.getActualProductionGraph().traverse(
985
1012
  "downstream",
@@ -1025,13 +1052,13 @@ class ve {
1025
1052
  * accordingly */
1026
1053
  stopProduction(...e) {
1027
1054
  var n, a;
1028
- const t = this.getActualProductionGraph(), r = new Ot(e), s = new Set(e), i = [];
1055
+ const t = this.getActualProductionGraph(), r = new At(e), s = new Set(e), i = [];
1029
1056
  for (; !r.isEmpty(); ) {
1030
- const c = r.shift(), u = this.getBlockInfo(c).fields;
1031
- if (!(((n = u.prodOutput) == null ? void 0 : n.status) === "Ready" && ((a = u.prodCtx) == null ? void 0 : a.status) === "Ready") && this.deleteBlockFields(c, "prodOutput", "prodCtx", "prodUiCtx", "prodArgs")) {
1057
+ const c = r.shift(), l = this.getBlockInfo(c).fields;
1058
+ if (!(((n = l.prodOutput) == null ? void 0 : n.status) === "Ready" && ((a = l.prodCtx) == null ? void 0 : a.status) === "Ready") && this.deleteBlockFields(c, "prodOutput", "prodCtx", "prodUiCtx", "prodArgs")) {
1032
1059
  i.push(c);
1033
- for (const l of t.traverseIdsExcludingRoots("downstream", c))
1034
- s.has(l) || (r.push(l), s.add(l));
1060
+ for (const u of t.traverseIdsExcludingRoots("downstream", c))
1061
+ s.has(u) || (r.push(u), s.add(u));
1035
1062
  }
1036
1063
  }
1037
1064
  for (const c of t.traverseIdsExcludingRoots("downstream", ...i))
@@ -1085,142 +1112,142 @@ class ve {
1085
1112
  assignAuthorMarkers() {
1086
1113
  const e = this.author ? JSON.stringify(this.author) : void 0;
1087
1114
  for (const t of this.blocksWithChangedInputs)
1088
- e === void 0 ? this.tx.deleteKValue(this.rid, je(t)) : this.tx.setKValue(this.rid, je(t), e);
1089
- (this.metaChanged || this.structureChanged) && (e === void 0 ? this.tx.deleteKValue(this.rid, Ee) : this.tx.setKValue(this.rid, Ee, e));
1115
+ e === void 0 ? this.tx.deleteKValue(this.rid, Ie(t)) : this.tx.setKValue(this.rid, Ie(t), e);
1116
+ (this.metaChanged || this.structureChanged) && (e === void 0 ? this.tx.deleteKValue(this.rid, Ve) : this.tx.setKValue(this.rid, Ve, e));
1090
1117
  }
1091
1118
  save() {
1092
1119
  if (this.wasModified) {
1093
- this.lastModifiedChanged && this.tx.setKValue(this.rid, ne, JSON.stringify(this.lastModified)), this.structureChanged && this.tx.setKValue(this.rid, W, JSON.stringify(this.struct)), this.renderingStateChanged && this.tx.setKValue(
1120
+ this.lastModifiedChanged && this.tx.setKValue(this.rid, ce, JSON.stringify(this.lastModified)), this.structureChanged && this.tx.setKValue(this.rid, z, JSON.stringify(this.struct)), this.renderingStateChanged && this.tx.setKValue(
1094
1121
  this.rid,
1095
- me,
1122
+ ye,
1096
1123
  JSON.stringify({
1097
1124
  ...this.renderingState,
1098
1125
  blocksInLimbo: [...this.blocksInLimbo]
1099
1126
  })
1100
- ), this.metaChanged && this.tx.setKValue(this.rid, ae, JSON.stringify(this.meta));
1127
+ ), this.metaChanged && this.tx.setKValue(this.rid, le, JSON.stringify(this.meta));
1101
1128
  for (const e of this.changedBlockFrontendStates) {
1102
1129
  const t = this.blockFrontendStates.get(e);
1103
- t === void 0 ? this.tx.deleteKValue(this.rid, Te(e)) : this.tx.setKValue(this.rid, Te(e), t);
1130
+ t === void 0 ? this.tx.deleteKValue(this.rid, Ee(e)) : this.tx.setKValue(this.rid, Ee(e), t);
1104
1131
  }
1105
1132
  this.assignAuthorMarkers();
1106
1133
  }
1107
1134
  }
1108
1135
  static async load(e, t, r) {
1109
- const s = e.getResourceData(t, !0), i = e.getKValueJson(t, Tt), n = e.getKValueJson(t, ne), a = e.getKValueJson(t, ae), c = e.getKValueJson(t, W), u = e.getKValueJson(t, me), l = e.listKeyValuesString(t), [
1136
+ const s = e.getResourceData(t, !0), i = e.getKValueJson(t, It), n = e.getKValueJson(t, ce), a = e.getKValueJson(t, le), c = e.getKValueJson(t, z), l = e.getKValueJson(t, ye), u = e.listKeyValuesString(t), [
1110
1137
  d,
1111
1138
  g,
1112
- m,
1139
+ h,
1113
1140
  v,
1114
1141
  C,
1115
1142
  { stagingRefreshTimestamp: I, blocksInLimbo: V },
1116
- N
1143
+ L
1117
1144
  ] = await Promise.all([
1118
1145
  s,
1119
1146
  i,
1120
1147
  n,
1121
1148
  a,
1122
1149
  c,
1123
- u,
1124
- l
1150
+ l,
1151
+ u
1125
1152
  ]);
1126
- if (g !== jt)
1153
+ if (g !== Vt)
1127
1154
  throw new Error(
1128
1155
  `Can't act on this project resource because it has a wrong schema version: ${g}`
1129
1156
  );
1130
1157
  const $ = /* @__PURE__ */ new Map();
1131
1158
  for (const y of d.fields) {
1132
- const F = oo(y.name);
1133
- if (F === void 0) continue;
1134
- let R = $.get(F.blockId);
1159
+ const O = no(y.name);
1160
+ if (O === void 0) continue;
1161
+ let R = $.get(O.blockId);
1135
1162
  R === void 0 && (R = {
1136
- id: F.blockId,
1163
+ id: O.blockId,
1137
1164
  fields: {}
1138
- }, $.set(F.blockId, R)), R.fields[F.fieldName] = fe(y.value) ? { modCount: 0 } : { modCount: 0, ref: y.value };
1165
+ }, $.set(O.blockId, R)), R.fields[O.fieldName] = ve(y.value) ? { modCount: 0 } : { modCount: 0, ref: y.value };
1139
1166
  }
1140
- const z = await Mt(), ue = Ie(z.hash), S = d.fields.find(
1141
- (y) => y.name === ue
1167
+ const Y = await Gt(), de = Le(Y.hash), S = d.fields.find(
1168
+ (y) => y.name === de
1142
1169
  );
1143
- let L;
1144
- S !== void 0 ? L = xe(S.value) : (L = b.wrapInHolder(e, He(e, z.spec)), e.createField(
1145
- w(t, Ie(z.hash)),
1170
+ let N;
1171
+ S !== void 0 ? N = Te(S.value) : (N = b.wrapInHolder(e, ze(e, Y.spec)), e.createField(
1172
+ w(t, Le(Y.hash)),
1146
1173
  "Dynamic",
1147
- L
1174
+ N
1148
1175
  ));
1149
1176
  const q = { stagingRefreshTimestamp: I }, j = new Set(V), A = /* @__PURE__ */ new Map();
1150
- for (const y of N) {
1151
- const F = eo(y.key);
1152
- F !== void 0 && A.set(F, y.value);
1177
+ for (const y of L) {
1178
+ const O = oo(y.key);
1179
+ O !== void 0 && A.set(O, y.value);
1153
1180
  }
1154
1181
  const B = [];
1155
- $.forEach(({ id: y, fields: F }) => {
1156
- for (const [, R] of Object.entries(F))
1182
+ $.forEach(({ id: y, fields: O }) => {
1183
+ for (const [, R] of Object.entries(O))
1157
1184
  if (R.ref !== void 0) {
1158
- if (!gr(R.ref) || hr(R.ref))
1185
+ if (!mr(R.ref) || vr(R.ref))
1159
1186
  throw new Error("unexpected behaviour");
1160
1187
  B.push([R, e.getResourceData(R.ref, !1)]);
1161
1188
  }
1162
1189
  });
1163
- for (const [y, F] of B) {
1164
- const R = await F;
1165
- y.value = R.data, rt(R.error) ? y.status = "Error" : R.resourceReady || rt(R.originalResourceId) ? y.status = "Ready" : y.status = "NotReady";
1190
+ for (const [y, O] of B) {
1191
+ const R = await O;
1192
+ y.value = R.data, it(R.error) ? y.status = "Error" : R.resourceReady || it(R.originalResourceId) ? y.status = "Ready" : y.status = "NotReady";
1166
1193
  }
1167
1194
  const J = /* @__PURE__ */ new Map();
1168
- $.forEach(({ id: y, fields: F }) => J.set(y, new pt(y, F)));
1169
- const le = /* @__PURE__ */ new Set();
1195
+ $.forEach(({ id: y, fields: O }) => J.set(y, new ft(y, O)));
1196
+ const pe = /* @__PURE__ */ new Set();
1170
1197
  for (const y of M(C)) {
1171
1198
  if (!J.has(y.id))
1172
1199
  throw new Error(`Inconsistent project structure: no inputs for ${y.id}`);
1173
- le.add(y.id);
1200
+ pe.add(y.id);
1174
1201
  }
1175
1202
  J.forEach((y) => {
1176
- if (!le.has(y.id))
1203
+ if (!pe.has(y.id))
1177
1204
  throw new Error(`Inconsistent project structure: no structure entry for ${y.id}`);
1178
1205
  y.check();
1179
1206
  });
1180
- const X = new ve(
1207
+ const te = new be(
1181
1208
  t,
1182
1209
  e,
1183
1210
  r,
1184
1211
  g,
1185
- m,
1212
+ h,
1186
1213
  v,
1187
1214
  C,
1188
1215
  q,
1189
1216
  j,
1190
1217
  J,
1191
1218
  A,
1192
- L
1219
+ N
1193
1220
  );
1194
- return X.fixProblems(), X;
1221
+ return te.fixProblems(), te;
1195
1222
  }
1196
1223
  }
1197
- async function No(o, e = qr) {
1198
- const t = o.createEphemeral(Yr);
1224
+ async function Uo(o, e = Zr) {
1225
+ const t = o.createEphemeral(Xr);
1199
1226
  o.lock(t);
1200
1227
  const r = String(Date.now());
1201
- o.setKValue(t, Tt, JSON.stringify(jt)), o.setKValue(t, _e, r), o.setKValue(t, ne, r), o.setKValue(t, ae, JSON.stringify(e)), o.setKValue(t, W, JSON.stringify(Wr)), o.setKValue(t, me, JSON.stringify(zr));
1202
- const s = await Mt();
1228
+ o.setKValue(t, It, JSON.stringify(Vt)), o.setKValue(t, We, r), o.setKValue(t, ce, r), o.setKValue(t, le, JSON.stringify(e)), o.setKValue(t, z, JSON.stringify(qr)), o.setKValue(t, ye, JSON.stringify(Qr));
1229
+ const s = await Gt();
1203
1230
  return o.createField(
1204
- w(t, Ie(s.hash)),
1231
+ w(t, Le(s.hash)),
1205
1232
  "Dynamic",
1206
- b.wrapInHolder(o, He(o, s.spec))
1233
+ b.wrapInHolder(o, ze(o, s.spec))
1207
1234
  ), t;
1208
1235
  }
1209
- async function Fe(o, e, t) {
1236
+ async function De(o, e, t) {
1210
1237
  return U(o, e, void 0, t);
1211
1238
  }
1212
1239
  async function U(o, e, t, r) {
1213
- if (o instanceof pr)
1240
+ if (o instanceof fr)
1214
1241
  return await o.withWriteTx("ProjectAction", async (s) => {
1215
- const i = await ve.load(s, e, t), n = await r(i);
1242
+ const i = await be.load(s, e, t), n = await r(i);
1216
1243
  return i.wasModified && (i.save(), await s.commit()), n;
1217
1244
  });
1218
1245
  {
1219
- const s = await ve.load(o, e, t), i = await r(s);
1246
+ const s = await be.load(o, e, t), i = await r(s);
1220
1247
  return s.save(), i;
1221
1248
  }
1222
1249
  }
1223
- function* Lo(o) {
1250
+ function* Mo(o) {
1224
1251
  switch (o.type) {
1225
1252
  case "Json":
1226
1253
  return;
@@ -1235,21 +1262,21 @@ function* Lo(o) {
1235
1262
  D(o);
1236
1263
  }
1237
1264
  }
1238
- function gt(o, e) {
1265
+ function mt(o, e) {
1239
1266
  return Object.fromEntries(
1240
1267
  Object.entries(o).map(([t, r]) => [t, e(r, t)])
1241
1268
  );
1242
1269
  }
1243
- function Jo(o, e) {
1270
+ function $o(o, e) {
1244
1271
  switch (o.type) {
1245
1272
  case "Json":
1246
1273
  return { ...o };
1247
1274
  case "JsonPartitioned":
1248
- return { ...o, parts: gt(o.parts, e) };
1275
+ return { ...o, parts: mt(o.parts, e) };
1249
1276
  case "BinaryPartitioned":
1250
1277
  return {
1251
1278
  ...o,
1252
- parts: gt(o.parts, (t) => ({
1279
+ parts: mt(o.parts, (t) => ({
1253
1280
  index: e(t.index),
1254
1281
  values: e(t.values)
1255
1282
  }))
@@ -1258,26 +1285,26 @@ function Jo(o, e) {
1258
1285
  D(o);
1259
1286
  }
1260
1287
  }
1261
- const Uo = ce("PColumnData/JsonPartitioned", "1"), Mo = ce(
1288
+ const Ko = ue("PColumnData/JsonPartitioned", "1"), Go = ue(
1262
1289
  "PColumnData/Partitioned/JsonPartitioned",
1263
1290
  "1"
1264
- ), $o = ce("PColumnData/BinaryPartitioned", "1"), Ko = ce(
1291
+ ), _o = ue("PColumnData/BinaryPartitioned", "1"), Ho = ue(
1265
1292
  "PColumnData/Partitioned/BinaryPartitioned",
1266
1293
  "1"
1267
- ), Go = ce("PColumnData/Json", "1");
1268
- function _o(o) {
1294
+ ), Wo = ue("PColumnData/Json", "1");
1295
+ function zo(o) {
1269
1296
  if (!o.getIsReadyOrError()) throw new Error("Data not ready.");
1270
1297
  const e = o.getDataAsJson();
1271
1298
  if (e === void 0)
1272
1299
  throw new Error("unexpected data info structure, no resource data");
1273
- if (G(o.resourceType, Go)) {
1300
+ if (_(o.resourceType, Wo)) {
1274
1301
  const t = e;
1275
1302
  return {
1276
1303
  type: "Json",
1277
1304
  keyLength: t.keyLength,
1278
1305
  data: t.data
1279
1306
  };
1280
- } else if (G(o.resourceType, Uo)) {
1307
+ } else if (_(o.resourceType, Ko)) {
1281
1308
  const t = e, r = Object.fromEntries(
1282
1309
  o.listInputFields().map((s) => [s, o.traverse({ field: s, errorIfFieldNotSet: !0 }).resourceInfo])
1283
1310
  );
@@ -1286,7 +1313,7 @@ function _o(o) {
1286
1313
  partitionKeyLength: t.partitionKeyLength,
1287
1314
  parts: r
1288
1315
  };
1289
- } else if (G(o.resourceType, Mo)) {
1316
+ } else if (_(o.resourceType, Go)) {
1290
1317
  const t = e, r = {};
1291
1318
  for (const s of o.listInputFields()) {
1292
1319
  const i = o.traverse({ field: s, errorIfFieldNotSet: !0 }), n = i.listInputFields();
@@ -1301,7 +1328,7 @@ function _o(o) {
1301
1328
  partitionKeyLength: t.superPartitionKeyLength + t.partitionKeyLength,
1302
1329
  parts: r
1303
1330
  };
1304
- } else if (G(o.resourceType, $o)) {
1331
+ } else if (_(o.resourceType, _o)) {
1305
1332
  const t = e, r = {};
1306
1333
  for (const s of o.listInputFields())
1307
1334
  if (s.endsWith(".index")) {
@@ -1322,23 +1349,23 @@ function _o(o) {
1322
1349
  partitionKeyLength: t.partitionKeyLength,
1323
1350
  parts: r
1324
1351
  };
1325
- } else if (G(o.resourceType, Ko)) {
1352
+ } else if (_(o.resourceType, Ho)) {
1326
1353
  const t = e, r = {};
1327
1354
  for (const s of o.listInputFields()) {
1328
1355
  const i = o.traverse({ field: s, errorIfFieldNotSet: !0 }), n = i.listInputFields();
1329
1356
  if (n === void 0) throw new Error(`no partition keys for super key ${s}`);
1330
1357
  for (const a of n)
1331
1358
  if (a.endsWith(".index")) {
1332
- const c = a.slice(0, a.length - 6), u = JSON.stringify([...JSON.parse(s), ...JSON.parse(c)]);
1333
- let l = r[u];
1334
- l === void 0 && (l = {}, r[u] = l), r[u].index = i.traverse({
1359
+ const c = a.slice(0, a.length - 6), l = JSON.stringify([...JSON.parse(s), ...JSON.parse(c)]);
1360
+ let u = r[l];
1361
+ u === void 0 && (u = {}, r[l] = u), r[l].index = i.traverse({
1335
1362
  field: a,
1336
1363
  errorIfFieldNotSet: !0
1337
1364
  }).resourceInfo;
1338
1365
  } else if (a.endsWith(".values")) {
1339
- const c = a.slice(0, a.length - 7), u = JSON.stringify([...JSON.parse(s), ...JSON.parse(c)]);
1340
- let l = r[u];
1341
- l === void 0 && (l = {}, r[u] = l), r[u].values = i.traverse({
1366
+ const c = a.slice(0, a.length - 7), l = JSON.stringify([...JSON.parse(s), ...JSON.parse(c)]);
1367
+ let u = r[l];
1368
+ u === void 0 && (u = {}, r[l] = u), r[l].values = i.traverse({
1342
1369
  field: a,
1343
1370
  errorIfFieldNotSet: !0
1344
1371
  }).resourceInfo;
@@ -1350,40 +1377,40 @@ function _o(o) {
1350
1377
  parts: r
1351
1378
  };
1352
1379
  }
1353
- throw new Error(`unsupported resource type: ${fr(o.resourceType)}`);
1380
+ throw new Error(`unsupported resource type: ${yr(o.resourceType)}`);
1354
1381
  }
1355
- function Je(o, e) {
1356
- const t = be("sha256");
1357
- return t.update(Me(o)), t.update(String(fe(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
1382
+ function Me(o, e) {
1383
+ const t = Se("sha256");
1384
+ return t.update(Ke(o)), t.update(String(ve(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
1358
1385
  }
1359
- function $t(o, e = !0, t = !1, r = "") {
1360
- var a, c, u;
1386
+ function _t(o, e = !0, t = !1, r = "") {
1387
+ var a, c, l;
1361
1388
  const s = /^(?<name>.*)\.(?<type>spec|data)$/, i = /* @__PURE__ */ new Map();
1362
- for (const l of o.listInputFields()) {
1363
- const d = l.match(s);
1389
+ for (const u of o.listInputFields()) {
1390
+ const d = u.match(s);
1364
1391
  if (!d) {
1365
- if (e) throw new Error(`unexpected field name ${l}`);
1392
+ if (e) throw new Error(`unexpected field name ${u}`);
1366
1393
  continue;
1367
1394
  }
1368
1395
  let g = k((a = d.groups) == null ? void 0 : a.name);
1369
1396
  if (!g.startsWith(r)) {
1370
- if (e) throw new Error(`unexpected field name ${l}`);
1397
+ if (e) throw new Error(`unexpected field name ${u}`);
1371
1398
  continue;
1372
1399
  }
1373
1400
  g = g.slice(r.length);
1374
- const m = k((c = d.groups) == null ? void 0 : c.type);
1401
+ const h = k((c = d.groups) == null ? void 0 : c.type);
1375
1402
  let v = i.get(g);
1376
- switch (v === void 0 && (v = {}, i.set(g, v)), m) {
1403
+ switch (v === void 0 && (v = {}, i.set(g, v)), h) {
1377
1404
  case "spec":
1378
- v.spec = (u = o.traverse({
1379
- field: l,
1405
+ v.spec = (l = o.traverse({
1406
+ field: u,
1380
1407
  ignoreError: t,
1381
1408
  pureFieldErrorToUndefined: t
1382
- })) == null ? void 0 : u.getDataAsJson();
1409
+ })) == null ? void 0 : l.getDataAsJson();
1383
1410
  break;
1384
1411
  case "data":
1385
1412
  v.hasData = !0, v.data = () => o.traverseOrError({
1386
- field: l,
1413
+ field: u,
1387
1414
  ignoreError: t
1388
1415
  });
1389
1416
  default:
@@ -1392,13 +1419,13 @@ function $t(o, e = !0, t = !1, r = "") {
1392
1419
  }
1393
1420
  const n = o.getInputsLocked();
1394
1421
  if (n)
1395
- for (const [, l] of i) l.data === void 0 && (l.hasData = !1);
1422
+ for (const [, u] of i) u.data === void 0 && (u.hasData = !1);
1396
1423
  return { locked: n, results: i };
1397
1424
  }
1398
- function Ho(o, e = !0, t = "") {
1425
+ function Yo(o, e = !0, t = "") {
1399
1426
  if (!o.getIsReadyOrError()) throw new Error("resource is not ready");
1400
- const r = $t(o, e, !1, t);
1401
- Pr(r.locked);
1427
+ const r = _t(o, e, !1, t);
1428
+ Or(r.locked);
1402
1429
  const s = {};
1403
1430
  for (const [i, n] of r.results) {
1404
1431
  if (n.spec === void 0) throw new Error(`no spec for key ${i}`);
@@ -1406,16 +1433,16 @@ function Ho(o, e = !0, t = "") {
1406
1433
  throw new Error(`no data for key ${i}`);
1407
1434
  const a = n.data();
1408
1435
  if (a === void 0) throw new Error(`no data for key ${i}`);
1409
- if (!a.ok) throw new wr(a.error);
1436
+ if (!a.ok) throw new Cr(a.error);
1410
1437
  s[i] = {
1411
- id: Je(n.spec, a.value),
1438
+ id: Me(n.spec, a.value),
1412
1439
  spec: n.spec,
1413
1440
  data: a.value
1414
1441
  };
1415
1442
  }
1416
1443
  return s;
1417
1444
  }
1418
- class We {
1445
+ class Ye {
1419
1446
  constructor(e, t) {
1420
1447
  p(this, "allSpecsAvailable");
1421
1448
  this.ctx = e, this.blocks = t;
@@ -1436,11 +1463,11 @@ class We {
1436
1463
  this.allSpecsAvailable = r;
1437
1464
  }
1438
1465
  getSpecByRef(e, t) {
1439
- var i, n, a, c, u, l;
1466
+ var i, n, a, c, l, u;
1440
1467
  const r = this.blocks.get(e);
1441
1468
  if (r === void 0) return;
1442
1469
  let s = (a = (n = (i = r.prod) == null ? void 0 : i.results) == null ? void 0 : n.get(t)) == null ? void 0 : a.spec;
1443
- if (s !== void 0 || (s = (l = (u = (c = r.staging) == null ? void 0 : c.results) == null ? void 0 : u.get(t)) == null ? void 0 : l.spec, s !== void 0)) return s;
1470
+ if (s !== void 0 || (s = (u = (l = (c = r.staging) == null ? void 0 : c.results) == null ? void 0 : l.get(t)) == null ? void 0 : u.spec, s !== void 0)) return s;
1444
1471
  r.staging === void 0 ? this.ctx.markUnstable(`staging_not_rendered:${e}`) : r.staging.locked ? r.prod !== void 0 && !r.prod.locked && this.ctx.markUnstable(`prod_not_locked:${e}`) : this.ctx.markUnstable(`staging_not_locked:${e}`);
1445
1472
  }
1446
1473
  getDataOrErrorByRef(e, t) {
@@ -1449,10 +1476,10 @@ class We {
1449
1476
  if (r === void 0) return;
1450
1477
  let s = (a = (n = r.prod) == null ? void 0 : n.results) == null ? void 0 : a.get(t), i = (c = s == null ? void 0 : s.data) == null ? void 0 : c.call(s);
1451
1478
  if (s !== void 0 && s.spec !== void 0 && i !== void 0)
1452
- return wt(i, (u) => ({
1453
- id: Je(s.spec, u),
1479
+ return Ct(i, (l) => ({
1480
+ id: Me(s.spec, l),
1454
1481
  spec: s.spec,
1455
- data: u
1482
+ data: l
1456
1483
  }));
1457
1484
  s !== void 0 && this.ctx.markUnstable(`no_data:${e}:${t}`), r.prod !== void 0 && !r.prod.locked && this.ctx.markUnstable(`prod_not_locked:${e}`);
1458
1485
  }
@@ -1485,13 +1512,13 @@ class We {
1485
1512
  r === void 0 && (r = n), t = !1;
1486
1513
  }, i = (n, a, c) => {
1487
1514
  if (c.spec !== void 0 && c.hasData === !0 && c.data !== void 0) {
1488
- const u = c.data();
1489
- u !== void 0 ? e.push({
1490
- ref: de(n, a),
1515
+ const l = c.data();
1516
+ l !== void 0 ? e.push({
1517
+ ref: ge(n, a),
1491
1518
  obj: {
1492
- id: u.ok ? Je(c.spec, u.value) : void 0,
1519
+ id: l.ok ? Me(c.spec, l.value) : void 0,
1493
1520
  spec: c.spec,
1494
- data: u
1521
+ data: l
1495
1522
  }
1496
1523
  }) : s(`no_data:${n}:${a}`);
1497
1524
  }
@@ -1500,13 +1527,13 @@ class We {
1500
1527
  const c = /* @__PURE__ */ new Set();
1501
1528
  if (a.prod !== void 0) {
1502
1529
  a.prod.locked || s(`prod_not_locked:${n}`);
1503
- for (const [u, l] of a.prod.results)
1504
- c.add(u), i(n, u, l);
1530
+ for (const [l, u] of a.prod.results)
1531
+ c.add(l), i(n, l, u);
1505
1532
  }
1506
1533
  if (a.staging !== void 0) {
1507
1534
  a.staging.locked || s(`staging_not_locked:${n}`);
1508
- for (const [u, l] of a.staging.results)
1509
- c.has(u) || i(n, u, l);
1535
+ for (const [l, u] of a.staging.results)
1536
+ c.has(l) || i(n, l, u);
1510
1537
  }
1511
1538
  }
1512
1539
  return { entries: e, isComplete: t, instabilityMarker: r };
@@ -1521,18 +1548,18 @@ class We {
1521
1548
  const a = /* @__PURE__ */ new Set();
1522
1549
  if (n.staging !== void 0) {
1523
1550
  n.staging.locked || s(`staging_not_locked:${i}`);
1524
- for (const [c, u] of n.staging.results)
1525
- u.spec !== void 0 && (e.push({
1526
- ref: de(i, c),
1527
- obj: u.spec
1551
+ for (const [c, l] of n.staging.results)
1552
+ l.spec !== void 0 && (e.push({
1553
+ ref: ge(i, c),
1554
+ obj: l.spec
1528
1555
  }), a.add(c));
1529
1556
  } else s(`staging_not_rendered:${i}`);
1530
1557
  if (n.prod !== void 0) {
1531
1558
  n.prod.locked || s(`prod_not_locked:${i}`);
1532
- for (const [c, u] of n.prod.results)
1533
- a.has(c) || u.spec !== void 0 && e.push({
1534
- ref: de(i, c),
1535
- obj: u.spec
1559
+ for (const [c, l] of n.prod.results)
1560
+ a.has(c) || l.spec !== void 0 && e.push({
1561
+ ref: ge(i, c),
1562
+ obj: l.spec
1536
1563
  });
1537
1564
  }
1538
1565
  }
@@ -1543,9 +1570,9 @@ class We {
1543
1570
  for (const r of this.blocks.values()) {
1544
1571
  const s = /* @__PURE__ */ new Set(), i = (n) => {
1545
1572
  for (const [a, c] of n.results)
1546
- s.has(a) || c.spec === void 0 || (s.add(a), rr(e, c.spec) && t.push({
1573
+ s.has(a) || c.spec === void 0 || (s.add(a), ir(e, c.spec) && t.push({
1547
1574
  label: r.info.label + " / " + a,
1548
- ref: de(r.info.id, a),
1575
+ ref: ge(r.info.id, a),
1549
1576
  spec: c.spec
1550
1577
  }));
1551
1578
  };
@@ -1554,64 +1581,64 @@ class We {
1554
1581
  return t;
1555
1582
  }
1556
1583
  static create(e, t, r) {
1557
- const s = e.accessor(t).node(), i = k(s.getKeyValueAsJson(W)), a = Ne(i).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
1558
- for (const u of M(i)) {
1559
- if (!a.has(u.id)) continue;
1560
- const l = ht(
1584
+ const s = e.accessor(t).node(), i = k(s.getKeyValueAsJson(z)), a = Je(i).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
1585
+ for (const l of M(i)) {
1586
+ if (!a.has(l.id)) continue;
1587
+ const u = vt(
1561
1588
  s.traverse({
1562
- field: O(u.id, "prodCtx"),
1589
+ field: F(l.id, "prodCtx"),
1563
1590
  ignoreError: !0,
1564
1591
  pureFieldErrorToUndefined: !0,
1565
1592
  stableIfNotFound: !0
1566
1593
  }) !== void 0,
1567
1594
  s.traverseOrError({
1568
- field: O(u.id, "prodUiCtx"),
1595
+ field: F(l.id, "prodUiCtx"),
1569
1596
  stableIfNotFound: !0
1570
1597
  })
1571
- ), d = ht(
1598
+ ), d = vt(
1572
1599
  s.traverse({
1573
- field: O(u.id, "stagingCtx"),
1600
+ field: F(l.id, "stagingCtx"),
1574
1601
  ignoreError: !0,
1575
1602
  pureFieldErrorToUndefined: !0
1576
1603
  }) !== void 0,
1577
1604
  s.traverseOrError({
1578
- field: O(u.id, "stagingUiCtx")
1605
+ field: F(l.id, "stagingUiCtx")
1579
1606
  })
1580
1607
  );
1581
- c.set(u.id, { info: u, prod: l, staging: d });
1608
+ c.set(l.id, { info: l, prod: u, staging: d });
1582
1609
  }
1583
- return new We(e, c);
1610
+ return new Ye(e, c);
1584
1611
  }
1585
1612
  }
1586
- function ht(o, e) {
1613
+ function vt(o, e) {
1587
1614
  if (e === void 0)
1588
1615
  return o ? { locked: !1, results: /* @__PURE__ */ new Map() } : void 0;
1589
- if (e.ok) return $t(e.value, !1, !0);
1616
+ if (e.ok) return _t(e.value, !1, !0);
1590
1617
  }
1591
- function ze(o, e) {
1618
+ function qe(o, e) {
1592
1619
  return {
1593
1620
  blockId: e,
1594
1621
  args: (s) => k(
1595
1622
  s.accessor(o).node().traverse({
1596
- field: O(e, "currentArgs"),
1623
+ field: F(e, "currentArgs"),
1597
1624
  errorIfFieldNotSet: !0
1598
1625
  }).getDataAsString()
1599
1626
  ),
1600
- uiState: (s) => s.accessor(o).node().getKeyValueAsString(Te(e)),
1627
+ uiState: (s) => s.accessor(o).node().getKeyValueAsString(Ee(e)),
1601
1628
  blockMeta: (s) => {
1602
- const i = s.accessor(o).node(), n = k(i.getKeyValueAsJson(W)), a = /* @__PURE__ */ new Map();
1629
+ const i = s.accessor(o).node(), n = k(i.getKeyValueAsJson(z)), a = /* @__PURE__ */ new Map();
1603
1630
  for (const c of M(n)) a.set(c.id, c);
1604
1631
  return a;
1605
1632
  }
1606
1633
  };
1607
1634
  }
1608
- function Kt(o, e) {
1635
+ function Ht(o, e) {
1609
1636
  return {
1610
- ...ze(o, e),
1637
+ ...qe(o, e),
1611
1638
  prod: (t) => {
1612
1639
  var r;
1613
1640
  return (r = t.accessor(o).node({ ignoreError: !0 }).traverse({
1614
- field: O(e, "prodOutput"),
1641
+ field: F(e, "prodOutput"),
1615
1642
  stableIfNotFound: !0,
1616
1643
  ignoreError: !0
1617
1644
  })) == null ? void 0 : r.persist();
@@ -1619,12 +1646,12 @@ function Kt(o, e) {
1619
1646
  staging: (t) => {
1620
1647
  var s;
1621
1648
  const r = (s = t.accessor(o).node({ ignoreError: !0 }).traverse({
1622
- field: O(e, "stagingOutput"),
1649
+ field: F(e, "stagingOutput"),
1623
1650
  ignoreError: !0
1624
1651
  })) == null ? void 0 : s.persist();
1625
1652
  return r === void 0 && t.markUnstable("staging_not_rendered"), r;
1626
1653
  },
1627
- getResultsPool: (t) => We.create(t, o, e)
1654
+ getResultsPool: (t) => Ye.create(t, o, e)
1628
1655
  };
1629
1656
  }
1630
1657
  function* T(o, e) {
@@ -1677,15 +1704,15 @@ function* T(o, e) {
1677
1704
  D(o);
1678
1705
  }
1679
1706
  }
1680
- function Wo(o, e) {
1707
+ function qo(o, e) {
1681
1708
  const t = {};
1682
1709
  for (const [r, s] of Object.entries(o)) t[r] = e(s);
1683
1710
  return t;
1684
1711
  }
1685
- function re(o, e) {
1712
+ function se(o, e) {
1686
1713
  return o === void 0 ? void 0 : e(o);
1687
1714
  }
1688
- function zo(o) {
1715
+ function Qo(o) {
1689
1716
  switch (o.type) {
1690
1717
  case "GetImportProgress":
1691
1718
  return !0;
@@ -1693,121 +1720,121 @@ function zo(o) {
1693
1720
  return !1;
1694
1721
  }
1695
1722
  }
1696
- function qo(o) {
1697
- for (const e of T(o)) if (zo(e)) return !0;
1723
+ function Zo(o) {
1724
+ for (const e of T(o)) if (Qo(e)) return !0;
1698
1725
  return !1;
1699
1726
  }
1700
- function we(o) {
1727
+ function ke(o) {
1701
1728
  return {
1702
1729
  type: "ReturnResult",
1703
1730
  result: o
1704
1731
  };
1705
1732
  }
1706
- function h(o) {
1707
- return () => we(o);
1733
+ function f(o) {
1734
+ return () => ke(o);
1708
1735
  }
1709
- const Yo = (o) => {
1736
+ const Xo = (o) => {
1710
1737
  const e = {};
1711
1738
  for (const [t, r] of Object.entries(o)) e[t] = r;
1712
- return h(e);
1713
- }, Qo = (o) => {
1739
+ return f(e);
1740
+ }, es = (o) => {
1714
1741
  const e = o.source;
1715
- if (e === void 0) return h(void 0);
1742
+ if (e === void 0) return f(void 0);
1716
1743
  const t = [];
1717
1744
  for (const r of e)
1718
1745
  r instanceof Array ? t.push(...r) : t.push(r);
1719
- return h(t);
1720
- }, Zo = (o) => {
1746
+ return f(t);
1747
+ }, ts = (o) => {
1721
1748
  const e = o.source, t = o.field;
1722
- return e === void 0 || t === void 0 ? h(void 0) : ({ cCtx: r }) => {
1749
+ return e === void 0 || t === void 0 ? f(void 0) : ({ cCtx: r }) => {
1723
1750
  var s;
1724
- return we((s = r.accessor(e).node().traverse(t)) == null ? void 0 : s.persist());
1751
+ return ke((s = r.accessor(e).node().traverse(t)) == null ? void 0 : s.persist());
1725
1752
  };
1726
1753
  };
1727
- function Gt(o, e) {
1754
+ function Wt(o, e) {
1728
1755
  const t = {}, r = o.length;
1729
1756
  for (let s = 0; s < r; s++) t[String(s)] = e(o[s]);
1730
1757
  return t;
1731
1758
  }
1732
- function Xo(o, e) {
1759
+ function rs(o, e) {
1733
1760
  return (t) => {
1734
1761
  const r = t.source;
1735
- return r === void 0 ? h(void 0) : () => ({
1762
+ return r === void 0 ? f(void 0) : () => ({
1736
1763
  type: "ScheduleSubroutine",
1737
- subroutine: _t(r.length),
1738
- args: Gt(r, (s) => f({ ...o, [e.itVar]: s }, e.mapping))
1764
+ subroutine: zt(r.length),
1765
+ args: Wt(r, (s) => m({ ...o, [e.itVar]: s }, e.mapping))
1739
1766
  });
1740
1767
  };
1741
1768
  }
1742
- function _t(o) {
1769
+ function zt(o) {
1743
1770
  return (e) => {
1744
1771
  const t = [];
1745
1772
  for (let r = 0; r < o; r++) t.push(e[String(r)]);
1746
- return h(t);
1773
+ return f(t);
1747
1774
  };
1748
1775
  }
1749
- function es(o, e) {
1776
+ function os(o, e) {
1750
1777
  return (t) => {
1751
1778
  const r = t.source;
1752
- if (r === void 0) return h(void 0);
1779
+ if (r === void 0) return f(void 0);
1753
1780
  const s = {};
1754
1781
  for (const [i, n] of Object.entries(r)) {
1755
1782
  const a = { ...o, [e.itVar]: n };
1756
- s[i] = f(a, e.mapping);
1783
+ s[i] = m(a, e.mapping);
1757
1784
  }
1758
1785
  return () => ({
1759
1786
  type: "ScheduleSubroutine",
1760
- subroutine: ts,
1787
+ subroutine: ss,
1761
1788
  args: s
1762
1789
  });
1763
1790
  };
1764
1791
  }
1765
- const ts = (o) => h(o), rs = (o) => {
1792
+ const ss = (o) => f(o), is = (o) => {
1766
1793
  const e = o.arg;
1767
- return h(e === void 0 ? void 0 : e.length === 0);
1768
- }, os = (o) => {
1794
+ return f(e === void 0 ? void 0 : e.length === 0);
1795
+ }, ns = (o) => {
1769
1796
  const e = o.operand;
1770
- return h(e === void 0 ? void 0 : !e);
1771
- }, ss = (o) => {
1797
+ return f(e === void 0 ? void 0 : !e);
1798
+ }, as = (o) => {
1772
1799
  const e = o.operand1, t = o.operand2;
1773
- return h(e === void 0 || t === void 0 ? void 0 : e && t);
1774
- }, is = (o) => {
1800
+ return f(e === void 0 || t === void 0 ? void 0 : e && t);
1801
+ }, cs = (o) => {
1775
1802
  const e = o.operand1, t = o.operand2;
1776
- return h(e === void 0 || t === void 0 ? void 0 : e || t);
1777
- }, ns = (o) => {
1803
+ return f(e === void 0 || t === void 0 ? void 0 : e || t);
1804
+ }, ls = (o) => {
1778
1805
  const e = o.source;
1779
- return e === void 0 ? h(void 0) : ({ cCtx: t }) => {
1806
+ return e === void 0 ? f(void 0) : ({ cCtx: t }) => {
1780
1807
  var r;
1781
- return we((r = t.accessor(e).node()) == null ? void 0 : r.getDataAsJson());
1808
+ return ke((r = t.accessor(e).node()) == null ? void 0 : r.getDataAsJson());
1782
1809
  };
1783
- }, as = (o) => {
1810
+ }, us = (o) => {
1784
1811
  const e = o.source, t = o.field;
1785
- return h(e === void 0 || t === void 0 ? void 0 : e[t]);
1812
+ return f(e === void 0 || t === void 0 ? void 0 : e[t]);
1786
1813
  };
1787
- function cs(o, e) {
1814
+ function ds(o, e) {
1788
1815
  return (t) => {
1789
1816
  const r = t.source;
1790
- return r === void 0 ? h(void 0) : ({ cCtx: s }) => {
1817
+ return r === void 0 ? f(void 0) : ({ cCtx: s }) => {
1791
1818
  const i = s.accessor(r).node(), n = {};
1792
1819
  for (const a of i.listInputFields()) {
1793
1820
  const c = i.traverse(a);
1794
- if (c === void 0) n[a] = h(void 0);
1821
+ if (c === void 0) n[a] = f(void 0);
1795
1822
  else {
1796
- const u = { ...o, [e.itVar]: c.persist() };
1797
- n[a] = f(u, e.mapping);
1823
+ const l = { ...o, [e.itVar]: c.persist() };
1824
+ n[a] = m(l, e.mapping);
1798
1825
  }
1799
1826
  }
1800
1827
  return {
1801
1828
  type: "ScheduleSubroutine",
1802
- subroutine: us,
1829
+ subroutine: ps,
1803
1830
  args: n
1804
1831
  };
1805
1832
  };
1806
1833
  };
1807
1834
  }
1808
- const us = (o) => h(o), ls = (o) => {
1835
+ const ps = (o) => f(o), gs = (o) => {
1809
1836
  const e = o.source;
1810
- return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1837
+ return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
1811
1838
  type: "ScheduleComputable",
1812
1839
  computable: P.make(
1813
1840
  (r) => t.blobDriver.getDownloadedBlob(r.accessor(e).node().resourceInfo),
@@ -1819,9 +1846,9 @@ const us = (o) => h(o), ls = (o) => {
1819
1846
  }
1820
1847
  )
1821
1848
  });
1822
- }, ds = (o) => {
1849
+ }, hs = (o) => {
1823
1850
  const e = o.source;
1824
- return e === void 0 ? h(void 0) : ({ cCtx: t, drivers: r }) => {
1851
+ return e === void 0 ? f(void 0) : ({ cCtx: t, drivers: r }) => {
1825
1852
  const s = t.accessor(e).node().resourceInfo;
1826
1853
  return {
1827
1854
  type: "ScheduleComputable",
@@ -1830,9 +1857,9 @@ const us = (o) => h(o), ls = (o) => {
1830
1857
  })
1831
1858
  };
1832
1859
  };
1833
- }, ps = (o) => {
1860
+ }, fs = (o) => {
1834
1861
  const e = o.source;
1835
- return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1862
+ return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
1836
1863
  type: "ScheduleComputable",
1837
1864
  computable: P.make(
1838
1865
  (r) => t.blobDriver.getDownloadedBlob(r.accessor(e).node().resourceInfo),
@@ -1846,237 +1873,237 @@ const us = (o) => h(o), ls = (o) => {
1846
1873
  }
1847
1874
  )
1848
1875
  });
1849
- }, gs = (o) => {
1876
+ }, ms = (o) => {
1850
1877
  const e = o.source;
1851
- return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1878
+ return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
1852
1879
  type: "ScheduleComputable",
1853
1880
  computable: t.blobDriver.getDownloadedBlob(e)
1854
1881
  });
1855
- }, hs = (o) => {
1882
+ }, vs = (o) => {
1856
1883
  const e = o.source;
1857
- return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1884
+ return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
1858
1885
  type: "ScheduleComputable",
1859
1886
  computable: t.blobDriver.getOnDemandBlob(e)
1860
1887
  });
1861
- }, fs = (o) => {
1888
+ }, ys = (o) => {
1862
1889
  const e = o.source;
1863
- return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1890
+ return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
1864
1891
  type: "ScheduleComputable",
1865
1892
  computable: t.uploadDriver.getProgressId(e)
1866
1893
  });
1867
- }, ms = (o) => (e) => {
1894
+ }, bs = (o) => (e) => {
1868
1895
  const t = e.source;
1869
- return t === void 0 ? h(void 0) : ({ drivers: r }) => ({
1896
+ return t === void 0 ? f(void 0) : ({ drivers: r }) => ({
1870
1897
  type: "ScheduleComputable",
1871
1898
  computable: r.logDriver.getLastLogs(t, o)
1872
1899
  });
1873
- }, vs = (o) => (e) => {
1900
+ }, ws = (o) => (e) => {
1874
1901
  const t = e.source;
1875
- return t === void 0 ? h(void 0) : ({ drivers: r }) => ({
1902
+ return t === void 0 ? f(void 0) : ({ drivers: r }) => ({
1876
1903
  type: "ScheduleComputable",
1877
1904
  computable: r.logDriver.getProgressLog(t, o)
1878
1905
  });
1879
- }, ys = (o) => {
1906
+ }, Ss = (o) => {
1880
1907
  const e = o.source;
1881
- return e === void 0 ? h(void 0) : ({ drivers: t }) => ({
1908
+ return e === void 0 ? f(void 0) : ({ drivers: t }) => ({
1882
1909
  type: "ScheduleComputable",
1883
1910
  computable: t.logDriver.getLogHandle(e)
1884
1911
  });
1885
1912
  };
1886
- function f(o, e) {
1913
+ function m(o, e) {
1887
1914
  switch (e.type) {
1888
1915
  case "GetFromCtx":
1889
1916
  const t = o[e.variable];
1890
- return typeof t == "function" ? (r) => we(t(r.cCtx)) : h(t);
1917
+ return typeof t == "function" ? (r) => ke(t(r.cCtx)) : f(t);
1891
1918
  case "Isolate":
1892
1919
  return ({ drivers: r }) => ({
1893
1920
  type: "ScheduleComputable",
1894
- computable: zt(r, o, e.cfg)
1921
+ computable: Qt(r, o, e.cfg)
1895
1922
  });
1896
1923
  case "Immediate":
1897
- return h(e.value);
1924
+ return f(e.value);
1898
1925
  case "GetJsonField":
1899
1926
  return () => ({
1900
1927
  type: "ScheduleSubroutine",
1901
- subroutine: as,
1928
+ subroutine: us,
1902
1929
  args: {
1903
- source: f(o, e.source),
1904
- field: f(o, e.field)
1930
+ source: m(o, e.source),
1931
+ field: m(o, e.field)
1905
1932
  }
1906
1933
  });
1907
1934
  case "MapArrayValues":
1908
1935
  return () => ({
1909
1936
  type: "ScheduleSubroutine",
1910
- subroutine: Xo(o, e),
1937
+ subroutine: rs(o, e),
1911
1938
  args: {
1912
- source: f(o, e.source)
1939
+ source: m(o, e.source)
1913
1940
  }
1914
1941
  });
1915
1942
  case "MapRecordValues":
1916
1943
  return () => ({
1917
1944
  type: "ScheduleSubroutine",
1918
- subroutine: es(o, e),
1945
+ subroutine: os(o, e),
1919
1946
  args: {
1920
- source: f(o, e.source)
1947
+ source: m(o, e.source)
1921
1948
  }
1922
1949
  });
1923
1950
  case "MakeObject":
1924
1951
  return () => ({
1925
1952
  type: "ScheduleSubroutine",
1926
- subroutine: Yo,
1927
- args: Wo(e.template, (r) => f(o, r))
1953
+ subroutine: Xo,
1954
+ args: qo(e.template, (r) => m(o, r))
1928
1955
  });
1929
1956
  case "MakeArray":
1930
1957
  return () => ({
1931
1958
  type: "ScheduleSubroutine",
1932
- subroutine: _t(e.template.length),
1933
- args: Gt(e.template, (r) => f(o, r))
1959
+ subroutine: zt(e.template.length),
1960
+ args: Wt(e.template, (r) => m(o, r))
1934
1961
  });
1935
1962
  case "Flatten":
1936
1963
  return () => ({
1937
1964
  type: "ScheduleSubroutine",
1938
- subroutine: Qo,
1965
+ subroutine: es,
1939
1966
  args: {
1940
- source: f(o, e.source)
1967
+ source: m(o, e.source)
1941
1968
  }
1942
1969
  });
1943
1970
  case "IsEmpty":
1944
1971
  return () => ({
1945
1972
  type: "ScheduleSubroutine",
1946
- subroutine: rs,
1973
+ subroutine: is,
1947
1974
  args: {
1948
- arg: f(o, e.arg)
1975
+ arg: m(o, e.arg)
1949
1976
  }
1950
1977
  });
1951
1978
  case "Not":
1952
1979
  return () => ({
1953
1980
  type: "ScheduleSubroutine",
1954
- subroutine: os,
1981
+ subroutine: ns,
1955
1982
  args: {
1956
- operand: f(o, e.operand)
1983
+ operand: m(o, e.operand)
1957
1984
  }
1958
1985
  });
1959
1986
  case "And":
1960
1987
  return () => ({
1961
1988
  type: "ScheduleSubroutine",
1962
- subroutine: ss,
1989
+ subroutine: as,
1963
1990
  args: {
1964
- operand1: f(o, e.operand1),
1965
- operand2: f(o, e.operand2)
1991
+ operand1: m(o, e.operand1),
1992
+ operand2: m(o, e.operand2)
1966
1993
  }
1967
1994
  });
1968
1995
  case "Or":
1969
1996
  return () => ({
1970
1997
  type: "ScheduleSubroutine",
1971
- subroutine: is,
1998
+ subroutine: cs,
1972
1999
  args: {
1973
- operand1: f(o, e.operand1),
1974
- operand2: f(o, e.operand2)
2000
+ operand1: m(o, e.operand1),
2001
+ operand2: m(o, e.operand2)
1975
2002
  }
1976
2003
  });
1977
2004
  case "MapResourceFields":
1978
2005
  return () => ({
1979
2006
  type: "ScheduleSubroutine",
1980
- subroutine: cs(o, e),
2007
+ subroutine: ds(o, e),
1981
2008
  args: {
1982
- source: f(o, e.source)
2009
+ source: m(o, e.source)
1983
2010
  }
1984
2011
  });
1985
2012
  case "GetResourceField":
1986
2013
  return () => ({
1987
2014
  type: "ScheduleSubroutine",
1988
- subroutine: Zo,
2015
+ subroutine: ts,
1989
2016
  args: {
1990
- source: f(o, e.source),
1991
- field: f(o, e.field)
2017
+ source: m(o, e.source),
2018
+ field: m(o, e.field)
1992
2019
  }
1993
2020
  });
1994
2021
  case "GetResourceValueAsJson":
1995
2022
  return () => ({
1996
2023
  type: "ScheduleSubroutine",
1997
- subroutine: ns,
2024
+ subroutine: ls,
1998
2025
  args: {
1999
- source: f(o, e.source)
2026
+ source: m(o, e.source)
2000
2027
  }
2001
2028
  });
2002
2029
  case "GetBlobContent":
2003
2030
  return () => ({
2004
2031
  type: "ScheduleSubroutine",
2005
- subroutine: ls,
2032
+ subroutine: gs,
2006
2033
  args: {
2007
- source: f(o, e.source)
2034
+ source: m(o, e.source)
2008
2035
  }
2009
2036
  });
2010
2037
  case "GetBlobContentAsString":
2011
2038
  return () => ({
2012
2039
  type: "ScheduleSubroutine",
2013
- subroutine: ds,
2040
+ subroutine: hs,
2014
2041
  args: {
2015
- source: f(o, e.source)
2042
+ source: m(o, e.source)
2016
2043
  }
2017
2044
  });
2018
2045
  case "GetBlobContentAsJson":
2019
2046
  return () => ({
2020
2047
  type: "ScheduleSubroutine",
2021
- subroutine: ps,
2048
+ subroutine: fs,
2022
2049
  args: {
2023
- source: f(o, e.source)
2050
+ source: m(o, e.source)
2024
2051
  }
2025
2052
  });
2026
2053
  case "GetDownloadedBlobContent":
2027
2054
  return () => ({
2028
2055
  type: "ScheduleSubroutine",
2029
- subroutine: gs,
2056
+ subroutine: ms,
2030
2057
  args: {
2031
- source: f(o, e.source)
2058
+ source: m(o, e.source)
2032
2059
  }
2033
2060
  });
2034
2061
  case "GetOnDemandBlobContent":
2035
2062
  return () => ({
2036
2063
  type: "ScheduleSubroutine",
2037
- subroutine: hs,
2064
+ subroutine: vs,
2038
2065
  args: {
2039
- source: f(o, e.source)
2066
+ source: m(o, e.source)
2040
2067
  }
2041
2068
  });
2042
2069
  case "GetImportProgress":
2043
2070
  return () => ({
2044
2071
  type: "ScheduleSubroutine",
2045
- subroutine: fs,
2072
+ subroutine: ys,
2046
2073
  args: {
2047
- source: f(o, e.source)
2074
+ source: m(o, e.source)
2048
2075
  }
2049
2076
  });
2050
2077
  case "GetLastLogs":
2051
2078
  return () => ({
2052
2079
  type: "ScheduleSubroutine",
2053
- subroutine: ms(e.lines),
2080
+ subroutine: bs(e.lines),
2054
2081
  args: {
2055
- source: f(o, e.source)
2082
+ source: m(o, e.source)
2056
2083
  }
2057
2084
  });
2058
2085
  case "GetProgressLog":
2059
2086
  return () => ({
2060
2087
  type: "ScheduleSubroutine",
2061
- subroutine: vs(e.patternToSearch),
2088
+ subroutine: ws(e.patternToSearch),
2062
2089
  args: {
2063
- source: f(o, e.source)
2090
+ source: m(o, e.source)
2064
2091
  }
2065
2092
  });
2066
2093
  case "GetLogHandle":
2067
2094
  return () => ({
2068
2095
  type: "ScheduleSubroutine",
2069
- subroutine: ys,
2096
+ subroutine: Ss,
2070
2097
  args: {
2071
- source: f(o, e.source)
2098
+ source: m(o, e.source)
2072
2099
  }
2073
2100
  });
2074
2101
  default:
2075
2102
  return D(e);
2076
2103
  }
2077
2104
  }
2078
- const bs = ["$prod", "$staging"];
2079
- function ws(o) {
2105
+ const ks = ["$prod", "$staging"];
2106
+ function Cs(o) {
2080
2107
  return {
2081
2108
  $blockId: o.blockId,
2082
2109
  $args: (e) => JSON.parse(o.args(e)),
@@ -2088,22 +2115,22 @@ function ws(o) {
2088
2115
  $staging: o.staging
2089
2116
  };
2090
2117
  }
2091
- const Ht = Symbol(), Wt = "return", Ss = { op: Ht, arg: Wt };
2092
- function ks(o) {
2093
- return o.op == Ht && o.arg == Wt;
2118
+ const Yt = Symbol(), qt = "return", Ps = { op: Yt, arg: qt };
2119
+ function Rs(o) {
2120
+ return o.op == Yt && o.arg == qt;
2094
2121
  }
2095
- function Cs() {
2122
+ function Bs() {
2096
2123
  return { pendingSubroutines: /* @__PURE__ */ new Map() };
2097
2124
  }
2098
- function ft(o, e, t, r) {
2099
- const s = new Ot(t), i = (a, c) => {
2100
- if (ks(a))
2125
+ function yt(o, e, t, r) {
2126
+ const s = new At(t), i = (a, c) => {
2127
+ if (Rs(a))
2101
2128
  return e.result = c, !1;
2102
- const u = k(e.pendingSubroutines.get(a.op));
2103
- if (a.arg in u.args) throw new Error("argument already set");
2104
- return u.args[a.arg] = c, u.argCounter--, u.argCounter === 0 && (e.pendingSubroutines.delete(a.op), s.push({
2105
- destination: u.destination,
2106
- operation: u.subroutine(u.args)
2129
+ const l = k(e.pendingSubroutines.get(a.op));
2130
+ if (a.arg in l.args) throw new Error("argument already set");
2131
+ return l.args[a.arg] = c, l.argCounter--, l.argCounter === 0 && (e.pendingSubroutines.delete(a.op), s.push({
2132
+ destination: l.destination,
2133
+ operation: l.subroutine(l.args)
2107
2134
  })), !0;
2108
2135
  }, n = [];
2109
2136
  e: for (; s.length > 0; ) {
@@ -2113,19 +2140,19 @@ function ft(o, e, t, r) {
2113
2140
  if (!i(a.destination, c.result)) break e;
2114
2141
  break;
2115
2142
  case "ScheduleSubroutine":
2116
- const u = Symbol(), l = Object.entries(c.args), d = l.length;
2143
+ const l = Symbol(), u = Object.entries(c.args), d = u.length;
2117
2144
  if (d === 0)
2118
2145
  s.push({
2119
2146
  destination: a.destination,
2120
2147
  operation: c.subroutine({})
2121
2148
  });
2122
2149
  else {
2123
- for (const [g, m] of l)
2150
+ for (const [g, h] of u)
2124
2151
  s.push({
2125
- destination: { op: u, arg: g },
2126
- operation: m
2152
+ destination: { op: l, arg: g },
2153
+ operation: h
2127
2154
  });
2128
- e.pendingSubroutines.set(u, {
2155
+ e.pendingSubroutines.set(l, {
2129
2156
  argCounter: d,
2130
2157
  args: {},
2131
2158
  subroutine: c.subroutine,
@@ -2147,35 +2174,35 @@ function ft(o, e, t, r) {
2147
2174
  }
2148
2175
  return n;
2149
2176
  }
2150
- function Ps(o, e, t, r = {}) {
2151
- return zt(o, ws(e), t, r);
2177
+ function Os(o, e, t, r = {}) {
2178
+ return Qt(o, Cs(e), t, r);
2152
2179
  }
2153
- function zt(o, e, t, r = {}) {
2154
- const s = `${e.blockId}#` + Me({
2180
+ function Qt(o, e, t, r = {}) {
2181
+ const s = `${e.blockId}#` + Ke({
2155
2182
  ctx: Object.fromEntries(
2156
- Object.entries(e).filter(([i]) => bs.indexOf(i) === -1)
2183
+ Object.entries(e).filter(([i]) => ks.indexOf(i) === -1)
2157
2184
  ),
2158
2185
  cfg: t
2159
2186
  });
2160
2187
  return P.makeRaw(
2161
2188
  (i) => {
2162
- const n = { drivers: o, cCtx: i }, a = Cs();
2189
+ const n = { drivers: o, cCtx: i }, a = Bs();
2163
2190
  return {
2164
- ir: ft(
2191
+ ir: yt(
2165
2192
  n,
2166
2193
  a,
2167
2194
  [
2168
2195
  {
2169
- destination: Ss,
2170
- operation: f(e, t)
2196
+ destination: Ps,
2197
+ operation: m(e, t)
2171
2198
  }
2172
2199
  ],
2173
2200
  !0
2174
2201
  ),
2175
- async postprocessValue(u) {
2176
- const l = [];
2177
- for (const v of u)
2178
- l.push({ destination: v.destination, operation: h(v.computable) });
2202
+ async postprocessValue(l) {
2203
+ const u = [];
2204
+ for (const v of l)
2205
+ u.push({ destination: v.destination, operation: f(v.computable) });
2179
2206
  const d = {
2180
2207
  drivers: o,
2181
2208
  get cCtx() {
@@ -2184,26 +2211,26 @@ function zt(o, e, t, r = {}) {
2184
2211
  }, g = /* @__PURE__ */ new Map();
2185
2212
  for (const [v, C] of a.pendingSubroutines)
2186
2213
  g.set(v, { ...C, args: { ...C.args } });
2187
- const m = {
2214
+ const h = {
2188
2215
  result: a.result,
2189
2216
  pendingSubroutines: g
2190
2217
  };
2191
- if (ft(d, m, l, !1), !("result" in m))
2218
+ if (yt(d, h, u, !1), !("result" in h))
2192
2219
  throw new Error("illegal cfg rendering stack state, no result");
2193
- return m.result;
2220
+ return h.result;
2194
2221
  }
2195
2222
  };
2196
2223
  },
2197
2224
  { ...r, key: s }
2198
2225
  );
2199
2226
  }
2200
- function Rs(o) {
2227
+ function Fs(o) {
2201
2228
  return o instanceof ArrayBuffer || ArrayBuffer.isView(o);
2202
2229
  }
2203
- function mt(o) {
2230
+ function bt(o) {
2204
2231
  return o !== void 0 ? Buffer.from(o).toString("base64") : void 0;
2205
2232
  }
2206
- class ye {
2233
+ class we {
2207
2234
  constructor(e, t, r, s, i) {
2208
2235
  p(this, "callbackRegistry");
2209
2236
  p(this, "fnJSONStringify");
@@ -2235,12 +2262,12 @@ class ye {
2235
2262
  try {
2236
2263
  this.vm.unwrapResult(this.vm.evalCode(e, "bundle.js", { type: "global" })).dispose();
2237
2264
  } catch (t) {
2238
- throw ye.cleanErrorContext(t), t;
2265
+ throw we.cleanErrorContext(t), t;
2239
2266
  }
2240
2267
  }
2241
2268
  runCallback(e, ...t) {
2242
2269
  try {
2243
- return Ae.withScope((r) => {
2270
+ return je.withScope((r) => {
2244
2271
  const s = r.manage(this.vm.getProp(this.callbackRegistry, e));
2245
2272
  if (this.vm.typeof(s) !== "function")
2246
2273
  throw new Error(`No such callback: ${e}`);
@@ -2255,7 +2282,7 @@ class ye {
2255
2282
  );
2256
2283
  });
2257
2284
  } catch (r) {
2258
- throw ye.cleanErrorContext(r), r;
2285
+ throw we.cleanErrorContext(r), r;
2259
2286
  }
2260
2287
  }
2261
2288
  //
@@ -2310,13 +2337,13 @@ class ye {
2310
2337
  return this.getAccessor(e).listDynamicFields();
2311
2338
  }
2312
2339
  getKeyValueBase64(e, t) {
2313
- return mt(this.getAccessor(e).getKeyValue(t));
2340
+ return bt(this.getAccessor(e).getKeyValue(t));
2314
2341
  }
2315
2342
  getKeyValueAsString(e, t) {
2316
2343
  return this.getAccessor(e).getKeyValueAsString(t);
2317
2344
  }
2318
2345
  getDataBase64(e) {
2319
- return mt(this.getAccessor(e).getData());
2346
+ return bt(this.getAccessor(e).getData());
2320
2347
  }
2321
2348
  getDataAsString(e) {
2322
2349
  return this.getAccessor(e).getDataAsString();
@@ -2327,16 +2354,16 @@ class ye {
2327
2354
  parsePObjectCollection(e, t, r) {
2328
2355
  const s = this.getAccessor(e);
2329
2356
  if (!s.getIsReadyOrError()) return;
2330
- const i = Ho(s, t, r), n = {};
2357
+ const i = Yo(s, t, r), n = {};
2331
2358
  for (const [a, c] of Object.entries(i))
2332
- n[a] = Z(c, (u) => this.wrapAccessor(u));
2359
+ n[a] = X(c, (l) => this.wrapAccessor(l));
2333
2360
  return n;
2334
2361
  }
2335
2362
  //
2336
2363
  // Blobs
2337
2364
  //
2338
2365
  registerComputable(e, t) {
2339
- const r = `${e}_${ie()}`;
2366
+ const r = `${e}_${ae()}`;
2340
2367
  return this.computablesToResolve[r] = t, r;
2341
2368
  }
2342
2369
  getBlobContentAsString(e) {
@@ -2445,7 +2472,7 @@ class ye {
2445
2472
  isComplete: e.isComplete,
2446
2473
  entries: e.entries.map((t) => ({
2447
2474
  ref: t.ref,
2448
- obj: Z(t.obj, (r) => this.wrapAccessor(r))
2475
+ obj: X(t.obj, (r) => this.wrapAccessor(r))
2449
2476
  }))
2450
2477
  };
2451
2478
  }
@@ -2458,7 +2485,7 @@ class ye {
2458
2485
  obj: {
2459
2486
  id: t.obj.id,
2460
2487
  spec: t.obj.spec,
2461
- data: wt(t.obj.data, (r) => this.wrapAccessor(r))
2488
+ data: Ct(t.obj.data, (r) => this.wrapAccessor(r))
2462
2489
  }
2463
2490
  }))
2464
2491
  };
@@ -2471,7 +2498,7 @@ class ye {
2471
2498
  return this.resultPool.getSpecByRef(e, t);
2472
2499
  }
2473
2500
  getDataFromResultPoolByRef(e, t) {
2474
- return Z(
2501
+ return X(
2475
2502
  this.resultPool.getDataByRef(e, t),
2476
2503
  (r) => this.wrapAccessor(r)
2477
2504
  );
@@ -2485,7 +2512,7 @@ class ye {
2485
2512
  "can't instantiate PFrames from this context (most porbably called from the future mapper)"
2486
2513
  );
2487
2514
  return this.env.driverKit.pFrameDriver.createPFrame(
2488
- e.map((t) => Z(t, (r) => this.getAccessor(r))),
2515
+ e.map((t) => X(t, (r) => this.getAccessor(r))),
2489
2516
  this.computableCtx
2490
2517
  );
2491
2518
  }
@@ -2495,7 +2522,7 @@ class ye {
2495
2522
  "can't instantiate PTable from this context (most porbably called from the future mapper)"
2496
2523
  );
2497
2524
  return this.env.driverKit.pFrameDriver.createPTable(
2498
- St(e, (t) => Z(t, (r) => this.getAccessor(r))),
2525
+ Pt(e, (t) => X(t, (r) => this.getAccessor(r))),
2499
2526
  this.computableCtx
2500
2527
  );
2501
2528
  }
@@ -2516,7 +2543,7 @@ class ye {
2516
2543
  }
2517
2544
  wrapAccessor(e) {
2518
2545
  if (e !== void 0) {
2519
- const t = ie();
2546
+ const t = ae();
2520
2547
  return this.accessors.set(t, e), t;
2521
2548
  }
2522
2549
  }
@@ -2548,7 +2575,7 @@ class ye {
2548
2575
  r = this.vm.null;
2549
2576
  break;
2550
2577
  }
2551
- if (Rs(e)) {
2578
+ if (Fs(e)) {
2552
2579
  r = this.vm.newArrayBuffer(e), s = !0;
2553
2580
  break;
2554
2581
  }
@@ -2584,7 +2611,7 @@ class ye {
2584
2611
  return JSON.parse(t);
2585
2612
  }
2586
2613
  injectCtx() {
2587
- Ae.withScope((e) => {
2614
+ je.withScope((e) => {
2588
2615
  const t = e.manage(this.vm.newObject()), r = this.blockCtx.args(this.computableCtx), s = this.blockCtx.uiState(this.computableCtx);
2589
2616
  this.vm.setProp(t, "args", e.manage(this.vm.newString(r))), s !== void 0 && this.vm.setProp(t, "uiState", e.manage(this.vm.newString(s))), this.vm.setProp(t, "callbackRegistry", this.callbackRegistry);
2590
2617
  const i = (n, a) => {
@@ -2598,7 +2625,7 @@ class ye {
2598
2625
  this.vm.getString(n),
2599
2626
  this.importObjectViaJson(a),
2600
2627
  ...c.map(
2601
- (u) => this.importObjectViaJson(u)
2628
+ (l) => this.importObjectViaJson(l)
2602
2629
  )
2603
2630
  ),
2604
2631
  void 0
@@ -2658,152 +2685,152 @@ class ye {
2658
2685
  });
2659
2686
  }
2660
2687
  }
2661
- function Se(o, e) {
2662
- return re(
2688
+ function Ce(o, e) {
2689
+ return se(
2663
2690
  o.traverse(
2664
2691
  {
2665
- field: O(e, "blockPack"),
2692
+ field: F(e, "blockPack"),
2666
2693
  assertFieldType: "Dynamic",
2667
2694
  errorIfFieldNotSet: !0
2668
2695
  },
2669
2696
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2670
2697
  ),
2671
2698
  (t) => {
2672
- const r = t.getDataAsJson(), s = kt(r.config);
2699
+ const r = t.getDataAsJson(), s = Rt(r.config);
2673
2700
  return { bpId: t.resourceInfo.id.toString(), info: r, cfg: s };
2674
2701
  }
2675
2702
  );
2676
2703
  }
2677
- const pe = process.env.MI_LOG_OUTPUT_STATUS;
2678
- function Bs(o, e, t, r, s, i = {}) {
2704
+ const he = process.env.MI_LOG_OUTPUT_STATUS;
2705
+ function Ds(o, e, t, r, s, i = {}) {
2679
2706
  const n = `${e.blockId}#lambda#${s}#${t.handle}`;
2680
2707
  return i = { ...i, key: n }, i.mode === void 0 && t.retentive === !0 && (i.mode = "StableOnlyRetentive"), P.makeRaw((a) => {
2681
- const c = new Ae();
2708
+ const c = new je();
2682
2709
  a.addOnDestroy(() => c.dispose());
2683
- const u = c.manage(o.quickJs.newRuntime());
2684
- u.setMemoryLimit(1024 * 640), u.setMaxStackSize(1024 * 320);
2685
- const l = c.manage(u.newContext()), d = new ye(c, l, e, o, a);
2710
+ const l = c.manage(o.quickJs.newRuntime());
2711
+ l.setMemoryLimit(1024 * 640), l.setMaxStackSize(1024 * 320);
2712
+ const u = c.manage(l.newContext()), d = new we(c, u, e, o, a);
2686
2713
  d.evaluateBundle(r.content);
2687
2714
  const g = d.runCallback(t.handle);
2688
2715
  d.resetComputableCtx();
2689
- let m = 0;
2690
- return pe && pe !== "unstable-only" && console.log(`Output ${t.handle} scaffold calculated.`), {
2716
+ let h = 0;
2717
+ return he && he !== "unstable-only" && console.log(`Output ${t.handle} scaffold calculated.`), {
2691
2718
  ir: d.computablesToResolve,
2692
2719
  postprocessValue: async (v, { unstableMarker: C, stable: I }) => {
2693
- for (const [N, $] of Object.entries(v)) d.runCallback(N, $);
2720
+ for (const [L, $] of Object.entries(v)) d.runCallback(L, $);
2694
2721
  const V = d.importObjectUniversal(g);
2695
- return m++, pe && (pe !== "unstable-only" || !I) && console.log(
2696
- I ? `Stable output ${t.handle} calculated ${V !== void 0 ? "defined" : "undefined"}; (#${m})` : `Unstable output ${t.handle}; marker = ${C}; ${V !== void 0 ? "defined" : "undefined"} (#${m})`
2722
+ return h++, he && (he !== "unstable-only" || !I) && console.log(
2723
+ I ? `Stable output ${t.handle} calculated ${V !== void 0 ? "defined" : "undefined"}; (#${h})` : `Unstable output ${t.handle}; marker = ${C}; ${V !== void 0 ? "defined" : "undefined"} (#${h})`
2697
2724
  ), V;
2698
2725
  }
2699
2726
  };
2700
2727
  }, i);
2701
2728
  }
2702
- function Fs(o) {
2703
- return Ct(o) ? o.isActive === !0 : qo(o);
2729
+ function xs(o) {
2730
+ return Bt(o) ? o.isActive === !0 : Zo(o);
2704
2731
  }
2705
- function oe(o, e, t, r, s, i = {}) {
2706
- if (Ct(t)) {
2732
+ function ie(o, e, t, r, s, i = {}) {
2733
+ if (Bt(t)) {
2707
2734
  if (r === void 0) throw new Error("No code bundle.");
2708
- return Bs(o, e, t, r, s, i);
2709
- } else return Ps(o.driverKit, e, t, i);
2735
+ return Ds(o, e, t, r, s, i);
2736
+ } else return Os(o.driverKit, e, t, i);
2710
2737
  }
2711
- function Os(o, e, t) {
2738
+ function As(o, e, t) {
2712
2739
  return P.make(
2713
2740
  (r) => {
2714
- var v, C, I, V, N, $, z, ue;
2715
- const s = r.accessor(o).node(), i = k(s.getKeyValueAsJson(_e)), n = k(s.getKeyValueAsJson(ne)), a = k(s.getKeyValueAsJson(ae)), c = k(s.getKeyValueAsJson(W)), u = k(
2716
- s.getKeyValueAsJson(me)
2717
- ), l = /* @__PURE__ */ new Map();
2741
+ var v, C, I, V, L, $, Y, de;
2742
+ const s = r.accessor(o).node(), i = k(s.getKeyValueAsJson(We)), n = k(s.getKeyValueAsJson(ce)), a = k(s.getKeyValueAsJson(le)), c = k(s.getKeyValueAsJson(z)), l = k(
2743
+ s.getKeyValueAsJson(ye)
2744
+ ), u = /* @__PURE__ */ new Map();
2718
2745
  for (const { id: S } of M(c)) {
2719
- const L = s.traverse({
2720
- field: O(S, "currentArgs"),
2746
+ const N = s.traverse({
2747
+ field: F(S, "currentArgs"),
2721
2748
  assertFieldType: "Dynamic",
2722
2749
  errorIfFieldNotSet: !0
2723
2750
  });
2724
2751
  let q;
2725
2752
  const j = s.traverse({
2726
- field: O(S, "prodArgs"),
2753
+ field: F(S, "prodArgs"),
2727
2754
  assertFieldType: "Dynamic",
2728
2755
  stableIfNotFound: !0
2729
2756
  });
2730
2757
  if (j !== void 0) {
2731
2758
  const A = s.getField({
2732
- field: O(S, "prodOutput"),
2759
+ field: F(S, "prodOutput"),
2733
2760
  assertFieldType: "Dynamic",
2734
2761
  errorIfFieldNotFound: !0
2735
2762
  }), B = s.getField({
2736
- field: O(S, "prodUiCtx"),
2763
+ field: F(S, "prodUiCtx"),
2737
2764
  assertFieldType: "Dynamic",
2738
2765
  errorIfFieldNotFound: !0
2739
2766
  });
2740
2767
  q = {
2741
2768
  arguments: j.getDataAsJson(),
2742
- stale: L.id !== j.id,
2769
+ stale: N.id !== j.id,
2743
2770
  outputError: A.error !== void 0 || B.error !== void 0 || ((v = A.value) == null ? void 0 : v.getError()) !== void 0 || ((C = B.value) == null ? void 0 : C.getError()) !== void 0,
2744
- outputsError: ((I = A.error) == null ? void 0 : I.getDataAsString()) ?? ((N = (V = A.value) == null ? void 0 : V.getError()) == null ? void 0 : N.getDataAsString()),
2745
- exportsError: (($ = B.error) == null ? void 0 : $.getDataAsString()) ?? ((ue = (z = B.value) == null ? void 0 : z.getError()) == null ? void 0 : ue.getDataAsString()),
2771
+ outputsError: ((I = A.error) == null ? void 0 : I.getDataAsString()) ?? ((L = (V = A.value) == null ? void 0 : V.getError()) == null ? void 0 : L.getDataAsString()),
2772
+ exportsError: (($ = B.error) == null ? void 0 : $.getDataAsString()) ?? ((de = (Y = B.value) == null ? void 0 : Y.getError()) == null ? void 0 : de.getDataAsString()),
2746
2773
  finished: (A.value !== void 0 && A.value.getIsReadyOrError() || A.error !== void 0 && A.error.getIsReadyOrError()) && (B.value !== void 0 && B.value.getIsReadyOrError() || B.error !== void 0 && B.error.getIsReadyOrError())
2747
2774
  };
2748
2775
  }
2749
- l.set(S, { currentArguments: L.getDataAsJson(), prod: q });
2776
+ u.set(S, { currentArguments: N.getDataAsJson(), prod: q });
2750
2777
  }
2751
- const d = ge(c, (S) => l.get(S).currentArguments), g = new Set(u.blocksInLimbo), m = [...M(c)].map(({ id: S, label: L, renderingMode: q }) => {
2752
- var Ye, Qe, Ze, Xe, et;
2753
- const j = k(l.get(S)), A = k(d.nodes.get(S));
2778
+ const d = fe(c, (S) => u.get(S).currentArguments), g = new Set(l.blocksInLimbo), h = [...M(c)].map(({ id: S, label: N, renderingMode: q }) => {
2779
+ var Ze, Xe, et, tt, rt;
2780
+ const j = k(u.get(S)), A = k(d.nodes.get(S));
2754
2781
  let B = "NotCalculated";
2755
2782
  j.prod !== void 0 && (g.has(S) ? B = "Limbo" : B = j.prod.finished ? "Done" : "Running");
2756
- const J = Se(s, S), { sections: le, title: X, inputsValid: y, sdkVersion: F } = re(J, ({ bpId: ee, cfg: _, info: Qs }) => {
2757
- const ke = ze(o, S);
2783
+ const J = Ce(s, S), { sections: pe, title: te, inputsValid: y, sdkVersion: O } = se(J, ({ bpId: re, cfg: H, info: ei }) => {
2784
+ const Pe = qe(o, S);
2758
2785
  return {
2759
- sections: oe(
2786
+ sections: ie(
2760
2787
  t,
2761
- ke,
2762
- _.sections,
2763
- _.code,
2764
- ee
2788
+ Pe,
2789
+ H.sections,
2790
+ H.code,
2791
+ re
2765
2792
  ),
2766
- title: re(
2767
- _.title,
2768
- (Xt) => oe(
2793
+ title: se(
2794
+ H.title,
2795
+ (rr) => ie(
2769
2796
  t,
2770
- ke,
2771
- Xt,
2772
- _.code,
2773
- ee
2797
+ Pe,
2798
+ rr,
2799
+ H.code,
2800
+ re
2774
2801
  )
2775
2802
  ),
2776
- inputsValid: oe(
2803
+ inputsValid: ie(
2777
2804
  t,
2778
- ke,
2779
- _.inputsValid,
2780
- _.code,
2781
- ee
2805
+ Pe,
2806
+ H.inputsValid,
2807
+ H.code,
2808
+ re
2782
2809
  ),
2783
- sdkVersion: _.sdkVersion
2810
+ sdkVersion: H.sdkVersion
2784
2811
  };
2785
- }) || {}, R = re(
2812
+ }) || {}, R = se(
2786
2813
  J,
2787
- ({ info: ee }) => t.blockUpdateWatcher.get(ee.source)
2814
+ ({ info: re }) => t.blockUpdateWatcher.get(re.source)
2788
2815
  );
2789
2816
  return {
2790
2817
  id: S,
2791
- label: X ?? L,
2792
- title: X ?? L,
2818
+ label: te ?? N,
2819
+ title: te ?? N,
2793
2820
  renderingMode: q,
2794
- stale: ((Ye = j.prod) == null ? void 0 : Ye.stale) !== !1 || B === "Limbo",
2821
+ stale: ((Ze = j.prod) == null ? void 0 : Ze.stale) !== !1 || B === "Limbo",
2795
2822
  missingReference: A.missingReferences,
2796
2823
  upstreams: [...d.traverseIdsExcludingRoots("upstream", S)],
2797
2824
  downstreams: [...d.traverseIdsExcludingRoots("downstream", S)],
2798
2825
  calculationStatus: B,
2799
- outputErrors: ((Qe = j.prod) == null ? void 0 : Qe.outputError) === !0,
2800
- outputsError: (Ze = j.prod) == null ? void 0 : Ze.outputsError,
2801
- exportsError: (Xe = j.prod) == null ? void 0 : Xe.exportsError,
2802
- sections: le,
2826
+ outputErrors: ((Xe = j.prod) == null ? void 0 : Xe.outputError) === !0,
2827
+ outputsError: (et = j.prod) == null ? void 0 : et.outputsError,
2828
+ exportsError: (tt = j.prod) == null ? void 0 : tt.exportsError,
2829
+ sections: pe,
2803
2830
  inputsValid: y,
2804
- currentBlockPack: (et = J == null ? void 0 : J.info) == null ? void 0 : et.source,
2831
+ currentBlockPack: (rt = J == null ? void 0 : J.info) == null ? void 0 : rt.source,
2805
2832
  updatedBlockPack: R,
2806
- sdkVersion: F,
2833
+ sdkVersion: O,
2807
2834
  navigationState: e.getState(S)
2808
2835
  };
2809
2836
  });
@@ -2811,8 +2838,8 @@ function Os(o, e, t) {
2811
2838
  meta: a,
2812
2839
  created: new Date(i),
2813
2840
  lastModified: new Date(n),
2814
- authorMarker: s.getKeyValueAsJson(Ee),
2815
- blocks: m
2841
+ authorMarker: s.getKeyValueAsJson(Ve),
2842
+ blocks: h
2816
2843
  };
2817
2844
  },
2818
2845
  {
@@ -2822,7 +2849,7 @@ function Os(o, e, t) {
2822
2849
  ...r,
2823
2850
  blocks: r.blocks.map((n) => {
2824
2851
  n.inputsValid || s.add(n.id), n.stale && i.add(n.id);
2825
- const a = n.stale || n.upstreams.findIndex((u) => i.has(u)) !== -1, c = (a || n.outputErrors) && !!n.inputsValid && !n.missingReference && n.upstreams.findIndex((u) => s.has(u)) === -1;
2852
+ const a = n.stale || n.upstreams.findIndex((l) => i.has(l)) !== -1, c = (a || n.outputErrors) && !!n.inputsValid && !n.missingReference && n.upstreams.findIndex((l) => s.has(l)) === -1;
2826
2853
  return { ...n, canRun: c, stale: a };
2827
2854
  })
2828
2855
  };
@@ -2830,13 +2857,13 @@ function Os(o, e, t) {
2830
2857
  }
2831
2858
  ).withStableType();
2832
2859
  }
2833
- function Ds(o, e) {
2860
+ function Ts(o, e) {
2834
2861
  const t = o.node();
2835
- if (G(t.resourceType, Vt)) {
2862
+ if (_(t.resourceType, Jt)) {
2836
2863
  const r = t.getDataAsJson();
2837
2864
  if (r === void 0) throw new Error("No resource data.");
2838
2865
  return e.frontendDownloadDriver.getPath(new URL(r.url)).withStableType();
2839
- } else if (G(t.resourceType, Nt)) {
2866
+ } else if (_(t.resourceType, Ut)) {
2840
2867
  const r = t.getDataAsJson();
2841
2868
  if (r === void 0) throw new Error("No resource data.");
2842
2869
  return e.signer.verify(
@@ -2847,10 +2874,10 @@ function Ds(o, e) {
2847
2874
  } else
2848
2875
  throw new Error(`Unsupported resource type: ${JSON.stringify(t.resourceType)}`);
2849
2876
  }
2850
- function xs(o, e) {
2877
+ function js(o, e) {
2851
2878
  if (o !== void 0)
2852
2879
  return P.make(
2853
- (t) => Ds(t.accessor(o), e),
2880
+ (t) => Ts(t.accessor(o), e),
2854
2881
  {
2855
2882
  postprocessValue: (t) => {
2856
2883
  if (t !== void 0) {
@@ -2862,86 +2889,86 @@ function xs(o, e) {
2862
2889
  }
2863
2890
  ).withStableType();
2864
2891
  }
2865
- function As(o, e, t) {
2892
+ function Es(o, e, t) {
2866
2893
  return P.make(
2867
2894
  (r) => {
2868
2895
  var a;
2869
- const s = r.accessor(o).node(), i = Se(s, e), n = (a = s.traverse(
2896
+ const s = r.accessor(o).node(), i = Ce(s, e), n = (a = s.traverse(
2870
2897
  {
2871
- field: O(e, "blockPack"),
2898
+ field: F(e, "blockPack"),
2872
2899
  assertFieldType: "Dynamic"
2873
2900
  },
2874
2901
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 },
2875
- { field: Jt, assertFieldType: "Input" }
2902
+ { field: $t, assertFieldType: "Input" }
2876
2903
  )) == null ? void 0 : a.persist();
2877
2904
  return {
2878
- path: xs(n, t),
2905
+ path: js(n, t),
2879
2906
  sdkVersion: i == null ? void 0 : i.cfg.sdkVersion
2880
2907
  };
2881
2908
  },
2882
2909
  { mode: "StableOnlyLive" }
2883
2910
  );
2884
2911
  }
2885
- function qt(o, e, t) {
2912
+ function Zt(o, e, t) {
2886
2913
  if (t === void 0)
2887
- return P.make((n) => qt(o, e, n), {
2888
- key: `inputs#${Bt(o.rid)}#${e}`
2914
+ return P.make((n) => Zt(o, e, n), {
2915
+ key: `inputs#${Dt(o.rid)}#${e}`
2889
2916
  });
2890
- const r = t.accessor(o).node(), s = ze(o, e), i = s.uiState(t);
2917
+ const r = t.accessor(o).node(), s = qe(o, e), i = s.uiState(t);
2891
2918
  return {
2892
- author: r.getKeyValueAsJson(je(e)),
2919
+ author: r.getKeyValueAsJson(Ie(e)),
2893
2920
  args: JSON.parse(s.args(t)),
2894
2921
  ui: i !== void 0 ? JSON.parse(i) : void 0
2895
2922
  };
2896
2923
  }
2897
- function Ts(o, e, t) {
2924
+ function Is(o, e, t) {
2898
2925
  return P.make(
2899
2926
  (r) => {
2900
- const s = r.accessor(o).node(), i = Kt(o, e);
2901
- return re(Se(s, e), ({ cfg: n, bpId: a }) => {
2927
+ const s = r.accessor(o).node(), i = Ht(o, e);
2928
+ return se(Ce(s, e), ({ cfg: n, bpId: a }) => {
2902
2929
  const c = {};
2903
- for (const [u, l] of Object.entries(n.outputs)) {
2904
- const d = oe(t, i, l, n.code, a);
2905
- c[u] = P.wrapError(d);
2930
+ for (const [l, u] of Object.entries(n.outputs)) {
2931
+ const d = ie(t, i, u, n.code, a);
2932
+ c[l] = P.wrapError(d);
2906
2933
  }
2907
2934
  return c;
2908
2935
  });
2909
2936
  },
2910
- { key: "outputs#" + Bt(o.rid) + "#" + e }
2937
+ { key: "outputs#" + Dt(o.rid) + "#" + e }
2911
2938
  ).withStableType();
2912
2939
  }
2913
- function js(o, e) {
2940
+ function Vs(o, e) {
2914
2941
  return P.make((t) => {
2915
- const r = t.accessor(o).node(), s = k(r.getKeyValueAsJson(W)), i = [];
2942
+ const r = t.accessor(o).node(), s = k(r.getKeyValueAsJson(z)), i = [];
2916
2943
  for (const { id: n, renderingMode: a } of M(s)) {
2917
- const c = Se(r, n);
2944
+ const c = Ce(r, n);
2918
2945
  if (c === void 0) continue;
2919
- const u = Object.entries(c.cfg.outputs).map(([, d]) => d).filter((d) => Fs(d)).map((d) => d);
2920
- if (u.length === 0) continue;
2921
- const l = Kt(r.persist(), n);
2922
- for (const d of u)
2946
+ const l = Object.entries(c.cfg.outputs).map(([, d]) => d).filter((d) => xs(d)).map((d) => d);
2947
+ if (l.length === 0) continue;
2948
+ const u = Ht(r.persist(), n);
2949
+ for (const d of l)
2923
2950
  i.push(
2924
- P.wrapError(oe(e, l, d, c.cfg.code, c.bpId))
2951
+ P.wrapError(ie(e, u, d, c.cfg.code, c.bpId))
2925
2952
  );
2926
2953
  }
2927
2954
  return i;
2928
2955
  });
2929
2956
  }
2930
- class Es {
2957
+ class Ls {
2931
2958
  constructor() {
2932
2959
  p(this, "states", /* @__PURE__ */ new Map());
2933
2960
  }
2934
2961
  setState(e, t) {
2935
2962
  const r = this.states.get(e);
2936
2963
  if (r === void 0) {
2937
- this.states.set(e, { state: t, change: new st() });
2964
+ this.states.set(e, { state: t, change: new at() });
2938
2965
  return;
2939
2966
  }
2940
2967
  r.state = { ...t }, r.change.markChanged();
2941
2968
  }
2942
2969
  readState(e, t) {
2943
2970
  let r = this.states.get(t);
2944
- return r === void 0 && (r = { state: { ...or }, change: new st() }, this.states.set(t, r)), r.change.attachWatcher(e.watcher), r.state;
2971
+ return r === void 0 && (r = { state: { ...nr }, change: new at() }, this.states.set(t, r)), r.change.attachWatcher(e.watcher), r.state;
2945
2972
  }
2946
2973
  getState(e) {
2947
2974
  return P.make(
@@ -2954,38 +2981,38 @@ class Es {
2954
2981
  t !== void 0 && (this.states.delete(e), t.change.markChanged());
2955
2982
  }
2956
2983
  }
2957
- class qe {
2984
+ class Qe {
2958
2985
  constructor(e, t, r) {
2959
2986
  /** Underlying pl resource id */
2960
2987
  p(this, "rid");
2961
2988
  /** Data for the left panel, contain basic information about block status. */
2962
2989
  p(this, "overview");
2963
- p(this, "navigationStates", new Es());
2990
+ p(this, "navigationStates", new Ls());
2964
2991
  p(this, "blockComputables", /* @__PURE__ */ new Map());
2965
2992
  p(this, "blockFrontends", /* @__PURE__ */ new Map());
2966
2993
  p(this, "activeConfigs");
2967
2994
  p(this, "refreshLoopResult");
2968
2995
  p(this, "abortController", new AbortController());
2969
2996
  p(this, "destroyed", !1);
2970
- this.env = e, this.projectTree = r, this.overview = Os(
2997
+ this.env = e, this.projectTree = r, this.overview = As(
2971
2998
  r.entry(),
2972
2999
  this.navigationStates,
2973
3000
  e
2974
- ).withPreCalculatedValueTree(), this.rid = t, this.refreshLoopResult = this.refreshLoop(), this.activeConfigs = js(r.entry(), e);
3001
+ ).withPreCalculatedValueTree(), this.rid = t, this.refreshLoopResult = this.refreshLoop(), this.activeConfigs = Vs(r.entry(), e);
2975
3002
  }
2976
3003
  async refreshLoop() {
2977
3004
  for (; !this.destroyed; )
2978
3005
  try {
2979
- await Fe(this.env.pl, this.rid, (e) => {
3006
+ await De(this.env.pl, this.rid, (e) => {
2980
3007
  e.doRefresh(this.env.ops.stagingRenderingRate);
2981
- }), await this.activeConfigs.getValue(), await Dt(this.env.ops.projectRefreshInterval, this.abortController.signal);
3008
+ }), await this.activeConfigs.getValue(), await Tt(this.env.ops.projectRefreshInterval, this.abortController.signal);
2982
3009
  } catch (e) {
2983
- if (mr(e)) {
3010
+ if (br(e)) {
2984
3011
  console.warn(
2985
3012
  "project refresh routine terminated, because project was externally deleted"
2986
3013
  );
2987
3014
  break;
2988
- } else if (!vr(e))
3015
+ } else if (!wr(e))
2989
3016
  throw new Error("Unexpected exception", { cause: e });
2990
3017
  }
2991
3018
  }
@@ -3000,13 +3027,13 @@ class qe {
3000
3027
  *
3001
3028
  * @return returns newly created block id
3002
3029
  * */
3003
- async addBlock(e, t, r, s = void 0, i = ie()) {
3004
- const n = await this.env.bpPreparer.prepare(t), a = await this.env.bpPreparer.getBlockConfigContainer(t), c = kt(a);
3030
+ async addBlock(e, t, r, s = void 0, i = ae()) {
3031
+ const n = await this.env.bpPreparer.prepare(t), a = await this.env.bpPreparer.getBlockConfigContainer(t), c = Rt(a);
3005
3032
  return await U(
3006
3033
  this.env.pl,
3007
3034
  this.rid,
3008
3035
  s,
3009
- (u) => u.addBlock(
3036
+ (l) => l.addBlock(
3010
3037
  {
3011
3038
  id: i,
3012
3039
  label: e,
@@ -3063,7 +3090,7 @@ class qe {
3063
3090
  id: i.id,
3064
3091
  label: i.label,
3065
3092
  blocks: e.map((a) => {
3066
- const c = i.blocks.find((u) => u.id === a);
3093
+ const c = i.blocks.find((l) => l.id === a);
3067
3094
  if (c === void 0) throw new Error(`Can't find block: ${a}`);
3068
3095
  return c;
3069
3096
  })
@@ -3079,7 +3106,7 @@ class qe {
3079
3106
  * stale state.
3080
3107
  * */
3081
3108
  async runBlock(e) {
3082
- await Fe(this.env.pl, this.rid, (t) => t.renderProduction([e], !0)), await this.projectTree.refreshState();
3109
+ await De(this.env.pl, this.rid, (t) => t.renderProduction([e], !0)), await this.projectTree.refreshState();
3083
3110
  }
3084
3111
  /**
3085
3112
  * Stops the block if it is running by destroying its production state. All
@@ -3087,7 +3114,7 @@ class qe {
3087
3114
  * calculated.
3088
3115
  * */
3089
3116
  async stopBlock(e) {
3090
- await Fe(this.env.pl, this.rid, (t) => t.stopProduction(e)), await this.projectTree.refreshState();
3117
+ await De(this.env.pl, this.rid, (t) => t.stopProduction(e)), await this.projectTree.refreshState();
3091
3118
  }
3092
3119
  // /** Update block label. */
3093
3120
  // public async setBlockLabel(blockId: string, label: string, author?: AuthorMarker) {
@@ -3144,9 +3171,9 @@ class qe {
3144
3171
  /** Resets arguments and ui state of the block to initial state */
3145
3172
  async resetBlockArgsAndUiState(e, t) {
3146
3173
  await this.env.pl.withWriteTx("BlockInputsReset", async (r) => {
3147
- const s = xe(
3148
- (await r.getField(w(this.rid, O(e, "blockPack")))).value
3149
- ), i = xe(
3174
+ const s = Te(
3175
+ (await r.getField(w(this.rid, F(e, "blockPack")))).value
3176
+ ), i = Te(
3150
3177
  (await r.getField(w(s, b.HolderRefField))).value
3151
3178
  ), n = await r.getResourceData(i, !1), a = JSON.parse(
3152
3179
  Buffer.from(k(n.data)).toString("utf-8")
@@ -3159,10 +3186,10 @@ class qe {
3159
3186
  getBlockComputables(e) {
3160
3187
  const t = this.blockComputables.get(e);
3161
3188
  if (t === void 0) {
3162
- const r = Ts(this.projectTree.entry(), e, this.env), i = {
3189
+ const r = Is(this.projectTree.entry(), e, this.env), i = {
3163
3190
  fullState: P.make(
3164
3191
  (n) => ({
3165
- argsAndUiState: qt(this.projectTree.entry(), e, n),
3192
+ argsAndUiState: Zt(this.projectTree.entry(), e, n),
3166
3193
  outputs: r,
3167
3194
  navigationState: this.navigationStates.getState(e)
3168
3195
  }),
@@ -3193,7 +3220,7 @@ class qe {
3193
3220
  getBlockFrontend(e) {
3194
3221
  const t = this.blockFrontends.get(e);
3195
3222
  if (t === void 0) {
3196
- const r = As(
3223
+ const r = Es(
3197
3224
  this.projectTree.entry(),
3198
3225
  e,
3199
3226
  this.env
@@ -3213,19 +3240,19 @@ class qe {
3213
3240
  await this.destroy();
3214
3241
  }
3215
3242
  static async init(e, t) {
3216
- const r = await Ft.init(
3243
+ const r = await xt.init(
3217
3244
  e.pl,
3218
3245
  t,
3219
3246
  {
3220
3247
  ...e.ops.defaultTreeOptions,
3221
- pruning: Is
3248
+ pruning: Ns
3222
3249
  },
3223
3250
  e.logger
3224
3251
  );
3225
- return new qe(e, t, r);
3252
+ return new Qe(e, t, r);
3226
3253
  }
3227
3254
  }
3228
- function Is(o) {
3255
+ function Ns(o) {
3229
3256
  switch (o.type.name) {
3230
3257
  case "BlockPackCustom":
3231
3258
  return o.fields.filter((e) => e.name !== "template");
@@ -3237,8 +3264,8 @@ function Is(o) {
3237
3264
  return o.fields;
3238
3265
  }
3239
3266
  }
3240
- const Yt = {
3241
- logger: new ur(),
3267
+ const Xt = {
3268
+ logger: new pr(),
3242
3269
  blobDriverOps: {
3243
3270
  cacheSoftSizeBytes: 100 * 1024 * 1024,
3244
3271
  // 100MB
@@ -3256,13 +3283,13 @@ const Yt = {
3256
3283
  stopPollingDelay: 1e3
3257
3284
  }
3258
3285
  };
3259
- function Qt(o) {
3286
+ function er(o) {
3260
3287
  return {
3261
3288
  blobDownloadPath: x.join(o, "download")
3262
3289
  };
3263
3290
  }
3264
- const Vs = {
3265
- ...Yt,
3291
+ const Js = {
3292
+ ...Xt,
3266
3293
  defaultTreeOptions: {
3267
3294
  pollingInterval: 350,
3268
3295
  stopPollingDelay: 2500
@@ -3271,18 +3298,18 @@ const Vs = {
3271
3298
  projectRefreshInterval: 700,
3272
3299
  stagingRenderingRate: 5
3273
3300
  };
3274
- function Ns(o) {
3301
+ function Us(o) {
3275
3302
  return {
3276
- ...Qt(o),
3303
+ ...er(o),
3277
3304
  frontendDownloadPath: x.join(o, "frontend")
3278
3305
  };
3279
3306
  }
3280
- const Ls = {
3307
+ const Ms = {
3281
3308
  minDelay: 1500
3282
- }, Js = "__no_updates__";
3283
- class Us extends Sr {
3309
+ }, $s = "__no_updates__";
3310
+ class Ks extends Pr {
3284
3311
  constructor(t, r, s = {}) {
3285
- super({ ...s, ...Ls }, r);
3312
+ super({ ...s, ...Ms }, r);
3286
3313
  p(this, "http");
3287
3314
  this.registryProvider = t, this.http = s.http;
3288
3315
  }
@@ -3295,51 +3322,74 @@ class Us extends Sr {
3295
3322
  case "from-registry-v2":
3296
3323
  return `from_registry_v2_${t.registryUrl}_${t.id.organization}_${t.id.name}_${t.id.version}`;
3297
3324
  default:
3298
- return Js;
3325
+ return $s;
3299
3326
  }
3300
3327
  }
3301
3328
  async readValue(t) {
3302
- var r;
3303
3329
  try {
3304
3330
  switch (t.type) {
3305
3331
  case "dev-v1":
3306
3332
  try {
3307
- const s = await At(t.folder);
3308
- return s === t.mtime ? void 0 : { ...t, mtime: s };
3309
- } catch (s) {
3310
- this.logger.warn(s);
3333
+ const r = await Et(t.folder);
3334
+ return r === t.mtime ? void 0 : { ...t, mtime: r };
3335
+ } catch (r) {
3336
+ this.logger.warn(r);
3311
3337
  return;
3312
3338
  }
3313
3339
  case "dev-v2":
3314
3340
  try {
3315
- const s = await De(t.folder, this.logger);
3316
- if (s === void 0) return;
3317
- const i = await Ge(s);
3318
- return i === t.mtime ? void 0 : { ...t, mtime: i };
3319
- } catch (s) {
3320
- this.logger.warn(s);
3341
+ const r = await Ae(t.folder, this.logger);
3342
+ if (r === void 0) return;
3343
+ const s = await He(r);
3344
+ return s === t.mtime ? void 0 : { ...t, mtime: s };
3345
+ } catch (r) {
3346
+ this.logger.warn(r);
3321
3347
  return;
3322
3348
  }
3323
3349
  case "from-registry-v2":
3324
3350
  try {
3325
- const s = this.registryProvider.getRegistry(t.registryUrl), i = (r = await s.getOverviewForSpec(t.id)) == null ? void 0 : r.spec;
3326
- if ((i == null ? void 0 : i.type) !== "from-registry-v2") throw new Error("Unexpected");
3327
- return Ce(i.id, t.id) ? void 0 : ((async () => {
3351
+ const r = this.registryProvider.getRegistry(t.registryUrl);
3352
+ let s;
3353
+ if (t.channel === void 0) {
3354
+ const i = await r.getLatestOverview(t.id, K);
3355
+ if (i) s = i.spec;
3356
+ else {
3357
+ const n = await r.getLatestOverview(t.id, ee);
3358
+ if (n === void 0) {
3359
+ this.logger.error(`No any channel record for ${ot(t.id)}`);
3360
+ return;
3361
+ }
3362
+ s = { ...n.spec, channel: K };
3363
+ }
3364
+ } else {
3365
+ const i = await r.getLatestOverview(t.id, t.channel);
3366
+ if (i) s = i.spec;
3367
+ else if (t.channel === K) {
3368
+ const n = await r.getLatestOverview(t.id, ee);
3369
+ if (n === void 0) {
3370
+ this.logger.error(`No any channel record for ${ot(t.id)}`);
3371
+ return;
3372
+ }
3373
+ s = { ...n.spec, channel: K };
3374
+ }
3375
+ }
3376
+ if ((s == null ? void 0 : s.type) !== "from-registry-v2") throw new Error("Unexpected");
3377
+ return Re(s.id, t.id) ? void 0 : ((async () => {
3328
3378
  try {
3329
- await s.getComponents(i.id);
3330
- } catch (n) {
3331
- this.logger.warn(n);
3379
+ await r.getComponents(s.id);
3380
+ } catch (i) {
3381
+ this.logger.warn(i);
3332
3382
  }
3333
- })(), i);
3334
- } catch (s) {
3335
- this.logger.warn(s);
3383
+ })(), s);
3384
+ } catch (r) {
3385
+ this.logger.warn(r);
3336
3386
  return;
3337
3387
  }
3338
3388
  default:
3339
3389
  return;
3340
3390
  }
3341
- } catch (s) {
3342
- this.logger.warn(s);
3391
+ } catch (r) {
3392
+ this.logger.warn(r);
3343
3393
  return;
3344
3394
  }
3345
3395
  }
@@ -3348,9 +3398,9 @@ class Us extends Sr {
3348
3398
  if (t === void 0 || r === void 0 || t.type !== r.type) return !1;
3349
3399
  switch (t.type) {
3350
3400
  case "from-registry-v1":
3351
- return r.type !== "from-registry-v1" ? !1 : t.registryUrl === r.registryUrl && Ce(t.id, r.id);
3401
+ return r.type !== "from-registry-v1" ? !1 : t.registryUrl === r.registryUrl && Re(t.id, r.id);
3352
3402
  case "from-registry-v2":
3353
- return r.type !== "from-registry-v2" ? !1 : t.registryUrl === r.registryUrl && Ce(t.id, r.id);
3403
+ return r.type !== "from-registry-v2" ? !1 : t.registryUrl === r.registryUrl && Re(t.id, r.id);
3354
3404
  case "dev-v1":
3355
3405
  return r.type !== "dev-v1" ? !1 : t.folder === r.folder && t.mtime === r.mtime;
3356
3406
  case "dev-v2":
@@ -3360,7 +3410,7 @@ class Us extends Sr {
3360
3410
  }
3361
3411
  }
3362
3412
  }
3363
- class vt {
3413
+ class wt {
3364
3414
  constructor() {
3365
3415
  p(this, "resources", /* @__PURE__ */ new Map());
3366
3416
  }
@@ -3395,11 +3445,11 @@ class vt {
3395
3445
  return (t = this.resources.get(e)) == null ? void 0 : t.resource;
3396
3446
  }
3397
3447
  }
3398
- function yt(o) {
3448
+ function St(o) {
3399
3449
  return String(o.id);
3400
3450
  }
3401
- const Ms = ["Int", "Long", "Float", "Double", "String", "Bytes"];
3402
- function Oe(o) {
3451
+ const Gs = ["Int", "Long", "Float", "Double", "String", "Bytes"];
3452
+ function xe(o) {
3403
3453
  const e = [], t = [];
3404
3454
  for (const r of o)
3405
3455
  r.type === "bySingleColumn" ? (e.push(r), t.push({
@@ -3412,9 +3462,9 @@ function Oe(o) {
3412
3462
  }
3413
3463
  return o;
3414
3464
  }
3415
- class $s {
3465
+ class _s {
3416
3466
  constructor(e, t, r) {
3417
- p(this, "pFrame", new Vr());
3467
+ p(this, "pFrame", new Jr());
3418
3468
  p(this, "blobIdToResource", /* @__PURE__ */ new Map());
3419
3469
  p(this, "blobHandleComputables", /* @__PURE__ */ new Map());
3420
3470
  p(this, "preloadBlob", async (e) => {
@@ -3436,8 +3486,8 @@ class $s {
3436
3486
  });
3437
3487
  this.blobDriver = e, this.blobContentCache = t, this.columns = r, this.pFrame.setDataSource(this);
3438
3488
  for (const s of r) {
3439
- for (const n of Lo(s.data)) this.blobIdToResource.set(yt(n), n);
3440
- const i = Jo(s.data, yt);
3489
+ for (const n of Mo(s.data)) this.blobIdToResource.set(St(n), n);
3490
+ const i = $o(s.data, St);
3441
3491
  try {
3442
3492
  this.pFrame.addColumnSpec(s.id, s.spec), this.pFrame.setColumnData(s.id, i);
3443
3493
  } catch (n) {
@@ -3459,7 +3509,7 @@ class $s {
3459
3509
  this.pFrame.dispose();
3460
3510
  }
3461
3511
  }
3462
- class Ks {
3512
+ class Hs {
3463
3513
  constructor(e) {
3464
3514
  p(this, "pFrames");
3465
3515
  p(this, "pTables");
@@ -3467,37 +3517,37 @@ class Ks {
3467
3517
  /** Limits concurrent requests to PFrame API to prevent deadlock with Node's IO threads */
3468
3518
  p(this, "concurrencyLimiter");
3469
3519
  this.blobDriver = e;
3470
- const t = new Nr({
3520
+ const t = new Ur({
3471
3521
  maxSize: 1e9,
3472
3522
  // 1Gb
3473
- fetchMethod: async (s) => await Rt.readFile(s),
3523
+ fetchMethod: async (s) => await Ft.readFile(s),
3474
3524
  sizeCalculation: (s) => s.length
3475
- }), r = new lr(1);
3476
- this.blobContentCache = t, this.concurrencyLimiter = r, this.pFrames = new class extends vt {
3525
+ }), r = new gr(1);
3526
+ this.blobContentCache = t, this.concurrencyLimiter = r, this.pFrames = new class extends wt {
3477
3527
  constructor(s) {
3478
3528
  super(), this.blobDriver = s;
3479
3529
  }
3480
3530
  createNewResource(s) {
3481
- return new $s(this.blobDriver, t, s);
3531
+ return new _s(this.blobDriver, t, s);
3482
3532
  }
3483
3533
  calculateParamsKey(s) {
3484
- return _s(s);
3534
+ return zs(s);
3485
3535
  }
3486
- }(this.blobDriver), this.pTables = new class extends vt {
3536
+ }(this.blobDriver), this.pTables = new class extends wt {
3487
3537
  constructor(s) {
3488
3538
  super(), this.pFrames = s;
3489
3539
  }
3490
3540
  async createNewResource(s) {
3491
3541
  const i = this.pFrames.getByKey(s.pFrameHandle), n = await r.run(
3492
3542
  async () => await i.pFrame.createTable({
3493
- src: se(s.def.src),
3494
- filters: Oe(s.def.filters)
3543
+ src: ne(s.def.src),
3544
+ filters: xe(s.def.filters)
3495
3545
  })
3496
3546
  );
3497
3547
  return s.def.sorting.length !== 0 ? n.sort(s.def.sorting) : n;
3498
3548
  }
3499
3549
  calculateParamsKey(s) {
3500
- return Gs(s);
3550
+ return Ws(s);
3501
3551
  }
3502
3552
  }(this.pFrames);
3503
3553
  }
@@ -3505,11 +3555,11 @@ class Ks {
3505
3555
  // Internal / Config API Methods
3506
3556
  //
3507
3557
  createPFrame(e, t) {
3508
- const r = e.filter((i) => Ms.find((n) => n === i.spec.valueType)).map((i) => Z(i, (n) => _o(n))), s = this.pFrames.acquire(r);
3558
+ const r = e.filter((i) => Gs.find((n) => n === i.spec.valueType)).map((i) => X(i, (n) => zo(n))), s = this.pFrames.acquire(r);
3509
3559
  return t.addOnDestroy(s.unref), s.key;
3510
3560
  }
3511
3561
  createPTable(e, t) {
3512
- const r = this.createPFrame(Hs(e.src), t), s = St(e, (n) => n.id), i = this.pTables.acquire({ def: s, pFrameHandle: r });
3562
+ const r = this.createPFrame(Ys(e.src), t), s = Pt(e, (n) => n.id), i = this.pTables.acquire({ def: s, pFrameHandle: r });
3513
3563
  return t.addOnDestroy(i.unref), i.key;
3514
3564
  }
3515
3565
  //
@@ -3539,8 +3589,8 @@ class Ks {
3539
3589
  async calculateTableData(e, t) {
3540
3590
  let r = await this.concurrencyLimiter.run(
3541
3591
  async () => await this.pFrames.getByKey(e).pFrame.createTable({
3542
- src: se(t.src),
3543
- filters: Oe(t.filters)
3592
+ src: ne(t.src),
3593
+ filters: xe(t.filters)
3544
3594
  })
3545
3595
  );
3546
3596
  if (t.sorting.length > 0) {
@@ -3561,7 +3611,7 @@ class Ks {
3561
3611
  return await this.concurrencyLimiter.run(
3562
3612
  async () => await this.pFrames.getByKey(e).pFrame.getUniqueValues({
3563
3613
  ...t,
3564
- filters: Oe(t.filters)
3614
+ filters: xe(t.filters)
3565
3615
  })
3566
3616
  );
3567
3617
  }
@@ -3581,7 +3631,7 @@ class Ks {
3581
3631
  );
3582
3632
  }
3583
3633
  }
3584
- function se(o) {
3634
+ function ne(o) {
3585
3635
  switch (o.type) {
3586
3636
  case "column":
3587
3637
  return {
@@ -3593,86 +3643,86 @@ function se(o) {
3593
3643
  case "full":
3594
3644
  return {
3595
3645
  type: o.type,
3596
- entries: o.entries.map((e) => se(e))
3646
+ entries: o.entries.map((e) => ne(e))
3597
3647
  };
3598
3648
  case "outer":
3599
3649
  return {
3600
3650
  type: "outer",
3601
- primary: se(o.primary),
3602
- secondary: o.secondary.map((e) => se(e))
3651
+ primary: ne(o.primary),
3652
+ secondary: o.secondary.map((e) => ne(e))
3603
3653
  };
3604
3654
  default:
3605
3655
  D(o);
3606
3656
  }
3607
3657
  }
3608
- function Gs(o) {
3609
- const e = be("sha256");
3610
- return e.update(o.pFrameHandle), e.update(Me(o.def)), e.digest().toString("hex");
3658
+ function Ws(o) {
3659
+ const e = Se("sha256");
3660
+ return e.update(o.pFrameHandle), e.update(Ke(o.def)), e.digest().toString("hex");
3611
3661
  }
3612
- function _s(o) {
3613
- const e = o.map((s) => s.id).sort(), t = be("sha256");
3662
+ function zs(o) {
3663
+ const e = o.map((s) => s.id).sort(), t = Se("sha256");
3614
3664
  let r = "";
3615
3665
  for (const s of e)
3616
3666
  r !== s && (t.update(s), r = s);
3617
3667
  return t.digest().toString("hex");
3618
3668
  }
3619
- function Hs(o) {
3669
+ function Ys(o) {
3620
3670
  const e = /* @__PURE__ */ new Map();
3621
- return he(o, e), [...e.values()];
3671
+ return me(o, e), [...e.values()];
3622
3672
  }
3623
- function he(o, e) {
3673
+ function me(o, e) {
3624
3674
  switch (o.type) {
3625
3675
  case "column":
3626
3676
  e.set(o.column.id, o.column);
3627
3677
  return;
3628
3678
  case "full":
3629
3679
  case "inner":
3630
- for (const t of o.entries) he(t, e);
3680
+ for (const t of o.entries) me(t, e);
3631
3681
  return;
3632
3682
  case "outer":
3633
- he(o.primary, e);
3634
- for (const t of o.secondary) he(t, e);
3683
+ me(o.primary, e);
3684
+ for (const t of o.secondary) me(t, e);
3635
3685
  return;
3636
3686
  default:
3637
3687
  D(o);
3638
3688
  }
3639
3689
  }
3640
- async function Ws(o, e, t) {
3690
+ async function qs(o, e, t) {
3641
3691
  const r = {
3642
- ...Yt,
3643
- ...Qt(e),
3692
+ ...Xt,
3693
+ ...er(e),
3644
3694
  ...t
3645
- }, s = new Pt(r.localSecret), i = Br(r.logger, o, r.localProjections), n = Fr(o, r.logger), a = Or(o, r.logger), c = Dr(o, r.logger), u = new xr(
3695
+ }, s = new Ot(r.localSecret), i = Dr(r.logger, o, r.localProjections), n = xr(o, r.logger), a = Ar(o, r.logger), c = Tr(o, r.logger), l = new jr(
3646
3696
  r.logger,
3647
3697
  i,
3648
3698
  n,
3649
3699
  r.blobDownloadPath,
3650
3700
  s,
3651
3701
  r.blobDriverOps
3652
- ), l = new Ar(
3702
+ ), u = new Er(
3653
3703
  r.logger,
3654
3704
  s,
3655
3705
  a,
3656
3706
  c,
3657
3707
  r.uploadDriverOps
3658
- ), d = new Tr(r.logger, n, r.logStreamDriverOps), g = new jr(r.logger, d, u), m = await Er.init(
3708
+ ), d = new Ir(r.logger, n, r.logStreamDriverOps), g = new Vr(r.logger, d, l), h = await Lr.init(
3659
3709
  r.logger,
3660
3710
  o,
3661
3711
  s,
3662
3712
  r.localProjections,
3663
3713
  r.openFileDialogCallback,
3664
3714
  r.virtualLocalStoragesOverride
3665
- ), v = new Ks(u);
3715
+ ), v = new Hs(l);
3666
3716
  return {
3667
- blobDriver: u,
3717
+ blobDriver: l,
3668
3718
  logDriver: g,
3669
- lsDriver: m,
3719
+ lsDriver: h,
3670
3720
  signer: s,
3671
- uploadDriver: l,
3721
+ uploadDriver: u,
3672
3722
  pFrameDriver: v
3673
3723
  };
3674
3724
  }
3675
- class Zt {
3725
+ class tr {
3676
3726
  constructor(e, t, r, s, i, n, a, c) {
3677
3727
  p(this, "pl");
3678
3728
  /** Contains a reactive list of projects along with their meta information. */
@@ -3691,10 +3741,10 @@ class Zt {
3691
3741
  // Project List Manipulation
3692
3742
  //
3693
3743
  /** Creates a project with initial state and adds it to project list. */
3694
- async createProject(e, t = ie()) {
3744
+ async createProject(e, t = ae()) {
3695
3745
  const r = await this.pl.withWriteTx("MLCreateProject", async (s) => {
3696
- const i = await No(s, e);
3697
- return s.createField(w(this.projectListResourceId, t), "Dynamic", i), await s.commit(), await yr(i);
3746
+ const i = await Uo(s, e);
3747
+ return s.createField(w(this.projectListResourceId, t), "Dynamic", i), await s.commit(), await Sr(i);
3698
3748
  });
3699
3749
  return await this.projectListTree.refreshState(), r;
3700
3750
  }
@@ -3714,7 +3764,7 @@ class Zt {
3714
3764
  async projectIdToResourceId(e) {
3715
3765
  return await this.pl.withReadTx("Project id to resource id", async (t) => {
3716
3766
  const r = (await t.getField(w(this.projectListResourceId, e))).value;
3717
- if (fe(r)) throw new Error("Unexpected project list structure.");
3767
+ if (ve(r)) throw new Error("Unexpected project list structure.");
3718
3768
  return r;
3719
3769
  });
3720
3770
  }
@@ -3725,7 +3775,7 @@ class Zt {
3725
3775
  async openProject(e) {
3726
3776
  const t = await this.ensureProjectRid(e);
3727
3777
  if (this.openedProjectsByRid.has(t)) throw new Error(`Project ${t} already opened`);
3728
- this.openedProjectsByRid.set(t, await qe.init(this.env, t)), this.openedProjectsList.setValue([...this.openedProjectsByRid.keys()]);
3778
+ this.openedProjectsByRid.set(t, await Qe.init(this.env, t)), this.openedProjectsList.setValue([...this.openedProjectsByRid.keys()]);
3729
3779
  }
3730
3780
  /** Closes the project, and deallocate all corresponding resources. */
3731
3781
  async closeProject(e) {
@@ -3753,33 +3803,33 @@ class Zt {
3753
3803
  /** Generates sufficiently random string to be used as local secret for the
3754
3804
  * middle layer */
3755
3805
  static generateLocalSecret() {
3756
- return Pt.generateSecret();
3806
+ return Ot.generateSecret();
3757
3807
  }
3758
3808
  /** Initialize middle layer */
3759
3809
  static async init(e, t, r) {
3760
3810
  const s = {
3761
- ...Vs,
3762
- ...Ns(t),
3811
+ ...Js,
3812
+ ...Us(t),
3763
3813
  ...r
3764
3814
  };
3765
3815
  process.env.MI_LOG_TREE_STAT && (s.defaultTreeOptions.logStat = process.env.MI_LOG_TREE_STAT === "cumulative" ? "cumulative" : "per-request");
3766
3816
  const i = await e.withWriteTx("MLInitialization", async (C) => {
3767
- const I = w(C.clientRoot, so);
3817
+ const I = w(C.clientRoot, ao);
3768
3818
  C.createField(I, "Dynamic");
3769
3819
  const V = await C.getField(I);
3770
- if (fe(V.value)) {
3771
- const N = C.createEphemeral(Et);
3772
- return C.lock(N), C.setField(I, N), await C.commit(), await N.globalId;
3820
+ if (ve(V.value)) {
3821
+ const L = C.createEphemeral(Lt);
3822
+ return C.lock(L), C.setField(I, L), await C.commit(), await L.globalId;
3773
3823
  } else
3774
3824
  return V.value;
3775
- }), n = s.logger, a = await Ws(e, t, s), c = new sr(e.httpDispatcher, {
3825
+ }), n = s.logger, a = await qs(e, t, s), c = new ar(e.httpDispatcher, {
3776
3826
  minTimeout: 250,
3777
3827
  maxRetries: 4
3778
- }), u = new Hr(c), l = new xo(
3779
- u,
3828
+ }), l = new Yr(c), u = new jo(
3829
+ l,
3780
3830
  a.signer,
3781
3831
  c
3782
- ), d = new Ir(
3832
+ ), d = new Nr(
3783
3833
  n,
3784
3834
  e.httpDispatcher,
3785
3835
  s.frontendDownloadPath
@@ -3790,28 +3840,28 @@ class Zt {
3790
3840
  httpDispatcher: e.httpDispatcher,
3791
3841
  retryHttpDispatcher: c,
3792
3842
  ops: s,
3793
- bpPreparer: l,
3843
+ bpPreparer: u,
3794
3844
  frontendDownloadDriver: d,
3795
3845
  driverKit: a,
3796
- blockUpdateWatcher: new Us(u, n, {
3846
+ blockUpdateWatcher: new Ks(l, n, {
3797
3847
  minDelay: s.devBlockUpdateRecheckInterval,
3798
3848
  http: c
3799
3849
  }),
3800
- quickJs: await Rr()
3801
- }, m = new kr([]), v = await no(e, i, m, g);
3802
- return new Zt(
3850
+ quickJs: await Fr()
3851
+ }, h = new Rr([]), v = await lo(e, i, h, g);
3852
+ return new tr(
3803
3853
  g,
3804
3854
  a,
3805
3855
  a.signer,
3806
3856
  i,
3807
- m,
3857
+ h,
3808
3858
  v.tree,
3809
- u,
3859
+ l,
3810
3860
  v.computable
3811
3861
  );
3812
3862
  }
3813
3863
  }
3814
- const zs = [
3864
+ const Qs = [
3815
3865
  "undici:request:create",
3816
3866
  // When a new request is created
3817
3867
  "undici:request:bodySent",
@@ -3849,7 +3899,7 @@ const zs = [
3849
3899
  "undici:dispatcher:retry"
3850
3900
  // When a dispatcher retries a request
3851
3901
  ];
3852
- async function Bi(o, e = {}) {
3902
+ async function Di(o, e = {}) {
3853
3903
  const t = {
3854
3904
  pingCheckDurationMs: 1e4,
3855
3905
  pingTimeoutMs: 3e3,
@@ -3867,15 +3917,15 @@ async function Bi(o, e = {}) {
3867
3917
  bodyLimit: 300,
3868
3918
  ...e
3869
3919
  }, r = [];
3870
- zs.forEach((c) => {
3871
- Lr(c).subscribe((l) => {
3920
+ Qs.forEach((c) => {
3921
+ Mr(c).subscribe((u) => {
3872
3922
  var g;
3873
3923
  const d = (/* @__PURE__ */ new Date()).toISOString();
3874
- (g = l == null ? void 0 : l.response) != null && g.headers && (l.response.headers = l.response.headers.map((m) => m.toString())), r.push(
3924
+ (g = u == null ? void 0 : u.response) != null && g.headers && (u.response.headers = u.response.headers.map((h) => h.toString())), r.push(
3875
3925
  JSON.stringify({
3876
3926
  timestamp: d,
3877
3927
  event: c,
3878
- data: l
3928
+ data: u
3879
3929
  })
3880
3930
  );
3881
3931
  });
@@ -3887,56 +3937,56 @@ async function Bi(o, e = {}) {
3887
3937
  blockRegistryUiChecks: [],
3888
3938
  blockGARegistryUiChecks: [],
3889
3939
  autoUpdateCdnChecks: []
3890
- }, i = br(o, { defaultRequestTimeout: t.pingTimeoutMs });
3891
- s.plPings = await Y(t.pingCheckDurationMs, t.maxPingsPerSecond, async () => {
3892
- const u = await new ot(i).ping();
3893
- return JSON.stringify(u).slice(0, t.bodyLimit) + "...";
3940
+ }, i = kr(o, { defaultRequestTimeout: t.pingTimeoutMs });
3941
+ s.plPings = await Q(t.pingCheckDurationMs, t.maxPingsPerSecond, async () => {
3942
+ const l = await new nt(i).ping();
3943
+ return JSON.stringify(l).slice(0, t.bodyLimit) + "...";
3894
3944
  });
3895
- const a = new ot(i).ll.httpDispatcher;
3896
- return s.blockRegistryOverviewChecks = await Y(
3945
+ const a = new nt(i).ll.httpDispatcher;
3946
+ return s.blockRegistryOverviewChecks = await Q(
3897
3947
  t.blockRegistryDurationMs,
3898
3948
  t.maxRegistryChecksPerSecond,
3899
- async () => await te(new URL(t.blockOverviewPath, t.blockRegistryUrl), t, a)
3900
- ), s.blockGARegistryOverviewChecks = await Y(
3949
+ async () => await oe(new URL(t.blockOverviewPath, t.blockRegistryUrl), t, a)
3950
+ ), s.blockGARegistryOverviewChecks = await Q(
3901
3951
  t.blockRegistryDurationMs,
3902
3952
  t.maxRegistryChecksPerSecond,
3903
- async () => await te(new URL(t.blockOverviewPath, t.blockGARegistryUrl), t, a)
3904
- ), s.blockRegistryUiChecks = await Y(
3953
+ async () => await oe(new URL(t.blockOverviewPath, t.blockGARegistryUrl), t, a)
3954
+ ), s.blockRegistryUiChecks = await Q(
3905
3955
  t.blockRegistryDurationMs,
3906
3956
  t.maxRegistryChecksPerSecond,
3907
- async () => await te(new URL(t.blockUiPath, t.blockRegistryUrl), t, a)
3908
- ), s.blockGARegistryUiChecks = await Y(
3957
+ async () => await oe(new URL(t.blockUiPath, t.blockRegistryUrl), t, a)
3958
+ ), s.blockGARegistryUiChecks = await Q(
3909
3959
  t.blockRegistryDurationMs,
3910
3960
  t.maxRegistryChecksPerSecond,
3911
- async () => await te(new URL(t.blockUiPath, t.blockGARegistryUrl), t, a)
3912
- ), s.autoUpdateCdnChecks = await Y(
3961
+ async () => await oe(new URL(t.blockUiPath, t.blockGARegistryUrl), t, a)
3962
+ ), s.autoUpdateCdnChecks = await Q(
3913
3963
  t.autoUpdateCdnDurationMs,
3914
3964
  t.maxAutoUpdateCdnChecksPerSecond,
3915
- async () => await te(t.autoUpdateCdnUrl, t, a)
3916
- ), qs(s, o, t, r);
3965
+ async () => await oe(t.autoUpdateCdnUrl, t, a)
3966
+ ), Zs(s, o, t, r);
3917
3967
  }
3918
- async function Y(o, e, t) {
3919
- const r = Ue(), s = [];
3920
- for (; bt(r) < o; ) {
3921
- const i = Ue();
3968
+ async function Q(o, e, t) {
3969
+ const r = $e(), s = [];
3970
+ for (; kt(r) < o; ) {
3971
+ const i = $e();
3922
3972
  let n;
3923
3973
  try {
3924
3974
  n = { ok: !0, value: await t() };
3925
- } catch (u) {
3926
- n = { ok: !1, error: u };
3975
+ } catch (l) {
3976
+ n = { ok: !1, error: l };
3927
3977
  }
3928
- const a = bt(i);
3978
+ const a = kt(i);
3929
3979
  s.push({
3930
3980
  elapsedMs: a,
3931
3981
  response: n
3932
3982
  });
3933
3983
  const c = 1e3 / e - a;
3934
- c > 0 && await Dt(c);
3984
+ c > 0 && await Tt(c);
3935
3985
  }
3936
3986
  return s;
3937
3987
  }
3938
- async function te(o, e, t) {
3939
- const { body: r, statusCode: s } = await K(o, {
3988
+ async function oe(o, e, t) {
3989
+ const { body: r, statusCode: s } = await G(o, {
3940
3990
  dispatcher: t,
3941
3991
  headersTimeout: e.httpTimeoutMs,
3942
3992
  bodyTimeout: e.httpTimeoutMs
@@ -3946,7 +3996,7 @@ async function te(o, e, t) {
3946
3996
  beginningOfBody: i.slice(0, e.bodyLimit) + "..."
3947
3997
  };
3948
3998
  }
3949
- function qs(o, e, t, r) {
3999
+ function Zs(o, e, t, r) {
3950
4000
  const s = o.plPings.filter((a) => a.response.ok), i = o.plPings.filter((a) => !a.response.ok), n = [
3951
4001
  ...new Set(s.map((a) => JSON.stringify(a.response.value)))
3952
4002
  ];
@@ -3955,17 +4005,17 @@ Network report:
3955
4005
  pl endpoint: ${e};
3956
4006
  options: ${JSON.stringify(t, null, 2)}.
3957
4007
 
3958
- Platforma pings: ${Q(o.plPings)}
4008
+ Platforma pings: ${Z(o.plPings)}
3959
4009
 
3960
- Block registry overview responses: ${Q(o.blockRegistryOverviewChecks)}
4010
+ Block registry overview responses: ${Z(o.blockRegistryOverviewChecks)}
3961
4011
 
3962
- Block ga registry overview responses: ${Q(o.blockGARegistryOverviewChecks)}
4012
+ Block ga registry overview responses: ${Z(o.blockGARegistryOverviewChecks)}
3963
4013
 
3964
- Block registry ui responses: ${Q(o.blockRegistryUiChecks)}
4014
+ Block registry ui responses: ${Z(o.blockRegistryUiChecks)}
3965
4015
 
3966
- Block ga registry ui responses: ${Q(o.blockGARegistryUiChecks)}
4016
+ Block ga registry ui responses: ${Z(o.blockGARegistryUiChecks)}
3967
4017
 
3968
- Auto-update CDN responses: ${Q(o.autoUpdateCdnChecks)}
4018
+ Auto-update CDN responses: ${Z(o.autoUpdateCdnChecks)}
3969
4019
 
3970
4020
  Block registry overview dumps:
3971
4021
  ${JSON.stringify(o.blockRegistryOverviewChecks, null, 2)}
@@ -3993,8 +4043,8 @@ ${r.join(`
3993
4043
  `)}
3994
4044
  `;
3995
4045
  }
3996
- function Q(o) {
3997
- const e = o.filter((s) => s.response.ok), { mean: t, median: r } = Ys(o);
4046
+ function Z(o) {
4047
+ const e = o.filter((s) => s.response.ok), { mean: t, median: r } = Xs(o);
3998
4048
  return `
3999
4049
  total: ${o.length};
4000
4050
  successes: ${e.length};
@@ -4003,7 +4053,7 @@ mean in ms: ${t};
4003
4053
  median in ms: ${r};
4004
4054
  `;
4005
4055
  }
4006
- function Ys(o) {
4056
+ function Xs(o) {
4007
4057
  const e = o.map((s) => s.elapsedMs), t = e.reduce((s, i) => s + i) / e.length;
4008
4058
  let r;
4009
4059
  if (e.length > 0) {
@@ -4012,40 +4062,40 @@ function Ys(o) {
4012
4062
  }
4013
4063
  return { mean: t, median: r };
4014
4064
  }
4015
- function Ue() {
4065
+ function $e() {
4016
4066
  return Date.now();
4017
4067
  }
4018
- function bt(o) {
4019
- return Ue() - o;
4068
+ function kt(o) {
4069
+ return $e() - o;
4020
4070
  }
4021
4071
  export {
4022
- ki as BlockPackRegistry,
4023
- Ci as CentralBlockRegistry,
4024
- Qt as DefaultDriverKitOpsPaths,
4025
- Yt as DefaultDriverKitOpsSettings,
4026
- Ns as DefaultMiddleLayerOpsPaths,
4027
- Vs as DefaultMiddleLayerOpsSettings,
4028
- Nt as FrontendFromFolderResourceType,
4029
- Vt as FrontendFromUrlResourceType,
4030
- Zt as MiddleLayer,
4031
- qe as Project,
4032
- vo as TengoTemplateGet,
4033
- yo as TengoTemplateGetRegistry,
4034
- wo as TengoTemplateGetTemplate,
4035
- bo as TengoTemplateGetTemplateURI,
4036
- So as TengoTemplatePack,
4037
- ko as TengoTemplatePackConvert,
4038
- Po as TengoTemplatePackConvertTemplate,
4039
- Co as TengoTemplatePackConvertTemplatePack,
4040
- Ri as V1CentralDevSnapshotRegistry,
4041
- Pi as V1CentralRegistry,
4042
- Hr as V2RegistryProvider,
4043
- Bi as checkNetwork,
4044
- It as createRenderTemplate,
4045
- At as getDevV1PacketMtime,
4046
- Ge as getDevV2PacketMtime,
4047
- Ws as initDriverKit,
4048
- He as loadTemplate,
4049
- Ro as prepareTemplateSpec
4072
+ Ri as BlockPackRegistry,
4073
+ Bi as CentralBlockRegistry,
4074
+ er as DefaultDriverKitOpsPaths,
4075
+ Xt as DefaultDriverKitOpsSettings,
4076
+ Us as DefaultMiddleLayerOpsPaths,
4077
+ Js as DefaultMiddleLayerOpsSettings,
4078
+ Ut as FrontendFromFolderResourceType,
4079
+ Jt as FrontendFromUrlResourceType,
4080
+ tr as MiddleLayer,
4081
+ Qe as Project,
4082
+ wo as TengoTemplateGet,
4083
+ So as TengoTemplateGetRegistry,
4084
+ Co as TengoTemplateGetTemplate,
4085
+ ko as TengoTemplateGetTemplateURI,
4086
+ Po as TengoTemplatePack,
4087
+ Ro as TengoTemplatePackConvert,
4088
+ Oo as TengoTemplatePackConvertTemplate,
4089
+ Bo as TengoTemplatePackConvertTemplatePack,
4090
+ Fi as V1CentralDevSnapshotRegistry,
4091
+ Oi as V1CentralRegistry,
4092
+ Yr as V2RegistryProvider,
4093
+ Di as checkNetwork,
4094
+ Nt as createRenderTemplate,
4095
+ Et as getDevV1PacketMtime,
4096
+ He as getDevV2PacketMtime,
4097
+ qs as initDriverKit,
4098
+ ze as loadTemplate,
4099
+ Fo as prepareTemplateSpec
4050
4100
  };
4051
4101
  //# sourceMappingURL=index.mjs.map