@milaboratories/pl-middle-layer 1.10.36 → 1.10.39

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,33 +1,33 @@
1
- var Kt = Object.defineProperty;
2
- var Mt = (o, e, t) => e in o ? Kt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
- var d = (o, e, t) => Mt(o, typeof e != "symbol" ? e + "" : e, t);
4
- import { executePSpecPredicate as Ut, mapPObjectData as q, mapValueInVOE as $t, mapPTableDef as ct, isFunctionHandle as ut, normalizeBlockConfig as De, DefaultNavigationState as Gt } from "@platforma-sdk/model";
1
+ var Mt = Object.defineProperty;
2
+ var Ut = (o, e, t) => e in o ? Mt(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
3
+ var d = (o, e, t) => Ut(o, typeof e != "symbol" ? e + "" : e, t);
4
+ import { executePSpecPredicate as $t, mapPObjectData as q, mapValueInVOE as Gt, mapPTableDef as ut, isFunctionHandle as lt, normalizeBlockConfig as je, DefaultNavigationState as Ht } from "@platforma-sdk/model";
5
5
  export * from "@platforma-sdk/model";
6
- import { blockPackIdEquals as Ht } from "@milaboratories/pl-model-middle-layer";
6
+ import { blockPackIdEquals as me } from "@milaboratories/pl-model-middle-layer";
7
7
  export * from "@milaboratories/pl-model-middle-layer";
8
8
  import { request as G, RetryAgent as _t } from "undici";
9
- import { RegistryV1 as H, tryLoadPackDescription as lt, BlockPackMetaEmbedAbsoluteBytes as Wt, RegistryV2Reader as zt, folderReaderByUrl as Yt, loadPackDescription as He } from "@platforma-sdk/block-tools";
9
+ import { RegistryV1 as H, tryLoadPackDescription as dt, BlockPackMetaEmbedAbsoluteBytes as Wt, RegistryV2Reader as zt, folderReaderByUrl as Yt, loadPackDescription as _e } from "@platforma-sdk/block-tools";
10
10
  import T from "node:fs";
11
11
  import I from "node:path";
12
12
  import qt from "yaml";
13
- import { assertNever as O, notEmpty as w, ConsoleLoggerAdapter as Qt, HmacSha256Signer as dt } from "@milaboratories/ts-helpers";
13
+ import { assertNever as O, notEmpty as w, ConsoleLoggerAdapter as Qt, HmacSha256Signer as pt } from "@milaboratories/ts-helpers";
14
14
  import * as Zt from "node:fs/promises";
15
15
  import { tryResolve as Xt } from "@milaboratories/resolve-helper";
16
- import { resourceTypesEqual as U, field as S, Pl as b, PlClient as er, isNullResourceId as ce, ensureResourceIdNotNull as we, isResource as tr, isResourceRef as rr, isNotNullResourceId as _e, resourceType as te, resourceTypeToString as or, resourceIdToString as pt, isNotFoundError as sr, isTimeoutOrCancelError as ir, toGlobalResourceId as nr } from "@milaboratories/pl-client";
16
+ import { resourceTypesEqual as U, field as S, Pl as b, PlClient as er, isNullResourceId as ce, ensureResourceIdNotNull as Se, isResource as tr, isResourceRef as rr, isNotNullResourceId as We, resourceType as te, resourceTypeToString as or, resourceIdToString as gt, isNotFoundError as sr, isTimeoutOrCancelError as ir, toGlobalResourceId as nr } from "@milaboratories/pl-client";
17
17
  export * from "@milaboratories/pl-client";
18
- import { SynchronizedTreeState as gt, PlError as ar } from "@milaboratories/pl-tree";
19
- import { Computable as P, ChangeSource as We, PollComputablePool as cr, WatchableValue as ur } from "@milaboratories/computable";
18
+ import { SynchronizedTreeState as ht, PlError as ar } from "@milaboratories/pl-tree";
19
+ import { Computable as P, ChangeSource as ze, PollComputablePool as cr, WatchableValue as ur } from "@milaboratories/computable";
20
20
  import { randomUUID as Z, createHash as ge } from "node:crypto";
21
- import ht from "denque";
21
+ import ft from "denque";
22
22
  import { Templates as lr } from "@platforma-sdk/workflow-tengo";
23
- import je from "canonicalize";
23
+ import Ee from "canonicalize";
24
24
  import dr from "node:assert";
25
- import { Scope as Se, getQuickJS as pr } from "quickjs-emscripten";
25
+ import { Scope as ke, getQuickJS as pr } from "quickjs-emscripten";
26
26
  import { setTimeout as gr } from "node:timers/promises";
27
- import * as ft from "node:os";
27
+ import * as mt from "node:os";
28
28
  import { createDownloadClient as hr, createLogsClient as fr, createUploadBlobClient as mr, createUploadProgressClient as vr, createLsFilesClient as yr, DownloadDriver as br, UploadDriver as wr, LogsStreamDriver as Sr, LogsDriver as kr, LsDriver as Cr, DownloadUrlDriver as Pr } from "@milaboratories/pl-drivers";
29
29
  import { PFrame as Fr } from "@milaboratories/pframes-node";
30
- async function ze(o) {
30
+ async function Ye(o) {
31
31
  try {
32
32
  return await Zt.stat(o, { bigint: !0 });
33
33
  } catch (e) {
@@ -36,30 +36,30 @@ async function ze(o) {
36
36
  throw e;
37
37
  }
38
38
  }
39
- const Br = [H.PlPackageYamlConfigFile], Rr = [H.PlPackageJsonConfigFile], Ee = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Te = ["config", "dist", "config.json"], mt = ["frontend", "dist"], Ye = "block-model/dist/config.json", Or = "block-ui/package.json", xr = [
40
- Ee,
39
+ const Br = [H.PlPackageYamlConfigFile], Rr = [H.PlPackageJsonConfigFile], Te = ["backend", "dist", "tengo", "tpl", "main.plj.gz"], Ae = ["config", "dist", "config.json"], vt = ["frontend", "dist"], qe = "block-model/dist/config.json", Or = "block-ui/package.json", xr = [
41
40
  Te,
41
+ Ae,
42
42
  Br,
43
43
  Rr,
44
- mt
44
+ vt
45
45
  ];
46
46
  async function Dr(o) {
47
- return await ze(I.join(o, ...Te)) !== void 0 || await ze(I.join(o, ...Ee)) !== void 0;
47
+ return await Ye(I.join(o, ...Ae)) !== void 0 || await Ye(I.join(o, ...Te)) !== void 0;
48
48
  }
49
- function me(o, e) {
49
+ function ve(o, e) {
50
50
  const t = Xt(o, e);
51
51
  if (t === void 0) throw new Error(`Can't resolve ${e} against ${o}`);
52
52
  return t;
53
53
  }
54
- async function qe(o, e) {
54
+ async function Qe(o, e) {
55
55
  if (I.isAbsolute(o) || (o = I.resolve(o)), await Dr(o))
56
56
  return {
57
- workflow: I.join(o, ...Ee),
58
- config: I.join(o, ...Te),
59
- ui: I.join(o, ...mt)
57
+ workflow: I.join(o, ...Te),
58
+ config: I.join(o, ...Ae),
59
+ ui: I.join(o, ...vt)
60
60
  };
61
61
  {
62
- const t = me(o, Ye), r = me(o, Ye), s = me(o, Or);
62
+ const t = ve(o, qe), r = ve(o, qe), s = ve(o, Or);
63
63
  return { workflow: t, config: r, ui: I.resolve(s, "..", "dist") };
64
64
  }
65
65
  }
@@ -81,7 +81,7 @@ async function Er(o) {
81
81
  throw e;
82
82
  }
83
83
  }
84
- async function vt(o) {
84
+ async function yt(o) {
85
85
  let e = 0n;
86
86
  for (const t of xr) {
87
87
  const r = I.join(o, ...t), s = await Er(r);
@@ -89,7 +89,7 @@ async function vt(o) {
89
89
  }
90
90
  return e.toString();
91
91
  }
92
- async function Ae(o) {
92
+ async function Ie(o) {
93
93
  const e = await T.promises.stat(o.components.workflow.main.file, {
94
94
  bigint: !0
95
95
  }), t = await T.promises.stat(o.components.model.file, { bigint: !0 });
@@ -145,7 +145,7 @@ class ei {
145
145
  I.join(c, H.PlPackageYamlConfigFile)
146
146
  );
147
147
  if (u !== void 0) {
148
- const l = H.PlPackageConfigData.parse(qt.parse(u)), p = await vt(c), g = {
148
+ const l = H.PlPackageConfigData.parse(qt.parse(u)), p = await yt(c), g = {
149
149
  organization: l.organization,
150
150
  name: l.package,
151
151
  version: "DEV"
@@ -169,9 +169,9 @@ class ei {
169
169
  otherVersions: []
170
170
  });
171
171
  } else {
172
- const l = await lt(c);
172
+ const l = await dt(c);
173
173
  if (l !== void 0) {
174
- const p = await Ae(l);
174
+ const p = await Ie(l);
175
175
  t.push({
176
176
  registryId: e.id,
177
177
  id: l.id,
@@ -226,22 +226,22 @@ const ti = {
226
226
  blocksInLimbo: []
227
227
  }, Vr = {
228
228
  label: "New Project"
229
- }, Nr = { name: "UserProject", version: "2" }, yt = "SchemaVersion", bt = "1", Ie = "ProjectCreated", X = "ProjectLastModified", ee = "ProjectMeta", _ = "ProjectStructure", ue = "BlockRenderingState", Lr = "BlockFrontendState/", Jr = /^BlockFrontendState\/(?<blockid>.*)$/;
230
- function ke(o) {
229
+ }, Nr = { name: "UserProject", version: "2" }, bt = "SchemaVersion", wt = "1", Ve = "ProjectCreated", X = "ProjectLastModified", ee = "ProjectMeta", _ = "ProjectStructure", ue = "BlockRenderingState", Lr = "BlockFrontendState/", Jr = /^BlockFrontendState\/(?<blockid>.*)$/;
230
+ function Ce(o) {
231
231
  return `${Lr}${o}`;
232
232
  }
233
233
  const Kr = "BlockArgsAuthor/";
234
- function Ce(o) {
234
+ function Pe(o) {
235
235
  return `${Kr}${o}`;
236
236
  }
237
- const Pe = "ProjectStructureAuthor";
237
+ const Fe = "ProjectStructureAuthor";
238
238
  function Mr(o) {
239
239
  const e = o.match(Jr);
240
240
  if (e !== null)
241
241
  return e.groups.blockid;
242
242
  }
243
243
  const Ur = "__serviceTemplate_";
244
- function Fe(o) {
244
+ function Be(o) {
245
245
  return `${Ur}${o}`;
246
246
  }
247
247
  function C(o, e) {
@@ -254,9 +254,9 @@ function Gr(o) {
254
254
  const { blockId: t, fieldName: r } = e.groups;
255
255
  return { blockId: t, fieldName: r };
256
256
  }
257
- const Hr = "projects", wt = { name: "Projects", version: "1" }, _r = (o) => U(o.type, wt) ? o.fields : [];
257
+ const Hr = "projects", St = { name: "Projects", version: "1" }, _r = (o) => U(o.type, St) ? o.fields : [];
258
258
  async function Wr(o, e, t, r) {
259
- const s = await gt.init(o, e, {
259
+ const s = await ht.init(o, e, {
260
260
  ...r.ops.defaultTreeOptions,
261
261
  pruning: _r
262
262
  });
@@ -267,7 +267,7 @@ async function Wr(o, e, t, r) {
267
267
  for (const l of a.listDynamicFields()) {
268
268
  const p = a.traverse(l);
269
269
  if (p === void 0) continue;
270
- const g = w(p.getKeyValueAsJson(ee)), f = w(p.getKeyValueAsJson(Ie)), v = w(p.getKeyValueAsJson(X));
270
+ const g = w(p.getKeyValueAsJson(ee)), f = w(p.getKeyValueAsJson(Ve)), v = w(p.getKeyValueAsJson(X));
271
271
  u.push({
272
272
  id: l,
273
273
  rid: p.id,
@@ -287,14 +287,14 @@ const zr = {
287
287
  name: "RenderTemplate",
288
288
  version: "1"
289
289
  };
290
- function St(o, e, t, r, s) {
290
+ function kt(o, e, t, r, s) {
291
291
  if (s.length === 0) throw new Error("Zero output names provided");
292
292
  const i = t ? o.createEphemeral(zr) : o.createStruct(Yr), n = S(i, "template"), a = S(i, "inputs");
293
293
  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/");
294
294
  }
295
295
  const qr = { name: "BContextEnd", version: "1" }, Qr = { name: "BContext", version: "1" }, Zr = "id", Xr = "parent/", eo = ["context", "result"];
296
- function Qe(o, e, t) {
297
- return St(o, e, !0, t, eo);
296
+ function Ze(o, e, t) {
297
+ return kt(o, e, !0, t, eo);
298
298
  }
299
299
  function to(o) {
300
300
  const e = o.createEphemeral(qr);
@@ -335,7 +335,7 @@ function ho(o, e) {
335
335
  const t = o.createValue(ao, e.content), r = o.createStruct(co), s = S(r, uo), i = S(r, lo);
336
336
  return o.setField(s, t), i;
337
337
  }
338
- function Ve(o, e) {
338
+ function Ne(o, e) {
339
339
  switch (e.type) {
340
340
  case "from-registry":
341
341
  return go(o, e);
@@ -345,7 +345,7 @@ function Ve(o, e) {
345
345
  return O(e);
346
346
  }
347
347
  }
348
- const kt = { name: "Frontend/FromUrl", version: "1" }, Ct = {
348
+ const Ct = { name: "Frontend/FromUrl", version: "1" }, Pt = {
349
349
  name: "Frontend/FromFolder",
350
350
  version: "1"
351
351
  };
@@ -353,12 +353,12 @@ function fo(o, e) {
353
353
  switch (e.type) {
354
354
  case "url":
355
355
  return o.createValue(
356
- kt,
356
+ Ct,
357
357
  JSON.stringify({ url: e.url })
358
358
  );
359
359
  case "local":
360
360
  return o.createValue(
361
- Ct,
361
+ Pt,
362
362
  JSON.stringify({
363
363
  path: e.path,
364
364
  signature: e.signature
@@ -368,8 +368,8 @@ function fo(o, e) {
368
368
  return O(e);
369
369
  }
370
370
  }
371
- const mo = { name: "BlockPackCustom", version: "1" }, Pt = "template", Ft = "frontend";
372
- function Ze(o) {
371
+ const mo = { name: "BlockPackCustom", version: "1" }, Ft = "template", Bt = "frontend";
372
+ function Xe(o) {
373
373
  return o.endsWith("/") ? o : `${o}/`;
374
374
  }
375
375
  class vo {
@@ -381,17 +381,17 @@ class vo {
381
381
  case "explicit":
382
382
  return e.config;
383
383
  case "dev-v1": {
384
- const t = await qe(e.folder), r = await T.promises.readFile(t.config, { encoding: "utf-8" });
384
+ const t = await Qe(e.folder), r = await T.promises.readFile(t.config, { encoding: "utf-8" });
385
385
  return JSON.parse(r);
386
386
  }
387
387
  case "dev-v2": {
388
- const t = await He(e.folder), r = await T.promises.readFile(t.components.model.file, {
388
+ const t = await _e(e.folder), r = await T.promises.readFile(t.components.model.file, {
389
389
  encoding: "utf-8"
390
390
  });
391
391
  return JSON.parse(r);
392
392
  }
393
393
  case "from-registry-v1": {
394
- const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${Ze(e.registryUrl)}${H.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`;
394
+ const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${Xe(e.registryUrl)}${H.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`;
395
395
  return await (await G(`${r}/config.json`, t)).body.json();
396
396
  }
397
397
  case "from-registry-v2": {
@@ -407,7 +407,7 @@ class vo {
407
407
  case "explicit":
408
408
  return e;
409
409
  case "dev-v1": {
410
- const t = await qe(e.folder), r = await T.promises.readFile(t.workflow), s = JSON.parse(
410
+ const t = await Qe(e.folder), r = await T.promises.readFile(t.workflow), s = JSON.parse(
411
411
  await T.promises.readFile(t.config, "utf-8")
412
412
  ), i = t.ui;
413
413
  return {
@@ -426,14 +426,14 @@ class vo {
426
426
  };
427
427
  }
428
428
  case "dev-v2": {
429
- const t = await He(e.folder), r = JSON.parse(
429
+ const t = await _e(e.folder), r = JSON.parse(
430
430
  await T.promises.readFile(t.components.model.file, {
431
431
  encoding: "utf-8"
432
432
  })
433
433
  ), s = await T.promises.readFile(
434
434
  t.components.workflow.main.file
435
435
  ), i = t.components.ui.folder, n = { ...e };
436
- return e.mtime === void 0 && (n.mtime = await Ae(t)), {
436
+ return e.mtime === void 0 && (n.mtime = await Ie(t)), {
437
437
  type: "explicit",
438
438
  template: {
439
439
  type: "explicit",
@@ -449,7 +449,7 @@ class vo {
449
449
  };
450
450
  }
451
451
  case "from-registry-v1": {
452
- const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${Ze(e.registryUrl)}${H.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`, s = `${r}/template.plj.gz`, i = await G(s, t);
452
+ const t = this.http !== void 0 ? { dispatcher: this.http } : {}, r = `${Xe(e.registryUrl)}${H.packageContentPrefix({ organization: e.id.organization, package: e.id.name, version: e.id.version })}`, s = `${r}/template.plj.gz`, i = await G(s, t);
453
453
  if (i.statusCode !== 200)
454
454
  throw new Error(
455
455
  `Block not found in registry (url = ${s} ; code = ${i.statusCode}): ` + JSON.stringify(e)
@@ -492,9 +492,9 @@ class vo {
492
492
  }
493
493
  function yo(o, e) {
494
494
  const t = { config: e.config, source: e.source }, r = o.createStruct(mo, JSON.stringify(t));
495
- return o.createField(S(r, Pt), "Input", Ve(o, e.template)), o.createField(S(r, Ft), "Input", fo(o, e.frontend)), o.lock(r), r;
495
+ return o.createField(S(r, Ft), "Input", Ne(o, e.template)), o.createField(S(r, Bt), "Input", fo(o, e.frontend)), o.lock(r), r;
496
496
  }
497
- function Xe(o, e) {
497
+ function et(o, e) {
498
498
  switch (e.type) {
499
499
  case "explicit":
500
500
  return yo(o, e);
@@ -508,7 +508,7 @@ function ie(o, e) {
508
508
  function bo(o) {
509
509
  return typeof o == "object" && o !== null && o.__isRef === !0 && "blockId" in o && "name" in o;
510
510
  }
511
- function Be(o, e, t) {
511
+ function Re(o, e, t) {
512
512
  const r = typeof e;
513
513
  switch (r) {
514
514
  case "function":
@@ -524,10 +524,10 @@ function Be(o, e, t) {
524
524
  if (bo(e))
525
525
  t === void 0 || t.has(e.blockId) ? o.upstreams.add(e.blockId) : o.missingReferences = !0;
526
526
  else if (Array.isArray(e))
527
- for (const s of e) Be(o, s, t);
527
+ for (const s of e) Re(o, s, t);
528
528
  else
529
529
  for (const [, s] of Object.entries(e))
530
- Be(o, s, t);
530
+ Re(o, s, t);
531
531
  return;
532
532
  default:
533
533
  O(r);
@@ -535,7 +535,7 @@ function Be(o, e, t) {
535
535
  }
536
536
  function wo(o, e) {
537
537
  const t = { upstreams: /* @__PURE__ */ new Set(), missingReferences: !1 };
538
- return Be(t, o, e), t;
538
+ return Re(t, o, e), t;
539
539
  }
540
540
  function V(o) {
541
541
  return {
@@ -544,7 +544,7 @@ function V(o) {
544
544
  }
545
545
  };
546
546
  }
547
- class Bt {
547
+ class Rt {
548
548
  constructor(e) {
549
549
  /** Nodes are stored in the map in topological order */
550
550
  d(this, "nodes");
@@ -574,7 +574,7 @@ class Bt {
574
574
  }
575
575
  }
576
576
  }
577
- function Re(o) {
577
+ function Oe(o) {
578
578
  const e = /* @__PURE__ */ new Map();
579
579
  let t;
580
580
  for (const { id: r } of V(o)) {
@@ -584,7 +584,7 @@ function Re(o) {
584
584
  };
585
585
  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;
586
586
  }
587
- return t !== void 0 && (t.downstream = /* @__PURE__ */ new Set()), new Bt(e);
587
+ return t !== void 0 && (t.downstream = /* @__PURE__ */ new Set()), new Rt(e);
588
588
  }
589
589
  function ne(o, e) {
590
590
  const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
@@ -600,41 +600,41 @@ function ne(o, e) {
600
600
  };
601
601
  t.set(s, a), n.upstreams.forEach((c) => t.get(c).downstream.add(s)), r.add(s);
602
602
  }
603
- return new Bt(t);
603
+ return new Rt(t);
604
604
  }
605
605
  function So(o, e) {
606
606
  if (o.size !== e.size) return !1;
607
607
  for (const t of o) if (!e.has(t)) return !1;
608
608
  return !0;
609
609
  }
610
- function Oe(o, e) {
611
- if (o.size > e.size) return Oe(e, o);
610
+ function xe(o, e) {
611
+ if (o.size > e.size) return xe(e, o);
612
612
  for (const t of o) if (e.has(t)) return !0;
613
613
  return !1;
614
614
  }
615
- function et(o, e) {
615
+ function tt(o, e) {
616
616
  const t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
617
617
  return o.nodes.forEach((i) => {
618
618
  const n = e.nodes.get(i.id);
619
- n === void 0 ? t.add(i.id) : (!So(i.upstream, n.upstream) || Oe(i.upstream, s)) && s.add(i.id);
619
+ n === void 0 ? t.add(i.id) : (!So(i.upstream, n.upstream) || xe(i.upstream, s)) && s.add(i.id);
620
620
  }), e.nodes.forEach((i) => {
621
- o.nodes.has(i.id) ? Oe(i.upstream, s) && s.add(i.id) : r.add(i.id);
621
+ o.nodes.has(i.id) ? xe(i.upstream, s) && s.add(i.id) : r.add(i.id);
622
622
  }), { onlyInA: t, onlyInB: r, different: s };
623
623
  }
624
- let ve;
625
- async function Rt() {
626
- if (ve === void 0) {
624
+ let ye;
625
+ async function Ot() {
626
+ if (ye === void 0) {
627
627
  const o = await po(lr["pframes.export-pframe"]);
628
628
  if (o.type !== "explicit") throw new Error("Unexpected prepared template type.");
629
629
  const e = ge("sha256").update(o.content).digest("hex");
630
- ve = { spec: o, hash: e };
630
+ ye = { spec: o, hash: e };
631
631
  }
632
- return ve;
632
+ return ye;
633
633
  }
634
634
  function ko(o, e, t) {
635
- return St(o, e, !0, { pf: t }, ["result"]).result;
635
+ return kt(o, e, !0, { pf: t }, ["result"]).result;
636
636
  }
637
- function ye(o, e) {
637
+ function be(o, e) {
638
638
  let t = !1, r, s;
639
639
  return () => {
640
640
  if (!t)
@@ -643,13 +643,13 @@ function ye(o, e) {
643
643
  return r !== i && (r = i, s = e()), e();
644
644
  };
645
645
  }
646
- class tt {
646
+ class rt {
647
647
  constructor(e, t) {
648
- d(this, "currentInputsC", ye(
648
+ d(this, "currentInputsC", be(
649
649
  () => this.fields.currentArgs.modCount,
650
650
  () => JSON.parse(Buffer.from(this.fields.currentArgs.value).toString())
651
651
  ));
652
- d(this, "actualProductionInputsC", ye(
652
+ d(this, "actualProductionInputsC", be(
653
653
  () => {
654
654
  var e;
655
655
  return (e = this.fields.prodArgs) == null ? void 0 : e.modCount;
@@ -661,7 +661,7 @@ class tt {
661
661
  return JSON.parse(Buffer.from(e).toString());
662
662
  }
663
663
  ));
664
- d(this, "productionStaleC", ye(
664
+ d(this, "productionStaleC", be(
665
665
  () => {
666
666
  var e;
667
667
  return `${this.fields.currentArgs.modCount}_${(e = this.fields.prodArgs) == null ? void 0 : e.modCount}`;
@@ -703,7 +703,7 @@ class tt {
703
703
  getTemplate(e) {
704
704
  return e.getFutureFieldValue(
705
705
  b.unwrapHolder(e, this.fields.blockPack.ref),
706
- Pt,
706
+ Ft,
707
707
  "Input"
708
708
  );
709
709
  }
@@ -745,7 +745,7 @@ class le {
745
745
  return JSON.parse(JSON.stringify(this.struct));
746
746
  }
747
747
  getStagingGraph() {
748
- return this.stagingGraph === void 0 && (this.stagingGraph = Re(this.struct)), this.stagingGraph;
748
+ return this.stagingGraph === void 0 && (this.stagingGraph = Oe(this.struct)), this.stagingGraph;
749
749
  }
750
750
  getPendingProductionGraph() {
751
751
  return this.pendingProductionGraph === void 0 && (this.pendingProductionGraph = ne(
@@ -860,7 +860,7 @@ class le {
860
860
  this.resetStaging(e);
861
861
  const t = this.getBlockInfo(e), r = this.createCtx(this.getStagingGraph().nodes.get(e).upstream, "stagingCtx");
862
862
  if (this.getBlock(e).renderingMode !== "Heavy") throw new Error("not supported yet");
863
- const s = t.getTemplate(this.tx), i = Qe(this.tx, s, {
863
+ const s = t.getTemplate(this.tx), i = Ze(this.tx, s, {
864
864
  args: t.fields.currentArgs.ref,
865
865
  blockId: this.tx.createValue(b.JsonString, JSON.stringify(e)),
866
866
  isProduction: this.tx.createValue(b.JsonBool, JSON.stringify(!1)),
@@ -881,7 +881,7 @@ class le {
881
881
  );
882
882
  if (this.getBlock(e).renderingMode === "Light")
883
883
  throw new Error("Can't render production for light block.");
884
- const s = t.getTemplate(this.tx), i = Qe(this.tx, s, {
884
+ const s = t.getTemplate(this.tx), i = Ze(this.tx, s, {
885
885
  args: t.fields.currentArgs.ref,
886
886
  blockId: this.tx.createValue(b.JsonString, JSON.stringify(e)),
887
887
  isProduction: this.tx.createValue(b.JsonBool, JSON.stringify(!0)),
@@ -899,21 +899,21 @@ class le {
899
899
  //
900
900
  /** Very generic method, better check for more specialized case-specific methods first. */
901
901
  updateStructure(e, t = Co) {
902
- const r = this.getStagingGraph(), s = this.getActualProductionGraph(), i = Re(e), n = ne(
902
+ const r = this.getStagingGraph(), s = this.getActualProductionGraph(), i = Oe(e), n = ne(
903
903
  e,
904
904
  (u) => {
905
905
  var l;
906
906
  return (l = this.blockInfos.get(u)) == null ? void 0 : l.actualProductionInputs;
907
907
  }
908
- ), a = et(r, i), c = et(s, n);
908
+ ), a = tt(r, i), c = tt(s, n);
909
909
  for (const u of a.onlyInA) {
910
910
  const { fields: l } = this.getBlockInfo(u);
911
911
  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);
912
912
  }
913
913
  for (const u of a.onlyInB) {
914
- const l = new tt(u, {});
914
+ const l = new rt(u, {});
915
915
  this.blockInfos.set(u, l);
916
- const p = t(u), g = Xe(this.tx, p.blockPack);
916
+ const p = t(u), g = et(this.tx, p.blockPack);
917
917
  this.setBlockField(u, "blockPack", b.wrapInHolder(this.tx, g), "NotReady");
918
918
  const f = Buffer.from(p.args), v = this.tx.createValue(b.JsonObject, f);
919
919
  this.setBlockField(u, "currentArgs", v, "Ready", f), l.check();
@@ -967,7 +967,7 @@ class le {
967
967
  this.setBlockField(
968
968
  e,
969
969
  "blockPack",
970
- b.wrapInHolder(this.tx, Xe(this.tx, t)),
970
+ b.wrapInHolder(this.tx, et(this.tx, t)),
971
971
  "NotReady"
972
972
  ), 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(
973
973
  "downstream",
@@ -1013,7 +1013,7 @@ class le {
1013
1013
  * accordingly */
1014
1014
  stopProduction(...e) {
1015
1015
  var n, a;
1016
- const t = this.getActualProductionGraph(), r = new ht(e), s = new Set(e), i = [];
1016
+ const t = this.getActualProductionGraph(), r = new ft(e), s = new Set(e), i = [];
1017
1017
  for (; !r.isEmpty(); ) {
1018
1018
  const c = r.shift(), u = this.getBlockInfo(c).fields;
1019
1019
  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")) {
@@ -1073,8 +1073,8 @@ class le {
1073
1073
  assignAuthorMarkers() {
1074
1074
  const e = this.author ? JSON.stringify(this.author) : void 0;
1075
1075
  for (const t of this.blocksWithChangedInputs)
1076
- e === void 0 ? this.tx.deleteKValue(this.rid, Ce(t)) : this.tx.setKValue(this.rid, Ce(t), e);
1077
- (this.metaChanged || this.structureChanged) && (e === void 0 ? this.tx.deleteKValue(this.rid, Pe) : this.tx.setKValue(this.rid, Pe, e));
1076
+ e === void 0 ? this.tx.deleteKValue(this.rid, Pe(t)) : this.tx.setKValue(this.rid, Pe(t), e);
1077
+ (this.metaChanged || this.structureChanged) && (e === void 0 ? this.tx.deleteKValue(this.rid, Fe) : this.tx.setKValue(this.rid, Fe, e));
1078
1078
  }
1079
1079
  save() {
1080
1080
  if (this.wasModified) {
@@ -1088,13 +1088,13 @@ class le {
1088
1088
  ), this.metaChanged && this.tx.setKValue(this.rid, ee, JSON.stringify(this.meta));
1089
1089
  for (const e of this.changedBlockFrontendStates) {
1090
1090
  const t = this.blockFrontendStates.get(e);
1091
- t === void 0 ? this.tx.deleteKValue(this.rid, ke(e)) : this.tx.setKValue(this.rid, ke(e), t);
1091
+ t === void 0 ? this.tx.deleteKValue(this.rid, Ce(e)) : this.tx.setKValue(this.rid, Ce(e), t);
1092
1092
  }
1093
1093
  this.assignAuthorMarkers();
1094
1094
  }
1095
1095
  }
1096
1096
  static async load(e, t, r) {
1097
- const s = e.getResourceData(t, !0), i = e.getKValueJson(t, yt), n = e.getKValueJson(t, X), a = e.getKValueJson(t, ee), c = e.getKValueJson(t, _), u = e.getKValueJson(t, ue), l = e.listKeyValuesString(t), [
1097
+ const s = e.getResourceData(t, !0), i = e.getKValueJson(t, bt), n = e.getKValueJson(t, X), a = e.getKValueJson(t, ee), c = e.getKValueJson(t, _), u = e.getKValueJson(t, ue), l = e.listKeyValuesString(t), [
1098
1098
  p,
1099
1099
  g,
1100
1100
  f,
@@ -1111,7 +1111,7 @@ class le {
1111
1111
  u,
1112
1112
  l
1113
1113
  ]);
1114
- if (g !== bt)
1114
+ if (g !== wt)
1115
1115
  throw new Error(
1116
1116
  `Can't act on this project resource because it has a wrong schema version: ${g}`
1117
1117
  );
@@ -1125,12 +1125,12 @@ class le {
1125
1125
  fields: {}
1126
1126
  }, $.set(R.blockId, F)), F.fields[R.fieldName] = ce(y.value) ? { modCount: 0 } : { modCount: 0, ref: y.value };
1127
1127
  }
1128
- const W = await Rt(), oe = Fe(W.hash), k = p.fields.find(
1128
+ const W = await Ot(), oe = Be(W.hash), k = p.fields.find(
1129
1129
  (y) => y.name === oe
1130
1130
  );
1131
1131
  let J;
1132
- k !== void 0 ? J = we(k.value) : (J = b.wrapInHolder(e, Ve(e, W.spec)), e.createField(
1133
- S(t, Fe(W.hash)),
1132
+ k !== void 0 ? J = Se(k.value) : (J = b.wrapInHolder(e, Ne(e, W.spec)), e.createField(
1133
+ S(t, Be(W.hash)),
1134
1134
  "Dynamic",
1135
1135
  J
1136
1136
  ));
@@ -1150,10 +1150,10 @@ class le {
1150
1150
  });
1151
1151
  for (const [y, R] of B) {
1152
1152
  const F = await R;
1153
- y.value = F.data, _e(F.error) ? y.status = "Error" : F.resourceReady || _e(F.originalResourceId) ? y.status = "Ready" : y.status = "NotReady";
1153
+ y.value = F.data, We(F.error) ? y.status = "Error" : F.resourceReady || We(F.originalResourceId) ? y.status = "Ready" : y.status = "NotReady";
1154
1154
  }
1155
1155
  const M = /* @__PURE__ */ new Map();
1156
- $.forEach(({ id: y, fields: R }) => M.set(y, new tt(y, R)));
1156
+ $.forEach(({ id: y, fields: R }) => M.set(y, new rt(y, R)));
1157
1157
  const L = /* @__PURE__ */ new Set();
1158
1158
  for (const y of V(x)) {
1159
1159
  if (!M.has(y.id))
@@ -1186,15 +1186,15 @@ async function Po(o, e = Vr) {
1186
1186
  const t = o.createEphemeral(Nr);
1187
1187
  o.lock(t);
1188
1188
  const r = String(Date.now());
1189
- o.setKValue(t, yt, JSON.stringify(bt)), o.setKValue(t, Ie, r), o.setKValue(t, X, r), o.setKValue(t, ee, JSON.stringify(e)), o.setKValue(t, _, JSON.stringify(Ar)), o.setKValue(t, ue, JSON.stringify(Ir));
1190
- const s = await Rt();
1189
+ o.setKValue(t, bt, JSON.stringify(wt)), o.setKValue(t, Ve, r), o.setKValue(t, X, r), o.setKValue(t, ee, JSON.stringify(e)), o.setKValue(t, _, JSON.stringify(Ar)), o.setKValue(t, ue, JSON.stringify(Ir));
1190
+ const s = await Ot();
1191
1191
  return o.createField(
1192
- S(t, Fe(s.hash)),
1192
+ S(t, Be(s.hash)),
1193
1193
  "Dynamic",
1194
- b.wrapInHolder(o, Ve(o, s.spec))
1194
+ b.wrapInHolder(o, Ne(o, s.spec))
1195
1195
  ), t;
1196
1196
  }
1197
- async function be(o, e, t) {
1197
+ async function we(o, e, t) {
1198
1198
  return A(o, e, void 0, t);
1199
1199
  }
1200
1200
  async function A(o, e, t, r) {
@@ -1223,7 +1223,7 @@ function* Fo(o) {
1223
1223
  O(o);
1224
1224
  }
1225
1225
  }
1226
- function rt(o, e) {
1226
+ function ot(o, e) {
1227
1227
  return Object.fromEntries(
1228
1228
  Object.entries(o).map(([t, r]) => [t, e(r, t)])
1229
1229
  );
@@ -1233,11 +1233,11 @@ function Bo(o, e) {
1233
1233
  case "Json":
1234
1234
  return { ...o };
1235
1235
  case "JsonPartitioned":
1236
- return { ...o, parts: rt(o.parts, e) };
1236
+ return { ...o, parts: ot(o.parts, e) };
1237
1237
  case "BinaryPartitioned":
1238
1238
  return {
1239
1239
  ...o,
1240
- parts: rt(o.parts, (t) => ({
1240
+ parts: ot(o.parts, (t) => ({
1241
1241
  index: e(t.index),
1242
1242
  values: e(t.values)
1243
1243
  }))
@@ -1340,11 +1340,11 @@ function Eo(o) {
1340
1340
  }
1341
1341
  throw new Error(`unsupported resource type: ${or(o.resourceType)}`);
1342
1342
  }
1343
- function Ot(o, e) {
1343
+ function xt(o, e) {
1344
1344
  const t = ge("sha256");
1345
- return t.update(je(o)), t.update(String(ce(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
1345
+ return t.update(Ee(o)), t.update(String(ce(e.originalId) ? e.id : e.originalId)), t.digest().toString("hex");
1346
1346
  }
1347
- function xt(o, e = !0, t = !1, r = "") {
1347
+ function Dt(o, e = !0, t = !1, r = "") {
1348
1348
  var a, c, u;
1349
1349
  const s = /^(?<name>.*)\.(?<type>spec|data)$/, i = /* @__PURE__ */ new Map();
1350
1350
  for (const l of o.listInputFields()) {
@@ -1385,7 +1385,7 @@ function xt(o, e = !0, t = !1, r = "") {
1385
1385
  }
1386
1386
  function To(o, e = !0, t = "") {
1387
1387
  if (!o.getIsReadyOrError()) throw new Error("resource is not ready");
1388
- const r = xt(o, e, !1, t);
1388
+ const r = Dt(o, e, !1, t);
1389
1389
  dr(r.locked);
1390
1390
  const s = {};
1391
1391
  for (const [i, n] of r.results) {
@@ -1396,14 +1396,14 @@ function To(o, e = !0, t = "") {
1396
1396
  if (a === void 0) throw new Error(`no data for key ${i}`);
1397
1397
  if (!a.ok) throw new ar(a.error);
1398
1398
  s[i] = {
1399
- id: Ot(n.spec, a.value),
1399
+ id: xt(n.spec, a.value),
1400
1400
  spec: n.spec,
1401
1401
  data: a.value
1402
1402
  };
1403
1403
  }
1404
1404
  return s;
1405
1405
  }
1406
- class Ne {
1406
+ class Le {
1407
1407
  constructor(e, t) {
1408
1408
  d(this, "allSpecsAvailable");
1409
1409
  this.ctx = e, this.blocks = t;
@@ -1455,7 +1455,7 @@ class Ne {
1455
1455
  u !== void 0 ? e.push({
1456
1456
  ref: ie(n, a),
1457
1457
  obj: {
1458
- id: u.ok ? Ot(c.spec, u.value) : void 0,
1458
+ id: u.ok ? xt(c.spec, u.value) : void 0,
1459
1459
  spec: c.spec,
1460
1460
  data: u
1461
1461
  }
@@ -1509,7 +1509,7 @@ class Ne {
1509
1509
  for (const r of this.blocks.values()) {
1510
1510
  const s = /* @__PURE__ */ new Set(), i = (n) => {
1511
1511
  for (const [a, c] of n.results)
1512
- s.has(a) || c.spec === void 0 || (s.add(a), Ut(e, c.spec) && t.push({
1512
+ s.has(a) || c.spec === void 0 || (s.add(a), $t(e, c.spec) && t.push({
1513
1513
  label: r.info.label + " / " + a,
1514
1514
  ref: ie(r.info.id, a),
1515
1515
  spec: c.spec
@@ -1520,10 +1520,10 @@ class Ne {
1520
1520
  return t;
1521
1521
  }
1522
1522
  static create(e, t, r) {
1523
- const s = e.accessor(t).node(), i = w(s.getKeyValueAsJson(_)), a = Re(i).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
1523
+ const s = e.accessor(t).node(), i = w(s.getKeyValueAsJson(_)), a = Oe(i).traverseIds("upstream", r), c = /* @__PURE__ */ new Map();
1524
1524
  for (const u of V(i)) {
1525
1525
  if (!a.has(u.id)) continue;
1526
- const l = ot(
1526
+ const l = st(
1527
1527
  s.traverse({
1528
1528
  field: C(u.id, "prodCtx"),
1529
1529
  ignoreError: !0,
@@ -1534,7 +1534,7 @@ class Ne {
1534
1534
  field: C(u.id, "prodUiCtx"),
1535
1535
  stableIfNotFound: !0
1536
1536
  })
1537
- ), p = ot(
1537
+ ), p = st(
1538
1538
  s.traverse({
1539
1539
  field: C(u.id, "stagingCtx"),
1540
1540
  ignoreError: !0,
@@ -1546,21 +1546,21 @@ class Ne {
1546
1546
  );
1547
1547
  c.set(u.id, { info: u, prod: l, staging: p });
1548
1548
  }
1549
- return new Ne(e, c);
1549
+ return new Le(e, c);
1550
1550
  }
1551
1551
  }
1552
- function ot(o, e) {
1552
+ function st(o, e) {
1553
1553
  if (e === void 0)
1554
1554
  return o ? { locked: !1, results: /* @__PURE__ */ new Map() } : void 0;
1555
- if (e.ok) return xt(e.value, !1, !0);
1555
+ if (e.ok) return Dt(e.value, !1, !0);
1556
1556
  }
1557
- function Le(o, e) {
1557
+ function Je(o, e) {
1558
1558
  const t = o.persist(), r = w(
1559
1559
  o.traverse({
1560
1560
  field: C(e, "currentArgs"),
1561
1561
  errorIfFieldNotSet: !0
1562
1562
  }).getDataAsString()
1563
- ), s = o.getKeyValueAsString(ke(e));
1563
+ ), s = o.getKeyValueAsString(Ce(e));
1564
1564
  return {
1565
1565
  blockId: e,
1566
1566
  args: r,
@@ -1572,10 +1572,10 @@ function Le(o, e) {
1572
1572
  }
1573
1573
  };
1574
1574
  }
1575
- function Dt(o, e) {
1575
+ function jt(o, e) {
1576
1576
  const t = o.persist();
1577
1577
  return {
1578
- ...Le(o, e),
1578
+ ...Je(o, e),
1579
1579
  prod: (r) => {
1580
1580
  var s;
1581
1581
  return (s = r.accessor(t).node({ ignoreError: !0 }).traverse({
@@ -1592,7 +1592,7 @@ function Dt(o, e) {
1592
1592
  })) == null ? void 0 : i.persist();
1593
1593
  return s === void 0 && r.markUnstable("staging_not_rendered"), s;
1594
1594
  },
1595
- getResultsPool: (r) => Ne.create(r, t, e)
1595
+ getResultsPool: (r) => Le.create(r, t, e)
1596
1596
  };
1597
1597
  }
1598
1598
  function* j(o, e) {
@@ -1692,7 +1692,7 @@ const No = (o) => {
1692
1692
  return he((s = r.accessor(e).node().traverse(t)) == null ? void 0 : s.persist());
1693
1693
  };
1694
1694
  };
1695
- function jt(o, e) {
1695
+ function Et(o, e) {
1696
1696
  const t = {}, r = o.length;
1697
1697
  for (let s = 0; s < r; s++) t[String(s)] = e(o[s]);
1698
1698
  return t;
@@ -1702,12 +1702,12 @@ function Ko(o, e) {
1702
1702
  const r = t.source;
1703
1703
  return r === void 0 ? h(void 0) : () => ({
1704
1704
  type: "ScheduleSubroutine",
1705
- subroutine: Et(r.length),
1706
- args: jt(r, (s) => m({ ...o, [e.itVar]: s }, e.mapping))
1705
+ subroutine: Tt(r.length),
1706
+ args: Et(r, (s) => m({ ...o, [e.itVar]: s }, e.mapping))
1707
1707
  });
1708
1708
  };
1709
1709
  }
1710
- function Et(o) {
1710
+ function Tt(o) {
1711
1711
  return (e) => {
1712
1712
  const t = [];
1713
1713
  for (let r = 0; r < o; r++) t.push(e[String(r)]);
@@ -1859,7 +1859,7 @@ function m(o, e) {
1859
1859
  case "Isolate":
1860
1860
  return ({ drivers: r }) => ({
1861
1861
  type: "ScheduleComputable",
1862
- computable: Vt(r, o, e.cfg)
1862
+ computable: Nt(r, o, e.cfg)
1863
1863
  });
1864
1864
  case "Immediate":
1865
1865
  return h(e.value);
@@ -1897,8 +1897,8 @@ function m(o, e) {
1897
1897
  case "MakeArray":
1898
1898
  return () => ({
1899
1899
  type: "ScheduleSubroutine",
1900
- subroutine: Et(e.template.length),
1901
- args: jt(e.template, (r) => m(o, r))
1900
+ subroutine: Tt(e.template.length),
1901
+ args: Et(e.template, (r) => m(o, r))
1902
1902
  });
1903
1903
  case "Flatten":
1904
1904
  return () => ({
@@ -2053,15 +2053,15 @@ function as(o) {
2053
2053
  $staging: o.staging
2054
2054
  };
2055
2055
  }
2056
- const Tt = Symbol(), At = "return", cs = { op: Tt, arg: At };
2056
+ const At = Symbol(), It = "return", cs = { op: At, arg: It };
2057
2057
  function us(o) {
2058
- return o.op == Tt && o.arg == At;
2058
+ return o.op == At && o.arg == It;
2059
2059
  }
2060
2060
  function ls() {
2061
2061
  return { pendingSubroutines: /* @__PURE__ */ new Map() };
2062
2062
  }
2063
- function st(o, e, t, r) {
2064
- const s = new ht(t), i = (a, c) => {
2063
+ function it(o, e, t, r) {
2064
+ const s = new ft(t), i = (a, c) => {
2065
2065
  if (us(a))
2066
2066
  return e.result = c, !1;
2067
2067
  const u = w(e.pendingSubroutines.get(a.op));
@@ -2112,11 +2112,11 @@ function st(o, e, t, r) {
2112
2112
  }
2113
2113
  return n;
2114
2114
  }
2115
- function It(o, e, t, r = {}) {
2116
- return Vt(o, as(e), t, r);
2117
- }
2118
2115
  function Vt(o, e, t, r = {}) {
2119
- const s = je({
2116
+ return Nt(o, as(e), t, r);
2117
+ }
2118
+ function Nt(o, e, t, r = {}) {
2119
+ const s = Ee({
2120
2120
  ctx: Object.fromEntries(Object.entries(e).filter(([i]) => ns.indexOf(i) === -1)),
2121
2121
  cfg: t
2122
2122
  });
@@ -2124,7 +2124,7 @@ function Vt(o, e, t, r = {}) {
2124
2124
  (i) => {
2125
2125
  const n = { drivers: o, cCtx: i }, a = ls();
2126
2126
  return {
2127
- ir: st(
2127
+ ir: it(
2128
2128
  n,
2129
2129
  a,
2130
2130
  [
@@ -2151,7 +2151,7 @@ function Vt(o, e, t, r = {}) {
2151
2151
  result: a.result,
2152
2152
  pendingSubroutines: f
2153
2153
  };
2154
- if (st(g, v, p, !1), !("result" in v))
2154
+ if (it(g, v, p, !1), !("result" in v))
2155
2155
  throw new Error("illegal cfg rendering stack state, no result");
2156
2156
  return v.result;
2157
2157
  }
@@ -2163,7 +2163,7 @@ function Vt(o, e, t, r = {}) {
2163
2163
  function ds(o) {
2164
2164
  return o instanceof ArrayBuffer || ArrayBuffer.isView(o);
2165
2165
  }
2166
- function it(o) {
2166
+ function nt(o) {
2167
2167
  return o !== void 0 ? Buffer.from(o).toString("base64") : void 0;
2168
2168
  }
2169
2169
  class pe {
@@ -2203,7 +2203,7 @@ class pe {
2203
2203
  }
2204
2204
  runCallback(e, ...t) {
2205
2205
  try {
2206
- return Se.withScope((r) => {
2206
+ return ke.withScope((r) => {
2207
2207
  const s = r.manage(this.vm.getProp(this.callbackRegistry, e));
2208
2208
  if (this.vm.typeof(s) !== "function")
2209
2209
  throw new Error(`No such callback: ${e}`);
@@ -2273,13 +2273,13 @@ class pe {
2273
2273
  return this.getAccessor(e).listDynamicFields();
2274
2274
  }
2275
2275
  getKeyValueBase64(e, t) {
2276
- return it(this.getAccessor(e).getKeyValue(t));
2276
+ return nt(this.getAccessor(e).getKeyValue(t));
2277
2277
  }
2278
2278
  getKeyValueAsString(e, t) {
2279
2279
  return this.getAccessor(e).getKeyValueAsString(t);
2280
2280
  }
2281
2281
  getDataBase64(e) {
2282
- return it(this.getAccessor(e).getData());
2282
+ return nt(this.getAccessor(e).getData());
2283
2283
  }
2284
2284
  getDataAsString(e) {
2285
2285
  return this.getAccessor(e).getDataAsString();
@@ -2421,7 +2421,7 @@ class pe {
2421
2421
  obj: {
2422
2422
  id: t.obj.id,
2423
2423
  spec: t.obj.spec,
2424
- data: $t(t.obj.data, (r) => this.wrapAccessor(r))
2424
+ data: Gt(t.obj.data, (r) => this.wrapAccessor(r))
2425
2425
  }
2426
2426
  }))
2427
2427
  };
@@ -2449,7 +2449,7 @@ class pe {
2449
2449
  "can't instantiate PTable from this context (most porbably called from the future mapper)"
2450
2450
  );
2451
2451
  return this.env.driverKit.pFrameDriver.createPTable(
2452
- ct(e, (t) => q(t, (r) => this.getAccessor(r))),
2452
+ ut(e, (t) => q(t, (r) => this.getAccessor(r))),
2453
2453
  this.computableCtx
2454
2454
  );
2455
2455
  }
@@ -2531,7 +2531,7 @@ class pe {
2531
2531
  return JSON.parse(t);
2532
2532
  }
2533
2533
  injectCtx() {
2534
- Se.withScope((e) => {
2534
+ ke.withScope((e) => {
2535
2535
  const t = e.manage(this.vm.newObject());
2536
2536
  this.vm.setProp(t, "args", e.manage(this.vm.newString(this.blockCtx.args))), this.blockCtx.uiState !== void 0 && this.vm.setProp(
2537
2537
  t,
@@ -2599,7 +2599,7 @@ class pe {
2599
2599
  }
2600
2600
  function ps(o, e, t, r, s = {}) {
2601
2601
  return P.makeRaw((i) => {
2602
- const n = new Se();
2602
+ const n = new ke();
2603
2603
  i.addOnDestroy(() => n.dispose());
2604
2604
  const a = n.manage(o.quickJs.newRuntime());
2605
2605
  a.setMemoryLimit(1024 * 640), a.setMaxStackSize(1024 * 320);
@@ -2615,17 +2615,17 @@ function ps(o, e, t, r, s = {}) {
2615
2615
  };
2616
2616
  }, s);
2617
2617
  }
2618
- function xe(o, e, t, r, s = {}) {
2619
- if (ut(t)) {
2618
+ function De(o, e, t, r, s = {}) {
2619
+ if (lt(t)) {
2620
2620
  if (r === void 0) throw new Error("No code bundle.");
2621
2621
  return ps(o, e, t, r, s);
2622
- } else return It(o.driverKit, e, t, s);
2622
+ } else return Vt(o.driverKit, e, t, s);
2623
2623
  }
2624
2624
  function gs(o, e, t) {
2625
2625
  return P.make(
2626
2626
  (r) => {
2627
2627
  var v, x, N, K, re, $, W, oe;
2628
- const s = r.accessor(o).node(), i = w(s.getKeyValueAsJson(Ie)), n = w(s.getKeyValueAsJson(X)), a = w(s.getKeyValueAsJson(ee)), c = w(s.getKeyValueAsJson(_)), u = w(
2628
+ const s = r.accessor(o).node(), i = w(s.getKeyValueAsJson(Ve)), n = w(s.getKeyValueAsJson(X)), a = w(s.getKeyValueAsJson(ee)), c = w(s.getKeyValueAsJson(_)), u = w(
2629
2629
  s.getKeyValueAsJson(ue)
2630
2630
  ), l = /* @__PURE__ */ new Map();
2631
2631
  for (const { id: k } of V(c)) {
@@ -2662,7 +2662,7 @@ function gs(o, e, t) {
2662
2662
  l.set(k, { currentArguments: J.getDataAsJson(), prod: z });
2663
2663
  }
2664
2664
  const p = ne(c, (k) => l.get(k).currentArguments), g = new Set(u.blocksInLimbo), f = [...V(c)].map(({ id: k, label: J, renderingMode: z }) => {
2665
- var Ke, Me, Ue, $e;
2665
+ var Me, Ue, $e, Ge;
2666
2666
  const E = w(l.get(k)), D = w(p.nodes.get(k));
2667
2667
  let B = "NotCalculated";
2668
2668
  E.prod !== void 0 && (g.has(k) ? B = "Limbo" : B = E.prod.finished ? "Done" : "Running");
@@ -2674,17 +2674,17 @@ function gs(o, e, t) {
2674
2674
  },
2675
2675
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2676
2676
  ), L = M == null ? void 0 : M.getDataAsJson(), { sections: se, inputsValid: y, sdkVersion: R } = de(L == null ? void 0 : L.config, (fe) => {
2677
- const Y = De(fe), Ge = Le(s, k);
2677
+ const Y = je(fe), He = Je(s, k);
2678
2678
  return {
2679
- sections: xe(
2679
+ sections: De(
2680
2680
  t,
2681
- Ge,
2681
+ He,
2682
2682
  Y.sections,
2683
2683
  Y.code
2684
2684
  ),
2685
- inputsValid: xe(
2685
+ inputsValid: De(
2686
2686
  t,
2687
- Ge,
2687
+ He,
2688
2688
  Y.inputsValid,
2689
2689
  Y.code
2690
2690
  ),
@@ -2698,14 +2698,14 @@ function gs(o, e, t) {
2698
2698
  id: k,
2699
2699
  label: J,
2700
2700
  renderingMode: z,
2701
- stale: ((Ke = E.prod) == null ? void 0 : Ke.stale) !== !1 || B === "Limbo",
2701
+ stale: ((Me = E.prod) == null ? void 0 : Me.stale) !== !1 || B === "Limbo",
2702
2702
  missingReference: D.missingReferences,
2703
2703
  upstreams: [...p.traverseIdsExcludingRoots("upstream", k)],
2704
2704
  downstreams: [...p.traverseIdsExcludingRoots("downstream", k)],
2705
2705
  calculationStatus: B,
2706
- outputErrors: ((Me = E.prod) == null ? void 0 : Me.outputError) === !0,
2707
- outputsError: (Ue = E.prod) == null ? void 0 : Ue.outputsError,
2708
- exportsError: ($e = E.prod) == null ? void 0 : $e.exportsError,
2706
+ outputErrors: ((Ue = E.prod) == null ? void 0 : Ue.outputError) === !0,
2707
+ outputsError: ($e = E.prod) == null ? void 0 : $e.outputsError,
2708
+ exportsError: (Ge = E.prod) == null ? void 0 : Ge.exportsError,
2709
2709
  sections: se,
2710
2710
  inputsValid: y,
2711
2711
  currentBlockPack: L == null ? void 0 : L.source,
@@ -2718,7 +2718,7 @@ function gs(o, e, t) {
2718
2718
  meta: a,
2719
2719
  created: new Date(i),
2720
2720
  lastModified: new Date(n),
2721
- authorMarker: s.getKeyValueAsJson(Pe),
2721
+ authorMarker: s.getKeyValueAsJson(Fe),
2722
2722
  blocks: f
2723
2723
  };
2724
2724
  },
@@ -2737,7 +2737,7 @@ function gs(o, e, t) {
2737
2737
  }
2738
2738
  ).withStableType();
2739
2739
  }
2740
- function Nt(o, e) {
2740
+ function Lt(o, e) {
2741
2741
  var t, r;
2742
2742
  return de(
2743
2743
  (r = (t = o.traverse(
@@ -2748,16 +2748,16 @@ function Nt(o, e) {
2748
2748
  },
2749
2749
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2750
2750
  )) == null ? void 0 : t.getDataAsJson()) == null ? void 0 : r.config,
2751
- (s) => De(s)
2751
+ (s) => je(s)
2752
2752
  );
2753
2753
  }
2754
2754
  function hs(o, e) {
2755
2755
  const t = o.node();
2756
- if (U(t.resourceType, kt)) {
2756
+ if (U(t.resourceType, Ct)) {
2757
2757
  const r = t.getDataAsJson();
2758
2758
  if (r === void 0) throw new Error("No resource data.");
2759
2759
  return e.frontendDownloadDriver.getPath(new URL(r.url)).withStableType();
2760
- } else if (U(t.resourceType, Ct)) {
2760
+ } else if (U(t.resourceType, Pt)) {
2761
2761
  const r = t.getDataAsJson();
2762
2762
  if (r === void 0) throw new Error("No resource data.");
2763
2763
  return e.signer.verify(
@@ -2787,13 +2787,13 @@ function ms(o, e, t) {
2787
2787
  return P.make(
2788
2788
  (r) => {
2789
2789
  var a;
2790
- const s = r.accessor(o).node(), i = Nt(s, e), n = (a = s.traverse(
2790
+ const s = r.accessor(o).node(), i = Lt(s, e), n = (a = s.traverse(
2791
2791
  {
2792
2792
  field: C(e, "blockPack"),
2793
2793
  assertFieldType: "Dynamic"
2794
2794
  },
2795
2795
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 },
2796
- { field: Ft, assertFieldType: "Input" }
2796
+ { field: Bt, assertFieldType: "Input" }
2797
2797
  )) == null ? void 0 : a.persist();
2798
2798
  return { path: fs(n, t), sdkVersion: i == null ? void 0 : i.sdkVersion };
2799
2799
  },
@@ -2803,30 +2803,30 @@ function ms(o, e, t) {
2803
2803
  function vs(o, e, t) {
2804
2804
  return P.make(
2805
2805
  (r) => {
2806
- const s = r.accessor(o).node(), i = Le(s, e);
2806
+ const s = r.accessor(o).node(), i = Je(s, e);
2807
2807
  return {
2808
- author: s.getKeyValueAsJson(Ce(e)),
2808
+ author: s.getKeyValueAsJson(Pe(e)),
2809
2809
  args: JSON.parse(i.args),
2810
2810
  ui: i.uiState !== void 0 ? JSON.parse(i.uiState) : void 0
2811
2811
  };
2812
2812
  },
2813
- { key: "inputs#" + pt(o.rid) + e }
2813
+ { key: "inputs#" + gt(o.rid) + e }
2814
2814
  );
2815
2815
  }
2816
2816
  function ys(o, e, t) {
2817
2817
  return P.make(
2818
2818
  (r) => {
2819
- const s = r.accessor(o).node(), i = Dt(s, e), n = Nt(s, e);
2819
+ const s = r.accessor(o).node(), i = jt(s, e), n = Lt(s, e);
2820
2820
  return de(n, (a) => {
2821
2821
  const c = {};
2822
2822
  for (const [u, l] of Object.entries(a.outputs))
2823
2823
  c[u] = P.wrapError(
2824
- xe(t, i, l, a.code)
2824
+ De(t, i, l, a.code)
2825
2825
  );
2826
2826
  return c;
2827
2827
  });
2828
2828
  },
2829
- { key: "outputs#" + pt(o.rid) + e }
2829
+ { key: "outputs#" + gt(o.rid) + e }
2830
2830
  ).withStableType();
2831
2831
  }
2832
2832
  function bs(o, e) {
@@ -2842,11 +2842,11 @@ function bs(o, e) {
2842
2842
  { field: b.HolderRefField, assertFieldType: "Input", errorIfFieldNotFound: !0 }
2843
2843
  ), u = c == null ? void 0 : c.getDataAsJson();
2844
2844
  if ((u == null ? void 0 : u.config) === void 0) continue;
2845
- const l = De(u.config), p = Object.entries(l.outputs).map(([, f]) => f).filter((f) => !ut(f) && Vo(f)).map((f) => f);
2845
+ const l = je(u.config), p = Object.entries(l.outputs).map(([, f]) => f).filter((f) => !lt(f) && Vo(f)).map((f) => f);
2846
2846
  if (p.length === 0) continue;
2847
- const g = Dt(r, n);
2847
+ const g = jt(r, n);
2848
2848
  for (const f of p)
2849
- i.push(P.wrapError(It(e.driverKit, g, f)));
2849
+ i.push(P.wrapError(Vt(e.driverKit, g, f)));
2850
2850
  }
2851
2851
  return i;
2852
2852
  });
@@ -2858,14 +2858,14 @@ class ws {
2858
2858
  setState(e, t) {
2859
2859
  const r = this.states.get(e);
2860
2860
  if (r === void 0) {
2861
- this.states.set(e, { state: t, change: new We() });
2861
+ this.states.set(e, { state: t, change: new ze() });
2862
2862
  return;
2863
2863
  }
2864
2864
  r.state = { ...t }, r.change.markChanged();
2865
2865
  }
2866
2866
  readState(e, t) {
2867
2867
  let r = this.states.get(t);
2868
- return r === void 0 && (r = { state: { ...Gt }, change: new We() }, this.states.set(t, r)), r.change.attachWatcher(e.watcher), r.state;
2868
+ return r === void 0 && (r = { state: { ...Ht }, change: new ze() }, this.states.set(t, r)), r.change.attachWatcher(e.watcher), r.state;
2869
2869
  }
2870
2870
  getState(e) {
2871
2871
  return P.make(
@@ -2878,7 +2878,7 @@ class ws {
2878
2878
  t !== void 0 && (this.states.delete(e), t.change.markChanged());
2879
2879
  }
2880
2880
  }
2881
- class Je {
2881
+ class Ke {
2882
2882
  constructor(e, t, r) {
2883
2883
  /** Underlying pl resource id */
2884
2884
  d(this, "rid");
@@ -2900,7 +2900,7 @@ class Je {
2900
2900
  async refreshLoop() {
2901
2901
  for (; !this.destroyed; )
2902
2902
  try {
2903
- await be(this.env.pl, this.rid, (e) => {
2903
+ await we(this.env.pl, this.rid, (e) => {
2904
2904
  e.doRefresh(this.env.ops.stagingRenderingRate);
2905
2905
  }), await this.activeConfigs.getValue(), await gr(this.env.ops.projectRefreshInterval, this.abortController.signal);
2906
2906
  } catch (e) {
@@ -3002,7 +3002,7 @@ class Je {
3002
3002
  * stale state.
3003
3003
  * */
3004
3004
  async runBlock(e) {
3005
- await be(this.env.pl, this.rid, (t) => t.renderProduction([e], !0)), await this.projectTree.refreshState();
3005
+ await we(this.env.pl, this.rid, (t) => t.renderProduction([e], !0)), await this.projectTree.refreshState();
3006
3006
  }
3007
3007
  /**
3008
3008
  * Stops the block if it is running by destroying its production state. All
@@ -3010,7 +3010,7 @@ class Je {
3010
3010
  * calculated.
3011
3011
  * */
3012
3012
  async stopBlock(e) {
3013
- await be(this.env.pl, this.rid, (t) => t.stopProduction(e)), await this.projectTree.refreshState();
3013
+ await we(this.env.pl, this.rid, (t) => t.stopProduction(e)), await this.projectTree.refreshState();
3014
3014
  }
3015
3015
  /** Update block label. */
3016
3016
  async setBlockLabel(e, t, r) {
@@ -3066,9 +3066,9 @@ class Je {
3066
3066
  /** Resets arguments and ui state of the block to initial state */
3067
3067
  async resetBlockArgsAndUiState(e, t) {
3068
3068
  await this.env.pl.withWriteTx("BlockInputsReset", async (r) => {
3069
- const s = we(
3069
+ const s = Se(
3070
3070
  (await r.getField(S(this.rid, C(e, "blockPack")))).value
3071
- ), i = we(
3071
+ ), i = Se(
3072
3072
  (await r.getField(S(s, b.HolderRefField))).value
3073
3073
  ), n = await r.getResourceData(i, !1), a = JSON.parse(
3074
3074
  Buffer.from(w(n.data)).toString("utf-8")
@@ -3135,14 +3135,14 @@ class Je {
3135
3135
  await this.destroy();
3136
3136
  }
3137
3137
  static async init(e, t) {
3138
- const r = await gt.init(e.pl, t, e.ops.defaultTreeOptions);
3139
- return new Je(e, t, r);
3138
+ const r = await ht.init(e.pl, t, e.ops.defaultTreeOptions);
3139
+ return new Ke(e, t, r);
3140
3140
  }
3141
3141
  }
3142
- const Lt = {
3142
+ const Jt = {
3143
3143
  logger: new Qt(),
3144
3144
  platformLocalStorageNameToPath: {},
3145
- localStorageNameToPath: { local: ft.homedir() },
3145
+ localStorageNameToPath: { local: mt.homedir() },
3146
3146
  blobDriverOps: {
3147
3147
  cacheSoftSizeBytes: 100 * 1024 * 1024,
3148
3148
  // 100MB
@@ -3160,7 +3160,7 @@ const Lt = {
3160
3160
  stopPollingDelay: 1e3
3161
3161
  }
3162
3162
  }, Ss = {
3163
- ...Lt,
3163
+ ...Jt,
3164
3164
  defaultTreeOptions: {
3165
3165
  pollingInterval: 350,
3166
3166
  stopPollingDelay: 2500
@@ -3184,7 +3184,7 @@ class Ps extends cr {
3184
3184
  case "dev-v2":
3185
3185
  return `dev_2_${t.folder}_${t.mtime}`;
3186
3186
  case "from-registry-v2":
3187
- return `from_registry_v2_${t.registryUrl}_${t.id.organization}_${t.id.name}`;
3187
+ return `from_registry_v2_${t.registryUrl}_${t.id.organization}_${t.id.name}_${t.id.version}`;
3188
3188
  default:
3189
3189
  return Cs;
3190
3190
  }
@@ -3195,7 +3195,7 @@ class Ps extends cr {
3195
3195
  switch (t.type) {
3196
3196
  case "dev-v1":
3197
3197
  try {
3198
- const s = await vt(t.folder);
3198
+ const s = await yt(t.folder);
3199
3199
  return s === t.mtime ? void 0 : { ...t, mtime: s };
3200
3200
  } catch (s) {
3201
3201
  this.logger.warn(s);
@@ -3203,9 +3203,9 @@ class Ps extends cr {
3203
3203
  }
3204
3204
  case "dev-v2":
3205
3205
  try {
3206
- const s = await lt(t.folder);
3206
+ const s = await dt(t.folder, this.logger);
3207
3207
  if (s === void 0) return;
3208
- const i = await Ae(s);
3208
+ const i = await Ie(s);
3209
3209
  return i === t.mtime ? void 0 : { ...t, mtime: i };
3210
3210
  } catch (s) {
3211
3211
  this.logger.warn(s);
@@ -3215,7 +3215,7 @@ class Ps extends cr {
3215
3215
  try {
3216
3216
  const i = (r = await this.registryProvider.getRegistry(t.registryUrl).getOverviewForSpec(t.id)) == null ? void 0 : r.spec;
3217
3217
  if ((i == null ? void 0 : i.type) !== "from-registry-v2") throw new Error("Unexpected");
3218
- return Ht(i.id, t.id) ? void 0 : i;
3218
+ return me(i.id, t.id) ? void 0 : i;
3219
3219
  } catch (s) {
3220
3220
  this.logger.warn(s);
3221
3221
  return;
@@ -3223,19 +3223,29 @@ class Ps extends cr {
3223
3223
  default:
3224
3224
  return;
3225
3225
  }
3226
- } catch {
3226
+ } catch (s) {
3227
+ this.logger.warn(s);
3227
3228
  return;
3228
3229
  }
3229
3230
  }
3230
3231
  resultsEqual(t, r) {
3231
3232
  if (t === void 0 && r === void 0) return !0;
3232
- if (t === void 0 || r === void 0) return !1;
3233
- if (t.type === "from-registry-v1" || r.type === "from-registry-v1" || t.type === "from-registry-v2" || r.type === "from-registry-v2")
3234
- throw new Error("Unexpected, not yet supported.");
3235
- return t.folder === r.folder && t.mtime === r.mtime;
3233
+ if (t === void 0 || r === void 0 || t.type !== r.type) return !1;
3234
+ switch (t.type) {
3235
+ case "from-registry-v1":
3236
+ return r.type !== "from-registry-v1" ? !1 : t.registryUrl === r.registryUrl && me(t.id, r.id);
3237
+ case "from-registry-v2":
3238
+ return r.type !== "from-registry-v2" ? !1 : t.registryUrl === r.registryUrl && me(t.id, r.id);
3239
+ case "dev-v1":
3240
+ return r.type !== "dev-v1" ? !1 : t.folder === r.folder && t.mtime === r.mtime;
3241
+ case "dev-v2":
3242
+ return r.type !== "dev-v2" ? !1 : t.folder === r.folder && t.mtime === r.mtime;
3243
+ default:
3244
+ O(t);
3245
+ }
3236
3246
  }
3237
3247
  }
3238
- class nt {
3248
+ class at {
3239
3249
  constructor() {
3240
3250
  d(this, "resources", /* @__PURE__ */ new Map());
3241
3251
  }
@@ -3270,7 +3280,7 @@ class nt {
3270
3280
  return (t = this.resources.get(e)) == null ? void 0 : t.resource;
3271
3281
  }
3272
3282
  }
3273
- function at(o) {
3283
+ function ct(o) {
3274
3284
  return String(o.id);
3275
3285
  }
3276
3286
  class Fs {
@@ -3288,8 +3298,8 @@ class Fs {
3288
3298
  });
3289
3299
  this.blobDriver = e, this.columns = t, this.pFrame.setDataSource(this);
3290
3300
  for (const r of t) {
3291
- for (const i of Fo(r.data)) this.blobIdToResource.set(at(i), i);
3292
- const s = Bo(r.data, at);
3301
+ for (const i of Fo(r.data)) this.blobIdToResource.set(ct(i), i);
3302
+ const s = Bo(r.data, ct);
3293
3303
  try {
3294
3304
  this.pFrame.addColumnSpec(r.id, r.spec), this.pFrame.setColumnData(r.id, s);
3295
3305
  } catch (i) {
@@ -3315,7 +3325,7 @@ class Bs {
3315
3325
  constructor(e) {
3316
3326
  d(this, "pFrames");
3317
3327
  d(this, "pTables");
3318
- this.blobDriver = e, this.pFrames = new class extends nt {
3328
+ this.blobDriver = e, this.pFrames = new class extends at {
3319
3329
  constructor(t) {
3320
3330
  super(), this.blobDriver = t;
3321
3331
  }
@@ -3325,7 +3335,7 @@ class Bs {
3325
3335
  calculateParamsKey(t) {
3326
3336
  return Os(t);
3327
3337
  }
3328
- }(this.blobDriver), this.pTables = new class extends nt {
3338
+ }(this.blobDriver), this.pTables = new class extends at {
3329
3339
  constructor(t) {
3330
3340
  super(), this.pFrames = t;
3331
3341
  }
@@ -3349,7 +3359,7 @@ class Bs {
3349
3359
  return t.addOnDestroy(s.unref), s.key;
3350
3360
  }
3351
3361
  createPTable(e, t) {
3352
- const r = this.createPFrame(xs(e.src), t), s = ct(e, (n) => n.id), i = this.pTables.acquire({ def: s, pFrameHandle: r });
3362
+ const r = this.createPFrame(xs(e.src), t), s = ut(e, (n) => n.id), i = this.pTables.acquire({ def: s, pFrameHandle: r });
3353
3363
  return t.addOnDestroy(i.unref), i.key;
3354
3364
  }
3355
3365
  //
@@ -3429,7 +3439,7 @@ function Q(o) {
3429
3439
  }
3430
3440
  function Rs(o) {
3431
3441
  const e = ge("sha256");
3432
- return e.update(o.pFrameHandle), e.update(je(o.def)), e.digest().toString("hex");
3442
+ return e.update(o.pFrameHandle), e.update(Ee(o.def)), e.digest().toString("hex");
3433
3443
  }
3434
3444
  function Os(o) {
3435
3445
  const e = o.map((s) => s.id).sort(), t = ge("sha256");
@@ -3460,9 +3470,9 @@ function ae(o, e) {
3460
3470
  }
3461
3471
  }
3462
3472
  async function Ds(o, e) {
3463
- const t = { ...Lt, ...e };
3473
+ const t = { ...Jt, ...e };
3464
3474
  js(t.logger, t);
3465
- const r = new dt(t.localSecret), s = hr(t.logger, o, t.platformLocalStorageNameToPath), i = fr(o, t.logger), n = mr(o, t.logger), a = vr(o, t.logger), c = yr(o, t.logger), u = new br(
3475
+ const r = new pt(t.localSecret), s = hr(t.logger, o, t.platformLocalStorageNameToPath), i = fr(o, t.logger), n = mr(o, t.logger), a = vr(o, t.logger), c = yr(o, t.logger), u = new br(
3466
3476
  t.logger,
3467
3477
  s,
3468
3478
  i,
@@ -3486,7 +3496,7 @@ async function Ds(o, e) {
3486
3496
  };
3487
3497
  }
3488
3498
  function js(o, e) {
3489
- e.localStorageNameToPath.local != ft.homedir() && o.warn(`'local' storage with homedir was overwrote: ${e.localStorageNameToPath.local}`);
3499
+ e.localStorageNameToPath.local != mt.homedir() && o.warn(`'local' storage with homedir was overwrote: ${e.localStorageNameToPath.local}`);
3490
3500
  const t = Object.keys(e.platformLocalStorageNameToPath), r = Object.keys(e.localStorageNameToPath).find(
3491
3501
  (s) => t.includes(s)
3492
3502
  );
@@ -3495,7 +3505,7 @@ function js(o, e) {
3495
3505
  `Platform local storages include one or more local storages: ${r}. Note that we automatically included 'local' storage with user's home directory.`
3496
3506
  );
3497
3507
  }
3498
- class Jt {
3508
+ class Kt {
3499
3509
  constructor(e, t, r, s, i, n, a, c) {
3500
3510
  d(this, "pl");
3501
3511
  /** Contains a reactive list of projects along with their meta information. */
@@ -3548,7 +3558,7 @@ class Jt {
3548
3558
  async openProject(e) {
3549
3559
  const t = await this.ensureProjectRid(e);
3550
3560
  if (this.openedProjectsByRid.has(t)) throw new Error(`Project ${t} already opened`);
3551
- this.openedProjectsByRid.set(t, await Je.init(this.env, t)), this.openedProjectsList.setValue([...this.openedProjectsByRid.keys()]);
3561
+ this.openedProjectsByRid.set(t, await Ke.init(this.env, t)), this.openedProjectsList.setValue([...this.openedProjectsByRid.keys()]);
3552
3562
  }
3553
3563
  /** Closes the project, and deallocate all corresponding resources. */
3554
3564
  async closeProject(e) {
@@ -3576,7 +3586,7 @@ class Jt {
3576
3586
  /** Generates sufficiently random string to be used as local secret for the
3577
3587
  * middle layer */
3578
3588
  static generateLocalSecret() {
3579
- return dt.generateSecret();
3589
+ return pt.generateSecret();
3580
3590
  }
3581
3591
  /** Initialize middle layer */
3582
3592
  static async init(e, t) {
@@ -3585,7 +3595,7 @@ class Jt {
3585
3595
  v.createField(x, "Dynamic");
3586
3596
  const N = await v.getField(x);
3587
3597
  if (ce(N.value)) {
3588
- const K = v.createEphemeral(wt);
3598
+ const K = v.createEphemeral(St);
3589
3599
  return v.lock(K), v.setField(x, K), await v.commit(), await K.globalId;
3590
3600
  } else
3591
3601
  return N.value;
@@ -3613,7 +3623,7 @@ class Jt {
3613
3623
  }),
3614
3624
  quickJs: await pr()
3615
3625
  }, g = new ur([]), f = await Wr(e, s, g, p);
3616
- return new Jt(
3626
+ return new Kt(
3617
3627
  p,
3618
3628
  n,
3619
3629
  n.signer,
@@ -3628,12 +3638,12 @@ class Jt {
3628
3638
  export {
3629
3639
  ei as BlockPackRegistry,
3630
3640
  ti as CentralBlockRegistry,
3631
- Lt as DefaultDriverKitOps,
3641
+ Jt as DefaultDriverKitOps,
3632
3642
  Ss as DefaultMiddleLayerOps,
3633
- Ct as FrontendFromFolderResourceType,
3634
- kt as FrontendFromUrlResourceType,
3635
- Jt as MiddleLayer,
3636
- Je as Project,
3643
+ Pt as FrontendFromFolderResourceType,
3644
+ Ct as FrontendFromUrlResourceType,
3645
+ Kt as MiddleLayer,
3646
+ Ke as Project,
3637
3647
  oo as TengoTemplateGet,
3638
3648
  so as TengoTemplateGetRegistry,
3639
3649
  no as TengoTemplateGetTemplate,
@@ -3645,11 +3655,11 @@ export {
3645
3655
  oi as V1CentralDevSnapshotRegistry,
3646
3656
  ri as V1CentralRegistry,
3647
3657
  Tr as V2RegistryProvider,
3648
- St as createRenderTemplate,
3649
- vt as getDevV1PacketMtime,
3650
- Ae as getDevV2PacketMtime,
3658
+ kt as createRenderTemplate,
3659
+ yt as getDevV1PacketMtime,
3660
+ Ie as getDevV2PacketMtime,
3651
3661
  Ds as initDriverKit,
3652
- Ve as loadTemplate,
3662
+ Ne as loadTemplate,
3653
3663
  po as prepareTemplateSpec
3654
3664
  };
3655
3665
  //# sourceMappingURL=index.mjs.map