@dialecte/scl 0.3.14 → 0.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/{hooks-By65uB-0.js → hooks-CLIa7kxj.js} +1061 -900
  2. package/dist/v2019C1/constants/index.d.ts +3 -0
  3. package/dist/v2019C1/constants/index.d.ts.map +1 -1
  4. package/dist/v2019C1/constants/naming.d.ts +3 -0
  5. package/dist/v2019C1/constants/naming.d.ts.map +1 -0
  6. package/dist/v2019C1/constants/topology-tags.d.ts +15 -0
  7. package/dist/v2019C1/constants/topology-tags.d.ts.map +1 -0
  8. package/dist/v2019C1/constants/topology-tags.types.d.ts +6 -0
  9. package/dist/v2019C1/constants/topology-tags.types.d.ts.map +1 -0
  10. package/dist/v2019C1/extensions/identity/transaction/restore-cloned-uuids.d.ts +8 -10
  11. package/dist/v2019C1/extensions/identity/transaction/restore-cloned-uuids.d.ts.map +1 -1
  12. package/dist/v2019C1/extensions/lifecycle/engine/reconcile.d.ts.map +1 -1
  13. package/dist/v2019C1/extensions/lifecycle/extract/transaction/ensure-substation-structure.d.ts.map +1 -1
  14. package/dist/v2019C1/extensions/lifecycle/extract/transaction/index.d.ts +1 -0
  15. package/dist/v2019C1/extensions/lifecycle/extract/transaction/index.d.ts.map +1 -1
  16. package/dist/v2019C1/extensions/lifecycle/extract/transaction/ssd.d.ts +20 -0
  17. package/dist/v2019C1/extensions/lifecycle/extract/transaction/ssd.d.ts.map +1 -0
  18. package/dist/v2019C1/extensions/lifecycle/instance/find-instance.d.ts +3 -0
  19. package/dist/v2019C1/extensions/lifecycle/instance/find-instance.d.ts.map +1 -1
  20. package/dist/v2019C1/extensions/lifecycle/instantiate/transaction/asd.d.ts.map +1 -1
  21. package/dist/v2019C1/extensions/lifecycle/instantiate/transaction/fsd.d.ts.map +1 -1
  22. package/dist/v2019C1/extensions/lifecycle/layers/omit-filters.d.ts +6 -0
  23. package/dist/v2019C1/extensions/lifecycle/layers/omit-filters.d.ts.map +1 -1
  24. package/dist/v2019C1/extensions/lifecycle/layers/topology/clone-topology-content.d.ts +27 -0
  25. package/dist/v2019C1/extensions/lifecycle/layers/topology/clone-topology-content.d.ts.map +1 -0
  26. package/dist/v2019C1/extensions/lifecycle/layers/topology/index.d.ts +3 -0
  27. package/dist/v2019C1/extensions/lifecycle/layers/topology/index.d.ts.map +1 -0
  28. package/dist/v2019C1/extensions/lifecycle/layers/topology/root-selection.d.ts +14 -0
  29. package/dist/v2019C1/extensions/lifecycle/layers/topology/root-selection.d.ts.map +1 -0
  30. package/dist/v2019C1/extensions/lifecycle/report/query/report-asd.d.ts.map +1 -1
  31. package/dist/v2019C1/extensions/lifecycle/transplant/transaction/primitives/merge-children-into.d.ts +1 -1
  32. package/dist/v2019C1/extensions/lifecycle/transplant/transaction/primitives/merge-children-into.d.ts.map +1 -1
  33. package/dist/v2019C1/extensions/lifecycle/update/transaction/asd.d.ts.map +1 -1
  34. package/dist/v2019C1/extensions/lifecycle/update/transaction/cross-cutting-satellites.d.ts +4 -0
  35. package/dist/v2019C1/extensions/lifecycle/update/transaction/cross-cutting-satellites.d.ts.map +1 -1
  36. package/dist/v2019C1/extensions/lifecycle/update/transaction/fsd.d.ts.map +1 -1
  37. package/dist/v2019C1/extensions/lifecycle/update/transaction/function-satellites.d.ts +6 -0
  38. package/dist/v2019C1/extensions/lifecycle/update/transaction/function-satellites.d.ts.map +1 -1
  39. package/dist/v2019C1/extensions/lifecycle/update/transaction/satellite-reconcile.d.ts +6 -0
  40. package/dist/v2019C1/extensions/lifecycle/update/transaction/satellite-reconcile.d.ts.map +1 -1
  41. package/dist/v2019C1/extensions/reference/transaction/index.d.ts +1 -1
  42. package/dist/v2019C1/extensions/reference/transaction/index.d.ts.map +1 -1
  43. package/dist/v2019C1/extensions/reference/transaction/write-provenance.d.ts +9 -9
  44. package/dist/v2019C1/extensions/reference/transaction/write-provenance.d.ts.map +1 -1
  45. package/dist/v2019C1/extensions/reference/transaction/write-provenance.types.d.ts +22 -7
  46. package/dist/v2019C1/extensions/reference/transaction/write-provenance.types.d.ts.map +1 -1
  47. package/dist/v2019C1/index.js +10 -10
  48. package/dist/v2019C1/test.js +1 -1
  49. package/package.json +1 -1
@@ -24597,7 +24597,7 @@ async function S(e, n) {
24597
24597
  tagName: "DOType",
24598
24598
  attributes: { id: n }
24599
24599
  });
24600
- r && C(i.doTypes, n, r) && await w({
24600
+ r && C(i.doTypes, n, r) && await ee({
24601
24601
  query: e,
24602
24602
  parent: r,
24603
24603
  dataModelMap: i
@@ -24614,7 +24614,7 @@ async function S(e, n) {
24614
24614
  function C(e, t, n) {
24615
24615
  return e.has(t) ? !1 : (e.set(t, n), !0);
24616
24616
  }
24617
- async function w(e) {
24617
+ async function ee(e) {
24618
24618
  let { query: n, parent: r, dataModelMap: i } = e, a = r.tagName === "DOType" ? await n.getRecords(r.children.filter((e) => t(e, "DA"))) : await n.getRecords(r.children.filter((e) => t(e, "BDA")));
24619
24619
  for (let e of a) {
24620
24620
  if (!e) continue;
@@ -24631,7 +24631,7 @@ async function w(e) {
24631
24631
  tagName: "DAType",
24632
24632
  attributes: { id: r }
24633
24633
  });
24634
- e && C(i.daTypes, r, e) && await w({
24634
+ e && C(i.daTypes, r, e) && await ee({
24635
24635
  query: n,
24636
24636
  parent: e,
24637
24637
  dataModelMap: i
@@ -24648,7 +24648,7 @@ async function w(e) {
24648
24648
  tagName: "DOType",
24649
24649
  attributes: { id: t }
24650
24650
  });
24651
- r && C(i.doTypes, t, r) && await w({
24651
+ r && C(i.doTypes, t, r) && await ee({
24652
24652
  query: n,
24653
24653
  parent: r,
24654
24654
  dataModelMap: i
@@ -24658,15 +24658,15 @@ async function w(e) {
24658
24658
  }
24659
24659
  //#endregion
24660
24660
  //#region src/v2019C1/extensions/data-model/query/is-lnode-locked.ts
24661
- var ee = "None";
24662
- async function te(e, t) {
24661
+ var te = "None";
24662
+ async function w(e, t) {
24663
24663
  let n = await e.any.getAttribute(t, { name: "iedName" });
24664
- return !!n && n !== ee;
24664
+ return !!n && n !== te;
24665
24665
  }
24666
24666
  //#endregion
24667
24667
  //#region src/v2019C1/extensions/data-model/query/index.ts
24668
24668
  var ne = /* @__PURE__ */ l({
24669
- isLNodeLocked: () => te,
24669
+ isLNodeLocked: () => w,
24670
24670
  resolve: () => S
24671
24671
  });
24672
24672
  //#endregion
@@ -24674,7 +24674,7 @@ var ne = /* @__PURE__ */ l({
24674
24674
  async function re(e) {
24675
24675
  let t = await e.getRecordsByTagName("LNode");
24676
24676
  for (let n of t) {
24677
- if (!await te(e, n)) {
24677
+ if (!await w(e, n)) {
24678
24678
  await e.update(n, { attributes: { iedName: "None" } });
24679
24679
  continue;
24680
24680
  }
@@ -25287,10 +25287,19 @@ var D = {
25287
25287
  "InputVar",
25288
25288
  "OutputVar",
25289
25289
  "ProcessEcho"
25290
- ]), k = Object.keys(D), A = new Set(k), pe = new Set(Object.values(D).flatMap((e) => e.flatMap((e) => e.target)));
25290
+ ]), pe = Object.keys(D), k = new Set(pe), me = new Set(Object.values(D).flatMap((e) => e.flatMap((e) => e.target))), he = "TEMPLATE", ge = [
25291
+ "Substation",
25292
+ "VoltageLevel",
25293
+ "Bay"
25294
+ ], _e = [
25295
+ "ConductingEquipment",
25296
+ "PowerTransformer",
25297
+ "GeneralEquipment",
25298
+ "ConnectivityNode"
25299
+ ];
25291
25300
  //#endregion
25292
25301
  //#region src/v2019C1/extensions/reference/query/resolve/parse-path.ts
25293
- function me(e) {
25302
+ function ve(e) {
25294
25303
  if (!e) return [];
25295
25304
  let t = [], n = "", r = "/";
25296
25305
  for (let i of e) i === "/" || i === "." ? (n && t.push({
@@ -25302,7 +25311,7 @@ function me(e) {
25302
25311
  separator: r
25303
25312
  }), t;
25304
25313
  }
25305
- function he(e) {
25314
+ function A(e) {
25306
25315
  let t = e.split("/"), n = t[t.length - 1], r = n.indexOf(".");
25307
25316
  if (r === -1) return { path: e };
25308
25317
  let i = n.substring(0, r), a = n.substring(r + 1);
@@ -25311,19 +25320,19 @@ function he(e) {
25311
25320
  qualifier: a || void 0
25312
25321
  };
25313
25322
  }
25314
- function ge(e, t, n, r) {
25315
- return !e || e === M.unsupported ? null : e === M.direct ? { lookupKey: n } : e === M.iedAddress ? ve(n, r) : e === M.lnode ? _e(n) : e === M.behaviorDescription ? ye(t, n, r) : null;
25323
+ function ye(e, t, n, r) {
25324
+ return !e || e === M.unsupported ? null : e === M.direct ? { lookupKey: n } : e === M.iedAddress ? xe(n, r) : e === M.lnode ? be(n) : e === M.behaviorDescription ? Se(t, n, r) : null;
25316
25325
  }
25317
- function _e(e) {
25318
- let { path: t, qualifier: n } = he(e);
25326
+ function be(e) {
25327
+ let { path: t, qualifier: n } = A(e);
25319
25328
  return {
25320
25329
  lookupKey: t,
25321
25330
  qualifier: n
25322
25331
  };
25323
25332
  }
25324
- function ve(e, t) {
25333
+ function xe(e, t) {
25325
25334
  if (t) {
25326
- let n = Se(t);
25335
+ let n = Te(t);
25327
25336
  if (n) return {
25328
25337
  lookupKey: e,
25329
25338
  fallbackLookupKey: `${n}/${e}`
@@ -25331,15 +25340,15 @@ function ve(e, t) {
25331
25340
  }
25332
25341
  return { lookupKey: e };
25333
25342
  }
25334
- function ye(e, t, n) {
25343
+ function Se(e, t, n) {
25335
25344
  if (!n) return null;
25336
- let r = be(n);
25345
+ let r = Ce(n);
25337
25346
  return r ? e === "dataName" ? {
25338
25347
  lookupKey: r,
25339
25348
  qualifier: t
25340
- } : e === "inputName" || e === "outputName" ? { lookupKey: `${r}.${xe(t)}` } : null : null;
25349
+ } : e === "inputName" || e === "outputName" ? { lookupKey: `${r}.${we(t)}` } : null : null;
25341
25350
  }
25342
- function be(e) {
25351
+ function Ce(e) {
25343
25352
  let t = -1;
25344
25353
  for (let n = e.length - 1; n >= 0; n--) if (e[n].tagName === "BehaviorDescription") {
25345
25354
  t = n;
@@ -25353,11 +25362,11 @@ function be(e) {
25353
25362
  }
25354
25363
  return n.length === 0 ? null : de(n);
25355
25364
  }
25356
- function xe(e) {
25365
+ function we(e) {
25357
25366
  let t = e.indexOf("("), n = e.indexOf(".");
25358
25367
  return t === -1 ? n === -1 ? e : e.substring(0, n) : e.substring(0, t);
25359
25368
  }
25360
- function Se(e) {
25369
+ function Te(e) {
25361
25370
  for (let t = e.length - 1; t >= 0; t--) if (e[t].tagName === "LNode") return e[t].attributes.find((e) => e.name === "iedName")?.value ?? null;
25362
25371
  return null;
25363
25372
  }
@@ -25366,7 +25375,7 @@ function Se(e) {
25366
25375
  async function j(e, t) {
25367
25376
  let { reference: n, target: r } = t;
25368
25377
  if (P.has(n.tagName)) return null;
25369
- let a = Te(n.tagName, r.tagName);
25378
+ let a = Oe(n.tagName, r.tagName);
25370
25379
  if (!a) return null;
25371
25380
  let o = a.resolution;
25372
25381
  if (o === M.behaviorDescription) {
@@ -25379,12 +25388,12 @@ async function j(e, t) {
25379
25388
  if (o === M.lnode) {
25380
25389
  let t = await e.getRecord(n);
25381
25390
  if (!t) return c;
25382
- let r = we(t, a);
25383
- return r ? `${c}.${Ce(t, a) ?? r}` : c;
25391
+ let r = De(t, a);
25392
+ return r ? `${c}.${Ee(t, a) ?? r}` : c;
25384
25393
  }
25385
25394
  return c;
25386
25395
  }
25387
- function Ce(e, t) {
25396
+ function Ee(e, t) {
25388
25397
  let [n, r] = t.companions;
25389
25398
  if (!n) return;
25390
25399
  let i = e.attributes.find((e) => e.name === n.name)?.value;
@@ -25392,11 +25401,11 @@ function Ce(e, t) {
25392
25401
  let a = r ? e.attributes.find((e) => e.name === r.name)?.value : void 0;
25393
25402
  return a ? `${i}.${a}` : i;
25394
25403
  }
25395
- function we(e, t) {
25404
+ function De(e, t) {
25396
25405
  let n = e.attributes.find((e) => e.name === t.attribute.path)?.value;
25397
- if (n) return he(n).qualifier;
25406
+ if (n) return A(n).qualifier;
25398
25407
  }
25399
- function Te(e, t) {
25408
+ function Oe(e, t) {
25400
25409
  let n = D[e];
25401
25410
  return n ? n.find((e) => e.target.includes(t)) ?? null : null;
25402
25411
  }
@@ -25462,7 +25471,7 @@ var M = {
25462
25471
  };
25463
25472
  //#endregion
25464
25473
  //#region src/v2019C1/extensions/reference/constants/helpers.ts
25465
- function Ee(e) {
25474
+ function ke(e) {
25466
25475
  let t = {};
25467
25476
  for (let [n, r] of Object.entries(e)) for (let e of r) {
25468
25477
  let r = t[e.resolution] ??= /* @__PURE__ */ new Map();
@@ -25477,7 +25486,7 @@ function Ee(e) {
25477
25486
  }
25478
25487
  return t;
25479
25488
  }
25480
- function De(e) {
25489
+ function Ae(e) {
25481
25490
  let t = /* @__PURE__ */ new Map();
25482
25491
  for (let [n, r] of Object.entries(e)) t.set(n, r.map((e) => ({
25483
25492
  uuidAttr: e.attribute.uuid,
@@ -25487,7 +25496,7 @@ function De(e) {
25487
25496
  })));
25488
25497
  return t;
25489
25498
  }
25490
- function Oe(e) {
25499
+ function je(e) {
25491
25500
  let t = /* @__PURE__ */ new Map();
25492
25501
  for (let [n, r] of Object.entries(e)) for (let e of r) {
25493
25502
  let r = t.get(e.target) ?? [];
@@ -25501,15 +25510,15 @@ function Oe(e) {
25501
25510
  }
25502
25511
  //#endregion
25503
25512
  //#region src/v2019C1/extensions/reference/constants/derived.ts
25504
- var ke = Ee(D), Ae = [
25513
+ var Me = ke(D), Ne = [
25505
25514
  M.direct,
25506
25515
  M.lnode,
25507
25516
  M.iedAddress,
25508
25517
  M.behaviorDescription
25509
- ], je = [...Ae, M.unsupported], Me = De(D), P = new Map(Object.entries(D).flatMap(([e, t]) => t.filter((e) => e.attribute.path === "mappedDoName" || e.attribute.path === "mappedDaName").map((t) => [e, {
25518
+ ], Pe = [...Ne, M.unsupported], Fe = Ae(D), P = new Map(Object.entries(D).flatMap(([e, t]) => t.filter((e) => e.attribute.path === "mappedDoName" || e.attribute.path === "mappedDaName").map((t) => [e, {
25510
25519
  path: t.attribute.path,
25511
25520
  uuid: t.attribute.uuid
25512
- }]))), Ne = [...new Set(Object.values(D).flatMap((e) => e.map((e) => e.attribute.uuid)))], F = new Map(Object.entries(N).map(([e, t]) => [e, [...new Set(t.map((e) => e.attribute))]])), Pe = Oe(N), Fe = new Set(Pe.keys()), Ie = new Set([..._.LNode?.attributes?.identityFields ?? [], ...F.get("LNode") ?? []]), Le = {
25521
+ }]))), Ie = [...new Set(Object.values(D).flatMap((e) => e.map((e) => e.attribute.uuid)))], Le = new Map(Object.entries(N).map(([e, t]) => [e, [...new Set(t.map((e) => e.attribute))]])), Re = je(N), ze = new Set(Re.keys()), Be = new Set([..._.LNode?.attributes?.identityFields ?? [], ...Le.get("LNode") ?? []]), Ve = {
25513
25522
  FunctionCatRef: ["SubCategory", "FunctionCategory"],
25514
25523
  PowerSystemRelation: ["PowerSystemRelations"],
25515
25524
  Resource: ["ProcessResource", "ProcessResources"],
@@ -25517,22 +25526,22 @@ var ke = Ee(D), Ae = [
25517
25526
  };
25518
25527
  //#endregion
25519
25528
  //#region src/v2019C1/extensions/reference/query/build/build-mapped-name.ts
25520
- async function Re(e, t) {
25529
+ async function He(e, t) {
25521
25530
  let n = P.get(t.tagName);
25522
25531
  if (!n) return;
25523
25532
  let r = t.attributes.find((e) => e.name === "name")?.value;
25524
25533
  if (!r) return;
25525
- let i = t.attributes.find((e) => e.name === n.path)?.value, a = ze(i, t.tagName === "DAS" && !await Be(e, t)) ?? r;
25534
+ let i = t.attributes.find((e) => e.name === n.path)?.value, a = Ue(i, t.tagName === "DAS" && !await We(e, t)) ?? r;
25526
25535
  return a === r ? void 0 : a;
25527
25536
  }
25528
- function ze(e, t) {
25537
+ function Ue(e, t) {
25529
25538
  if (!e) return;
25530
- let { path: n, qualifier: r } = he(e), i = r ?? n;
25539
+ let { path: n, qualifier: r } = A(e), i = r ?? n;
25531
25540
  if (t) return i || void 0;
25532
25541
  let a = i.split(".");
25533
25542
  return a[a.length - 1] || void 0;
25534
25543
  }
25535
- async function Be(e, t) {
25544
+ async function We(e, t) {
25536
25545
  let n = (await e.findAncestors(t)).find((e) => e.tagName === "DOS" || e.tagName === "SDS");
25537
25546
  return n ? !!await e.getAttribute({
25538
25547
  tagName: n.tagName,
@@ -25541,32 +25550,32 @@ async function Be(e, t) {
25541
25550
  }
25542
25551
  //#endregion
25543
25552
  //#region src/v2019C1/extensions/reference/query/build/build-mapped-lnode-path.ts
25544
- function Ve(e) {
25553
+ function Ge(e) {
25545
25554
  let t = e.iedName;
25546
- if (!t || t === He) return null;
25555
+ if (!t || t === Ke) return null;
25547
25556
  let n = e.ldInst, r = e.lnClass;
25548
25557
  return !n || !r ? null : `${t}/${n}/${`${e.prefix ?? ""}${r}${e.lnInst ?? ""}`}`;
25549
25558
  }
25550
- var He = "None";
25559
+ var Ke = "None";
25551
25560
  //#endregion
25552
25561
  //#region src/v2019C1/extensions/reference/query/resolve/resolve-reference-path.ts
25553
- async function Ue(e, t, n) {
25554
- let r = We(t.tagName, n);
25562
+ async function qe(e, t, n) {
25563
+ let r = Je(t.tagName, n);
25555
25564
  if (!r) return;
25556
25565
  let a = t.attributes.find((e) => e.name === n)?.value;
25557
25566
  if (!a) return;
25558
- let o = await Ge(e, t, r);
25567
+ let o = await Ye(e, t, r);
25559
25568
  if (o) return {
25560
25569
  record: o,
25561
- qualifier: Ke(r, n, a)
25570
+ qualifier: Xe(r, n, a)
25562
25571
  };
25563
25572
  let s;
25564
25573
  (r.resolution === M.behaviorDescription || r.resolution === M.iedAddress) && (s = (await e.findAncestors(t, { order: "top-down" })).map((e) => i(e)));
25565
- let c = ge(r.resolution, n, a, s);
25574
+ let c = ye(r.resolution, n, a, s);
25566
25575
  if (!c) return;
25567
- let l = me(c.lookupKey);
25576
+ let l = ve(c.lookupKey);
25568
25577
  if (l.length === 0) return;
25569
- let u = l[l.length - 1], d = l.slice(0, -1), f = await Xe({
25578
+ let u = l[l.length - 1], d = l.slice(0, -1), f = await et({
25570
25579
  query: e,
25571
25580
  targets: r.target,
25572
25581
  segment: u,
@@ -25577,11 +25586,11 @@ async function Ue(e, t, n) {
25577
25586
  qualifier: c.qualifier
25578
25587
  };
25579
25588
  }
25580
- function We(e, t) {
25589
+ function Je(e, t) {
25581
25590
  let n = D[e];
25582
25591
  if (n) return n.find((e) => e.attribute.path === t);
25583
25592
  }
25584
- async function Ge(e, t, n) {
25593
+ async function Ye(e, t, n) {
25585
25594
  let r = n.attribute.uuid, i = t.attributes.find((e) => e.name === r)?.value;
25586
25595
  if (i) for (let t of n.target) {
25587
25596
  let n = await e.findByAttributes({
@@ -25591,19 +25600,19 @@ async function Ge(e, t, n) {
25591
25600
  if (n.length > 0) return n[0];
25592
25601
  }
25593
25602
  }
25594
- function Ke(e, t, n) {
25595
- if (e.resolution === M.lnode) return he(n).qualifier;
25603
+ function Xe(e, t, n) {
25604
+ if (e.resolution === M.lnode) return A(n).qualifier;
25596
25605
  if (e.resolution === M.behaviorDescription && t === "dataName") return n;
25597
25606
  }
25598
- var qe = new Set(_.LNode.attributes.details.lnClass.facets.enumeration), Je = {
25607
+ var Ze = new Set(_.LNode.attributes.details.lnClass.facets.enumeration), Qe = {
25599
25608
  LNode: "lnInst",
25600
25609
  LN: "inst",
25601
25610
  LN0: "inst"
25602
25611
  };
25603
- function Ye(e) {
25612
+ function $e(e) {
25604
25613
  for (let t = 0; t <= e.length - 4; t++) {
25605
25614
  let n = e.substring(t, t + 4);
25606
- if (qe.has(n)) return {
25615
+ if (Ze.has(n)) return {
25607
25616
  prefix: e.substring(0, t),
25608
25617
  lnClass: n,
25609
25618
  inst: e.substring(t + 4)
@@ -25611,12 +25620,12 @@ function Ye(e) {
25611
25620
  }
25612
25621
  return null;
25613
25622
  }
25614
- async function Xe(e) {
25623
+ async function et(e) {
25615
25624
  let { query: t, targets: n, segment: r, expectedAncestry: i } = e;
25616
25625
  for (let e of n) {
25617
- let n = Je[e];
25626
+ let n = Qe[e];
25618
25627
  if (n) {
25619
- let a = await Ze({
25628
+ let a = await tt({
25620
25629
  query: t,
25621
25630
  tagName: e,
25622
25631
  segment: r,
@@ -25625,7 +25634,7 @@ async function Xe(e) {
25625
25634
  });
25626
25635
  if (a) return a;
25627
25636
  } else {
25628
- let n = await Qe({
25637
+ let n = await nt({
25629
25638
  query: t,
25630
25639
  tagName: e,
25631
25640
  segment: r,
@@ -25635,8 +25644,8 @@ async function Xe(e) {
25635
25644
  }
25636
25645
  }
25637
25646
  }
25638
- async function Ze(e) {
25639
- let { query: t, tagName: n, segment: r, instAttr: i, expectedAncestry: a } = e, o = Ye(r.segment);
25647
+ async function tt(e) {
25648
+ let { query: t, tagName: n, segment: r, instAttr: i, expectedAncestry: a } = e, o = $e(r.segment);
25640
25649
  if (!o) return;
25641
25650
  let s = await t.findByAttributes({
25642
25651
  tagName: n,
@@ -25644,17 +25653,17 @@ async function Ze(e) {
25644
25653
  });
25645
25654
  for (let e of s) {
25646
25655
  let n = e.attributes.find((e) => e.name === "prefix")?.value ?? "", r = e.attributes.find((e) => e.name === i)?.value ?? "";
25647
- if (!(n !== o.prefix || r !== o.inst) && await $e(t, e, a)) return e;
25656
+ if (!(n !== o.prefix || r !== o.inst) && await rt(t, e, a)) return e;
25648
25657
  }
25649
25658
  }
25650
- async function Qe(e) {
25659
+ async function nt(e) {
25651
25660
  let { query: t, tagName: n, segment: r, expectedAncestry: a } = e, o = await t.getRecordsByTagName(n);
25652
25661
  for (let e of o) {
25653
25662
  let n = T(i(e));
25654
- if (!(!n || n.segment !== r.segment) && await $e(t, e, a)) return e;
25663
+ if (!(!n || n.segment !== r.segment) && await rt(t, e, a)) return e;
25655
25664
  }
25656
25665
  }
25657
- async function $e(e, t, n) {
25666
+ async function rt(e, t, n) {
25658
25667
  if (n.length === 0) return !0;
25659
25668
  let r = await e.findAncestors(t), a = [];
25660
25669
  for (let e = r.length - 1; e >= 0; e--) {
@@ -25665,16 +25674,16 @@ async function $e(e, t, n) {
25665
25674
  }
25666
25675
  //#endregion
25667
25676
  //#region src/v2019C1/extensions/reference/query/resolve/resolve-element-path.ts
25668
- async function et(e, t) {
25669
- let n = me(t);
25670
- if (n.length !== 0) return tt({
25677
+ async function it(e, t) {
25678
+ let n = ve(t);
25679
+ if (n.length !== 0) return at({
25671
25680
  query: e,
25672
25681
  current: await e.getRoot(),
25673
25682
  segments: n,
25674
25683
  index: 0
25675
25684
  });
25676
25685
  }
25677
- async function tt(e) {
25686
+ async function at(e) {
25678
25687
  let { query: t, current: n, segments: r, index: a } = e;
25679
25688
  if (a >= r.length) return n;
25680
25689
  let o = n.children ?? [];
@@ -25684,7 +25693,7 @@ async function tt(e) {
25684
25693
  if (!e) continue;
25685
25694
  let n = T(i(e));
25686
25695
  if (!n) {
25687
- let n = await tt({
25696
+ let n = await at({
25688
25697
  query: t,
25689
25698
  current: e,
25690
25699
  segments: r,
@@ -25694,7 +25703,7 @@ async function tt(e) {
25694
25703
  continue;
25695
25704
  }
25696
25705
  if (n.segment === c.segment && n.separator === c.separator) {
25697
- let n = await tt({
25706
+ let n = await at({
25698
25707
  query: t,
25699
25708
  current: e,
25700
25709
  segments: r,
@@ -25707,14 +25716,14 @@ async function tt(e) {
25707
25716
  }
25708
25717
  //#endregion
25709
25718
  //#region src/v2019C1/extensions/reference/query/resolve/resolve-mapped-lnode.ts
25710
- var nt = new Set(["LN", "LN0"]);
25711
- async function rt(e, t) {
25712
- let n = Ve(it(t));
25719
+ var ot = new Set(["LN", "LN0"]);
25720
+ async function st(e, t) {
25721
+ let n = Ge(ct(t));
25713
25722
  if (!n) return;
25714
- let r = await et(e, n);
25715
- if (!(!r || !nt.has(r.tagName))) return r;
25723
+ let r = await it(e, n);
25724
+ if (!(!r || !ot.has(r.tagName))) return r;
25716
25725
  }
25717
- function it(e) {
25726
+ function ct(e) {
25718
25727
  let t = (t) => e.attributes.find((e) => e.name === t)?.value;
25719
25728
  return {
25720
25729
  iedName: t("iedName"),
@@ -25726,19 +25735,19 @@ function it(e) {
25726
25735
  }
25727
25736
  //#endregion
25728
25737
  //#region src/v2019C1/extensions/reference/guards.ts
25729
- function at(e) {
25730
- return Fe.has(e);
25738
+ function lt(e) {
25739
+ return ze.has(e);
25731
25740
  }
25732
25741
  //#endregion
25733
25742
  //#region src/v2019C1/extensions/reference/query/find/find-refs-pointing-to.ts
25734
- async function I(e, t) {
25743
+ async function F(e, t) {
25735
25744
  let { target: n, containerTagName: r } = t, i = await e.getRecord(n);
25736
- return i ? at(i.tagName) ? st(e, i, r) : ot(e, i, r) : [];
25745
+ return i ? lt(i.tagName) ? dt(e, i, r) : ut(e, i, r) : [];
25737
25746
  }
25738
- async function ot(e, t, r) {
25747
+ async function ut(e, t, r) {
25739
25748
  let i = t.attributes.find((e) => e.name === "uuid")?.value;
25740
25749
  if (!i) return [];
25741
- let a = lt(t.tagName);
25750
+ let a = pt(t.tagName);
25742
25751
  if (a.length === 0) return [];
25743
25752
  let o = [];
25744
25753
  for (let t of a) {
@@ -25748,7 +25757,7 @@ async function ot(e, t, r) {
25748
25757
  attributes: { [t.uuidAttr]: i }
25749
25758
  });
25750
25759
  for (let t of a) {
25751
- let n = r ? await ut(e, t, r) : void 0;
25760
+ let n = r ? await mt(e, t, r) : void 0;
25752
25761
  o.push({
25753
25762
  ref: t,
25754
25763
  container: n
@@ -25757,10 +25766,10 @@ async function ot(e, t, r) {
25757
25766
  }
25758
25767
  return o;
25759
25768
  }
25760
- async function st(e, t, r) {
25769
+ async function dt(e, t, r) {
25761
25770
  let i = t.attributes.find((e) => e.name === "id")?.value;
25762
25771
  if (!i) return [];
25763
- let a = Pe.get(t.tagName) ?? [], o = [];
25772
+ let a = Re.get(t.tagName) ?? [], o = [];
25764
25773
  for (let t of a) {
25765
25774
  if (!n(t.refTagName, x)) continue;
25766
25775
  let a = await e.findByAttributes({
@@ -25768,8 +25777,8 @@ async function st(e, t, r) {
25768
25777
  attributes: { [t.attribute]: i }
25769
25778
  });
25770
25779
  for (let n of a) {
25771
- if (!ct(n, t)) continue;
25772
- let i = r ? await ut(e, n, r) : void 0;
25780
+ if (!ft(n, t)) continue;
25781
+ let i = r ? await mt(e, n, r) : void 0;
25773
25782
  o.push({
25774
25783
  ref: n,
25775
25784
  container: i
@@ -25778,23 +25787,23 @@ async function st(e, t, r) {
25778
25787
  }
25779
25788
  return o;
25780
25789
  }
25781
- function ct(e, t) {
25790
+ function ft(e, t) {
25782
25791
  return t.when ? e.attributes.find((e) => e.name === t.when.attribute)?.value === t.when.equals : !0;
25783
25792
  }
25784
- function lt(e) {
25793
+ function pt(e) {
25785
25794
  let t = [];
25786
- for (let n of je) {
25787
- let r = ke[n]?.get(e);
25795
+ for (let n of Pe) {
25796
+ let r = Me[n]?.get(e);
25788
25797
  r && t.push(...r);
25789
25798
  }
25790
25799
  return t;
25791
25800
  }
25792
- async function ut(e, t, n) {
25801
+ async function mt(e, t, n) {
25793
25802
  return (await e.findAncestors(t, { stopAtTagName: n })).find((e) => e.tagName === n);
25794
25803
  }
25795
25804
  //#endregion
25796
25805
  //#region src/v2019C1/extensions/reference/query/provenance/get-provenance.constants.ts
25797
- var dt = {
25806
+ var ht = {
25798
25807
  Application: "application",
25799
25808
  Function: "function",
25800
25809
  SubFunction: "function",
@@ -25805,10 +25814,10 @@ var dt = {
25805
25814
  };
25806
25815
  //#endregion
25807
25816
  //#region src/v2019C1/extensions/reference/query/provenance/get-provenance.ts
25808
- async function ft(e) {
25817
+ async function gt(e) {
25809
25818
  let t = await e.getRecordsByTagName("SclFileReference"), n = [];
25810
25819
  for (let r of t) {
25811
- let t = await pt(e, r);
25820
+ let t = await _t(e, r);
25812
25821
  if (!t) continue;
25813
25822
  let { fileType: i, fileUuid: a, fileName: o, version: s, revision: c } = await e.getAttributes(r);
25814
25823
  n.push({
@@ -25822,17 +25831,17 @@ async function ft(e) {
25822
25831
  }
25823
25832
  return n;
25824
25833
  }
25825
- async function pt(e, t) {
25834
+ async function _t(e, t) {
25826
25835
  let n = await e.findAncestors(t);
25827
25836
  for (let e of n) {
25828
- let t = dt[e.tagName];
25837
+ let t = ht[e.tagName];
25829
25838
  if (t) return {
25830
25839
  kind: t,
25831
- ref: mt(e.tagName, e.id)
25840
+ ref: vt(e.tagName, e.id)
25832
25841
  };
25833
25842
  }
25834
25843
  }
25835
- function mt(e, t) {
25844
+ function vt(e, t) {
25836
25845
  return {
25837
25846
  tagName: e,
25838
25847
  id: t
@@ -25840,23 +25849,23 @@ function mt(e, t) {
25840
25849
  }
25841
25850
  //#endregion
25842
25851
  //#region src/v2019C1/extensions/reference/query/index.ts
25843
- var ht = /* @__PURE__ */ l({
25852
+ var yt = /* @__PURE__ */ l({
25844
25853
  buildElementPath: () => fe,
25845
- buildMappedLNodePath: () => Ve,
25846
- buildMappedName: () => Re,
25854
+ buildMappedLNodePath: () => Ge,
25855
+ buildMappedName: () => He,
25847
25856
  buildReferencePath: () => j,
25848
- findRefsPointingTo: () => I,
25849
- getProvenance: () => ft,
25850
- resolveElementPath: () => et,
25851
- resolveMappedLNode: () => rt,
25852
- resolveReferencePath: () => Ue
25857
+ findRefsPointingTo: () => F,
25858
+ getProvenance: () => gt,
25859
+ resolveElementPath: () => it,
25860
+ resolveMappedLNode: () => st,
25861
+ resolveReferencePath: () => qe
25853
25862
  });
25854
25863
  //#endregion
25855
25864
  //#region src/v2019C1/extensions/reference/transaction/apply-type-id-remap.ts
25856
- async function L(e, t) {
25865
+ async function bt(e, t) {
25857
25866
  let { records: n, idRemap: r } = t;
25858
25867
  if (r.size !== 0) for (let t of n) {
25859
- let n = F.get(t.tagName);
25868
+ let n = Le.get(t.tagName);
25860
25869
  if (!n) continue;
25861
25870
  let i = await e.getRecord(t);
25862
25871
  if (!i) continue;
@@ -25872,7 +25881,7 @@ async function L(e, t) {
25872
25881
  }
25873
25882
  //#endregion
25874
25883
  //#region src/v2019C1/extensions/reference/transaction/apply-uuid-remap.ts
25875
- async function R(e, t) {
25884
+ async function I(e, t) {
25876
25885
  let { mappings: n } = t;
25877
25886
  if (n.length === 0) return;
25878
25887
  let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
@@ -25915,37 +25924,61 @@ async function R(e, t) {
25915
25924
  }
25916
25925
  //#endregion
25917
25926
  //#region src/v2019C1/extensions/reference/transaction/write-provenance.ts
25918
- var gt = {
25919
- FSD: "FunctionSclRef",
25920
- ASD: "ApplicationSclRef"
25927
+ var xt = {
25928
+ function: {
25929
+ tag: "FunctionSclRef",
25930
+ fileType: "FSD"
25931
+ },
25932
+ application: {
25933
+ tag: "ApplicationSclRef",
25934
+ fileType: "ASD"
25935
+ }
25921
25936
  };
25922
- async function _t(e, t) {
25923
- let { sourceQuery: n, targetRoot: r, fileType: i } = t, [a] = await n.getRecordsByTagName("Header"), o = a ? await n.getAttributes(a) : void 0, s = await e.addChild(r, { tagName: gt[i] }), { name: c } = await n.getDocumentInfo();
25924
- await e.addChild(s, {
25937
+ async function St(e, t) {
25938
+ let { sourceQuery: n, target: r } = t, i = await Ct(n, wt(r));
25939
+ if (r.anchor === "document") {
25940
+ let t = await e.getRecord({ tagName: "Header" });
25941
+ if (!t) throw Error("writeProvenance: document anchor requires a target Header");
25942
+ let n = await e.ensureChild(t, { tagName: "SourceFiles" });
25943
+ await e.addChild(n, {
25944
+ tagName: "SclFileReference",
25945
+ attributes: i
25946
+ });
25947
+ return;
25948
+ }
25949
+ let { tag: a } = xt[r.anchor], o = await e.addChild(r.root, { tagName: a });
25950
+ await e.addChild(o, {
25925
25951
  tagName: "SclFileReference",
25926
- attributes: {
25927
- fileType: i,
25928
- version: o?.version ?? "",
25929
- revision: o?.revision ?? "",
25930
- fileName: c,
25931
- fileUuid: o?.uuid ?? ""
25932
- }
25952
+ attributes: i
25933
25953
  });
25934
25954
  }
25955
+ async function Ct(e, t) {
25956
+ let [n] = await e.getRecordsByTagName("Header"), r = n ? await e.getAttributes(n) : void 0, { name: i } = await e.getDocumentInfo();
25957
+ return {
25958
+ fileType: t,
25959
+ version: r?.version ?? "",
25960
+ revision: r?.revision ?? "",
25961
+ fileName: i,
25962
+ fileUuid: r?.uuid ?? ""
25963
+ };
25964
+ }
25965
+ function wt(e) {
25966
+ return e.anchor === "document" ? e.fileType : xt[e.anchor].fileType;
25967
+ }
25935
25968
  //#endregion
25936
25969
  //#region src/v2019C1/extensions/reference/index.ts
25937
- var z = {
25938
- query: ht,
25970
+ var L = {
25971
+ query: yt,
25939
25972
  transaction: /* @__PURE__ */ l({
25940
- applyTypeIdRemap: () => L,
25941
- applyUuidRemap: () => R,
25942
- writeProvenance: () => _t
25973
+ applyTypeIdRemap: () => bt,
25974
+ applyUuidRemap: () => I,
25975
+ writeProvenance: () => St
25943
25976
  })
25944
25977
  };
25945
25978
  //#endregion
25946
25979
  //#region src/v2019C1/extensions/clean-up/transaction/prune-empty-containers.ts
25947
- async function vt(e) {
25948
- let t = [...Object.values(Le).flat(), "Private"];
25980
+ async function Tt(e) {
25981
+ let t = [...Object.values(Ve).flat(), "Private"];
25949
25982
  for (let n of t) {
25950
25983
  let t = await e.getRecordsByTagName(n);
25951
25984
  for (let n of t) n.children.length === 0 && await e.delete(n);
@@ -25953,14 +25986,14 @@ async function vt(e) {
25953
25986
  }
25954
25987
  //#endregion
25955
25988
  //#region src/v2019C1/extensions/clean-up/transaction/orphan-uuid-refs.ts
25956
- async function yt(e) {
25957
- for (let t of k) {
25989
+ async function Et(e) {
25990
+ for (let t of pe) {
25958
25991
  let n = D[t], r = await e.getRecordsByTagName(t);
25959
25992
  for (let i of r) {
25960
25993
  let r = !1, a = !1, o = {};
25961
25994
  for (let t of n) {
25962
25995
  let n = await e.getAttribute(i, { name: t.attribute.uuid });
25963
- if (n) if (r = !0, await bt(e, n, t.target)) a = !0;
25996
+ if (n) if (r = !0, await Dt(e, n, t.target)) a = !0;
25964
25997
  else {
25965
25998
  o[t.attribute.uuid] = void 0, o[t.attribute.path] = void 0;
25966
25999
  for (let e of t.companions) o[e.name] = void 0;
@@ -25972,7 +26005,7 @@ async function yt(e) {
25972
26005
  }
25973
26006
  }
25974
26007
  }
25975
- async function bt(e, t, n) {
26008
+ async function Dt(e, t, n) {
25976
26009
  for (let r of n) {
25977
26010
  let [n] = await e.findByAttributes({
25978
26011
  tagName: r,
@@ -25984,80 +26017,80 @@ async function bt(e, t, n) {
25984
26017
  }
25985
26018
  //#endregion
25986
26019
  //#region src/v2019C1/extensions/clean-up/index.ts
25987
- var xt = { transaction: /* @__PURE__ */ l({
25988
- orphanUuidRefs: () => yt,
25989
- pruneEmptyContainers: () => vt,
26020
+ var R = { transaction: /* @__PURE__ */ l({
26021
+ orphanUuidRefs: () => Et,
26022
+ pruneEmptyContainers: () => Tt,
25990
26023
  resetLNode: () => re
25991
- }) }, St = ["id", "uuid"];
26024
+ }) }, Ot = ["id", "uuid"];
25992
26025
  //#endregion
25993
26026
  //#region src/v2019C1/extensions/signature/query/element-signature.ts
25994
- async function Ct(e, t) {
26027
+ async function z(e, t) {
25995
26028
  let n = {
25996
26029
  query: e,
25997
26030
  resolveReferences: t.resolveReferences ?? !1,
25998
- ignore: new Set(t.ignoreAttributes ?? St),
26031
+ ignore: new Set(t.ignoreAttributes ?? Ot),
25999
26032
  signatureCache: t.signatureCache ?? /* @__PURE__ */ new Map(),
26000
26033
  seen: /* @__PURE__ */ new Set()
26001
26034
  };
26002
- return Et(t.ref, n);
26035
+ return jt(t.ref, n);
26003
26036
  }
26004
- var wt = /* @__PURE__ */ new Set();
26005
- function Tt(e, t) {
26037
+ var kt = /* @__PURE__ */ new Set();
26038
+ function At(e, t) {
26006
26039
  return _[e]?.attributes?.details?.[t]?.default;
26007
26040
  }
26008
- async function Et(e, t) {
26041
+ async function jt(e, t) {
26009
26042
  let n = `${e.tagName}:${e.id}`, r = t.signatureCache.get(n);
26010
26043
  if (r !== void 0) return r;
26011
26044
  if (t.seen.has(n)) return `@cycle:${e.tagName}`;
26012
26045
  t.seen.add(n);
26013
- let i = await t.query.getTree(e), a = i ? await Dt(i, t) : "";
26046
+ let i = await t.query.getTree(e), a = i ? await Mt(i, t) : "";
26014
26047
  return t.seen.delete(n), t.signatureCache.set(n, a), a;
26015
26048
  }
26016
- async function Dt(e, t) {
26017
- let n = t.resolveReferences ? Mt(e.tagName) : wt, r = [];
26049
+ async function Mt(e, t) {
26050
+ let n = t.resolveReferences ? Lt(e.tagName) : kt, r = [];
26018
26051
  for (let i of e.attributes) {
26019
- if (t.ignore.has(i.name) || n.has(i.name) || i.value === Tt(e.tagName, i.name)) continue;
26052
+ if (t.ignore.has(i.name) || n.has(i.name) || i.value === At(e.tagName, i.name)) continue;
26020
26053
  let a = i.value;
26021
26054
  if (t.resolveReferences) {
26022
- let n = await Ot(e, i.name, i.value, t);
26055
+ let n = await Nt(e, i.name, i.value, t);
26023
26056
  n !== null && (a = `@sig:${n}`);
26024
26057
  }
26025
26058
  r.push(`${JSON.stringify(i.name)}:${JSON.stringify(a)}`);
26026
26059
  }
26027
26060
  r.sort();
26028
26061
  let i = [];
26029
- for (let n of e.tree ?? []) i.push(await Dt(n, t));
26062
+ for (let n of e.tree ?? []) i.push(await Mt(n, t));
26030
26063
  i.sort();
26031
26064
  let a = e.value?.trim(), o = a ? `,value:${JSON.stringify(a)}` : "";
26032
26065
  return `{tag:${JSON.stringify(e.tagName)},attrs:[${r.join(",")}]${o},children:[${i.join(",")}]}`;
26033
26066
  }
26034
- async function Ot(e, t, n, r) {
26035
- let i = kt(e, t);
26067
+ async function Nt(e, t, n, r) {
26068
+ let i = Pt(e, t);
26036
26069
  if (i) {
26037
- let e = await Nt(r.query, i.target, n);
26038
- return e ? Et(e, r) : `@missing:${n}`;
26070
+ let e = await Rt(r.query, i.target, n);
26071
+ return e ? jt(e, r) : `@missing:${n}`;
26039
26072
  }
26040
- let a = jt(e.tagName, t);
26073
+ let a = It(e.tagName, t);
26041
26074
  if (a) {
26042
- let e = await Pt(r.query, a.target, n);
26043
- return e ? Et(e, r) : `@missing:${n}`;
26075
+ let e = await zt(r.query, a.target, n);
26076
+ return e ? jt(e, r) : `@missing:${n}`;
26044
26077
  }
26045
26078
  return null;
26046
26079
  }
26047
- function kt(e, t) {
26048
- return N[e.tagName]?.find((n) => n.attribute === t && At(e, n));
26080
+ function Pt(e, t) {
26081
+ return N[e.tagName]?.find((n) => n.attribute === t && Ft(e, n));
26049
26082
  }
26050
- function At(e, t) {
26083
+ function Ft(e, t) {
26051
26084
  return t.when ? e.attributes.find((e) => e.name === t.when.attribute)?.value === t.when.equals : !0;
26052
26085
  }
26053
- function jt(e, t) {
26086
+ function It(e, t) {
26054
26087
  return D[e]?.find((e) => e.attribute.uuid === t);
26055
26088
  }
26056
- function Mt(e) {
26089
+ function Lt(e) {
26057
26090
  let t = D[e];
26058
- return t ? new Set(t.map((e) => e.attribute.path)) : wt;
26091
+ return t ? new Set(t.map((e) => e.attribute.path)) : kt;
26059
26092
  }
26060
- async function Nt(e, t, n) {
26093
+ async function Rt(e, t, n) {
26061
26094
  let [r] = await e.findByAttributes({
26062
26095
  tagName: t,
26063
26096
  attributes: { id: n }
@@ -26067,7 +26100,7 @@ async function Nt(e, t, n) {
26067
26100
  id: r.id
26068
26101
  } : null;
26069
26102
  }
26070
- async function Pt(e, t, n) {
26103
+ async function zt(e, t, n) {
26071
26104
  for (let r of t) {
26072
26105
  let [t] = await e.findByAttributes({
26073
26106
  tagName: r,
@@ -26082,13 +26115,13 @@ async function Pt(e, t, n) {
26082
26115
  }
26083
26116
  //#endregion
26084
26117
  //#region src/v2019C1/extensions/signature/query/index.ts
26085
- var Ft = /* @__PURE__ */ l({ elementSignature: () => Ct });
26118
+ var Bt = /* @__PURE__ */ l({ elementSignature: () => z });
26086
26119
  //#endregion
26087
26120
  //#region src/v2019C1/extensions/data-model/transaction/import-types.ts
26088
- async function It(e, t) {
26121
+ async function Vt(e, t) {
26089
26122
  let { sourceQuery: n, records: r, cloneMappings: i = [], forkPrefix: a = "", keepNameTypesFrom: o = "target" } = t;
26090
26123
  e.perf.start("scl::importTypes");
26091
- let s = Lt(await S(n, { records: r })), c = await e.ensureChild(await e.getRoot(), {
26124
+ let s = Ht(await S(n, { records: r })), c = await e.ensureChild(await e.getRoot(), {
26092
26125
  tagName: "DataTypeTemplates",
26093
26126
  attributes: {}
26094
26127
  });
@@ -26096,7 +26129,7 @@ async function It(e, t) {
26096
26129
  steps: s.length,
26097
26130
  label: "Indexing existing types…"
26098
26131
  }), e.perf.start("scl::importTypes::preExistingIndex");
26099
- let l = await zt(e);
26132
+ let l = await Wt(e);
26100
26133
  e.perf.stop("scl::importTypes::preExistingIndex");
26101
26134
  let u = /* @__PURE__ */ new Map(), d = [], f = [], p = {
26102
26135
  reused: 0,
@@ -26108,7 +26141,7 @@ async function It(e, t) {
26108
26141
  for (let t of s) {
26109
26142
  let r = await n.getAttribute(t, { name: "id" });
26110
26143
  if (e.progress.nextStep(r ? `Importing ${r}` : void 0), !r) continue;
26111
- let i = await Ct(n, {
26144
+ let i = await z(n, {
26112
26145
  ref: {
26113
26146
  tagName: t.tagName,
26114
26147
  id: t.id
@@ -26117,7 +26150,7 @@ async function It(e, t) {
26117
26150
  signatureCache: m
26118
26151
  }), s = l.get(i);
26119
26152
  if (s !== void 0) {
26120
- let n = o === "source" ? await Bt(e, {
26153
+ let n = o === "source" ? await Gt(e, {
26121
26154
  tagName: t.tagName,
26122
26155
  currentId: s,
26123
26156
  desiredId: r
@@ -26131,7 +26164,7 @@ async function It(e, t) {
26131
26164
  tagName: t.tagName,
26132
26165
  attributes: { id: r }
26133
26166
  }), _ = r, v = h;
26134
- g ? (_ = await qt(e, t.tagName, `${a}${r}_${Jt(i)}`), v = Vt(h, _), p.forked++) : p.preserved++;
26167
+ g ? (_ = await Qt(e, t.tagName, `${a}${r}_${$t(i)}`), v = Kt(h, _), p.forked++) : p.preserved++;
26135
26168
  let y = await e.deepClone(c, v);
26136
26169
  u.set(r, _), y?.record && (d.push(B(y.record.tagName, y.record.id)), g && f.push({
26137
26170
  oldId: r,
@@ -26142,16 +26175,16 @@ async function It(e, t) {
26142
26175
  }
26143
26176
  e.perf.stop("scl::importTypes::sourceLoop"), e.perf.start("scl::importTypes::remap");
26144
26177
  let h = [];
26145
- for (let t of i) t.target.tagName === "LNode" && await te(e, t.target) || h.push(t.target);
26178
+ for (let t of i) t.target.tagName === "LNode" && await w(e, t.target) || h.push(t.target);
26146
26179
  for (let t of d) {
26147
26180
  e.progress.nextStep("Repointing references…");
26148
26181
  let n = await e.getTree(t);
26149
- n && Ht(n, h);
26182
+ n && qt(n, h);
26150
26183
  }
26151
- return await L(e, {
26184
+ return await bt(e, {
26152
26185
  records: h,
26153
26186
  idRemap: u
26154
- }), e.perf.stop("scl::importTypes::remap"), f.length > 0 && (e.progress.nextStep("Reclaiming ids…"), e.perf.start("scl::importTypes::reclaim"), await Ut(e, {
26187
+ }), e.perf.stop("scl::importTypes::remap"), f.length > 0 && (e.progress.nextStep("Reclaiming ids…"), e.perf.start("scl::importTypes::reclaim"), await Jt(e, {
26155
26188
  collisions: f,
26156
26189
  idRemap: u,
26157
26190
  referrerRecords: h,
@@ -26161,7 +26194,7 @@ async function It(e, t) {
26161
26194
  stats: p
26162
26195
  };
26163
26196
  }
26164
- function Lt(e) {
26197
+ function Ht(e) {
26165
26198
  return [
26166
26199
  ...e.enumTypes,
26167
26200
  ...e.daTypes,
@@ -26169,20 +26202,20 @@ function Lt(e) {
26169
26202
  ...e.lnodeTypes
26170
26203
  ];
26171
26204
  }
26172
- var Rt = [
26205
+ var Ut = [
26173
26206
  "EnumType",
26174
26207
  "DAType",
26175
26208
  "DOType",
26176
26209
  "LNodeType"
26177
26210
  ];
26178
- async function zt(e) {
26211
+ async function Wt(e) {
26179
26212
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
26180
- for (let r of Rt) {
26213
+ for (let r of Ut) {
26181
26214
  let i = await e.getRecordsByTagName(r);
26182
26215
  for (let a of i) {
26183
26216
  let i = a.attributes.find((e) => e.name === "id")?.value;
26184
26217
  if (!i) continue;
26185
- let o = await Ct(e, {
26218
+ let o = await z(e, {
26186
26219
  ref: {
26187
26220
  tagName: r,
26188
26221
  id: a.id
@@ -26195,7 +26228,7 @@ async function zt(e) {
26195
26228
  }
26196
26229
  return t;
26197
26230
  }
26198
- async function Bt(e, t) {
26231
+ async function Gt(e, t) {
26199
26232
  let { tagName: n, currentId: r, desiredId: i } = t;
26200
26233
  if (r === i) return r;
26201
26234
  let [a] = await e.findByAttributes({
@@ -26208,13 +26241,13 @@ async function Bt(e, t) {
26208
26241
  attributes: { id: i }
26209
26242
  });
26210
26243
  if (o && o.id !== a.id) return r;
26211
- let s = B(a.tagName, a.id), c = await I(e, { target: s });
26212
- return await e.update(s, { attributes: { id: i } }), await L(e, {
26244
+ let s = B(a.tagName, a.id), c = await F(e, { target: s });
26245
+ return await e.update(s, { attributes: { id: i } }), await bt(e, {
26213
26246
  records: c.map((e) => B(e.ref.tagName, e.ref.id)),
26214
26247
  idRemap: new Map([[r, i]])
26215
26248
  }), i;
26216
26249
  }
26217
- function Vt(e, t) {
26250
+ function Kt(e, t) {
26218
26251
  let n = structuredClone(e), r = n.attributes, i = r.find((e) => e.name === "id");
26219
26252
  return i ? i.value = t : r.push({
26220
26253
  name: "id",
@@ -26227,13 +26260,13 @@ function B(e, t) {
26227
26260
  id: t
26228
26261
  };
26229
26262
  }
26230
- function Ht(e, t) {
26263
+ function qt(e, t) {
26231
26264
  t.push(B(e.tagName, e.id));
26232
- for (let n of e.tree ?? []) Ht(n, t);
26265
+ for (let n of e.tree ?? []) qt(n, t);
26233
26266
  }
26234
26267
  var V = (e) => `${e.tagName}#${e.id}`;
26235
- async function Ut(e, t) {
26236
- let { collisions: n, idRemap: r, referrerRecords: i, stats: a } = t, o = await Wt(e, n), s = /* @__PURE__ */ new Map(), c = [];
26268
+ async function Jt(e, t) {
26269
+ let { collisions: n, idRemap: r, referrerRecords: i, stats: a } = t, o = await Yt(e, n), s = /* @__PURE__ */ new Map(), c = [];
26237
26270
  for (let t of n) if (o.has(t.oldId)) {
26238
26271
  await e.update(t.forkRef, { attributes: { id: t.oldId } }), s.set(t.forkedId, t.oldId), c.push(t.forkRef), a.reclaimed++;
26239
26272
  for (let [e, n] of r) n === t.forkedId && r.set(e, t.oldId);
@@ -26242,21 +26275,21 @@ async function Ut(e, t) {
26242
26275
  let l = [...i];
26243
26276
  for (let t of c) {
26244
26277
  let n = await e.getTree(t);
26245
- n && Ht(n, l);
26278
+ n && qt(n, l);
26246
26279
  }
26247
- await L(e, {
26280
+ await bt(e, {
26248
26281
  records: l,
26249
26282
  idRemap: s
26250
26283
  });
26251
26284
  }
26252
- async function Wt(e, t) {
26285
+ async function Yt(e, t) {
26253
26286
  let n = /* @__PURE__ */ new Set(), r = new Map(t.map((e) => [V(e.oldRef), e.oldId])), i = t.map((e) => e.oldRef), a = new Set(i.map(V)), o = /* @__PURE__ */ new Set(), s = !0;
26254
26287
  for (; s;) {
26255
26288
  s = !1;
26256
26289
  for (let t of i) {
26257
26290
  let c = V(t);
26258
- if (o.has(c) || (await I(e, { target: t })).length > 0) continue;
26259
- let l = await e.getTree(t), u = l ? await Gt(e, l) : [];
26291
+ if (o.has(c) || (await F(e, { target: t })).length > 0) continue;
26292
+ let l = await e.getTree(t), u = l ? await Xt(e, l) : [];
26260
26293
  await e.delete(t), o.add(c), s = !0;
26261
26294
  let d = r.get(c);
26262
26295
  d !== void 0 && n.add(d);
@@ -26268,12 +26301,12 @@ async function Wt(e, t) {
26268
26301
  }
26269
26302
  return n;
26270
26303
  }
26271
- async function Gt(e, t) {
26304
+ async function Xt(e, t) {
26272
26305
  let n = [], r = /* @__PURE__ */ new Set();
26273
26306
  async function i(t) {
26274
26307
  let a = N[t.tagName];
26275
26308
  for (let i of a ?? []) {
26276
- if (!Kt(t, i)) continue;
26309
+ if (!Zt(t, i)) continue;
26277
26310
  let a = t.attributes.find((e) => e.name === i.attribute)?.value;
26278
26311
  if (!a) continue;
26279
26312
  let [o] = await e.findByAttributes({
@@ -26288,10 +26321,10 @@ async function Gt(e, t) {
26288
26321
  }
26289
26322
  return await i(t), n;
26290
26323
  }
26291
- function Kt(e, t) {
26324
+ function Zt(e, t) {
26292
26325
  return t.when ? e.attributes.find((e) => e.name === t.when.attribute)?.value === t.when.equals : !0;
26293
26326
  }
26294
- async function qt(e, t, n) {
26327
+ async function Qt(e, t, n) {
26295
26328
  let r = n, i = 2;
26296
26329
  for (; (await e.findByAttributes({
26297
26330
  tagName: t,
@@ -26299,20 +26332,20 @@ async function qt(e, t, n) {
26299
26332
  })).length > 0;) r = `${n}_${i}`, i += 1;
26300
26333
  return r;
26301
26334
  }
26302
- function Jt(e) {
26335
+ function $t(e) {
26303
26336
  let t = 2166136261;
26304
26337
  for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
26305
26338
  return (t >>> 0).toString(16).padStart(8, "0");
26306
26339
  }
26307
26340
  //#endregion
26308
26341
  //#region src/v2019C1/extensions/data-model/index.ts
26309
- var Yt = {
26342
+ var en = {
26310
26343
  query: ne,
26311
- transaction: /* @__PURE__ */ l({ importTypes: () => It })
26344
+ transaction: /* @__PURE__ */ l({ importTypes: () => Vt })
26312
26345
  };
26313
26346
  //#endregion
26314
26347
  //#region src/v2019C1/extensions/history/query/get-sorted-hitem.ts
26315
- async function Xt(e) {
26348
+ async function tn(e) {
26316
26349
  let t = await e.getRecord({ tagName: "History" });
26317
26350
  if (!t) return [];
26318
26351
  let { Hitem: n = [] } = await e.findDescendants(t, { collect: "Hitem" });
@@ -26326,18 +26359,18 @@ async function Xt(e) {
26326
26359
  }
26327
26360
  //#endregion
26328
26361
  //#region src/v2019C1/extensions/history/query/get-latest-hitem.ts
26329
- async function Zt(e) {
26330
- return (await Xt(e)).at(-1);
26362
+ async function nn(e) {
26363
+ return (await tn(e)).at(-1);
26331
26364
  }
26332
26365
  //#endregion
26333
26366
  //#region src/v2019C1/extensions/history/query/index.ts
26334
- var Qt = /* @__PURE__ */ l({
26335
- getLatestHitem: () => Zt,
26336
- getSortedHitems: () => Xt
26367
+ var rn = /* @__PURE__ */ l({
26368
+ getLatestHitem: () => nn,
26369
+ getSortedHitems: () => tn
26337
26370
  });
26338
26371
  //#endregion
26339
26372
  //#region src/v2019C1/extensions/history/transaction/add-entry.ts
26340
- async function $t(e, t) {
26373
+ async function an(e, t) {
26341
26374
  let { filename: n, header: r, item: i } = t, { id: a, fileType: o, nameStructure: s, version: c, tool: l } = r, { who: u, what: d, why: f } = i, p = await e.getRoot(), m = await e.getRecord({ tagName: "Header" }) ?? await e.addChild(p, {
26342
26375
  tagName: "Header",
26343
26376
  attributes: {
@@ -26352,18 +26385,18 @@ async function $t(e, t) {
26352
26385
  }), h = await e.getRecord({ tagName: "History" }) ?? await e.addChild(m, {
26353
26386
  tagName: "History",
26354
26387
  attributes: {}
26355
- }), g = await Zt(e), _ = g?.attributes.find((e) => e.name === "version")?.value, v = g?.attributes.find((e) => e.name === "revision")?.value, y = c === "keep" ? _ ?? "0" : _ ? String(Number(_) + 1) : "0", b = v ? String(Number(v) + 1) : "1";
26388
+ }), g = await nn(e), _ = g?.attributes.find((e) => e.name === "version")?.value, v = g?.attributes.find((e) => e.name === "revision")?.value, y = c === "keep" ? _ ?? "0" : _ ? String(Number(_) + 1) : "0", b = v ? String(Number(v) + 1) : "1";
26356
26389
  await e.update(m, { attributes: {
26357
26390
  version: y,
26358
26391
  revision: b
26359
26392
  } });
26360
- let x = /* @__PURE__ */ new Date(), S = x.toString().split(" "), C = x.toLocaleString("en", { timeZoneName: "short" }).split(" ").pop(), w = `${S[0]} ${S[1]} ${S[2]} ${S[4]} ${C} ${S[3]}`;
26393
+ let x = /* @__PURE__ */ new Date(), S = x.toString().split(" "), C = x.toLocaleString("en", { timeZoneName: "short" }).split(" ").pop(), ee = `${S[0]} ${S[1]} ${S[2]} ${S[4]} ${C} ${S[3]}`;
26361
26394
  await e.addChild(h, {
26362
26395
  tagName: "Hitem",
26363
26396
  attributes: {
26364
26397
  version: y,
26365
26398
  revision: b,
26366
- when: w,
26399
+ when: ee,
26367
26400
  who: u,
26368
26401
  what: d,
26369
26402
  why: f
@@ -26375,92 +26408,74 @@ async function $t(e, t) {
26375
26408
  }
26376
26409
  //#endregion
26377
26410
  //#region src/v2019C1/extensions/history/index.ts
26378
- var en = {
26379
- query: Qt,
26380
- transaction: /* @__PURE__ */ l({ addEntry: () => $t })
26411
+ var H = {
26412
+ query: rn,
26413
+ transaction: /* @__PURE__ */ l({ addEntry: () => an })
26381
26414
  };
26382
26415
  //#endregion
26383
26416
  //#region src/v2019C1/extensions/identity/transaction/write-identity.ts
26384
- async function H(e, t) {
26417
+ async function U(e, t) {
26385
26418
  let { mappings: n, mode: r } = t;
26386
26419
  if (r !== "keep") for (let t of n) {
26387
- let n = r === "strip" ? tn() : nn(t);
26420
+ let n = r === "strip" ? on() : sn(t);
26388
26421
  if (Object.keys(n).length === 0) continue;
26389
26422
  let i = await e.getRecord(t.target);
26390
26423
  i && await e.update(i, { attributes: n });
26391
26424
  }
26392
26425
  }
26393
- function tn() {
26426
+ function on() {
26394
26427
  return {
26395
26428
  templateUuid: void 0,
26396
26429
  originUuid: void 0
26397
26430
  };
26398
26431
  }
26399
- function nn(e) {
26400
- let t = an(e.source.attributes, "uuid"), n = an(e.source.attributes, "templateUuid"), r = an(e.source.attributes, "originUuid"), i = {};
26432
+ function sn(e) {
26433
+ let t = ln(e.source.attributes, "uuid"), n = ln(e.source.attributes, "templateUuid"), r = ln(e.source.attributes, "originUuid"), i = {};
26401
26434
  t && (i.templateUuid = t);
26402
- let a = rn(e.target.tagName);
26435
+ let a = cn(e.target.tagName);
26403
26436
  return n && !r && a && (i.originUuid = n), i;
26404
26437
  }
26405
- function rn(e) {
26438
+ function cn(e) {
26406
26439
  let t = x.attributes[e];
26407
26440
  return t ? "originUuid" in t : !1;
26408
26441
  }
26409
- function an(e, t) {
26442
+ function ln(e, t) {
26410
26443
  return e.find((e) => e.name === t)?.value;
26411
26444
  }
26412
26445
  //#endregion
26413
26446
  //#region src/v2019C1/extensions/identity/transaction/restore-cloned-uuids.ts
26414
- async function on(e, t) {
26415
- let { mappings: n } = t, r = /* @__PURE__ */ new Map(), i = [];
26447
+ async function W(e, t) {
26448
+ let { mappings: n } = t;
26416
26449
  for (let t of n) {
26417
- let n = sn(t.source.attributes, "uuid");
26450
+ let n = un(t.source.attributes, "uuid");
26418
26451
  if (!n) continue;
26419
- let a = await e.getRecord(t.target), o = a ? a.attributes.find((e) => e.name === "uuid")?.value : void 0;
26420
- !o || o === n || (r.set(o, n), i.push({
26421
- ref: t.target,
26422
- sourceUuid: n
26423
- }));
26424
- }
26425
- if (r.size !== 0) {
26426
- for (let { ref: t, sourceUuid: n } of i) await e.update(t, { attributes: { uuid: n } });
26427
- for (let t of n) {
26428
- let n = D[t.target.tagName];
26429
- if (!n) continue;
26430
- let i = await e.getRecord(t.target);
26431
- if (!i) continue;
26432
- let a = {};
26433
- for (let e of n) {
26434
- let t = i.attributes.find((t) => t.name === e.attribute.uuid)?.value, n = t ? r.get(t) : void 0;
26435
- n && (a[e.attribute.uuid] = n);
26436
- }
26437
- Object.keys(a).length > 0 && await e.update(t.target, { attributes: a });
26438
- }
26452
+ let r = (await e.getRecord(t.target))?.attributes.find((e) => e.name === "uuid")?.value;
26453
+ !r || r === n || await e.update(t.target, { attributes: { uuid: n } });
26439
26454
  }
26440
26455
  }
26441
- function sn(e, t) {
26456
+ function un(e, t) {
26442
26457
  return e.find((e) => e.name === t)?.value;
26443
26458
  }
26444
26459
  //#endregion
26445
26460
  //#region src/v2019C1/extensions/identity/index.ts
26446
- var cn = { transaction: /* @__PURE__ */ l({
26447
- restoreClonedUuids: () => on,
26448
- writeIdentity: () => H
26461
+ var dn = { transaction: /* @__PURE__ */ l({
26462
+ restoreClonedUuids: () => W,
26463
+ writeIdentity: () => U
26449
26464
  }) };
26450
26465
  //#endregion
26451
26466
  //#region src/v2019C1/extensions/lifecycle/engine/group.ts
26452
- function ln(e, t) {
26467
+ function fn(e, t) {
26453
26468
  let n = [];
26454
- return un({
26469
+ return pn({
26455
26470
  node: e,
26456
26471
  scopePrefix: t,
26457
26472
  out: n
26458
26473
  }), n;
26459
26474
  }
26460
- function un(e) {
26475
+ function pn(e) {
26461
26476
  let { node: t, scopePrefix: n, out: r } = e;
26462
26477
  if (t.change === "unchanged") {
26463
- for (let e of t.children) un({
26478
+ for (let e of t.children) pn({
26464
26479
  node: e,
26465
26480
  scopePrefix: n,
26466
26481
  out: r
@@ -26468,11 +26483,11 @@ function un(e) {
26468
26483
  return;
26469
26484
  }
26470
26485
  let i = [];
26471
- dn({
26486
+ mn({
26472
26487
  node: t,
26473
26488
  out: i
26474
26489
  }), r.push({
26475
- id: fn(t, n),
26490
+ id: hn(t, n),
26476
26491
  change: t.change,
26477
26492
  title: `${t.change} ${t.tagName}`,
26478
26493
  primary: t,
@@ -26481,32 +26496,32 @@ function un(e) {
26481
26496
  suggestedAction: t.change === "target-only" ? "skip" : "accept"
26482
26497
  });
26483
26498
  }
26484
- function dn(e) {
26499
+ function mn(e) {
26485
26500
  let { node: t, out: n } = e;
26486
- for (let e of t.children) e.change !== "unchanged" && n.push(e), dn({
26501
+ for (let e of t.children) e.change !== "unchanged" && n.push(e), mn({
26487
26502
  node: e,
26488
26503
  out: n
26489
26504
  });
26490
26505
  }
26491
- function fn(e, t) {
26506
+ function hn(e, t) {
26492
26507
  let n = e.sourceRef ?? e.instanceRef, r = n ? `${n.tagName}:${n.id}` : e.tagName;
26493
26508
  return t ? `${t}::${r}` : r;
26494
26509
  }
26495
26510
  //#endregion
26496
26511
  //#region src/v2019C1/extensions/lifecycle/engine/visible-attributes.ts
26497
- var pn = new Set([
26512
+ var gn = new Set([
26498
26513
  "uuid",
26499
26514
  "templateUuid",
26500
26515
  "originUuid"
26501
- ]), mn = new Set(Object.values(D).flatMap((e) => e.flatMap((e) => [e.attribute.path, e.attribute.uuid])));
26502
- function hn(e) {
26516
+ ]), _n = new Set(Object.values(D).flatMap((e) => e.flatMap((e) => [e.attribute.path, e.attribute.uuid])));
26517
+ function vn(e) {
26503
26518
  let t = {};
26504
- for (let [n, r] of Object.entries(e)) pn.has(n) || n === "name" || mn.has(n) || (t[n] = r);
26519
+ for (let [n, r] of Object.entries(e)) gn.has(n) || n === "name" || _n.has(n) || (t[n] = r);
26505
26520
  return t;
26506
26521
  }
26507
26522
  //#endregion
26508
26523
  //#region src/v2019C1/extensions/lifecycle/engine/diff.ts
26509
- var gn = new Set([
26524
+ var yn = new Set([
26510
26525
  "LNodeSpecNaming",
26511
26526
  "FunctionSclRef",
26512
26527
  "ApplicationSclRef",
@@ -26514,30 +26529,30 @@ var gn = new Set([
26514
26529
  "FunctionRole",
26515
26530
  "FunctionRoleContent"
26516
26531
  ]);
26517
- async function _n(e) {
26532
+ async function bn(e) {
26518
26533
  let { sourceQuery: t, targetQuery: n, sourceRootRef: r, instanceRootRef: i, keepLeftoverRefs: a } = e, o = e.leftoverRefPolicy, s = e.refsAlwaysAdded ?? !1, c = e.matchKey ?? "templateUuid", l = await t.any.getTree(r);
26519
26534
  if (!l) throw Error("diff: source subtree not found");
26520
26535
  let u = i ? await n.any.getTree(i) : void 0;
26521
26536
  if (!u) {
26522
- let e = wn(l);
26537
+ let e = Dn(l);
26523
26538
  return {
26524
26539
  root: e,
26525
- groups: ln(e),
26526
- summary: Fn(e)
26540
+ groups: fn(e),
26541
+ summary: Rn(e)
26527
26542
  };
26528
26543
  }
26529
26544
  let d = /* @__PURE__ */ new Map();
26530
- await Mn(n, {
26545
+ await Fn(n, {
26531
26546
  node: u,
26532
26547
  index: d,
26533
26548
  matchKey: c
26534
26549
  });
26535
26550
  let f = /* @__PURE__ */ new Set();
26536
- await Nn(t, {
26551
+ await In(t, {
26537
26552
  node: l,
26538
26553
  out: f
26539
26554
  });
26540
- let p = await vn(t, {
26555
+ let p = await xn(t, {
26541
26556
  targetQuery: n,
26542
26557
  sourceNode: l,
26543
26558
  instanceNode: u,
@@ -26547,21 +26562,21 @@ async function _n(e) {
26547
26562
  leftoverRefPolicy: o,
26548
26563
  refsAlwaysAdded: s,
26549
26564
  matchKey: c
26550
- }), m = Fn(p);
26565
+ }), m = Rn(p);
26551
26566
  return {
26552
26567
  root: p,
26553
- groups: ln(p, u.id),
26568
+ groups: fn(p, u.id),
26554
26569
  summary: m
26555
26570
  };
26556
26571
  }
26557
- async function vn(e, t) {
26558
- let { targetQuery: n, sourceNode: r, instanceNode: i, index: o, sourceUuids: s, keepLeftoverRefs: c, matchKey: l } = t, u = t.leftoverRefPolicy, d = t.refsAlwaysAdded ?? !1, f = await jn(e, {
26572
+ async function xn(e, t) {
26573
+ let { targetQuery: n, sourceNode: r, instanceNode: i, index: o, sourceUuids: s, keepLeftoverRefs: c, matchKey: l } = t, u = t.leftoverRefPolicy, d = t.refsAlwaysAdded ?? !1, f = await Pn(e, {
26559
26574
  targetQuery: n,
26560
26575
  sourceNode: r,
26561
26576
  instanceNode: i
26562
26577
  }), p = [], m = /* @__PURE__ */ new Set();
26563
26578
  for (let t of r.tree) {
26564
- let r = await yn(e, {
26579
+ let r = await Sn(e, {
26565
26580
  targetQuery: n,
26566
26581
  sourceChild: t,
26567
26582
  instanceNode: i,
@@ -26569,7 +26584,7 @@ async function vn(e, t) {
26569
26584
  matchedInstanceIds: m,
26570
26585
  refsAlwaysAdded: d
26571
26586
  });
26572
- r ? (m.add(r.id), p.push(await vn(e, {
26587
+ r ? (m.add(r.id), p.push(await xn(e, {
26573
26588
  targetQuery: n,
26574
26589
  sourceNode: t,
26575
26590
  instanceNode: r,
@@ -26579,22 +26594,22 @@ async function vn(e, t) {
26579
26594
  leftoverRefPolicy: u,
26580
26595
  refsAlwaysAdded: d,
26581
26596
  matchKey: l
26582
- }))) : p.push(wn(t));
26597
+ }))) : p.push(Dn(t));
26583
26598
  }
26584
- let h = await Dn(e, r);
26599
+ let h = await An(e, r);
26585
26600
  for (let e of i.tree) {
26586
26601
  if (m.has(e.id)) continue;
26587
26602
  let t = await n.any.getAttribute(e, { name: l });
26588
26603
  if (t) {
26589
- s.has(t) || p.push(Tn(e));
26604
+ s.has(t) || p.push(On(e));
26590
26605
  continue;
26591
26606
  }
26592
- if (A.has(e.tagName) && !O.has(e.tagName)) {
26593
- let t = c || await On(n, e, h), r = t && u ? await u(e) === "removed" : !1;
26594
- t && !r ? p.push(En(e)) : p.push(Tn(e));
26607
+ if (k.has(e.tagName) && !O.has(e.tagName)) {
26608
+ let t = c || await jn(n, e, h), r = t && u ? await u(e) === "removed" : !1;
26609
+ t && !r ? p.push(kn(e)) : p.push(On(e));
26595
26610
  continue;
26596
26611
  }
26597
- An(e, p);
26612
+ Nn(e, p);
26598
26613
  }
26599
26614
  return {
26600
26615
  change: f.length > 0 ? "modified" : "unchanged",
@@ -26605,40 +26620,40 @@ async function vn(e, t) {
26605
26620
  children: p
26606
26621
  };
26607
26622
  }
26608
- async function yn(e, t) {
26623
+ async function Sn(e, t) {
26609
26624
  let { targetQuery: n, sourceChild: r, instanceNode: i, index: a, matchedInstanceIds: o } = t, s = await e.any.getAttribute(r, { name: "uuid" });
26610
26625
  if (s) {
26611
26626
  let e = a.get(s);
26612
26627
  return e && e.tagName === r.tagName ? e : void 0;
26613
26628
  }
26614
- if (t.refsAlwaysAdded && A.has(r.tagName)) return;
26629
+ if (t.refsAlwaysAdded && k.has(r.tagName)) return;
26615
26630
  let c = i.tree.filter((e) => e.tagName === r.tagName && !o.has(e.id));
26616
26631
  if (c.length !== 0) {
26617
- if (A.has(r.tagName)) {
26618
- let t = await bn(e, r, { mapToTemplate: !1 });
26632
+ if (k.has(r.tagName)) {
26633
+ let t = await Cn(e, r, { mapToTemplate: !1 });
26619
26634
  if (t === void 0) return c[0];
26620
- for (let e of c) if (await bn(n, e, { mapToTemplate: !0 }) === t) return e;
26621
- let i = await Sn(e, r);
26635
+ for (let e of c) if (await Cn(n, e, { mapToTemplate: !0 }) === t) return e;
26636
+ let i = await Tn(e, r);
26622
26637
  if (i === void 0) return;
26623
- for (let e of c) if (await Sn(n, e) === i) return e;
26638
+ for (let e of c) if (await Tn(n, e) === i) return e;
26624
26639
  return;
26625
26640
  }
26626
26641
  return c[0];
26627
26642
  }
26628
26643
  }
26629
- async function bn(e, t, n) {
26644
+ async function Cn(e, t, n) {
26630
26645
  let r = D[t.tagName];
26631
26646
  if (!r) return;
26632
26647
  let i = [];
26633
26648
  for (let a of r) {
26634
26649
  let r = await e.any.getAttribute(t, { name: a.attribute.uuid });
26635
26650
  if (!r) continue;
26636
- let o = n.mapToTemplate ? await xn(e, r, a.target) : r;
26651
+ let o = n.mapToTemplate ? await wn(e, r, a.target) : r;
26637
26652
  i.push(`${a.attribute.uuid}=${o}`);
26638
26653
  }
26639
26654
  return i.length > 0 ? i.sort().join("|") : void 0;
26640
26655
  }
26641
- async function xn(e, t, n) {
26656
+ async function wn(e, t, n) {
26642
26657
  for (let r of n) {
26643
26658
  let n = (await e.findByAttributes({
26644
26659
  tagName: r,
@@ -26648,19 +26663,19 @@ async function xn(e, t, n) {
26648
26663
  }
26649
26664
  return t;
26650
26665
  }
26651
- async function Sn(e, t) {
26666
+ async function Tn(e, t) {
26652
26667
  let n = D[t.tagName];
26653
26668
  if (!n) return;
26654
26669
  let r = [];
26655
26670
  for (let i of n) {
26656
26671
  let n = await e.any.getAttribute(t, { name: i.attribute.uuid });
26657
26672
  if (!n) continue;
26658
- let a = await Cn(e, n, i.target);
26673
+ let a = await En(e, n, i.target);
26659
26674
  a !== void 0 && r.push(`${i.attribute.uuid}=${a}`);
26660
26675
  }
26661
26676
  return r.length > 0 ? r.sort().join("|") : void 0;
26662
26677
  }
26663
- async function Cn(e, t, n) {
26678
+ async function En(e, t, n) {
26664
26679
  for (let r of n) {
26665
26680
  let n = (await e.findByAttributes({
26666
26681
  tagName: r,
@@ -26669,8 +26684,8 @@ async function Cn(e, t, n) {
26669
26684
  if (n) return await e.any.getAttribute(n, { name: "name" }) || void 0;
26670
26685
  }
26671
26686
  }
26672
- function wn(e) {
26673
- let t = e.tree.map((e) => wn(e));
26687
+ function Dn(e) {
26688
+ let t = e.tree.map((e) => Dn(e));
26674
26689
  return {
26675
26690
  change: "added",
26676
26691
  tagName: e.tagName,
@@ -26678,8 +26693,8 @@ function wn(e) {
26678
26693
  children: t
26679
26694
  };
26680
26695
  }
26681
- function Tn(e) {
26682
- let t = e.tree.map((e) => Tn(e));
26696
+ function On(e) {
26697
+ let t = e.tree.map((e) => On(e));
26683
26698
  return {
26684
26699
  change: "removed",
26685
26700
  tagName: e.tagName,
@@ -26687,7 +26702,7 @@ function Tn(e) {
26687
26702
  children: t
26688
26703
  };
26689
26704
  }
26690
- function En(e) {
26705
+ function kn(e) {
26691
26706
  return {
26692
26707
  change: "unchanged",
26693
26708
  tagName: e.tagName,
@@ -26695,26 +26710,26 @@ function En(e) {
26695
26710
  children: []
26696
26711
  };
26697
26712
  }
26698
- async function Dn(e, t) {
26713
+ async function An(e, t) {
26699
26714
  let n = /* @__PURE__ */ new Set();
26700
26715
  for (let r of t.tree) {
26701
- if (!A.has(r.tagName)) continue;
26702
- let t = await bn(e, r, { mapToTemplate: !1 });
26716
+ if (!k.has(r.tagName)) continue;
26717
+ let t = await Cn(e, r, { mapToTemplate: !1 });
26703
26718
  t && n.add(t);
26704
- let i = await Sn(e, r);
26719
+ let i = await Tn(e, r);
26705
26720
  i && n.add(i);
26706
26721
  }
26707
26722
  return n;
26708
26723
  }
26709
- async function On(e, t, n) {
26724
+ async function jn(e, t, n) {
26710
26725
  if (n.size === 0) return !1;
26711
- let r = await bn(e, t, { mapToTemplate: !0 });
26726
+ let r = await Cn(e, t, { mapToTemplate: !0 });
26712
26727
  if (r && n.has(r)) return !0;
26713
- let i = await Sn(e, t);
26728
+ let i = await Tn(e, t);
26714
26729
  return !!i && n.has(i);
26715
26730
  }
26716
- function kn(e) {
26717
- let t = e.tree.map((e) => kn(e));
26731
+ function Mn(e) {
26732
+ let t = e.tree.map((e) => Mn(e));
26718
26733
  return {
26719
26734
  change: "target-only",
26720
26735
  tagName: e.tagName,
@@ -26722,17 +26737,17 @@ function kn(e) {
26722
26737
  children: t
26723
26738
  };
26724
26739
  }
26725
- function An(e, t) {
26726
- if (!gn.has(e.tagName)) {
26740
+ function Nn(e, t) {
26741
+ if (!yn.has(e.tagName)) {
26727
26742
  if (e.tagName === "Private") {
26728
- for (let n of e.tree) An(n, t);
26743
+ for (let n of e.tree) Nn(n, t);
26729
26744
  return;
26730
26745
  }
26731
- t.push(kn(e));
26746
+ t.push(Mn(e));
26732
26747
  }
26733
26748
  }
26734
- async function jn(e, t) {
26735
- let { targetQuery: n, sourceNode: r, instanceNode: i } = t, a = hn(await e.any.getAttributes(r)), o = hn(await n.any.getAttributes(i)), s = [];
26749
+ async function Pn(e, t) {
26750
+ let { targetQuery: n, sourceNode: r, instanceNode: i } = t, a = vn(await e.any.getAttributes(r)), o = vn(await n.any.getAttributes(i)), s = [];
26736
26751
  for (let e of new Set([...Object.keys(a), ...Object.keys(o)])) {
26737
26752
  let t = o[e], n = a[e];
26738
26753
  t !== n && s.push({
@@ -26743,26 +26758,26 @@ async function jn(e, t) {
26743
26758
  }
26744
26759
  return s;
26745
26760
  }
26746
- async function Mn(e, t) {
26761
+ async function Fn(e, t) {
26747
26762
  let { node: n, index: r, matchKey: i } = t, a = await e.any.getAttribute(n, { name: i });
26748
26763
  a && r.set(a, n);
26749
- for (let t of n.tree) await Mn(e, {
26764
+ for (let t of n.tree) await Fn(e, {
26750
26765
  node: t,
26751
26766
  index: r,
26752
26767
  matchKey: i
26753
26768
  });
26754
26769
  }
26755
- async function Nn(e, t) {
26770
+ async function In(e, t) {
26756
26771
  let { node: n, out: r } = t, i = await e.any.getAttribute(n, { name: "uuid" });
26757
26772
  i && r.add(i);
26758
- for (let t of n.tree) await Nn(e, {
26773
+ for (let t of n.tree) await In(e, {
26759
26774
  node: t,
26760
26775
  out: r
26761
26776
  });
26762
26777
  }
26763
- function Pn(e) {
26778
+ function Ln(e) {
26764
26779
  let t = e.reduce((e, t) => {
26765
- let n = Fn(t.tree);
26780
+ let n = Rn(t.tree);
26766
26781
  return {
26767
26782
  added: e.added + n.added,
26768
26783
  removed: e.removed + n.removed,
@@ -26779,10 +26794,10 @@ function Pn(e) {
26779
26794
  summary: t
26780
26795
  };
26781
26796
  }
26782
- function U(e) {
26797
+ function G(e) {
26783
26798
  return e.instances.flatMap((e) => e.groups);
26784
26799
  }
26785
- function Fn(e) {
26800
+ function Rn(e) {
26786
26801
  let t = {
26787
26802
  added: 0,
26788
26803
  removed: 0,
@@ -26795,58 +26810,58 @@ function Fn(e) {
26795
26810
  }
26796
26811
  //#endregion
26797
26812
  //#region src/v2019C1/extensions/lifecycle/constraints/classify-attribute.constants.ts
26798
- var In = new Set([
26813
+ var zn = new Set([
26799
26814
  "uuid",
26800
26815
  "templateUuid",
26801
26816
  "originUuid"
26802
- ]), Ln = ["rename", "free"], Rn = /* @__PURE__ */ new Map();
26803
- function zn(e) {
26804
- let t = Rn.get(e);
26817
+ ]), Bn = ["rename", "free"], Vn = /* @__PURE__ */ new Map();
26818
+ function Hn(e) {
26819
+ let t = Vn.get(e);
26805
26820
  if (t) return t;
26806
26821
  let n = _[e]?.attributes?.identityFields ?? [], r = new Set(n);
26807
- return Rn.set(e, r), r;
26822
+ return Vn.set(e, r), r;
26808
26823
  }
26809
26824
  //#endregion
26810
26825
  //#region src/v2019C1/extensions/lifecycle/constraints/classify-attribute.ts
26811
- function W(e, t) {
26812
- return In.has(t) ? "identity" : Hn(e).has(t) || Un(e).has(t) ? "reference" : t === "name" ? "rename" : se.has(t) || zn(e).has(t) ? "identity" : "free";
26826
+ function Un(e, t) {
26827
+ return zn.has(t) ? "identity" : Kn(e).has(t) || qn(e).has(t) ? "reference" : t === "name" ? "rename" : se.has(t) || Hn(e).has(t) ? "identity" : "free";
26813
26828
  }
26814
- function Bn(e) {
26815
- return Ln.includes(e);
26829
+ function Wn(e) {
26830
+ return Bn.includes(e);
26816
26831
  }
26817
- function Vn(e) {
26832
+ function Gn(e) {
26818
26833
  let t = Object.keys(g[e] ?? {}), n = [];
26819
26834
  for (let r of t) {
26820
- let t = W(e, r);
26821
- Bn(t) && n.push({
26835
+ let t = Un(e, r);
26836
+ Wn(t) && n.push({
26822
26837
  attr: r,
26823
26838
  mode: t
26824
26839
  });
26825
26840
  }
26826
26841
  return n;
26827
26842
  }
26828
- function Hn(e) {
26843
+ function Kn(e) {
26829
26844
  let t = D[e];
26830
- if (!t) return Wn;
26845
+ if (!t) return Jn;
26831
26846
  let n = /* @__PURE__ */ new Set();
26832
26847
  for (let e of t) n.add(e.attribute.path), n.add(e.attribute.uuid);
26833
26848
  return n;
26834
26849
  }
26835
- function Un(e) {
26836
- let t = F.get(e);
26837
- return t ? new Set(t) : Wn;
26850
+ function qn(e) {
26851
+ let t = Le.get(e);
26852
+ return t ? new Set(t) : Jn;
26838
26853
  }
26839
- var Wn = /* @__PURE__ */ new Set();
26854
+ var Jn = /* @__PURE__ */ new Set();
26840
26855
  //#endregion
26841
26856
  //#region src/v2019C1/extensions/lifecycle/constraints/find-constraint-violation.ts
26842
- async function G(e, t) {
26843
- let { parentRef: n, childTag: r, candidate: i, excludeId: a } = t, o = Kn(n.tagName).filter((e) => (e.kind === "unique" || e.kind === "key") && qn(e, r));
26857
+ async function Yn(e, t) {
26858
+ let { parentRef: n, childTag: r, candidate: i, excludeId: a } = t, o = Zn(n.tagName).filter((e) => (e.kind === "unique" || e.kind === "key") && Qn(e, r));
26844
26859
  if (o.length === 0) return null;
26845
26860
  let s = (await e.any.getTree(n))?.tree ?? [];
26846
26861
  for (let e of o) {
26847
- let t = Jn(e);
26862
+ let t = $n(e);
26848
26863
  if (!(t.length === 0 || t.some((e) => i[e] === void 0))) {
26849
- for (let n of s) if (n.id !== a && qn(e, n.tagName) && t.every((e) => Gn(n, e) === i[e])) return {
26864
+ for (let n of s) if (n.id !== a && Qn(e, n.tagName) && t.every((e) => Xn(n, e) === i[e])) return {
26850
26865
  constraint: e.name,
26851
26866
  fields: t,
26852
26867
  offendingId: n.id
@@ -26855,41 +26870,41 @@ async function G(e, t) {
26855
26870
  }
26856
26871
  return null;
26857
26872
  }
26858
- function Gn(e, t) {
26873
+ function Xn(e, t) {
26859
26874
  return e.attributes.find((e) => e.name === t)?.value;
26860
26875
  }
26861
- function Kn(e) {
26876
+ function Zn(e) {
26862
26877
  return [..._[e]?.constraints ?? []];
26863
26878
  }
26864
- function qn(e, t) {
26879
+ function Qn(e, t) {
26865
26880
  for (let n of e.selector ?? []) {
26866
26881
  let e = (n.steps ?? []).at(-1);
26867
26882
  if (e && (e.kind === "wildcard" || e.kind === "name" && e.value === t)) return !0;
26868
26883
  }
26869
26884
  return !1;
26870
26885
  }
26871
- function Jn(e) {
26886
+ function $n(e) {
26872
26887
  return (e.fields ?? []).map((e) => e.target?.value).filter((e) => !!e);
26873
26888
  }
26874
26889
  //#endregion
26875
26890
  //#region src/v2019C1/extensions/lifecycle/constraints/resolve-unique-value.ts
26876
- var Yn = 1e3;
26877
- async function Xn(e, t) {
26891
+ var er = 1e3;
26892
+ async function tr(e, t) {
26878
26893
  let { parentRef: n, childTag: r, candidate: i, attr: a, decorate: o, excludeId: s } = t, c = i[a] ?? "";
26879
- if (!await G(e, {
26894
+ if (!await Yn(e, {
26880
26895
  parentRef: n,
26881
26896
  childTag: r,
26882
26897
  candidate: i,
26883
26898
  excludeId: s
26884
26899
  })) return c;
26885
- for (let t = 1; t <= Yn; t++) {
26900
+ for (let t = 1; t <= er; t++) {
26886
26901
  let l = o ? o({
26887
26902
  base: c,
26888
26903
  attempt: t,
26889
26904
  attr: a,
26890
26905
  childTag: r
26891
26906
  }) : `${c}_${t}`;
26892
- if (!await G(e, {
26907
+ if (!await Yn(e, {
26893
26908
  parentRef: n,
26894
26909
  childTag: r,
26895
26910
  candidate: {
@@ -26899,22 +26914,22 @@ async function Xn(e, t) {
26899
26914
  excludeId: s
26900
26915
  })) return l;
26901
26916
  }
26902
- throw Error(`could not resolve a unique ${a} for <${r}> under <${n.tagName}> after ${Yn} attempts`);
26917
+ throw Error(`could not resolve a unique ${a} for <${r}> under <${n.tagName}> after ${er} attempts`);
26903
26918
  }
26904
26919
  //#endregion
26905
26920
  //#region src/v2019C1/extensions/lifecycle/constraints/resolve-placement-collision.ts
26906
- async function K(e, t) {
26921
+ async function nr(e, t) {
26907
26922
  let { ref: n, decorate: r, overrides: i } = t, a = t.parentRef ?? (await e.getRecord(n))?.parent;
26908
26923
  if (!a) return { status: "ok" };
26909
26924
  let o = await e.getAttributes(n);
26910
26925
  if (i) for (let [t, r] of Object.entries(i)) {
26911
- let i = W(n.tagName, t);
26926
+ let i = Un(n.tagName, t);
26912
26927
  (i === "rename" || i === "free") && o[t] !== r && (await e.update(n, { attributes: { [t]: r } }), o = {
26913
26928
  ...o,
26914
26929
  [t]: r
26915
26930
  });
26916
26931
  }
26917
- let s = await G(e, {
26932
+ let s = await Yn(e, {
26918
26933
  parentRef: a,
26919
26934
  childTag: n.tagName,
26920
26935
  candidate: o,
@@ -26922,14 +26937,14 @@ async function K(e, t) {
26922
26937
  });
26923
26938
  if (!s) return { status: "ok" };
26924
26939
  let c = s.fields.find((e) => {
26925
- let t = W(n.tagName, e);
26940
+ let t = Un(n.tagName, e);
26926
26941
  return t === "rename" || t === "free";
26927
26942
  });
26928
26943
  if (!c) return {
26929
26944
  status: "unresolvable",
26930
26945
  violation: s
26931
26946
  };
26932
- let l = o[c] ?? "", u = await Xn(e, {
26947
+ let l = o[c] ?? "", u = await tr(e, {
26933
26948
  parentRef: a,
26934
26949
  childTag: n.tagName,
26935
26950
  candidate: o,
@@ -26946,12 +26961,12 @@ async function K(e, t) {
26946
26961
  }
26947
26962
  //#endregion
26948
26963
  //#region src/v2019C1/extensions/lifecycle/transplant/transaction/primitives/clone-tree.ts
26949
- var Zn = {
26964
+ var rr = {
26950
26965
  scope: "tree",
26951
26966
  attributes: ["templateUuid", "originUuid"]
26952
26967
  };
26953
- async function q(e, t) {
26954
- let { sourceQuery: n, ref: i, targetParent: a, omit: o, retagRoot: s, strip: c = Zn } = t, l = await n.getTree(i, {
26968
+ async function K(e, t) {
26969
+ let { sourceQuery: n, ref: i, targetParent: a, omit: o, retagRoot: s, strip: c = rr } = t, l = await n.getTree(i, {
26955
26970
  omit: o,
26956
26971
  unwrap: []
26957
26972
  });
@@ -26967,12 +26982,12 @@ async function q(e, t) {
26967
26982
  }
26968
26983
  //#endregion
26969
26984
  //#region src/v2019C1/extensions/lifecycle/transplant/transaction/primitives/add-children-to.ts
26970
- async function Qn(e, t) {
26985
+ async function ir(e, t) {
26971
26986
  let { sourceQuery: n, source: r, target: i, omit: a, strip: o } = t, s = await n.any.getRecord(r);
26972
26987
  if (!s) return [];
26973
26988
  let c = [];
26974
26989
  for (let t of s.children) {
26975
- let r = await q(e, {
26990
+ let r = await K(e, {
26976
26991
  sourceQuery: n,
26977
26992
  ref: {
26978
26993
  tagName: t.tagName,
@@ -26988,14 +27003,14 @@ async function Qn(e, t) {
26988
27003
  }
26989
27004
  //#endregion
26990
27005
  //#region src/v2019C1/extensions/lifecycle/transplant/transaction/deep.ts
26991
- async function J(e, t) {
26992
- let { sourceQuery: n, ref: r, targetParent: i, withTypes: a = !0, omit: o, strip: s = !1, retagRoot: c } = t, l = await $n(e, {
27006
+ async function ar(e, t) {
27007
+ let { sourceQuery: n, ref: r, targetParent: i, withTypes: a = !0, omit: o, strip: s = !1, retagRoot: c } = t, l = await or(e, {
26993
27008
  sourceQuery: n,
26994
27009
  ref: r,
26995
27010
  targetParent: i
26996
27011
  }), u, d;
26997
27012
  if (l) {
26998
- d = await Qn(e, {
27013
+ d = await ir(e, {
26999
27014
  sourceQuery: n,
27000
27015
  source: r,
27001
27016
  target: l,
@@ -27006,7 +27021,7 @@ async function J(e, t) {
27006
27021
  if (!t) throw Error(`transplant.deep: merge target vanished: ${l.id}`);
27007
27022
  u = t;
27008
27023
  } else {
27009
- let t = await q(e, {
27024
+ let t = await K(e, {
27010
27025
  sourceQuery: n,
27011
27026
  ref: r,
27012
27027
  targetParent: i,
@@ -27019,10 +27034,10 @@ async function J(e, t) {
27019
27034
  }
27020
27035
  let f = /* @__PURE__ */ new Map();
27021
27036
  if (a) {
27022
- let t = await er(n, r);
27037
+ let t = await sr(n, r);
27023
27038
  if (t.length > 0) {
27024
27039
  let r = typeof a == "object" ? a.keepNameFrom : void 0;
27025
- f = (await It(e, {
27040
+ f = (await Vt(e, {
27026
27041
  sourceQuery: n,
27027
27042
  records: t,
27028
27043
  cloneMappings: d,
@@ -27036,7 +27051,7 @@ async function J(e, t) {
27036
27051
  recordMappings: d
27037
27052
  };
27038
27053
  }
27039
- async function $n(e, t) {
27054
+ async function or(e, t) {
27040
27055
  let { sourceQuery: n, ref: r, targetParent: i } = t;
27041
27056
  if (r.tagName !== "Private") return;
27042
27057
  let a = (await n.any.getAttributes(r)).type;
@@ -27047,7 +27062,7 @@ async function $n(e, t) {
27047
27062
  id: t.id
27048
27063
  };
27049
27064
  }
27050
- async function er(e, t) {
27065
+ async function sr(e, t) {
27051
27066
  let { LNode: n = [], LN: r = [], LN0: i = [] } = await e.findDescendants(t, { collect: [
27052
27067
  "LNode",
27053
27068
  "LN",
@@ -27061,7 +27076,7 @@ async function er(e, t) {
27061
27076
  }
27062
27077
  //#endregion
27063
27078
  //#region src/v2019C1/extensions/lifecycle/transplant/transaction/primitives/clone-referenced.ts
27064
- async function tr(e, t) {
27079
+ async function cr(e, t) {
27065
27080
  let { sourceQuery: n, scopeRef: r, refTagName: i, targetTagName: a, alreadyCloned: o } = t, s = D[i][0].attribute.uuid, { [i]: c = [] } = await n.findDescendants(r, { collect: i }), l = /* @__PURE__ */ new Set();
27066
27081
  for (let e of c) {
27067
27082
  let t = e.attributes.find((e) => e.name === s)?.value;
@@ -27085,8 +27100,8 @@ async function tr(e, t) {
27085
27100
  }
27086
27101
  return u;
27087
27102
  }
27088
- async function nr(e, t) {
27089
- let { sourceQuery: n, scopeRef: r, refTagName: i, targetTagName: a, resolveTargetParent: o, alreadyCloned: s, omit: c } = t, l = await tr(e, {
27103
+ async function lr(e, t) {
27104
+ let { sourceQuery: n, scopeRef: r, refTagName: i, targetTagName: a, resolveTargetParent: o, alreadyCloned: s, omit: c } = t, l = await cr(e, {
27090
27105
  sourceQuery: n,
27091
27106
  scopeRef: r,
27092
27107
  refTagName: i,
@@ -27094,7 +27109,7 @@ async function nr(e, t) {
27094
27109
  alreadyCloned: s
27095
27110
  }), u = [];
27096
27111
  for (let t of l) {
27097
- let r = await q(e, {
27112
+ let r = await K(e, {
27098
27113
  sourceQuery: n,
27099
27114
  ref: t,
27100
27115
  targetParent: await o(t),
@@ -27104,8 +27119,8 @@ async function nr(e, t) {
27104
27119
  }
27105
27120
  return u;
27106
27121
  }
27107
- async function rr(e, t) {
27108
- let { sourceQuery: n, scopeTagName: r, scopeRef: i, resolveTargetParent: a, alreadyCloned: o, skip: s = /* @__PURE__ */ new Set(), omit: c } = t, l = (p[r] ?? []).filter((e) => e in D && !s.has(e)), u = nr, d = [];
27122
+ async function ur(e, t) {
27123
+ let { sourceQuery: n, scopeTagName: r, scopeRef: i, resolveTargetParent: a, alreadyCloned: o, skip: s = /* @__PURE__ */ new Set(), omit: c } = t, l = (p[r] ?? []).filter((e) => e in D && !s.has(e)), u = lr, d = [];
27109
27124
  for (let t of l) for (let r of D[t]) for (let s of r.target) {
27110
27125
  let r = await u(e, {
27111
27126
  sourceQuery: n,
@@ -27122,7 +27137,7 @@ async function rr(e, t) {
27122
27137
  }
27123
27138
  //#endregion
27124
27139
  //#region src/v2019C1/extensions/lifecycle/transplant/transaction/primitives/merge-children-into.ts
27125
- async function ir(e, t) {
27140
+ async function dr(e, t) {
27126
27141
  let { sourceQuery: n, source: r, target: i, strip: a } = t, o = await n.any.getRecord(r);
27127
27142
  if (!o) return [];
27128
27143
  let s = [];
@@ -27130,9 +27145,9 @@ async function ir(e, t) {
27130
27145
  let r = {
27131
27146
  tagName: t.tagName,
27132
27147
  id: t.id
27133
- }, o = await n.any.getAttribute(t, { name: "name" }), c = o ? await ar(e, i, t.tagName, o) : void 0;
27148
+ }, o = await n.any.getAttribute(t, { name: "name" }), c = o ? await fr(e, i, t.tagName, o) : void 0;
27134
27149
  if (c) {
27135
- s.push(...await ir(e, {
27150
+ s.push(...await dr(e, {
27136
27151
  sourceQuery: n,
27137
27152
  source: r,
27138
27153
  target: c,
@@ -27140,7 +27155,8 @@ async function ir(e, t) {
27140
27155
  }));
27141
27156
  continue;
27142
27157
  }
27143
- let l = await q(e, {
27158
+ if (await pr(e, i, n, r)) continue;
27159
+ let l = await K(e, {
27144
27160
  sourceQuery: n,
27145
27161
  ref: r,
27146
27162
  targetParent: i,
@@ -27150,7 +27166,7 @@ async function ir(e, t) {
27150
27166
  }
27151
27167
  return s;
27152
27168
  }
27153
- async function ar(e, t, n, r) {
27169
+ async function fr(e, t, n, r) {
27154
27170
  let i = await e.any.getRecord(t);
27155
27171
  if (i) {
27156
27172
  for (let t of i.children) if (t.tagName === n && await e.any.getAttribute(t, { name: "name" }) === r) return {
@@ -27159,9 +27175,19 @@ async function ar(e, t, n, r) {
27159
27175
  };
27160
27176
  }
27161
27177
  }
27178
+ async function pr(e, t, n, r) {
27179
+ let i = await e.any.getRecord(t);
27180
+ if (!i) return !1;
27181
+ let a = await z(n, { ref: r });
27182
+ for (let t of i.children) if (t.tagName === r.tagName && await z(e, { ref: {
27183
+ tagName: t.tagName,
27184
+ id: t.id
27185
+ } }) === a) return !0;
27186
+ return !1;
27187
+ }
27162
27188
  //#endregion
27163
27189
  //#region src/v2019C1/extensions/lifecycle/transplant/transaction/resolve-structure-ref.ts
27164
- async function Y(e, t, n) {
27190
+ async function q(e, t, n) {
27165
27191
  let r = (await e.findAncestors(t, { stopAtTagName: "Substation" })).find((e) => e.tagName in n);
27166
27192
  s(r, {
27167
27193
  key: "ELEMENT_NOT_FOUND",
@@ -27176,7 +27202,7 @@ async function Y(e, t, n) {
27176
27202
  id: i.id
27177
27203
  };
27178
27204
  }
27179
- function or(e) {
27205
+ function mr(e) {
27180
27206
  let { sourceQuery: t, structure: n, cloneIndex: r } = e;
27181
27207
  return async function(e) {
27182
27208
  let i = await t.findAncestors(e, { stopAtTagName: "Substation" });
@@ -27199,26 +27225,26 @@ function or(e) {
27199
27225
  }
27200
27226
  //#endregion
27201
27227
  //#region src/v2019C1/extensions/lifecycle/engine/reconcile.ts
27202
- async function sr(e, t) {
27228
+ async function hr(e, t) {
27203
27229
  let { sourceQuery: n, sourceRootRef: r, instanceRootRef: i, accepted: a, overrides: o, keepNameTypesFrom: s, matchKey: c = "templateUuid", identityMode: l = "stamp-template" } = t, u = await n.any.getTree(r), d = await e.any.getTree(i);
27204
27230
  if (!u || !d) return;
27205
27231
  let f = /* @__PURE__ */ new Map();
27206
- await fr(e, {
27232
+ await br(e, {
27207
27233
  node: d,
27208
27234
  index: f,
27209
27235
  matchKey: c
27210
27236
  });
27211
27237
  let p = /* @__PURE__ */ new Set();
27212
- await pr(n, {
27238
+ await xr(n, {
27213
27239
  node: u,
27214
27240
  out: p
27215
- }), await dr(e, {
27241
+ }), await yr(e, {
27216
27242
  sourceQuery: n,
27217
27243
  instanceRecord: d,
27218
27244
  sourceNode: u,
27219
27245
  accepted: a,
27220
27246
  overrides: o
27221
- }), await cr(e, {
27247
+ }), await gr(e, {
27222
27248
  sourceQuery: n,
27223
27249
  sourceNode: u,
27224
27250
  instanceParent: d,
@@ -27228,25 +27254,25 @@ async function sr(e, t) {
27228
27254
  keepNameTypesFrom: s,
27229
27255
  matchKey: c,
27230
27256
  identityMode: l
27231
- }), await lr(e, {
27257
+ }), await _r(e, {
27232
27258
  instanceNode: d,
27233
27259
  sourceUuids: p,
27234
27260
  accepted: a,
27235
27261
  matchKey: c
27236
27262
  });
27237
27263
  }
27238
- async function cr(e, t) {
27264
+ async function gr(e, t) {
27239
27265
  let { sourceQuery: n, sourceNode: r, instanceParent: i, index: o, accepted: s, overrides: c, keepNameTypesFrom: l, matchKey: u, identityMode: d } = t, f = /* @__PURE__ */ new Set();
27240
27266
  for (let t of r.tree) {
27241
27267
  let r = await n.any.getAttribute(t, { name: "uuid" }), p = (r ? o.get(r) : void 0) ?? (r ? void 0 : i.tree.find((e) => e.tagName === t.tagName && !f.has(e.id)));
27242
27268
  if (p) {
27243
- f.add(p.id), await dr(e, {
27269
+ f.add(p.id), await yr(e, {
27244
27270
  sourceQuery: n,
27245
27271
  instanceRecord: p,
27246
27272
  sourceNode: t,
27247
27273
  accepted: s,
27248
27274
  overrides: c
27249
- }), await cr(e, {
27275
+ }), await gr(e, {
27250
27276
  sourceQuery: n,
27251
27277
  sourceNode: t,
27252
27278
  instanceParent: p,
@@ -27260,34 +27286,34 @@ async function cr(e, t) {
27260
27286
  continue;
27261
27287
  }
27262
27288
  if (s && !s.sourceIds.has(t.id)) continue;
27263
- let { recordMappings: m } = await J(e, {
27289
+ let { recordMappings: m } = await ar(e, {
27264
27290
  sourceQuery: n,
27265
27291
  ref: a(t),
27266
27292
  targetParent: a(i),
27267
27293
  strip: !1,
27268
27294
  withTypes: { keepNameFrom: l }
27269
27295
  });
27270
- await H(e, {
27296
+ await U(e, {
27271
27297
  mappings: m,
27272
27298
  mode: d
27273
- }), d === "keep" && await on(e, { mappings: m });
27299
+ }), d === "keep" ? await W(e, { mappings: m }) : await I(e, { mappings: m });
27274
27300
  let h = m.find((e) => e.source.id === t.id);
27275
- h && d !== "keep" && await K(e, {
27301
+ h && d !== "keep" && await nr(e, {
27276
27302
  ref: h.target,
27277
27303
  parentRef: a(i),
27278
27304
  overrides: c?.get(t.id)
27279
27305
  });
27280
27306
  }
27281
27307
  for (let t of i.tree) if (!f.has(t.id) && !await e.any.getAttribute(t, { name: "templateUuid" })) {
27282
- if (A.has(t.tagName) && !O.has(t.tagName)) {
27308
+ if (k.has(t.tagName) && !O.has(t.tagName)) {
27283
27309
  if (s && !s.instanceIds.has(t.id)) continue;
27284
27310
  } else if (!s || !s.instanceIds.has(t.id)) continue;
27285
27311
  await e.any.getRecord(t) && await e.any.delete(t);
27286
27312
  }
27287
27313
  }
27288
- async function lr(e, t) {
27314
+ async function _r(e, t) {
27289
27315
  let { instanceNode: n, sourceUuids: r, accepted: i, matchKey: a } = t, o = [];
27290
- await ur(e, {
27316
+ await vr(e, {
27291
27317
  node: n,
27292
27318
  sourceUuids: r,
27293
27319
  accepted: i,
@@ -27296,13 +27322,13 @@ async function lr(e, t) {
27296
27322
  });
27297
27323
  for (let t of o) await e.any.getRecord(t) && await e.any.delete(t);
27298
27324
  }
27299
- async function ur(e, t) {
27325
+ async function vr(e, t) {
27300
27326
  let { node: n, sourceUuids: r, accepted: i, matchKey: a, out: o } = t, s = await e.any.getAttribute(n, { name: a });
27301
27327
  if (s && !r.has(s)) {
27302
27328
  (!i || i.instanceIds.has(n.id)) && o.push(n);
27303
27329
  return;
27304
27330
  }
27305
- for (let t of n.tree) await ur(e, {
27331
+ for (let t of n.tree) await vr(e, {
27306
27332
  node: t,
27307
27333
  sourceUuids: r,
27308
27334
  accepted: i,
@@ -27310,87 +27336,87 @@ async function ur(e, t) {
27310
27336
  out: o
27311
27337
  });
27312
27338
  }
27313
- async function dr(e, t) {
27339
+ async function yr(e, t) {
27314
27340
  let { sourceQuery: n, instanceRecord: r, sourceNode: i, accepted: a, overrides: o } = t;
27315
27341
  if (a && !a.sourceIds.has(i.id)) return;
27316
27342
  let s = {
27317
- ...hn(await n.any.getAttributes(i)),
27343
+ ...vn(await n.any.getAttributes(i)),
27318
27344
  ...o?.get(i.id)
27319
- }, c = hn(await e.any.getAttributes(r)), l = {};
27345
+ }, c = vn(await e.any.getAttributes(r)), l = {};
27320
27346
  for (let e of new Set([...Object.keys(s), ...Object.keys(c)])) {
27321
27347
  let t = e in s ? s[e] : void 0;
27322
27348
  c[e] !== t && (l[e] = t);
27323
27349
  }
27324
- if (r.tagName === "LNode" && Object.keys(l).some((e) => Ie.has(e)) && await te(e, r)) for (let e of Ie) delete l[e];
27350
+ if (r.tagName === "LNode" && Object.keys(l).some((e) => Be.has(e)) && await w(e, r)) for (let e of Be) delete l[e];
27325
27351
  Object.keys(l).length > 0 && await e.any.update(r, { attributes: l });
27326
27352
  }
27327
- async function fr(e, t) {
27353
+ async function br(e, t) {
27328
27354
  let { node: n, index: r, matchKey: i } = t, a = await e.any.getAttribute(n, { name: i });
27329
27355
  a && r.set(a, n);
27330
- for (let t of n.tree) await fr(e, {
27356
+ for (let t of n.tree) await br(e, {
27331
27357
  node: t,
27332
27358
  index: r,
27333
27359
  matchKey: i
27334
27360
  });
27335
27361
  }
27336
- async function pr(e, t) {
27362
+ async function xr(e, t) {
27337
27363
  let { node: n, out: r } = t, i = await e.any.getAttribute(n, { name: "uuid" });
27338
27364
  i && r.add(i);
27339
- for (let t of n.tree) await pr(e, {
27365
+ for (let t of n.tree) await xr(e, {
27340
27366
  node: t,
27341
27367
  out: r
27342
27368
  });
27343
27369
  }
27344
27370
  //#endregion
27345
27371
  //#region src/v2019C1/extensions/lifecycle/engine/decide.ts
27346
- function mr(e, t) {
27372
+ function Sr(e, t) {
27347
27373
  return e?.instances.find((e) => e.rootRef?.id === t)?.groups ?? [];
27348
27374
  }
27349
- function hr(e) {
27375
+ function Cr(e) {
27350
27376
  return e === void 0 ? "accept" : typeof e == "string" ? e : e.action;
27351
27377
  }
27352
- function gr(e) {
27378
+ function wr(e) {
27353
27379
  return typeof e == "object" ? e.values : void 0;
27354
27380
  }
27355
- function _r(e) {
27381
+ function Tr(e) {
27356
27382
  let t = e.decisions.get(e.group.id);
27357
- return t === void 0 ? e.group.suggestedAction : hr(t);
27383
+ return t === void 0 ? e.group.suggestedAction : Cr(t);
27358
27384
  }
27359
- function vr(e) {
27360
- return _r(e) !== "skip";
27385
+ function Er(e) {
27386
+ return Tr(e) !== "skip";
27361
27387
  }
27362
- function yr(e) {
27388
+ function Dr(e) {
27363
27389
  let { groups: t, decisions: n } = e, r = /* @__PURE__ */ new Map();
27364
27390
  for (let e of t) {
27365
27391
  let t = n.get(e.id);
27366
- if (_r({
27392
+ if (Tr({
27367
27393
  group: e,
27368
27394
  decisions: n
27369
27395
  }) === "skip") continue;
27370
- let i = gr(t), a = e.primary.sourceRef?.id;
27396
+ let i = wr(t), a = e.primary.sourceRef?.id;
27371
27397
  i && a && r.set(a, i);
27372
27398
  }
27373
27399
  return r;
27374
27400
  }
27375
- function br(e) {
27401
+ function Or(e) {
27376
27402
  let { groups: t, decisions: n } = e;
27377
- for (let e of t) if (vr({
27403
+ for (let e of t) if (Er({
27378
27404
  group: e,
27379
27405
  decisions: n
27380
- })) for (let r of e.dependsOn) s(vr({
27381
- group: xr(t, r) ?? e,
27406
+ })) for (let r of e.dependsOn) s(Er({
27407
+ group: kr(t, r) ?? e,
27382
27408
  decisions: n
27383
27409
  }), { detail: `decision accepts group "${e.id}" but its dependency "${r}" is skipped` });
27384
27410
  }
27385
- function xr(e, t) {
27411
+ function kr(e, t) {
27386
27412
  return e.find((e) => e.id === t);
27387
27413
  }
27388
- function Sr(e) {
27414
+ function Ar(e) {
27389
27415
  let { groups: t, decisions: n } = e, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
27390
- for (let e of t) if (vr({
27416
+ for (let e of t) if (Er({
27391
27417
  group: e,
27392
27418
  decisions: n
27393
- })) for (let t of [e.primary, ...e.companions]) Cr({
27419
+ })) for (let t of [e.primary, ...e.companions]) jr({
27394
27420
  node: t,
27395
27421
  sourceIds: r,
27396
27422
  instanceIds: i
@@ -27400,45 +27426,45 @@ function Sr(e) {
27400
27426
  instanceIds: i
27401
27427
  };
27402
27428
  }
27403
- function Cr(e) {
27429
+ function jr(e) {
27404
27430
  let { node: t, sourceIds: n, instanceIds: r } = e;
27405
- wr({
27431
+ Mr({
27406
27432
  node: t,
27407
27433
  sourceIds: n,
27408
27434
  instanceIds: r
27409
27435
  });
27410
- for (let e of t.children) Cr({
27436
+ for (let e of t.children) jr({
27411
27437
  node: e,
27412
27438
  sourceIds: n,
27413
27439
  instanceIds: r
27414
27440
  });
27415
27441
  }
27416
- function wr(e) {
27442
+ function Mr(e) {
27417
27443
  let { node: t, sourceIds: n, instanceIds: r } = e;
27418
27444
  t.change !== "unchanged" && (t.change === "removed" || t.change === "target-only" ? t.instanceRef?.id && r.add(t.instanceRef.id) : t.sourceRef?.id && n.add(t.sourceRef.id));
27419
27445
  }
27420
27446
  //#endregion
27421
27447
  //#region src/v2019C1/extensions/lifecycle/instance/composed-functions.ts
27422
- async function Tr(e, t) {
27448
+ async function Nr(e, t) {
27423
27449
  let n = /* @__PURE__ */ new Set(), r = await e.any.getTree(t);
27424
- return r && await Er(e, r, n), n;
27450
+ return r && await Pr(e, r, n), n;
27425
27451
  }
27426
- async function Er(e, t, n) {
27452
+ async function Pr(e, t, n) {
27427
27453
  if (t.tagName === "FunctionRef") {
27428
27454
  let r = await e.any.getAttribute(t, { name: "functionUuid" });
27429
27455
  r && n.add(r);
27430
27456
  }
27431
- for (let r of t.tree) await Er(e, r, n);
27457
+ for (let r of t.tree) await Pr(e, r, n);
27432
27458
  }
27433
27459
  //#endregion
27434
27460
  //#region src/v2019C1/extensions/lifecycle/instance/find-instance.ts
27435
- async function Dr(e, t) {
27461
+ async function Fr(e, t) {
27436
27462
  let { targetParent: n, tagName: r, sourceUuid: i, matchKey: a = "templateUuid" } = t;
27437
27463
  if (!i) return [];
27438
27464
  let o = await e.any.getTree(n);
27439
27465
  if (!o) return [];
27440
27466
  let s = [];
27441
- return await Or(e, {
27467
+ return await Ir(e, {
27442
27468
  node: o,
27443
27469
  tagName: r,
27444
27470
  sourceUuid: i,
@@ -27446,13 +27472,13 @@ async function Dr(e, t) {
27446
27472
  out: s
27447
27473
  }), s;
27448
27474
  }
27449
- async function Or(e, t) {
27475
+ async function Ir(e, t) {
27450
27476
  let { node: n, tagName: r, sourceUuid: i, matchKey: a, out: o } = t;
27451
27477
  if (n.tagName === r && await e.any.getAttribute(n, { name: a }) === i) {
27452
27478
  o.push(n);
27453
27479
  return;
27454
27480
  }
27455
- for (let t of n.tree) await Or(e, {
27481
+ for (let t of n.tree) await Ir(e, {
27456
27482
  node: t,
27457
27483
  tagName: r,
27458
27484
  sourceUuid: i,
@@ -27460,77 +27486,80 @@ async function Or(e, t) {
27460
27486
  out: o
27461
27487
  });
27462
27488
  }
27463
- async function kr(e, t) {
27464
- let [n] = await X(e, t);
27489
+ async function Lr(e, t) {
27490
+ let [n] = await J(e, t);
27465
27491
  return n;
27466
27492
  }
27467
- async function X(e, t) {
27468
- let { tagName: n, sourceUuid: r, sourceName: i } = t, a = await e.any.getRecordsByTagName(n), o = [];
27469
- if (r) for (let t of a) await e.any.getAttribute(t, { name: "templateUuid" }) === r && o.push(t);
27470
- if (o.length > 0) return o;
27493
+ async function J(e, t) {
27494
+ let { tagName: n, sourceUuid: r, sourceName: i, matchKey: a = "templateUuid" } = t, o = await e.any.getRecordsByTagName(n), s = [];
27495
+ if (r) for (let t of o) await e.any.getAttribute(t, { name: a }) === r && s.push(t);
27496
+ if (s.length > 0) return s;
27471
27497
  if (!i) return [];
27472
- let s = [];
27473
- for (let t of a) await e.any.getAttribute(t, { name: "name" }) === i && s.push(t);
27474
- return s.length === 1 ? s : [];
27498
+ let c = [];
27499
+ for (let t of o) await e.any.getAttribute(t, { name: "name" }) === i && c.push(t);
27500
+ return c.length === 1 ? c : [];
27475
27501
  }
27476
27502
  //#endregion
27477
27503
  //#region src/v2019C1/extensions/lifecycle/update/transaction/satellite-reconcile.ts
27478
- async function Ar(e, t) {
27479
- let { sourceQuery: n, satelliteRefs: r, instanceSatelliteRefs: i, structure: a, accepted: o } = t;
27504
+ async function Rr(e, t) {
27505
+ let { sourceQuery: n, satelliteRefs: r, instanceSatelliteRefs: i, structure: a, accepted: o, matchKey: s = "templateUuid", identityMode: c = "stamp-template" } = t;
27480
27506
  for (let t of r) {
27481
- let { uuid: r, name: i } = await n.any.getAttributes(t), s = await kr(e, {
27507
+ let { uuid: r, name: i } = await n.any.getAttributes(t), l = await Lr(e, {
27482
27508
  tagName: t.tagName,
27483
27509
  sourceUuid: r,
27484
- sourceName: i
27510
+ sourceName: i,
27511
+ matchKey: s
27485
27512
  });
27486
- if (s) {
27487
- await sr(e, {
27513
+ if (l) {
27514
+ await hr(e, {
27488
27515
  sourceQuery: n,
27489
27516
  sourceRootRef: t,
27490
- instanceRootRef: s,
27491
- accepted: o
27517
+ instanceRootRef: l,
27518
+ accepted: o,
27519
+ matchKey: s,
27520
+ identityMode: c
27492
27521
  });
27493
27522
  continue;
27494
27523
  }
27495
27524
  if (o && t.id && !o.sourceIds.has(t.id)) continue;
27496
- let c = await q(e, {
27525
+ let u = await K(e, {
27497
27526
  sourceQuery: n,
27498
27527
  ref: t,
27499
- targetParent: await Y(n, t, a),
27528
+ targetParent: await q(n, t, a),
27500
27529
  strip: !1
27501
27530
  });
27502
- c && await H(e, {
27503
- mappings: c.mappings,
27504
- mode: "stamp-template"
27505
- });
27531
+ u && (await U(e, {
27532
+ mappings: u.mappings,
27533
+ mode: c
27534
+ }), c === "keep" && await W(e, { mappings: u.mappings }));
27506
27535
  }
27507
27536
  for (let t of i ?? []) {
27508
- let { templateUuid: r } = await e.any.getAttributes(t);
27537
+ let r = await e.any.getAttribute(t, { name: s });
27509
27538
  if (!r) continue;
27510
27539
  let [i] = await n.any.findByAttributes({
27511
27540
  tagName: t.tagName,
27512
27541
  attributes: { uuid: r }
27513
27542
  });
27514
- i || o && t.id && !o.instanceIds.has(t.id) || (await I(e, { target: t })).length > 0 || await e.delete(t);
27543
+ i || o && t.id && !o.instanceIds.has(t.id) || (await F(e, { target: t })).length > 0 || await e.delete(t);
27515
27544
  }
27516
27545
  }
27517
27546
  //#endregion
27518
27547
  //#region src/v2019C1/extensions/lifecycle/cross-cutting/applied-satellites.constants.ts
27519
- var jr = ["Variable", "BehaviorDescription"];
27548
+ var zr = ["Variable", "BehaviorDescription"];
27520
27549
  //#endregion
27521
27550
  //#region src/v2019C1/extensions/lifecycle/cross-cutting/applied-satellites.ts
27522
- async function Z(e, t) {
27551
+ async function Y(e, t) {
27523
27552
  let { primaryRef: n } = t, r = await e.any.getTree(n);
27524
27553
  if (!r) return [];
27525
27554
  let i = /* @__PURE__ */ new Set(), o = [];
27526
- Mr({
27555
+ Br({
27527
27556
  node: r,
27528
27557
  subtreeIds: i,
27529
27558
  targets: o
27530
27559
  });
27531
27560
  let s = /* @__PURE__ */ new Set(), c = [];
27532
- for (let t of o) for (let n of jr) {
27533
- let r = await z.query.findRefsPointingTo(e, {
27561
+ for (let t of o) for (let n of zr) {
27562
+ let r = await L.query.findRefsPointingTo(e, {
27534
27563
  target: a(t),
27535
27564
  containerTagName: n
27536
27565
  });
@@ -27538,10 +27567,10 @@ async function Z(e, t) {
27538
27567
  }
27539
27568
  return c;
27540
27569
  }
27541
- function Mr(e) {
27570
+ function Br(e) {
27542
27571
  let { node: t, subtreeIds: n, targets: r } = e;
27543
27572
  n.add(t.id), t.attributes.some((e) => e.name === "uuid") && r.push(t);
27544
- for (let e of t.tree) Mr({
27573
+ for (let e of t.tree) Br({
27545
27574
  node: e,
27546
27575
  subtreeIds: n,
27547
27576
  targets: r
@@ -27549,19 +27578,21 @@ function Mr(e) {
27549
27578
  }
27550
27579
  //#endregion
27551
27580
  //#region src/v2019C1/extensions/lifecycle/update/transaction/cross-cutting-satellites.ts
27552
- async function Nr(e, t) {
27553
- let { sourceQuery: n, primaryRef: r, instancePrimaryRef: i, structure: a, accepted: o } = t;
27554
- await Ar(e, {
27581
+ async function Vr(e, t) {
27582
+ let { sourceQuery: n, primaryRef: r, instancePrimaryRef: i, structure: a, accepted: o, matchKey: s, identityMode: c } = t;
27583
+ await Rr(e, {
27555
27584
  sourceQuery: n,
27556
- satelliteRefs: await Z(n, { primaryRef: r }),
27557
- instanceSatelliteRefs: i ? await Z(e, { primaryRef: i }) : [],
27585
+ satelliteRefs: await Y(n, { primaryRef: r }),
27586
+ instanceSatelliteRefs: i ? await Y(e, { primaryRef: i }) : [],
27558
27587
  structure: a,
27559
- accepted: o
27588
+ accepted: o,
27589
+ matchKey: s,
27590
+ identityMode: c
27560
27591
  });
27561
27592
  }
27562
27593
  //#endregion
27563
27594
  //#region src/v2019C1/extensions/lifecycle/instantiate/transaction/resolve-target-structure.ts
27564
- async function Q(e, t) {
27595
+ async function X(e, t) {
27565
27596
  let n = await e.getRecord(t);
27566
27597
  s(n, {
27567
27598
  key: "ELEMENT_NOT_FOUND",
@@ -27572,12 +27603,12 @@ async function Q(e, t) {
27572
27603
  }
27573
27604
  //#endregion
27574
27605
  //#region src/v2019C1/extensions/lifecycle/cross-cutting/clone-applied-satellites.ts
27575
- async function Pr(e, t) {
27576
- let { sourceQuery: n, primaryRef: r, structure: i, strip: a = !0 } = t, o = await Z(n, { primaryRef: r }), s = [];
27606
+ async function Hr(e, t) {
27607
+ let { sourceQuery: n, primaryRef: r, structure: i, strip: a = !0 } = t, o = await Y(n, { primaryRef: r }), s = [];
27577
27608
  for (let t of o) {
27578
- let r = await Fr(e, n, t);
27609
+ let r = await Ur(e, n, t);
27579
27610
  if (r) {
27580
- let i = await ir(e, {
27611
+ let i = await dr(e, {
27581
27612
  sourceQuery: n,
27582
27613
  source: t,
27583
27614
  target: r,
@@ -27586,17 +27617,17 @@ async function Pr(e, t) {
27586
27617
  s.push(...i);
27587
27618
  continue;
27588
27619
  }
27589
- let o = await q(e, {
27620
+ let o = await K(e, {
27590
27621
  sourceQuery: n,
27591
27622
  ref: t,
27592
- targetParent: await Y(n, t, i),
27623
+ targetParent: await q(n, t, i),
27593
27624
  ...a ? {} : { strip: !1 }
27594
27625
  });
27595
27626
  o && s.push(...o.mappings);
27596
27627
  }
27597
27628
  return s;
27598
27629
  }
27599
- async function Fr(e, t, n) {
27630
+ async function Ur(e, t, n) {
27600
27631
  let r = await t.any.getRecord(n);
27601
27632
  if (!r) return;
27602
27633
  let i = await t.any.getAttribute(r, { name: "name" });
@@ -27612,8 +27643,8 @@ async function Fr(e, t, n) {
27612
27643
  }
27613
27644
  //#endregion
27614
27645
  //#region src/v2019C1/extensions/lifecycle/layers/function/clone-function.ts
27615
- async function Ir(e, t) {
27616
- let { sourceQuery: n, functionRef: r, targetParentRef: i, omit: a, stripRootAttributes: o, keepNameTypesFrom: s } = t, { recordMappings: c } = await J(e, {
27646
+ async function Wr(e, t) {
27647
+ let { sourceQuery: n, functionRef: r, targetParentRef: i, omit: a, stripRootAttributes: o, keepNameTypesFrom: s } = t, { recordMappings: c } = await ar(e, {
27617
27648
  sourceQuery: n,
27618
27649
  ref: r,
27619
27650
  targetParent: i,
@@ -27630,15 +27661,15 @@ async function Ir(e, t) {
27630
27661
  });
27631
27662
  return c;
27632
27663
  }
27633
- async function Lr(e, t) {
27634
- let { sourceQuery: n, functionRef: r, structure: i, stripCategoriesUuid: a = !0 } = t, o = await Rr(n, r), s = [];
27664
+ async function Z(e, t) {
27665
+ let { sourceQuery: n, functionRef: r, structure: i, stripCategoriesUuid: a = !0 } = t, o = await Gr(n, r), s = [];
27635
27666
  for (let t of o) {
27636
27667
  let r = {
27637
27668
  tagName: "FunctionCategory",
27638
27669
  id: t
27639
- }, o = await Br(e, n, t);
27670
+ }, o = await qr(e, n, t);
27640
27671
  if (o) {
27641
- let t = await ir(e, {
27672
+ let t = await dr(e, {
27642
27673
  sourceQuery: n,
27643
27674
  source: r,
27644
27675
  target: o,
@@ -27647,28 +27678,28 @@ async function Lr(e, t) {
27647
27678
  s.push(...t);
27648
27679
  continue;
27649
27680
  }
27650
- let c = await q(e, {
27681
+ let c = await K(e, {
27651
27682
  sourceQuery: n,
27652
27683
  ref: r,
27653
- targetParent: await Y(n, r, i),
27684
+ targetParent: await q(n, r, i),
27654
27685
  ...a ? {} : { strip: !1 }
27655
27686
  });
27656
27687
  c && s.push(...c.mappings);
27657
27688
  }
27658
27689
  return s;
27659
27690
  }
27660
- async function Rr(e, t) {
27661
- let n = await zr(e, t), r = /* @__PURE__ */ new Set();
27691
+ async function Gr(e, t) {
27692
+ let n = await Kr(e, t), r = /* @__PURE__ */ new Set();
27662
27693
  for (let { container: e } of n) e && r.add(e.id);
27663
27694
  return r;
27664
27695
  }
27665
- async function zr(e, t) {
27666
- let n = await z.query.findRefsPointingTo(e, {
27696
+ async function Kr(e, t) {
27697
+ let n = await L.query.findRefsPointingTo(e, {
27667
27698
  target: t,
27668
27699
  containerTagName: "FunctionCategory"
27669
27700
  }), { SubFunction: r = [] } = await e.findDescendants(t, { collect: "SubFunction" });
27670
27701
  for (let t of r) {
27671
- let r = await z.query.findRefsPointingTo(e, {
27702
+ let r = await L.query.findRefsPointingTo(e, {
27672
27703
  target: {
27673
27704
  tagName: "SubFunction",
27674
27705
  id: t.id
@@ -27679,7 +27710,7 @@ async function zr(e, t) {
27679
27710
  }
27680
27711
  return n;
27681
27712
  }
27682
- async function Br(e, t, n) {
27713
+ async function qr(e, t, n) {
27683
27714
  let r = await t.getRecord({
27684
27715
  tagName: "FunctionCategory",
27685
27716
  id: n
@@ -27698,18 +27729,18 @@ async function Br(e, t, n) {
27698
27729
  }
27699
27730
  //#endregion
27700
27731
  //#region src/v2019C1/extensions/lifecycle/layers/function/satellites.constants.ts
27701
- var Vr = ["FunctionCategory"];
27732
+ var Jr = ["FunctionCategory"];
27702
27733
  //#endregion
27703
27734
  //#region src/v2019C1/extensions/lifecycle/layers/function/satellites.ts
27704
- async function Hr(e, t) {
27735
+ async function Yr(e, t) {
27705
27736
  let { primaryRef: n } = t, r = [n], { SubFunction: i = [] } = await e.findDescendants(n, { collect: "SubFunction" });
27706
27737
  for (let e of i) r.push({
27707
27738
  tagName: "SubFunction",
27708
27739
  id: e.id
27709
27740
  });
27710
27741
  let o = /* @__PURE__ */ new Set(), s = [];
27711
- for (let t of r) for (let n of Vr) {
27712
- let r = await z.query.findRefsPointingTo(e, {
27742
+ for (let t of r) for (let n of Jr) {
27743
+ let r = await L.query.findRefsPointingTo(e, {
27713
27744
  target: t,
27714
27745
  containerTagName: n
27715
27746
  });
@@ -27719,8 +27750,8 @@ async function Hr(e, t) {
27719
27750
  }
27720
27751
  //#endregion
27721
27752
  //#region src/v2019C1/extensions/lifecycle/instantiate/transaction/fsd.ts
27722
- async function Ur(e, t) {
27723
- let { sourceQuery: n, functionRef: r, targetParent: i, overrides: a, keepNameTypesFrom: o } = t, { recordMappings: s } = await J(e, {
27753
+ async function Xr(e, t) {
27754
+ let { sourceQuery: n, functionRef: r, targetParent: i, overrides: a, keepNameTypesFrom: o } = t, { recordMappings: s } = await ar(e, {
27724
27755
  sourceQuery: n,
27725
27756
  ref: r,
27726
27757
  targetParent: i,
@@ -27730,12 +27761,12 @@ async function Ur(e, t) {
27730
27761
  to: "SubFunction"
27731
27762
  } : void 0,
27732
27763
  withTypes: { keepNameFrom: o }
27733
- }), c = await Q(e, i), l = await Lr(e, {
27764
+ }), c = await X(e, i), l = await Z(e, {
27734
27765
  sourceQuery: n,
27735
27766
  functionRef: r,
27736
27767
  structure: c,
27737
27768
  stripCategoriesUuid: !1
27738
- }), u = await Pr(e, {
27769
+ }), u = await Hr(e, {
27739
27770
  sourceQuery: n,
27740
27771
  primaryRef: r,
27741
27772
  structure: c,
@@ -27745,21 +27776,23 @@ async function Ur(e, t) {
27745
27776
  ...l,
27746
27777
  ...u
27747
27778
  ];
27748
- await R(e, { mappings: d }), await H(e, {
27779
+ await I(e, { mappings: d }), await U(e, {
27749
27780
  mappings: d,
27750
27781
  mode: "stamp-template"
27751
27782
  });
27752
27783
  let f = s.find((e) => e.source.id === r.id);
27753
27784
  if (!f) throw Error(`instantiate.fsd: cloned root not found for ${r.tagName}#${r.id}`);
27754
27785
  let p = f.target;
27755
- return await K(e, {
27786
+ return await nr(e, {
27756
27787
  ref: p,
27757
27788
  parentRef: i,
27758
27789
  overrides: a?.get(r.id)
27759
- }), await _t(e, {
27790
+ }), await St(e, {
27760
27791
  sourceQuery: n,
27761
- targetRoot: p,
27762
- fileType: "FSD"
27792
+ target: {
27793
+ anchor: "function",
27794
+ root: p
27795
+ }
27763
27796
  }), {
27764
27797
  functionRef: p,
27765
27798
  recordMappings: s
@@ -27767,18 +27800,18 @@ async function Ur(e, t) {
27767
27800
  }
27768
27801
  //#endregion
27769
27802
  //#region src/v2019C1/extensions/lifecycle/layers/application/clone-application.ts
27770
- async function Wr(e, t) {
27771
- let { sourceQuery: n, applicationRef: r, structure: i, omit: a, keepNameTypesFrom: o } = t, s = /* @__PURE__ */ new Map(), c = [], l = await tr(e, {
27803
+ async function Zr(e, t) {
27804
+ let { sourceQuery: n, applicationRef: r, structure: i, omit: a, keepNameTypesFrom: o } = t, s = /* @__PURE__ */ new Map(), c = [], l = await cr(e, {
27772
27805
  sourceQuery: n,
27773
27806
  scopeRef: r,
27774
27807
  refTagName: "FunctionRef",
27775
27808
  targetTagName: "Function"
27776
27809
  });
27777
27810
  for (let t of l) {
27778
- let r = await Ir(e, {
27811
+ let r = await Wr(e, {
27779
27812
  sourceQuery: n,
27780
27813
  functionRef: t,
27781
- targetParentRef: await Y(n, t, i),
27814
+ targetParentRef: await q(n, t, i),
27782
27815
  omit: a,
27783
27816
  keepNameTypesFrom: o
27784
27817
  });
@@ -27786,7 +27819,7 @@ async function Wr(e, t) {
27786
27819
  for (let e of r) e.source.id && s.set(e.source.id, e.target);
27787
27820
  }
27788
27821
  for (let t of l) {
27789
- let r = await Lr(e, {
27822
+ let r = await Z(e, {
27790
27823
  sourceQuery: n,
27791
27824
  functionRef: t,
27792
27825
  structure: i,
@@ -27794,16 +27827,16 @@ async function Wr(e, t) {
27794
27827
  });
27795
27828
  c.push(...r);
27796
27829
  }
27797
- let u = await Gr(e, {
27830
+ let u = await Qr(e, {
27798
27831
  sourceQuery: n,
27799
27832
  applicationRef: r
27800
27833
  });
27801
27834
  for (let e of u) s.set(e.sourceId, e.existingRef);
27802
- let d = new Set(["FunctionRef", "FunctionCategoryRef"]), f = await rr(e, {
27835
+ let d = new Set(["FunctionRef", "FunctionCategoryRef"]), f = await ur(e, {
27803
27836
  sourceQuery: n,
27804
27837
  scopeTagName: "Application",
27805
27838
  scopeRef: r,
27806
- resolveTargetParent: or({
27839
+ resolveTargetParent: mr({
27807
27840
  sourceQuery: n,
27808
27841
  structure: i,
27809
27842
  cloneIndex: s
@@ -27813,10 +27846,10 @@ async function Wr(e, t) {
27813
27846
  omit: a
27814
27847
  });
27815
27848
  c.push(...f);
27816
- let p = await q(e, {
27849
+ let p = await K(e, {
27817
27850
  sourceQuery: n,
27818
27851
  ref: r,
27819
- targetParent: await Y(n, r, i),
27852
+ targetParent: await q(n, r, i),
27820
27853
  omit: a
27821
27854
  });
27822
27855
  p && c.push(...p.mappings);
@@ -27832,7 +27865,7 @@ async function Wr(e, t) {
27832
27865
  }
27833
27866
  return c;
27834
27867
  }
27835
- async function Gr(e, t) {
27868
+ async function Qr(e, t) {
27836
27869
  let { sourceQuery: n, applicationRef: r } = t, { AllocationRoleRef: i = [] } = await n.findDescendants(r, { collect: "AllocationRoleRef" }), a = [], o = /* @__PURE__ */ new Set();
27837
27870
  for (let t of i) {
27838
27871
  let r = t.attributes.find((e) => e.name === "allocationRoleUuid")?.value;
@@ -27856,7 +27889,7 @@ async function Gr(e, t) {
27856
27889
  tagName: "AllocationRole",
27857
27890
  id: c.id
27858
27891
  };
27859
- await Qn(e, {
27892
+ await ir(e, {
27860
27893
  sourceQuery: n,
27861
27894
  source: {
27862
27895
  tagName: "AllocationRole",
@@ -27875,20 +27908,20 @@ async function Gr(e, t) {
27875
27908
  }
27876
27909
  //#endregion
27877
27910
  //#region src/v2019C1/extensions/lifecycle/layers/application/satellites.constants.ts
27878
- var Kr = [{
27911
+ var $r = [{
27879
27912
  refTag: "AllocationRoleRef",
27880
27913
  uuidAttr: "allocationRoleUuid",
27881
27914
  targetTag: "AllocationRole"
27882
27915
  }];
27883
27916
  //#endregion
27884
27917
  //#region src/v2019C1/extensions/lifecycle/layers/application/satellites.ts
27885
- async function qr(e, t) {
27918
+ async function ei(e, t) {
27886
27919
  let { applicationRef: n } = t, r = await e.any.getTree(n);
27887
27920
  if (!r) return [];
27888
27921
  let i = /* @__PURE__ */ new Set(), o = [];
27889
- for (let t of Kr) {
27922
+ for (let t of $r) {
27890
27923
  let n = /* @__PURE__ */ new Set();
27891
- await Jr(e, {
27924
+ await ti(e, {
27892
27925
  node: r,
27893
27926
  refTag: t.refTag,
27894
27927
  uuidAttr: t.uuidAttr,
@@ -27904,13 +27937,13 @@ async function qr(e, t) {
27904
27937
  }
27905
27938
  return o;
27906
27939
  }
27907
- async function Jr(e, t) {
27940
+ async function ti(e, t) {
27908
27941
  let { node: n, refTag: r, uuidAttr: i, out: a } = t;
27909
27942
  if (n.tagName === r) {
27910
27943
  let t = await e.any.getAttribute(n, { name: i });
27911
27944
  t && a.add(t);
27912
27945
  }
27913
- for (let t of n.tree) await Jr(e, {
27946
+ for (let t of n.tree) await ti(e, {
27914
27947
  node: t,
27915
27948
  refTag: r,
27916
27949
  uuidAttr: i,
@@ -27919,32 +27952,32 @@ async function Jr(e, t) {
27919
27952
  }
27920
27953
  //#endregion
27921
27954
  //#region src/v2019C1/extensions/lifecycle/instantiate/transaction/asd.ts
27922
- async function Yr(e, t) {
27923
- let { sourceQuery: n, applicationRef: r, targetParent: i, overrides: a, keepNameTypesFrom: o } = t, s = await Q(e, i), c = await tr(e, {
27955
+ async function ni(e, t) {
27956
+ let { sourceQuery: n, applicationRef: r, targetParent: i, overrides: a, keepNameTypesFrom: o } = t, s = await X(e, i), c = await cr(e, {
27924
27957
  sourceQuery: n,
27925
27958
  scopeRef: r,
27926
27959
  refTagName: "FunctionRef",
27927
27960
  targetTagName: "Function"
27928
- }), l = await Wr(e, {
27961
+ }), l = await Zr(e, {
27929
27962
  sourceQuery: n,
27930
27963
  applicationRef: r,
27931
27964
  structure: s,
27932
27965
  keepNameTypesFrom: o
27933
- }), u = await Pr(e, {
27966
+ }), u = await Hr(e, {
27934
27967
  sourceQuery: n,
27935
27968
  primaryRef: r,
27936
27969
  structure: s,
27937
27970
  strip: !1
27938
27971
  }), d = [...l, ...u];
27939
- await R(e, { mappings: d }), await H(e, {
27972
+ await I(e, { mappings: d }), await U(e, {
27940
27973
  mappings: d,
27941
27974
  mode: "stamp-template"
27942
27975
  });
27943
27976
  for (let t of c) {
27944
27977
  let r = l.find((e) => e.source.id === t.id);
27945
27978
  if (!r) continue;
27946
- let i = await Y(n, t, s);
27947
- await K(e, {
27979
+ let i = await q(n, t, s);
27980
+ await nr(e, {
27948
27981
  ref: r.target,
27949
27982
  parentRef: i,
27950
27983
  overrides: a?.get(t.id)
@@ -27952,15 +27985,17 @@ async function Yr(e, t) {
27952
27985
  }
27953
27986
  let f = l.find((e) => e.source.id === r.id);
27954
27987
  if (!f) throw Error(`instantiate.asd: cloned Application not found for ${r.id}`);
27955
- let p = await Y(n, r, s);
27956
- await K(e, {
27988
+ let p = await q(n, r, s);
27989
+ await nr(e, {
27957
27990
  ref: f.target,
27958
27991
  parentRef: p,
27959
27992
  overrides: a?.get(r.id)
27960
- }), await _t(e, {
27993
+ }), await St(e, {
27961
27994
  sourceQuery: n,
27962
- targetRoot: f.target,
27963
- fileType: "ASD"
27995
+ target: {
27996
+ anchor: "application",
27997
+ root: f.target
27998
+ }
27964
27999
  });
27965
28000
  let m = c.map((e) => l.find((t) => t.source.id === e.id)?.target).filter((e) => !!e);
27966
28001
  return {
@@ -27971,75 +28006,81 @@ async function Yr(e, t) {
27971
28006
  }
27972
28007
  //#endregion
27973
28008
  //#region src/v2019C1/extensions/lifecycle/update/transaction/function-satellites.ts
27974
- async function Xr(e, t) {
27975
- let { sourceQuery: n, functionRef: r, instanceRef: i, targetParent: a, accepted: o } = t, s = await Hr(n, { primaryRef: r }), c = !1;
27976
- for (let t of s) {
27977
- let { uuid: r, name: i } = await n.any.getAttributes(t), a = await kr(e, {
28009
+ async function ri(e, t) {
28010
+ let { sourceQuery: n, functionRef: r, instanceRef: i, targetParent: a, accepted: o, matchKey: s = "templateUuid", identityMode: c = "stamp-template" } = t, l = await Yr(n, { primaryRef: r }), u = !1;
28011
+ for (let t of l) {
28012
+ let { uuid: r, name: i } = await n.any.getAttributes(t), a = await Lr(e, {
27978
28013
  tagName: t.tagName,
27979
28014
  sourceUuid: r,
27980
- sourceName: i
28015
+ sourceName: i,
28016
+ matchKey: s
27981
28017
  });
27982
28018
  if (!a) {
27983
- c = !0;
28019
+ u = !0;
27984
28020
  continue;
27985
28021
  }
27986
- await sr(e, {
28022
+ await hr(e, {
27987
28023
  sourceQuery: n,
27988
28024
  sourceRootRef: t,
27989
28025
  instanceRootRef: a,
27990
- accepted: o
28026
+ accepted: o,
28027
+ matchKey: s,
28028
+ identityMode: c
27991
28029
  });
27992
28030
  }
27993
- c && (!o || o.sourceIds.has(r.id)) && await H(e, {
27994
- mappings: await Lr(e, {
28031
+ if (u && (!o || o.sourceIds.has(r.id))) {
28032
+ let t = await Z(e, {
27995
28033
  sourceQuery: n,
27996
28034
  functionRef: r,
27997
- structure: await Q(e, a),
28035
+ structure: await X(e, a),
27998
28036
  stripCategoriesUuid: !1
27999
- }),
28000
- mode: "stamp-template"
28001
- });
28002
- let l = await Hr(e, { primaryRef: {
28037
+ });
28038
+ await U(e, {
28039
+ mappings: t,
28040
+ mode: c
28041
+ }), c === "keep" && await W(e, { mappings: t });
28042
+ }
28043
+ let d = await Yr(e, { primaryRef: {
28003
28044
  tagName: "Function",
28004
28045
  id: i.id
28005
28046
  } });
28006
- for (let t of l) {
28007
- let { templateUuid: r } = await e.any.getAttributes(t);
28047
+ for (let t of d) {
28048
+ let r = await e.any.getAttribute(t, { name: s });
28008
28049
  if (!r) continue;
28009
28050
  let [i] = await n.any.findByAttributes({
28010
28051
  tagName: t.tagName,
28011
28052
  attributes: { uuid: r }
28012
28053
  });
28013
- i || o && t.id && !o.instanceIds.has(t.id) || (await I(e, { target: t })).length > 0 || await e.delete(t);
28054
+ i || o && t.id && !o.instanceIds.has(t.id) || (await F(e, { target: t })).length > 0 || await e.delete(t);
28014
28055
  }
28015
28056
  }
28016
28057
  //#endregion
28017
28058
  //#region src/v2019C1/extensions/lifecycle/scenario.ts
28018
- function Zr(e) {
28059
+ function Q(e) {
28019
28060
  return e === "fork" ? "uuid" : "templateUuid";
28020
28061
  }
28021
- function Qr(e) {
28062
+ function ii(e) {
28022
28063
  return e === "fork" ? "keep" : "stamp-template";
28023
28064
  }
28024
28065
  //#endregion
28025
28066
  //#region src/v2019C1/extensions/lifecycle/update/transaction/fsd.ts
28026
- async function $r(e, t) {
28027
- let { sourceQuery: n, functionRef: r, targetParent: i, scenario: a, report: o, decisions: s, keepNameTypesFrom: c } = t, { uuid: l } = await n.getAttributes(r), u = Zr(a), d = Qr(a), f = a === "instantiate" ? [] : await Dr(e, {
28067
+ async function ai(e, t) {
28068
+ let { sourceQuery: n, functionRef: r, targetParent: i, scenario: a, report: o, decisions: s, keepNameTypesFrom: c } = t, { uuid: l } = await n.getAttributes(r), u = Q(a), d = ii(a), f = a === "instantiate" ? [] : await Fr(e, {
28028
28069
  targetParent: i,
28029
28070
  tagName: "Function",
28030
28071
  sourceUuid: l,
28031
28072
  matchKey: u
28032
- }), p = o ? U(o) : [];
28073
+ }), p = o ? G(o) : [];
28033
28074
  if (f.length === 0) {
28034
- let t = s ? Sr({
28075
+ let t = s ? Ar({
28035
28076
  groups: p,
28036
28077
  decisions: s
28037
- }) : void 0, a = s ? yr({
28078
+ }) : void 0, a = s ? Dr({
28038
28079
  groups: p,
28039
28080
  decisions: s
28040
28081
  }) : void 0;
28041
28082
  if (t && !t.sourceIds.has(r.id)) return [];
28042
- let { functionRef: o } = await Ur(e, {
28083
+ let { functionRef: o } = await Xr(e, {
28043
28084
  sourceQuery: n,
28044
28085
  functionRef: r,
28045
28086
  targetParent: i,
@@ -28048,13 +28089,13 @@ async function $r(e, t) {
28048
28089
  });
28049
28090
  return [o];
28050
28091
  }
28051
- let m = await Q(e, i);
28092
+ let m = await X(e, i);
28052
28093
  for (let t of f) {
28053
- let { instanceAccepted: a, instanceOverrides: l } = ei({
28054
- instanceGroups: mr(o, t.id),
28094
+ let { instanceAccepted: a, instanceOverrides: l } = oi({
28095
+ instanceGroups: Sr(o, t.id),
28055
28096
  decisions: s
28056
28097
  });
28057
- await sr(e, {
28098
+ await hr(e, {
28058
28099
  sourceQuery: n,
28059
28100
  sourceRootRef: r,
28060
28101
  instanceRootRef: t,
@@ -28063,13 +28104,15 @@ async function $r(e, t) {
28063
28104
  keepNameTypesFrom: c,
28064
28105
  matchKey: u,
28065
28106
  identityMode: d
28066
- }), await Xr(e, {
28107
+ }), await ri(e, {
28067
28108
  sourceQuery: n,
28068
28109
  functionRef: r,
28069
28110
  instanceRef: t,
28070
28111
  targetParent: i,
28071
- accepted: a
28072
- }), await Nr(e, {
28112
+ accepted: a,
28113
+ matchKey: u,
28114
+ identityMode: d
28115
+ }), await Vr(e, {
28073
28116
  sourceQuery: n,
28074
28117
  primaryRef: r,
28075
28118
  instancePrimaryRef: {
@@ -28077,7 +28120,9 @@ async function $r(e, t) {
28077
28120
  id: t.id
28078
28121
  },
28079
28122
  structure: m,
28080
- accepted: a
28123
+ accepted: a,
28124
+ matchKey: u,
28125
+ identityMode: d
28081
28126
  });
28082
28127
  }
28083
28128
  return f.map((e) => ({
@@ -28085,14 +28130,14 @@ async function $r(e, t) {
28085
28130
  id: e.id
28086
28131
  }));
28087
28132
  }
28088
- function ei(e) {
28133
+ function oi(e) {
28089
28134
  let { instanceGroups: t, decisions: n } = e;
28090
28135
  return n ? {
28091
- instanceAccepted: Sr({
28136
+ instanceAccepted: Ar({
28092
28137
  groups: t,
28093
28138
  decisions: n
28094
28139
  }),
28095
- instanceOverrides: yr({
28140
+ instanceOverrides: Dr({
28096
28141
  groups: t,
28097
28142
  decisions: n
28098
28143
  })
@@ -28103,24 +28148,25 @@ function ei(e) {
28103
28148
  }
28104
28149
  //#endregion
28105
28150
  //#region src/v2019C1/extensions/lifecycle/update/transaction/asd.ts
28106
- async function ti(e, t) {
28107
- let { sourceQuery: n, applicationRef: r, targetParent: i, scenario: a, report: o, decisions: s, keepNameTypesFrom: c } = t, { uuid: l } = await n.getAttributes(r), u = a === "instantiate" ? [] : await X(e, {
28151
+ async function si(e, t) {
28152
+ let { sourceQuery: n, applicationRef: r, targetParent: i, scenario: a, report: o, decisions: s, keepNameTypesFrom: c } = t, { uuid: l } = await n.getAttributes(r), u = Q(a), d = ii(a), f = a === "instantiate" ? [] : await J(e, {
28108
28153
  tagName: "Application",
28109
- sourceUuid: l
28110
- }), d = o ? U(o) : [];
28111
- if (u.length === 0) {
28112
- let t = s ? Sr({
28113
- groups: d,
28154
+ sourceUuid: l,
28155
+ matchKey: u
28156
+ }), p = o ? G(o) : [];
28157
+ if (f.length === 0) {
28158
+ let t = s ? Ar({
28159
+ groups: p,
28114
28160
  decisions: s
28115
- }) : void 0, a = s ? yr({
28116
- groups: d,
28161
+ }) : void 0, a = s ? Dr({
28162
+ groups: p,
28117
28163
  decisions: s
28118
28164
  }) : void 0;
28119
28165
  if (t && !t.sourceIds.has(r.id)) return {
28120
28166
  applications: [],
28121
28167
  functions: []
28122
28168
  };
28123
- let { applicationRef: o, composedFunctionRefs: l } = await Yr(e, {
28169
+ let { applicationRef: o, composedFunctionRefs: l } = await ni(e, {
28124
28170
  sourceQuery: n,
28125
28171
  applicationRef: r,
28126
28172
  targetParent: i,
@@ -28132,50 +28178,56 @@ async function ti(e, t) {
28132
28178
  functions: l
28133
28179
  };
28134
28180
  }
28135
- let f = await Q(e, i), p = await qr(n, { applicationRef: r }), m = [];
28136
- for (let t of u) {
28137
- let i = mr(o, t.id), a = s ? Sr({
28181
+ let m = await X(e, i), h = await ei(n, { applicationRef: r }), g = [];
28182
+ for (let t of f) {
28183
+ let i = Sr(o, t.id), a = s ? Ar({
28138
28184
  groups: i,
28139
28185
  decisions: s
28140
- }) : void 0, l = s ? yr({
28186
+ }) : void 0, l = s ? Dr({
28141
28187
  groups: i,
28142
28188
  decisions: s
28143
28189
  }) : void 0;
28144
- (!a || a.sourceIds.size > 0 || a.instanceIds.size > 0) && m.push({
28190
+ (!a || a.sourceIds.size > 0 || a.instanceIds.size > 0) && g.push({
28145
28191
  tagName: "Application",
28146
28192
  id: t.id
28147
28193
  });
28148
- let u = await qr(e, { applicationRef: {
28194
+ let f = await ei(e, { applicationRef: {
28149
28195
  tagName: "Application",
28150
28196
  id: t.id
28151
28197
  } });
28152
- await sr(e, {
28198
+ await hr(e, {
28153
28199
  sourceQuery: n,
28154
28200
  sourceRootRef: r,
28155
28201
  instanceRootRef: t,
28156
28202
  accepted: a,
28157
28203
  overrides: l,
28158
- keepNameTypesFrom: c
28159
- }), await Ar(e, {
28204
+ keepNameTypesFrom: c,
28205
+ matchKey: u,
28206
+ identityMode: d
28207
+ }), await Rr(e, {
28160
28208
  sourceQuery: n,
28161
- satelliteRefs: p,
28162
- instanceSatelliteRefs: u,
28163
- structure: f,
28164
- accepted: a
28165
- }), await Nr(e, {
28209
+ satelliteRefs: h,
28210
+ instanceSatelliteRefs: f,
28211
+ structure: m,
28212
+ accepted: a,
28213
+ matchKey: u,
28214
+ identityMode: d
28215
+ }), await Vr(e, {
28166
28216
  sourceQuery: n,
28167
28217
  primaryRef: r,
28168
28218
  instancePrimaryRef: {
28169
28219
  tagName: "Application",
28170
28220
  id: t.id
28171
28221
  },
28172
- structure: f,
28173
- accepted: a
28222
+ structure: m,
28223
+ accepted: a,
28224
+ matchKey: u,
28225
+ identityMode: d
28174
28226
  });
28175
28227
  }
28176
28228
  return {
28177
- applications: m,
28178
- functions: await ni(e, {
28229
+ applications: g,
28230
+ functions: await ci(e, {
28179
28231
  sourceQuery: n,
28180
28232
  applicationRef: r,
28181
28233
  targetParent: i,
@@ -28186,10 +28238,10 @@ async function ti(e, t) {
28186
28238
  })
28187
28239
  };
28188
28240
  }
28189
- async function ni(e, t) {
28190
- let { sourceQuery: n, applicationRef: r, targetParent: i, scenario: a, report: o, decisions: s, keepNameTypesFrom: c } = t, l = await Tr(n, r);
28241
+ async function ci(e, t) {
28242
+ let { sourceQuery: n, applicationRef: r, targetParent: i, scenario: a, report: o, decisions: s, keepNameTypesFrom: c } = t, l = await Nr(n, r);
28191
28243
  if (l.size === 0) return [];
28192
- let u = await Q(e, i), d = [];
28244
+ let u = await X(e, i), d = [];
28193
28245
  for (let t of l) {
28194
28246
  let [r] = await n.any.findByAttributes({
28195
28247
  tagName: "Function",
@@ -28199,10 +28251,10 @@ async function ni(e, t) {
28199
28251
  let i = {
28200
28252
  tagName: "Function",
28201
28253
  id: r.id
28202
- }, l = await $r(e, {
28254
+ }, l = await ai(e, {
28203
28255
  sourceQuery: n,
28204
28256
  functionRef: i,
28205
- targetParent: await Y(n, i, u),
28257
+ targetParent: await q(n, i, u),
28206
28258
  scenario: a,
28207
28259
  report: o,
28208
28260
  decisions: s,
@@ -28214,29 +28266,29 @@ async function ni(e, t) {
28214
28266
  }
28215
28267
  //#endregion
28216
28268
  //#region src/v2019C1/extensions/lifecycle/update/index.ts
28217
- var ri = /* @__PURE__ */ l({
28218
- asd: () => ti,
28219
- fsd: () => $r
28269
+ var li = /* @__PURE__ */ l({
28270
+ asd: () => si,
28271
+ fsd: () => ai
28220
28272
  });
28221
28273
  //#endregion
28222
28274
  //#region src/v2019C1/extensions/lifecycle/apply/apply.ts
28223
- async function ii(e, t) {
28275
+ async function ui(e, t) {
28224
28276
  let { report: n, decisions: r } = t;
28225
- return r ? (br({
28226
- groups: U(n),
28277
+ return r ? (Or({
28278
+ groups: G(n),
28227
28279
  decisions: r
28228
28280
  }), {
28229
28281
  report: n,
28230
- instances: await oi(e, t, n, r)
28282
+ instances: await fi(e, t, n, r)
28231
28283
  }) : n.needsDecisions ? {
28232
28284
  report: n,
28233
- instances: ai(t.verb)
28285
+ instances: di(t.verb)
28234
28286
  } : {
28235
28287
  report: n,
28236
- instances: await oi(e, t, n, void 0)
28288
+ instances: await fi(e, t, n, void 0)
28237
28289
  };
28238
28290
  }
28239
- function ai(e) {
28291
+ function di(e) {
28240
28292
  return e === "fsd" ? {
28241
28293
  verb: "fsd",
28242
28294
  functions: []
@@ -28246,10 +28298,10 @@ function ai(e) {
28246
28298
  functions: []
28247
28299
  };
28248
28300
  }
28249
- async function oi(e, t, n, r) {
28301
+ async function fi(e, t, n, r) {
28250
28302
  if (t.verb === "fsd") return {
28251
28303
  verb: "fsd",
28252
- functions: await $r(e, {
28304
+ functions: await ai(e, {
28253
28305
  sourceQuery: t.sourceQuery,
28254
28306
  functionRef: t.ref,
28255
28307
  targetParent: t.anchor,
@@ -28259,7 +28311,7 @@ async function oi(e, t, n, r) {
28259
28311
  keepNameTypesFrom: t.keepNameTypesFrom
28260
28312
  })
28261
28313
  };
28262
- let { applications: i, functions: a } = await ti(e, {
28314
+ let { applications: i, functions: a } = await si(e, {
28263
28315
  sourceQuery: t.sourceQuery,
28264
28316
  applicationRef: t.ref,
28265
28317
  targetParent: t.anchor,
@@ -28276,41 +28328,41 @@ async function oi(e, t, n, r) {
28276
28328
  }
28277
28329
  //#endregion
28278
28330
  //#region src/v2019C1/extensions/lifecycle/extract/transaction/ensure-substation-structure.ts
28279
- async function si(e) {
28331
+ async function pi(e) {
28280
28332
  let t = await e.getRoot(), n = await e.ensureChild(t, {
28281
28333
  tagName: "Substation",
28282
- attributes: { name: "TEMPLATE" }
28334
+ attributes: { name: he }
28283
28335
  }), r = await e.ensureChild(n, {
28284
28336
  tagName: "VoltageLevel",
28285
- attributes: { name: "TEMPLATE" }
28337
+ attributes: { name: he }
28286
28338
  });
28287
28339
  return {
28288
28340
  Substation: n,
28289
28341
  VoltageLevel: r,
28290
28342
  Bay: await e.ensureChild(r, {
28291
28343
  tagName: "Bay",
28292
- attributes: { name: "TEMPLATE" }
28344
+ attributes: { name: he }
28293
28345
  })
28294
28346
  };
28295
28347
  }
28296
28348
  //#endregion
28297
28349
  //#region src/v2019C1/extensions/lifecycle/extract/transaction/post-extraction-cleanup.ts
28298
- async function ci(e) {
28299
- await xt.transaction.orphanUuidRefs(e), await xt.transaction.resetLNode(e), await xt.transaction.pruneEmptyContainers(e);
28350
+ async function mi(e) {
28351
+ await R.transaction.orphanUuidRefs(e), await R.transaction.resetLNode(e), await R.transaction.pruneEmptyContainers(e);
28300
28352
  }
28301
28353
  //#endregion
28302
28354
  //#region src/v2019C1/extensions/lifecycle/layers/omit-filters.ts
28303
- var li = [
28355
+ var hi = [
28304
28356
  "FunctionSclRef",
28305
28357
  "ApplicationSclRef",
28306
28358
  "GeneralEquipment",
28307
28359
  "ConductingEquipment"
28308
- ];
28360
+ ], gi = ["FunctionSclRef", "ApplicationSclRef"];
28309
28361
  //#endregion
28310
28362
  //#region src/v2019C1/extensions/lifecycle/extract/transaction/asd.ts
28311
- async function ui(e, t) {
28312
- let { sourceQuery: n, applicationRef: r, tool: i, who: a, nameStructure: o } = t, s = await si(e), c = await e.getAttribute(r, { name: "name" }) || "Unnamed Application";
28313
- await en.transaction.addEntry(e, {
28363
+ async function _i(e, t) {
28364
+ let { sourceQuery: n, applicationRef: r, tool: i, who: a, nameStructure: o } = t, s = await pi(e), c = await e.getAttribute(r, { name: "name" }) || "Unnamed Application";
28365
+ await H.transaction.addEntry(e, {
28314
28366
  filename: `ASD_${c.replace(/\s+/g, "_")}`,
28315
28367
  header: {
28316
28368
  fileType: "ASD",
@@ -28323,17 +28375,17 @@ async function ui(e, t) {
28323
28375
  what: "ASD initialization",
28324
28376
  why: "Application was extracted from a previous file"
28325
28377
  }
28326
- }), await R(e, { mappings: await Wr(e, {
28378
+ }), await I(e, { mappings: await Zr(e, {
28327
28379
  sourceQuery: n,
28328
28380
  applicationRef: r,
28329
28381
  structure: s,
28330
- omit: li
28331
- }) }), await ci(e);
28382
+ omit: hi
28383
+ }) }), await mi(e);
28332
28384
  }
28333
28385
  //#endregion
28334
28386
  //#region src/v2019C1/extensions/lifecycle/extract/transaction/omit.ts
28335
- var di = [
28336
- ...li,
28387
+ var vi = [
28388
+ ...hi,
28337
28389
  "DOS",
28338
28390
  "Labels",
28339
28391
  "LNodeInputs",
@@ -28345,12 +28397,12 @@ var di = [
28345
28397
  ];
28346
28398
  //#endregion
28347
28399
  //#region src/v2019C1/extensions/lifecycle/extract/transaction/fsd.ts
28348
- async function fi(e, t) {
28349
- let { sourceQuery: n, functionRef: r, tool: i, who: a, nameStructure: o } = t, s = await si(e), c = {
28400
+ async function yi(e, t) {
28401
+ let { sourceQuery: n, functionRef: r, tool: i, who: a, nameStructure: o } = t, s = await pi(e), c = {
28350
28402
  tagName: s.Substation.tagName,
28351
28403
  id: s.Substation.id
28352
28404
  }, l = await n.getAttribute(r, { name: "name" }) || "Unnamed Function";
28353
- await en.transaction.addEntry(e, {
28405
+ await H.transaction.addEntry(e, {
28354
28406
  filename: `FSD_${l.replace(/\s+/g, "_")}`,
28355
28407
  header: {
28356
28408
  fileType: "FSD",
@@ -28364,40 +28416,142 @@ async function fi(e, t) {
28364
28416
  why: "Function was extracted from a previous file"
28365
28417
  }
28366
28418
  });
28367
- let u = await Ir(e, {
28419
+ let u = await Wr(e, {
28368
28420
  sourceQuery: n,
28369
28421
  functionRef: r,
28370
28422
  targetParentRef: c,
28371
- omit: di,
28423
+ omit: vi,
28372
28424
  stripRootAttributes: ["templateUuid"]
28373
- }), d = await Lr(e, {
28425
+ }), d = await Z(e, {
28374
28426
  sourceQuery: n,
28375
28427
  functionRef: r,
28376
28428
  structure: s
28377
28429
  });
28378
- await R(e, { mappings: [...u, ...d] }), await ci(e);
28430
+ await I(e, { mappings: [...u, ...d] }), await mi(e);
28431
+ }
28432
+ //#endregion
28433
+ //#region src/v2019C1/extensions/lifecycle/layers/topology/clone-topology-content.ts
28434
+ async function bi(e, t) {
28435
+ let { sourceQuery: n, scopeRef: r, structure: i, omit: a } = t, o = [], s = /* @__PURE__ */ new Set();
28436
+ function c(e) {
28437
+ for (let t of e) o.push(t), t.source.id && s.add(t.source.id);
28438
+ }
28439
+ for (let t of await xi(n, r)) c(await Zr(e, {
28440
+ sourceQuery: n,
28441
+ applicationRef: t,
28442
+ structure: i,
28443
+ omit: a
28444
+ }));
28445
+ for (let t of await Si(n, r)) s.has(t.id) || (c(await Wr(e, {
28446
+ sourceQuery: n,
28447
+ functionRef: t,
28448
+ targetParentRef: await q(n, t, i),
28449
+ omit: a
28450
+ })), c(await Z(e, {
28451
+ sourceQuery: n,
28452
+ functionRef: t,
28453
+ structure: i,
28454
+ stripCategoriesUuid: !1
28455
+ })));
28456
+ for (let t of await Ci(n, r)) {
28457
+ let r = await K(e, {
28458
+ sourceQuery: n,
28459
+ ref: t,
28460
+ targetParent: await q(n, t, i),
28461
+ omit: a
28462
+ });
28463
+ r && c(r.mappings);
28464
+ }
28465
+ return o;
28466
+ }
28467
+ async function xi(e, t) {
28468
+ let n = await e.getRecordsByTagName("Application"), r = [];
28469
+ for (let i of n) (await e.findAncestors(i, { stopAtTagName: "Substation" })).some((e) => e.id === t.id) && r.push({
28470
+ tagName: "Application",
28471
+ id: i.id
28472
+ });
28473
+ return r;
28474
+ }
28475
+ async function Si(e, t) {
28476
+ let n = await e.getRecordsByTagName("Function"), r = [];
28477
+ for (let i of n) (await e.findAncestors(i, { stopAtTagName: "Substation" })).some((e) => e.id === t.id) && r.push({
28478
+ tagName: "Function",
28479
+ id: i.id
28480
+ });
28481
+ return r;
28482
+ }
28483
+ async function Ci(e, t) {
28484
+ let n = [];
28485
+ for (let r of _e) {
28486
+ let i = await e.getRecordsByTagName(r);
28487
+ for (let a of i) {
28488
+ let i = await e.findAncestors(a, { stopAtTagName: "Substation" });
28489
+ i.some((e) => e.id === t.id) && i[0] && ge.includes(i[0].tagName) && n.push({
28490
+ tagName: r,
28491
+ id: a.id
28492
+ });
28493
+ }
28494
+ }
28495
+ return n;
28496
+ }
28497
+ //#endregion
28498
+ //#region src/v2019C1/extensions/lifecycle/extract/transaction/ssd.ts
28499
+ async function wi(e, t) {
28500
+ let { sourceQuery: n, scopeRef: r, tool: i, who: a, nameStructure: o } = t, s = await pi(e), c = await n.getAttribute(r, { name: "name" }) || "Unnamed", l = await Ti(n);
28501
+ await H.transaction.addEntry(e, {
28502
+ filename: `SSD_${c.replace(/\s+/g, "_")}`,
28503
+ header: {
28504
+ fileType: "SSD",
28505
+ version: "keep",
28506
+ tool: i,
28507
+ ...o ? { nameStructure: o } : {}
28508
+ },
28509
+ item: {
28510
+ who: a,
28511
+ what: "SSD initialization",
28512
+ why: "Process scope was extracted from a previous file"
28513
+ }
28514
+ });
28515
+ let u = await bi(e, {
28516
+ sourceQuery: n,
28517
+ scopeRef: r,
28518
+ structure: s,
28519
+ omit: gi
28520
+ }), d = s[r.tagName];
28521
+ return await e.update({
28522
+ tagName: r.tagName,
28523
+ id: d.id
28524
+ }, { attributes: {
28525
+ name: c,
28526
+ templateUuid: void 0
28527
+ } }), await I(e, { mappings: u }), await mi(e), { warnings: l };
28528
+ }
28529
+ async function Ti(e) {
28530
+ let t = await e.getRecordsByTagName("IED"), n = await e.getRecordsByTagName("Communication");
28531
+ return t.length === 0 && n.length === 0 ? [] : [`Skipped ${t.length} IED and ${n.length} Communication section(s): not yet carried into an SSD (available once the IED/ISD layer exists).`];
28379
28532
  }
28380
28533
  //#endregion
28381
28534
  //#region src/v2019C1/extensions/lifecycle/extract/index.ts
28382
- var pi = /* @__PURE__ */ l({
28383
- asd: () => ui,
28384
- ensureSubstationTemplateStructure: () => si,
28385
- fsd: () => fi
28386
- }), mi = /* @__PURE__ */ l({
28387
- asd: () => Yr,
28388
- fsd: () => Ur,
28389
- resolveTargetStructure: () => Q
28535
+ var Ei = /* @__PURE__ */ l({
28536
+ asd: () => _i,
28537
+ ensureSubstationTemplateStructure: () => pi,
28538
+ fsd: () => yi,
28539
+ ssd: () => wi
28540
+ }), Di = /* @__PURE__ */ l({
28541
+ asd: () => ni,
28542
+ fsd: () => Xr,
28543
+ resolveTargetStructure: () => X
28390
28544
  });
28391
28545
  //#endregion
28392
28546
  //#region src/v2019C1/extensions/lifecycle/report/mark-placement-conflicts.ts
28393
- async function hi(e, t, n) {
28394
- if (t.scenario === "instantiate") for (let r of U(n)) {
28547
+ async function Oi(e, t, n) {
28548
+ if (t.scenario === "instantiate") for (let r of G(n)) {
28395
28549
  if (r.change !== "added") continue;
28396
28550
  let i = r.primary.sourceRef;
28397
28551
  if (!i) continue;
28398
28552
  let a = await t.sourceQuery.getAttributes(i), o = a.uuid;
28399
28553
  if (!o) continue;
28400
- let s = r.primary.tagName, [c] = await X(e, {
28554
+ let s = r.primary.tagName, [c] = await J(e, {
28401
28555
  tagName: s,
28402
28556
  sourceUuid: o
28403
28557
  });
@@ -28410,7 +28564,7 @@ async function hi(e, t, n) {
28410
28564
  let n = {
28411
28565
  tagName: t.tagName,
28412
28566
  id: t.id
28413
- }, r = await G(e, {
28567
+ }, r = await Yn(e, {
28414
28568
  parentRef: n,
28415
28569
  childTag: s,
28416
28570
  candidate: a
@@ -28421,9 +28575,9 @@ async function hi(e, t, n) {
28421
28575
  }
28422
28576
  }
28423
28577
  if (!d || !u) continue;
28424
- let f = d.fields.find((e) => Bn(W(s, e)));
28578
+ let f = d.fields.find((e) => Wn(Un(s, e)));
28425
28579
  if (f) {
28426
- let t = await Xn(e, {
28580
+ let t = await tr(e, {
28427
28581
  parentRef: u,
28428
28582
  childTag: s,
28429
28583
  candidate: a,
@@ -28438,23 +28592,23 @@ async function hi(e, t, n) {
28438
28592
  }
28439
28593
  //#endregion
28440
28594
  //#region src/v2019C1/extensions/lifecycle/report/query/satellite-companions.ts
28441
- async function gi(e, t) {
28595
+ async function ki(e, t) {
28442
28596
  let { sourceQuery: n, primaryRef: r, satelliteRefs: i, instanceSatelliteRefs: a, report: o, instanceScopeId: s } = t, c = o.groups.find((e) => e.primary.sourceRef?.id === r.id);
28443
28597
  for (let r of i) {
28444
- let { uuid: i, name: a } = await n.any.getAttributes(r), l = await _n({
28598
+ let { uuid: i, name: a } = await n.any.getAttributes(r), l = await bn({
28445
28599
  sourceQuery: n,
28446
28600
  targetQuery: e,
28447
28601
  sourceRootRef: r,
28448
- instanceRootRef: await kr(e, {
28602
+ instanceRootRef: await Lr(e, {
28449
28603
  tagName: r.tagName,
28450
28604
  sourceUuid: i,
28451
28605
  sourceName: a
28452
28606
  }),
28453
28607
  keepLeftoverRefs: !0,
28454
- leftoverRefPolicy: await _i(e, n, r),
28608
+ leftoverRefPolicy: await Ai(e, n, r),
28455
28609
  refsAlwaysAdded: t.refsAlwaysAdded ?? !1
28456
28610
  });
28457
- l.summary.added + l.summary.removed + l.summary.modified > 0 && (c ? c.companions.push(l.root) : o.groups.push(...ln(l.root, s)));
28611
+ l.summary.added + l.summary.removed + l.summary.modified > 0 && (c ? c.companions.push(l.root) : o.groups.push(...fn(l.root, s)));
28458
28612
  }
28459
28613
  if (c) for (let t of a ?? []) {
28460
28614
  let { templateUuid: r } = await e.any.getAttributes(t);
@@ -28472,31 +28626,31 @@ async function gi(e, t) {
28472
28626
  }
28473
28627
  return o;
28474
28628
  }
28475
- async function _i(e, t, n) {
28629
+ async function Ai(e, t, n) {
28476
28630
  let r = await t.any.getTree(n), i = /* @__PURE__ */ new Set();
28477
- return r && await vi(t, r, i), async (n) => {
28631
+ return r && await ji(t, r, i), async (n) => {
28478
28632
  let r = D[n.tagName];
28479
28633
  if (!r) return "keep";
28480
28634
  for (let a of r) {
28481
28635
  let r = await e.any.getAttribute(n, { name: a.attribute.uuid });
28482
28636
  if (!r) continue;
28483
- let o = await yi(e, r, a.target);
28637
+ let o = await Mi(e, r, a.target);
28484
28638
  if (!o) continue;
28485
28639
  let s = await e.any.getAttribute(o, { name: "templateUuid" });
28486
- if (s && await yi(t, s, a.target) && !i.has(s)) return "removed";
28640
+ if (s && await Mi(t, s, a.target) && !i.has(s)) return "removed";
28487
28641
  }
28488
28642
  return "keep";
28489
28643
  };
28490
28644
  }
28491
- async function vi(e, t, n) {
28645
+ async function ji(e, t, n) {
28492
28646
  let r = D[t.tagName];
28493
28647
  if (r) for (let i of r) {
28494
28648
  let r = await e.any.getAttribute(t, { name: i.attribute.uuid });
28495
28649
  r && n.add(r);
28496
28650
  }
28497
- for (let r of t.tree) await vi(e, r, n);
28651
+ for (let r of t.tree) await ji(e, r, n);
28498
28652
  }
28499
- async function yi(e, t, n) {
28653
+ async function Mi(e, t, n) {
28500
28654
  for (let r of n) {
28501
28655
  let [n] = await e.any.findByAttributes({
28502
28656
  tagName: r,
@@ -28507,13 +28661,13 @@ async function yi(e, t, n) {
28507
28661
  }
28508
28662
  //#endregion
28509
28663
  //#region src/v2019C1/extensions/lifecycle/report/query/cross-cutting-satellites.ts
28510
- async function bi(e, t) {
28664
+ async function Ni(e, t) {
28511
28665
  let { sourceQuery: n, primaryRef: r, instancePrimaryRef: i, report: a } = t;
28512
- return gi(e, {
28666
+ return ki(e, {
28513
28667
  sourceQuery: n,
28514
28668
  primaryRef: r,
28515
- satelliteRefs: await Z(n, { primaryRef: r }),
28516
- instanceSatelliteRefs: i ? await Z(e, { primaryRef: i }) : [],
28669
+ satelliteRefs: await Y(n, { primaryRef: r }),
28670
+ instanceSatelliteRefs: i ? await Y(e, { primaryRef: i }) : [],
28517
28671
  report: a,
28518
28672
  instanceScopeId: i?.id,
28519
28673
  refsAlwaysAdded: t.refsAlwaysAdded ?? !1
@@ -28521,13 +28675,13 @@ async function bi(e, t) {
28521
28675
  }
28522
28676
  //#endregion
28523
28677
  //#region src/v2019C1/extensions/lifecycle/report/query/report-function-satellites.ts
28524
- async function xi(e, t) {
28678
+ async function Pi(e, t) {
28525
28679
  let { sourceQuery: n, functionRef: r, instance: i, report: a } = t;
28526
- return gi(e, {
28680
+ return ki(e, {
28527
28681
  sourceQuery: n,
28528
28682
  primaryRef: r,
28529
- satelliteRefs: await Hr(n, { primaryRef: r }),
28530
- instanceSatelliteRefs: i ? await Hr(e, { primaryRef: {
28683
+ satelliteRefs: await Yr(n, { primaryRef: r }),
28684
+ instanceSatelliteRefs: i ? await Yr(e, { primaryRef: {
28531
28685
  tagName: "Function",
28532
28686
  id: i.id
28533
28687
  } }) : [],
@@ -28538,12 +28692,12 @@ async function xi(e, t) {
28538
28692
  }
28539
28693
  //#endregion
28540
28694
  //#region src/v2019C1/extensions/lifecycle/report/query/report-function.ts
28541
- async function Si(e, t) {
28542
- let { sourceQuery: n, functionRef: r, instance: i } = t, a = t.refsAlwaysAdded ?? !1, o = await xi(e, {
28695
+ async function Fi(e, t) {
28696
+ let { sourceQuery: n, functionRef: r, instance: i } = t, a = t.refsAlwaysAdded ?? !1, o = await Pi(e, {
28543
28697
  sourceQuery: n,
28544
28698
  functionRef: r,
28545
28699
  instance: i,
28546
- report: await _n({
28700
+ report: await bn({
28547
28701
  sourceQuery: n,
28548
28702
  targetQuery: e,
28549
28703
  sourceRootRef: r,
@@ -28552,7 +28706,7 @@ async function Si(e, t) {
28552
28706
  }),
28553
28707
  refsAlwaysAdded: a
28554
28708
  });
28555
- return bi(e, {
28709
+ return Ni(e, {
28556
28710
  sourceQuery: n,
28557
28711
  primaryRef: r,
28558
28712
  instancePrimaryRef: i ? {
@@ -28565,7 +28719,7 @@ async function Si(e, t) {
28565
28719
  }
28566
28720
  //#endregion
28567
28721
  //#region src/v2019C1/extensions/presentation/constants/title.ts
28568
- var Ci = {
28722
+ var Ii = {
28569
28723
  LNode: {
28570
28724
  compact: [
28571
28725
  "prefix",
@@ -28662,29 +28816,29 @@ var Ci = {
28662
28816
  };
28663
28817
  //#endregion
28664
28818
  //#region src/v2019C1/extensions/presentation/query/extract-element-title.ts
28665
- async function wi(e, t, n = {}) {
28819
+ async function Li(e, t, n = {}) {
28666
28820
  let r = await e.getRecord(t);
28667
28821
  if (!r) return n.withLabels ? {
28668
28822
  title: "",
28669
28823
  labels: {}
28670
28824
  } : "";
28671
- let i = r.tagName, a = n.mode ?? "compact", o = await e.any.getAttributes(r), s = Ci[i], c = Ti({
28825
+ let i = r.tagName, a = n.mode ?? "compact", o = await e.any.getAttributes(r), s = Ii[i], c = Ri({
28672
28826
  tag: i,
28673
28827
  spec: s,
28674
28828
  mode: a,
28675
28829
  attributes: o,
28676
- specAttributes: s?.attributesFrom ? await Ei(e, r, s.attributesFrom) : o,
28830
+ specAttributes: s?.attributesFrom ? await zi(e, r, s.attributesFrom) : o,
28677
28831
  value: r.value
28678
28832
  });
28679
28833
  return n.withLabels ? {
28680
28834
  title: c,
28681
- labels: await Di(e, r)
28835
+ labels: await Bi(e, r)
28682
28836
  } : c;
28683
28837
  }
28684
- function Ti(e) {
28838
+ function Ri(e) {
28685
28839
  let { tag: t, spec: n, mode: r, attributes: i, specAttributes: a, value: o } = e;
28686
28840
  if (n) {
28687
- let e = Ai(n, a, r);
28841
+ let e = Ui(n, a, r);
28688
28842
  if (e) return e;
28689
28843
  }
28690
28844
  let s = (o ?? "").trim();
@@ -28692,14 +28846,14 @@ function Ti(e) {
28692
28846
  let c = _[t]?.attributes?.identityFields, l = c?.find((e) => e === "name" || e === "id") ?? c?.[0];
28693
28847
  return l && i[l] ? i[l] : i.name || t;
28694
28848
  }
28695
- async function Ei(e, t, n) {
28849
+ async function zi(e, t, n) {
28696
28850
  let [r] = await e.any.getChildren(t, n);
28697
28851
  return r ? e.any.getAttributes(r) : {};
28698
28852
  }
28699
- async function Di(e, t) {
28700
- return ki(await Oi(e, t));
28853
+ async function Bi(e, t) {
28854
+ return Hi(await Vi(e, t));
28701
28855
  }
28702
- async function Oi(e, t) {
28856
+ async function Vi(e, t) {
28703
28857
  let n = [], r = await e.any.getChildren(t, "Labels");
28704
28858
  for (let t of r) {
28705
28859
  let r = await e.any.getChildren(t, "Label");
@@ -28714,18 +28868,18 @@ async function Oi(e, t) {
28714
28868
  }
28715
28869
  return n;
28716
28870
  }
28717
- function ki(e) {
28871
+ function Hi(e) {
28718
28872
  let t = {};
28719
28873
  for (let { lang: n, id: r, text: i } of e) (t[n] ??= {})[r] = i;
28720
28874
  return t;
28721
28875
  }
28722
- function Ai(e, t, n) {
28876
+ function Ui(e, t, n) {
28723
28877
  let r = n === "full" && e.full !== void 0, i = r ? e.full : e.compact, a = r ? e.fullSeparator ?? e.separator ?? "" : e.separator ?? "";
28724
- if (typeof i == "string") return Mi(i, t);
28725
- if (ji(i)) {
28878
+ if (typeof i == "string") return Gi(i, t);
28879
+ if (Wi(i)) {
28726
28880
  for (let e of i) {
28727
28881
  if (e.whenPresent && !t[e.whenPresent]) continue;
28728
- let n = Mi(e.template, t);
28882
+ let n = Gi(e.template, t);
28729
28883
  if (n) return n;
28730
28884
  }
28731
28885
  return "";
@@ -28733,22 +28887,22 @@ function Ai(e, t, n) {
28733
28887
  let o = i.map((e) => t[e]).filter(Boolean);
28734
28888
  return o.length > 0 ? o.join(a) : "";
28735
28889
  }
28736
- function ji(e) {
28890
+ function Wi(e) {
28737
28891
  return typeof e[0] == "object";
28738
28892
  }
28739
- function Mi(e, t) {
28893
+ function Gi(e, t) {
28740
28894
  return e.replace(/\{([a-zA-Z_][a-zA-Z0-9_]*)\}/g, (e, n) => t[n] ?? "").replace(/\[\]/g, "").replace(/\(\)/g, "").split("/").map((e) => e.split(".").filter((e) => e !== "").join(".")).filter((e) => e !== "").join("/");
28741
28895
  }
28742
28896
  //#endregion
28743
28897
  //#region src/v2019C1/extensions/presentation/query/index.ts
28744
- var Ni = /* @__PURE__ */ l({ extractElementTitle: () => wi });
28898
+ var Ki = /* @__PURE__ */ l({ extractElementTitle: () => Li });
28745
28899
  //#endregion
28746
28900
  //#region src/v2019C1/extensions/lifecycle/report/query/report-instance.ts
28747
28901
  async function $(e, t) {
28748
28902
  let { instanceDiff: n, instance: r, sourceQuery: i, sourceRef: o } = t, s = n.groups.length === 0;
28749
28903
  if (!r) return {
28750
28904
  rootRef: void 0,
28751
- title: await wi(i, o),
28905
+ title: await Li(i, o),
28752
28906
  linked: !1,
28753
28907
  upToDate: s,
28754
28908
  tree: n.root,
@@ -28757,7 +28911,7 @@ async function $(e, t) {
28757
28911
  let { templateUuid: c, originUuid: l } = await e.any.getAttributes(r), u = !!(c || l);
28758
28912
  return {
28759
28913
  rootRef: a(r),
28760
- title: await wi(e, r),
28914
+ title: await Li(e, r),
28761
28915
  linked: u,
28762
28916
  upToDate: s,
28763
28917
  tree: n.root,
@@ -28766,64 +28920,68 @@ async function $(e, t) {
28766
28920
  }
28767
28921
  //#endregion
28768
28922
  //#region src/v2019C1/extensions/lifecycle/report/query/report-asd.ts
28769
- async function Pi(e, t) {
28770
- let { sourceQuery: n, applicationRef: r, scenario: i } = t, { uuid: a } = await n.getAttributes(r), o = i === "instantiate" ? [] : await X(e, {
28923
+ async function qi(e, t) {
28924
+ let { sourceQuery: n, applicationRef: r, scenario: i } = t, { uuid: a } = await n.getAttributes(r), o = Q(i), s = i === "instantiate" ? [] : await J(e, {
28771
28925
  tagName: "Application",
28772
- sourceUuid: a
28773
- }), s = [];
28774
- if (o.length === 0) {
28775
- let t = await Fi(e, {
28926
+ sourceUuid: a,
28927
+ matchKey: o
28928
+ }), c = [];
28929
+ if (s.length === 0) {
28930
+ let t = await Ji(e, {
28776
28931
  sourceQuery: n,
28777
28932
  applicationRef: r,
28778
28933
  instance: void 0,
28779
- refsAlwaysAdded: i === "instantiate"
28934
+ refsAlwaysAdded: i === "instantiate",
28935
+ matchKey: o
28780
28936
  });
28781
- s.push(await $(e, {
28937
+ c.push(await $(e, {
28782
28938
  instanceDiff: t,
28783
28939
  instance: void 0,
28784
28940
  sourceQuery: n,
28785
28941
  sourceRef: r
28786
28942
  }));
28787
- } else for (let t of o) {
28788
- let a = await Fi(e, {
28943
+ } else for (let t of s) {
28944
+ let a = await Ji(e, {
28789
28945
  sourceQuery: n,
28790
28946
  applicationRef: r,
28791
28947
  instance: t,
28792
- refsAlwaysAdded: i === "instantiate"
28948
+ refsAlwaysAdded: i === "instantiate",
28949
+ matchKey: o
28793
28950
  });
28794
- s.push(await $(e, {
28951
+ c.push(await $(e, {
28795
28952
  instanceDiff: a,
28796
28953
  instance: t,
28797
28954
  sourceQuery: n,
28798
28955
  sourceRef: r
28799
28956
  }));
28800
28957
  }
28801
- let c = await Ii(e, {
28958
+ let l = await Yi(e, {
28802
28959
  sourceQuery: n,
28803
28960
  applicationRef: r,
28804
28961
  scenario: i
28805
28962
  });
28806
- return Pn([...s, ...c]);
28963
+ return Ln([...c, ...l]);
28807
28964
  }
28808
- async function Fi(e, t) {
28809
- let { sourceQuery: n, applicationRef: r, instance: i } = t, a = t.refsAlwaysAdded ?? !1, o = await _n({
28965
+ async function Ji(e, t) {
28966
+ let { sourceQuery: n, applicationRef: r, instance: i } = t, a = t.refsAlwaysAdded ?? !1, o = await bn({
28810
28967
  sourceQuery: n,
28811
28968
  targetQuery: e,
28812
28969
  sourceRootRef: r,
28813
- instanceRootRef: i
28970
+ instanceRootRef: i,
28971
+ matchKey: t.matchKey
28814
28972
  });
28815
- return await gi(e, {
28973
+ return await ki(e, {
28816
28974
  sourceQuery: n,
28817
28975
  primaryRef: r,
28818
- satelliteRefs: await qr(n, { applicationRef: r }),
28819
- instanceSatelliteRefs: i ? await qr(e, { applicationRef: {
28976
+ satelliteRefs: await ei(n, { applicationRef: r }),
28977
+ instanceSatelliteRefs: i ? await ei(e, { applicationRef: {
28820
28978
  tagName: "Application",
28821
28979
  id: i.id
28822
28980
  } }) : [],
28823
28981
  report: o,
28824
28982
  instanceScopeId: i?.id,
28825
28983
  refsAlwaysAdded: a
28826
- }), await bi(e, {
28984
+ }), await Ni(e, {
28827
28985
  sourceQuery: n,
28828
28986
  primaryRef: r,
28829
28987
  instancePrimaryRef: i ? {
@@ -28834,64 +28992,67 @@ async function Fi(e, t) {
28834
28992
  refsAlwaysAdded: a
28835
28993
  }), o;
28836
28994
  }
28837
- async function Ii(e, t) {
28838
- let { sourceQuery: n, applicationRef: r, scenario: i } = t, a = await Tr(n, r), o = [];
28839
- for (let t of a) {
28995
+ async function Yi(e, t) {
28996
+ let { sourceQuery: n, applicationRef: r, scenario: i } = t, a = Q(i), o = await Nr(n, r), s = [];
28997
+ for (let t of o) {
28840
28998
  let [r] = await n.any.findByAttributes({
28841
28999
  tagName: "Function",
28842
29000
  attributes: { uuid: t }
28843
29001
  });
28844
29002
  if (!r) continue;
28845
- let a = {
29003
+ let o = {
28846
29004
  tagName: "Function",
28847
29005
  id: r.id
28848
- }, s = i === "instantiate" ? [] : await X(e, {
29006
+ }, c = i === "instantiate" ? [] : await J(e, {
28849
29007
  tagName: "Function",
28850
- sourceUuid: t
29008
+ sourceUuid: t,
29009
+ matchKey: a
28851
29010
  });
28852
- if (s.length === 0) {
28853
- let t = await Si(e, {
29011
+ if (c.length === 0) {
29012
+ let t = await Fi(e, {
28854
29013
  sourceQuery: n,
28855
- functionRef: a,
29014
+ functionRef: o,
28856
29015
  instance: void 0,
28857
- refsAlwaysAdded: i === "instantiate"
29016
+ refsAlwaysAdded: i === "instantiate",
29017
+ matchKey: a
28858
29018
  });
28859
- o.push(await $(e, {
29019
+ s.push(await $(e, {
28860
29020
  instanceDiff: t,
28861
29021
  instance: void 0,
28862
29022
  sourceQuery: n,
28863
- sourceRef: a
29023
+ sourceRef: o
28864
29024
  }));
28865
29025
  continue;
28866
29026
  }
28867
- for (let t of s) {
28868
- let r = await Si(e, {
29027
+ for (let t of c) {
29028
+ let r = await Fi(e, {
28869
29029
  sourceQuery: n,
28870
- functionRef: a,
29030
+ functionRef: o,
28871
29031
  instance: t,
28872
- refsAlwaysAdded: i === "instantiate"
29032
+ refsAlwaysAdded: i === "instantiate",
29033
+ matchKey: a
28873
29034
  });
28874
- o.push(await $(e, {
29035
+ s.push(await $(e, {
28875
29036
  instanceDiff: r,
28876
29037
  instance: t,
28877
29038
  sourceQuery: n,
28878
- sourceRef: a
29039
+ sourceRef: o
28879
29040
  }));
28880
29041
  }
28881
29042
  }
28882
- return o;
29043
+ return s;
28883
29044
  }
28884
29045
  //#endregion
28885
29046
  //#region src/v2019C1/extensions/lifecycle/report/query/report-fsd.ts
28886
- async function Li(e, t) {
28887
- let { sourceQuery: n, functionRef: r, targetParent: i, scenario: a } = t, { uuid: o } = await n.getAttributes(r), s = Zr(a), c = a === "instantiate" ? [] : await Dr(e, {
29047
+ async function Xi(e, t) {
29048
+ let { sourceQuery: n, functionRef: r, targetParent: i, scenario: a } = t, { uuid: o } = await n.getAttributes(r), s = Q(a), c = a === "instantiate" ? [] : await Fr(e, {
28888
29049
  targetParent: i,
28889
29050
  tagName: "Function",
28890
29051
  sourceUuid: o,
28891
29052
  matchKey: s
28892
29053
  });
28893
- if (c.length === 0) return Pn([await $(e, {
28894
- instanceDiff: await Si(e, {
29054
+ if (c.length === 0) return Ln([await $(e, {
29055
+ instanceDiff: await Fi(e, {
28895
29056
  sourceQuery: n,
28896
29057
  functionRef: r,
28897
29058
  instance: void 0,
@@ -28904,7 +29065,7 @@ async function Li(e, t) {
28904
29065
  })]);
28905
29066
  let l = [];
28906
29067
  for (let t of c) {
28907
- let i = await Si(e, {
29068
+ let i = await Fi(e, {
28908
29069
  sourceQuery: n,
28909
29070
  functionRef: r,
28910
29071
  instance: t,
@@ -28918,27 +29079,27 @@ async function Li(e, t) {
28918
29079
  sourceRef: r
28919
29080
  }));
28920
29081
  }
28921
- return Pn(l);
29082
+ return Ln(l);
28922
29083
  }
28923
29084
  //#endregion
28924
29085
  //#region src/v2019C1/extensions/lifecycle/report/report.ts
28925
- async function Ri(e, t) {
28926
- let n = t.verb === "fsd" ? await Li(e, {
29086
+ async function Zi(e, t) {
29087
+ let n = t.verb === "fsd" ? await Xi(e, {
28927
29088
  sourceQuery: t.sourceQuery,
28928
29089
  functionRef: t.ref,
28929
29090
  targetParent: t.anchor,
28930
29091
  scenario: t.scenario
28931
- }) : await Pi(e, {
29092
+ }) : await qi(e, {
28932
29093
  sourceQuery: t.sourceQuery,
28933
29094
  applicationRef: t.ref,
28934
29095
  scenario: t.scenario
28935
29096
  });
28936
- for (let e of U(n)) e.editableAttributes = Vn(e.primary.tagName);
28937
- return await hi(e, t, n), n;
29097
+ for (let e of G(n)) e.editableAttributes = Gn(e.primary.tagName);
29098
+ return await Oi(e, t, n), n;
28938
29099
  }
28939
29100
  //#endregion
28940
29101
  //#region src/v2019C1/extensions/lifecycle/report/presentation-scope.ts
28941
- function zi(e) {
29102
+ function Qi(e) {
28942
29103
  switch (e.verb) {
28943
29104
  case "fsd":
28944
29105
  case "asd": return {
@@ -28950,9 +29111,9 @@ function zi(e) {
28950
29111
  }
28951
29112
  //#endregion
28952
29113
  //#region src/v2019C1/extensions/lifecycle/validate/template-uuid-check.ts
28953
- async function Bi(e) {
29114
+ async function $i(e) {
28954
29115
  let t = await e.any.getSnapshot({ as: "tree" }), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
28955
- await Vi(e, t, n, r);
29116
+ await ea(e, t, n, r);
28956
29117
  let i = [], a = /* @__PURE__ */ new Set();
28957
29118
  for (let [e, { tagNames: t, refs: r }] of n) {
28958
29119
  if (t.size < 2) continue;
@@ -29000,7 +29161,7 @@ async function Bi(e) {
29000
29161
  }
29001
29162
  return i;
29002
29163
  }
29003
- async function Vi(e, t, n, r) {
29164
+ async function ea(e, t, n, r) {
29004
29165
  let i = {
29005
29166
  tagName: t.tagName,
29006
29167
  id: t.id
@@ -29020,35 +29181,35 @@ async function Vi(e, t, n, r) {
29020
29181
  ref: i
29021
29182
  }), r.set(o, e);
29022
29183
  }
29023
- for (let i of t.tree) await Vi(e, i, n, r);
29184
+ for (let i of t.tree) await ea(e, i, n, r);
29024
29185
  }
29025
29186
  //#endregion
29026
29187
  //#region src/v2019C1/extensions/index.ts
29027
- var Hi = {
29028
- cleanUp: xt,
29029
- dataModel: Yt,
29030
- history: en,
29031
- identity: cn,
29188
+ var ta = {
29189
+ cleanUp: R,
29190
+ dataModel: en,
29191
+ history: H,
29192
+ identity: dn,
29032
29193
  lifecycle: {
29033
29194
  query: {
29034
- report: Ri,
29035
- checkTemplateUuids: Bi
29195
+ report: Zi,
29196
+ checkTemplateUuids: $i
29036
29197
  },
29037
29198
  transaction: {
29038
- extract: pi,
29039
- instantiate: mi,
29040
- transplant: { deep: J },
29041
- update: ri,
29042
- apply: ii
29199
+ extract: Ei,
29200
+ instantiate: Di,
29201
+ transplant: { deep: ar },
29202
+ update: li,
29203
+ apply: ui
29043
29204
  }
29044
29205
  },
29045
- reference: z,
29046
- signature: { query: Ft },
29047
- presentation: { query: Ni }
29206
+ reference: L,
29207
+ signature: { query: Bt },
29208
+ presentation: { query: Ki }
29048
29209
  };
29049
29210
  //#endregion
29050
29211
  //#region src/v2019C1/hooks/after-created/private-wrapper.ts
29051
- async function Ui(e) {
29212
+ async function na(e) {
29052
29213
  let { childRecord: t, parentRecord: n, query: r } = e;
29053
29214
  if (t.namespace.prefix === x.namespaces.default.prefix) return [];
29054
29215
  let i = n.tagName === "Private", a = n.namespace.prefix === x.namespaces.default.prefix;
@@ -29057,26 +29218,26 @@ async function Ui(e) {
29057
29218
  ...n,
29058
29219
  children: n.children.filter((e) => e.id !== t.id)
29059
29220
  };
29060
- return i ? Wi({
29221
+ return i ? ra({
29061
29222
  parentRecord: n,
29062
29223
  childRecord: t,
29063
29224
  query: r
29064
- }) : o ? Gi({
29225
+ }) : o ? ia({
29065
29226
  existingPrivateRef: o,
29066
29227
  parentRecord: n,
29067
29228
  updatedParentRecord: s,
29068
29229
  childRecord: t,
29069
29230
  query: r
29070
- }) : (await r.findAncestors(n)).some((e) => e.tagName === "Private" && e.attributes.some((e) => e.name === "type" && e.value === t.namespace.prefix)) ? [] : Ki({
29231
+ }) : (await r.findAncestors(n)).some((e) => e.tagName === "Private" && e.attributes.some((e) => e.name === "type" && e.value === t.namespace.prefix)) ? [] : aa({
29071
29232
  parentRecord: n,
29072
29233
  updatedParentRecord: s,
29073
29234
  childRecord: t
29074
29235
  });
29075
29236
  }
29076
- async function Wi(e) {
29237
+ async function ra(e) {
29077
29238
  let { parentRecord: t, childRecord: n, query: r } = e, a = t;
29078
29239
  if (n.parent?.id === a.id && n.parent?.tagName === "Private") return [];
29079
- let o = await qi({
29240
+ let o = await oa({
29080
29241
  privateId: a.id,
29081
29242
  query: r
29082
29243
  });
@@ -29084,7 +29245,7 @@ async function Wi(e) {
29084
29245
  detail: "Latest private record not found",
29085
29246
  key: "ELEMENT_NOT_FOUND"
29086
29247
  });
29087
- let { childRecord: c, privateRecord: l } = Ji({
29248
+ let { childRecord: c, privateRecord: l } = sa({
29088
29249
  privateRecord: o,
29089
29250
  childRecord: n
29090
29251
  });
@@ -29098,8 +29259,8 @@ async function Wi(e) {
29098
29259
  newRecord: i(l)
29099
29260
  }];
29100
29261
  }
29101
- async function Gi(e) {
29102
- let { existingPrivateRef: t, parentRecord: n, updatedParentRecord: r, childRecord: a, query: o } = e, c = await qi({
29262
+ async function ia(e) {
29263
+ let { existingPrivateRef: t, parentRecord: n, updatedParentRecord: r, childRecord: a, query: o } = e, c = await oa({
29103
29264
  privateId: t.id,
29104
29265
  query: o
29105
29266
  });
@@ -29107,7 +29268,7 @@ async function Gi(e) {
29107
29268
  detail: "Latest private record not found",
29108
29269
  key: "ELEMENT_NOT_FOUND"
29109
29270
  }), !c.attributes.some((e) => e.name === "type" && e.value === a.namespace.prefix)) return [];
29110
- let { childRecord: l, privateRecord: u } = Ji({
29271
+ let { childRecord: l, privateRecord: u } = sa({
29111
29272
  privateRecord: c,
29112
29273
  childRecord: a
29113
29274
  });
@@ -29129,7 +29290,7 @@ async function Gi(e) {
29129
29290
  }
29130
29291
  ];
29131
29292
  }
29132
- function Ki(e) {
29293
+ function aa(e) {
29133
29294
  let { parentRecord: t, updatedParentRecord: n, childRecord: r } = e, a = {
29134
29295
  id: crypto.randomUUID(),
29135
29296
  tagName: "Private",
@@ -29178,14 +29339,14 @@ function Ki(e) {
29178
29339
  }
29179
29340
  ];
29180
29341
  }
29181
- async function qi(e) {
29342
+ async function oa(e) {
29182
29343
  let { privateId: t, query: n } = e;
29183
29344
  return await n.getRecord({
29184
29345
  id: t,
29185
29346
  tagName: "Private"
29186
29347
  });
29187
29348
  }
29188
- function Ji(e) {
29349
+ function sa(e) {
29189
29350
  let { privateRecord: t, childRecord: n } = e;
29190
29351
  return {
29191
29352
  childRecord: {
@@ -29206,7 +29367,7 @@ function Ji(e) {
29206
29367
  }
29207
29368
  //#endregion
29208
29369
  //#region src/v2019C1/hooks/shared/ref-entry-ops.ts
29209
- async function Yi(e) {
29370
+ async function ca(e) {
29210
29371
  let { uuid: t, entry: r, target: a, query: o } = e;
29211
29372
  if (!n(r.refTagName, x)) return [];
29212
29373
  let s = await o.getRecordsByTagName(r.refTagName), c = [];
@@ -29215,7 +29376,7 @@ async function Yi(e) {
29215
29376
  let n = {
29216
29377
  tagName: e.tagName,
29217
29378
  id: e.id
29218
- }, s = await z.query.buildReferencePath(o, {
29379
+ }, s = await L.query.buildReferencePath(o, {
29219
29380
  reference: n,
29220
29381
  target: a
29221
29382
  });
@@ -29235,17 +29396,17 @@ async function Yi(e) {
29235
29396
  }
29236
29397
  return c;
29237
29398
  }
29238
- function Xi(e) {
29399
+ function la(e) {
29239
29400
  let t = [];
29240
- for (let n of je) {
29241
- let r = ke[n]?.get(e);
29401
+ for (let n of Pe) {
29402
+ let r = Me[n]?.get(e);
29242
29403
  r && t.push(...r);
29243
29404
  }
29244
29405
  return t;
29245
29406
  }
29246
29407
  //#endregion
29247
29408
  //#region src/v2019C1/hooks/shared/record-ops.ts
29248
- function Zi(e, t) {
29409
+ function ua(e, t) {
29249
29410
  return {
29250
29411
  status: "updated",
29251
29412
  oldRecord: e,
@@ -29255,7 +29416,7 @@ function Zi(e, t) {
29255
29416
  }
29256
29417
  };
29257
29418
  }
29258
- function Qi(e, t, n) {
29419
+ function da(e, t, n) {
29259
29420
  return e.some((e) => e.name === t) ? e.map((e) => e.name === t ? {
29260
29421
  ...e,
29261
29422
  value: n
@@ -29266,23 +29427,23 @@ function Qi(e, t, n) {
29266
29427
  }
29267
29428
  //#endregion
29268
29429
  //#region src/v2019C1/hooks/shared/mapped-name.ts
29269
- async function $i(e, t) {
29430
+ async function fa(e, t) {
29270
29431
  let n = P.get(t.tagName);
29271
29432
  if (!n || !t.attributes.find((e) => e.name === n.uuid)?.value) return null;
29272
- let r = await Re(e, t);
29273
- return r === t.attributes.find((e) => e.name === n.path)?.value ? null : Zi(t, r === void 0 ? t.attributes.filter((e) => e.name !== n.path) : Qi(t.attributes, n.path, r));
29433
+ let r = await He(e, t);
29434
+ return r === t.attributes.find((e) => e.name === n.path)?.value ? null : ua(t, r === void 0 ? t.attributes.filter((e) => e.name !== n.path) : da(t.attributes, n.path, r));
29274
29435
  }
29275
29436
  //#endregion
29276
29437
  //#region src/v2019C1/hooks/shared/ref-path-rebuild.ts
29277
- async function ea(e) {
29438
+ async function pa(e) {
29278
29439
  let { oldRecord: t, newRecord: n, query: r } = e;
29279
29440
  if (P.has(n.tagName)) return [];
29280
29441
  let i = D[n.tagName];
29281
29442
  if (!i) return [];
29282
29443
  let a = [];
29283
29444
  for (let e of i) {
29284
- if (e.resolution === M.unsupported || !ta(t, n, e)) continue;
29285
- let i = await na({
29445
+ if (e.resolution === M.unsupported || !ma(t, n, e)) continue;
29446
+ let i = await ha({
29286
29447
  newRecord: n,
29287
29448
  pair: e,
29288
29449
  query: r
@@ -29291,13 +29452,13 @@ async function ea(e) {
29291
29452
  }
29292
29453
  return a;
29293
29454
  }
29294
- function ta(e, t, n) {
29295
- return [n.attribute.uuid, ...n.companions.map((e) => e.name)].some((n) => ia(e, n) !== ia(t, n));
29455
+ function ma(e, t, n) {
29456
+ return [n.attribute.uuid, ...n.companions.map((e) => e.name)].some((n) => _a(e, n) !== _a(t, n));
29296
29457
  }
29297
- async function na(e) {
29298
- let { newRecord: t, pair: n, query: r } = e, i = ia(t, n.attribute.uuid);
29458
+ async function ha(e) {
29459
+ let { newRecord: t, pair: n, query: r } = e, i = _a(t, n.attribute.uuid);
29299
29460
  if (!i) return null;
29300
- let a = await ra({
29461
+ let a = await ga({
29301
29462
  uuidValue: i,
29302
29463
  targetTagNames: n.target,
29303
29464
  query: r
@@ -29310,9 +29471,9 @@ async function na(e) {
29310
29471
  },
29311
29472
  target: a
29312
29473
  });
29313
- return !o || ia(t, n.attribute.path) === o ? null : Zi(t, Qi(t.attributes, n.attribute.path, o));
29474
+ return !o || _a(t, n.attribute.path) === o ? null : ua(t, da(t.attributes, n.attribute.path, o));
29314
29475
  }
29315
- async function ra(e) {
29476
+ async function ga(e) {
29316
29477
  let { uuidValue: t, targetTagNames: r, query: i } = e;
29317
29478
  for (let e of r) {
29318
29479
  if (!n(e, x)) continue;
@@ -29324,22 +29485,22 @@ async function ra(e) {
29324
29485
  }
29325
29486
  return null;
29326
29487
  }
29327
- function ia(e, t) {
29488
+ function _a(e, t) {
29328
29489
  return e.attributes.find((e) => e.name === t)?.value;
29329
29490
  }
29330
29491
  //#endregion
29331
29492
  //#region src/v2019C1/hooks/shared/lnode-binding.ts
29332
- var aa = "None";
29333
- async function oa(e) {
29493
+ var va = "None";
29494
+ async function ya(e) {
29334
29495
  let { oldRecord: t, newRecord: n, query: r } = e;
29335
29496
  if (n.tagName !== "LNode") return null;
29336
- let i = da(t, "lnUuid"), a = da(n, "lnUuid");
29497
+ let i = wa(t, "lnUuid"), a = wa(n, "lnUuid");
29337
29498
  if (i === a) return null;
29338
- let o = a ? await sa(r, a) : await ca(r, n);
29339
- return o ? ua(n, o) : null;
29499
+ let o = a ? await ba(r, a) : await xa(r, n);
29500
+ return o ? Ca(n, o) : null;
29340
29501
  }
29341
- async function sa(e, t) {
29342
- let n = await la(e, t);
29502
+ async function ba(e, t) {
29503
+ let n = await Sa(e, t);
29343
29504
  if (!n) return null;
29344
29505
  let r = await e.getAttributes(n), i = await e.findAncestors(n), a = i.find((e) => e.tagName === "LDevice"), o = i.find((e) => e.tagName === "IED"), s = a ? await e.getAttributes({
29345
29506
  tagName: "LDevice",
@@ -29356,9 +29517,9 @@ async function sa(e, t) {
29356
29517
  lnInst: r.inst
29357
29518
  };
29358
29519
  }
29359
- async function ca(e, t) {
29520
+ async function xa(e, t) {
29360
29521
  let n = {
29361
- iedName: aa,
29522
+ iedName: va,
29362
29523
  ldInst: void 0
29363
29524
  }, r = await e.getChild({
29364
29525
  tagName: "LNode",
@@ -29373,7 +29534,7 @@ async function ca(e, t) {
29373
29534
  lnInst: i.sLnInst
29374
29535
  };
29375
29536
  }
29376
- async function la(e, t) {
29537
+ async function Sa(e, t) {
29377
29538
  for (let r of ["LN", "LN0"]) {
29378
29539
  if (!n(r, x)) continue;
29379
29540
  let i = (await e.getRecordsByTagName(r)).find((e) => e.attributes.find((e) => e.name === "uuid")?.value === t);
@@ -29384,7 +29545,7 @@ async function la(e, t) {
29384
29545
  }
29385
29546
  return null;
29386
29547
  }
29387
- function ua(e, t) {
29548
+ function Ca(e, t) {
29388
29549
  let n = [...e.attributes], r = !1;
29389
29550
  for (let [e, i] of Object.entries(t)) {
29390
29551
  let t = n.find((t) => t.name === e)?.value;
@@ -29393,35 +29554,35 @@ function ua(e, t) {
29393
29554
  n = n.filter((t) => t.name !== e), r = !0;
29394
29555
  continue;
29395
29556
  }
29396
- t !== i && (n = Qi(n, e, i), r = !0);
29557
+ t !== i && (n = da(n, e, i), r = !0);
29397
29558
  }
29398
- return r ? Zi(e, n) : null;
29559
+ return r ? ua(e, n) : null;
29399
29560
  }
29400
- function da(e, t) {
29561
+ function wa(e, t) {
29401
29562
  return e.attributes.find((e) => e.name === t)?.value;
29402
29563
  }
29403
29564
  //#endregion
29404
29565
  //#region src/v2019C1/hooks/after-created/ref-paths.ts
29405
- async function fa(e) {
29406
- let { childRecord: t, query: n } = e, r = await pa({
29566
+ async function Ta(e) {
29567
+ let { childRecord: t, query: n } = e, r = await Ea({
29407
29568
  childRecord: t,
29408
29569
  query: n
29409
- }), i = await ga({
29570
+ }), i = await ka({
29410
29571
  childRecord: t,
29411
29572
  query: n
29412
- }), a = await $i(n, o(t)), s = a ? [a] : [];
29573
+ }), a = await fa(n, o(t)), s = a ? [a] : [];
29413
29574
  return [
29414
29575
  ...r,
29415
29576
  ...i,
29416
29577
  ...s
29417
29578
  ];
29418
29579
  }
29419
- async function pa(e) {
29420
- let { childRecord: t, query: n } = e, r = Me.get(t.tagName);
29580
+ async function Ea(e) {
29581
+ let { childRecord: t, query: n } = e, r = Fe.get(t.tagName);
29421
29582
  if (!r?.length) return [];
29422
29583
  let i = [];
29423
29584
  for (let e of r) {
29424
- let r = await ma({
29585
+ let r = await Da({
29425
29586
  childRecord: t,
29426
29587
  pair: e,
29427
29588
  query: n
@@ -29430,10 +29591,10 @@ async function pa(e) {
29430
29591
  }
29431
29592
  return i;
29432
29593
  }
29433
- async function ma(e) {
29594
+ async function Da(e) {
29434
29595
  let { childRecord: t, pair: n, query: r } = e, i = t.attributes.find((e) => e.name === n.uuidAttr)?.value;
29435
29596
  if (!i) return null;
29436
- let a = await ha({
29597
+ let a = await Oa({
29437
29598
  uuidValue: i,
29438
29599
  targetTagNames: n.targetTagNames,
29439
29600
  query: r
@@ -29463,7 +29624,7 @@ async function ma(e) {
29463
29624
  }
29464
29625
  };
29465
29626
  }
29466
- async function ha(e) {
29627
+ async function Oa(e) {
29467
29628
  let { uuidValue: t, targetTagNames: r, query: i } = e;
29468
29629
  for (let e of r) {
29469
29630
  if (!n(e, x)) continue;
@@ -29475,17 +29636,17 @@ async function ha(e) {
29475
29636
  }
29476
29637
  return null;
29477
29638
  }
29478
- async function ga(e) {
29639
+ async function ka(e) {
29479
29640
  let { childRecord: t, query: n } = e, r = t.attributes.find((e) => e.name === "uuid")?.value;
29480
29641
  if (!r) return [];
29481
- let i = Xi(t.tagName);
29642
+ let i = la(t.tagName);
29482
29643
  if (i.length === 0) return [];
29483
29644
  let a = {
29484
29645
  tagName: t.tagName,
29485
29646
  id: t.id
29486
29647
  }, o = [];
29487
29648
  for (let e of i) {
29488
- let t = await Yi({
29649
+ let t = await ca({
29489
29650
  uuid: r,
29490
29651
  entry: e,
29491
29652
  target: a,
@@ -29497,12 +29658,12 @@ async function ga(e) {
29497
29658
  }
29498
29659
  //#endregion
29499
29660
  //#region src/v2019C1/hooks/after-created/after-created.ts
29500
- async function _a(e) {
29501
- let { childRecord: t, parentRecord: n, query: r } = e, i = await Ui({
29661
+ async function Aa(e) {
29662
+ let { childRecord: t, parentRecord: n, query: r } = e, i = await na({
29502
29663
  childRecord: t,
29503
29664
  parentRecord: n,
29504
29665
  query: r
29505
- }), a = await fa({
29666
+ }), a = await Ta({
29506
29667
  childRecord: t,
29507
29668
  query: r
29508
29669
  });
@@ -29510,7 +29671,7 @@ async function _a(e) {
29510
29671
  }
29511
29672
  //#endregion
29512
29673
  //#region src/v2019C1/hooks/after-standardized-record/uuid-attribute.ts
29513
- function va(e) {
29674
+ function ja(e) {
29514
29675
  let { record: t } = e, { tagName: n, attributes: r } = t, i = x.definition[n];
29515
29676
  if (!("uuid" in i.attributes.details) || r.find((e) => e.name === "uuid")?.value) return t;
29516
29677
  let a = i.attributes.details.uuid?.namespace, o = r.filter((e) => e.name !== "uuid");
@@ -29525,21 +29686,21 @@ function va(e) {
29525
29686
  }
29526
29687
  //#endregion
29527
29688
  //#region src/v2019C1/hooks/after-standardized-record/after-standardized-record.ts
29528
- function ya(e) {
29529
- return va(e);
29689
+ function Ma(e) {
29690
+ return ja(e);
29530
29691
  }
29531
29692
  //#endregion
29532
29693
  //#region src/v2019C1/hooks/after-updated/ref-paths.ts
29533
- async function ba(e) {
29534
- let { oldRecord: t, newRecord: n, query: r } = e, i = [], a = o(t), s = o(n), c = await $i(r, s);
29694
+ async function Na(e) {
29695
+ let { oldRecord: t, newRecord: n, query: r } = e, i = [], a = o(t), s = o(n), c = await fa(r, s);
29535
29696
  c && i.push(c);
29536
- let l = await oa({
29697
+ let l = await ya({
29537
29698
  oldRecord: a,
29538
29699
  newRecord: s,
29539
29700
  query: r
29540
29701
  });
29541
29702
  l && i.push(l);
29542
- let u = await ea({
29703
+ let u = await pa({
29543
29704
  oldRecord: a,
29544
29705
  newRecord: s,
29545
29706
  query: r
@@ -29547,12 +29708,12 @@ async function ba(e) {
29547
29708
  i.push(...u);
29548
29709
  let d = n.attributes.find((e) => e.name === "uuid")?.value;
29549
29710
  if (d) {
29550
- let e = Xi(n.tagName), t = {
29711
+ let e = la(n.tagName), t = {
29551
29712
  tagName: n.tagName,
29552
29713
  id: n.id
29553
29714
  };
29554
29715
  for (let n of e) {
29555
- let e = await Yi({
29716
+ let e = await ca({
29556
29717
  uuid: d,
29557
29718
  entry: n,
29558
29719
  target: t,
@@ -29561,8 +29722,8 @@ async function ba(e) {
29561
29722
  i.push(...e);
29562
29723
  }
29563
29724
  }
29564
- if (xa(t, n)) {
29565
- let e = await Sa({
29725
+ if (Pa(t, n)) {
29726
+ let e = await Fa({
29566
29727
  newRecord: n,
29567
29728
  query: r
29568
29729
  });
@@ -29570,11 +29731,11 @@ async function ba(e) {
29570
29731
  }
29571
29732
  return i;
29572
29733
  }
29573
- function xa(e, t) {
29734
+ function Pa(e, t) {
29574
29735
  for (let n of se) if (e.attributes.find((e) => e.name === n)?.value !== t.attributes.find((e) => e.name === n)?.value) return !0;
29575
29736
  return !1;
29576
29737
  }
29577
- async function Sa(e) {
29738
+ async function Fa(e) {
29578
29739
  let { newRecord: t, query: n } = e, r = {
29579
29740
  tagName: t.tagName,
29580
29741
  id: t.id
@@ -29583,14 +29744,14 @@ async function Sa(e) {
29583
29744
  if (r.id === t.id) continue;
29584
29745
  let e = await n.any.getAttribute(r, { name: "uuid" });
29585
29746
  if (!e) continue;
29586
- let i = Xi(r.tagName);
29747
+ let i = la(r.tagName);
29587
29748
  if (i.length === 0) continue;
29588
29749
  let o = {
29589
29750
  tagName: r.tagName,
29590
29751
  id: r.id
29591
29752
  };
29592
29753
  for (let t of i) {
29593
- let r = await Yi({
29754
+ let r = await ca({
29594
29755
  uuid: e,
29595
29756
  entry: t,
29596
29757
  target: o,
@@ -29603,18 +29764,18 @@ async function Sa(e) {
29603
29764
  }
29604
29765
  //#endregion
29605
29766
  //#region src/v2019C1/hooks/after-updated/after-updated.ts
29606
- async function Ca(e) {
29607
- return ba(e);
29767
+ async function Ia(e) {
29768
+ return Na(e);
29608
29769
  }
29609
29770
  //#endregion
29610
29771
  //#region src/v2019C1/hooks/before-clone/before-clone.ts
29611
- var wa = new Set(Object.values(b).map((e) => e.uri)), Ta = new Set(Object.values(b).map((e) => e.prefix).filter(Boolean));
29612
- function Ea(e) {
29613
- return wa.has(e.namespace.uri) && !n(e.tagName, x);
29772
+ var La = new Set(Object.values(b).map((e) => e.uri)), Ra = new Set(Object.values(b).map((e) => e.prefix).filter(Boolean));
29773
+ function za(e) {
29774
+ return La.has(e.namespace.uri) && !n(e.tagName, x);
29614
29775
  }
29615
- function Da(e) {
29776
+ function Ba(e) {
29616
29777
  let { record: t } = e, n = t, r = !0, i = !!t.value?.trim(), a = t.attributes.find((e) => e.name === "type")?.value, o = a !== void 0;
29617
- t.tagName === "Private" && !t.tree.length && !i && !o && (r = !1), t.tagName === "Private" && !t.tree.length && !i && a !== void 0 && Ta.has(a) && (r = !1), Ea(n) && (r = !1), t.tagName === "Private" && n.tree.length > 0 && n.tree.every(Ea) && (r = !1);
29778
+ t.tagName === "Private" && !t.tree.length && !i && !o && (r = !1), t.tagName === "Private" && !t.tree.length && !i && a !== void 0 && Ra.has(a) && (r = !1), za(n) && (r = !1), t.tagName === "Private" && n.tree.length > 0 && n.tree.every(za) && (r = !1);
29618
29779
  let s = t.attributes.filter((e) => e.name !== "uuid");
29619
29780
  return {
29620
29781
  shouldBeCloned: r,
@@ -29626,17 +29787,17 @@ function Da(e) {
29626
29787
  }
29627
29788
  //#endregion
29628
29789
  //#region src/v2019C1/hooks/before-delete/orphaned-refs.ts
29629
- async function Oa(e) {
29790
+ async function Va(e) {
29630
29791
  let { record: t, query: n } = e, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
29631
- if (await Pa({
29792
+ if (await qa({
29632
29793
  record: t,
29633
29794
  query: n,
29634
29795
  ids: r,
29635
29796
  uuids: i
29636
29797
  }), i.size === 0) return [];
29637
29798
  let a = [];
29638
- for (let e of k) {
29639
- let t = await ka({
29799
+ for (let e of pe) {
29800
+ let t = await Ha({
29640
29801
  refTagName: e,
29641
29802
  subtreeIds: r,
29642
29803
  subtreeUuids: i,
@@ -29646,11 +29807,11 @@ async function Oa(e) {
29646
29807
  }
29647
29808
  return a;
29648
29809
  }
29649
- async function ka(e) {
29810
+ async function Ha(e) {
29650
29811
  let { refTagName: t, subtreeIds: n, subtreeUuids: r, query: i } = e, a = D[t], o = await i.getRecordsByTagName(t), s = [];
29651
29812
  for (let e of o) {
29652
29813
  if (n.has(e.id)) continue;
29653
- let o = await Aa({
29814
+ let o = await Ua({
29654
29815
  refTagName: t,
29655
29816
  refRecord: e,
29656
29817
  refPairs: a,
@@ -29661,15 +29822,15 @@ async function ka(e) {
29661
29822
  }
29662
29823
  return s;
29663
29824
  }
29664
- async function Aa(e) {
29665
- let { refTagName: t, refRecord: n, refPairs: r, subtreeUuids: i, query: a } = e, o = ja({
29825
+ async function Ua(e) {
29826
+ let { refTagName: t, refRecord: n, refPairs: r, subtreeUuids: i, query: a } = e, o = Wa({
29666
29827
  refPairs: r,
29667
29828
  refRecord: n,
29668
29829
  subtreeUuids: i
29669
29830
  });
29670
- return o.size === 0 ? [] : O.has(t) ? [Ma(n, o)] : Na(n, a);
29831
+ return o.size === 0 ? [] : O.has(t) ? [Ga(n, o)] : Ka(n, a);
29671
29832
  }
29672
- function ja(e) {
29833
+ function Wa(e) {
29673
29834
  let { refPairs: t, refRecord: n, subtreeUuids: r } = e, i = /* @__PURE__ */ new Set();
29674
29835
  for (let e of t) {
29675
29836
  let t = n.attributes.find((t) => t.name === e.attribute.uuid)?.value;
@@ -29680,7 +29841,7 @@ function ja(e) {
29680
29841
  }
29681
29842
  return i;
29682
29843
  }
29683
- function Ma(e, t) {
29844
+ function Ga(e, t) {
29684
29845
  let n = e.attributes.filter((e) => !t.has(e.name));
29685
29846
  return {
29686
29847
  status: "updated",
@@ -29691,7 +29852,7 @@ function Ma(e, t) {
29691
29852
  })
29692
29853
  };
29693
29854
  }
29694
- async function Na(e, t) {
29855
+ async function Ka(e, t) {
29695
29856
  let n = [{
29696
29857
  status: "deleted",
29697
29858
  oldRecord: i(e),
@@ -29713,14 +29874,14 @@ async function Na(e, t) {
29713
29874
  }
29714
29875
  return n;
29715
29876
  }
29716
- async function Pa(e) {
29877
+ async function qa(e) {
29717
29878
  let { record: t, query: n, ids: r, uuids: i } = e;
29718
29879
  r.add(t.id);
29719
29880
  let a = t.attributes.find((e) => e.name === "uuid")?.value;
29720
29881
  a && i.add(a);
29721
29882
  for (let e of t.children) {
29722
29883
  let t = await n.getRecord(e);
29723
- t && await Pa({
29884
+ t && await qa({
29724
29885
  record: t,
29725
29886
  query: n,
29726
29887
  ids: r,
@@ -29730,29 +29891,29 @@ async function Pa(e) {
29730
29891
  }
29731
29892
  //#endregion
29732
29893
  //#region src/v2019C1/hooks/before-delete/before-delete.ts
29733
- async function Fa(e) {
29734
- return Oa(e);
29894
+ async function Ja(e) {
29895
+ return Va(e);
29735
29896
  }
29736
29897
  //#endregion
29737
29898
  //#region src/v2019C1/hooks/io/io-hooks.ts
29738
- function Ia() {
29899
+ function Ya() {
29739
29900
  let e = /* @__PURE__ */ new Map(), t = [], n = [];
29740
29901
  return {
29741
29902
  beforeImportRecord: (r) => {
29742
29903
  let { record: i, ancestry: a } = r, { tagName: o } = i, s = i.attributes.find((e) => e.name === "uuid")?.value;
29743
- if (s && pe.has(o)) {
29904
+ if (s && me.has(o)) {
29744
29905
  let t = ue({
29745
29906
  record: i,
29746
29907
  ancestry: a
29747
29908
  });
29748
29909
  t && e.set(t.path, s);
29749
29910
  }
29750
- if (!A.has(o)) return;
29911
+ if (!k.has(o)) return;
29751
29912
  let c = D[o];
29752
29913
  for (let e of c) {
29753
29914
  let r = i.attributes.find((t) => t.name === e.attribute.path)?.value;
29754
29915
  if (!r || i.attributes.find((t) => t.name === e.attribute.uuid)?.value) continue;
29755
- let s = ge(e.resolution, e.attribute.path, r, a);
29916
+ let s = ye(e.resolution, e.attribute.path, r, a);
29756
29917
  if (!s) {
29757
29918
  e.resolution === M.unsupported && n.push({
29758
29919
  type: "unsupported-xpath-reference",
@@ -29810,12 +29971,12 @@ function Ia() {
29810
29971
  }
29811
29972
  //#endregion
29812
29973
  //#region src/v2019C1/hooks/index.ts
29813
- var La = {
29814
- beforeClone: Da,
29815
- afterStandardizedRecord: ya,
29816
- afterCreated: _a,
29817
- afterUpdated: Ca,
29818
- beforeDelete: Fa
29974
+ var Xa = {
29975
+ beforeClone: Ba,
29976
+ afterStandardizedRecord: Ma,
29977
+ afterCreated: Aa,
29978
+ afterUpdated: Ia,
29979
+ beforeDelete: Ja
29819
29980
  };
29820
29981
  //#endregion
29821
- export { b as A, pe as C, y as D, ae as E, x as O, A as S, se as T, Fe as _, St as a, O as b, Ne as c, P as d, Me as f, F as g, Pe as h, zi as i, v as k, je as l, Ae as m, Ia as n, at as o, ke as p, Hi as r, Le as s, La as t, Ie as u, N as v, D as w, k as x, M as y };
29982
+ export { y as A, O as C, D, me as E, v as M, b as N, se as O, he as S, k as T, ze as _, Ot as a, _e as b, Ie as c, P as d, Fe as f, Le as g, Re as h, Qi as i, x as j, ae as k, Pe as l, Ne as m, Ya as n, lt as o, Me as p, ta as r, Ve as s, Xa as t, Be as u, N as v, pe as w, ge as x, M as y };