@dialecte/scl 0.3.8 → 0.3.9

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 (78) hide show
  1. package/dist/{hooks-DJJN-WU2.js → hooks-DO4gUiix.js} +1384 -1064
  2. package/dist/v2019C1/constants/reference-pairs.d.ts +11 -0
  3. package/dist/v2019C1/constants/reference-pairs.d.ts.map +1 -1
  4. package/dist/v2019C1/extensions/clean-up/transaction/orphan-lnode-bindings.d.ts +12 -5
  5. package/dist/v2019C1/extensions/clean-up/transaction/orphan-lnode-bindings.d.ts.map +1 -1
  6. package/dist/v2019C1/extensions/clean-up/transaction/orphan-uuid-refs.d.ts.map +1 -1
  7. package/dist/v2019C1/extensions/data-model/query/index.d.ts +1 -0
  8. package/dist/v2019C1/extensions/data-model/query/index.d.ts.map +1 -1
  9. package/dist/v2019C1/extensions/data-model/query/is-lnode-locked.d.ts +18 -0
  10. package/dist/v2019C1/extensions/data-model/query/is-lnode-locked.d.ts.map +1 -0
  11. package/dist/v2019C1/extensions/data-model/transaction/import-types.d.ts.map +1 -1
  12. package/dist/v2019C1/extensions/lifecycle/constraints/classify-attribute.d.ts +4 -3
  13. package/dist/v2019C1/extensions/lifecycle/constraints/classify-attribute.d.ts.map +1 -1
  14. package/dist/v2019C1/extensions/lifecycle/constraints/classify-attribute.types.d.ts +10 -0
  15. package/dist/v2019C1/extensions/lifecycle/constraints/classify-attribute.types.d.ts.map +1 -1
  16. package/dist/v2019C1/extensions/lifecycle/cross-cutting/applied-satellites.constants.d.ts +1 -1
  17. package/dist/v2019C1/extensions/lifecycle/engine/decide.d.ts.map +1 -1
  18. package/dist/v2019C1/extensions/lifecycle/engine/diff.d.ts.map +1 -1
  19. package/dist/v2019C1/extensions/lifecycle/engine/diff.types.d.ts +2 -2
  20. package/dist/v2019C1/extensions/lifecycle/engine/diff.types.d.ts.map +1 -1
  21. package/dist/v2019C1/extensions/lifecycle/engine/group.d.ts +4 -0
  22. package/dist/v2019C1/extensions/lifecycle/engine/group.d.ts.map +1 -1
  23. package/dist/v2019C1/extensions/lifecycle/engine/reconcile.d.ts.map +1 -1
  24. package/dist/v2019C1/extensions/lifecycle/layers/function/satellites.constants.d.ts +1 -1
  25. package/dist/v2019C1/extensions/lifecycle/report/query/cross-cutting-satellites.d.ts.map +1 -1
  26. package/dist/v2019C1/extensions/lifecycle/report/query/report-function-satellites.d.ts.map +1 -1
  27. package/dist/v2019C1/extensions/lifecycle/report/query/satellite-companions.d.ts +2 -0
  28. package/dist/v2019C1/extensions/lifecycle/report/query/satellite-companions.d.ts.map +1 -1
  29. package/dist/v2019C1/extensions/lifecycle/report/report.d.ts.map +1 -1
  30. package/dist/v2019C1/extensions/lifecycle/update/transaction/asd.d.ts.map +1 -1
  31. package/dist/v2019C1/extensions/lifecycle/update/transaction/function-satellites.d.ts +1 -1
  32. package/dist/v2019C1/extensions/presentation/constants/title.d.ts +1 -12
  33. package/dist/v2019C1/extensions/presentation/constants/title.d.ts.map +1 -1
  34. package/dist/v2019C1/extensions/presentation/constants/title.types.d.ts +25 -0
  35. package/dist/v2019C1/extensions/presentation/constants/title.types.d.ts.map +1 -0
  36. package/dist/v2019C1/extensions/presentation/public.d.ts +3 -0
  37. package/dist/v2019C1/extensions/presentation/public.d.ts.map +1 -0
  38. package/dist/v2019C1/extensions/presentation/query/extract-element-title.d.ts +2 -24
  39. package/dist/v2019C1/extensions/presentation/query/extract-element-title.d.ts.map +1 -1
  40. package/dist/v2019C1/extensions/presentation/query/extract-element-title.types.d.ts +24 -0
  41. package/dist/v2019C1/extensions/presentation/query/extract-element-title.types.d.ts.map +1 -0
  42. package/dist/v2019C1/extensions/presentation/query/index.d.ts +1 -0
  43. package/dist/v2019C1/extensions/presentation/query/index.d.ts.map +1 -1
  44. package/dist/v2019C1/extensions/public.d.ts +1 -0
  45. package/dist/v2019C1/extensions/public.d.ts.map +1 -1
  46. package/dist/v2019C1/extensions/reference/constants/derived.d.ts +18 -0
  47. package/dist/v2019C1/extensions/reference/constants/derived.d.ts.map +1 -1
  48. package/dist/v2019C1/extensions/reference/constants/index.d.ts +2 -2
  49. package/dist/v2019C1/extensions/reference/constants/index.d.ts.map +1 -1
  50. package/dist/v2019C1/extensions/reference/constants/orphan-rules.d.ts +0 -8
  51. package/dist/v2019C1/extensions/reference/constants/orphan-rules.d.ts.map +1 -1
  52. package/dist/v2019C1/extensions/reference/query/build/build-mapped-name.d.ts +22 -0
  53. package/dist/v2019C1/extensions/reference/query/build/build-mapped-name.d.ts.map +1 -0
  54. package/dist/v2019C1/extensions/reference/query/build/build-reference-path.d.ts +1 -1
  55. package/dist/v2019C1/extensions/reference/query/build/build-reference-path.d.ts.map +1 -1
  56. package/dist/v2019C1/extensions/reference/query/build/index.d.ts +1 -0
  57. package/dist/v2019C1/extensions/reference/query/build/index.d.ts.map +1 -1
  58. package/dist/v2019C1/extensions/reference/query/resolve/parse-path.d.ts +1 -1
  59. package/dist/v2019C1/extensions/reference/transaction/write-provenance.d.ts +1 -1
  60. package/dist/v2019C1/hooks/after-created/ref-paths.d.ts.map +1 -1
  61. package/dist/v2019C1/hooks/after-updated/ref-paths.d.ts +7 -1
  62. package/dist/v2019C1/hooks/after-updated/ref-paths.d.ts.map +1 -1
  63. package/dist/v2019C1/hooks/before-clone/before-clone.d.ts.map +1 -1
  64. package/dist/v2019C1/hooks/before-delete/orphaned-refs.d.ts.map +1 -1
  65. package/dist/v2019C1/hooks/io/io-hooks.d.ts.map +1 -1
  66. package/dist/v2019C1/hooks/shared/index.d.ts +4 -0
  67. package/dist/v2019C1/hooks/shared/index.d.ts.map +1 -1
  68. package/dist/v2019C1/hooks/shared/lnode-binding.d.ts +23 -0
  69. package/dist/v2019C1/hooks/shared/lnode-binding.d.ts.map +1 -0
  70. package/dist/v2019C1/hooks/shared/mapped-name.d.ts +15 -0
  71. package/dist/v2019C1/hooks/shared/mapped-name.d.ts.map +1 -0
  72. package/dist/v2019C1/hooks/shared/record-ops.d.ts +19 -0
  73. package/dist/v2019C1/hooks/shared/record-ops.d.ts.map +1 -0
  74. package/dist/v2019C1/hooks/shared/ref-path-rebuild.d.ts +17 -0
  75. package/dist/v2019C1/hooks/shared/ref-path-rebuild.d.ts.map +1 -0
  76. package/dist/v2019C1/index.js +12 -12
  77. package/dist/v2019C1/test.js +1 -1
  78. package/package.json +5 -5
@@ -1,14 +1,14 @@
1
- import { XSI_NAMESPACE as e, isChildOf as t, isElementOf as n, stripAttributes as r, toRawRecord as i, toRef as a } from "@dialecte/core/helpers";
2
- import { invariant as o } from "@dialecte/core/utils";
1
+ import { XSI_NAMESPACE as e, isChildOf as t, isElementOf as n, stripAttributes as r, toRawRecord as i, toRef as a, widen as o } from "@dialecte/core/helpers";
2
+ import { invariant as s } from "@dialecte/core/utils";
3
3
  //#region \0rolldown/runtime.js
4
- var s = Object.defineProperty, c = (e, t) => {
4
+ var c = Object.defineProperty, l = (e, t) => {
5
5
  let n = {};
6
- for (var r in e) s(n, r, {
6
+ for (var r in e) c(n, r, {
7
7
  get: e[r],
8
8
  enumerable: !0
9
9
  });
10
- return t || s(n, Symbol.toStringTag, { value: "Module" }), n;
11
- }, l = /* @__PURE__ */ "AccessControl.AccessPoint.Address.AllocationRole.AllocationRoleRef.AnalogueWiringParameters.AnalogueWiringParametersRef.Application.ApplicationSclRef.Association.Authentication.BDA.Bay.BayType.BehaviorDescription.BehaviorDescriptionRef.BehaviorReference.BinaryWiringParameters.BinaryWiringParametersRef.BitRate.CheckoutID.ClientLN.ClientServices.CommProt.Communication.CommunicationServiceSpecifications.ConductingEquipment.ConfDataSet.ConfLNs.ConfLdName.ConfLogControl.ConfReportControl.ConfSG.ConfSigRef.ConnectedAP.ConnectivityNode.ControlRef.ControllingLNode.DA.DAI.DAS.DAType.DO.DOI.DOS.DOType.DataObjectDirectory.DataSet.DataSetDirectory.DataTypeTemplates.DynAssociation.DynDataSet.EnumType.EnumVal.EqFunction.EqSubFunction.ExtCtrl.ExtRef.FCDA.FileHandling.Function.FunctionCatRef.FunctionCategory.FunctionCategoryRef.FunctionRef.FunctionRole.FunctionRoleContent.FunctionSclRef.FunctionTemplate.FunctionalSubVariant.FunctionalVariant.FunctionalVariantGroup.FunctionalVariantRef.GOOSE.GOOSEMcSecurity.GOOSESecurity.GSE.GSEControl.GSEDir.GSESettings.GSSE.GeneralEquipment.GetCBValues.GetDataObjectDefinition.GetDataSetValue.GetDirectory.GooseParameters.GooseParametersRef.Header.History.Hitem.IED.IEDName.IEDSourceFiles.InputVar.InputVarRef.Inputs.IssuerName.KDC.L2CommParameters.L3IPv4CommParameters.L3IPv6CommParameters.LDevice.LN.LN0.LNode.LNodeDataRef.LNodeInputRef.LNodeInputs.LNodeOutputRef.LNodeOutputs.LNodeSpecNaming.LNodeType.Label.Labels.Line.Log.LogControl.LogParameters.LogParametersRef.LogSettings.MaxTime.McSecurity.MinRequestedSCDFile.MinRequestedSCDFiles.MinTime.MultiAPPerSubNet.NeutralPoint.OptFields.OutputVar.OutputVarRef.Outputs.P.PhysConn.PowerSystemRelation.PowerSystemRelationRef.PowerSystemRelations.PowerTransformer.Private.Process.ProcessEcho.ProcessResource.ProcessResourceRef.ProcessResources.Project.ProjectProcessReference.ProtNs.Protocol.ReadWrite.RedProt.ReportControl.ReportParameters.ReportParametersRef.ReportSettings.Resource.RptEnabled.SCL.SCSM.SDI.SDO.SDS.SGEdit.SMV.SMVParameters.SMVParametersRef.SMVSecurity.SMVSettings.SMVsc.SVMcSecurity.SampledValueControl.SamplesPerSec.SclFileReference.SecPerSamples.Security.Server.ServerAt.ServiceSpecifications.Services.SetDataSetValue.SettingControl.SettingGroups.SignalRole.SmpRate.SmvOpts.SourceFiles.SourceRef.SubCategory.SubCheckoutID.SubEquipment.SubFunction.SubFunctionTemplate.SubNetwork.Subject.SubscriberLNode.Substation.SupSubscription.TapChanger.Terminal.Text.TimeSyncProt.TimerActivatedControl.TransformerWinding.TrgOps.Val.ValueHandling.Variable.VariableApplyTo.VariableRef.Voltage.VoltageLevel".split("."), u = {
10
+ return t || c(n, Symbol.toStringTag, { value: "Module" }), n;
11
+ }, u = /* @__PURE__ */ "AccessControl.AccessPoint.Address.AllocationRole.AllocationRoleRef.AnalogueWiringParameters.AnalogueWiringParametersRef.Application.ApplicationSclRef.Association.Authentication.BDA.Bay.BayType.BehaviorDescription.BehaviorDescriptionRef.BehaviorReference.BinaryWiringParameters.BinaryWiringParametersRef.BitRate.CheckoutID.ClientLN.ClientServices.CommProt.Communication.CommunicationServiceSpecifications.ConductingEquipment.ConfDataSet.ConfLNs.ConfLdName.ConfLogControl.ConfReportControl.ConfSG.ConfSigRef.ConnectedAP.ConnectivityNode.ControlRef.ControllingLNode.DA.DAI.DAS.DAType.DO.DOI.DOS.DOType.DataObjectDirectory.DataSet.DataSetDirectory.DataTypeTemplates.DynAssociation.DynDataSet.EnumType.EnumVal.EqFunction.EqSubFunction.ExtCtrl.ExtRef.FCDA.FileHandling.Function.FunctionCatRef.FunctionCategory.FunctionCategoryRef.FunctionRef.FunctionRole.FunctionRoleContent.FunctionSclRef.FunctionTemplate.FunctionalSubVariant.FunctionalVariant.FunctionalVariantGroup.FunctionalVariantRef.GOOSE.GOOSEMcSecurity.GOOSESecurity.GSE.GSEControl.GSEDir.GSESettings.GSSE.GeneralEquipment.GetCBValues.GetDataObjectDefinition.GetDataSetValue.GetDirectory.GooseParameters.GooseParametersRef.Header.History.Hitem.IED.IEDName.IEDSourceFiles.InputVar.InputVarRef.Inputs.IssuerName.KDC.L2CommParameters.L3IPv4CommParameters.L3IPv6CommParameters.LDevice.LN.LN0.LNode.LNodeDataRef.LNodeInputRef.LNodeInputs.LNodeOutputRef.LNodeOutputs.LNodeSpecNaming.LNodeType.Label.Labels.Line.Log.LogControl.LogParameters.LogParametersRef.LogSettings.MaxTime.McSecurity.MinRequestedSCDFile.MinRequestedSCDFiles.MinTime.MultiAPPerSubNet.NeutralPoint.OptFields.OutputVar.OutputVarRef.Outputs.P.PhysConn.PowerSystemRelation.PowerSystemRelationRef.PowerSystemRelations.PowerTransformer.Private.Process.ProcessEcho.ProcessResource.ProcessResourceRef.ProcessResources.Project.ProjectProcessReference.ProtNs.Protocol.ReadWrite.RedProt.ReportControl.ReportParameters.ReportParametersRef.ReportSettings.Resource.RptEnabled.SCL.SCSM.SDI.SDO.SDS.SGEdit.SMV.SMVParameters.SMVParametersRef.SMVSecurity.SMVSettings.SMVsc.SVMcSecurity.SampledValueControl.SamplesPerSec.SclFileReference.SecPerSamples.Security.Server.ServerAt.ServiceSpecifications.Services.SetDataSetValue.SettingControl.SettingGroups.SignalRole.SmpRate.SmvOpts.SourceFiles.SourceRef.SubCategory.SubCheckoutID.SubEquipment.SubFunction.SubFunctionTemplate.SubNetwork.Subject.SubscriberLNode.Substation.SupSubscription.TapChanger.Terminal.Text.TimeSyncProt.TimerActivatedControl.TransformerWinding.TrgOps.Val.ValueHandling.Variable.VariableApplyTo.VariableRef.Voltage.VoltageLevel".split("."), d = {
12
12
  AccessControl: [],
13
13
  AccessPoint: [
14
14
  "Text",
@@ -799,7 +799,7 @@ var s = Object.defineProperty, c = (e, t) => {
799
799
  "ProcessResources",
800
800
  "Variable"
801
801
  ]
802
- }, d = {
802
+ }, f = {
803
803
  AccessControl: ["LDevice"],
804
804
  AccessPoint: ["IED"],
805
805
  Address: [
@@ -1197,7 +1197,7 @@ var s = Object.defineProperty, c = (e, t) => {
1197
1197
  ],
1198
1198
  Voltage: ["Line", "VoltageLevel"],
1199
1199
  VoltageLevel: ["Substation"]
1200
- }, f = {
1200
+ }, p = {
1201
1201
  AccessControl: [],
1202
1202
  AccessPoint: /* @__PURE__ */ "AccessControl.Association.Authentication.ClientLN.ClientServices.CommProt.ConfDataSet.ConfLNs.ConfLdName.ConfLogControl.ConfReportControl.ConfSG.ConfSigRef.DAI.DOI.DataObjectDirectory.DataSet.DataSetDirectory.DynAssociation.DynDataSet.ExtCtrl.ExtRef.FCDA.FileHandling.GOOSE.GOOSEMcSecurity.GOOSESecurity.GSEControl.GSEDir.GSESettings.GSSE.GetCBValues.GetDataObjectDefinition.GetDataSetValue.GetDirectory.IEDName.Inputs.IssuerName.LDevice.LN.LN0.Label.Labels.Log.LogControl.LogSettings.McSecurity.MultiAPPerSubNet.OptFields.Outputs.Private.Protocol.ReadWrite.RedProt.ReportControl.ReportSettings.RptEnabled.SCSM.SDI.SGEdit.SMVSecurity.SMVSettings.SMVsc.SVMcSecurity.SampledValueControl.SamplesPerSec.SecPerSamples.Security.Server.ServerAt.Services.SetDataSetValue.SettingControl.SettingGroups.SmpRate.SmvOpts.Subject.SupSubscription.Text.TimeSyncProt.TimerActivatedControl.TrgOps.Val.ValueHandling".split("."),
1203
1203
  Address: ["P"],
@@ -1929,7 +1929,7 @@ var s = Object.defineProperty, c = (e, t) => {
1929
1929
  VariableRef: ["FunctionalVariantRef", "Text"],
1930
1930
  Voltage: [],
1931
1931
  VoltageLevel: /* @__PURE__ */ "AllocationRole.AllocationRoleRef.AnalogueWiringParametersRef.Application.ApplicationSclRef.Bay.BehaviorDescription.BehaviorDescriptionRef.BehaviorReference.BinaryWiringParametersRef.ConductingEquipment.ConnectivityNode.ControlRef.ControllingLNode.DAS.DOS.EqFunction.EqSubFunction.Function.FunctionCatRef.FunctionCategory.FunctionCategoryRef.FunctionRef.FunctionRole.FunctionRoleContent.FunctionSclRef.FunctionalSubVariant.FunctionalVariant.FunctionalVariantGroup.FunctionalVariantRef.GeneralEquipment.GooseParametersRef.InputVar.InputVarRef.LNode.LNodeDataRef.LNodeInputRef.LNodeInputs.LNodeOutputRef.LNodeOutputs.LNodeSpecNaming.Label.Labels.LogParametersRef.NeutralPoint.OutputVar.OutputVarRef.PowerSystemRelation.PowerSystemRelationRef.PowerSystemRelations.PowerTransformer.Private.ProcessEcho.ProcessResource.ProcessResourceRef.ProcessResources.ReportParametersRef.Resource.SDS.SMVParametersRef.SclFileReference.SignalRole.SourceRef.SubCategory.SubCheckoutID.SubEquipment.SubFunction.SubscriberLNode.TapChanger.Terminal.Text.TransformerWinding.Val.Variable.VariableApplyTo.VariableRef.Voltage".split(".")
1932
- }, p = {
1932
+ }, m = {
1933
1933
  AccessControl: [
1934
1934
  "AccessPoint",
1935
1935
  "IED",
@@ -3702,13 +3702,13 @@ var s = Object.defineProperty, c = (e, t) => {
3702
3702
  "SCL",
3703
3703
  "Substation"
3704
3704
  ]
3705
- }, m = [
3705
+ }, h = [
3706
3706
  "Communication",
3707
3707
  "DataTypeTemplates",
3708
3708
  "Header",
3709
3709
  "History",
3710
3710
  "SCL"
3711
- ], h = {
3711
+ ], g = {
3712
3712
  AccessControl: {},
3713
3713
  AccessPoint: {
3714
3714
  clock: "",
@@ -5161,7 +5161,7 @@ var s = Object.defineProperty, c = (e, t) => {
5161
5161
  templateUuid: "",
5162
5162
  uuid: ""
5163
5163
  }
5164
- }, g = {
5164
+ }, _ = {
5165
5165
  AccessControl: {
5166
5166
  tag: "AccessControl",
5167
5167
  namespace: {
@@ -24516,7 +24516,7 @@ var s = Object.defineProperty, c = (e, t) => {
24516
24516
  ]
24517
24517
  }]
24518
24518
  }
24519
- }, _ = { supportedFileExtensions: [
24519
+ }, v = { supportedFileExtensions: [
24520
24520
  ".fsd",
24521
24521
  ".asd",
24522
24522
  ".ssd",
@@ -24524,7 +24524,7 @@ var s = Object.defineProperty, c = (e, t) => {
24524
24524
  ".isd",
24525
24525
  ".icd",
24526
24526
  ".xml"
24527
- ] }, v = {
24527
+ ] }, y = {
24528
24528
  recordSchema: {
24529
24529
  primaryKey: "id",
24530
24530
  indexes: [
@@ -24542,7 +24542,7 @@ var s = Object.defineProperty, c = (e, t) => {
24542
24542
  },
24543
24543
  additionalTables: { attachedFiles: { schema: "id, filename, file" } }
24544
24544
  }
24545
- }, y = {
24545
+ }, b = {
24546
24546
  default: {
24547
24547
  uri: "http://www.iec.ch/61850/2003/SCL",
24548
24548
  prefix: ""
@@ -24552,39 +24552,139 @@ var s = Object.defineProperty, c = (e, t) => {
24552
24552
  prefix: "eIEC61850-6-100"
24553
24553
  },
24554
24554
  xsi: e
24555
- }, b = {
24555
+ }, x = {
24556
24556
  rootElementName: "SCL",
24557
- singletonElements: m,
24557
+ singletonElements: h,
24558
24558
  transparentElements: ["Private"],
24559
- elements: l,
24560
- namespaces: y,
24561
- attributes: h,
24562
- children: u,
24563
- parents: d,
24564
- descendants: f,
24565
- ancestors: p,
24566
- database: v,
24567
- io: _,
24568
- definition: g
24559
+ elements: u,
24560
+ namespaces: b,
24561
+ attributes: g,
24562
+ children: d,
24563
+ parents: f,
24564
+ descendants: p,
24565
+ ancestors: m,
24566
+ database: y,
24567
+ io: v,
24568
+ definition: _
24569
24569
  };
24570
24570
  //#endregion
24571
+ //#region src/v2019C1/extensions/data-model/query/resolve.ts
24572
+ async function S(e, n) {
24573
+ let { records: r } = n, i = {
24574
+ lnodeTypes: /* @__PURE__ */ new Map(),
24575
+ doTypes: /* @__PURE__ */ new Map(),
24576
+ daTypes: /* @__PURE__ */ new Map(),
24577
+ enumTypes: /* @__PURE__ */ new Map()
24578
+ };
24579
+ for (let n of r) {
24580
+ let r = await e.getAttribute(n, { name: "lnType" });
24581
+ if (!r) continue;
24582
+ let [a] = await e.findByAttributes({
24583
+ tagName: "LNodeType",
24584
+ attributes: { id: r }
24585
+ });
24586
+ if (s(a, {
24587
+ key: "ELEMENT_NOT_FOUND",
24588
+ detail: `LNodeType not found for lnType="${r}"`
24589
+ }), !C(i.lnodeTypes, r, a)) continue;
24590
+ let o = a.children.filter((e) => t(e, "DO")), c = await e.getRecords(o);
24591
+ for (let t of c) {
24592
+ if (!t) continue;
24593
+ let n = await e.getAttribute(t, { name: "type" });
24594
+ if (!n) continue;
24595
+ let [r] = await e.findByAttributes({
24596
+ tagName: "DOType",
24597
+ attributes: { id: n }
24598
+ });
24599
+ r && C(i.doTypes, n, r) && await w({
24600
+ query: e,
24601
+ parent: r,
24602
+ dataModelMap: i
24603
+ });
24604
+ }
24605
+ }
24606
+ return {
24607
+ lnodeTypes: Array.from(i.lnodeTypes.values()),
24608
+ doTypes: Array.from(i.doTypes.values()),
24609
+ daTypes: Array.from(i.daTypes.values()),
24610
+ enumTypes: Array.from(i.enumTypes.values())
24611
+ };
24612
+ }
24613
+ function C(e, t, n) {
24614
+ return e.has(t) ? !1 : (e.set(t, n), !0);
24615
+ }
24616
+ async function w(e) {
24617
+ 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")));
24618
+ for (let e of a) {
24619
+ if (!e) continue;
24620
+ let t = await n.getAttribute(e, { name: "bType" }), r = await n.getAttribute(e, { name: "type" });
24621
+ if (r) {
24622
+ if (t === "Enum") {
24623
+ let [e] = await n.findByAttributes({
24624
+ tagName: "EnumType",
24625
+ attributes: { id: r }
24626
+ });
24627
+ e && C(i.enumTypes, r, e);
24628
+ } else if (t === "Struct") {
24629
+ let [e] = await n.findByAttributes({
24630
+ tagName: "DAType",
24631
+ attributes: { id: r }
24632
+ });
24633
+ e && C(i.daTypes, r, e) && await w({
24634
+ query: n,
24635
+ parent: e,
24636
+ dataModelMap: i
24637
+ });
24638
+ }
24639
+ }
24640
+ }
24641
+ if (r.tagName === "DOType") {
24642
+ let e = r.children.filter((e) => t(e, "SDO")), a = await n.getRecords(e);
24643
+ for (let e of a) {
24644
+ let t = await n.getAttribute(e, { name: "type" });
24645
+ if (!t) continue;
24646
+ let [r] = await n.findByAttributes({
24647
+ tagName: "DOType",
24648
+ attributes: { id: t }
24649
+ });
24650
+ r && C(i.doTypes, t, r) && await w({
24651
+ query: n,
24652
+ parent: r,
24653
+ dataModelMap: i
24654
+ });
24655
+ }
24656
+ }
24657
+ }
24658
+ //#endregion
24659
+ //#region src/v2019C1/extensions/data-model/query/is-lnode-locked.ts
24660
+ var ee = "None";
24661
+ async function T(e, t) {
24662
+ let n = await e.any.getAttribute(t, { name: "iedName" });
24663
+ return !!n && n !== ee;
24664
+ }
24665
+ //#endregion
24666
+ //#region src/v2019C1/extensions/data-model/query/index.ts
24667
+ var te = /* @__PURE__ */ l({
24668
+ isLNodeLocked: () => T,
24669
+ resolve: () => S
24670
+ });
24671
+ //#endregion
24571
24672
  //#region src/v2019C1/extensions/clean-up/transaction/orphan-lnode-bindings.ts
24572
- async function ee(e) {
24673
+ async function ne(e) {
24573
24674
  let t = await e.getRecordsByTagName("LNode");
24574
24675
  for (let n of t) {
24575
- let t = await e.getAttribute(n, { name: "iedName" });
24576
- if (!t || t === "None") {
24676
+ if (!await T(e, n)) {
24577
24677
  await e.update(n, { attributes: { iedName: "None" } });
24578
24678
  continue;
24579
24679
  }
24580
- let [r] = await e.findByAttributes({
24680
+ let t = await e.getAttribute(n, { name: "iedName" }), [r] = await e.findByAttributes({
24581
24681
  tagName: "IED",
24582
24682
  attributes: { name: t }
24583
24683
  });
24584
- r || await x(e, n);
24684
+ r || await re(e, n);
24585
24685
  }
24586
24686
  }
24587
- async function x(e, t) {
24687
+ async function re(e, t) {
24588
24688
  let n = await e.getChild(t, "LNodeSpecNaming");
24589
24689
  if (n) {
24590
24690
  let r = await e.getAttribute(n, { name: "sLnClass" }), i = await e.getAttribute(n, { name: "sLnInst" }), a = await e.getAttribute(n, { name: "sPrefix" });
@@ -24595,7 +24695,6 @@ async function x(e, t) {
24595
24695
  iedName: "None",
24596
24696
  ldInst: void 0,
24597
24697
  lnUuid: void 0,
24598
- templateUuid: void 0,
24599
24698
  lnClass: r || void 0,
24600
24699
  lnInst: i || void 0,
24601
24700
  prefix: a || void 0
@@ -24604,7 +24703,6 @@ async function x(e, t) {
24604
24703
  iedName: "None",
24605
24704
  ldInst: void 0,
24606
24705
  lnUuid: void 0,
24607
- templateUuid: void 0,
24608
24706
  lnClass: void 0,
24609
24707
  lnInst: void 0,
24610
24708
  prefix: void 0
@@ -24612,7 +24710,7 @@ async function x(e, t) {
24612
24710
  }
24613
24711
  //#endregion
24614
24712
  //#region src/v2019C1/extensions/reference/constants/path-extraction.ts
24615
- var S = {
24713
+ var ie = {
24616
24714
  AccessPoint: { type: "transparent" },
24617
24715
  Server: { type: "transparent" },
24618
24716
  Private: { type: "transparent" },
@@ -24692,16 +24790,16 @@ var S = {
24692
24790
  PowerSystemRelation: { type: "name" },
24693
24791
  Variable: { type: "name" },
24694
24792
  Process: { type: "name" }
24695
- }, te = [
24793
+ }, ae = [
24696
24794
  "lnClass",
24697
24795
  "prefix",
24698
24796
  "inst",
24699
24797
  "lnInst"
24700
- ], ne = new Set(Object.values(S).flatMap((e) => {
24798
+ ], oe = new Set(Object.values(ie).flatMap((e) => {
24701
24799
  switch (e.type) {
24702
24800
  case "transparent": return [];
24703
24801
  case "name": return ["name"];
24704
- case "lnClass": return [...te];
24802
+ case "lnClass": return [...ae];
24705
24803
  case "attribute": return [e.attr];
24706
24804
  case "sourceRef": return [
24707
24805
  "input",
@@ -24713,13 +24811,13 @@ var S = {
24713
24811
  }));
24714
24812
  //#endregion
24715
24813
  //#region src/v2019C1/extensions/reference/query/build/path-segment.ts
24716
- function re(e) {
24814
+ function se(e) {
24717
24815
  switch (e.type) {
24718
24816
  case "transparent": return () => null;
24719
24817
  case "name": {
24720
24818
  let t = e.separator ?? "/";
24721
24819
  return (e) => {
24722
- let n = w(e, "name");
24820
+ let n = D(e, "name");
24723
24821
  return n ? {
24724
24822
  segment: n,
24725
24823
  separator: t
@@ -24727,34 +24825,34 @@ function re(e) {
24727
24825
  };
24728
24826
  }
24729
24827
  case "lnClass": return (e) => {
24730
- let t = w(e, "lnClass");
24828
+ let t = D(e, "lnClass");
24731
24829
  return t ? {
24732
- segment: `${w(e, "prefix") ?? ""}${t}${w(e, "inst") ?? w(e, "lnInst") ?? ""}`,
24830
+ segment: `${D(e, "prefix") ?? ""}${t}${D(e, "inst") ?? D(e, "lnInst") ?? ""}`,
24733
24831
  separator: "/"
24734
24832
  } : null;
24735
24833
  };
24736
24834
  case "attribute": return (t) => {
24737
- let n = w(t, e.attr);
24835
+ let n = D(t, e.attr);
24738
24836
  return n ? {
24739
24837
  segment: n,
24740
24838
  separator: e.separator
24741
24839
  } : null;
24742
24840
  };
24743
24841
  case "sourceRef": return (e) => {
24744
- let t = w(e, "input");
24842
+ let t = D(e, "input");
24745
24843
  if (!t) return null;
24746
- let n = t, r = w(e, "inputInst");
24844
+ let n = t, r = D(e, "inputInst");
24747
24845
  r && r !== "1" && (n += `(${r})`);
24748
- let i = w(e, "pDA");
24846
+ let i = D(e, "pDA");
24749
24847
  return i && (n += `.${i}`), {
24750
24848
  segment: n,
24751
24849
  separator: "."
24752
24850
  };
24753
24851
  };
24754
24852
  case "controlRef": return (e) => {
24755
- let t = w(e, "output");
24853
+ let t = D(e, "output");
24756
24854
  if (!t) return null;
24757
- let n = t, r = w(e, "outputInst");
24855
+ let n = t, r = D(e, "outputInst");
24758
24856
  return r && r !== "1" && (n += `(${r})`), {
24759
24857
  segment: n,
24760
24858
  separator: "."
@@ -24762,15 +24860,15 @@ function re(e) {
24762
24860
  };
24763
24861
  }
24764
24862
  }
24765
- var ie = Object.fromEntries(Object.entries(S).map(([e, t]) => [e, re(t)]));
24766
- function C(e) {
24767
- let t = ie[e.tagName];
24863
+ var ce = Object.fromEntries(Object.entries(ie).map(([e, t]) => [e, se(t)]));
24864
+ function E(e) {
24865
+ let t = ce[e.tagName];
24768
24866
  return t ? t(e) : null;
24769
24867
  }
24770
- function ae(e) {
24868
+ function le(e) {
24771
24869
  let { record: t, ancestry: n } = e, r = [];
24772
24870
  for (let e of n) {
24773
- let t = C(e);
24871
+ let t = E(e);
24774
24872
  t && r.push({
24775
24873
  ...t,
24776
24874
  ref: {
@@ -24779,7 +24877,7 @@ function ae(e) {
24779
24877
  }
24780
24878
  });
24781
24879
  }
24782
- let i = C(t);
24880
+ let i = E(t);
24783
24881
  return i && r.push({
24784
24882
  ...i,
24785
24883
  ref: {
@@ -24787,36 +24885,36 @@ function ae(e) {
24787
24885
  id: t.id
24788
24886
  }
24789
24887
  }), r.length === 0 ? null : {
24790
- path: oe(r),
24888
+ path: ue(r),
24791
24889
  segments: r
24792
24890
  };
24793
24891
  }
24794
- function w(e, t) {
24892
+ function D(e, t) {
24795
24893
  return e.attributes.find((e) => e.name === t)?.value;
24796
24894
  }
24797
- function oe(e) {
24895
+ function ue(e) {
24798
24896
  let t = e[0].segment;
24799
24897
  for (let n = 1; n < e.length; n++) t += e[n].separator + e[n].segment;
24800
24898
  return t;
24801
24899
  }
24802
24900
  //#endregion
24803
24901
  //#region src/v2019C1/extensions/reference/query/build/build-element-path.ts
24804
- async function se(e, t) {
24902
+ async function de(e, t) {
24805
24903
  let n = await e.getRecord(t);
24806
24904
  if (!n) return null;
24807
24905
  let r = i(n);
24808
- if (!C(r)) {
24906
+ if (!E(r)) {
24809
24907
  let e = r.attributes.find((e) => e.name === "uuid")?.value;
24810
24908
  return console.warn(`[scl] buildElementPath: no path segment for <${r.tagName}>${e ? ` (uuid ${e})` : ""} — cannot build a path to this element; leaving any existing reference path untouched`), null;
24811
24909
  }
24812
- return ae({
24910
+ return le({
24813
24911
  record: r,
24814
24912
  ancestry: (await e.findAncestors(t, { order: "top-down" })).map(i)
24815
24913
  });
24816
24914
  }
24817
24915
  //#endregion
24818
24916
  //#region src/v2019C1/constants/reference-pairs.ts
24819
- var T = {
24917
+ var O = {
24820
24918
  AllocationRoleRef: [{
24821
24919
  attribute: {
24822
24920
  path: "allocationRole",
@@ -25161,7 +25259,7 @@ var T = {
25161
25259
  uuid: "elementUuid"
25162
25260
  },
25163
25261
  resolution: "unsupported",
25164
- target: l,
25262
+ target: u,
25165
25263
  companions: [{
25166
25264
  name: "doName",
25167
25265
  required: !1
@@ -25179,10 +25277,19 @@ var T = {
25179
25277
  target: ["Variable"],
25180
25278
  companions: []
25181
25279
  }]
25182
- };
25280
+ }, k = new Set([
25281
+ "SourceRef",
25282
+ "ControlRef",
25283
+ "DOS",
25284
+ "SDS",
25285
+ "DAS",
25286
+ "InputVar",
25287
+ "OutputVar",
25288
+ "ProcessEcho"
25289
+ ]), A = Object.keys(O), fe = new Set(A), pe = new Set(Object.values(O).flatMap((e) => e.flatMap((e) => e.target)));
25183
25290
  //#endregion
25184
25291
  //#region src/v2019C1/extensions/reference/query/resolve/parse-path.ts
25185
- function ce(e) {
25292
+ function me(e) {
25186
25293
  if (!e) return [];
25187
25294
  let t = [], n = "", r = "/";
25188
25295
  for (let i of e) i === "/" || i === "." ? (n && t.push({
@@ -25194,7 +25301,7 @@ function ce(e) {
25194
25301
  separator: r
25195
25302
  }), t;
25196
25303
  }
25197
- function le(e) {
25304
+ function he(e) {
25198
25305
  let t = e.split("/"), n = t[t.length - 1], r = n.indexOf(".");
25199
25306
  if (r === -1) return { path: e };
25200
25307
  let i = n.substring(0, r), a = n.substring(r + 1);
@@ -25203,19 +25310,19 @@ function le(e) {
25203
25310
  qualifier: a || void 0
25204
25311
  };
25205
25312
  }
25206
- function ue(e, t, n, r) {
25207
- return !e || e === E.unsupported ? null : e === E.direct ? { lookupKey: n } : e === E.iedAddress ? fe(n, r) : e === E.lnode ? de(n) : e === E.behaviorDescription ? pe(t, n, r) : null;
25313
+ function ge(e, t, n, r) {
25314
+ return !e || e === j.unsupported ? null : e === j.direct ? { lookupKey: n } : e === j.iedAddress ? ve(n, r) : e === j.lnode ? _e(n) : e === j.behaviorDescription ? ye(t, n, r) : null;
25208
25315
  }
25209
- function de(e) {
25210
- let { path: t, qualifier: n } = le(e);
25316
+ function _e(e) {
25317
+ let { path: t, qualifier: n } = he(e);
25211
25318
  return {
25212
25319
  lookupKey: t,
25213
25320
  qualifier: n
25214
25321
  };
25215
25322
  }
25216
- function fe(e, t) {
25323
+ function ve(e, t) {
25217
25324
  if (t) {
25218
- let n = ge(t);
25325
+ let n = Se(t);
25219
25326
  if (n) return {
25220
25327
  lookupKey: e,
25221
25328
  fallbackLookupKey: `${n}/${e}`
@@ -25223,15 +25330,15 @@ function fe(e, t) {
25223
25330
  }
25224
25331
  return { lookupKey: e };
25225
25332
  }
25226
- function pe(e, t, n) {
25333
+ function ye(e, t, n) {
25227
25334
  if (!n) return null;
25228
- let r = me(n);
25335
+ let r = be(n);
25229
25336
  return r ? e === "dataName" ? {
25230
25337
  lookupKey: r,
25231
25338
  qualifier: t
25232
- } : e === "inputName" || e === "outputName" ? { lookupKey: `${r}.${he(t)}` } : null : null;
25339
+ } : e === "inputName" || e === "outputName" ? { lookupKey: `${r}.${xe(t)}` } : null : null;
25233
25340
  }
25234
- function me(e) {
25341
+ function be(e) {
25235
25342
  let t = -1;
25236
25343
  for (let n = e.length - 1; n >= 0; n--) if (e[n].tagName === "BehaviorDescription") {
25237
25344
  t = n;
@@ -25240,74 +25347,225 @@ function me(e) {
25240
25347
  if (t === -1) return null;
25241
25348
  let n = [];
25242
25349
  for (let r = 0; r < t; r++) {
25243
- let t = C(e[r]);
25350
+ let t = E(e[r]);
25244
25351
  t && n.push(t);
25245
25352
  }
25246
- return n.length === 0 ? null : oe(n);
25353
+ return n.length === 0 ? null : ue(n);
25247
25354
  }
25248
- function he(e) {
25355
+ function xe(e) {
25249
25356
  let t = e.indexOf("("), n = e.indexOf(".");
25250
25357
  return t === -1 ? n === -1 ? e : e.substring(0, n) : e.substring(0, t);
25251
25358
  }
25252
- function ge(e) {
25359
+ function Se(e) {
25253
25360
  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;
25254
25361
  return null;
25255
25362
  }
25256
25363
  //#endregion
25257
25364
  //#region src/v2019C1/extensions/reference/query/build/build-reference-path.ts
25258
- async function _e(e, t) {
25259
- let { reference: n, target: r } = t, a = ve(n.tagName, r.tagName);
25365
+ async function Ce(e, t) {
25366
+ let { reference: n, target: r } = t;
25367
+ if (N.has(n.tagName)) return null;
25368
+ let a = Ee(n.tagName, r.tagName);
25260
25369
  if (!a) return null;
25261
25370
  let o = a.resolution;
25262
- if (o === E.behaviorDescription) {
25371
+ if (o === j.behaviorDescription) {
25263
25372
  let t = await e.getRecord(r);
25264
- return t ? C(i(t))?.segment ?? null : null;
25373
+ return t ? E(i(t))?.segment ?? null : null;
25265
25374
  }
25266
- let s = await se(e, r);
25375
+ let s = await de(e, r);
25267
25376
  if (!s) return null;
25268
25377
  let c = s.path;
25269
- if (o === E.lnode) {
25378
+ if (o === j.lnode) {
25270
25379
  let t = await e.getRecord(n);
25271
25380
  if (!t) return c;
25272
- let r = t.attributes.find((e) => e.name === a.attribute.path)?.value;
25273
- if (!r) return c;
25274
- let { qualifier: i } = le(r);
25275
- return i ? `${c}.${i}` : c;
25381
+ let r = Te(t, a);
25382
+ return r ? `${c}.${we(t, a) ?? r}` : c;
25276
25383
  }
25277
25384
  return c;
25278
25385
  }
25279
- function ve(e, t) {
25280
- let n = T[e];
25386
+ function we(e, t) {
25387
+ let [n, r] = t.companions;
25388
+ if (!n) return;
25389
+ let i = e.attributes.find((e) => e.name === n.name)?.value;
25390
+ if (!i) return;
25391
+ let a = r ? e.attributes.find((e) => e.name === r.name)?.value : void 0;
25392
+ return a ? `${i}.${a}` : i;
25393
+ }
25394
+ function Te(e, t) {
25395
+ let n = e.attributes.find((e) => e.name === t.attribute.path)?.value;
25396
+ if (n) return he(n).qualifier;
25397
+ }
25398
+ function Ee(e, t) {
25399
+ let n = O[e];
25281
25400
  return n ? n.find((e) => e.target.includes(t)) ?? null : null;
25282
25401
  }
25283
25402
  //#endregion
25403
+ //#region src/v2019C1/extensions/reference/constants/resolution-types.ts
25404
+ var j = {
25405
+ direct: "direct",
25406
+ lnode: "lnode",
25407
+ iedAddress: "ied-address",
25408
+ behaviorDescription: "behavior-description",
25409
+ unsupported: "unsupported"
25410
+ }, M = {
25411
+ LN: [{
25412
+ attribute: "lnType",
25413
+ target: "LNodeType"
25414
+ }],
25415
+ LN0: [{
25416
+ attribute: "lnType",
25417
+ target: "LNodeType"
25418
+ }],
25419
+ LNode: [{
25420
+ attribute: "lnType",
25421
+ target: "LNodeType"
25422
+ }],
25423
+ DO: [{
25424
+ attribute: "type",
25425
+ target: "DOType"
25426
+ }],
25427
+ SDO: [{
25428
+ attribute: "type",
25429
+ target: "DOType"
25430
+ }],
25431
+ DA: [{
25432
+ attribute: "type",
25433
+ target: "EnumType",
25434
+ when: {
25435
+ attribute: "bType",
25436
+ equals: "Enum"
25437
+ }
25438
+ }, {
25439
+ attribute: "type",
25440
+ target: "DAType",
25441
+ when: {
25442
+ attribute: "bType",
25443
+ equals: "Struct"
25444
+ }
25445
+ }],
25446
+ BDA: [{
25447
+ attribute: "type",
25448
+ target: "EnumType",
25449
+ when: {
25450
+ attribute: "bType",
25451
+ equals: "Enum"
25452
+ }
25453
+ }, {
25454
+ attribute: "type",
25455
+ target: "DAType",
25456
+ when: {
25457
+ attribute: "bType",
25458
+ equals: "Struct"
25459
+ }
25460
+ }]
25461
+ };
25462
+ //#endregion
25463
+ //#region src/v2019C1/extensions/reference/constants/helpers.ts
25464
+ function De(e) {
25465
+ let t = {};
25466
+ for (let [n, r] of Object.entries(e)) for (let e of r) {
25467
+ let r = t[e.resolution] ??= /* @__PURE__ */ new Map();
25468
+ for (let t of e.target) {
25469
+ let i = r.get(t) ?? [];
25470
+ i.push({
25471
+ refTagName: n,
25472
+ uuidAttr: e.attribute.uuid,
25473
+ pathAttr: e.attribute.path
25474
+ }), r.set(t, i);
25475
+ }
25476
+ }
25477
+ return t;
25478
+ }
25479
+ function Oe(e) {
25480
+ let t = /* @__PURE__ */ new Map();
25481
+ for (let [n, r] of Object.entries(e)) t.set(n, r.map((e) => ({
25482
+ uuidAttr: e.attribute.uuid,
25483
+ pathAttr: e.attribute.path,
25484
+ resolution: e.resolution,
25485
+ targetTagNames: e.target
25486
+ })));
25487
+ return t;
25488
+ }
25489
+ function ke(e) {
25490
+ let t = /* @__PURE__ */ new Map();
25491
+ for (let [n, r] of Object.entries(e)) for (let e of r) {
25492
+ let r = t.get(e.target) ?? [];
25493
+ r.push({
25494
+ refTagName: n,
25495
+ attribute: e.attribute,
25496
+ when: e.when
25497
+ }), t.set(e.target, r);
25498
+ }
25499
+ return t;
25500
+ }
25501
+ //#endregion
25502
+ //#region src/v2019C1/extensions/reference/constants/derived.ts
25503
+ var Ae = De(O), je = [
25504
+ j.direct,
25505
+ j.lnode,
25506
+ j.iedAddress,
25507
+ j.behaviorDescription
25508
+ ], Me = [...je, j.unsupported], Ne = Oe(O), N = new Map(Object.entries(O).flatMap(([e, t]) => t.filter((e) => e.attribute.path === "mappedDoName" || e.attribute.path === "mappedDaName").map((t) => [e, {
25509
+ path: t.attribute.path,
25510
+ uuid: t.attribute.uuid
25511
+ }]))), Pe = [...new Set(Object.values(O).flatMap((e) => e.map((e) => e.attribute.uuid)))], P = new Map(Object.entries(M).map(([e, t]) => [e, [...new Set(t.map((e) => e.attribute))]])), Fe = ke(M), Ie = new Set(Fe.keys()), Le = new Set([..._.LNode?.attributes?.identityFields ?? [], ...P.get("LNode") ?? []]), Re = {
25512
+ FunctionCatRef: ["SubCategory", "FunctionCategory"],
25513
+ PowerSystemRelation: ["PowerSystemRelations"],
25514
+ Resource: ["ProcessResource", "ProcessResources"],
25515
+ VariableApplyTo: ["Variable"]
25516
+ };
25517
+ //#endregion
25518
+ //#region src/v2019C1/extensions/reference/query/build/build-mapped-name.ts
25519
+ async function ze(e, t) {
25520
+ let n = N.get(t.tagName);
25521
+ if (!n) return;
25522
+ let r = t.attributes.find((e) => e.name === "name")?.value;
25523
+ if (!r) return;
25524
+ let i = t.attributes.find((e) => e.name === n.path)?.value, a = Be(i, t.tagName === "DAS" && !await Ve(e, t)) ?? r;
25525
+ return a === r ? void 0 : a;
25526
+ }
25527
+ function Be(e, t) {
25528
+ if (!e) return;
25529
+ let { path: n, qualifier: r } = he(e), i = r ?? n;
25530
+ if (t) return i || void 0;
25531
+ let a = i.split(".");
25532
+ return a[a.length - 1] || void 0;
25533
+ }
25534
+ async function Ve(e, t) {
25535
+ let n = (await e.findAncestors(t)).find((e) => e.tagName === "DOS" || e.tagName === "SDS");
25536
+ return n ? !!await e.getAttribute({
25537
+ tagName: n.tagName,
25538
+ id: n.id
25539
+ }, { name: "mappedLnUuid" }) : !1;
25540
+ }
25541
+ //#endregion
25284
25542
  //#region src/v2019C1/extensions/reference/query/build/build-mapped-lnode-path.ts
25285
- function ye(e) {
25543
+ function He(e) {
25286
25544
  let t = e.iedName;
25287
- if (!t || t === be) return null;
25545
+ if (!t || t === Ue) return null;
25288
25546
  let n = e.ldInst, r = e.lnClass;
25289
25547
  return !n || !r ? null : `${t}/${n}/${`${e.prefix ?? ""}${r}${e.lnInst ?? ""}`}`;
25290
25548
  }
25291
- var be = "None";
25549
+ var Ue = "None";
25292
25550
  //#endregion
25293
25551
  //#region src/v2019C1/extensions/reference/query/resolve/resolve-reference-path.ts
25294
- async function xe(e, t, n) {
25295
- let r = Se(t.tagName, n);
25552
+ async function We(e, t, n) {
25553
+ let r = Ge(t.tagName, n);
25296
25554
  if (!r) return;
25297
25555
  let a = t.attributes.find((e) => e.name === n)?.value;
25298
25556
  if (!a) return;
25299
- let o = await Ce(e, t, r);
25557
+ let o = await Ke(e, t, r);
25300
25558
  if (o) return {
25301
25559
  record: o,
25302
- qualifier: we(r, n, a)
25560
+ qualifier: qe(r, n, a)
25303
25561
  };
25304
25562
  let s;
25305
- (r.resolution === E.behaviorDescription || r.resolution === E.iedAddress) && (s = (await e.findAncestors(t, { order: "top-down" })).map((e) => i(e)));
25306
- let c = ue(r.resolution, n, a, s);
25563
+ (r.resolution === j.behaviorDescription || r.resolution === j.iedAddress) && (s = (await e.findAncestors(t, { order: "top-down" })).map((e) => i(e)));
25564
+ let c = ge(r.resolution, n, a, s);
25307
25565
  if (!c) return;
25308
- let l = ce(c.lookupKey);
25566
+ let l = me(c.lookupKey);
25309
25567
  if (l.length === 0) return;
25310
- let u = l[l.length - 1], d = l.slice(0, -1), f = await Oe({
25568
+ let u = l[l.length - 1], d = l.slice(0, -1), f = await Ze({
25311
25569
  query: e,
25312
25570
  targets: r.target,
25313
25571
  segment: u,
@@ -25318,11 +25576,11 @@ async function xe(e, t, n) {
25318
25576
  qualifier: c.qualifier
25319
25577
  };
25320
25578
  }
25321
- function Se(e, t) {
25322
- let n = T[e];
25579
+ function Ge(e, t) {
25580
+ let n = O[e];
25323
25581
  if (n) return n.find((e) => e.attribute.path === t);
25324
25582
  }
25325
- async function Ce(e, t, n) {
25583
+ async function Ke(e, t, n) {
25326
25584
  let r = n.attribute.uuid, i = t.attributes.find((e) => e.name === r)?.value;
25327
25585
  if (i) for (let t of n.target) {
25328
25586
  let n = await e.findByAttributes({
@@ -25332,19 +25590,19 @@ async function Ce(e, t, n) {
25332
25590
  if (n.length > 0) return n[0];
25333
25591
  }
25334
25592
  }
25335
- function we(e, t, n) {
25336
- if (e.resolution === E.lnode) return le(n).qualifier;
25337
- if (e.resolution === E.behaviorDescription && t === "dataName") return n;
25593
+ function qe(e, t, n) {
25594
+ if (e.resolution === j.lnode) return he(n).qualifier;
25595
+ if (e.resolution === j.behaviorDescription && t === "dataName") return n;
25338
25596
  }
25339
- var Te = new Set(g.LNode.attributes.details.lnClass.facets.enumeration), Ee = {
25597
+ var Je = new Set(_.LNode.attributes.details.lnClass.facets.enumeration), Ye = {
25340
25598
  LNode: "lnInst",
25341
25599
  LN: "inst",
25342
25600
  LN0: "inst"
25343
25601
  };
25344
- function De(e) {
25602
+ function Xe(e) {
25345
25603
  for (let t = 0; t <= e.length - 4; t++) {
25346
25604
  let n = e.substring(t, t + 4);
25347
- if (Te.has(n)) return {
25605
+ if (Je.has(n)) return {
25348
25606
  prefix: e.substring(0, t),
25349
25607
  lnClass: n,
25350
25608
  inst: e.substring(t + 4)
@@ -25352,12 +25610,12 @@ function De(e) {
25352
25610
  }
25353
25611
  return null;
25354
25612
  }
25355
- async function Oe(e) {
25613
+ async function Ze(e) {
25356
25614
  let { query: t, targets: n, segment: r, expectedAncestry: i } = e;
25357
25615
  for (let e of n) {
25358
- let n = Ee[e];
25616
+ let n = Ye[e];
25359
25617
  if (n) {
25360
- let a = await ke({
25618
+ let a = await Qe({
25361
25619
  query: t,
25362
25620
  tagName: e,
25363
25621
  segment: r,
@@ -25366,7 +25624,7 @@ async function Oe(e) {
25366
25624
  });
25367
25625
  if (a) return a;
25368
25626
  } else {
25369
- let n = await Ae({
25627
+ let n = await $e({
25370
25628
  query: t,
25371
25629
  tagName: e,
25372
25630
  segment: r,
@@ -25376,8 +25634,8 @@ async function Oe(e) {
25376
25634
  }
25377
25635
  }
25378
25636
  }
25379
- async function ke(e) {
25380
- let { query: t, tagName: n, segment: r, instAttr: i, expectedAncestry: a } = e, o = De(r.segment);
25637
+ async function Qe(e) {
25638
+ let { query: t, tagName: n, segment: r, instAttr: i, expectedAncestry: a } = e, o = Xe(r.segment);
25381
25639
  if (!o) return;
25382
25640
  let s = await t.findByAttributes({
25383
25641
  tagName: n,
@@ -25385,37 +25643,37 @@ async function ke(e) {
25385
25643
  });
25386
25644
  for (let e of s) {
25387
25645
  let n = e.attributes.find((e) => e.name === "prefix")?.value ?? "", r = e.attributes.find((e) => e.name === i)?.value ?? "";
25388
- if (!(n !== o.prefix || r !== o.inst) && await je(t, e, a)) return e;
25646
+ if (!(n !== o.prefix || r !== o.inst) && await et(t, e, a)) return e;
25389
25647
  }
25390
25648
  }
25391
- async function Ae(e) {
25649
+ async function $e(e) {
25392
25650
  let { query: t, tagName: n, segment: r, expectedAncestry: a } = e, o = await t.getRecordsByTagName(n);
25393
25651
  for (let e of o) {
25394
- let n = C(i(e));
25395
- if (!(!n || n.segment !== r.segment) && await je(t, e, a)) return e;
25652
+ let n = E(i(e));
25653
+ if (!(!n || n.segment !== r.segment) && await et(t, e, a)) return e;
25396
25654
  }
25397
25655
  }
25398
- async function je(e, t, n) {
25656
+ async function et(e, t, n) {
25399
25657
  if (n.length === 0) return !0;
25400
25658
  let r = await e.findAncestors(t), a = [];
25401
25659
  for (let e = r.length - 1; e >= 0; e--) {
25402
- let t = C(i(r[e]));
25660
+ let t = E(i(r[e]));
25403
25661
  t && a.push(t);
25404
25662
  }
25405
25663
  return a.length === n.length ? a.every((e, t) => e.segment === n[t].segment) : !1;
25406
25664
  }
25407
25665
  //#endregion
25408
25666
  //#region src/v2019C1/extensions/reference/query/resolve/resolve-element-path.ts
25409
- async function Me(e, t) {
25410
- let n = ce(t);
25411
- if (n.length !== 0) return Ne({
25667
+ async function tt(e, t) {
25668
+ let n = me(t);
25669
+ if (n.length !== 0) return nt({
25412
25670
  query: e,
25413
25671
  current: await e.getRoot(),
25414
25672
  segments: n,
25415
25673
  index: 0
25416
25674
  });
25417
25675
  }
25418
- async function Ne(e) {
25676
+ async function nt(e) {
25419
25677
  let { query: t, current: n, segments: r, index: a } = e;
25420
25678
  if (a >= r.length) return n;
25421
25679
  let o = n.children ?? [];
@@ -25423,9 +25681,9 @@ async function Ne(e) {
25423
25681
  let s = await t.getRecords(o), c = r[a];
25424
25682
  for (let e of s) {
25425
25683
  if (!e) continue;
25426
- let n = C(i(e));
25684
+ let n = E(i(e));
25427
25685
  if (!n) {
25428
- let n = await Ne({
25686
+ let n = await nt({
25429
25687
  query: t,
25430
25688
  current: e,
25431
25689
  segments: r,
@@ -25435,7 +25693,7 @@ async function Ne(e) {
25435
25693
  continue;
25436
25694
  }
25437
25695
  if (n.segment === c.segment && n.separator === c.separator) {
25438
- let n = await Ne({
25696
+ let n = await nt({
25439
25697
  query: t,
25440
25698
  current: e,
25441
25699
  segments: r,
@@ -25448,14 +25706,14 @@ async function Ne(e) {
25448
25706
  }
25449
25707
  //#endregion
25450
25708
  //#region src/v2019C1/extensions/reference/query/resolve/resolve-mapped-lnode.ts
25451
- var Pe = new Set(["LN", "LN0"]);
25452
- async function Fe(e, t) {
25453
- let n = ye(Ie(t));
25709
+ var rt = new Set(["LN", "LN0"]);
25710
+ async function it(e, t) {
25711
+ let n = He(at(t));
25454
25712
  if (!n) return;
25455
- let r = await Me(e, n);
25456
- if (!(!r || !Pe.has(r.tagName))) return r;
25713
+ let r = await tt(e, n);
25714
+ if (!(!r || !rt.has(r.tagName))) return r;
25457
25715
  }
25458
- function Ie(e) {
25716
+ function at(e) {
25459
25717
  let t = (t) => e.attributes.find((e) => e.name === t)?.value;
25460
25718
  return {
25461
25719
  iedName: t("iedName"),
@@ -25466,151 +25724,30 @@ function Ie(e) {
25466
25724
  };
25467
25725
  }
25468
25726
  //#endregion
25469
- //#region src/v2019C1/extensions/reference/constants/resolution-types.ts
25470
- var E = {
25471
- direct: "direct",
25472
- lnode: "lnode",
25473
- iedAddress: "ied-address",
25474
- behaviorDescription: "behavior-description",
25475
- unsupported: "unsupported"
25476
- }, D = {
25477
- LN: [{
25478
- attribute: "lnType",
25479
- target: "LNodeType"
25480
- }],
25481
- LN0: [{
25482
- attribute: "lnType",
25483
- target: "LNodeType"
25484
- }],
25485
- LNode: [{
25486
- attribute: "lnType",
25487
- target: "LNodeType"
25488
- }],
25489
- DO: [{
25490
- attribute: "type",
25491
- target: "DOType"
25492
- }],
25493
- SDO: [{
25494
- attribute: "type",
25495
- target: "DOType"
25496
- }],
25497
- DA: [{
25498
- attribute: "type",
25499
- target: "EnumType",
25500
- when: {
25501
- attribute: "bType",
25502
- equals: "Enum"
25503
- }
25504
- }, {
25505
- attribute: "type",
25506
- target: "DAType",
25507
- when: {
25508
- attribute: "bType",
25509
- equals: "Struct"
25510
- }
25511
- }],
25512
- BDA: [{
25513
- attribute: "type",
25514
- target: "EnumType",
25515
- when: {
25516
- attribute: "bType",
25517
- equals: "Enum"
25518
- }
25519
- }, {
25520
- attribute: "type",
25521
- target: "DAType",
25522
- when: {
25523
- attribute: "bType",
25524
- equals: "Struct"
25525
- }
25526
- }]
25527
- };
25528
- //#endregion
25529
- //#region src/v2019C1/extensions/reference/constants/helpers.ts
25530
- function Le(e) {
25531
- let t = {};
25532
- for (let [n, r] of Object.entries(e)) for (let e of r) {
25533
- let r = t[e.resolution] ??= /* @__PURE__ */ new Map();
25534
- for (let t of e.target) {
25535
- let i = r.get(t) ?? [];
25536
- i.push({
25537
- refTagName: n,
25538
- uuidAttr: e.attribute.uuid,
25539
- pathAttr: e.attribute.path
25540
- }), r.set(t, i);
25541
- }
25542
- }
25543
- return t;
25544
- }
25545
- function Re(e) {
25546
- let t = /* @__PURE__ */ new Map();
25547
- for (let [n, r] of Object.entries(e)) t.set(n, r.map((e) => ({
25548
- uuidAttr: e.attribute.uuid,
25549
- pathAttr: e.attribute.path,
25550
- resolution: e.resolution,
25551
- targetTagNames: e.target
25552
- })));
25553
- return t;
25554
- }
25555
- function ze(e) {
25556
- let t = /* @__PURE__ */ new Map();
25557
- for (let [n, r] of Object.entries(e)) for (let e of r) {
25558
- let r = t.get(e.target) ?? [];
25559
- r.push({
25560
- refTagName: n,
25561
- attribute: e.attribute,
25562
- when: e.when
25563
- }), t.set(e.target, r);
25564
- }
25565
- return t;
25566
- }
25567
- //#endregion
25568
- //#region src/v2019C1/extensions/reference/constants/derived.ts
25569
- var Be = Le(T), Ve = [
25570
- E.direct,
25571
- E.lnode,
25572
- E.iedAddress,
25573
- E.behaviorDescription
25574
- ], He = [...Ve, E.unsupported], Ue = Re(T), We = [...new Set(Object.values(T).flatMap((e) => e.map((e) => e.attribute.uuid)))], Ge = new Map(Object.entries(D).map(([e, t]) => [e, [...new Set(t.map((e) => e.attribute))]])), Ke = ze(D), qe = new Set(Ke.keys()), Je = new Set([
25575
- "SourceRef",
25576
- "ControlRef",
25577
- "DOS",
25578
- "SDS",
25579
- "DAS",
25580
- "InputVar",
25581
- "OutputVar",
25582
- "ProcessEcho"
25583
- ]), Ye = {
25584
- FunctionCatRef: ["SubCategory", "FunctionCategory"],
25585
- PowerSystemRelation: ["PowerSystemRelations"],
25586
- Resource: ["ProcessResource", "ProcessResources"],
25587
- VariableApplyTo: ["Variable"]
25588
- };
25589
- //#endregion
25590
25727
  //#region src/v2019C1/extensions/reference/guards.ts
25591
- function Xe(e) {
25592
- return qe.has(e);
25728
+ function ot(e) {
25729
+ return Ie.has(e);
25593
25730
  }
25594
25731
  //#endregion
25595
25732
  //#region src/v2019C1/extensions/reference/query/find/find-refs-pointing-to.ts
25596
- async function O(e, t) {
25733
+ async function F(e, t) {
25597
25734
  let { target: n, containerTagName: r } = t, i = await e.getRecord(n);
25598
- return i ? Xe(i.tagName) ? Qe(e, i, r) : Ze(e, i, r) : [];
25735
+ return i ? ot(i.tagName) ? ct(e, i, r) : st(e, i, r) : [];
25599
25736
  }
25600
- async function Ze(e, t, r) {
25737
+ async function st(e, t, r) {
25601
25738
  let i = t.attributes.find((e) => e.name === "uuid")?.value;
25602
25739
  if (!i) return [];
25603
- let a = et(t.tagName);
25740
+ let a = ut(t.tagName);
25604
25741
  if (a.length === 0) return [];
25605
25742
  let o = [];
25606
25743
  for (let t of a) {
25607
- if (!n(t.refTagName, b)) continue;
25744
+ if (!n(t.refTagName, x)) continue;
25608
25745
  let a = await e.findByAttributes({
25609
25746
  tagName: t.refTagName,
25610
25747
  attributes: { [t.uuidAttr]: i }
25611
25748
  });
25612
25749
  for (let t of a) {
25613
- let n = r ? await tt(e, t, r) : void 0;
25750
+ let n = r ? await dt(e, t, r) : void 0;
25614
25751
  o.push({
25615
25752
  ref: t,
25616
25753
  container: n
@@ -25619,19 +25756,19 @@ async function Ze(e, t, r) {
25619
25756
  }
25620
25757
  return o;
25621
25758
  }
25622
- async function Qe(e, t, r) {
25759
+ async function ct(e, t, r) {
25623
25760
  let i = t.attributes.find((e) => e.name === "id")?.value;
25624
25761
  if (!i) return [];
25625
- let a = Ke.get(t.tagName) ?? [], o = [];
25762
+ let a = Fe.get(t.tagName) ?? [], o = [];
25626
25763
  for (let t of a) {
25627
- if (!n(t.refTagName, b)) continue;
25764
+ if (!n(t.refTagName, x)) continue;
25628
25765
  let a = await e.findByAttributes({
25629
25766
  tagName: t.refTagName,
25630
25767
  attributes: { [t.attribute]: i }
25631
25768
  });
25632
25769
  for (let n of a) {
25633
- if (!$e(n, t)) continue;
25634
- let i = r ? await tt(e, n, r) : void 0;
25770
+ if (!lt(n, t)) continue;
25771
+ let i = r ? await dt(e, n, r) : void 0;
25635
25772
  o.push({
25636
25773
  ref: n,
25637
25774
  container: i
@@ -25640,23 +25777,23 @@ async function Qe(e, t, r) {
25640
25777
  }
25641
25778
  return o;
25642
25779
  }
25643
- function $e(e, t) {
25780
+ function lt(e, t) {
25644
25781
  return t.when ? e.attributes.find((e) => e.name === t.when.attribute)?.value === t.when.equals : !0;
25645
25782
  }
25646
- function et(e) {
25783
+ function ut(e) {
25647
25784
  let t = [];
25648
- for (let n of He) {
25649
- let r = Be[n]?.get(e);
25785
+ for (let n of Me) {
25786
+ let r = Ae[n]?.get(e);
25650
25787
  r && t.push(...r);
25651
25788
  }
25652
25789
  return t;
25653
25790
  }
25654
- async function tt(e, t, n) {
25791
+ async function dt(e, t, n) {
25655
25792
  return (await e.findAncestors(t, { stopAtTagName: n })).find((e) => e.tagName === n);
25656
25793
  }
25657
25794
  //#endregion
25658
25795
  //#region src/v2019C1/extensions/reference/query/provenance/get-provenance.constants.ts
25659
- var nt = {
25796
+ var ft = {
25660
25797
  Application: "application",
25661
25798
  Function: "function",
25662
25799
  SubFunction: "function",
@@ -25667,10 +25804,10 @@ var nt = {
25667
25804
  };
25668
25805
  //#endregion
25669
25806
  //#region src/v2019C1/extensions/reference/query/provenance/get-provenance.ts
25670
- async function rt(e) {
25807
+ async function pt(e) {
25671
25808
  let t = await e.getRecordsByTagName("SclFileReference"), n = [];
25672
25809
  for (let r of t) {
25673
- let t = await it(e, r);
25810
+ let t = await mt(e, r);
25674
25811
  if (!t) continue;
25675
25812
  let { fileType: i, fileUuid: a, fileName: o, version: s, revision: c } = await e.getAttributes(r);
25676
25813
  n.push({
@@ -25684,17 +25821,17 @@ async function rt(e) {
25684
25821
  }
25685
25822
  return n;
25686
25823
  }
25687
- async function it(e, t) {
25824
+ async function mt(e, t) {
25688
25825
  let n = await e.findAncestors(t);
25689
25826
  for (let e of n) {
25690
- let t = nt[e.tagName];
25827
+ let t = ft[e.tagName];
25691
25828
  if (t) return {
25692
25829
  kind: t,
25693
- ref: at(e.tagName, e.id)
25830
+ ref: ht(e.tagName, e.id)
25694
25831
  };
25695
25832
  }
25696
25833
  }
25697
- function at(e, t) {
25834
+ function ht(e, t) {
25698
25835
  return {
25699
25836
  tagName: e,
25700
25837
  id: t
@@ -25702,22 +25839,23 @@ function at(e, t) {
25702
25839
  }
25703
25840
  //#endregion
25704
25841
  //#region src/v2019C1/extensions/reference/query/index.ts
25705
- var ot = /* @__PURE__ */ c({
25706
- buildElementPath: () => se,
25707
- buildMappedLNodePath: () => ye,
25708
- buildReferencePath: () => _e,
25709
- findRefsPointingTo: () => O,
25710
- getProvenance: () => rt,
25711
- resolveElementPath: () => Me,
25712
- resolveMappedLNode: () => Fe,
25713
- resolveReferencePath: () => xe
25842
+ var gt = /* @__PURE__ */ l({
25843
+ buildElementPath: () => de,
25844
+ buildMappedLNodePath: () => He,
25845
+ buildMappedName: () => ze,
25846
+ buildReferencePath: () => Ce,
25847
+ findRefsPointingTo: () => F,
25848
+ getProvenance: () => pt,
25849
+ resolveElementPath: () => tt,
25850
+ resolveMappedLNode: () => it,
25851
+ resolveReferencePath: () => We
25714
25852
  });
25715
25853
  //#endregion
25716
25854
  //#region src/v2019C1/extensions/reference/transaction/apply-type-id-remap.ts
25717
- async function k(e, t) {
25855
+ async function I(e, t) {
25718
25856
  let { records: n, idRemap: r } = t;
25719
25857
  if (r.size !== 0) for (let t of n) {
25720
- let n = Ge.get(t.tagName);
25858
+ let n = P.get(t.tagName);
25721
25859
  if (!n) continue;
25722
25860
  let i = await e.getRecord(t);
25723
25861
  if (!i) continue;
@@ -25733,12 +25871,12 @@ async function k(e, t) {
25733
25871
  }
25734
25872
  //#endregion
25735
25873
  //#region src/v2019C1/extensions/reference/transaction/write-provenance.ts
25736
- var st = {
25874
+ var _t = {
25737
25875
  FSD: "FunctionSclRef",
25738
25876
  ASD: "ApplicationSclRef"
25739
25877
  };
25740
- async function ct(e, t) {
25741
- 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: st[i] }), { name: c } = await n.getDocumentInfo();
25878
+ async function vt(e, t) {
25879
+ 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: _t[i] }), { name: c } = await n.getDocumentInfo();
25742
25880
  await e.addChild(s, {
25743
25881
  tagName: "SclFileReference",
25744
25882
  attributes: {
@@ -25752,17 +25890,17 @@ async function ct(e, t) {
25752
25890
  }
25753
25891
  //#endregion
25754
25892
  //#region src/v2019C1/extensions/reference/index.ts
25755
- var A = {
25756
- query: ot,
25757
- transaction: /* @__PURE__ */ c({
25758
- applyTypeIdRemap: () => k,
25759
- writeProvenance: () => ct
25893
+ var L = {
25894
+ query: gt,
25895
+ transaction: /* @__PURE__ */ l({
25896
+ applyTypeIdRemap: () => I,
25897
+ writeProvenance: () => vt
25760
25898
  })
25761
25899
  };
25762
25900
  //#endregion
25763
25901
  //#region src/v2019C1/extensions/clean-up/transaction/prune-empty-containers.ts
25764
- async function lt(e) {
25765
- let t = [...Object.values(Ye).flat(), "Private"];
25902
+ async function yt(e) {
25903
+ let t = [...Object.values(Re).flat(), "Private"];
25766
25904
  for (let n of t) {
25767
25905
  let t = await e.getRecordsByTagName(n);
25768
25906
  for (let n of t) n.children.length === 0 && await e.delete(n);
@@ -25770,27 +25908,26 @@ async function lt(e) {
25770
25908
  }
25771
25909
  //#endregion
25772
25910
  //#region src/v2019C1/extensions/clean-up/transaction/orphan-uuid-refs.ts
25773
- async function ut(e) {
25774
- let t = Object.keys(T);
25775
- for (let n of t) {
25776
- let t = T[n], r = await e.getRecordsByTagName(n);
25911
+ async function bt(e) {
25912
+ for (let t of A) {
25913
+ let n = O[t], r = await e.getRecordsByTagName(t);
25777
25914
  for (let i of r) {
25778
25915
  let r = !1, a = !1, o = {};
25779
- for (let n of t) {
25780
- let t = await e.getAttribute(i, { name: n.attribute.uuid });
25781
- if (t) if (r = !0, await dt(e, t, n.target)) a = !0;
25916
+ for (let t of n) {
25917
+ let n = await e.getAttribute(i, { name: t.attribute.uuid });
25918
+ if (n) if (r = !0, await xt(e, n, t.target)) a = !0;
25782
25919
  else {
25783
- o[n.attribute.uuid] = void 0, o[n.attribute.path] = void 0;
25784
- for (let e of n.companions) o[e.name] = void 0;
25920
+ o[t.attribute.uuid] = void 0, o[t.attribute.path] = void 0;
25921
+ for (let e of t.companions) o[e.name] = void 0;
25785
25922
  }
25786
25923
  }
25787
25924
  Object.keys(o).length > 0 && await e.update(i, { attributes: o });
25788
- let s = Je.has(n);
25925
+ let s = k.has(t);
25789
25926
  r && !a && !s && await e.delete(i);
25790
25927
  }
25791
25928
  }
25792
25929
  }
25793
- async function dt(e, t, n) {
25930
+ async function xt(e, t, n) {
25794
25931
  for (let r of n) {
25795
25932
  let [n] = await e.findByAttributes({
25796
25933
  tagName: r,
@@ -25802,171 +25939,80 @@ async function dt(e, t, n) {
25802
25939
  }
25803
25940
  //#endregion
25804
25941
  //#region src/v2019C1/extensions/clean-up/index.ts
25805
- var j = { transaction: /* @__PURE__ */ c({
25806
- orphanUuidRefs: () => ut,
25807
- pruneEmptyContainers: () => lt,
25808
- resetLNode: () => ee
25809
- }) };
25810
- //#endregion
25811
- //#region src/v2019C1/extensions/data-model/query/resolve.ts
25812
- async function ft(e, n) {
25813
- let { records: r } = n, i = {
25814
- lnodeTypes: /* @__PURE__ */ new Map(),
25815
- doTypes: /* @__PURE__ */ new Map(),
25816
- daTypes: /* @__PURE__ */ new Map(),
25817
- enumTypes: /* @__PURE__ */ new Map()
25818
- };
25819
- for (let n of r) {
25820
- let r = await e.getAttribute(n, { name: "lnType" });
25821
- if (!r) continue;
25822
- let [a] = await e.findByAttributes({
25823
- tagName: "LNodeType",
25824
- attributes: { id: r }
25825
- });
25826
- if (o(a, {
25827
- key: "ELEMENT_NOT_FOUND",
25828
- detail: `LNodeType not found for lnType="${r}"`
25829
- }), !M(i.lnodeTypes, r, a)) continue;
25830
- let s = a.children.filter((e) => t(e, "DO")), c = await e.getRecords(s);
25831
- for (let t of c) {
25832
- if (!t) continue;
25833
- let n = await e.getAttribute(t, { name: "type" });
25834
- if (!n) continue;
25835
- let [r] = await e.findByAttributes({
25836
- tagName: "DOType",
25837
- attributes: { id: n }
25838
- });
25839
- r && M(i.doTypes, n, r) && await pt({
25840
- query: e,
25841
- parent: r,
25842
- dataModelMap: i
25843
- });
25844
- }
25845
- }
25846
- return {
25847
- lnodeTypes: Array.from(i.lnodeTypes.values()),
25848
- doTypes: Array.from(i.doTypes.values()),
25849
- daTypes: Array.from(i.daTypes.values()),
25850
- enumTypes: Array.from(i.enumTypes.values())
25851
- };
25852
- }
25853
- function M(e, t, n) {
25854
- return e.has(t) ? !1 : (e.set(t, n), !0);
25855
- }
25856
- async function pt(e) {
25857
- 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")));
25858
- for (let e of a) {
25859
- if (!e) continue;
25860
- let t = await n.getAttribute(e, { name: "bType" }), r = await n.getAttribute(e, { name: "type" });
25861
- if (r) {
25862
- if (t === "Enum") {
25863
- let [e] = await n.findByAttributes({
25864
- tagName: "EnumType",
25865
- attributes: { id: r }
25866
- });
25867
- e && M(i.enumTypes, r, e);
25868
- } else if (t === "Struct") {
25869
- let [e] = await n.findByAttributes({
25870
- tagName: "DAType",
25871
- attributes: { id: r }
25872
- });
25873
- e && M(i.daTypes, r, e) && await pt({
25874
- query: n,
25875
- parent: e,
25876
- dataModelMap: i
25877
- });
25878
- }
25879
- }
25880
- }
25881
- if (r.tagName === "DOType") {
25882
- let e = r.children.filter((e) => t(e, "SDO")), a = await n.getRecords(e);
25883
- for (let e of a) {
25884
- let t = await n.getAttribute(e, { name: "type" });
25885
- if (!t) continue;
25886
- let [r] = await n.findByAttributes({
25887
- tagName: "DOType",
25888
- attributes: { id: t }
25889
- });
25890
- r && M(i.doTypes, t, r) && await pt({
25891
- query: n,
25892
- parent: r,
25893
- dataModelMap: i
25894
- });
25895
- }
25896
- }
25897
- }
25898
- //#endregion
25899
- //#region src/v2019C1/extensions/data-model/query/index.ts
25900
- var mt = /* @__PURE__ */ c({ resolve: () => ft }), ht = ["id", "uuid"];
25942
+ var R = { transaction: /* @__PURE__ */ l({
25943
+ orphanUuidRefs: () => bt,
25944
+ pruneEmptyContainers: () => yt,
25945
+ resetLNode: () => ne
25946
+ }) }, St = ["id", "uuid"];
25901
25947
  //#endregion
25902
25948
  //#region src/v2019C1/extensions/signature/query/element-signature.ts
25903
- async function gt(e, t) {
25949
+ async function Ct(e, t) {
25904
25950
  let n = {
25905
25951
  query: e,
25906
25952
  resolveReferences: t.resolveReferences ?? !1,
25907
- ignore: new Set(t.ignoreAttributes ?? ht),
25953
+ ignore: new Set(t.ignoreAttributes ?? St),
25908
25954
  memo: /* @__PURE__ */ new Map(),
25909
25955
  seen: /* @__PURE__ */ new Set()
25910
25956
  };
25911
- return yt(t.ref, n);
25957
+ return Et(t.ref, n);
25912
25958
  }
25913
- var _t = /* @__PURE__ */ new Set();
25914
- function vt(e, t) {
25915
- return g[e]?.attributes?.details?.[t]?.default;
25959
+ var wt = /* @__PURE__ */ new Set();
25960
+ function Tt(e, t) {
25961
+ return _[e]?.attributes?.details?.[t]?.default;
25916
25962
  }
25917
- async function yt(e, t) {
25963
+ async function Et(e, t) {
25918
25964
  let n = `${e.tagName}:${e.id}`, r = t.memo.get(n);
25919
25965
  if (r !== void 0) return r;
25920
25966
  if (t.seen.has(n)) return `@cycle:${e.tagName}`;
25921
25967
  t.seen.add(n);
25922
- let i = await t.query.getTree(e), a = i ? await bt(i, t) : "";
25968
+ let i = await t.query.getTree(e), a = i ? await Dt(i, t) : "";
25923
25969
  return t.seen.delete(n), t.memo.set(n, a), a;
25924
25970
  }
25925
- async function bt(e, t) {
25926
- let n = t.resolveReferences ? Tt(e.tagName) : _t, r = [];
25971
+ async function Dt(e, t) {
25972
+ let n = t.resolveReferences ? Mt(e.tagName) : wt, r = [];
25927
25973
  for (let i of e.attributes) {
25928
- if (t.ignore.has(i.name) || n.has(i.name) || i.value === vt(e.tagName, i.name)) continue;
25974
+ if (t.ignore.has(i.name) || n.has(i.name) || i.value === Tt(e.tagName, i.name)) continue;
25929
25975
  let a = i.value;
25930
25976
  if (t.resolveReferences) {
25931
- let n = await xt(e, i.name, i.value, t);
25977
+ let n = await Ot(e, i.name, i.value, t);
25932
25978
  n !== null && (a = `@sig:${n}`);
25933
25979
  }
25934
25980
  r.push(`${JSON.stringify(i.name)}:${JSON.stringify(a)}`);
25935
25981
  }
25936
25982
  r.sort();
25937
25983
  let i = [];
25938
- for (let n of e.tree ?? []) i.push(await bt(n, t));
25984
+ for (let n of e.tree ?? []) i.push(await Dt(n, t));
25939
25985
  i.sort();
25940
25986
  let a = e.value?.trim(), o = a ? `,value:${JSON.stringify(a)}` : "";
25941
25987
  return `{tag:${JSON.stringify(e.tagName)},attrs:[${r.join(",")}]${o},children:[${i.join(",")}]}`;
25942
25988
  }
25943
- async function xt(e, t, n, r) {
25944
- let i = St(e, t);
25989
+ async function Ot(e, t, n, r) {
25990
+ let i = kt(e, t);
25945
25991
  if (i) {
25946
- let e = await Et(r.query, i.target, n);
25947
- return e ? yt(e, r) : `@missing:${n}`;
25992
+ let e = await Nt(r.query, i.target, n);
25993
+ return e ? Et(e, r) : `@missing:${n}`;
25948
25994
  }
25949
- let a = wt(e.tagName, t);
25995
+ let a = jt(e.tagName, t);
25950
25996
  if (a) {
25951
- let e = await Dt(r.query, a.target, n);
25952
- return e ? yt(e, r) : `@missing:${n}`;
25997
+ let e = await Pt(r.query, a.target, n);
25998
+ return e ? Et(e, r) : `@missing:${n}`;
25953
25999
  }
25954
26000
  return null;
25955
26001
  }
25956
- function St(e, t) {
25957
- return D[e.tagName]?.find((n) => n.attribute === t && Ct(e, n));
26002
+ function kt(e, t) {
26003
+ return M[e.tagName]?.find((n) => n.attribute === t && At(e, n));
25958
26004
  }
25959
- function Ct(e, t) {
26005
+ function At(e, t) {
25960
26006
  return t.when ? e.attributes.find((e) => e.name === t.when.attribute)?.value === t.when.equals : !0;
25961
26007
  }
25962
- function wt(e, t) {
25963
- return T[e]?.find((e) => e.attribute.uuid === t);
26008
+ function jt(e, t) {
26009
+ return O[e]?.find((e) => e.attribute.uuid === t);
25964
26010
  }
25965
- function Tt(e) {
25966
- let t = T[e];
25967
- return t ? new Set(t.map((e) => e.attribute.path)) : _t;
26011
+ function Mt(e) {
26012
+ let t = O[e];
26013
+ return t ? new Set(t.map((e) => e.attribute.path)) : wt;
25968
26014
  }
25969
- async function Et(e, t, n) {
26015
+ async function Nt(e, t, n) {
25970
26016
  let [r] = await e.findByAttributes({
25971
26017
  tagName: t,
25972
26018
  attributes: { id: n }
@@ -25976,7 +26022,7 @@ async function Et(e, t, n) {
25976
26022
  id: r.id
25977
26023
  } : null;
25978
26024
  }
25979
- async function Dt(e, t, n) {
26025
+ async function Pt(e, t, n) {
25980
26026
  for (let r of t) {
25981
26027
  let [t] = await e.findByAttributes({
25982
26028
  tagName: r,
@@ -25991,14 +26037,14 @@ async function Dt(e, t, n) {
25991
26037
  }
25992
26038
  //#endregion
25993
26039
  //#region src/v2019C1/extensions/signature/query/index.ts
25994
- var Ot = /* @__PURE__ */ c({ elementSignature: () => gt });
26040
+ var Ft = /* @__PURE__ */ l({ elementSignature: () => Ct });
25995
26041
  //#endregion
25996
26042
  //#region src/v2019C1/extensions/data-model/transaction/import-types.ts
25997
- async function kt(e, t) {
25998
- let { sourceQuery: n, records: r, cloneMappings: i = [], forkPrefix: a = "", keepNameTypesFrom: o = "target" } = t, s = At(await ft(n, { records: r })), c = await e.ensureChild(await e.getRoot(), {
26043
+ async function It(e, t) {
26044
+ let { sourceQuery: n, records: r, cloneMappings: i = [], forkPrefix: a = "", keepNameTypesFrom: o = "target" } = t, s = Lt(await S(n, { records: r })), c = await e.ensureChild(await e.getRoot(), {
25999
26045
  tagName: "DataTypeTemplates",
26000
26046
  attributes: {}
26001
- }), l = await Mt(e), u = /* @__PURE__ */ new Map(), d = [], f = [], p = {
26047
+ }), l = await zt(e), u = /* @__PURE__ */ new Map(), d = [], f = [], p = {
26002
26048
  reused: 0,
26003
26049
  preserved: 0,
26004
26050
  forked: 0,
@@ -26007,7 +26053,7 @@ async function kt(e, t) {
26007
26053
  for (let t of s) {
26008
26054
  let r = await n.getAttribute(t, { name: "id" });
26009
26055
  if (!r) continue;
26010
- let i = await gt(n, {
26056
+ let i = await Ct(n, {
26011
26057
  ref: {
26012
26058
  tagName: t.tagName,
26013
26059
  id: t.id
@@ -26015,7 +26061,7 @@ async function kt(e, t) {
26015
26061
  resolveReferences: !0
26016
26062
  }), s = l.get(i);
26017
26063
  if (s !== void 0) {
26018
- let n = o === "source" ? await Nt(e, {
26064
+ let n = o === "source" ? await Bt(e, {
26019
26065
  tagName: t.tagName,
26020
26066
  currentId: s,
26021
26067
  desiredId: r
@@ -26029,24 +26075,25 @@ async function kt(e, t) {
26029
26075
  tagName: t.tagName,
26030
26076
  attributes: { id: r }
26031
26077
  }), g = r, _ = m;
26032
- h ? (g = await Bt(e, t.tagName, `${a}${r}_${Vt(i)}`), _ = Pt(m, g), p.forked++) : p.preserved++;
26078
+ h ? (g = await qt(e, t.tagName, `${a}${r}_${Jt(i)}`), _ = Vt(m, g), p.forked++) : p.preserved++;
26033
26079
  let v = await e.deepClone(c, _);
26034
- u.set(r, g), v?.record && (d.push(N(v.record.tagName, v.record.id)), h && f.push({
26080
+ u.set(r, g), v?.record && (d.push(z(v.record.tagName, v.record.id)), h && f.push({
26035
26081
  oldId: r,
26036
- oldRef: N(h.tagName, h.id),
26037
- forkRef: N(v.record.tagName, v.record.id),
26082
+ oldRef: z(h.tagName, h.id),
26083
+ forkRef: z(v.record.tagName, v.record.id),
26038
26084
  forkedId: g
26039
26085
  }));
26040
26086
  }
26041
- let m = i.map((e) => e.target);
26087
+ let m = [];
26088
+ for (let t of i) t.target.tagName === "LNode" && await T(e, t.target) || m.push(t.target);
26042
26089
  for (let t of d) {
26043
26090
  let n = await e.getTree(t);
26044
- n && Ft(n, m);
26091
+ n && Ht(n, m);
26045
26092
  }
26046
- return await k(e, {
26093
+ return await I(e, {
26047
26094
  records: m,
26048
26095
  idRemap: u
26049
- }), f.length > 0 && await It(e, {
26096
+ }), f.length > 0 && await Ut(e, {
26050
26097
  collisions: f,
26051
26098
  idRemap: u,
26052
26099
  referrerRecords: m,
@@ -26056,7 +26103,7 @@ async function kt(e, t) {
26056
26103
  stats: p
26057
26104
  };
26058
26105
  }
26059
- function At(e) {
26106
+ function Lt(e) {
26060
26107
  return [
26061
26108
  ...e.enumTypes,
26062
26109
  ...e.daTypes,
@@ -26064,20 +26111,20 @@ function At(e) {
26064
26111
  ...e.lnodeTypes
26065
26112
  ];
26066
26113
  }
26067
- var jt = [
26114
+ var Rt = [
26068
26115
  "EnumType",
26069
26116
  "DAType",
26070
26117
  "DOType",
26071
26118
  "LNodeType"
26072
26119
  ];
26073
- async function Mt(e) {
26120
+ async function zt(e) {
26074
26121
  let t = /* @__PURE__ */ new Map();
26075
- for (let n of jt) {
26122
+ for (let n of Rt) {
26076
26123
  let r = await e.getRecordsByTagName(n);
26077
26124
  for (let i of r) {
26078
26125
  let r = i.attributes.find((e) => e.name === "id")?.value;
26079
26126
  if (!r) continue;
26080
- let a = await gt(e, {
26127
+ let a = await Ct(e, {
26081
26128
  ref: {
26082
26129
  tagName: n,
26083
26130
  id: i.id
@@ -26089,7 +26136,7 @@ async function Mt(e) {
26089
26136
  }
26090
26137
  return t;
26091
26138
  }
26092
- async function Nt(e, t) {
26139
+ async function Bt(e, t) {
26093
26140
  let { tagName: n, currentId: r, desiredId: i } = t;
26094
26141
  if (r === i) return r;
26095
26142
  let [a] = await e.findByAttributes({
@@ -26102,32 +26149,32 @@ async function Nt(e, t) {
26102
26149
  attributes: { id: i }
26103
26150
  });
26104
26151
  if (o && o.id !== a.id) return r;
26105
- let s = N(a.tagName, a.id), c = await O(e, { target: s });
26106
- return await e.update(s, { attributes: { id: i } }), await k(e, {
26107
- records: c.map((e) => N(e.ref.tagName, e.ref.id)),
26152
+ let s = z(a.tagName, a.id), c = await F(e, { target: s });
26153
+ return await e.update(s, { attributes: { id: i } }), await I(e, {
26154
+ records: c.map((e) => z(e.ref.tagName, e.ref.id)),
26108
26155
  idRemap: new Map([[r, i]])
26109
26156
  }), i;
26110
26157
  }
26111
- function Pt(e, t) {
26158
+ function Vt(e, t) {
26112
26159
  let n = structuredClone(e), r = n.attributes, i = r.find((e) => e.name === "id");
26113
26160
  return i ? i.value = t : r.push({
26114
26161
  name: "id",
26115
26162
  value: t
26116
26163
  }), n;
26117
26164
  }
26118
- function N(e, t) {
26165
+ function z(e, t) {
26119
26166
  return {
26120
26167
  tagName: e,
26121
26168
  id: t
26122
26169
  };
26123
26170
  }
26124
- function Ft(e, t) {
26125
- t.push(N(e.tagName, e.id));
26126
- for (let n of e.tree ?? []) Ft(n, t);
26171
+ function Ht(e, t) {
26172
+ t.push(z(e.tagName, e.id));
26173
+ for (let n of e.tree ?? []) Ht(n, t);
26127
26174
  }
26128
- var P = (e) => `${e.tagName}#${e.id}`;
26129
- async function It(e, t) {
26130
- let { collisions: n, idRemap: r, referrerRecords: i, stats: a } = t, o = await Lt(e, n), s = /* @__PURE__ */ new Map(), c = [];
26175
+ var B = (e) => `${e.tagName}#${e.id}`;
26176
+ async function Ut(e, t) {
26177
+ let { collisions: n, idRemap: r, referrerRecords: i, stats: a } = t, o = await Wt(e, n), s = /* @__PURE__ */ new Map(), c = [];
26131
26178
  for (let t of n) if (o.has(t.oldId)) {
26132
26179
  await e.update(t.forkRef, { attributes: { id: t.oldId } }), s.set(t.forkedId, t.oldId), c.push(t.forkRef), a.reclaimed++;
26133
26180
  for (let [e, n] of r) n === t.forkedId && r.set(e, t.oldId);
@@ -26136,38 +26183,38 @@ async function It(e, t) {
26136
26183
  let l = [...i];
26137
26184
  for (let t of c) {
26138
26185
  let n = await e.getTree(t);
26139
- n && Ft(n, l);
26186
+ n && Ht(n, l);
26140
26187
  }
26141
- await k(e, {
26188
+ await I(e, {
26142
26189
  records: l,
26143
26190
  idRemap: s
26144
26191
  });
26145
26192
  }
26146
- async function Lt(e, t) {
26147
- let n = /* @__PURE__ */ new Set(), r = new Map(t.map((e) => [P(e.oldRef), e.oldId])), i = t.map((e) => e.oldRef), a = new Set(i.map(P)), o = /* @__PURE__ */ new Set(), s = !0;
26193
+ async function Wt(e, t) {
26194
+ let n = /* @__PURE__ */ new Set(), r = new Map(t.map((e) => [B(e.oldRef), e.oldId])), i = t.map((e) => e.oldRef), a = new Set(i.map(B)), o = /* @__PURE__ */ new Set(), s = !0;
26148
26195
  for (; s;) {
26149
26196
  s = !1;
26150
26197
  for (let t of i) {
26151
- let c = P(t);
26152
- if (o.has(c) || (await O(e, { target: t })).length > 0) continue;
26153
- let l = await e.getTree(t), u = l ? await Rt(e, l) : [];
26198
+ let c = B(t);
26199
+ if (o.has(c) || (await F(e, { target: t })).length > 0) continue;
26200
+ let l = await e.getTree(t), u = l ? await Gt(e, l) : [];
26154
26201
  await e.delete(t), o.add(c), s = !0;
26155
26202
  let d = r.get(c);
26156
26203
  d !== void 0 && n.add(d);
26157
26204
  for (let e of u) {
26158
- let t = P(e);
26205
+ let t = B(e);
26159
26206
  a.has(t) || (i.push(e), a.add(t));
26160
26207
  }
26161
26208
  }
26162
26209
  }
26163
26210
  return n;
26164
26211
  }
26165
- async function Rt(e, t) {
26212
+ async function Gt(e, t) {
26166
26213
  let n = [], r = /* @__PURE__ */ new Set();
26167
26214
  async function i(t) {
26168
- let a = D[t.tagName];
26215
+ let a = M[t.tagName];
26169
26216
  for (let i of a ?? []) {
26170
- if (!zt(t, i)) continue;
26217
+ if (!Kt(t, i)) continue;
26171
26218
  let a = t.attributes.find((e) => e.name === i.attribute)?.value;
26172
26219
  if (!a) continue;
26173
26220
  let [o] = await e.findByAttributes({
@@ -26175,17 +26222,17 @@ async function Rt(e, t) {
26175
26222
  attributes: { id: a }
26176
26223
  });
26177
26224
  if (!o) continue;
26178
- let s = N(i.target, o.id), c = P(s);
26225
+ let s = z(i.target, o.id), c = B(s);
26179
26226
  r.has(c) || (r.add(c), n.push(s));
26180
26227
  }
26181
26228
  for (let e of t.tree ?? []) await i(e);
26182
26229
  }
26183
26230
  return await i(t), n;
26184
26231
  }
26185
- function zt(e, t) {
26232
+ function Kt(e, t) {
26186
26233
  return t.when ? e.attributes.find((e) => e.name === t.when.attribute)?.value === t.when.equals : !0;
26187
26234
  }
26188
- async function Bt(e, t, n) {
26235
+ async function qt(e, t, n) {
26189
26236
  let r = n, i = 2;
26190
26237
  for (; (await e.findByAttributes({
26191
26238
  tagName: t,
@@ -26193,20 +26240,20 @@ async function Bt(e, t, n) {
26193
26240
  })).length > 0;) r = `${n}_${i}`, i += 1;
26194
26241
  return r;
26195
26242
  }
26196
- function Vt(e) {
26243
+ function Jt(e) {
26197
26244
  let t = 2166136261;
26198
26245
  for (let n = 0; n < e.length; n++) t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
26199
26246
  return (t >>> 0).toString(16).padStart(8, "0");
26200
26247
  }
26201
26248
  //#endregion
26202
26249
  //#region src/v2019C1/extensions/data-model/index.ts
26203
- var Ht = {
26204
- query: mt,
26205
- transaction: /* @__PURE__ */ c({ importTypes: () => kt })
26250
+ var Yt = {
26251
+ query: te,
26252
+ transaction: /* @__PURE__ */ l({ importTypes: () => It })
26206
26253
  };
26207
26254
  //#endregion
26208
26255
  //#region src/v2019C1/extensions/history/query/get-sorted-hitem.ts
26209
- async function Ut(e) {
26256
+ async function Xt(e) {
26210
26257
  let t = await e.getRecord({ tagName: "History" });
26211
26258
  if (!t) return [];
26212
26259
  let { Hitem: n = [] } = await e.findDescendants(t, { collect: "Hitem" });
@@ -26220,18 +26267,18 @@ async function Ut(e) {
26220
26267
  }
26221
26268
  //#endregion
26222
26269
  //#region src/v2019C1/extensions/history/query/get-latest-hitem.ts
26223
- async function Wt(e) {
26224
- return (await Ut(e)).at(-1);
26270
+ async function Zt(e) {
26271
+ return (await Xt(e)).at(-1);
26225
26272
  }
26226
26273
  //#endregion
26227
26274
  //#region src/v2019C1/extensions/history/query/index.ts
26228
- var Gt = /* @__PURE__ */ c({
26229
- getLatestHitem: () => Wt,
26230
- getSortedHitems: () => Ut
26275
+ var Qt = /* @__PURE__ */ l({
26276
+ getLatestHitem: () => Zt,
26277
+ getSortedHitems: () => Xt
26231
26278
  });
26232
26279
  //#endregion
26233
26280
  //#region src/v2019C1/extensions/history/transaction/add-entry.ts
26234
- async function Kt(e, t) {
26281
+ async function $t(e, t) {
26235
26282
  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, {
26236
26283
  tagName: "Header",
26237
26284
  attributes: {
@@ -26246,18 +26293,18 @@ async function Kt(e, t) {
26246
26293
  }), h = await e.getRecord({ tagName: "History" }) ?? await e.addChild(m, {
26247
26294
  tagName: "History",
26248
26295
  attributes: {}
26249
- }), g = await Wt(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";
26296
+ }), 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";
26250
26297
  await e.update(m, { attributes: {
26251
26298
  version: y,
26252
26299
  revision: b
26253
26300
  } });
26254
- let ee = /* @__PURE__ */ new Date(), x = ee.toString().split(" "), S = ee.toLocaleString("en", { timeZoneName: "short" }).split(" ").pop(), te = `${x[0]} ${x[1]} ${x[2]} ${x[4]} ${S} ${x[3]}`;
26301
+ 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]}`;
26255
26302
  await e.addChild(h, {
26256
26303
  tagName: "Hitem",
26257
26304
  attributes: {
26258
26305
  version: y,
26259
26306
  revision: b,
26260
- when: te,
26307
+ when: w,
26261
26308
  who: u,
26262
26309
  what: d,
26263
26310
  why: f
@@ -26269,57 +26316,57 @@ async function Kt(e, t) {
26269
26316
  }
26270
26317
  //#endregion
26271
26318
  //#region src/v2019C1/extensions/history/index.ts
26272
- var qt = {
26273
- query: Gt,
26274
- transaction: /* @__PURE__ */ c({ addEntry: () => Kt })
26319
+ var en = {
26320
+ query: Qt,
26321
+ transaction: /* @__PURE__ */ l({ addEntry: () => $t })
26275
26322
  };
26276
26323
  //#endregion
26277
26324
  //#region src/v2019C1/extensions/identity/transaction/write-identity.ts
26278
- async function F(e, t) {
26325
+ async function V(e, t) {
26279
26326
  let { mappings: n, mode: r } = t;
26280
26327
  if (r !== "keep") for (let t of n) {
26281
- let n = r === "strip" ? Jt() : Yt(t);
26328
+ let n = r === "strip" ? tn() : nn(t);
26282
26329
  if (Object.keys(n).length === 0) continue;
26283
26330
  let i = await e.getRecord(t.target);
26284
26331
  i && await e.update(i, { attributes: n });
26285
26332
  }
26286
26333
  }
26287
- function Jt() {
26334
+ function tn() {
26288
26335
  return {
26289
26336
  templateUuid: void 0,
26290
26337
  originUuid: void 0
26291
26338
  };
26292
26339
  }
26293
- function Yt(e) {
26294
- let t = Zt(e.source.attributes, "uuid"), n = Zt(e.source.attributes, "templateUuid"), r = Zt(e.source.attributes, "originUuid"), i = {};
26340
+ function nn(e) {
26341
+ let t = an(e.source.attributes, "uuid"), n = an(e.source.attributes, "templateUuid"), r = an(e.source.attributes, "originUuid"), i = {};
26295
26342
  t && (i.templateUuid = t);
26296
- let a = Xt(e.target.tagName);
26343
+ let a = rn(e.target.tagName);
26297
26344
  return n && !r && a && (i.originUuid = n), i;
26298
26345
  }
26299
- function Xt(e) {
26300
- let t = b.attributes[e];
26346
+ function rn(e) {
26347
+ let t = x.attributes[e];
26301
26348
  return t ? "originUuid" in t : !1;
26302
26349
  }
26303
- function Zt(e, t) {
26350
+ function an(e, t) {
26304
26351
  return e.find((e) => e.name === t)?.value;
26305
26352
  }
26306
26353
  //#endregion
26307
26354
  //#region src/v2019C1/extensions/identity/index.ts
26308
- var Qt = { transaction: /* @__PURE__ */ c({ writeIdentity: () => F }) };
26355
+ var on = { transaction: /* @__PURE__ */ l({ writeIdentity: () => V }) };
26309
26356
  //#endregion
26310
26357
  //#region src/v2019C1/extensions/lifecycle/engine/group.ts
26311
- function $t(e, t) {
26358
+ function sn(e, t) {
26312
26359
  let n = [];
26313
- return en({
26360
+ return cn({
26314
26361
  node: e,
26315
26362
  instanceScopeId: t,
26316
26363
  out: n
26317
26364
  }), n;
26318
26365
  }
26319
- function en(e) {
26366
+ function cn(e) {
26320
26367
  let { node: t, instanceScopeId: n, out: r } = e;
26321
26368
  if (t.change === "unchanged") {
26322
- for (let e of t.children) en({
26369
+ for (let e of t.children) cn({
26323
26370
  node: e,
26324
26371
  instanceScopeId: n,
26325
26372
  out: r
@@ -26327,105 +26374,118 @@ function en(e) {
26327
26374
  return;
26328
26375
  }
26329
26376
  let i = [];
26330
- tn({
26377
+ ln({
26331
26378
  node: t,
26332
26379
  out: i
26333
26380
  }), r.push({
26334
- id: nn(t, n),
26381
+ id: un(t, n),
26335
26382
  change: t.change,
26336
26383
  title: `${t.change} ${t.tagName}`,
26337
26384
  primary: t,
26338
26385
  companions: i,
26339
26386
  dependsOn: [],
26340
- suggestedAction: "accept",
26387
+ suggestedAction: t.change === "target-only" ? "skip" : "accept",
26341
26388
  instanceScopeId: n
26342
26389
  });
26343
26390
  }
26344
- function tn(e) {
26391
+ function ln(e) {
26345
26392
  let { node: t, out: n } = e;
26346
- for (let e of t.children) e.change !== "unchanged" && n.push(e), tn({
26393
+ for (let e of t.children) e.change !== "unchanged" && n.push(e), ln({
26347
26394
  node: e,
26348
26395
  out: n
26349
26396
  });
26350
26397
  }
26351
- function nn(e, t) {
26398
+ function un(e, t) {
26352
26399
  let n = e.sourceRef ?? e.instanceRef, r = n ? `${n.tagName}:${n.id}` : e.tagName;
26353
26400
  return t ? `${t}::${r}` : r;
26354
26401
  }
26355
26402
  //#endregion
26356
26403
  //#region src/v2019C1/extensions/lifecycle/engine/visible-attributes.ts
26357
- var rn = new Set([
26404
+ var dn = new Set([
26358
26405
  "uuid",
26359
26406
  "templateUuid",
26360
26407
  "originUuid"
26361
- ]), an = new Set(Object.values(T).flatMap((e) => e.flatMap((e) => [e.attribute.path, e.attribute.uuid])));
26362
- function I(e) {
26408
+ ]), fn = new Set(Object.values(O).flatMap((e) => e.flatMap((e) => [e.attribute.path, e.attribute.uuid])));
26409
+ function H(e) {
26363
26410
  let t = {};
26364
- for (let [n, r] of Object.entries(e)) rn.has(n) || n === "name" || an.has(n) || (t[n] = r);
26411
+ for (let [n, r] of Object.entries(e)) dn.has(n) || n === "name" || fn.has(n) || (t[n] = r);
26365
26412
  return t;
26366
26413
  }
26367
26414
  //#endregion
26368
26415
  //#region src/v2019C1/extensions/lifecycle/engine/diff.ts
26369
- var on = new Set(Object.keys(T));
26370
- async function sn(e) {
26416
+ var pn = new Set([
26417
+ "LNodeSpecNaming",
26418
+ "FunctionSclRef",
26419
+ "ApplicationSclRef",
26420
+ "SclFileReference"
26421
+ ]);
26422
+ async function mn(e) {
26371
26423
  let { sourceQuery: t, targetQuery: n, sourceRootRef: r, instanceRootRef: i } = e, a = await t.any.getTree(r);
26372
26424
  if (!a) throw Error("diff: source subtree not found");
26373
26425
  let o = i ? await n.any.getTree(i) : void 0;
26374
26426
  if (!o) {
26375
- let e = ln(a);
26427
+ let e = gn(a);
26376
26428
  return {
26377
26429
  root: e,
26378
26430
  roots: [e],
26379
- groups: $t(e),
26431
+ groups: sn(e),
26380
26432
  needsDecisions: !1,
26381
- summary: hn(e)
26433
+ summary: wn(e)
26382
26434
  };
26383
26435
  }
26384
26436
  let s = /* @__PURE__ */ new Map();
26385
- await fn(n, {
26437
+ await xn(n, {
26386
26438
  node: o,
26387
26439
  index: s
26388
26440
  });
26389
26441
  let c = /* @__PURE__ */ new Set();
26390
- await pn(t, {
26442
+ await Sn(t, {
26391
26443
  node: a,
26392
26444
  out: c
26393
26445
  });
26394
- let l = await cn(t, {
26446
+ let l = await hn(t, {
26395
26447
  targetQuery: n,
26396
26448
  sourceNode: a,
26397
26449
  instanceNode: o,
26398
26450
  index: s,
26399
26451
  sourceUuids: c
26400
- }), u = hn(l), d = u.added + u.removed + u.modified > 0;
26452
+ }), u = wn(l), d = sn(l, o.id), f = d.length > 0;
26401
26453
  return {
26402
26454
  root: l,
26403
26455
  roots: [l],
26404
- groups: $t(l, o.id),
26405
- needsDecisions: d,
26456
+ groups: d,
26457
+ needsDecisions: f,
26406
26458
  summary: u
26407
26459
  };
26408
26460
  }
26409
- async function cn(e, t) {
26410
- let { targetQuery: n, sourceNode: r, instanceNode: i, index: o, sourceUuids: s } = t, c = await dn(e, {
26461
+ async function hn(e, t) {
26462
+ let { targetQuery: n, sourceNode: r, instanceNode: i, index: o, sourceUuids: s } = t, c = await bn(e, {
26411
26463
  targetQuery: n,
26412
26464
  sourceNode: r,
26413
26465
  instanceNode: i
26414
26466
  }), l = [], u = /* @__PURE__ */ new Set();
26415
26467
  for (let t of r.tree) {
26416
26468
  let r = await e.any.getAttribute(t, { name: "uuid" }), a = (r ? o.get(r) : void 0) ?? (r ? void 0 : i.tree.find((e) => e.tagName === t.tagName && !u.has(e.id)));
26417
- a ? (u.add(a.id), l.push(await cn(e, {
26469
+ a ? (u.add(a.id), l.push(await hn(e, {
26418
26470
  targetQuery: n,
26419
26471
  sourceNode: t,
26420
26472
  instanceNode: a,
26421
26473
  index: o,
26422
26474
  sourceUuids: s
26423
- }))) : l.push(ln(t));
26475
+ }))) : l.push(gn(t));
26424
26476
  }
26425
26477
  for (let e of i.tree) {
26426
26478
  if (u.has(e.id)) continue;
26427
26479
  let t = await n.any.getAttribute(e, { name: "templateUuid" });
26428
- (t ? !s.has(t) : on.has(e.tagName)) && l.push(un(e));
26480
+ if (t) {
26481
+ s.has(t) || l.push(_n(e));
26482
+ continue;
26483
+ }
26484
+ if (fe.has(e.tagName) && !k.has(e.tagName)) {
26485
+ l.push(_n(e));
26486
+ continue;
26487
+ }
26488
+ yn(e, l);
26429
26489
  }
26430
26490
  return {
26431
26491
  change: c.length > 0 ? "modified" : "unchanged",
@@ -26436,8 +26496,8 @@ async function cn(e, t) {
26436
26496
  children: l
26437
26497
  };
26438
26498
  }
26439
- function ln(e) {
26440
- let t = e.tree.map((e) => ln(e));
26499
+ function gn(e) {
26500
+ let t = e.tree.map((e) => gn(e));
26441
26501
  return {
26442
26502
  change: "added",
26443
26503
  tagName: e.tagName,
@@ -26445,8 +26505,8 @@ function ln(e) {
26445
26505
  children: t
26446
26506
  };
26447
26507
  }
26448
- function un(e) {
26449
- let t = e.tree.map((e) => un(e));
26508
+ function _n(e) {
26509
+ let t = e.tree.map((e) => _n(e));
26450
26510
  return {
26451
26511
  change: "removed",
26452
26512
  tagName: e.tagName,
@@ -26454,8 +26514,26 @@ function un(e) {
26454
26514
  children: t
26455
26515
  };
26456
26516
  }
26457
- async function dn(e, t) {
26458
- let { targetQuery: n, sourceNode: r, instanceNode: i } = t, a = I(await e.any.getAttributes(r)), o = I(await n.any.getAttributes(i)), s = [];
26517
+ function vn(e) {
26518
+ let t = e.tree.map((e) => vn(e));
26519
+ return {
26520
+ change: "target-only",
26521
+ tagName: e.tagName,
26522
+ instanceRef: a(e),
26523
+ children: t
26524
+ };
26525
+ }
26526
+ function yn(e, t) {
26527
+ if (!pn.has(e.tagName)) {
26528
+ if (e.tagName === "Private") {
26529
+ for (let n of e.tree) yn(n, t);
26530
+ return;
26531
+ }
26532
+ t.push(vn(e));
26533
+ }
26534
+ }
26535
+ async function bn(e, t) {
26536
+ let { targetQuery: n, sourceNode: r, instanceNode: i } = t, a = H(await e.any.getAttributes(r)), o = H(await n.any.getAttributes(i)), s = [];
26459
26537
  for (let e of new Set([...Object.keys(a), ...Object.keys(o)])) {
26460
26538
  let t = o[e], n = a[e];
26461
26539
  t !== n && s.push({
@@ -26466,23 +26544,23 @@ async function dn(e, t) {
26466
26544
  }
26467
26545
  return s;
26468
26546
  }
26469
- async function fn(e, t) {
26547
+ async function xn(e, t) {
26470
26548
  let { node: n, index: r } = t, i = await e.any.getAttribute(n, { name: "templateUuid" });
26471
26549
  i && r.set(i, n);
26472
- for (let t of n.tree) await fn(e, {
26550
+ for (let t of n.tree) await xn(e, {
26473
26551
  node: t,
26474
26552
  index: r
26475
26553
  });
26476
26554
  }
26477
- async function pn(e, t) {
26555
+ async function Sn(e, t) {
26478
26556
  let { node: n, out: r } = t, i = await e.any.getAttribute(n, { name: "uuid" });
26479
26557
  i && r.add(i);
26480
- for (let t of n.tree) await pn(e, {
26558
+ for (let t of n.tree) await Sn(e, {
26481
26559
  node: t,
26482
26560
  out: r
26483
26561
  });
26484
26562
  }
26485
- function mn(e) {
26563
+ function Cn(e) {
26486
26564
  let [t] = e, n = e.flatMap((e) => e.groups), r = e.reduce((e, t) => ({
26487
26565
  added: e.added + t.summary.added,
26488
26566
  removed: e.removed + t.summary.removed,
@@ -26500,7 +26578,7 @@ function mn(e) {
26500
26578
  summary: r
26501
26579
  };
26502
26580
  }
26503
- function hn(e) {
26581
+ function wn(e) {
26504
26582
  let t = {
26505
26583
  added: 0,
26506
26584
  removed: 0,
@@ -26513,54 +26591,58 @@ function hn(e) {
26513
26591
  }
26514
26592
  //#endregion
26515
26593
  //#region src/v2019C1/extensions/lifecycle/constraints/classify-attribute.constants.ts
26516
- var gn = new Set([
26594
+ var Tn = new Set([
26517
26595
  "uuid",
26518
26596
  "templateUuid",
26519
26597
  "originUuid"
26520
- ]), _n = ["rename", "free"], vn = /* @__PURE__ */ new Map();
26521
- function yn(e) {
26522
- let t = vn.get(e);
26598
+ ]), En = ["rename", "free"], Dn = /* @__PURE__ */ new Map();
26599
+ function On(e) {
26600
+ let t = Dn.get(e);
26523
26601
  if (t) return t;
26524
- let n = g[e]?.attributes?.identityFields ?? [], r = new Set(n);
26525
- return vn.set(e, r), r;
26602
+ let n = _[e]?.attributes?.identityFields ?? [], r = new Set(n);
26603
+ return Dn.set(e, r), r;
26526
26604
  }
26527
26605
  //#endregion
26528
26606
  //#region src/v2019C1/extensions/lifecycle/constraints/classify-attribute.ts
26529
- function L(e, t) {
26530
- return gn.has(t) ? "identity" : Sn(e).has(t) ? "reference" : t === "name" ? "rename" : ne.has(t) || yn(e).has(t) ? "identity" : "free";
26607
+ function U(e, t) {
26608
+ return Tn.has(t) ? "identity" : jn(e).has(t) || Mn(e).has(t) ? "reference" : t === "name" ? "rename" : oe.has(t) || On(e).has(t) ? "identity" : "free";
26531
26609
  }
26532
- function bn(e) {
26533
- return _n.includes(e);
26610
+ function kn(e) {
26611
+ return En.includes(e);
26534
26612
  }
26535
- function xn(e) {
26536
- let t = Object.keys(h[e] ?? {}), n = [];
26613
+ function An(e) {
26614
+ let t = Object.keys(g[e] ?? {}), n = [];
26537
26615
  for (let r of t) {
26538
- let t = L(e, r);
26539
- bn(t) && n.push({
26616
+ let t = U(e, r);
26617
+ kn(t) && n.push({
26540
26618
  attr: r,
26541
26619
  mode: t
26542
26620
  });
26543
26621
  }
26544
26622
  return n;
26545
26623
  }
26546
- function Sn(e) {
26547
- let t = T[e];
26548
- if (!t) return Cn;
26624
+ function jn(e) {
26625
+ let t = O[e];
26626
+ if (!t) return Nn;
26549
26627
  let n = /* @__PURE__ */ new Set();
26550
26628
  for (let e of t) n.add(e.attribute.path), n.add(e.attribute.uuid);
26551
26629
  return n;
26552
26630
  }
26553
- var Cn = /* @__PURE__ */ new Set();
26631
+ function Mn(e) {
26632
+ let t = P.get(e);
26633
+ return t ? new Set(t) : Nn;
26634
+ }
26635
+ var Nn = /* @__PURE__ */ new Set();
26554
26636
  //#endregion
26555
26637
  //#region src/v2019C1/extensions/lifecycle/constraints/find-constraint-violation.ts
26556
- async function R(e, t) {
26557
- let { parentRef: n, childTag: r, candidate: i, excludeId: a } = t, o = Tn(n.tagName).filter((e) => (e.kind === "unique" || e.kind === "key") && En(e, r));
26638
+ async function W(e, t) {
26639
+ let { parentRef: n, childTag: r, candidate: i, excludeId: a } = t, o = Fn(n.tagName).filter((e) => (e.kind === "unique" || e.kind === "key") && In(e, r));
26558
26640
  if (o.length === 0) return null;
26559
26641
  let s = (await e.any.getTree(n))?.tree ?? [];
26560
26642
  for (let e of o) {
26561
- let t = Dn(e);
26643
+ let t = Ln(e);
26562
26644
  if (!(t.length === 0 || t.some((e) => i[e] === void 0))) {
26563
- for (let n of s) if (n.id !== a && En(e, n.tagName) && t.every((e) => wn(n, e) === i[e])) return {
26645
+ for (let n of s) if (n.id !== a && In(e, n.tagName) && t.every((e) => Pn(n, e) === i[e])) return {
26564
26646
  constraint: e.name,
26565
26647
  fields: t,
26566
26648
  offendingId: n.id
@@ -26569,41 +26651,41 @@ async function R(e, t) {
26569
26651
  }
26570
26652
  return null;
26571
26653
  }
26572
- function wn(e, t) {
26654
+ function Pn(e, t) {
26573
26655
  return e.attributes.find((e) => e.name === t)?.value;
26574
26656
  }
26575
- function Tn(e) {
26576
- return [...g[e]?.constraints ?? []];
26657
+ function Fn(e) {
26658
+ return [..._[e]?.constraints ?? []];
26577
26659
  }
26578
- function En(e, t) {
26660
+ function In(e, t) {
26579
26661
  for (let n of e.selector ?? []) {
26580
26662
  let e = (n.steps ?? []).at(-1);
26581
26663
  if (e && (e.kind === "wildcard" || e.kind === "name" && e.value === t)) return !0;
26582
26664
  }
26583
26665
  return !1;
26584
26666
  }
26585
- function Dn(e) {
26667
+ function Ln(e) {
26586
26668
  return (e.fields ?? []).map((e) => e.target?.value).filter((e) => !!e);
26587
26669
  }
26588
26670
  //#endregion
26589
26671
  //#region src/v2019C1/extensions/lifecycle/constraints/resolve-unique-value.ts
26590
- var On = 1e3;
26591
- async function kn(e, t) {
26672
+ var Rn = 1e3;
26673
+ async function zn(e, t) {
26592
26674
  let { parentRef: n, childTag: r, candidate: i, attr: a, decorate: o, excludeId: s } = t, c = i[a] ?? "";
26593
- if (!await R(e, {
26675
+ if (!await W(e, {
26594
26676
  parentRef: n,
26595
26677
  childTag: r,
26596
26678
  candidate: i,
26597
26679
  excludeId: s
26598
26680
  })) return c;
26599
- for (let t = 1; t <= On; t++) {
26681
+ for (let t = 1; t <= Rn; t++) {
26600
26682
  let l = o ? o({
26601
26683
  base: c,
26602
26684
  attempt: t,
26603
26685
  attr: a,
26604
26686
  childTag: r
26605
26687
  }) : `${c}_${t}`;
26606
- if (!await R(e, {
26688
+ if (!await W(e, {
26607
26689
  parentRef: n,
26608
26690
  childTag: r,
26609
26691
  candidate: {
@@ -26613,22 +26695,22 @@ async function kn(e, t) {
26613
26695
  excludeId: s
26614
26696
  })) return l;
26615
26697
  }
26616
- throw Error(`could not resolve a unique ${a} for <${r}> under <${n.tagName}> after ${On} attempts`);
26698
+ throw Error(`could not resolve a unique ${a} for <${r}> under <${n.tagName}> after ${Rn} attempts`);
26617
26699
  }
26618
26700
  //#endregion
26619
26701
  //#region src/v2019C1/extensions/lifecycle/constraints/resolve-placement-collision.ts
26620
- async function z(e, t) {
26702
+ async function G(e, t) {
26621
26703
  let { ref: n, decorate: r, overrides: i } = t, a = t.parentRef ?? (await e.getRecord(n))?.parent;
26622
26704
  if (!a) return { status: "ok" };
26623
26705
  let o = await e.getAttributes(n);
26624
26706
  if (i) for (let [t, r] of Object.entries(i)) {
26625
- let i = L(n.tagName, t);
26707
+ let i = U(n.tagName, t);
26626
26708
  (i === "rename" || i === "free") && o[t] !== r && (await e.update(n, { attributes: { [t]: r } }), o = {
26627
26709
  ...o,
26628
26710
  [t]: r
26629
26711
  });
26630
26712
  }
26631
- let s = await R(e, {
26713
+ let s = await W(e, {
26632
26714
  parentRef: a,
26633
26715
  childTag: n.tagName,
26634
26716
  candidate: o,
@@ -26636,14 +26718,14 @@ async function z(e, t) {
26636
26718
  });
26637
26719
  if (!s) return { status: "ok" };
26638
26720
  let c = s.fields.find((e) => {
26639
- let t = L(n.tagName, e);
26721
+ let t = U(n.tagName, e);
26640
26722
  return t === "rename" || t === "free";
26641
26723
  });
26642
26724
  if (!c) return {
26643
26725
  status: "unresolvable",
26644
26726
  violation: s
26645
26727
  };
26646
- let l = o[c] ?? "", u = await kn(e, {
26728
+ let l = o[c] ?? "", u = await zn(e, {
26647
26729
  parentRef: a,
26648
26730
  childTag: n.tagName,
26649
26731
  candidate: o,
@@ -26660,12 +26742,12 @@ async function z(e, t) {
26660
26742
  }
26661
26743
  //#endregion
26662
26744
  //#region src/v2019C1/extensions/lifecycle/transplant/transaction/primitives/clone-tree.ts
26663
- var An = {
26745
+ var Bn = {
26664
26746
  scope: "tree",
26665
26747
  attributes: ["templateUuid", "originUuid"]
26666
26748
  };
26667
- async function B(e, t) {
26668
- let { sourceQuery: n, ref: i, targetParent: a, omit: o, retagRoot: s, strip: c = An } = t, l = await n.getTree(i, {
26749
+ async function K(e, t) {
26750
+ let { sourceQuery: n, ref: i, targetParent: a, omit: o, retagRoot: s, strip: c = Bn } = t, l = await n.getTree(i, {
26669
26751
  omit: o,
26670
26752
  unwrap: []
26671
26753
  });
@@ -26681,12 +26763,12 @@ async function B(e, t) {
26681
26763
  }
26682
26764
  //#endregion
26683
26765
  //#region src/v2019C1/extensions/lifecycle/transplant/transaction/primitives/add-children-to.ts
26684
- async function V(e, t) {
26766
+ async function q(e, t) {
26685
26767
  let { sourceQuery: n, source: r, target: i, omit: a, strip: o } = t, s = await n.any.getRecord(r);
26686
26768
  if (!s) return [];
26687
26769
  let c = [];
26688
26770
  for (let t of s.children) {
26689
- let r = await B(e, {
26771
+ let r = await K(e, {
26690
26772
  sourceQuery: n,
26691
26773
  ref: {
26692
26774
  tagName: t.tagName,
@@ -26702,14 +26784,14 @@ async function V(e, t) {
26702
26784
  }
26703
26785
  //#endregion
26704
26786
  //#region src/v2019C1/extensions/lifecycle/transplant/transaction/deep.ts
26705
- async function H(e, t) {
26706
- let { sourceQuery: n, ref: r, targetParent: i, withTypes: a = !0, omit: o, strip: s = !1, retagRoot: c } = t, l = await jn(e, {
26787
+ async function J(e, t) {
26788
+ let { sourceQuery: n, ref: r, targetParent: i, withTypes: a = !0, omit: o, strip: s = !1, retagRoot: c } = t, l = await Vn(e, {
26707
26789
  sourceQuery: n,
26708
26790
  ref: r,
26709
26791
  targetParent: i
26710
26792
  }), u, d;
26711
26793
  if (l) {
26712
- d = await V(e, {
26794
+ d = await q(e, {
26713
26795
  sourceQuery: n,
26714
26796
  source: r,
26715
26797
  target: l,
@@ -26720,7 +26802,7 @@ async function H(e, t) {
26720
26802
  if (!t) throw Error(`transplant.deep: merge target vanished: ${l.id}`);
26721
26803
  u = t;
26722
26804
  } else {
26723
- let t = await B(e, {
26805
+ let t = await K(e, {
26724
26806
  sourceQuery: n,
26725
26807
  ref: r,
26726
26808
  targetParent: i,
@@ -26733,10 +26815,10 @@ async function H(e, t) {
26733
26815
  }
26734
26816
  let f = /* @__PURE__ */ new Map();
26735
26817
  if (a) {
26736
- let t = await Mn(n, r);
26818
+ let t = await Hn(n, r);
26737
26819
  if (t.length > 0) {
26738
26820
  let r = typeof a == "object" ? a.keepNameFrom : void 0;
26739
- f = (await kt(e, {
26821
+ f = (await It(e, {
26740
26822
  sourceQuery: n,
26741
26823
  records: t,
26742
26824
  cloneMappings: d,
@@ -26750,7 +26832,7 @@ async function H(e, t) {
26750
26832
  recordMappings: d
26751
26833
  };
26752
26834
  }
26753
- async function jn(e, t) {
26835
+ async function Vn(e, t) {
26754
26836
  let { sourceQuery: n, ref: r, targetParent: i } = t;
26755
26837
  if (r.tagName !== "Private") return;
26756
26838
  let a = (await n.any.getAttributes(r)).type;
@@ -26761,7 +26843,7 @@ async function jn(e, t) {
26761
26843
  id: t.id
26762
26844
  };
26763
26845
  }
26764
- async function Mn(e, t) {
26846
+ async function Hn(e, t) {
26765
26847
  let { LNode: n = [], LN: r = [], LN0: i = [] } = await e.findDescendants(t, { collect: [
26766
26848
  "LNode",
26767
26849
  "LN",
@@ -26775,8 +26857,8 @@ async function Mn(e, t) {
26775
26857
  }
26776
26858
  //#endregion
26777
26859
  //#region src/v2019C1/extensions/lifecycle/transplant/transaction/primitives/clone-referenced.ts
26778
- async function Nn(e, t) {
26779
- let { sourceQuery: n, scopeRef: r, refTagName: i, targetTagName: a, alreadyCloned: o } = t, s = T[i][0].attribute.uuid, { [i]: c = [] } = await n.findDescendants(r, { collect: i }), l = /* @__PURE__ */ new Set();
26860
+ async function Un(e, t) {
26861
+ let { sourceQuery: n, scopeRef: r, refTagName: i, targetTagName: a, alreadyCloned: o } = t, s = O[i][0].attribute.uuid, { [i]: c = [] } = await n.findDescendants(r, { collect: i }), l = /* @__PURE__ */ new Set();
26780
26862
  for (let e of c) {
26781
26863
  let t = e.attributes.find((e) => e.name === s)?.value;
26782
26864
  t && l.add(t);
@@ -26799,8 +26881,8 @@ async function Nn(e, t) {
26799
26881
  }
26800
26882
  return u;
26801
26883
  }
26802
- async function Pn(e, t) {
26803
- let { sourceQuery: n, scopeRef: r, refTagName: i, targetTagName: a, resolveTargetParent: o, alreadyCloned: s, omit: c } = t, l = await Nn(e, {
26884
+ async function Wn(e, t) {
26885
+ let { sourceQuery: n, scopeRef: r, refTagName: i, targetTagName: a, resolveTargetParent: o, alreadyCloned: s, omit: c } = t, l = await Un(e, {
26804
26886
  sourceQuery: n,
26805
26887
  scopeRef: r,
26806
26888
  refTagName: i,
@@ -26808,7 +26890,7 @@ async function Pn(e, t) {
26808
26890
  alreadyCloned: s
26809
26891
  }), u = [];
26810
26892
  for (let t of l) {
26811
- let r = await B(e, {
26893
+ let r = await K(e, {
26812
26894
  sourceQuery: n,
26813
26895
  ref: t,
26814
26896
  targetParent: await o(t),
@@ -26818,9 +26900,9 @@ async function Pn(e, t) {
26818
26900
  }
26819
26901
  return u;
26820
26902
  }
26821
- async function Fn(e, t) {
26822
- let { sourceQuery: n, scopeTagName: r, scopeRef: i, resolveTargetParent: a, alreadyCloned: o, skip: s = /* @__PURE__ */ new Set(), omit: c } = t, l = (f[r] ?? []).filter((e) => e in T && !s.has(e)), u = Pn, d = [];
26823
- for (let t of l) for (let r of T[t]) for (let s of r.target) {
26903
+ async function Gn(e, t) {
26904
+ 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 O && !s.has(e)), u = Wn, d = [];
26905
+ for (let t of l) for (let r of O[t]) for (let s of r.target) {
26824
26906
  let r = await u(e, {
26825
26907
  sourceQuery: n,
26826
26908
  scopeRef: i,
@@ -26836,14 +26918,14 @@ async function Fn(e, t) {
26836
26918
  }
26837
26919
  //#endregion
26838
26920
  //#region src/v2019C1/extensions/lifecycle/transplant/transaction/resolve-structure-ref.ts
26839
- async function U(e, t, n) {
26921
+ async function Y(e, t, n) {
26840
26922
  let r = (await e.findAncestors(t, { stopAtTagName: "Substation" })).find((e) => e.tagName in n);
26841
- o(r, {
26923
+ s(r, {
26842
26924
  key: "ELEMENT_NOT_FOUND",
26843
26925
  detail: `No Substation/VoltageLevel/Bay level in the target structure for ${t.tagName}`
26844
26926
  });
26845
26927
  let i = n[r.tagName];
26846
- return o(i, {
26928
+ return s(i, {
26847
26929
  key: "ELEMENT_NOT_FOUND",
26848
26930
  detail: `Target structure missing the ${r.tagName} level for ${t.tagName}`
26849
26931
  }), {
@@ -26851,7 +26933,7 @@ async function U(e, t, n) {
26851
26933
  id: i.id
26852
26934
  };
26853
26935
  }
26854
- function In(e) {
26936
+ function Kn(e) {
26855
26937
  let { sourceQuery: t, structure: n, cloneIndex: r } = e;
26856
26938
  return async function(e) {
26857
26939
  let i = await t.findAncestors(e, { stopAtTagName: "Substation" });
@@ -26866,7 +26948,7 @@ function In(e) {
26866
26948
  };
26867
26949
  }
26868
26950
  }
26869
- o(!1, {
26951
+ s(!1, {
26870
26952
  key: "ELEMENT_NOT_FOUND",
26871
26953
  detail: `No clone-mapped or structural ancestor found for ${e.tagName}`
26872
26954
  });
@@ -26874,26 +26956,25 @@ function In(e) {
26874
26956
  }
26875
26957
  //#endregion
26876
26958
  //#region src/v2019C1/extensions/lifecycle/engine/reconcile.ts
26877
- var Ln = new Set(Object.keys(T));
26878
- async function W(e, t) {
26959
+ async function qn(e, t) {
26879
26960
  let { sourceQuery: n, sourceRootRef: r, instanceRootRef: i, accepted: a, overrides: o, keepNameTypesFrom: s } = t, c = await n.any.getTree(r), l = await e.any.getTree(i);
26880
26961
  if (!c || !l) return;
26881
26962
  let u = /* @__PURE__ */ new Map();
26882
- await Hn(e, {
26963
+ await Qn(e, {
26883
26964
  node: l,
26884
26965
  index: u
26885
26966
  });
26886
26967
  let d = /* @__PURE__ */ new Set();
26887
- await Un(n, {
26968
+ await $n(n, {
26888
26969
  node: c,
26889
26970
  out: d
26890
- }), await Vn(e, {
26971
+ }), await Zn(e, {
26891
26972
  sourceQuery: n,
26892
26973
  instanceRecord: l,
26893
26974
  sourceNode: c,
26894
26975
  accepted: a,
26895
26976
  overrides: o
26896
- }), await Rn(e, {
26977
+ }), await Jn(e, {
26897
26978
  sourceQuery: n,
26898
26979
  sourceNode: c,
26899
26980
  instanceParent: l,
@@ -26901,24 +26982,24 @@ async function W(e, t) {
26901
26982
  accepted: a,
26902
26983
  overrides: o,
26903
26984
  keepNameTypesFrom: s
26904
- }), await zn(e, {
26985
+ }), await Yn(e, {
26905
26986
  instanceNode: l,
26906
26987
  sourceUuids: d,
26907
26988
  accepted: a
26908
26989
  });
26909
26990
  }
26910
- async function Rn(e, t) {
26991
+ async function Jn(e, t) {
26911
26992
  let { sourceQuery: n, sourceNode: r, instanceParent: i, index: o, accepted: s, overrides: c, keepNameTypesFrom: l } = t, u = /* @__PURE__ */ new Set();
26912
26993
  for (let t of r.tree) {
26913
26994
  let r = await n.any.getAttribute(t, { name: "uuid" }), d = (r ? o.get(r) : void 0) ?? (r ? void 0 : i.tree.find((e) => e.tagName === t.tagName && !u.has(e.id)));
26914
26995
  if (d) {
26915
- u.add(d.id), await Vn(e, {
26996
+ u.add(d.id), await Zn(e, {
26916
26997
  sourceQuery: n,
26917
26998
  instanceRecord: d,
26918
26999
  sourceNode: t,
26919
27000
  accepted: s,
26920
27001
  overrides: c
26921
- }), await Rn(e, {
27002
+ }), await Jn(e, {
26922
27003
  sourceQuery: n,
26923
27004
  sourceNode: t,
26924
27005
  instanceParent: d,
@@ -26930,29 +27011,34 @@ async function Rn(e, t) {
26930
27011
  continue;
26931
27012
  }
26932
27013
  if (s && !s.sourceIds.has(t.id)) continue;
26933
- let { recordMappings: f } = await H(e, {
27014
+ let { recordMappings: f } = await J(e, {
26934
27015
  sourceQuery: n,
26935
27016
  ref: a(t),
26936
27017
  targetParent: a(i),
26937
27018
  strip: !1,
26938
27019
  withTypes: { keepNameFrom: l }
26939
27020
  });
26940
- await F(e, {
27021
+ await V(e, {
26941
27022
  mappings: f,
26942
27023
  mode: "stamp-template"
26943
27024
  });
26944
27025
  let p = f.find((e) => e.source.id === t.id);
26945
- p && await z(e, {
27026
+ p && await G(e, {
26946
27027
  ref: p.target,
26947
27028
  parentRef: a(i),
26948
27029
  overrides: c?.get(t.id)
26949
27030
  });
26950
27031
  }
26951
- for (let t of i.tree) u.has(t.id) || Ln.has(t.tagName) && (await e.any.getAttribute(t, { name: "templateUuid" }) || s && !s.instanceIds.has(t.id) || await e.any.getRecord(t) && await e.any.delete(t));
27032
+ for (let t of i.tree) if (!u.has(t.id) && !await e.any.getAttribute(t, { name: "templateUuid" })) {
27033
+ if (fe.has(t.tagName) && !k.has(t.tagName)) {
27034
+ if (s && !s.instanceIds.has(t.id)) continue;
27035
+ } else if (!s || !s.instanceIds.has(t.id)) continue;
27036
+ await e.any.getRecord(t) && await e.any.delete(t);
27037
+ }
26952
27038
  }
26953
- async function zn(e, t) {
27039
+ async function Yn(e, t) {
26954
27040
  let { instanceNode: n, sourceUuids: r, accepted: i } = t, a = [];
26955
- await Bn(e, {
27041
+ await Xn(e, {
26956
27042
  node: n,
26957
27043
  sourceUuids: r,
26958
27044
  accepted: i,
@@ -26960,82 +27046,96 @@ async function zn(e, t) {
26960
27046
  });
26961
27047
  for (let t of a) await e.any.getRecord(t) && await e.any.delete(t);
26962
27048
  }
26963
- async function Bn(e, t) {
27049
+ async function Xn(e, t) {
26964
27050
  let { node: n, sourceUuids: r, accepted: i, out: a } = t, o = await e.any.getAttribute(n, { name: "templateUuid" });
26965
27051
  if (o && !r.has(o)) {
26966
27052
  (!i || i.instanceIds.has(n.id)) && a.push(n);
26967
27053
  return;
26968
27054
  }
26969
- for (let t of n.tree) await Bn(e, {
27055
+ for (let t of n.tree) await Xn(e, {
26970
27056
  node: t,
26971
27057
  sourceUuids: r,
26972
27058
  accepted: i,
26973
27059
  out: a
26974
27060
  });
26975
27061
  }
26976
- async function Vn(e, t) {
27062
+ async function Zn(e, t) {
26977
27063
  let { sourceQuery: n, instanceRecord: r, sourceNode: i, accepted: a, overrides: o } = t;
26978
27064
  if (a && !a.sourceIds.has(i.id)) return;
26979
27065
  let s = {
26980
- ...I(await n.any.getAttributes(i)),
27066
+ ...H(await n.any.getAttributes(i)),
26981
27067
  ...o?.get(i.id)
26982
- }, c = I(await e.any.getAttributes(r)), l = {};
26983
- for (let [e, t] of Object.entries(s)) c[e] !== t && (l[e] = t);
27068
+ }, c = H(await e.any.getAttributes(r)), l = {};
27069
+ for (let e of new Set([...Object.keys(s), ...Object.keys(c)])) {
27070
+ let t = e in s ? s[e] : void 0;
27071
+ c[e] !== t && (l[e] = t);
27072
+ }
27073
+ if (r.tagName === "LNode" && Object.keys(l).some((e) => Le.has(e)) && await T(e, r)) for (let e of Le) delete l[e];
26984
27074
  Object.keys(l).length > 0 && await e.any.update(r, { attributes: l });
26985
27075
  }
26986
- async function Hn(e, t) {
27076
+ async function Qn(e, t) {
26987
27077
  let { node: n, index: r } = t, i = await e.any.getAttribute(n, { name: "templateUuid" });
26988
27078
  i && r.set(i, n);
26989
- for (let t of n.tree) await Hn(e, {
27079
+ for (let t of n.tree) await Qn(e, {
26990
27080
  node: t,
26991
27081
  index: r
26992
27082
  });
26993
27083
  }
26994
- async function Un(e, t) {
27084
+ async function $n(e, t) {
26995
27085
  let { node: n, out: r } = t, i = await e.any.getAttribute(n, { name: "uuid" });
26996
27086
  i && r.add(i);
26997
- for (let t of n.tree) await Un(e, {
27087
+ for (let t of n.tree) await $n(e, {
26998
27088
  node: t,
26999
27089
  out: r
27000
27090
  });
27001
27091
  }
27002
27092
  //#endregion
27003
27093
  //#region src/v2019C1/extensions/lifecycle/engine/decide.ts
27004
- function Wn(e) {
27094
+ function er(e) {
27005
27095
  return e === void 0 ? "accept" : typeof e == "string" ? e : e.action;
27006
27096
  }
27007
- function Gn(e) {
27097
+ function tr(e) {
27008
27098
  return typeof e == "object" ? e.values : void 0;
27009
27099
  }
27010
- function Kn(e) {
27011
- return Wn(e.decisions.get(e.groupId)) !== "skip";
27100
+ function nr(e) {
27101
+ let t = e.decisions.get(e.group.id);
27102
+ return t === void 0 ? e.group.suggestedAction : er(t);
27103
+ }
27104
+ function rr(e) {
27105
+ return nr(e) !== "skip";
27012
27106
  }
27013
- function G(e) {
27107
+ function ir(e) {
27014
27108
  let { groups: t, decisions: n } = e, r = /* @__PURE__ */ new Map();
27015
27109
  for (let e of t) {
27016
27110
  let t = n.get(e.id);
27017
- if (Wn(t) === "skip") continue;
27018
- let i = Gn(t), a = e.primary.sourceRef?.id;
27111
+ if (nr({
27112
+ group: e,
27113
+ decisions: n
27114
+ }) === "skip") continue;
27115
+ let i = tr(t), a = e.primary.sourceRef?.id;
27019
27116
  i && a && r.set(a, i);
27020
27117
  }
27021
27118
  return r;
27022
27119
  }
27023
- function qn(e) {
27120
+ function ar(e) {
27024
27121
  let { groups: t, decisions: n } = e;
27025
- for (let e of t) if (Kn({
27026
- groupId: e.id,
27122
+ for (let e of t) if (rr({
27123
+ group: e,
27027
27124
  decisions: n
27028
- })) for (let t of e.dependsOn) o(Kn({
27029
- groupId: t,
27125
+ })) for (let r of e.dependsOn) s(rr({
27126
+ group: or(t, r) ?? e,
27030
27127
  decisions: n
27031
- }), { detail: `decision accepts group "${e.id}" but its dependency "${t}" is skipped` });
27128
+ }), { detail: `decision accepts group "${e.id}" but its dependency "${r}" is skipped` });
27032
27129
  }
27033
- function K(e) {
27130
+ function or(e, t) {
27131
+ return e.find((e) => e.id === t);
27132
+ }
27133
+ function sr(e) {
27034
27134
  let { groups: t, decisions: n } = e, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
27035
- for (let e of t) if (Kn({
27036
- groupId: e.id,
27135
+ for (let e of t) if (rr({
27136
+ group: e,
27037
27137
  decisions: n
27038
- })) for (let t of [e.primary, ...e.companions]) Jn({
27138
+ })) for (let t of [e.primary, ...e.companions]) cr({
27039
27139
  node: t,
27040
27140
  sourceIds: r,
27041
27141
  instanceIds: i
@@ -27045,56 +27145,56 @@ function K(e) {
27045
27145
  instanceIds: i
27046
27146
  };
27047
27147
  }
27048
- function Jn(e) {
27148
+ function cr(e) {
27049
27149
  let { node: t, sourceIds: n, instanceIds: r } = e;
27050
- t.change === "removed" ? t.instanceRef?.id && r.add(t.instanceRef.id) : t.sourceRef?.id && n.add(t.sourceRef.id);
27150
+ t.change === "removed" || t.change === "target-only" ? t.instanceRef?.id && r.add(t.instanceRef.id) : t.sourceRef?.id && n.add(t.sourceRef.id);
27051
27151
  }
27052
27152
  //#endregion
27053
27153
  //#region src/v2019C1/extensions/lifecycle/instance/composed-functions.ts
27054
- async function Yn(e, t) {
27154
+ async function lr(e, t) {
27055
27155
  let n = /* @__PURE__ */ new Set(), r = await e.any.getTree(t);
27056
- return r && await Xn(e, r, n), n;
27156
+ return r && await ur(e, r, n), n;
27057
27157
  }
27058
- async function Xn(e, t, n) {
27158
+ async function ur(e, t, n) {
27059
27159
  if (t.tagName === "FunctionRef") {
27060
27160
  let r = await e.any.getAttribute(t, { name: "functionUuid" });
27061
27161
  r && n.add(r);
27062
27162
  }
27063
- for (let r of t.tree) await Xn(e, r, n);
27163
+ for (let r of t.tree) await ur(e, r, n);
27064
27164
  }
27065
27165
  //#endregion
27066
27166
  //#region src/v2019C1/extensions/lifecycle/instance/find-instance.ts
27067
- async function Zn(e, t) {
27167
+ async function dr(e, t) {
27068
27168
  let { targetParent: n, tagName: r, sourceUuid: i } = t;
27069
27169
  if (!i) return [];
27070
27170
  let a = await e.any.getTree(n);
27071
27171
  if (!a) return [];
27072
27172
  let o = [];
27073
- return await Qn(e, {
27173
+ return await fr(e, {
27074
27174
  node: a,
27075
27175
  tagName: r,
27076
27176
  sourceUuid: i,
27077
27177
  out: o
27078
27178
  }), o;
27079
27179
  }
27080
- async function Qn(e, t) {
27180
+ async function fr(e, t) {
27081
27181
  let { node: n, tagName: r, sourceUuid: i, out: a } = t;
27082
27182
  if (n.tagName === r && await e.any.getAttribute(n, { name: "templateUuid" }) === i) {
27083
27183
  a.push(n);
27084
27184
  return;
27085
27185
  }
27086
- for (let t of n.tree) await Qn(e, {
27186
+ for (let t of n.tree) await fr(e, {
27087
27187
  node: t,
27088
27188
  tagName: r,
27089
27189
  sourceUuid: i,
27090
27190
  out: a
27091
27191
  });
27092
27192
  }
27093
- async function $n(e, t) {
27094
- let [n] = await q(e, t);
27193
+ async function pr(e, t) {
27194
+ let [n] = await X(e, t);
27095
27195
  return n;
27096
27196
  }
27097
- async function q(e, t) {
27197
+ async function X(e, t) {
27098
27198
  let { tagName: n, sourceUuid: r } = t;
27099
27199
  if (!r) return [];
27100
27200
  let i = await e.any.getRecordsByTagName(n), a = [];
@@ -27103,15 +27203,15 @@ async function q(e, t) {
27103
27203
  }
27104
27204
  //#endregion
27105
27205
  //#region src/v2019C1/extensions/lifecycle/update/transaction/satellite-reconcile.ts
27106
- async function er(e, t) {
27206
+ async function mr(e, t) {
27107
27207
  let { sourceQuery: n, satelliteRefs: r, instanceSatelliteRefs: i, structure: a, accepted: o } = t;
27108
27208
  for (let t of r) {
27109
- let { uuid: r } = await n.any.getAttributes(t), i = await $n(e, {
27209
+ let { uuid: r } = await n.any.getAttributes(t), i = await pr(e, {
27110
27210
  tagName: t.tagName,
27111
27211
  sourceUuid: r
27112
27212
  });
27113
27213
  if (i) {
27114
- await W(e, {
27214
+ await qn(e, {
27115
27215
  sourceQuery: n,
27116
27216
  sourceRootRef: t,
27117
27217
  instanceRootRef: i,
@@ -27120,13 +27220,13 @@ async function er(e, t) {
27120
27220
  continue;
27121
27221
  }
27122
27222
  if (o && t.id && !o.sourceIds.has(t.id)) continue;
27123
- let s = await B(e, {
27223
+ let s = await K(e, {
27124
27224
  sourceQuery: n,
27125
27225
  ref: t,
27126
- targetParent: await U(n, t, a),
27226
+ targetParent: await Y(n, t, a),
27127
27227
  strip: !1
27128
27228
  });
27129
- s && await F(e, {
27229
+ s && await V(e, {
27130
27230
  mappings: s.mappings,
27131
27231
  mode: "stamp-template"
27132
27232
  });
@@ -27138,26 +27238,26 @@ async function er(e, t) {
27138
27238
  tagName: t.tagName,
27139
27239
  attributes: { uuid: r }
27140
27240
  });
27141
- i || o && t.id && !o.instanceIds.has(t.id) || (await O(e, { target: t })).length > 0 || await e.delete(t);
27241
+ i || o && t.id && !o.instanceIds.has(t.id) || (await F(e, { target: t })).length > 0 || await e.delete(t);
27142
27242
  }
27143
27243
  }
27144
27244
  //#endregion
27145
27245
  //#region src/v2019C1/extensions/lifecycle/cross-cutting/applied-satellites.constants.ts
27146
- var tr = ["Variable", "BehaviorDescription"];
27246
+ var hr = ["Variable", "BehaviorDescription"];
27147
27247
  //#endregion
27148
27248
  //#region src/v2019C1/extensions/lifecycle/cross-cutting/applied-satellites.ts
27149
- async function J(e, t) {
27249
+ async function Z(e, t) {
27150
27250
  let { primaryRef: n } = t, r = await e.any.getTree(n);
27151
27251
  if (!r) return [];
27152
27252
  let i = /* @__PURE__ */ new Set(), o = [];
27153
- nr({
27253
+ gr({
27154
27254
  node: r,
27155
27255
  subtreeIds: i,
27156
27256
  targets: o
27157
27257
  });
27158
27258
  let s = /* @__PURE__ */ new Set(), c = [];
27159
- for (let t of o) for (let n of tr) {
27160
- let r = await A.query.findRefsPointingTo(e, {
27259
+ for (let t of o) for (let n of hr) {
27260
+ let r = await L.query.findRefsPointingTo(e, {
27161
27261
  target: a(t),
27162
27262
  containerTagName: n
27163
27263
  });
@@ -27165,10 +27265,10 @@ async function J(e, t) {
27165
27265
  }
27166
27266
  return c;
27167
27267
  }
27168
- function nr(e) {
27268
+ function gr(e) {
27169
27269
  let { node: t, subtreeIds: n, targets: r } = e;
27170
27270
  n.add(t.id), t.attributes.some((e) => e.name === "uuid") && r.push(t);
27171
- for (let e of t.tree) nr({
27271
+ for (let e of t.tree) gr({
27172
27272
  node: e,
27173
27273
  subtreeIds: n,
27174
27274
  targets: r
@@ -27176,35 +27276,35 @@ function nr(e) {
27176
27276
  }
27177
27277
  //#endregion
27178
27278
  //#region src/v2019C1/extensions/lifecycle/update/transaction/cross-cutting-satellites.ts
27179
- async function rr(e, t) {
27279
+ async function _r(e, t) {
27180
27280
  let { sourceQuery: n, primaryRef: r, instancePrimaryRef: i, structure: a, accepted: o } = t;
27181
- await er(e, {
27281
+ await mr(e, {
27182
27282
  sourceQuery: n,
27183
- satelliteRefs: await J(n, { primaryRef: r }),
27184
- instanceSatelliteRefs: i ? await J(e, { primaryRef: i }) : [],
27283
+ satelliteRefs: await Z(n, { primaryRef: r }),
27284
+ instanceSatelliteRefs: i ? await Z(e, { primaryRef: i }) : [],
27185
27285
  structure: a,
27186
27286
  accepted: o
27187
27287
  });
27188
27288
  }
27189
27289
  //#endregion
27190
27290
  //#region src/v2019C1/extensions/lifecycle/instantiate/transaction/resolve-target-structure.ts
27191
- async function Y(e, t) {
27291
+ async function Q(e, t) {
27192
27292
  let n = await e.getRecord(t);
27193
- o(n, {
27293
+ s(n, {
27194
27294
  key: "ELEMENT_NOT_FOUND",
27195
27295
  detail: `resolveTargetStructure: target parent not found: ${t.tagName}#${t.id}`
27196
27296
  });
27197
- let r = [n, ...await e.findAncestors(t, { stopAtTagName: "Substation" })], i = r.find((e) => e.tagName === "Substation"), a = r.find((e) => e.tagName === "VoltageLevel"), s = r.find((e) => e.tagName === "Bay"), c = {};
27198
- return i && (c.Substation = i), a && (c.VoltageLevel = a), s && (c.Bay = s), c;
27297
+ let r = [n, ...await e.findAncestors(t, { stopAtTagName: "Substation" })], i = r.find((e) => e.tagName === "Substation"), a = r.find((e) => e.tagName === "VoltageLevel"), o = r.find((e) => e.tagName === "Bay"), c = {};
27298
+ return i && (c.Substation = i), a && (c.VoltageLevel = a), o && (c.Bay = o), c;
27199
27299
  }
27200
27300
  //#endregion
27201
27301
  //#region src/v2019C1/extensions/lifecycle/cross-cutting/clone-applied-satellites.ts
27202
- async function ir(e, t) {
27203
- let { sourceQuery: n, primaryRef: r, structure: i, strip: a = !0 } = t, o = await J(n, { primaryRef: r }), s = [];
27302
+ async function vr(e, t) {
27303
+ let { sourceQuery: n, primaryRef: r, structure: i, strip: a = !0 } = t, o = await Z(n, { primaryRef: r }), s = [];
27204
27304
  for (let t of o) {
27205
- let r = await ar(e, n, t);
27305
+ let r = await yr(e, n, t);
27206
27306
  if (r) {
27207
- let i = await V(e, {
27307
+ let i = await q(e, {
27208
27308
  sourceQuery: n,
27209
27309
  source: t,
27210
27310
  target: r,
@@ -27213,17 +27313,17 @@ async function ir(e, t) {
27213
27313
  s.push(...i);
27214
27314
  continue;
27215
27315
  }
27216
- let o = await B(e, {
27316
+ let o = await K(e, {
27217
27317
  sourceQuery: n,
27218
27318
  ref: t,
27219
- targetParent: await U(n, t, i),
27319
+ targetParent: await Y(n, t, i),
27220
27320
  ...a ? {} : { strip: !1 }
27221
27321
  });
27222
27322
  o && s.push(...o.mappings);
27223
27323
  }
27224
27324
  return s;
27225
27325
  }
27226
- async function ar(e, t, n) {
27326
+ async function yr(e, t, n) {
27227
27327
  let r = await t.any.getRecord(n);
27228
27328
  if (!r) return;
27229
27329
  let i = await t.any.getAttribute(r, { name: "name" });
@@ -27239,8 +27339,8 @@ async function ar(e, t, n) {
27239
27339
  }
27240
27340
  //#endregion
27241
27341
  //#region src/v2019C1/extensions/lifecycle/layers/function/clone-function.ts
27242
- async function or(e, t) {
27243
- let { sourceQuery: n, functionRef: r, targetParentRef: i, omit: a, stripRootAttributes: o, keepNameTypesFrom: s } = t, { recordMappings: c } = await H(e, {
27342
+ async function br(e, t) {
27343
+ let { sourceQuery: n, functionRef: r, targetParentRef: i, omit: a, stripRootAttributes: o, keepNameTypesFrom: s } = t, { recordMappings: c } = await J(e, {
27244
27344
  sourceQuery: n,
27245
27345
  ref: r,
27246
27346
  targetParent: i,
@@ -27257,15 +27357,15 @@ async function or(e, t) {
27257
27357
  });
27258
27358
  return c;
27259
27359
  }
27260
- async function X(e, t) {
27261
- let { sourceQuery: n, functionRef: r, structure: i, stripCategoriesUuid: a = !0 } = t, o = await sr(n, r), s = [];
27360
+ async function xr(e, t) {
27361
+ let { sourceQuery: n, functionRef: r, structure: i, stripCategoriesUuid: a = !0 } = t, o = await Sr(n, r), s = [];
27262
27362
  for (let t of o) {
27263
27363
  let r = {
27264
27364
  tagName: "FunctionCategory",
27265
27365
  id: t
27266
- }, o = await lr(e, n, t);
27366
+ }, o = await wr(e, n, t);
27267
27367
  if (o) {
27268
- let t = await V(e, {
27368
+ let t = await q(e, {
27269
27369
  sourceQuery: n,
27270
27370
  source: r,
27271
27371
  target: o,
@@ -27274,28 +27374,28 @@ async function X(e, t) {
27274
27374
  s.push(...t);
27275
27375
  continue;
27276
27376
  }
27277
- let c = await B(e, {
27377
+ let c = await K(e, {
27278
27378
  sourceQuery: n,
27279
27379
  ref: r,
27280
- targetParent: await U(n, r, i),
27380
+ targetParent: await Y(n, r, i),
27281
27381
  ...a ? {} : { strip: !1 }
27282
27382
  });
27283
27383
  c && s.push(...c.mappings);
27284
27384
  }
27285
27385
  return s;
27286
27386
  }
27287
- async function sr(e, t) {
27288
- let n = await cr(e, t), r = /* @__PURE__ */ new Set();
27387
+ async function Sr(e, t) {
27388
+ let n = await Cr(e, t), r = /* @__PURE__ */ new Set();
27289
27389
  for (let { container: e } of n) e && r.add(e.id);
27290
27390
  return r;
27291
27391
  }
27292
- async function cr(e, t) {
27293
- let n = await A.query.findRefsPointingTo(e, {
27392
+ async function Cr(e, t) {
27393
+ let n = await L.query.findRefsPointingTo(e, {
27294
27394
  target: t,
27295
27395
  containerTagName: "FunctionCategory"
27296
27396
  }), { SubFunction: r = [] } = await e.findDescendants(t, { collect: "SubFunction" });
27297
27397
  for (let t of r) {
27298
- let r = await A.query.findRefsPointingTo(e, {
27398
+ let r = await L.query.findRefsPointingTo(e, {
27299
27399
  target: {
27300
27400
  tagName: "SubFunction",
27301
27401
  id: t.id
@@ -27306,7 +27406,7 @@ async function cr(e, t) {
27306
27406
  }
27307
27407
  return n;
27308
27408
  }
27309
- async function lr(e, t, n) {
27409
+ async function wr(e, t, n) {
27310
27410
  let r = await t.getRecord({
27311
27411
  tagName: "FunctionCategory",
27312
27412
  id: n
@@ -27325,18 +27425,18 @@ async function lr(e, t, n) {
27325
27425
  }
27326
27426
  //#endregion
27327
27427
  //#region src/v2019C1/extensions/lifecycle/layers/function/satellites.constants.ts
27328
- var ur = ["FunctionCategory"];
27428
+ var Tr = ["FunctionCategory"];
27329
27429
  //#endregion
27330
27430
  //#region src/v2019C1/extensions/lifecycle/layers/function/satellites.ts
27331
- async function Z(e, t) {
27431
+ async function Er(e, t) {
27332
27432
  let { primaryRef: n } = t, r = [n], { SubFunction: i = [] } = await e.findDescendants(n, { collect: "SubFunction" });
27333
27433
  for (let e of i) r.push({
27334
27434
  tagName: "SubFunction",
27335
27435
  id: e.id
27336
27436
  });
27337
27437
  let o = /* @__PURE__ */ new Set(), s = [];
27338
- for (let t of r) for (let n of ur) {
27339
- let r = await A.query.findRefsPointingTo(e, {
27438
+ for (let t of r) for (let n of Tr) {
27439
+ let r = await L.query.findRefsPointingTo(e, {
27340
27440
  target: t,
27341
27441
  containerTagName: n
27342
27442
  });
@@ -27346,8 +27446,8 @@ async function Z(e, t) {
27346
27446
  }
27347
27447
  //#endregion
27348
27448
  //#region src/v2019C1/extensions/lifecycle/instantiate/transaction/fsd.ts
27349
- async function dr(e, t) {
27350
- let { sourceQuery: n, functionRef: r, targetParent: i, overrides: a, keepNameTypesFrom: o } = t, { recordMappings: s } = await H(e, {
27449
+ async function Dr(e, t) {
27450
+ let { sourceQuery: n, functionRef: r, targetParent: i, overrides: a, keepNameTypesFrom: o } = t, { recordMappings: s } = await J(e, {
27351
27451
  sourceQuery: n,
27352
27452
  ref: r,
27353
27453
  targetParent: i,
@@ -27357,18 +27457,18 @@ async function dr(e, t) {
27357
27457
  to: "SubFunction"
27358
27458
  } : void 0,
27359
27459
  withTypes: { keepNameFrom: o }
27360
- }), c = await Y(e, i), l = await X(e, {
27460
+ }), c = await Q(e, i), l = await xr(e, {
27361
27461
  sourceQuery: n,
27362
27462
  functionRef: r,
27363
27463
  structure: c,
27364
27464
  stripCategoriesUuid: !1
27365
- }), u = await ir(e, {
27465
+ }), u = await vr(e, {
27366
27466
  sourceQuery: n,
27367
27467
  primaryRef: r,
27368
27468
  structure: c,
27369
27469
  strip: !1
27370
27470
  });
27371
- await F(e, {
27471
+ await V(e, {
27372
27472
  mappings: [
27373
27473
  ...s,
27374
27474
  ...l,
@@ -27379,11 +27479,11 @@ async function dr(e, t) {
27379
27479
  let d = s.find((e) => e.source.id === r.id);
27380
27480
  if (!d) throw Error(`instantiate.fsd: cloned root not found for ${r.tagName}#${r.id}`);
27381
27481
  let f = d.target;
27382
- return await z(e, {
27482
+ return await G(e, {
27383
27483
  ref: f,
27384
27484
  parentRef: i,
27385
27485
  overrides: a?.get(r.id)
27386
- }), await ct(e, {
27486
+ }), await vt(e, {
27387
27487
  sourceQuery: n,
27388
27488
  targetRoot: f,
27389
27489
  fileType: "FSD"
@@ -27394,18 +27494,18 @@ async function dr(e, t) {
27394
27494
  }
27395
27495
  //#endregion
27396
27496
  //#region src/v2019C1/extensions/lifecycle/layers/application/clone-application.ts
27397
- async function fr(e, t) {
27398
- let { sourceQuery: n, applicationRef: r, structure: i, omit: a, keepNameTypesFrom: o } = t, s = /* @__PURE__ */ new Map(), c = [], l = await Nn(e, {
27497
+ async function Or(e, t) {
27498
+ let { sourceQuery: n, applicationRef: r, structure: i, omit: a, keepNameTypesFrom: o } = t, s = /* @__PURE__ */ new Map(), c = [], l = await Un(e, {
27399
27499
  sourceQuery: n,
27400
27500
  scopeRef: r,
27401
27501
  refTagName: "FunctionRef",
27402
27502
  targetTagName: "Function"
27403
27503
  });
27404
27504
  for (let t of l) {
27405
- let r = await or(e, {
27505
+ let r = await br(e, {
27406
27506
  sourceQuery: n,
27407
27507
  functionRef: t,
27408
- targetParentRef: await U(n, t, i),
27508
+ targetParentRef: await Y(n, t, i),
27409
27509
  omit: a,
27410
27510
  keepNameTypesFrom: o
27411
27511
  });
@@ -27413,7 +27513,7 @@ async function fr(e, t) {
27413
27513
  for (let e of r) e.source.id && s.set(e.source.id, e.target);
27414
27514
  }
27415
27515
  for (let t of l) {
27416
- let r = await X(e, {
27516
+ let r = await xr(e, {
27417
27517
  sourceQuery: n,
27418
27518
  functionRef: t,
27419
27519
  structure: i,
@@ -27421,16 +27521,16 @@ async function fr(e, t) {
27421
27521
  });
27422
27522
  c.push(...r);
27423
27523
  }
27424
- let u = await pr(e, {
27524
+ let u = await kr(e, {
27425
27525
  sourceQuery: n,
27426
27526
  applicationRef: r
27427
27527
  });
27428
27528
  for (let e of u) s.set(e.sourceId, e.existingRef);
27429
- let d = new Set(["FunctionRef", "FunctionCategoryRef"]), f = await Fn(e, {
27529
+ let d = new Set(["FunctionRef", "FunctionCategoryRef"]), f = await Gn(e, {
27430
27530
  sourceQuery: n,
27431
27531
  scopeTagName: "Application",
27432
27532
  scopeRef: r,
27433
- resolveTargetParent: In({
27533
+ resolveTargetParent: Kn({
27434
27534
  sourceQuery: n,
27435
27535
  structure: i,
27436
27536
  cloneIndex: s
@@ -27440,10 +27540,10 @@ async function fr(e, t) {
27440
27540
  omit: a
27441
27541
  });
27442
27542
  c.push(...f);
27443
- let p = await B(e, {
27543
+ let p = await K(e, {
27444
27544
  sourceQuery: n,
27445
27545
  ref: r,
27446
- targetParent: await U(n, r, i),
27546
+ targetParent: await Y(n, r, i),
27447
27547
  omit: a
27448
27548
  });
27449
27549
  p && c.push(...p.mappings);
@@ -27459,7 +27559,7 @@ async function fr(e, t) {
27459
27559
  }
27460
27560
  return c;
27461
27561
  }
27462
- async function pr(e, t) {
27562
+ async function kr(e, t) {
27463
27563
  let { sourceQuery: n, applicationRef: r } = t, { AllocationRoleRef: i = [] } = await n.findDescendants(r, { collect: "AllocationRoleRef" }), a = [], o = /* @__PURE__ */ new Set();
27464
27564
  for (let t of i) {
27465
27565
  let r = t.attributes.find((e) => e.name === "allocationRoleUuid")?.value;
@@ -27483,7 +27583,7 @@ async function pr(e, t) {
27483
27583
  tagName: "AllocationRole",
27484
27584
  id: c.id
27485
27585
  };
27486
- await V(e, {
27586
+ await q(e, {
27487
27587
  sourceQuery: n,
27488
27588
  source: {
27489
27589
  tagName: "AllocationRole",
@@ -27502,20 +27602,20 @@ async function pr(e, t) {
27502
27602
  }
27503
27603
  //#endregion
27504
27604
  //#region src/v2019C1/extensions/lifecycle/layers/application/satellites.constants.ts
27505
- var mr = [{
27605
+ var Ar = [{
27506
27606
  refTag: "AllocationRoleRef",
27507
27607
  uuidAttr: "allocationRoleUuid",
27508
27608
  targetTag: "AllocationRole"
27509
27609
  }];
27510
27610
  //#endregion
27511
27611
  //#region src/v2019C1/extensions/lifecycle/layers/application/satellites.ts
27512
- async function Q(e, t) {
27612
+ async function jr(e, t) {
27513
27613
  let { applicationRef: n } = t, r = await e.any.getTree(n);
27514
27614
  if (!r) return [];
27515
27615
  let i = /* @__PURE__ */ new Set(), o = [];
27516
- for (let t of mr) {
27616
+ for (let t of Ar) {
27517
27617
  let n = /* @__PURE__ */ new Set();
27518
- await hr(e, {
27618
+ await Mr(e, {
27519
27619
  node: r,
27520
27620
  refTag: t.refTag,
27521
27621
  uuidAttr: t.uuidAttr,
@@ -27531,13 +27631,13 @@ async function Q(e, t) {
27531
27631
  }
27532
27632
  return o;
27533
27633
  }
27534
- async function hr(e, t) {
27634
+ async function Mr(e, t) {
27535
27635
  let { node: n, refTag: r, uuidAttr: i, out: a } = t;
27536
27636
  if (n.tagName === r) {
27537
27637
  let t = await e.any.getAttribute(n, { name: i });
27538
27638
  t && a.add(t);
27539
27639
  }
27540
- for (let t of n.tree) await hr(e, {
27640
+ for (let t of n.tree) await Mr(e, {
27541
27641
  node: t,
27542
27642
  refTag: r,
27543
27643
  uuidAttr: i,
@@ -27546,32 +27646,32 @@ async function hr(e, t) {
27546
27646
  }
27547
27647
  //#endregion
27548
27648
  //#region src/v2019C1/extensions/lifecycle/instantiate/transaction/asd.ts
27549
- async function gr(e, t) {
27550
- let { sourceQuery: n, applicationRef: r, targetParent: i, overrides: a, keepNameTypesFrom: o } = t, s = await Y(e, i), c = await Nn(e, {
27649
+ async function Nr(e, t) {
27650
+ let { sourceQuery: n, applicationRef: r, targetParent: i, overrides: a, keepNameTypesFrom: o } = t, s = await Q(e, i), c = await Un(e, {
27551
27651
  sourceQuery: n,
27552
27652
  scopeRef: r,
27553
27653
  refTagName: "FunctionRef",
27554
27654
  targetTagName: "Function"
27555
- }), l = await fr(e, {
27655
+ }), l = await Or(e, {
27556
27656
  sourceQuery: n,
27557
27657
  applicationRef: r,
27558
27658
  structure: s,
27559
27659
  keepNameTypesFrom: o
27560
- }), u = await ir(e, {
27660
+ }), u = await vr(e, {
27561
27661
  sourceQuery: n,
27562
27662
  primaryRef: r,
27563
27663
  structure: s,
27564
27664
  strip: !1
27565
27665
  });
27566
- await F(e, {
27666
+ await V(e, {
27567
27667
  mappings: [...l, ...u],
27568
27668
  mode: "stamp-template"
27569
27669
  });
27570
27670
  for (let t of c) {
27571
27671
  let r = l.find((e) => e.source.id === t.id);
27572
27672
  if (!r) continue;
27573
- let i = await U(n, t, s);
27574
- await z(e, {
27673
+ let i = await Y(n, t, s);
27674
+ await G(e, {
27575
27675
  ref: r.target,
27576
27676
  parentRef: i,
27577
27677
  overrides: a?.get(t.id)
@@ -27579,12 +27679,12 @@ async function gr(e, t) {
27579
27679
  }
27580
27680
  let d = l.find((e) => e.source.id === r.id);
27581
27681
  if (!d) throw Error(`instantiate.asd: cloned Application not found for ${r.id}`);
27582
- let f = await U(n, r, s);
27583
- await z(e, {
27682
+ let f = await Y(n, r, s);
27683
+ await G(e, {
27584
27684
  ref: d.target,
27585
27685
  parentRef: f,
27586
27686
  overrides: a?.get(r.id)
27587
- }), await ct(e, {
27687
+ }), await vt(e, {
27588
27688
  sourceQuery: n,
27589
27689
  targetRoot: d.target,
27590
27690
  fileType: "ASD"
@@ -27598,10 +27698,10 @@ async function gr(e, t) {
27598
27698
  }
27599
27699
  //#endregion
27600
27700
  //#region src/v2019C1/extensions/lifecycle/update/transaction/function-satellites.ts
27601
- async function _r(e, t) {
27602
- let { sourceQuery: n, functionRef: r, instanceRef: i, targetParent: a, accepted: o } = t, s = await Z(n, { primaryRef: r }), c = !1;
27701
+ async function Pr(e, t) {
27702
+ let { sourceQuery: n, functionRef: r, instanceRef: i, targetParent: a, accepted: o } = t, s = await Er(n, { primaryRef: r }), c = !1;
27603
27703
  for (let t of s) {
27604
- let { uuid: r } = await n.any.getAttributes(t), i = await $n(e, {
27704
+ let { uuid: r } = await n.any.getAttributes(t), i = await pr(e, {
27605
27705
  tagName: t.tagName,
27606
27706
  sourceUuid: r
27607
27707
  });
@@ -27609,23 +27709,23 @@ async function _r(e, t) {
27609
27709
  c = !0;
27610
27710
  continue;
27611
27711
  }
27612
- await W(e, {
27712
+ await qn(e, {
27613
27713
  sourceQuery: n,
27614
27714
  sourceRootRef: t,
27615
27715
  instanceRootRef: i,
27616
27716
  accepted: o
27617
27717
  });
27618
27718
  }
27619
- c && (!o || o.sourceIds.has(r.id)) && await F(e, {
27620
- mappings: await X(e, {
27719
+ c && (!o || o.sourceIds.has(r.id)) && await V(e, {
27720
+ mappings: await xr(e, {
27621
27721
  sourceQuery: n,
27622
27722
  functionRef: r,
27623
- structure: await Y(e, a),
27723
+ structure: await Q(e, a),
27624
27724
  stripCategoriesUuid: !1
27625
27725
  }),
27626
27726
  mode: "stamp-template"
27627
27727
  });
27628
- let l = await Z(e, { primaryRef: {
27728
+ let l = await Er(e, { primaryRef: {
27629
27729
  tagName: "Function",
27630
27730
  id: i.id
27631
27731
  } });
@@ -27636,27 +27736,27 @@ async function _r(e, t) {
27636
27736
  tagName: t.tagName,
27637
27737
  attributes: { uuid: r }
27638
27738
  });
27639
- i || o && t.id && !o.instanceIds.has(t.id) || (await O(e, { target: t })).length > 0 || await e.delete(t);
27739
+ i || o && t.id && !o.instanceIds.has(t.id) || (await F(e, { target: t })).length > 0 || await e.delete(t);
27640
27740
  }
27641
27741
  }
27642
27742
  //#endregion
27643
27743
  //#region src/v2019C1/extensions/lifecycle/update/transaction/fsd.ts
27644
- async function vr(e, t) {
27645
- let { sourceQuery: n, functionRef: r, targetParent: i, scenario: a, report: o, decisions: s, keepNameTypesFrom: c } = t, { uuid: l } = await n.getAttributes(r), u = a === "instantiate" ? [] : await Zn(e, {
27744
+ async function Fr(e, t) {
27745
+ let { sourceQuery: n, functionRef: r, targetParent: i, scenario: a, report: o, decisions: s, keepNameTypesFrom: c } = t, { uuid: l } = await n.getAttributes(r), u = a === "instantiate" ? [] : await dr(e, {
27646
27746
  targetParent: i,
27647
27747
  tagName: "Function",
27648
27748
  sourceUuid: l
27649
27749
  }), d = o?.groups ?? [];
27650
27750
  if (u.length === 0) {
27651
- let t = s ? K({
27751
+ let t = s ? sr({
27652
27752
  groups: d,
27653
27753
  decisions: s
27654
- }) : void 0, a = s ? G({
27754
+ }) : void 0, a = s ? ir({
27655
27755
  groups: d,
27656
27756
  decisions: s
27657
27757
  }) : void 0;
27658
27758
  if (t && !t.sourceIds.has(r.id)) return [];
27659
- let { functionRef: o } = await dr(e, {
27759
+ let { functionRef: o } = await Dr(e, {
27660
27760
  sourceQuery: n,
27661
27761
  functionRef: r,
27662
27762
  targetParent: i,
@@ -27665,27 +27765,27 @@ async function vr(e, t) {
27665
27765
  });
27666
27766
  return [o];
27667
27767
  }
27668
- let f = await Y(e, i);
27768
+ let f = await Q(e, i);
27669
27769
  for (let t of u) {
27670
- let { instanceAccepted: a, instanceOverrides: o } = yr({
27770
+ let { instanceAccepted: a, instanceOverrides: o } = Ir({
27671
27771
  instanceId: t.id,
27672
27772
  groups: d,
27673
27773
  decisions: s
27674
27774
  });
27675
- await W(e, {
27775
+ await qn(e, {
27676
27776
  sourceQuery: n,
27677
27777
  sourceRootRef: r,
27678
27778
  instanceRootRef: t,
27679
27779
  accepted: a,
27680
27780
  overrides: o,
27681
27781
  keepNameTypesFrom: c
27682
- }), await _r(e, {
27782
+ }), await Pr(e, {
27683
27783
  sourceQuery: n,
27684
27784
  functionRef: r,
27685
27785
  instanceRef: t,
27686
27786
  targetParent: i,
27687
27787
  accepted: a
27688
- }), await rr(e, {
27788
+ }), await _r(e, {
27689
27789
  sourceQuery: n,
27690
27790
  primaryRef: r,
27691
27791
  instancePrimaryRef: {
@@ -27701,7 +27801,7 @@ async function vr(e, t) {
27701
27801
  id: e.id
27702
27802
  }));
27703
27803
  }
27704
- function yr(e) {
27804
+ function Ir(e) {
27705
27805
  let { instanceId: t, groups: n, decisions: r } = e;
27706
27806
  if (!r) return {
27707
27807
  instanceAccepted: void 0,
@@ -27709,11 +27809,11 @@ function yr(e) {
27709
27809
  };
27710
27810
  let i = n.filter((e) => e.instanceScopeId === t);
27711
27811
  return {
27712
- instanceAccepted: K({
27812
+ instanceAccepted: sr({
27713
27813
  groups: i,
27714
27814
  decisions: r
27715
27815
  }),
27716
- instanceOverrides: G({
27816
+ instanceOverrides: ir({
27717
27817
  groups: i,
27718
27818
  decisions: r
27719
27819
  })
@@ -27721,16 +27821,16 @@ function yr(e) {
27721
27821
  }
27722
27822
  //#endregion
27723
27823
  //#region src/v2019C1/extensions/lifecycle/update/transaction/asd.ts
27724
- async function br(e, t) {
27725
- 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 q(e, {
27824
+ async function Lr(e, t) {
27825
+ 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, {
27726
27826
  tagName: "Application",
27727
27827
  sourceUuid: l
27728
27828
  }), d = o?.groups ?? [];
27729
27829
  if (u.length === 0) {
27730
- let t = s ? K({
27830
+ let t = s ? sr({
27731
27831
  groups: d,
27732
27832
  decisions: s
27733
- }) : void 0, a = s ? G({
27833
+ }) : void 0, a = s ? ir({
27734
27834
  groups: d,
27735
27835
  decisions: s
27736
27836
  }) : void 0;
@@ -27738,7 +27838,7 @@ async function br(e, t) {
27738
27838
  applications: [],
27739
27839
  functions: []
27740
27840
  };
27741
- let { applicationRef: o, composedFunctionRefs: l } = await gr(e, {
27841
+ let { applicationRef: o, composedFunctionRefs: l } = await Nr(e, {
27742
27842
  sourceQuery: n,
27743
27843
  applicationRef: r,
27744
27844
  targetParent: i,
@@ -27750,32 +27850,37 @@ async function br(e, t) {
27750
27850
  functions: l
27751
27851
  };
27752
27852
  }
27753
- let f = await Y(e, i), p = await Q(n, { applicationRef: r });
27853
+ let f = await Q(e, i), p = await jr(n, { applicationRef: r }), m = [];
27754
27854
  for (let t of u) {
27755
- let i = d.filter((e) => e.instanceScopeId === t.id), a = s ? K({
27855
+ let i = d.filter((e) => e.instanceScopeId === t.id), a = s ? sr({
27756
27856
  groups: i,
27757
27857
  decisions: s
27758
- }) : void 0, o = s ? G({
27858
+ }) : void 0, o = s ? ir({
27759
27859
  groups: i,
27760
27860
  decisions: s
27761
- }) : void 0, l = await Q(e, { applicationRef: {
27861
+ }) : void 0;
27862
+ (!a || a.sourceIds.size > 0 || a.instanceIds.size > 0) && m.push({
27863
+ tagName: "Application",
27864
+ id: t.id
27865
+ });
27866
+ let l = await jr(e, { applicationRef: {
27762
27867
  tagName: "Application",
27763
27868
  id: t.id
27764
27869
  } });
27765
- await W(e, {
27870
+ await qn(e, {
27766
27871
  sourceQuery: n,
27767
27872
  sourceRootRef: r,
27768
27873
  instanceRootRef: t,
27769
27874
  accepted: a,
27770
27875
  overrides: o,
27771
27876
  keepNameTypesFrom: c
27772
- }), await er(e, {
27877
+ }), await mr(e, {
27773
27878
  sourceQuery: n,
27774
27879
  satelliteRefs: p,
27775
27880
  instanceSatelliteRefs: l,
27776
27881
  structure: f,
27777
27882
  accepted: a
27778
- }), await rr(e, {
27883
+ }), await _r(e, {
27779
27884
  sourceQuery: n,
27780
27885
  primaryRef: r,
27781
27886
  instancePrimaryRef: {
@@ -27786,27 +27891,23 @@ async function br(e, t) {
27786
27891
  accepted: a
27787
27892
  });
27788
27893
  }
27789
- let m = await xr(e, {
27790
- sourceQuery: n,
27791
- applicationRef: r,
27792
- targetParent: i,
27793
- scenario: a,
27794
- report: o,
27795
- decisions: s,
27796
- keepNameTypesFrom: c
27797
- });
27798
27894
  return {
27799
- applications: u.map((e) => ({
27800
- tagName: "Application",
27801
- id: e.id
27802
- })),
27803
- functions: m
27895
+ applications: m,
27896
+ functions: await Rr(e, {
27897
+ sourceQuery: n,
27898
+ applicationRef: r,
27899
+ targetParent: i,
27900
+ scenario: a,
27901
+ report: o,
27902
+ decisions: s,
27903
+ keepNameTypesFrom: c
27904
+ })
27804
27905
  };
27805
27906
  }
27806
- async function xr(e, t) {
27807
- let { sourceQuery: n, applicationRef: r, targetParent: i, scenario: a, report: o, decisions: s, keepNameTypesFrom: c } = t, l = await Yn(n, r);
27907
+ async function Rr(e, t) {
27908
+ let { sourceQuery: n, applicationRef: r, targetParent: i, scenario: a, report: o, decisions: s, keepNameTypesFrom: c } = t, l = await lr(n, r);
27808
27909
  if (l.size === 0) return [];
27809
- let u = await Y(e, i), d = [];
27910
+ let u = await Q(e, i), d = [];
27810
27911
  for (let t of l) {
27811
27912
  let [r] = await n.any.findByAttributes({
27812
27913
  tagName: "Function",
@@ -27816,10 +27917,10 @@ async function xr(e, t) {
27816
27917
  let i = {
27817
27918
  tagName: "Function",
27818
27919
  id: r.id
27819
- }, l = await vr(e, {
27920
+ }, l = await Fr(e, {
27820
27921
  sourceQuery: n,
27821
27922
  functionRef: i,
27822
- targetParent: await U(n, i, u),
27923
+ targetParent: await Y(n, i, u),
27823
27924
  scenario: a,
27824
27925
  report: o,
27825
27926
  decisions: s,
@@ -27831,29 +27932,29 @@ async function xr(e, t) {
27831
27932
  }
27832
27933
  //#endregion
27833
27934
  //#region src/v2019C1/extensions/lifecycle/update/index.ts
27834
- var Sr = /* @__PURE__ */ c({
27835
- asd: () => br,
27836
- fsd: () => vr
27935
+ var zr = /* @__PURE__ */ l({
27936
+ asd: () => Lr,
27937
+ fsd: () => Fr
27837
27938
  });
27838
27939
  //#endregion
27839
27940
  //#region src/v2019C1/extensions/lifecycle/apply/apply.ts
27840
- async function Cr(e, t) {
27941
+ async function Br(e, t) {
27841
27942
  let { report: n, decisions: r } = t;
27842
- return r ? (qn({
27943
+ return r ? (ar({
27843
27944
  groups: n.groups,
27844
27945
  decisions: r
27845
27946
  }), {
27846
27947
  report: n,
27847
- instances: await Tr(e, t, n, r)
27948
+ instances: await Hr(e, t, n, r)
27848
27949
  }) : n.needsDecisions ? {
27849
27950
  report: n,
27850
- instances: wr(t.verb)
27951
+ instances: Vr(t.verb)
27851
27952
  } : {
27852
27953
  report: n,
27853
- instances: await Tr(e, t, n, void 0)
27954
+ instances: await Hr(e, t, n, void 0)
27854
27955
  };
27855
27956
  }
27856
- function wr(e) {
27957
+ function Vr(e) {
27857
27958
  return e === "fsd" ? {
27858
27959
  verb: "fsd",
27859
27960
  functions: []
@@ -27863,10 +27964,10 @@ function wr(e) {
27863
27964
  functions: []
27864
27965
  };
27865
27966
  }
27866
- async function Tr(e, t, n, r) {
27967
+ async function Hr(e, t, n, r) {
27867
27968
  if (t.verb === "fsd") return {
27868
27969
  verb: "fsd",
27869
- functions: await vr(e, {
27970
+ functions: await Fr(e, {
27870
27971
  sourceQuery: t.sourceQuery,
27871
27972
  functionRef: t.ref,
27872
27973
  targetParent: t.anchor,
@@ -27876,7 +27977,7 @@ async function Tr(e, t, n, r) {
27876
27977
  keepNameTypesFrom: t.keepNameTypesFrom
27877
27978
  })
27878
27979
  };
27879
- let { applications: i, functions: a } = await br(e, {
27980
+ let { applications: i, functions: a } = await Lr(e, {
27880
27981
  sourceQuery: t.sourceQuery,
27881
27982
  applicationRef: t.ref,
27882
27983
  targetParent: t.anchor,
@@ -27893,7 +27994,7 @@ async function Tr(e, t, n, r) {
27893
27994
  }
27894
27995
  //#endregion
27895
27996
  //#region src/v2019C1/extensions/lifecycle/extract/transaction/ensure-substation-structure.ts
27896
- async function Er(e) {
27997
+ async function Ur(e) {
27897
27998
  let t = await e.getRoot(), n = await e.ensureChild(t, {
27898
27999
  tagName: "Substation",
27899
28000
  attributes: { name: "TEMPLATE" }
@@ -27912,12 +28013,12 @@ async function Er(e) {
27912
28013
  }
27913
28014
  //#endregion
27914
28015
  //#region src/v2019C1/extensions/lifecycle/extract/transaction/post-extraction-cleanup.ts
27915
- async function Dr(e) {
27916
- await j.transaction.orphanUuidRefs(e), await j.transaction.resetLNode(e), await j.transaction.pruneEmptyContainers(e);
28016
+ async function Wr(e) {
28017
+ await R.transaction.orphanUuidRefs(e), await R.transaction.resetLNode(e), await R.transaction.pruneEmptyContainers(e);
27917
28018
  }
27918
28019
  //#endregion
27919
28020
  //#region src/v2019C1/extensions/lifecycle/layers/omit-filters.ts
27920
- var Or = [
28021
+ var Gr = [
27921
28022
  "FunctionSclRef",
27922
28023
  "ApplicationSclRef",
27923
28024
  "GeneralEquipment",
@@ -27925,9 +28026,9 @@ var Or = [
27925
28026
  ];
27926
28027
  //#endregion
27927
28028
  //#region src/v2019C1/extensions/lifecycle/extract/transaction/asd.ts
27928
- async function kr(e, t) {
27929
- let { sourceQuery: n, applicationRef: r, tool: i, who: a, nameStructure: o } = t, s = await Er(e), c = await e.getAttribute(r, { name: "name" }) || "Unnamed Application";
27930
- await qt.transaction.addEntry(e, {
28029
+ async function Kr(e, t) {
28030
+ let { sourceQuery: n, applicationRef: r, tool: i, who: a, nameStructure: o } = t, s = await Ur(e), c = await e.getAttribute(r, { name: "name" }) || "Unnamed Application";
28031
+ await en.transaction.addEntry(e, {
27931
28032
  filename: `ASD_${c.replace(/\s+/g, "_")}`,
27932
28033
  header: {
27933
28034
  fileType: "ASD",
@@ -27940,17 +28041,17 @@ async function kr(e, t) {
27940
28041
  what: "ASD initialization",
27941
28042
  why: "Application was extracted from a previous file"
27942
28043
  }
27943
- }), await fr(e, {
28044
+ }), await Or(e, {
27944
28045
  sourceQuery: n,
27945
28046
  applicationRef: r,
27946
28047
  structure: s,
27947
- omit: Or
27948
- }), await Dr(e);
28048
+ omit: Gr
28049
+ }), await Wr(e);
27949
28050
  }
27950
28051
  //#endregion
27951
28052
  //#region src/v2019C1/extensions/lifecycle/extract/transaction/omit.ts
27952
- var Ar = [
27953
- ...Or,
28053
+ var qr = [
28054
+ ...Gr,
27954
28055
  "DOS",
27955
28056
  "Labels",
27956
28057
  "LNodeInputs",
@@ -27962,12 +28063,12 @@ var Ar = [
27962
28063
  ];
27963
28064
  //#endregion
27964
28065
  //#region src/v2019C1/extensions/lifecycle/extract/transaction/fsd.ts
27965
- async function jr(e, t) {
27966
- let { sourceQuery: n, functionRef: r, tool: i, who: a, nameStructure: o } = t, s = await Er(e), c = {
28066
+ async function Jr(e, t) {
28067
+ let { sourceQuery: n, functionRef: r, tool: i, who: a, nameStructure: o } = t, s = await Ur(e), c = {
27967
28068
  tagName: s.Substation.tagName,
27968
28069
  id: s.Substation.id
27969
28070
  }, l = await n.getAttribute(r, { name: "name" }) || "Unnamed Function";
27970
- await qt.transaction.addEntry(e, {
28071
+ await en.transaction.addEntry(e, {
27971
28072
  filename: `FSD_${l.replace(/\s+/g, "_")}`,
27972
28073
  header: {
27973
28074
  fileType: "FSD",
@@ -27980,39 +28081,39 @@ async function jr(e, t) {
27980
28081
  what: "FSD initialization",
27981
28082
  why: "Function was extracted from a previous file"
27982
28083
  }
27983
- }), await or(e, {
28084
+ }), await br(e, {
27984
28085
  sourceQuery: n,
27985
28086
  functionRef: r,
27986
28087
  targetParentRef: c,
27987
- omit: Ar,
28088
+ omit: qr,
27988
28089
  stripRootAttributes: ["templateUuid"]
27989
- }), await X(e, {
28090
+ }), await xr(e, {
27990
28091
  sourceQuery: n,
27991
28092
  functionRef: r,
27992
28093
  structure: s
27993
- }), await Dr(e);
28094
+ }), await Wr(e);
27994
28095
  }
27995
28096
  //#endregion
27996
28097
  //#region src/v2019C1/extensions/lifecycle/extract/index.ts
27997
- var Mr = /* @__PURE__ */ c({
27998
- asd: () => kr,
27999
- ensureSubstationTemplateStructure: () => Er,
28000
- fsd: () => jr
28001
- }), Nr = /* @__PURE__ */ c({
28002
- asd: () => gr,
28003
- fsd: () => dr,
28004
- resolveTargetStructure: () => Y
28098
+ var Yr = /* @__PURE__ */ l({
28099
+ asd: () => Kr,
28100
+ ensureSubstationTemplateStructure: () => Ur,
28101
+ fsd: () => Jr
28102
+ }), Xr = /* @__PURE__ */ l({
28103
+ asd: () => Nr,
28104
+ fsd: () => Dr,
28105
+ resolveTargetStructure: () => Q
28005
28106
  });
28006
28107
  //#endregion
28007
28108
  //#region src/v2019C1/extensions/lifecycle/report/mark-placement-conflicts.ts
28008
- async function Pr(e, t, n) {
28109
+ async function Zr(e, t, n) {
28009
28110
  if (t.scenario === "instantiate") for (let r of n.groups) {
28010
28111
  if (r.change !== "added") continue;
28011
28112
  let i = r.primary.sourceRef;
28012
28113
  if (!i) continue;
28013
28114
  let a = await t.sourceQuery.getAttributes(i), o = a.uuid;
28014
28115
  if (!o) continue;
28015
- let s = r.primary.tagName, [c] = await q(e, {
28116
+ let s = r.primary.tagName, [c] = await X(e, {
28016
28117
  tagName: s,
28017
28118
  sourceUuid: o
28018
28119
  });
@@ -28025,7 +28126,7 @@ async function Pr(e, t, n) {
28025
28126
  let n = {
28026
28127
  tagName: t.tagName,
28027
28128
  id: t.id
28028
- }, r = await R(e, {
28129
+ }, r = await W(e, {
28029
28130
  parentRef: n,
28030
28131
  childTag: s,
28031
28132
  candidate: a
@@ -28036,9 +28137,9 @@ async function Pr(e, t, n) {
28036
28137
  }
28037
28138
  }
28038
28139
  if (!d || !u) continue;
28039
- let f = d.fields.find((e) => bn(L(s, e)));
28140
+ let f = d.fields.find((e) => kn(U(s, e)));
28040
28141
  if (f) {
28041
- let t = await kn(e, {
28142
+ let t = await zn(e, {
28042
28143
  parentRef: u,
28043
28144
  childTag: s,
28044
28145
  candidate: a,
@@ -28053,29 +28154,31 @@ async function Pr(e, t, n) {
28053
28154
  }
28054
28155
  //#endregion
28055
28156
  //#region src/v2019C1/extensions/lifecycle/report/query/satellite-companions.ts
28056
- async function Fr(e, t) {
28057
- let { sourceQuery: n, primaryRef: r, satelliteRefs: i, instanceSatelliteRefs: a, report: o } = t, s = o.groups.find((e) => e.primary.sourceRef?.id === r.id);
28058
- if (!s) return o;
28157
+ async function Qr(e, t) {
28158
+ 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);
28059
28159
  for (let t of i) {
28060
- let { uuid: r } = await n.any.getAttributes(t), i = await sn({
28160
+ let { uuid: r } = await n.any.getAttributes(t), i = await mn({
28061
28161
  sourceQuery: n,
28062
28162
  targetQuery: e,
28063
28163
  sourceRootRef: t,
28064
- instanceRootRef: await $n(e, {
28164
+ instanceRootRef: await pr(e, {
28065
28165
  tagName: t.tagName,
28066
28166
  sourceUuid: r
28067
28167
  })
28068
28168
  });
28069
- i.root.change !== "unchanged" && s.companions.push(i.root);
28169
+ i.summary.added + i.summary.removed + i.summary.modified > 0 && (c ? (i.root.change !== "unchanged" && c.companions.push(i.root), ln({
28170
+ node: i.root,
28171
+ out: c.companions
28172
+ })) : (o.groups.push(...sn(i.root, s)), o.needsDecisions = !0));
28070
28173
  }
28071
- for (let t of a ?? []) {
28174
+ if (c) for (let t of a ?? []) {
28072
28175
  let { templateUuid: r } = await e.any.getAttributes(t);
28073
28176
  if (!r) continue;
28074
28177
  let [i] = await n.any.findByAttributes({
28075
28178
  tagName: t.tagName,
28076
28179
  attributes: { uuid: r }
28077
28180
  });
28078
- i || s.companions.push({
28181
+ i || c.companions.push({
28079
28182
  change: "removed",
28080
28183
  tagName: t.tagName,
28081
28184
  instanceRef: t,
@@ -28086,46 +28189,48 @@ async function Fr(e, t) {
28086
28189
  }
28087
28190
  //#endregion
28088
28191
  //#region src/v2019C1/extensions/lifecycle/report/query/cross-cutting-satellites.ts
28089
- async function Ir(e, t) {
28192
+ async function $r(e, t) {
28090
28193
  let { sourceQuery: n, primaryRef: r, instancePrimaryRef: i, report: a } = t;
28091
- return Fr(e, {
28194
+ return Qr(e, {
28092
28195
  sourceQuery: n,
28093
28196
  primaryRef: r,
28094
- satelliteRefs: await J(n, { primaryRef: r }),
28095
- instanceSatelliteRefs: i ? await J(e, { primaryRef: i }) : [],
28096
- report: a
28197
+ satelliteRefs: await Z(n, { primaryRef: r }),
28198
+ instanceSatelliteRefs: i ? await Z(e, { primaryRef: i }) : [],
28199
+ report: a,
28200
+ instanceScopeId: i?.id
28097
28201
  });
28098
28202
  }
28099
28203
  //#endregion
28100
28204
  //#region src/v2019C1/extensions/lifecycle/report/query/report-function-satellites.ts
28101
- async function Lr(e, t) {
28205
+ async function ei(e, t) {
28102
28206
  let { sourceQuery: n, functionRef: r, instance: i, report: a } = t;
28103
- return Fr(e, {
28207
+ return Qr(e, {
28104
28208
  sourceQuery: n,
28105
28209
  primaryRef: r,
28106
- satelliteRefs: await Z(n, { primaryRef: r }),
28107
- instanceSatelliteRefs: i ? await Z(e, { primaryRef: {
28210
+ satelliteRefs: await Er(n, { primaryRef: r }),
28211
+ instanceSatelliteRefs: i ? await Er(e, { primaryRef: {
28108
28212
  tagName: "Function",
28109
28213
  id: i.id
28110
28214
  } }) : [],
28111
- report: a
28215
+ report: a,
28216
+ instanceScopeId: i?.id
28112
28217
  });
28113
28218
  }
28114
28219
  //#endregion
28115
28220
  //#region src/v2019C1/extensions/lifecycle/report/query/report-function.ts
28116
- async function Rr(e, t) {
28117
- let { sourceQuery: n, functionRef: r, instance: i } = t, a = await Lr(e, {
28221
+ async function ti(e, t) {
28222
+ let { sourceQuery: n, functionRef: r, instance: i } = t, a = await ei(e, {
28118
28223
  sourceQuery: n,
28119
28224
  functionRef: r,
28120
28225
  instance: i,
28121
- report: await sn({
28226
+ report: await mn({
28122
28227
  sourceQuery: n,
28123
28228
  targetQuery: e,
28124
28229
  sourceRootRef: r,
28125
28230
  instanceRootRef: i
28126
28231
  })
28127
28232
  });
28128
- return Ir(e, {
28233
+ return $r(e, {
28129
28234
  sourceQuery: n,
28130
28235
  primaryRef: r,
28131
28236
  instancePrimaryRef: i ? {
@@ -28137,7 +28242,7 @@ async function Rr(e, t) {
28137
28242
  }
28138
28243
  //#endregion
28139
28244
  //#region src/v2019C1/extensions/presentation/constants/title.ts
28140
- var zr = {
28245
+ var ni = {
28141
28246
  LNode: {
28142
28247
  compact: [
28143
28248
  "prefix",
@@ -28183,10 +28288,19 @@ var zr = {
28183
28288
  compact: ["version", "revision"],
28184
28289
  separator: "."
28185
28290
  },
28186
- ControlRef: { compact: "{output}[{outputInst}]/{pLN}.{pDO}/{controlled}" },
28291
+ ControlRef: {
28292
+ compact: [{
28293
+ whenPresent: "controlled",
28294
+ template: "{output}[{outputInst}]/{controlled}"
28295
+ }, { template: "{output}[{outputInst}]/{pLN}.{pDO}" }],
28296
+ full: "{output}[{outputInst}]/{pLN}.{pDO}/{controlled}"
28297
+ },
28187
28298
  SourceRef: {
28188
- compact: "{pLN}.{pDO}.{pDA}",
28189
- full: "{service}/Input[{inputInst}]/{pLN}.{pDO}.{pDA}/{source}"
28299
+ compact: [{
28300
+ whenPresent: "source",
28301
+ template: "{service}/{input}[{inputInst}]/{source}"
28302
+ }, { template: "{service}/{input}[{inputInst}]/{pLN}.{pDO}.{pDA}" }],
28303
+ full: "{service}/{input}[{inputInst}]/{pLN}.{pDO}.{pDA}/{source}"
28190
28304
  },
28191
28305
  FunctionCatRef: { compact: ["function"] },
28192
28306
  FunctionRef: { compact: ["function"] },
@@ -28225,44 +28339,44 @@ var zr = {
28225
28339
  };
28226
28340
  //#endregion
28227
28341
  //#region src/v2019C1/extensions/presentation/query/extract-element-title.ts
28228
- async function $(e, t, n = {}) {
28342
+ async function ri(e, t, n = {}) {
28229
28343
  let r = await e.getRecord(t);
28230
28344
  if (!r) return n.withLabels ? {
28231
28345
  title: "",
28232
28346
  labels: {}
28233
28347
  } : "";
28234
- let i = r.tagName, a = n.mode ?? "compact", o = await e.any.getAttributes(r), s = zr[i], c = Br({
28348
+ let i = r.tagName, a = n.mode ?? "compact", o = await e.any.getAttributes(r), s = ni[i], c = ii({
28235
28349
  tag: i,
28236
28350
  spec: s,
28237
28351
  mode: a,
28238
28352
  attributes: o,
28239
- specAttributes: s?.attributesFrom ? await Vr(e, r, s.attributesFrom) : o,
28353
+ specAttributes: s?.attributesFrom ? await ai(e, r, s.attributesFrom) : o,
28240
28354
  value: r.value
28241
28355
  });
28242
28356
  return n.withLabels ? {
28243
28357
  title: c,
28244
- labels: await Hr(e, r)
28358
+ labels: await oi(e, r)
28245
28359
  } : c;
28246
28360
  }
28247
- function Br(e) {
28361
+ function ii(e) {
28248
28362
  let { tag: t, spec: n, mode: r, attributes: i, specAttributes: a, value: o } = e;
28249
28363
  if (n) {
28250
- let e = Gr(n, a, r);
28364
+ let e = li(n, a, r);
28251
28365
  if (e) return e;
28252
28366
  }
28253
28367
  let s = (o ?? "").trim();
28254
28368
  if (s) return s;
28255
- let c = g[t]?.attributes?.identityFields, l = c?.find((e) => e === "name" || e === "id") ?? c?.[0];
28369
+ let c = _[t]?.attributes?.identityFields, l = c?.find((e) => e === "name" || e === "id") ?? c?.[0];
28256
28370
  return l && i[l] ? i[l] : i.name || t;
28257
28371
  }
28258
- async function Vr(e, t, n) {
28372
+ async function ai(e, t, n) {
28259
28373
  let [r] = await e.any.getChildren(t, n);
28260
28374
  return r ? e.any.getAttributes(r) : {};
28261
28375
  }
28262
- async function Hr(e, t) {
28263
- return Wr(await Ur(e, t));
28376
+ async function oi(e, t) {
28377
+ return ci(await si(e, t));
28264
28378
  }
28265
- async function Ur(e, t) {
28379
+ async function si(e, t) {
28266
28380
  let n = [], r = await e.any.getChildren(t, "Labels");
28267
28381
  for (let t of r) {
28268
28382
  let r = await e.any.getChildren(t, "Label");
@@ -28277,64 +28391,76 @@ async function Ur(e, t) {
28277
28391
  }
28278
28392
  return n;
28279
28393
  }
28280
- function Wr(e) {
28394
+ function ci(e) {
28281
28395
  let t = {};
28282
28396
  for (let { lang: n, id: r, text: i } of e) (t[n] ??= {})[r] = i;
28283
28397
  return t;
28284
28398
  }
28285
- function Gr(e, t, n) {
28399
+ function li(e, t, n) {
28286
28400
  let r = n === "full" && e.full !== void 0, i = r ? e.full : e.compact, a = r ? e.fullSeparator ?? e.separator ?? "" : e.separator ?? "";
28287
- if (typeof i == "string") return Kr(i, t);
28401
+ if (typeof i == "string") return di(i, t);
28402
+ if (ui(i)) {
28403
+ for (let e of i) {
28404
+ if (e.whenPresent && !t[e.whenPresent]) continue;
28405
+ let n = di(e.template, t);
28406
+ if (n) return n;
28407
+ }
28408
+ return "";
28409
+ }
28288
28410
  let o = i.map((e) => t[e]).filter(Boolean);
28289
28411
  return o.length > 0 ? o.join(a) : "";
28290
28412
  }
28291
- function Kr(e, t) {
28413
+ function ui(e) {
28414
+ return typeof e[0] == "object";
28415
+ }
28416
+ function di(e, t) {
28292
28417
  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("/");
28293
28418
  }
28294
28419
  //#endregion
28295
28420
  //#region src/v2019C1/extensions/presentation/query/index.ts
28296
- var qr = /* @__PURE__ */ c({ extractElementTitle: () => $ });
28421
+ var fi = /* @__PURE__ */ l({ extractElementTitle: () => ri });
28297
28422
  //#endregion
28298
28423
  //#region src/v2019C1/extensions/lifecycle/report/query/report-asd.ts
28299
- async function Jr(e, t) {
28300
- let { sourceQuery: n, applicationRef: r, scenario: i } = t, { uuid: a } = await n.getAttributes(r), o = i === "instantiate" ? [] : await q(e, {
28424
+ async function pi(e, t) {
28425
+ let { sourceQuery: n, applicationRef: r, scenario: i } = t, { uuid: a } = await n.getAttributes(r), o = i === "instantiate" ? [] : await X(e, {
28301
28426
  tagName: "Application",
28302
28427
  sourceUuid: a
28303
28428
  }), s = [];
28304
- if (o.length === 0) s.push(await Yr(e, {
28429
+ if (o.length === 0) s.push(await mi(e, {
28305
28430
  sourceQuery: n,
28306
28431
  applicationRef: r,
28307
28432
  instance: void 0
28308
28433
  }));
28309
- else for (let t of o) s.push(await Yr(e, {
28434
+ else for (let t of o) s.push(await mi(e, {
28310
28435
  sourceQuery: n,
28311
28436
  applicationRef: r,
28312
28437
  instance: t
28313
28438
  }));
28314
- let c = await Xr(e, {
28439
+ let c = await hi(e, {
28315
28440
  sourceQuery: n,
28316
28441
  applicationRef: r,
28317
28442
  scenario: i
28318
28443
  });
28319
- return mn([...s, ...c]);
28444
+ return Cn([...s, ...c]);
28320
28445
  }
28321
- async function Yr(e, t) {
28322
- let { sourceQuery: n, applicationRef: r, instance: i } = t, a = await sn({
28446
+ async function mi(e, t) {
28447
+ let { sourceQuery: n, applicationRef: r, instance: i } = t, a = await mn({
28323
28448
  sourceQuery: n,
28324
28449
  targetQuery: e,
28325
28450
  sourceRootRef: r,
28326
28451
  instanceRootRef: i
28327
28452
  });
28328
- if (await Fr(e, {
28453
+ if (await Qr(e, {
28329
28454
  sourceQuery: n,
28330
28455
  primaryRef: r,
28331
- satelliteRefs: await Q(n, { applicationRef: r }),
28332
- instanceSatelliteRefs: i ? await Q(e, { applicationRef: {
28456
+ satelliteRefs: await jr(n, { applicationRef: r }),
28457
+ instanceSatelliteRefs: i ? await jr(e, { applicationRef: {
28333
28458
  tagName: "Application",
28334
28459
  id: i.id
28335
28460
  } }) : [],
28336
- report: a
28337
- }), await Ir(e, {
28461
+ report: a,
28462
+ instanceScopeId: i?.id
28463
+ }), await $r(e, {
28338
28464
  sourceQuery: n,
28339
28465
  primaryRef: r,
28340
28466
  instancePrimaryRef: i ? {
@@ -28343,13 +28469,13 @@ async function Yr(e, t) {
28343
28469
  } : void 0,
28344
28470
  report: a
28345
28471
  }), i) {
28346
- let t = await $(e, i);
28472
+ let t = await ri(e, i);
28347
28473
  for (let e of a.groups) e.instanceScopeTitle = t;
28348
28474
  }
28349
28475
  return a;
28350
28476
  }
28351
- async function Xr(e, t) {
28352
- let { sourceQuery: n, applicationRef: r, scenario: i } = t, a = await Yn(n, r), o = [];
28477
+ async function hi(e, t) {
28478
+ let { sourceQuery: n, applicationRef: r, scenario: i } = t, a = await lr(n, r), o = [];
28353
28479
  for (let t of a) {
28354
28480
  let [r] = await n.any.findByAttributes({
28355
28481
  tagName: "Function",
@@ -28359,12 +28485,12 @@ async function Xr(e, t) {
28359
28485
  let a = {
28360
28486
  tagName: "Function",
28361
28487
  id: r.id
28362
- }, s = i === "instantiate" ? [] : await q(e, {
28488
+ }, s = i === "instantiate" ? [] : await X(e, {
28363
28489
  tagName: "Function",
28364
28490
  sourceUuid: t
28365
28491
  });
28366
28492
  if (s.length === 0) {
28367
- o.push(await Rr(e, {
28493
+ o.push(await ti(e, {
28368
28494
  sourceQuery: n,
28369
28495
  functionRef: a,
28370
28496
  instance: void 0
@@ -28372,11 +28498,11 @@ async function Xr(e, t) {
28372
28498
  continue;
28373
28499
  }
28374
28500
  for (let t of s) {
28375
- let r = await Rr(e, {
28501
+ let r = await ti(e, {
28376
28502
  sourceQuery: n,
28377
28503
  functionRef: a,
28378
28504
  instance: t
28379
- }), i = await $(e, t);
28505
+ }), i = await ri(e, t);
28380
28506
  for (let e of r.groups) e.instanceScopeTitle = i;
28381
28507
  o.push(r);
28382
28508
  }
@@ -28385,48 +28511,61 @@ async function Xr(e, t) {
28385
28511
  }
28386
28512
  //#endregion
28387
28513
  //#region src/v2019C1/extensions/lifecycle/report/query/report-fsd.ts
28388
- async function Zr(e, t) {
28389
- let { sourceQuery: n, functionRef: r, targetParent: i, scenario: a } = t, { uuid: o } = await n.getAttributes(r), s = a === "instantiate" ? [] : await Zn(e, {
28514
+ async function gi(e, t) {
28515
+ let { sourceQuery: n, functionRef: r, targetParent: i, scenario: a } = t, { uuid: o } = await n.getAttributes(r), s = a === "instantiate" ? [] : await dr(e, {
28390
28516
  targetParent: i,
28391
28517
  tagName: "Function",
28392
28518
  sourceUuid: o
28393
28519
  });
28394
- if (s.length === 0) return Rr(e, {
28520
+ if (s.length === 0) return ti(e, {
28395
28521
  sourceQuery: n,
28396
28522
  functionRef: r,
28397
28523
  instance: void 0
28398
28524
  });
28399
28525
  let c = [];
28400
28526
  for (let t of s) {
28401
- let i = await Rr(e, {
28527
+ let i = await ti(e, {
28402
28528
  sourceQuery: n,
28403
28529
  functionRef: r,
28404
28530
  instance: t
28405
- }), a = await $(e, t);
28531
+ }), a = await ri(e, t);
28406
28532
  for (let e of i.groups) e.instanceScopeTitle = a;
28407
28533
  c.push(i);
28408
28534
  }
28409
- return mn(c);
28535
+ return Cn(c);
28410
28536
  }
28411
28537
  //#endregion
28412
28538
  //#region src/v2019C1/extensions/lifecycle/report/report.ts
28413
- async function Qr(e, t) {
28414
- let n = t.verb === "fsd" ? await Zr(e, {
28539
+ async function _i(e, t) {
28540
+ let n = t.verb === "fsd" ? await gi(e, {
28415
28541
  sourceQuery: t.sourceQuery,
28416
28542
  functionRef: t.ref,
28417
28543
  targetParent: t.anchor,
28418
28544
  scenario: t.scenario
28419
- }) : await Jr(e, {
28545
+ }) : await pi(e, {
28420
28546
  sourceQuery: t.sourceQuery,
28421
28547
  applicationRef: t.ref,
28422
28548
  scenario: t.scenario
28423
28549
  });
28424
- for (let e of n.groups) e.editableAttributes = xn(e.primary.tagName);
28425
- return await Pr(e, t, n), n;
28550
+ for (let e of n.groups) e.editableAttributes = vi(An(e.primary.tagName), e.primary.attributeChanges);
28551
+ return await Zr(e, t, n), n;
28552
+ }
28553
+ function vi(e, t) {
28554
+ if (!t?.length) return e;
28555
+ let n = new Map(t.map((e) => [e.name, e]));
28556
+ return e.map((e) => {
28557
+ let t = n.get(e.attr);
28558
+ return t ? {
28559
+ ...e,
28560
+ before: t.before,
28561
+ after: t.after,
28562
+ changed: !0
28563
+ } : e;
28564
+ }).sort((e, t) => Number(t.changed ?? !1) - Number(e.changed ?? !1));
28426
28565
  }
28427
28566
  //#endregion
28428
28567
  //#region src/v2019C1/extensions/lifecycle/report/presentation-scope.ts
28429
- function $r(e) {
28568
+ function yi(e) {
28430
28569
  switch (e.verb) {
28431
28570
  case "fsd":
28432
28571
  case "asd": return {
@@ -28438,65 +28577,65 @@ function $r(e) {
28438
28577
  }
28439
28578
  //#endregion
28440
28579
  //#region src/v2019C1/extensions/index.ts
28441
- var ei = {
28442
- cleanUp: j,
28443
- dataModel: Ht,
28444
- history: qt,
28445
- identity: Qt,
28580
+ var bi = {
28581
+ cleanUp: R,
28582
+ dataModel: Yt,
28583
+ history: en,
28584
+ identity: on,
28446
28585
  lifecycle: {
28447
- query: { report: Qr },
28586
+ query: { report: _i },
28448
28587
  transaction: {
28449
- extract: Mr,
28450
- instantiate: Nr,
28451
- transplant: { deep: H },
28452
- update: Sr,
28453
- apply: Cr
28588
+ extract: Yr,
28589
+ instantiate: Xr,
28590
+ transplant: { deep: J },
28591
+ update: zr,
28592
+ apply: Br
28454
28593
  }
28455
28594
  },
28456
- reference: A,
28457
- signature: { query: Ot },
28458
- presentation: { query: qr }
28595
+ reference: L,
28596
+ signature: { query: Ft },
28597
+ presentation: { query: fi }
28459
28598
  };
28460
28599
  //#endregion
28461
28600
  //#region src/v2019C1/hooks/after-created/private-wrapper.ts
28462
- async function ti(e) {
28601
+ async function xi(e) {
28463
28602
  let { childRecord: t, parentRecord: n, query: r } = e;
28464
- if (t.namespace.prefix === b.namespaces.default.prefix) return [];
28465
- let i = n.tagName === "Private", a = n.namespace.prefix === b.namespaces.default.prefix;
28603
+ if (t.namespace.prefix === x.namespaces.default.prefix) return [];
28604
+ let i = n.tagName === "Private", a = n.namespace.prefix === x.namespaces.default.prefix;
28466
28605
  if (!i && !a) return [];
28467
28606
  let o = n.children.find((e) => e.tagName === "Private"), s = {
28468
28607
  ...n,
28469
28608
  children: n.children.filter((e) => e.id !== t.id)
28470
28609
  };
28471
- return i ? ni({
28610
+ return i ? Si({
28472
28611
  parentRecord: n,
28473
28612
  childRecord: t,
28474
28613
  query: r
28475
- }) : o ? ri({
28614
+ }) : o ? Ci({
28476
28615
  existingPrivateRef: o,
28477
28616
  parentRecord: n,
28478
28617
  updatedParentRecord: s,
28479
28618
  childRecord: t,
28480
28619
  query: r
28481
- }) : (await r.findAncestors(n)).some((e) => e.tagName === "Private" && e.attributes.some((e) => e.name === "type" && e.value === t.namespace.prefix)) ? [] : ii({
28620
+ }) : (await r.findAncestors(n)).some((e) => e.tagName === "Private" && e.attributes.some((e) => e.name === "type" && e.value === t.namespace.prefix)) ? [] : wi({
28482
28621
  parentRecord: n,
28483
28622
  updatedParentRecord: s,
28484
28623
  childRecord: t
28485
28624
  });
28486
28625
  }
28487
- async function ni(e) {
28626
+ async function Si(e) {
28488
28627
  let { parentRecord: t, childRecord: n, query: r } = e, a = t;
28489
28628
  if (n.parent?.id === a.id && n.parent?.tagName === "Private") return [];
28490
- let s = await ai({
28629
+ let o = await Ti({
28491
28630
  privateId: a.id,
28492
28631
  query: r
28493
28632
  });
28494
- o(s, {
28633
+ s(o, {
28495
28634
  detail: "Latest private record not found",
28496
28635
  key: "ELEMENT_NOT_FOUND"
28497
28636
  });
28498
- let { childRecord: c, privateRecord: l } = oi({
28499
- privateRecord: s,
28637
+ let { childRecord: c, privateRecord: l } = Ei({
28638
+ privateRecord: o,
28500
28639
  childRecord: n
28501
28640
  });
28502
28641
  return [{
@@ -28505,20 +28644,20 @@ async function ni(e) {
28505
28644
  newRecord: i(c)
28506
28645
  }, {
28507
28646
  status: "updated",
28508
- oldRecord: i(s),
28647
+ oldRecord: i(o),
28509
28648
  newRecord: i(l)
28510
28649
  }];
28511
28650
  }
28512
- async function ri(e) {
28513
- let { existingPrivateRef: t, parentRecord: n, updatedParentRecord: r, childRecord: a, query: s } = e, c = await ai({
28651
+ async function Ci(e) {
28652
+ let { existingPrivateRef: t, parentRecord: n, updatedParentRecord: r, childRecord: a, query: o } = e, c = await Ti({
28514
28653
  privateId: t.id,
28515
- query: s
28654
+ query: o
28516
28655
  });
28517
- if (o(c, {
28656
+ if (s(c, {
28518
28657
  detail: "Latest private record not found",
28519
28658
  key: "ELEMENT_NOT_FOUND"
28520
28659
  }), !c.attributes.some((e) => e.name === "type" && e.value === a.namespace.prefix)) return [];
28521
- let { childRecord: l, privateRecord: u } = oi({
28660
+ let { childRecord: l, privateRecord: u } = Ei({
28522
28661
  privateRecord: c,
28523
28662
  childRecord: a
28524
28663
  });
@@ -28540,11 +28679,11 @@ async function ri(e) {
28540
28679
  }
28541
28680
  ];
28542
28681
  }
28543
- function ii(e) {
28682
+ function wi(e) {
28544
28683
  let { parentRecord: t, updatedParentRecord: n, childRecord: r } = e, a = {
28545
28684
  id: crypto.randomUUID(),
28546
28685
  tagName: "Private",
28547
- namespace: b.namespaces.default,
28686
+ namespace: x.namespaces.default,
28548
28687
  attributes: [{
28549
28688
  name: "type",
28550
28689
  value: r.namespace.prefix
@@ -28589,14 +28728,14 @@ function ii(e) {
28589
28728
  }
28590
28729
  ];
28591
28730
  }
28592
- async function ai(e) {
28731
+ async function Ti(e) {
28593
28732
  let { privateId: t, query: n } = e;
28594
28733
  return await n.getRecord({
28595
28734
  id: t,
28596
28735
  tagName: "Private"
28597
28736
  });
28598
28737
  }
28599
- function oi(e) {
28738
+ function Ei(e) {
28600
28739
  let { privateRecord: t, childRecord: n } = e;
28601
28740
  return {
28602
28741
  childRecord: {
@@ -28617,16 +28756,16 @@ function oi(e) {
28617
28756
  }
28618
28757
  //#endregion
28619
28758
  //#region src/v2019C1/hooks/shared/ref-entry-ops.ts
28620
- async function si(e) {
28759
+ async function Di(e) {
28621
28760
  let { uuid: t, entry: r, target: a, query: o } = e;
28622
- if (!n(r.refTagName, b)) return [];
28761
+ if (!n(r.refTagName, x)) return [];
28623
28762
  let s = await o.getRecordsByTagName(r.refTagName), c = [];
28624
28763
  for (let e of s) {
28625
28764
  if (e.attributes.find((e) => e.name === r.uuidAttr)?.value !== t) continue;
28626
28765
  let n = {
28627
28766
  tagName: e.tagName,
28628
28767
  id: e.id
28629
- }, s = await A.query.buildReferencePath(o, {
28768
+ }, s = await L.query.buildReferencePath(o, {
28630
28769
  reference: n,
28631
28770
  target: a
28632
28771
  });
@@ -28646,32 +28785,193 @@ async function si(e) {
28646
28785
  }
28647
28786
  return c;
28648
28787
  }
28649
- function ci(e) {
28788
+ function Oi(e) {
28650
28789
  let t = [];
28651
- for (let n of He) {
28652
- let r = Be[n]?.get(e);
28790
+ for (let n of Me) {
28791
+ let r = Ae[n]?.get(e);
28653
28792
  r && t.push(...r);
28654
28793
  }
28655
28794
  return t;
28656
28795
  }
28657
28796
  //#endregion
28797
+ //#region src/v2019C1/hooks/shared/record-ops.ts
28798
+ function ki(e, t) {
28799
+ return {
28800
+ status: "updated",
28801
+ oldRecord: e,
28802
+ newRecord: {
28803
+ ...e,
28804
+ attributes: t
28805
+ }
28806
+ };
28807
+ }
28808
+ function Ai(e, t, n) {
28809
+ return e.some((e) => e.name === t) ? e.map((e) => e.name === t ? {
28810
+ ...e,
28811
+ value: n
28812
+ } : e) : [...e, {
28813
+ name: t,
28814
+ value: n
28815
+ }];
28816
+ }
28817
+ //#endregion
28818
+ //#region src/v2019C1/hooks/shared/mapped-name.ts
28819
+ async function ji(e, t) {
28820
+ let n = N.get(t.tagName);
28821
+ if (!n || !t.attributes.find((e) => e.name === n.uuid)?.value) return null;
28822
+ let r = await ze(e, t);
28823
+ return r === t.attributes.find((e) => e.name === n.path)?.value ? null : ki(t, r === void 0 ? t.attributes.filter((e) => e.name !== n.path) : Ai(t.attributes, n.path, r));
28824
+ }
28825
+ //#endregion
28826
+ //#region src/v2019C1/hooks/shared/ref-path-rebuild.ts
28827
+ async function Mi(e) {
28828
+ let { oldRecord: t, newRecord: n, query: r } = e;
28829
+ if (N.has(n.tagName)) return [];
28830
+ let i = O[n.tagName];
28831
+ if (!i) return [];
28832
+ let a = [];
28833
+ for (let e of i) {
28834
+ if (e.resolution === j.unsupported || !Ni(t, n, e)) continue;
28835
+ let i = await Pi({
28836
+ newRecord: n,
28837
+ pair: e,
28838
+ query: r
28839
+ });
28840
+ i && a.push(i);
28841
+ }
28842
+ return a;
28843
+ }
28844
+ function Ni(e, t, n) {
28845
+ return [n.attribute.uuid, ...n.companions.map((e) => e.name)].some((n) => $(e, n) !== $(t, n));
28846
+ }
28847
+ async function Pi(e) {
28848
+ let { newRecord: t, pair: n, query: r } = e, i = $(t, n.attribute.uuid);
28849
+ if (!i) return null;
28850
+ let a = await Fi({
28851
+ uuidValue: i,
28852
+ targetTagNames: n.target,
28853
+ query: r
28854
+ });
28855
+ if (!a) return null;
28856
+ let o = await Ce(r, {
28857
+ reference: {
28858
+ tagName: t.tagName,
28859
+ id: t.id
28860
+ },
28861
+ target: a
28862
+ });
28863
+ return !o || $(t, n.attribute.path) === o ? null : ki(t, Ai(t.attributes, n.attribute.path, o));
28864
+ }
28865
+ async function Fi(e) {
28866
+ let { uuidValue: t, targetTagNames: r, query: i } = e;
28867
+ for (let e of r) {
28868
+ if (!n(e, x)) continue;
28869
+ let r = (await i.getRecordsByTagName(e)).find((e) => e.attributes.find((e) => e.name === "uuid")?.value === t);
28870
+ if (r) return {
28871
+ tagName: r.tagName,
28872
+ id: r.id
28873
+ };
28874
+ }
28875
+ return null;
28876
+ }
28877
+ function $(e, t) {
28878
+ return e.attributes.find((e) => e.name === t)?.value;
28879
+ }
28880
+ //#endregion
28881
+ //#region src/v2019C1/hooks/shared/lnode-binding.ts
28882
+ var Ii = "None";
28883
+ async function Li(e) {
28884
+ let { oldRecord: t, newRecord: n, query: r } = e;
28885
+ if (n.tagName !== "LNode") return null;
28886
+ let i = Hi(t, "lnUuid"), a = Hi(n, "lnUuid");
28887
+ if (i === a) return null;
28888
+ let o = a ? await Ri(r, a) : await zi(r, n);
28889
+ return o ? Vi(n, o) : null;
28890
+ }
28891
+ async function Ri(e, t) {
28892
+ let n = await Bi(e, t);
28893
+ if (!n) return null;
28894
+ 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({
28895
+ tagName: "LDevice",
28896
+ id: a.id
28897
+ }) : void 0;
28898
+ return {
28899
+ iedName: (o ? await e.getAttributes({
28900
+ tagName: "IED",
28901
+ id: o.id
28902
+ }) : void 0)?.name,
28903
+ ldInst: s?.inst,
28904
+ prefix: r.prefix,
28905
+ lnClass: r.lnClass,
28906
+ lnInst: r.inst
28907
+ };
28908
+ }
28909
+ async function zi(e, t) {
28910
+ let n = {
28911
+ iedName: Ii,
28912
+ ldInst: void 0
28913
+ }, r = await e.getChild({
28914
+ tagName: "LNode",
28915
+ id: t.id
28916
+ }, "LNodeSpecNaming");
28917
+ if (!r) return n;
28918
+ let i = await e.getAttributes(r);
28919
+ return {
28920
+ ...n,
28921
+ prefix: i.sPrefix,
28922
+ lnClass: i.sLnClass,
28923
+ lnInst: i.sLnInst
28924
+ };
28925
+ }
28926
+ async function Bi(e, t) {
28927
+ for (let r of ["LN", "LN0"]) {
28928
+ if (!n(r, x)) continue;
28929
+ let i = (await e.getRecordsByTagName(r)).find((e) => e.attributes.find((e) => e.name === "uuid")?.value === t);
28930
+ if (i) return {
28931
+ tagName: i.tagName,
28932
+ id: i.id
28933
+ };
28934
+ }
28935
+ return null;
28936
+ }
28937
+ function Vi(e, t) {
28938
+ let n = [...e.attributes], r = !1;
28939
+ for (let [e, i] of Object.entries(t)) {
28940
+ let t = n.find((t) => t.name === e)?.value;
28941
+ if (i === void 0) {
28942
+ if (t === void 0) continue;
28943
+ n = n.filter((t) => t.name !== e), r = !0;
28944
+ continue;
28945
+ }
28946
+ t !== i && (n = Ai(n, e, i), r = !0);
28947
+ }
28948
+ return r ? ki(e, n) : null;
28949
+ }
28950
+ function Hi(e, t) {
28951
+ return e.attributes.find((e) => e.name === t)?.value;
28952
+ }
28953
+ //#endregion
28658
28954
  //#region src/v2019C1/hooks/after-created/ref-paths.ts
28659
- async function li(e) {
28660
- let { childRecord: t, query: n } = e, r = await ui({
28955
+ async function Ui(e) {
28956
+ let { childRecord: t, query: n } = e, r = await Wi({
28661
28957
  childRecord: t,
28662
28958
  query: n
28663
- }), i = await pi({
28959
+ }), i = await qi({
28664
28960
  childRecord: t,
28665
28961
  query: n
28666
- });
28667
- return [...r, ...i];
28962
+ }), a = await ji(n, o(t)), s = a ? [a] : [];
28963
+ return [
28964
+ ...r,
28965
+ ...i,
28966
+ ...s
28967
+ ];
28668
28968
  }
28669
- async function ui(e) {
28670
- let { childRecord: t, query: n } = e, r = Ue.get(t.tagName);
28969
+ async function Wi(e) {
28970
+ let { childRecord: t, query: n } = e, r = Ne.get(t.tagName);
28671
28971
  if (!r?.length) return [];
28672
28972
  let i = [];
28673
28973
  for (let e of r) {
28674
- let r = await di({
28974
+ let r = await Gi({
28675
28975
  childRecord: t,
28676
28976
  pair: e,
28677
28977
  query: n
@@ -28680,16 +28980,16 @@ async function ui(e) {
28680
28980
  }
28681
28981
  return i;
28682
28982
  }
28683
- async function di(e) {
28983
+ async function Gi(e) {
28684
28984
  let { childRecord: t, pair: n, query: r } = e, i = t.attributes.find((e) => e.name === n.uuidAttr)?.value;
28685
28985
  if (!i) return null;
28686
- let a = await fi({
28986
+ let a = await Ki({
28687
28987
  uuidValue: i,
28688
28988
  targetTagNames: n.targetTagNames,
28689
28989
  query: r
28690
28990
  });
28691
28991
  if (!a) return null;
28692
- let o = await _e(r, {
28992
+ let o = await Ce(r, {
28693
28993
  reference: {
28694
28994
  tagName: t.tagName,
28695
28995
  id: t.id
@@ -28713,10 +29013,10 @@ async function di(e) {
28713
29013
  }
28714
29014
  };
28715
29015
  }
28716
- async function fi(e) {
29016
+ async function Ki(e) {
28717
29017
  let { uuidValue: t, targetTagNames: r, query: i } = e;
28718
29018
  for (let e of r) {
28719
- if (!n(e, b)) continue;
29019
+ if (!n(e, x)) continue;
28720
29020
  let r = (await i.getRecordsByTagName(e)).find((e) => e.attributes.find((e) => e.name === "uuid")?.value === t);
28721
29021
  if (r) return {
28722
29022
  tagName: r.tagName,
@@ -28725,17 +29025,17 @@ async function fi(e) {
28725
29025
  }
28726
29026
  return null;
28727
29027
  }
28728
- async function pi(e) {
29028
+ async function qi(e) {
28729
29029
  let { childRecord: t, query: n } = e, r = t.attributes.find((e) => e.name === "uuid")?.value;
28730
29030
  if (!r) return [];
28731
- let i = ci(t.tagName);
29031
+ let i = Oi(t.tagName);
28732
29032
  if (i.length === 0) return [];
28733
29033
  let a = {
28734
29034
  tagName: t.tagName,
28735
29035
  id: t.id
28736
29036
  }, o = [];
28737
29037
  for (let e of i) {
28738
- let t = await si({
29038
+ let t = await Di({
28739
29039
  uuid: r,
28740
29040
  entry: e,
28741
29041
  target: a,
@@ -28747,12 +29047,12 @@ async function pi(e) {
28747
29047
  }
28748
29048
  //#endregion
28749
29049
  //#region src/v2019C1/hooks/after-created/after-created.ts
28750
- async function mi(e) {
28751
- let { childRecord: t, parentRecord: n, query: r } = e, i = await ti({
29050
+ async function Ji(e) {
29051
+ let { childRecord: t, parentRecord: n, query: r } = e, i = await xi({
28752
29052
  childRecord: t,
28753
29053
  parentRecord: n,
28754
29054
  query: r
28755
- }), a = await li({
29055
+ }), a = await Ui({
28756
29056
  childRecord: t,
28757
29057
  query: r
28758
29058
  });
@@ -28760,12 +29060,12 @@ async function mi(e) {
28760
29060
  }
28761
29061
  //#endregion
28762
29062
  //#region src/v2019C1/hooks/after-deep-clone/ref-paths.ts
28763
- async function hi(e) {
28764
- let { cumulativeCloneMappings: t, query: n } = e, { uuidMap: r, uuidToRef: i } = await gi(t, n);
29063
+ async function Yi(e) {
29064
+ let { cumulativeCloneMappings: t, query: n } = e, { uuidMap: r, uuidToRef: i } = await Xi(t, n);
28765
29065
  if (r.size === 0) return [];
28766
29066
  let a = [];
28767
29067
  for (let { target: e } of t) {
28768
- let t = await vi({
29068
+ let t = await Qi({
28769
29069
  target: e,
28770
29070
  uuidMap: r,
28771
29071
  uuidToRef: i,
@@ -28775,9 +29075,9 @@ async function hi(e) {
28775
29075
  }
28776
29076
  return a;
28777
29077
  }
28778
- async function gi(e, t) {
29078
+ async function Xi(e, t) {
28779
29079
  let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
28780
- for (let { source: i, target: a } of e) await _i({
29080
+ for (let { source: i, target: a } of e) await Zi({
28781
29081
  source: i,
28782
29082
  target: a,
28783
29083
  query: t,
@@ -28789,7 +29089,7 @@ async function gi(e, t) {
28789
29089
  uuidToRef: r
28790
29090
  };
28791
29091
  }
28792
- async function _i(e) {
29092
+ async function Zi(e) {
28793
29093
  let { source: t, target: n, query: r, uuidMap: i, uuidToRef: a } = e, o = await r.getRecord(n);
28794
29094
  if (!o) return;
28795
29095
  let s = t.attributes.find((e) => e.name === "uuid")?.value, c = o.attributes.find((e) => e.name === "uuid")?.value;
@@ -28798,14 +29098,14 @@ async function _i(e) {
28798
29098
  id: o.id
28799
29099
  }));
28800
29100
  }
28801
- async function vi(e) {
29101
+ async function Qi(e) {
28802
29102
  let { target: t, uuidMap: n, uuidToRef: r, query: a } = e, o = t.tagName;
28803
- if (!(o in T)) return null;
29103
+ if (!(o in O)) return null;
28804
29104
  let s = await a.getRecord(t);
28805
29105
  if (!s) return null;
28806
- let c = T[o], l = [...s.attributes], u = !1;
29106
+ let c = O[o], l = [...s.attributes], u = !1;
28807
29107
  for (let e of c) {
28808
- let t = await yi({
29108
+ let t = await $i({
28809
29109
  pair: e,
28810
29110
  tagName: o,
28811
29111
  refId: s.id,
@@ -28825,14 +29125,14 @@ async function vi(e) {
28825
29125
  })
28826
29126
  } : null;
28827
29127
  }
28828
- async function yi(e) {
29128
+ async function $i(e) {
28829
29129
  let { pair: t, tagName: n, refId: r, uuidMap: i, uuidToRef: a, query: o } = e, s = [...e.updatedAttributes], c = s.find((e) => e.name === t.attribute.uuid)?.value;
28830
29130
  if (!c) return null;
28831
29131
  let l = i.get(c);
28832
29132
  if (!l) return null;
28833
- let u = !1, d = bi(s, t.attribute.uuid, c, l);
29133
+ let u = !1, d = ea(s, t.attribute.uuid, c, l);
28834
29134
  d && (s = d, u = !0);
28835
- let f = await xi({
29135
+ let f = await ta({
28836
29136
  attributes: s,
28837
29137
  pathAttrName: t.attribute.path,
28838
29138
  newUuid: l,
@@ -28843,16 +29143,16 @@ async function yi(e) {
28843
29143
  });
28844
29144
  return f && (s = f, u = !0), u ? s : null;
28845
29145
  }
28846
- function bi(e, t, n, r) {
29146
+ function ea(e, t, n, r) {
28847
29147
  return r === n ? null : e.map((e) => e.name === t ? {
28848
29148
  ...e,
28849
29149
  value: r
28850
29150
  } : e);
28851
29151
  }
28852
- async function xi(e) {
29152
+ async function ta(e) {
28853
29153
  let { attributes: t, pathAttrName: n, newUuid: r, uuidToRef: i, tagName: a, refId: o, query: s } = e, c = i.get(r);
28854
29154
  if (!c) return null;
28855
- let l = await A.query.buildReferencePath(s, {
29155
+ let l = await L.query.buildReferencePath(s, {
28856
29156
  reference: {
28857
29157
  tagName: a,
28858
29158
  id: o
@@ -28869,13 +29169,13 @@ async function xi(e) {
28869
29169
  }
28870
29170
  //#endregion
28871
29171
  //#region src/v2019C1/hooks/after-deep-clone/after-deep-clone.ts
28872
- async function Si(e) {
28873
- return hi(e);
29172
+ async function na(e) {
29173
+ return Yi(e);
28874
29174
  }
28875
29175
  //#endregion
28876
29176
  //#region src/v2019C1/hooks/after-standardized-record/uuid-attribute.ts
28877
- function Ci(e) {
28878
- let { record: t } = e, { tagName: n, attributes: r } = t, i = b.definition[n];
29177
+ function ra(e) {
29178
+ let { record: t } = e, { tagName: n, attributes: r } = t, i = x.definition[n];
28879
29179
  if (!("uuid" in i.attributes.details) || r.find((e) => e.name === "uuid")?.value) return t;
28880
29180
  let a = i.attributes.details.uuid?.namespace, o = r.filter((e) => e.name !== "uuid");
28881
29181
  return {
@@ -28889,21 +29189,35 @@ function Ci(e) {
28889
29189
  }
28890
29190
  //#endregion
28891
29191
  //#region src/v2019C1/hooks/after-standardized-record/after-standardized-record.ts
28892
- function wi(e) {
28893
- return Ci(e);
29192
+ function ia(e) {
29193
+ return ra(e);
28894
29194
  }
28895
29195
  //#endregion
28896
29196
  //#region src/v2019C1/hooks/after-updated/ref-paths.ts
28897
- async function Ti(e) {
28898
- let { oldRecord: t, newRecord: n, query: r } = e, i = [], a = n.attributes.find((e) => e.name === "uuid")?.value;
28899
- if (a) {
28900
- let e = ci(n.tagName), t = {
29197
+ async function aa(e) {
29198
+ let { oldRecord: t, newRecord: n, query: r } = e, i = [], a = o(t), s = o(n), c = await ji(r, s);
29199
+ c && i.push(c);
29200
+ let l = await Li({
29201
+ oldRecord: a,
29202
+ newRecord: s,
29203
+ query: r
29204
+ });
29205
+ l && i.push(l);
29206
+ let u = await Mi({
29207
+ oldRecord: a,
29208
+ newRecord: s,
29209
+ query: r
29210
+ });
29211
+ i.push(...u);
29212
+ let d = n.attributes.find((e) => e.name === "uuid")?.value;
29213
+ if (d) {
29214
+ let e = Oi(n.tagName), t = {
28901
29215
  tagName: n.tagName,
28902
29216
  id: n.id
28903
29217
  };
28904
29218
  for (let n of e) {
28905
- let e = await si({
28906
- uuid: a,
29219
+ let e = await Di({
29220
+ uuid: d,
28907
29221
  entry: n,
28908
29222
  target: t,
28909
29223
  query: r
@@ -28911,8 +29225,8 @@ async function Ti(e) {
28911
29225
  i.push(...e);
28912
29226
  }
28913
29227
  }
28914
- if (Ei(t, n)) {
28915
- let e = await Di({
29228
+ if (oa(t, n)) {
29229
+ let e = await sa({
28916
29230
  newRecord: n,
28917
29231
  query: r
28918
29232
  });
@@ -28920,11 +29234,11 @@ async function Ti(e) {
28920
29234
  }
28921
29235
  return i;
28922
29236
  }
28923
- function Ei(e, t) {
28924
- for (let n of ne) if (e.attributes.find((e) => e.name === n)?.value !== t.attributes.find((e) => e.name === n)?.value) return !0;
29237
+ function oa(e, t) {
29238
+ for (let n of oe) if (e.attributes.find((e) => e.name === n)?.value !== t.attributes.find((e) => e.name === n)?.value) return !0;
28925
29239
  return !1;
28926
29240
  }
28927
- async function Di(e) {
29241
+ async function sa(e) {
28928
29242
  let { newRecord: t, query: n } = e, r = {
28929
29243
  tagName: t.tagName,
28930
29244
  id: t.id
@@ -28933,14 +29247,14 @@ async function Di(e) {
28933
29247
  if (r.id === t.id) continue;
28934
29248
  let e = await n.any.getAttribute(r, { name: "uuid" });
28935
29249
  if (!e) continue;
28936
- let i = ci(r.tagName);
29250
+ let i = Oi(r.tagName);
28937
29251
  if (i.length === 0) continue;
28938
29252
  let o = {
28939
29253
  tagName: r.tagName,
28940
29254
  id: r.id
28941
29255
  };
28942
29256
  for (let t of i) {
28943
- let r = await si({
29257
+ let r = await Di({
28944
29258
  uuid: e,
28945
29259
  entry: t,
28946
29260
  target: o,
@@ -28953,36 +29267,40 @@ async function Di(e) {
28953
29267
  }
28954
29268
  //#endregion
28955
29269
  //#region src/v2019C1/hooks/after-updated/after-updated.ts
28956
- async function Oi(e) {
28957
- return Ti(e);
29270
+ async function ca(e) {
29271
+ return aa(e);
28958
29272
  }
28959
29273
  //#endregion
28960
29274
  //#region src/v2019C1/hooks/before-clone/before-clone.ts
28961
- function ki(e) {
28962
- let { record: t } = e, n = !0, r = !!t.value?.trim(), i = t.attributes.some((e) => e.name === "type");
28963
- t.tagName === "Private" && !t.tree.length && !r && !i && (n = !1);
28964
- let a = t.attributes.filter((e) => e.name !== "uuid");
29275
+ var la = new Set(Object.values(b).map((e) => e.uri)), ua = new Set(Object.values(b).map((e) => e.prefix).filter(Boolean));
29276
+ function da(e) {
29277
+ return la.has(e.namespace.uri) && !n(e.tagName, x);
29278
+ }
29279
+ function fa(e) {
29280
+ 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;
29281
+ t.tagName === "Private" && !t.tree.length && !i && !o && (r = !1), t.tagName === "Private" && !t.tree.length && !i && a !== void 0 && ua.has(a) && (r = !1), da(n) && (r = !1), t.tagName === "Private" && n.tree.length > 0 && n.tree.every(da) && (r = !1);
29282
+ let s = t.attributes.filter((e) => e.name !== "uuid");
28965
29283
  return {
28966
- shouldBeCloned: n,
29284
+ shouldBeCloned: r,
28967
29285
  transformedRecord: {
28968
29286
  ...t,
28969
- attributes: a
29287
+ attributes: s
28970
29288
  }
28971
29289
  };
28972
29290
  }
28973
29291
  //#endregion
28974
29292
  //#region src/v2019C1/hooks/before-delete/orphaned-refs.ts
28975
- async function Ai(e) {
29293
+ async function pa(e) {
28976
29294
  let { record: t, query: n } = e, r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
28977
- if (await Ii({
29295
+ if (await ya({
28978
29296
  record: t,
28979
29297
  query: n,
28980
29298
  ids: r,
28981
29299
  uuids: i
28982
29300
  }), i.size === 0) return [];
28983
- let a = [], o = Object.keys(T);
28984
- for (let e of o) {
28985
- let t = await ji({
29301
+ let a = [];
29302
+ for (let e of A) {
29303
+ let t = await ma({
28986
29304
  refTagName: e,
28987
29305
  subtreeIds: r,
28988
29306
  subtreeUuids: i,
@@ -28992,11 +29310,11 @@ async function Ai(e) {
28992
29310
  }
28993
29311
  return a;
28994
29312
  }
28995
- async function ji(e) {
28996
- let { refTagName: t, subtreeIds: n, subtreeUuids: r, query: i } = e, a = T[t], o = await i.getRecordsByTagName(t), s = [];
29313
+ async function ma(e) {
29314
+ let { refTagName: t, subtreeIds: n, subtreeUuids: r, query: i } = e, a = O[t], o = await i.getRecordsByTagName(t), s = [];
28997
29315
  for (let e of o) {
28998
29316
  if (n.has(e.id)) continue;
28999
- let o = await Mi({
29317
+ let o = await ha({
29000
29318
  refTagName: t,
29001
29319
  refRecord: e,
29002
29320
  refPairs: a,
@@ -29007,15 +29325,15 @@ async function ji(e) {
29007
29325
  }
29008
29326
  return s;
29009
29327
  }
29010
- async function Mi(e) {
29011
- let { refTagName: t, refRecord: n, refPairs: r, subtreeUuids: i, query: a } = e, o = Ni({
29328
+ async function ha(e) {
29329
+ let { refTagName: t, refRecord: n, refPairs: r, subtreeUuids: i, query: a } = e, o = ga({
29012
29330
  refPairs: r,
29013
29331
  refRecord: n,
29014
29332
  subtreeUuids: i
29015
29333
  });
29016
- return o.size === 0 ? [] : Je.has(t) ? [Pi(n, o)] : Fi(n, a);
29334
+ return o.size === 0 ? [] : k.has(t) ? [_a(n, o)] : va(n, a);
29017
29335
  }
29018
- function Ni(e) {
29336
+ function ga(e) {
29019
29337
  let { refPairs: t, refRecord: n, subtreeUuids: r } = e, i = /* @__PURE__ */ new Set();
29020
29338
  for (let e of t) {
29021
29339
  let t = n.attributes.find((t) => t.name === e.attribute.uuid)?.value;
@@ -29026,7 +29344,7 @@ function Ni(e) {
29026
29344
  }
29027
29345
  return i;
29028
29346
  }
29029
- function Pi(e, t) {
29347
+ function _a(e, t) {
29030
29348
  let n = e.attributes.filter((e) => !t.has(e.name));
29031
29349
  return {
29032
29350
  status: "updated",
@@ -29037,7 +29355,7 @@ function Pi(e, t) {
29037
29355
  })
29038
29356
  };
29039
29357
  }
29040
- async function Fi(e, t) {
29358
+ async function va(e, t) {
29041
29359
  let n = [{
29042
29360
  status: "deleted",
29043
29361
  oldRecord: i(e),
@@ -29059,14 +29377,14 @@ async function Fi(e, t) {
29059
29377
  }
29060
29378
  return n;
29061
29379
  }
29062
- async function Ii(e) {
29380
+ async function ya(e) {
29063
29381
  let { record: t, query: n, ids: r, uuids: i } = e;
29064
29382
  r.add(t.id);
29065
29383
  let a = t.attributes.find((e) => e.name === "uuid")?.value;
29066
29384
  a && i.add(a);
29067
29385
  for (let e of t.children) {
29068
29386
  let t = await n.getRecord(e);
29069
- t && await Ii({
29387
+ t && await ya({
29070
29388
  record: t,
29071
29389
  query: n,
29072
29390
  ids: r,
@@ -29076,31 +29394,31 @@ async function Ii(e) {
29076
29394
  }
29077
29395
  //#endregion
29078
29396
  //#region src/v2019C1/hooks/before-delete/before-delete.ts
29079
- async function Li(e) {
29080
- return Ai(e);
29397
+ async function ba(e) {
29398
+ return pa(e);
29081
29399
  }
29082
29400
  //#endregion
29083
29401
  //#region src/v2019C1/hooks/io/io-hooks.ts
29084
- function Ri() {
29402
+ function xa() {
29085
29403
  let e = /* @__PURE__ */ new Map(), t = [], n = [];
29086
29404
  return {
29087
29405
  beforeImportRecord: (r) => {
29088
29406
  let { record: i, ancestry: a } = r, { tagName: o } = i, s = i.attributes.find((e) => e.name === "uuid")?.value;
29089
- if (s && Bi.has(o)) {
29090
- let t = ae({
29407
+ if (s && pe.has(o)) {
29408
+ let t = le({
29091
29409
  record: i,
29092
29410
  ancestry: a
29093
29411
  });
29094
29412
  t && e.set(t.path, s);
29095
29413
  }
29096
- if (!zi.has(o)) return;
29097
- let c = T[o];
29414
+ if (!fe.has(o)) return;
29415
+ let c = O[o];
29098
29416
  for (let e of c) {
29099
29417
  let r = i.attributes.find((t) => t.name === e.attribute.path)?.value;
29100
29418
  if (!r || i.attributes.find((t) => t.name === e.attribute.uuid)?.value) continue;
29101
- let s = ue(e.resolution, e.attribute.path, r, a);
29419
+ let s = ge(e.resolution, e.attribute.path, r, a);
29102
29420
  if (!s) {
29103
- e.resolution === E.unsupported && n.push({
29421
+ e.resolution === j.unsupported && n.push({
29104
29422
  type: "unsupported-xpath-reference",
29105
29423
  recordId: i.id,
29106
29424
  details: {
@@ -29154,13 +29472,15 @@ function Ri() {
29154
29472
  }
29155
29473
  };
29156
29474
  }
29157
- var zi = new Set(Object.keys(T)), Bi = new Set(Object.values(T).flatMap((e) => e.flatMap((e) => e.target))), Vi = {
29158
- beforeClone: ki,
29159
- afterStandardizedRecord: wi,
29160
- afterCreated: mi,
29161
- afterDeepClone: Si,
29162
- afterUpdated: Oi,
29163
- beforeDelete: Li
29475
+ //#endregion
29476
+ //#region src/v2019C1/hooks/index.ts
29477
+ var Sa = {
29478
+ beforeClone: fa,
29479
+ afterStandardizedRecord: ia,
29480
+ afterCreated: Ji,
29481
+ afterDeepClone: na,
29482
+ afterUpdated: ca,
29483
+ beforeDelete: ba
29164
29484
  };
29165
29485
  //#endregion
29166
- export { b as C, v as S, y as T, D as _, ht as a, ne as b, Ye as c, Ue as d, Be as f, qe as g, Ge as h, $r as i, We as l, Ke as m, Ri as n, Xe as o, Ve as p, ei as r, Je as s, Vi as t, He as u, E as v, _ as w, S as x, T as y };
29486
+ export { b as A, pe as C, y as D, ie as E, x as O, fe as S, oe as T, Ie as _, St as a, k as b, Pe as c, N as d, Ne as f, P as g, Fe as h, yi as i, v as k, Me as l, je as m, xa as n, ot as o, Ae as p, bi as r, Re as s, Sa as t, Le as u, M as v, O as w, A as x, j as y };