@magmonium/cli 0.8.30 → 0.10.1

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.
@@ -21,11 +21,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var invariant_catalog_exports = {};
22
22
  __export(invariant_catalog_exports, {
23
23
  INVARIANTS: () => INVARIANTS,
24
+ codecDrops: () => codecDrops,
25
+ collectEmitGaps: () => collectEmitGaps,
24
26
  invariantScopeOf: () => invariantScopeOf,
25
27
  runInvariants: () => runInvariants
26
28
  });
27
29
  module.exports = __toCommonJS(invariant_catalog_exports);
28
- var import_codegen46 = require("./index.js");
30
+ var import_codegen52 = require("./index.js");
29
31
 
30
32
  // apps/m-one-ui/src/app/pages/design/model/invariant.ts
31
33
  var targetKey = (target2) => {
@@ -615,9 +617,306 @@ var bindingResolves = defineInvariant({
615
617
  })
616
618
  });
617
619
 
618
- // apps/m-one-ui/src/app/pages/design/lib/screen-embed-helper.ts
620
+ // apps/m-one-ui/src/app/pages/design/lib/invariants/binding-resolves-outputs.ts
619
621
  var import_codegen14 = require("./index.js");
620
- var isScreenControl = (control) => control.type === import_codegen14.ControlType.SCREEN && typeof control.screenId === "string";
622
+ var writesGone = (value, state) => {
623
+ if (Array.isArray(value)) return value.some((item) => writesGone(item, state));
624
+ if (!value || typeof value !== "object") return false;
625
+ const record = value;
626
+ if (typeof record.propertyId === "string" && "value" in record && !state.has(record.propertyId))
627
+ return true;
628
+ return Object.values(value).some((item) => writesGone(item, state));
629
+ };
630
+ var bindingResolvesOutputs = defineInvariant({
631
+ name: "binding-resolves-outputs",
632
+ message: "invariant-state-write-unresolved",
633
+ severity: "blocking",
634
+ deps: ["features", "screens", "screenControlMaps"],
635
+ validate: ({ features, screens, screenControlMaps }) => {
636
+ const state = new Set(
637
+ Object.values(features).flatMap(
638
+ (feature) => (0, import_codegen14.storesOf)(feature).flatMap((store) => Object.keys(store.properties ?? {}))
639
+ )
640
+ );
641
+ const found = [];
642
+ for (const screen of screens) {
643
+ const map = screenControlMaps[screen.id] ?? {};
644
+ for (const control of Object.values(map)) {
645
+ if (writesGone([control.outputWrites, control.outputOutcomes], state))
646
+ found.push({
647
+ subject: `${screen.name} \u2192 ${String(control.configs?.["name"] ?? control.id)}`,
648
+ target: { kind: "control", screenId: screen.id, controlId: control.id }
649
+ });
650
+ }
651
+ if (writesGone([screen.methods, screen.autoCalls], state))
652
+ found.push({
653
+ subject: `${screen.name} \u2192 ScreenMethod / AutoCall`,
654
+ target: { kind: "screen", screenId: screen.id, panel: "screen" }
655
+ });
656
+ }
657
+ return found;
658
+ }
659
+ });
660
+
661
+ // apps/m-one-ui/src/app/pages/design/lib/invariants/control-rules.ts
662
+ var import_codegen15 = require("./index.js");
663
+ var nameOf = (map, id) => String(map[id]?.configs?.["name"] ?? id);
664
+ var routerOutletPlaced = defineInvariant({
665
+ name: "router-outlet-placed",
666
+ message: "invariant-router-outlet-misplaced",
667
+ severity: "blocking",
668
+ deps: ["screens", "screenControlMaps"],
669
+ validate: ({ screens, screenControlMaps }) => screens.flatMap((screen) => {
670
+ const outlets = Object.values(screenControlMaps[screen.id] ?? {}).filter(
671
+ (control) => control.type === import_codegen15.ControlType.ROUTER_OUTLET
672
+ );
673
+ const misplaced = (0, import_codegen15.isRoutableKind)(screen.kind) ? outlets.slice(1) : outlets;
674
+ return misplaced.map((control) => ({
675
+ subject: `${screen.name} \u2192 ${nameOf(screenControlMaps[screen.id], control.id)}`,
676
+ target: { kind: "control", screenId: screen.id, controlId: control.id }
677
+ }));
678
+ })
679
+ });
680
+ var controlIdUnique = defineInvariant({
681
+ name: "control-id-unique",
682
+ message: "invariant-control-id-duplicate",
683
+ severity: "blocking",
684
+ deps: ["screens", "screenControlMaps"],
685
+ validate: ({ screens, screenControlMaps }) => {
686
+ const seen = /* @__PURE__ */ new Map();
687
+ const found = [];
688
+ for (const screen of screens) {
689
+ for (const id of Object.keys(screenControlMaps[screen.id] ?? {})) {
690
+ const first = seen.get(id);
691
+ if (first === void 0) {
692
+ seen.set(id, screen.name);
693
+ continue;
694
+ }
695
+ found.push({
696
+ subject: `${screen.name} \u2192 ${nameOf(screenControlMaps[screen.id], id)}, also on ${first}`,
697
+ target: { kind: "control", screenId: screen.id, controlId: id }
698
+ });
699
+ }
700
+ }
701
+ return found;
702
+ }
703
+ });
704
+ var fieldKeyTypeAgrees = defineInvariant({
705
+ name: "field-key-type-agrees",
706
+ message: "invariant-field-key-type-split",
707
+ severity: "blocking",
708
+ deps: ["screens", "screenControlMaps"],
709
+ validate: ({ screens, screenControlMaps }) => screens.flatMap((screen) => {
710
+ const map = screenControlMaps[screen.id] ?? {};
711
+ return Object.values(map).filter((control) => control.type === import_codegen15.ControlType.FIELD).filter((field) => (0, import_codegen15.fieldKeyClashes)(map, field.id, field.configs).length > 0).map((field) => ({
712
+ subject: `${screen.name} \u2192 ${nameOf(map, field.id)}`,
713
+ target: { kind: "control", screenId: screen.id, controlId: field.id }
714
+ }));
715
+ })
716
+ });
717
+ var submitTargetResolves = defineInvariant({
718
+ name: "submit-target-resolves",
719
+ message: "invariant-submit-target-unresolved",
720
+ severity: "blocking",
721
+ deps: ["screens", "screenControlMaps"],
722
+ validate: ({ screens, screenControlMaps }) => screens.flatMap((screen) => {
723
+ const map = screenControlMaps[screen.id] ?? {};
724
+ return Object.values(map).filter((control) => {
725
+ const target2 = control.configs?.[import_codegen15.SUBMIT_TARGET_KEY];
726
+ return typeof target2 === "string" && !map[target2];
727
+ }).map((control) => ({
728
+ subject: `${screen.name} \u2192 ${nameOf(map, control.id)}`,
729
+ target: { kind: "control", screenId: screen.id, controlId: control.id }
730
+ }));
731
+ })
732
+ });
733
+ var formResetResolves = defineInvariant({
734
+ name: "form-reset-resolves",
735
+ message: "invariant-form-reset-unresolved",
736
+ severity: "blocking",
737
+ deps: ["screens", "screenControlMaps"],
738
+ validate: ({ screens, screenControlMaps }) => screens.flatMap((screen) => {
739
+ const map = screenControlMaps[screen.id] ?? {};
740
+ const onControls = Object.values(map).filter(
741
+ (control) => Object.values(control.outputOutcomes ?? {}).some(
742
+ (outcome) => !!(0, import_codegen15.repairCallOutcome)(map, outcome)
743
+ )
744
+ ).map((control) => ({
745
+ subject: `${screen.name} \u2192 ${nameOf(map, control.id)}`,
746
+ target: { kind: "control", screenId: screen.id, controlId: control.id }
747
+ }));
748
+ const onSites = (0, import_codegen15.repairClassCallSites)(map, {
749
+ methods: screen.methods,
750
+ autoCalls: screen.autoCalls
751
+ }) ? [
752
+ {
753
+ subject: `${screen.name} \u2192 ScreenMethod / AutoCall`,
754
+ target: { kind: "screen", screenId: screen.id, panel: "screen" }
755
+ }
756
+ ] : [];
757
+ return [...onControls, ...onSites];
758
+ })
759
+ });
760
+ var ruleFieldResolves = defineInvariant({
761
+ name: "rule-field-resolves",
762
+ message: "invariant-rule-field-unresolved",
763
+ severity: "blocking",
764
+ deps: ["screens", "screenControlMaps"],
765
+ validate: ({ screens, screenControlMaps }) => screens.flatMap((screen) => {
766
+ const map = screenControlMaps[screen.id] ?? {};
767
+ const models = /* @__PURE__ */ new Set([
768
+ ...Object.keys(screen.formModels ?? {}),
769
+ ...Object.values(screen.formModels ?? {}).map((model) => model.id)
770
+ ]);
771
+ if (!models.size) return [];
772
+ const readsGone = (node) => {
773
+ if (Array.isArray(node)) return node.some(readsGone);
774
+ if (!node || typeof node !== "object") return false;
775
+ const path = node.path;
776
+ if (node.kind === "check" && Array.isArray(path) && typeof path[0] === "string" && models.has(path[0]) && typeof path[1] === "string" && !map[path[1]]) {
777
+ return true;
778
+ }
779
+ return Object.values(node).some(readsGone);
780
+ };
781
+ return Object.values(screen.variants ?? {}).filter((variant) => readsGone(variant.rule)).map((variant) => ({
782
+ subject: `${screen.name} \u2192 variant ${variant.name}`,
783
+ target: { kind: "screen", screenId: screen.id, panel: "screen", memberId: variant.id }
784
+ }));
785
+ })
786
+ });
787
+ var embedShapeWithinFeature = defineInvariant({
788
+ name: "embed-shape-within-feature",
789
+ message: "invariant-embed-shape-crosses-feature",
790
+ severity: "blocking",
791
+ deps: ["screens", "screenControlMaps"],
792
+ validate: ({ screens, screenControlMaps }) => {
793
+ const byId = new Map(screens.map((screen) => [screen.id, screen]));
794
+ return screens.flatMap(
795
+ (host) => Object.values(screenControlMaps[host.id] ?? {}).flatMap((control) => {
796
+ const target2 = control.screenId ? byId.get(control.screenId) : void 0;
797
+ if (!target2 || !(0, import_codegen15.embedShapeBlocked)(host, target2)) return [];
798
+ return [
799
+ {
800
+ subject: `${host.name} \u2192 ${target2.name}`,
801
+ target: { kind: "control", screenId: host.id, controlId: control.id }
802
+ }
803
+ ];
804
+ })
805
+ );
806
+ }
807
+ });
808
+
809
+ // apps/m-one-ui/src/app/pages/design/lib/invariants/function-rules.ts
810
+ var import_codegen16 = require("./index.js");
811
+ var functionNameUnshadowed = defineInvariant({
812
+ name: "function-name-unshadowed",
813
+ message: "invariant-function-name-shadowed",
814
+ severity: "blocking",
815
+ deps: ["features", "functions"],
816
+ validate: ({ features, functions }) => {
817
+ const appNames = new Set(Object.values(functions).map((fn) => fn.name));
818
+ return Object.values(features).flatMap(
819
+ (feature) => Object.values(feature.functions ?? {}).filter((fn) => appNames.has(fn.name)).map((fn) => ({
820
+ subject: `${feature.name} \xB7 ${fn.name}`,
821
+ target: { kind: "function", featureId: feature.id, functionId: fn.id }
822
+ }))
823
+ );
824
+ }
825
+ });
826
+ var functionTierFiled = defineInvariant({
827
+ name: "function-tier-filed",
828
+ message: "invariant-function-tier-misfiled",
829
+ severity: "blocking",
830
+ deps: ["features", "functions", "sharedShapes"],
831
+ validate: ({ features, functions, sharedShapes }) => {
832
+ const found = Object.values(functions).filter((fn) => (0, import_codegen16.tierOf)(fn) === "feature" && !fn.tier).filter((fn) => (0, import_codegen16.featureShapeIds)(fn).some((id) => !sharedShapes[id])).map((fn) => ({
833
+ subject: `shared \xB7 ${fn.name}`,
834
+ target: { kind: "function", functionId: fn.id }
835
+ }));
836
+ for (const feature of Object.values(features)) {
837
+ const foreign = (fn) => (0, import_codegen16.featureShapeIds)(fn).some((id) => !feature.shapes[id] && !sharedShapes[id]);
838
+ for (const fn of Object.values(feature.functions ?? {}).filter(foreign))
839
+ found.push({
840
+ subject: `${feature.name} \xB7 ${fn.name}`,
841
+ target: { kind: "function", featureId: feature.id, functionId: fn.id }
842
+ });
843
+ }
844
+ return found;
845
+ }
846
+ });
847
+ var namesBoth = (value) => {
848
+ if (Array.isArray(value)) return value.some(namesBoth);
849
+ if (!value || typeof value !== "object") return false;
850
+ const record = value;
851
+ if (typeof record.functionId === "string" && record.functionId !== "" && typeof record.oneFunction === "string" && record.oneFunction !== "") {
852
+ return true;
853
+ }
854
+ return Object.values(value).some(namesBoth);
855
+ };
856
+ var functionRefExclusive = defineInvariant({
857
+ name: "function-ref-exclusive",
858
+ message: "invariant-function-ref-both",
859
+ severity: "blocking",
860
+ deps: ["features", "screens"],
861
+ validate: ({ features, screens }) => [
862
+ ...Object.values(features).filter((feature) => namesBoth(feature.computeds) || namesBoth(feature.methods) || namesBoth(feature.subStores)).map((feature) => ({
863
+ subject: feature.name,
864
+ target: { kind: "panel", panel: "store", featureId: feature.id }
865
+ })),
866
+ ...screens.filter((screen) => namesBoth(screen.computeds) || namesBoth(screen.methods)).map((screen) => ({
867
+ subject: screen.name,
868
+ target: { kind: "screen", screenId: screen.id, panel: "screen" }
869
+ }))
870
+ ]
871
+ });
872
+
873
+ // apps/m-one-ui/src/app/pages/design/lib/invariants/store-rules.ts
874
+ var import_codegen17 = require("./index.js");
875
+ var storeNameReserved = defineInvariant({
876
+ name: "store-name-reserved",
877
+ message: "invariant-store-name-reserved",
878
+ severity: "blocking",
879
+ deps: ["features"],
880
+ validate: ({ features }) => Object.values(features).flatMap((feature) => {
881
+ const at = { kind: "panel", panel: "store", featureId: feature.id };
882
+ return (0, import_codegen17.storesOf)(feature).flatMap((store) => {
883
+ const subStoreId = store.subStore?.id;
884
+ const owner = subStoreId ? { ...at, subStoreId } : at;
885
+ const found = Object.values(store.methods ?? {}).filter((method) => import_codegen17.RESERVED_METHOD_NAMES.includes(method.name)).map((method) => ({
886
+ subject: `${feature.name} \u2192 method ${method.name}`,
887
+ target: { ...owner, memberId: method.id }
888
+ }));
889
+ if (store.subStore && store.subStore.name === import_codegen17.MAIN_STORE_VALUE)
890
+ found.push({ subject: `${feature.name} \u2192 store ${store.subStore.name}`, target: owner });
891
+ return found;
892
+ });
893
+ })
894
+ });
895
+ var storeMemberNameUnique = defineInvariant({
896
+ name: "store-member-name-unique",
897
+ message: "invariant-store-member-name-taken",
898
+ severity: "blocking",
899
+ deps: ["features"],
900
+ validate: ({ features }) => Object.values(features).flatMap((feature) => {
901
+ const at = { kind: "panel", panel: "store", featureId: feature.id };
902
+ return (0, import_codegen17.storesOf)(feature).flatMap((store) => {
903
+ const subStoreId = store.subStore?.id;
904
+ const owner = subStoreId ? { ...at, subStoreId } : at;
905
+ const others = /* @__PURE__ */ new Set([
906
+ ...Object.values(store.methods ?? {}).map((member) => member.name),
907
+ ...Object.values(store.computeds ?? {}).map((member) => member.name)
908
+ ]);
909
+ return Object.values(store.properties ?? {}).filter((property) => others.has(property.name)).map((property) => ({
910
+ subject: `${feature.name} \u2192 ${property.name}`,
911
+ target: { ...owner, memberId: property.id }
912
+ }));
913
+ });
914
+ })
915
+ });
916
+
917
+ // apps/m-one-ui/src/app/pages/design/lib/screen-embed-helper.ts
918
+ var import_codegen18 = require("./index.js");
919
+ var isScreenControl = (control) => control.type === import_codegen18.ControlType.SCREEN && typeof control.screenId === "string";
621
920
  function embeddedScreenIds(controlMap) {
622
921
  return Object.values(controlMap).filter(isScreenControl).map((control) => control.screenId);
623
922
  }
@@ -632,7 +931,7 @@ function reachableScreenIds(rootId, maps) {
632
931
  }
633
932
  return seen;
634
933
  }
635
- var firesFromMount = (screen) => (0, import_codegen14.isFeatureScreen)(screen) && !!screen.autoCalls?.length;
934
+ var firesFromMount = (screen) => (0, import_codegen18.isFeatureScreen)(screen) && !!screen.autoCalls?.length;
636
935
  function duplicateFeatureEmbeds(rootId, maps, screens) {
637
936
  return [
638
937
  ...new Set(
@@ -660,7 +959,7 @@ function duplicateFeatureEmbedControls(rootId, maps, screens) {
660
959
  if (parent.variants?.length) {
661
960
  gates.add(JSON.stringify([instance, "variants", parent.variants]));
662
961
  }
663
- if (parent.type === import_codegen14.ControlType.BRANCH_ARM) {
962
+ if (parent.type === import_codegen18.ControlType.BRANCH_ARM) {
664
963
  gates.add(
665
964
  JSON.stringify([instance, "arm", parent.parentId, parent.id])
666
965
  );
@@ -702,10 +1001,10 @@ function featureReachEdges(maps, screens) {
702
1001
  const byId = new Map(screens.map((screen) => [screen.id, screen]));
703
1002
  const edges = /* @__PURE__ */ new Map();
704
1003
  for (const screen of screens) {
705
- if (!(0, import_codegen14.isFeatureScreen)(screen)) continue;
1004
+ if (!(0, import_codegen18.isFeatureScreen)(screen)) continue;
706
1005
  for (const id of embeddedScreenIds(maps[screen.id] ?? {})) {
707
1006
  const target2 = byId.get(id);
708
- if (!target2 || !(0, import_codegen14.isFeatureScreen)(target2)) continue;
1007
+ if (!target2 || !(0, import_codegen18.isFeatureScreen)(target2)) continue;
709
1008
  if (target2.featureId === screen.featureId) continue;
710
1009
  const reached = edges.get(screen.featureId) ?? /* @__PURE__ */ new Set();
711
1010
  reached.add(target2.featureId);
@@ -744,7 +1043,7 @@ function screenEmbedProblems(host, maps, screens) {
744
1043
  });
745
1044
  continue;
746
1045
  }
747
- if (!(0, import_codegen14.canEmbedScreen)(host, target2)) {
1046
+ if (!(0, import_codegen18.canEmbedScreen)(host, target2)) {
748
1047
  problems.push({
749
1048
  kind: "illegal-target",
750
1049
  controlId: control.id,
@@ -752,7 +1051,7 @@ function screenEmbedProblems(host, maps, screens) {
752
1051
  });
753
1052
  continue;
754
1053
  }
755
- if ((0, import_codegen14.isFeatureScreen)(host) && (0, import_codegen14.isFeatureScreen)(target2) && wouldCycleFeatures(host.featureId, target2.featureId, featureEdges)) {
1054
+ if ((0, import_codegen18.isFeatureScreen)(host) && (0, import_codegen18.isFeatureScreen)(target2) && wouldCycleFeatures(host.featureId, target2.featureId, featureEdges)) {
756
1055
  problems.push({
757
1056
  kind: "feature-cycle",
758
1057
  controlId: control.id,
@@ -831,6 +1130,27 @@ var screenControlReachable = defineInvariant({
831
1130
  }
832
1131
  }));
833
1132
  }
1133
+ if (problem.kind === "missing-screen") {
1134
+ return [
1135
+ {
1136
+ subject: `${host.name} \u2192 missing Screen ${problem.screenId}`,
1137
+ screenRetarget: true,
1138
+ target: {
1139
+ kind: "control",
1140
+ screenId: host.id,
1141
+ controlId: problem.controlId
1142
+ }
1143
+ }
1144
+ ];
1145
+ }
1146
+ if (problem.kind === "cycle") {
1147
+ return [
1148
+ {
1149
+ subject: `${host.name} \u2192 embeds itself through its ScreenControls`,
1150
+ target: { kind: "screen", screenId: host.id, panel: "screen" }
1151
+ }
1152
+ ];
1153
+ }
834
1154
  return [];
835
1155
  }
836
1156
  )
@@ -845,12 +1165,12 @@ var screenControlReachable = defineInvariant({
845
1165
  });
846
1166
 
847
1167
  // apps/m-one-ui/src/app/pages/design/lib/screen-input-binding-check.ts
848
- var import_codegen15 = require("./index.js");
1168
+ var import_codegen19 = require("./index.js");
849
1169
  var staticFits = (input, value) => {
850
- const primitive = (0, import_codegen15.inputPrimitive)(input);
1170
+ const primitive = (0, import_codegen19.inputPrimitive)(input);
851
1171
  if (!primitive) return false;
852
1172
  if (input.cardinality === "many") {
853
- return (0, import_codegen15.fixedItems)(value).every(
1173
+ return (0, import_codegen19.fixedItems)(value).every(
854
1174
  (item) => staticFits({ ...input, cardinality: "one" }, item)
855
1175
  );
856
1176
  }
@@ -863,20 +1183,20 @@ var staticFits = (input, value) => {
863
1183
  var outputFits = (input, binding, controlMap, screens) => {
864
1184
  if (input.required) return false;
865
1185
  const sibling = controlMap[binding.controlId];
866
- if (!sibling || sibling.type !== import_codegen15.ControlType.SCREEN) return false;
1186
+ if (!sibling || sibling.type !== import_codegen19.ControlType.SCREEN) return false;
867
1187
  const siblingScreen = screens.find(
868
1188
  (screen) => screen.id === sibling.screenId
869
1189
  );
870
1190
  if (!siblingScreen) return false;
871
- const output = (0, import_codegen15.listScreenOutputs)(siblingScreen.outputs).find(
1191
+ const output = (0, import_codegen19.listScreenOutputs)(siblingScreen.outputs).find(
872
1192
  (entry) => entry.id === binding.outputId
873
1193
  );
874
- const primitive = (0, import_codegen15.inputPrimitive)(input);
1194
+ const primitive = (0, import_codegen19.inputPrimitive)(input);
875
1195
  return !!output && !!primitive && output.payload?.dataType === primitive && output.payload?.cardinality === input.cardinality;
876
1196
  };
877
1197
  var sourceScope = (host, control, controlMap, features, functions, enums) => {
878
- const feature = (0, import_codegen15.isFeatureScreen)(host) ? features[host.featureId] : void 0;
879
- const readable = feature ? (0, import_codegen15.readableMembers)(feature, import_codegen15.MAIN_STORE_OWNER) : void 0;
1198
+ const feature = (0, import_codegen19.isFeatureScreen)(host) ? features[host.featureId] : void 0;
1199
+ const readable = feature ? (0, import_codegen19.readableMembers)(feature, import_codegen19.MAIN_STORE_OWNER) : void 0;
880
1200
  const inScope = { ...functions, ...feature?.functions };
881
1201
  const properties = readable?.properties ?? {};
882
1202
  return {
@@ -889,7 +1209,7 @@ var sourceScope = (host, control, controlMap, features, functions, enums) => {
889
1209
  data: {
890
1210
  controlId: control.id,
891
1211
  controlMap,
892
- roots: (0, import_codegen15.propertiesWithComputeds)(
1212
+ roots: (0, import_codegen19.propertiesWithComputeds)(
893
1213
  properties,
894
1214
  readable?.computeds ?? {},
895
1215
  inScope
@@ -919,7 +1239,7 @@ function screenInputProblems(host, controlMap, screens, features, functions, enu
919
1239
  functions,
920
1240
  enums
921
1241
  );
922
- for (const input of (0, import_codegen15.listScreenInputs)(target2.inputs)) {
1242
+ for (const input of (0, import_codegen19.listScreenInputs)(target2.inputs)) {
923
1243
  if (input.origin) continue;
924
1244
  const binding = bound[input.id];
925
1245
  const row = {
@@ -932,13 +1252,13 @@ function screenInputProblems(host, controlMap, screens, features, functions, enu
932
1252
  if (input.required) problems.push({ kind: "required-unbound", ...row });
933
1253
  continue;
934
1254
  }
935
- const fits = binding.kind === "static" ? staticFits(input, binding.value) : binding.kind === "output" ? outputFits(input, binding, controlMap, screens) : (0, import_codegen15.screenInputSourceOptions)(scope, {
936
- dataType: (0, import_codegen15.inputPrimitive)(input),
1255
+ const fits = binding.kind === "static" ? staticFits(input, binding.value) : binding.kind === "output" ? outputFits(input, binding, controlMap, screens) : (0, import_codegen19.screenInputSourceOptions)(scope, {
1256
+ dataType: (0, import_codegen19.inputPrimitive)(input),
937
1257
  cardinality: input.cardinality,
938
1258
  declared: input.dataType,
939
1259
  required: input.required
940
1260
  }).some(
941
- (option) => option.value === (0, import_codegen15.screenInputSourceValue)(binding)
1261
+ (option) => option.value === (0, import_codegen19.screenInputSourceValue)(binding)
942
1262
  );
943
1263
  if (!fits) problems.push({ kind: "unfit", ...row });
944
1264
  }
@@ -999,15 +1319,15 @@ function perScreen(judge) {
999
1319
  }
1000
1320
 
1001
1321
  // apps/m-one-ui/src/app/pages/design/lib/invariants/branch-arm-reachable.ts
1002
- var import_codegen16 = require("./index.js");
1322
+ var import_codegen20 = require("./index.js");
1003
1323
  var ATOM_CAP = 12;
1004
- var foldText = (arm, names) => (0, import_codegen16.controlVariants)(arm).map((entry, index) => {
1324
+ var foldText = (arm, names) => (0, import_codegen20.controlVariants)(arm).map((entry, index) => {
1005
1325
  const name = names.get(entry.id) ?? entry.id;
1006
- const term = (0, import_codegen16.variantJoinIsNot)(entry.join) ? `!${name}` : name;
1326
+ const term = (0, import_codegen20.variantJoinIsNot)(entry.join) ? `!${name}` : name;
1007
1327
  if (index === 0) return term;
1008
- return `${(0, import_codegen16.variantJoinIsAnd)(entry.join) ? "&&" : "||"} ${term}`;
1328
+ return `${(0, import_codegen20.variantJoinIsAnd)(entry.join) ? "&&" : "||"} ${term}`;
1009
1329
  }).join(" ");
1010
- var armSubject = (arm, names) => (0, import_codegen16.armKind)(arm) === "default" ? import_codegen16.ARM_KIND_LABEL.default : foldText(arm, names) || import_codegen16.ARM_KIND_LABEL.branch;
1330
+ var armSubject = (arm, names) => (0, import_codegen20.armKind)(arm) === "default" ? import_codegen20.ARM_KIND_LABEL.default : foldText(arm, names) || import_codegen20.ARM_KIND_LABEL.branch;
1011
1331
  var variantNames = (features, screens, currentScreenId) => {
1012
1332
  const screen = screens.find((one) => one.id === currentScreenId);
1013
1333
  const feature = screen?.featureId ? features[screen.featureId] : void 0;
@@ -1018,13 +1338,13 @@ var variantNames = (features, screens, currentScreenId) => {
1018
1338
  return names;
1019
1339
  };
1020
1340
  var unreachableArmIds = (branchId, controlMap) => {
1021
- const arms = (0, import_codegen16.orderedArms)(branchId, controlMap).filter(
1022
- (arm) => (0, import_codegen16.armKind)(arm) === "default" || (0, import_codegen16.controlVariants)(arm).length > 0
1341
+ const arms = (0, import_codegen20.orderedArms)(branchId, controlMap).filter(
1342
+ (arm) => (0, import_codegen20.armKind)(arm) === "default" || (0, import_codegen20.controlVariants)(arm).length > 0
1023
1343
  );
1024
1344
  if (arms.length < 2) return [];
1025
1345
  const atoms = [
1026
1346
  ...new Set(
1027
- arms.flatMap((arm) => (0, import_codegen16.controlVariants)(arm).map((entry) => entry.id))
1347
+ arms.flatMap((arm) => (0, import_codegen20.controlVariants)(arm).map((entry) => entry.id))
1028
1348
  )
1029
1349
  ];
1030
1350
  if (atoms.length > ATOM_CAP) return [];
@@ -1033,7 +1353,7 @@ var unreachableArmIds = (branchId, controlMap) => {
1033
1353
  for (let row = 0; row < rows; row++) {
1034
1354
  const on = atoms.filter((_, index) => row & 1 << index);
1035
1355
  for (const arm of arms) {
1036
- if ((0, import_codegen16.armKind)(arm) === "default" || (0, import_codegen16.evaluateVariantGate)((0, import_codegen16.controlVariants)(arm), on)) {
1356
+ if ((0, import_codegen20.armKind)(arm) === "default" || (0, import_codegen20.evaluateVariantGate)((0, import_codegen20.controlVariants)(arm), on)) {
1037
1357
  reached.add(arm.id);
1038
1358
  break;
1039
1359
  }
@@ -1045,7 +1365,7 @@ var unreachableArms = perScreen(
1045
1365
  (controlMap, screen, { features, screens }) => {
1046
1366
  const names = variantNames(features, screens, screen.id);
1047
1367
  return Object.entries(controlMap).flatMap(([branchId, control]) => {
1048
- if (control.type !== import_codegen16.ControlType.VARIANT_BRANCH) return [];
1368
+ if (control.type !== import_codegen20.ControlType.VARIANT_BRANCH) return [];
1049
1369
  return unreachableArmIds(branchId, controlMap).map((armId) => ({
1050
1370
  subject: armSubject(controlMap[armId], names),
1051
1371
  target: {
@@ -1067,7 +1387,7 @@ var branchArmReachable = defineInvariant({
1067
1387
  });
1068
1388
 
1069
1389
  // apps/m-one-ui/src/app/pages/design/lib/invariants/computed-args-bound.ts
1070
- var import_codegen17 = require("./index.js");
1390
+ var import_codegen21 = require("./index.js");
1071
1391
  var computedArgsBound = defineInvariant({
1072
1392
  name: "computed-args-bound",
1073
1393
  message: "invariant-computed-args-unbound",
@@ -1075,21 +1395,21 @@ var computedArgsBound = defineInvariant({
1075
1395
  deps: ["features", "screens", "functions"],
1076
1396
  validate: ({ features, screens, functions }) => {
1077
1397
  const scopeFor = (featureId) => featureId ? { ...functions, ...features[featureId]?.functions ?? {} } : functions;
1078
- const broken = (fn, args) => !fn || !(0, import_codegen17.argsComplete)(fn, args);
1398
+ const broken = (fn, args) => !fn || !(0, import_codegen21.argsComplete)(fn, args);
1079
1399
  const stateFindings = Object.values(features).flatMap((feature) => {
1080
1400
  const fns = scopeFor(feature.id);
1081
1401
  const screenId = screens.find((screen) => screen.featureId === feature.id)?.id ?? "";
1082
- return Object.values(feature.computeds ?? {}).filter((computed) => broken((0, import_codegen17.stateComputedFunction)(computed, fns), computed.args)).map((computed) => ({
1402
+ return Object.values(feature.computeds ?? {}).filter((computed) => broken((0, import_codegen21.stateComputedFunction)(computed, fns), computed.args)).map((computed) => ({
1083
1403
  subject: `${feature.name}.${computed.name}`,
1084
1404
  target: { kind: "screen", screenId }
1085
1405
  }));
1086
1406
  });
1087
1407
  const screenFindings = screens.flatMap((screen) => {
1088
1408
  const fns = scopeFor(
1089
- (0, import_codegen17.isFeatureScreen)(screen) ? screen.featureId : void 0
1409
+ (0, import_codegen21.isFeatureScreen)(screen) ? screen.featureId : void 0
1090
1410
  );
1091
1411
  return Object.values(screen.computeds ?? {}).filter(
1092
- (computed) => broken((0, import_codegen17.screenComputedFunction)(computed, fns), computed.args)
1412
+ (computed) => broken((0, import_codegen21.screenComputedFunction)(computed, fns), computed.args)
1093
1413
  ).map((computed) => ({
1094
1414
  subject: `${screen.name}.${computed.name}`,
1095
1415
  target: { kind: "screen", screenId: screen.id }
@@ -1100,7 +1420,7 @@ var computedArgsBound = defineInvariant({
1100
1420
  });
1101
1421
 
1102
1422
  // apps/m-one-ui/src/app/pages/design/lib/invariants/computed-args-typed.ts
1103
- var import_codegen18 = require("./index.js");
1423
+ var import_codegen22 = require("./index.js");
1104
1424
  var computedArgsTyped = defineInvariant({
1105
1425
  name: "computed-args-typed",
1106
1426
  message: "invariant-computed-args-mistyped",
@@ -1111,7 +1431,7 @@ var computedArgsTyped = defineInvariant({
1111
1431
  const stateFindings = Object.values(features).flatMap((feature) => {
1112
1432
  const fns = scopeFor(feature.id);
1113
1433
  const screenId = screens.find((screen) => screen.featureId === feature.id)?.id ?? "";
1114
- const roots = (0, import_codegen18.propertiesWithComputeds)(
1434
+ const roots = (0, import_codegen22.propertiesWithComputeds)(
1115
1435
  feature.properties,
1116
1436
  feature.computeds,
1117
1437
  fns
@@ -1124,7 +1444,7 @@ var computedArgsTyped = defineInvariant({
1124
1444
  )
1125
1445
  ).filter((computed) => {
1126
1446
  const fn = fns[computed.functionId];
1127
- return !!fn && (0, import_codegen18.mistypedStateArgs)(fn, computed.args, roots, feature.shapes).length > 0;
1447
+ return !!fn && (0, import_codegen22.mistypedStateArgs)(fn, computed.args, roots, feature.shapes).length > 0;
1128
1448
  }).map((computed) => ({
1129
1449
  subject: `${feature.name}.${computed.name}`,
1130
1450
  target: { kind: "screen", screenId },
@@ -1133,27 +1453,27 @@ var computedArgsTyped = defineInvariant({
1133
1453
  featureId: feature.id,
1134
1454
  functionId: computed.functionId,
1135
1455
  params: fns[computed.functionId].params.map((param) => {
1136
- const held = (0, import_codegen18.stateComputedArgHeldType)(
1456
+ const held = (0, import_codegen22.stateComputedArgHeldType)(
1137
1457
  computed.args[param.id],
1138
1458
  roots,
1139
1459
  feature.shapes
1140
1460
  );
1141
- return held && !(0, import_codegen18.argAnswersParam)(held, param, feature.shapes) ? { ...param, ...held } : param;
1461
+ return held && !(0, import_codegen22.argAnswersParam)(held, param, feature.shapes) ? { ...param, ...held } : param;
1142
1462
  })
1143
1463
  }
1144
1464
  }));
1145
1465
  });
1146
1466
  const screenFindings = screens.flatMap((screen) => {
1147
- const featureId = (0, import_codegen18.isFeatureScreen)(screen) ? screen.featureId : void 0;
1467
+ const featureId = (0, import_codegen22.isFeatureScreen)(screen) ? screen.featureId : void 0;
1148
1468
  const fns = scopeFor(featureId);
1149
1469
  const feature = featureId ? features[featureId] : void 0;
1150
1470
  const scope = {
1151
1471
  constants: screen.constants,
1152
- variables: (0, import_codegen18.withVariableEnums)(
1472
+ variables: (0, import_codegen22.withVariableEnums)(
1153
1473
  screen.variables ?? {},
1154
1474
  screenControlMaps[screen.id] ?? {}
1155
1475
  ),
1156
- properties: feature ? (0, import_codegen18.propertiesWithComputeds)(
1476
+ properties: feature ? (0, import_codegen22.propertiesWithComputeds)(
1157
1477
  feature.properties,
1158
1478
  feature.computeds,
1159
1479
  fns
@@ -1161,9 +1481,9 @@ var computedArgsTyped = defineInvariant({
1161
1481
  shapes: feature?.shapes ?? {}
1162
1482
  };
1163
1483
  return Object.values(screen.computeds ?? {}).filter((computed) => {
1164
- if ((0, import_codegen18.isOneFunctionComputed)(computed)) return false;
1165
- const fn = (0, import_codegen18.screenComputedFunction)(computed, fns);
1166
- return !!fn && (0, import_codegen18.mistypedScreenArgs)(
1484
+ if ((0, import_codegen22.isOneFunctionComputed)(computed)) return false;
1485
+ const fn = (0, import_codegen22.screenComputedFunction)(computed, fns);
1486
+ return !!fn && (0, import_codegen22.mistypedScreenArgs)(
1167
1487
  fn,
1168
1488
  computed.args,
1169
1489
  screen.inputs ?? {},
@@ -1172,24 +1492,24 @@ var computedArgsTyped = defineInvariant({
1172
1492
  scope
1173
1493
  ).length > 0;
1174
1494
  }).map((computed) => {
1175
- const fn = (0, import_codegen18.screenComputedFunction)(computed, fns);
1495
+ const fn = (0, import_codegen22.screenComputedFunction)(computed, fns);
1176
1496
  const params = fn.params.map((param) => {
1177
1497
  const arg = computed.args[param.id];
1178
- const shapeId = arg?.source === "options" ? (0, import_codegen18.findOptionRowShapeId)(scope.shapes) : void 0;
1498
+ const shapeId = arg?.source === "options" ? (0, import_codegen22.findOptionRowShapeId)(scope.shapes) : void 0;
1179
1499
  const held = shapeId ? {
1180
1500
  dataType: { type: "shape", shapeId },
1181
1501
  cardinality: "many"
1182
- } : (0, import_codegen18.screenComputedArgHeldType)(
1502
+ } : (0, import_codegen22.screenComputedArgHeldType)(
1183
1503
  arg,
1184
1504
  screen.inputs ?? {},
1185
1505
  screen.computeds ?? {},
1186
1506
  fns,
1187
1507
  scope
1188
1508
  );
1189
- return held && !(0, import_codegen18.argAnswersParam)(held, param, scope.shapes) ? { ...param, ...held } : param;
1509
+ return held && !(0, import_codegen22.argAnswersParam)(held, param, scope.shapes) ? { ...param, ...held } : param;
1190
1510
  });
1191
1511
  const repaired = { ...fn, params };
1192
- const canFix = !(0, import_codegen18.isPassthroughComputed)(computed) && !(0, import_codegen18.isOneFunctionComputed)(computed) && (0, import_codegen18.mistypedScreenArgs)(
1512
+ const canFix = !(0, import_codegen22.isPassthroughComputed)(computed) && !(0, import_codegen22.isOneFunctionComputed)(computed) && (0, import_codegen22.mistypedScreenArgs)(
1193
1513
  repaired,
1194
1514
  computed.args,
1195
1515
  screen.inputs ?? {},
@@ -1216,7 +1536,7 @@ var computedArgsTyped = defineInvariant({
1216
1536
  });
1217
1537
 
1218
1538
  // apps/m-one-ui/src/app/pages/design/lib/invariants/one-function-arg-mismatch.ts
1219
- var import_codegen19 = require("./index.js");
1539
+ var import_codegen23 = require("./index.js");
1220
1540
  var sameDataType = (a, b) => a.type === "shape" ? b.type === "shape" && a.shapeId === b.shapeId : a.type === "form" ? b.type === "form" && a.formId === b.formId : a.type === b.type;
1221
1541
  var oneFunctionArgMismatch = defineInvariant({
1222
1542
  name: "one-function-arg-mismatch",
@@ -1225,24 +1545,24 @@ var oneFunctionArgMismatch = defineInvariant({
1225
1545
  deps: ["features", "screens", "functions"],
1226
1546
  validate: ({ features, screens, functions }) => [
1227
1547
  ...screens.flatMap((screen) => {
1228
- const featureId = (0, import_codegen19.isFeatureScreen)(screen) ? screen.featureId : void 0;
1548
+ const featureId = (0, import_codegen23.isFeatureScreen)(screen) ? screen.featureId : void 0;
1229
1549
  const feature = featureId ? features[featureId] : void 0;
1230
1550
  const fns = feature ? { ...functions, ...feature.functions ?? {} } : functions;
1231
1551
  const scope = {
1232
1552
  constants: screen.constants,
1233
1553
  variables: screen.variables,
1234
- properties: feature ? (0, import_codegen19.propertiesWithComputeds)(feature.properties, feature.computeds, fns) : {},
1554
+ properties: feature ? (0, import_codegen23.propertiesWithComputeds)(feature.properties, feature.computeds, fns) : {},
1235
1555
  shapes: feature?.shapes ?? {}
1236
1556
  };
1237
- return Object.values(screen.computeds ?? {}).filter(import_codegen19.isOneFunctionComputed).filter((computed) => {
1238
- const entry = (0, import_codegen19.oneFunctionOf)(computed.oneFunction);
1557
+ return Object.values(screen.computeds ?? {}).filter(import_codegen23.isOneFunctionComputed).filter((computed) => {
1558
+ const entry = (0, import_codegen23.oneFunctionOf)(computed.oneFunction);
1239
1559
  const returns = computed.returns;
1240
1560
  if (!entry || !returns) return false;
1241
1561
  if (!feature) return true;
1242
1562
  return entry.params.some((param) => {
1243
1563
  const arg = computed.args[param.id];
1244
1564
  if (!arg) return false;
1245
- const held = (0, import_codegen19.screenComputedArgHeldType)(
1565
+ const held = (0, import_codegen23.screenComputedArgHeldType)(
1246
1566
  arg,
1247
1567
  screen.inputs ?? {},
1248
1568
  screen.computeds ?? {},
@@ -1250,11 +1570,11 @@ var oneFunctionArgMismatch = defineInvariant({
1250
1570
  scope
1251
1571
  );
1252
1572
  if (!held) return false;
1253
- if (!(0, import_codegen19.oneFunctionArgFits)(param, held, arg.source === "path"))
1573
+ if (!(0, import_codegen23.oneFunctionArgFits)(param, held, arg.source === "path"))
1254
1574
  return true;
1255
1575
  return entry.returnsRow && param.id === entry.rowParamId && (!sameDataType(held.dataType, returns.dataType) || // A `map` turned `map-many` (or back) moves the return
1256
1576
  // between the row and the row list (ADR 0205).
1257
- (0, import_codegen19.oneFunctionReturns)(entry, held.dataType, held.cardinality).cardinality !== returns.cardinality);
1577
+ (0, import_codegen23.oneFunctionReturns)(entry, held.dataType, held.cardinality).cardinality !== returns.cardinality);
1258
1578
  });
1259
1579
  }).map((computed) => ({
1260
1580
  subject: `${screen.name}.${computed.name}`,
@@ -1277,32 +1597,32 @@ var oneFunctionArgMismatch = defineInvariant({
1277
1597
  });
1278
1598
  function stateComputedFindings(feature, functions) {
1279
1599
  const fns = { ...functions, ...feature.functions ?? {} };
1280
- const stores = (0, import_codegen19.storesOf)(feature);
1600
+ const stores = (0, import_codegen23.storesOf)(feature);
1281
1601
  const roots = Object.assign(
1282
1602
  {},
1283
1603
  ...stores.map(
1284
- (owned) => (0, import_codegen19.propertiesWithComputeds)(owned.properties, owned.computeds, fns)
1604
+ (owned) => (0, import_codegen23.propertiesWithComputeds)(owned.properties, owned.computeds, fns)
1285
1605
  )
1286
1606
  );
1287
1607
  return stores.flatMap(
1288
- (owned) => Object.values(owned.computeds).filter(import_codegen19.isOneFunctionStateComputed).filter((computed) => {
1289
- const entry = (0, import_codegen19.oneFunctionOf)(computed.oneFunction);
1608
+ (owned) => Object.values(owned.computeds).filter(import_codegen23.isOneFunctionStateComputed).filter((computed) => {
1609
+ const entry = (0, import_codegen23.oneFunctionOf)(computed.oneFunction);
1290
1610
  const returns = computed.returns;
1291
1611
  if (!entry?.reach.includes("state-computed") || !returns) return false;
1292
1612
  const rowArg = computed.args[entry.rowParamId];
1293
- const row = rowArg?.source === "path" ? (0, import_codegen19.statePathHeldType)(rowArg.path, roots, feature.shapes) : void 0;
1613
+ const row = rowArg?.source === "path" ? (0, import_codegen23.statePathHeldType)(rowArg.path, roots, feature.shapes) : void 0;
1294
1614
  const fits = entry.params.every((param) => {
1295
1615
  const arg = computed.args[param.id];
1296
1616
  if (!arg) return true;
1297
- const held = arg.source === "fixed" ? (0, import_codegen19.oneParamFixedHeld)(param, arg.value) : (0, import_codegen19.statePathHeldType)(arg.path, roots, feature.shapes);
1617
+ const held = arg.source === "fixed" ? (0, import_codegen23.oneParamFixedHeld)(param, arg.value) : (0, import_codegen23.statePathHeldType)(arg.path, roots, feature.shapes);
1298
1618
  if (arg.source === "path" && !held) return true;
1299
- return (0, import_codegen19.oneFunctionArgFits)(param, held, arg.source === "path");
1619
+ return (0, import_codegen23.oneFunctionArgFits)(param, held, arg.source === "path");
1300
1620
  });
1301
1621
  if (!fits) return true;
1302
- if (entry.returnsRow && row && (!sameDataType(row.dataType, returns.dataType) || (0, import_codegen19.oneFunctionReturns)(entry, row.dataType, row.cardinality).cardinality !== returns.cardinality))
1622
+ if (entry.returnsRow && row && (!sameDataType(row.dataType, returns.dataType) || (0, import_codegen23.oneFunctionReturns)(entry, row.dataType, row.cardinality).cardinality !== returns.cardinality))
1303
1623
  return true;
1304
- const key = computed.args[import_codegen19.ONE_FUNCTION_KEY_PARAM];
1305
- if (key?.source === "fixed" && entry.params.some((param) => param.id === import_codegen19.ONE_FUNCTION_KEY_PARAM) && row?.dataType.type === "shape") {
1624
+ const key = computed.args[import_codegen23.ONE_FUNCTION_KEY_PARAM];
1625
+ if (key?.source === "fixed" && entry.params.some((param) => param.id === import_codegen23.ONE_FUNCTION_KEY_PARAM) && row?.dataType.type === "shape") {
1306
1626
  const shape = feature.shapes[row.dataType.shapeId];
1307
1627
  return !!shape && !shape.keys.some(
1308
1628
  (member) => member.name === key.value && member.cardinality === "one" && member.dataType.type === "string"
@@ -1323,36 +1643,36 @@ function stateComputedFindings(feature, functions) {
1323
1643
  }
1324
1644
  function conditionFindings(feature, functions) {
1325
1645
  const fns = { ...functions, ...feature.functions ?? {} };
1326
- const stores = (0, import_codegen19.storesOf)(feature);
1646
+ const stores = (0, import_codegen23.storesOf)(feature);
1327
1647
  const roots = Object.assign(
1328
1648
  {},
1329
1649
  ...stores.map(
1330
- (owned) => (0, import_codegen19.propertiesWithComputeds)(owned.properties, owned.computeds, fns)
1650
+ (owned) => (0, import_codegen23.propertiesWithComputeds)(owned.properties, owned.computeds, fns)
1331
1651
  )
1332
1652
  );
1333
1653
  const mismatched = (condition) => {
1334
1654
  if (!condition.oneFunction) return false;
1335
- const entry = (0, import_codegen19.oneFunctionOf)(condition.oneFunction);
1655
+ const entry = (0, import_codegen23.oneFunctionOf)(condition.oneFunction);
1336
1656
  if (!entry?.reach.includes("call-condition")) return true;
1337
1657
  return entry.params.some((param) => {
1338
1658
  const binding = condition.args[param.id];
1339
1659
  if (binding?.source !== "store") return false;
1340
- const held = (0, import_codegen19.statePathHeldType)(binding.path, roots, feature.shapes);
1341
- return !!held && !(0, import_codegen19.oneFunctionArgFits)(param, held, true);
1660
+ const held = (0, import_codegen23.statePathHeldType)(binding.path, roots, feature.shapes);
1661
+ return !!held && !(0, import_codegen23.oneFunctionArgFits)(param, held, true);
1342
1662
  });
1343
1663
  };
1344
1664
  const computeMismatched = (compute) => {
1345
1665
  if (!compute.oneFunction) return false;
1346
- const entry = (0, import_codegen19.oneFunctionOf)(compute.oneFunction);
1666
+ const entry = (0, import_codegen23.oneFunctionOf)(compute.oneFunction);
1347
1667
  if (!entry?.reach.includes("call-compute") || !compute.returns) return true;
1348
1668
  const returns = compute.returns;
1349
1669
  return entry.params.some((param) => {
1350
1670
  const binding = compute.args[param.id];
1351
1671
  if (binding?.source !== "store") return false;
1352
- const held = (0, import_codegen19.statePathHeldType)(binding.path, roots, feature.shapes);
1672
+ const held = (0, import_codegen23.statePathHeldType)(binding.path, roots, feature.shapes);
1353
1673
  if (!held) return false;
1354
- if (!(0, import_codegen19.oneFunctionArgFits)(param, held, true)) return true;
1355
- return entry.returnsRow && param.id === entry.rowParamId && (!sameDataType(held.dataType, returns.dataType) || (0, import_codegen19.oneFunctionReturns)(entry, held.dataType, held.cardinality).cardinality !== returns.cardinality);
1674
+ if (!(0, import_codegen23.oneFunctionArgFits)(param, held, true)) return true;
1675
+ return entry.returnsRow && param.id === entry.rowParamId && (!sameDataType(held.dataType, returns.dataType) || (0, import_codegen23.oneFunctionReturns)(entry, held.dataType, held.cardinality).cardinality !== returns.cardinality);
1356
1676
  });
1357
1677
  };
1358
1678
  return stores.flatMap(
@@ -1372,7 +1692,7 @@ function conditionFindings(feature, functions) {
1372
1692
  }
1373
1693
 
1374
1694
  // apps/m-one-ui/src/app/pages/design/lib/invariants/one-function-required-param.ts
1375
- var import_codegen20 = require("./index.js");
1695
+ var import_codegen24 = require("./index.js");
1376
1696
  var requiresParam = (method, name) => (method.params ?? []).some(
1377
1697
  (param) => param.name === name && param.required === true
1378
1698
  ) || method.inputs.some(
@@ -1384,12 +1704,12 @@ var oneFunctionRequiredParam = defineInvariant({
1384
1704
  severity: "blocking",
1385
1705
  deps: ["features", "screens", "screenControlMaps"],
1386
1706
  validate: ({ features, screens, screenControlMaps }) => screens.flatMap((screen) => {
1387
- if (!(0, import_codegen20.isFeatureScreen)(screen)) return [];
1707
+ if (!(0, import_codegen24.isFeatureScreen)(screen)) return [];
1388
1708
  const feature = features[screen.featureId];
1389
1709
  if (!feature) return [];
1390
1710
  const methods = Object.assign(
1391
1711
  {},
1392
- ...(0, import_codegen20.storesOf)(feature).map((owned) => owned.methods)
1712
+ ...(0, import_codegen24.storesOf)(feature).map((owned) => owned.methods)
1393
1713
  );
1394
1714
  const computeds = screen.computeds ?? {};
1395
1715
  return Object.values(screenControlMaps[screen.id] ?? {}).flatMap(
@@ -1403,7 +1723,7 @@ var oneFunctionRequiredParam = defineInvariant({
1403
1723
  return false;
1404
1724
  const computed = computeds[root.id];
1405
1725
  const name = row.target[0];
1406
- return !!computed && (0, import_codegen20.isOneFunctionComputed)(computed) && (0, import_codegen20.screenComputedFunction)(computed, {})?.returnUndefined === true && !!name && requiresParam(method, name);
1726
+ return !!computed && (0, import_codegen24.isOneFunctionComputed)(computed) && (0, import_codegen24.screenComputedFunction)(computed, {})?.returnUndefined === true && !!name && requiresParam(method, name);
1407
1727
  }).map((row) => ({
1408
1728
  subject: `${screen.name}.${method.name}(${row.target[0]})`,
1409
1729
  target: {
@@ -1419,7 +1739,7 @@ var oneFunctionRequiredParam = defineInvariant({
1419
1739
  });
1420
1740
 
1421
1741
  // apps/m-one-ui/src/app/pages/design/lib/invariants/confirm-unattended-call.ts
1422
- var import_codegen21 = require("./index.js");
1742
+ var import_codegen25 = require("./index.js");
1423
1743
  var confirmUnattendedCall = defineInvariant({
1424
1744
  name: "confirm-unattended-call",
1425
1745
  message: "invariant-confirm-unattended",
@@ -1429,7 +1749,7 @@ var confirmUnattendedCall = defineInvariant({
1429
1749
  const featureScreen = (featureId) => screens.find((screen) => screen.featureId === featureId)?.id ?? "";
1430
1750
  return Object.values(features).flatMap((feature) => {
1431
1751
  const asking = new Set(
1432
- Object.values(feature.methods).filter((method) => !!(0, import_codegen21.drawnConfirm)(method)).map((method) => method.id)
1752
+ Object.values(feature.methods).filter((method) => !!(0, import_codegen25.drawnConfirm)(method)).map((method) => method.id)
1433
1753
  );
1434
1754
  if (!asking.size) return [];
1435
1755
  const named2 = (methodId) => feature.methods[methodId]?.name ?? methodId;
@@ -1463,15 +1783,15 @@ var confirmUnattendedCall = defineInvariant({
1463
1783
  });
1464
1784
 
1465
1785
  // apps/m-one-ui/src/app/pages/design/lib/invariants/close-overlay-off-overlay.ts
1466
- var import_codegen23 = require("./index.js");
1786
+ var import_codegen27 = require("./index.js");
1467
1787
 
1468
1788
  // apps/m-one-ui/src/app/pages/design/lib/screen-link.ts
1469
- var import_codegen22 = require("./index.js");
1789
+ var import_codegen26 = require("./index.js");
1470
1790
  function overlayLinks(fromScreenId, map) {
1471
1791
  const links = [];
1472
1792
  Object.values(map).forEach((control) => {
1473
1793
  Object.entries(control.directives ?? {}).forEach(([name, directive]) => {
1474
- if (!(0, import_codegen22.isOverlayDirectiveName)(name)) return;
1794
+ if (!(0, import_codegen26.isOverlayDirectiveName)(name)) return;
1475
1795
  const configs = directive.overlayId ? map[directive.overlayId]?.configs : directive.configs;
1476
1796
  const component = configs?.["component"];
1477
1797
  if (typeof component !== "string" || !component) return;
@@ -1485,7 +1805,7 @@ function overlayLinks(fromScreenId, map) {
1485
1805
  });
1486
1806
  return links;
1487
1807
  }
1488
- var cardKind = (control) => control.type === import_codegen22.ControlType.SECTION_CAROUSEL ? "carousel-element" : "card-element";
1808
+ var cardKind = (control) => control.type === import_codegen26.ControlType.SECTION_CAROUSEL ? "carousel-element" : "card-element";
1489
1809
  function controlMapLinks(fromScreenId, map) {
1490
1810
  const links = [];
1491
1811
  Object.values(map).forEach((control) => {
@@ -1507,7 +1827,7 @@ function controlMapLinks(fromScreenId, map) {
1507
1827
  });
1508
1828
  }
1509
1829
  Object.keys(control.outputOpens ?? {}).forEach((output) => {
1510
- const screenId = (0, import_codegen22.outputOpenOf)(control.outputOpens, output)?.screenId;
1830
+ const screenId = (0, import_codegen26.outputOpenOf)(control.outputOpens, output)?.screenId;
1511
1831
  if (!screenId) return;
1512
1832
  links.push({
1513
1833
  kind: "output-open",
@@ -1613,7 +1933,7 @@ var closeOverlayOffOverlay = defineInvariant({
1613
1933
  const closing = screens.map((screen) => ({
1614
1934
  screen,
1615
1935
  controls: Object.values(screenControlMaps[screen.id] ?? {}).filter(
1616
- import_codegen23.controlUsesOverlayRef
1936
+ import_codegen27.controlUsesOverlayRef
1617
1937
  )
1618
1938
  })).filter(({ controls }) => controls.length);
1619
1939
  if (!closing.length) return [];
@@ -1636,7 +1956,7 @@ var closeOverlayOffOverlay = defineInvariant({
1636
1956
  });
1637
1957
 
1638
1958
  // apps/m-one-ui/src/app/pages/design/lib/invariants/outcome-unattended-call.ts
1639
- var import_codegen24 = require("./index.js");
1959
+ var import_codegen28 = require("./index.js");
1640
1960
  var outcomeUnattendedCall = defineInvariant({
1641
1961
  name: "outcome-on-unattended-call",
1642
1962
  message: "invariant-outcome-unattended",
@@ -1648,7 +1968,7 @@ var outcomeUnattendedCall = defineInvariant({
1648
1968
  validate: ({ features, screens, screenControlMaps }) => {
1649
1969
  const featureScreen = (featureId) => screens.find((screen) => screen.featureId === featureId)?.id ?? "";
1650
1970
  return Object.values(features).flatMap((feature) => {
1651
- const armed = (0, import_codegen24.methodArms)(
1971
+ const armed = (0, import_codegen28.methodArms)(
1652
1972
  screens.filter((screen) => screen.featureId === feature.id).map((screen) => screenControlMaps[screen.id] ?? {})
1653
1973
  );
1654
1974
  const wired = new Set(Object.keys(armed));
@@ -1684,21 +2004,21 @@ var outcomeUnattendedCall = defineInvariant({
1684
2004
  });
1685
2005
 
1686
2006
  // apps/m-one-ui/src/app/pages/design/lib/invariants/outcome-call-nested.ts
1687
- var import_codegen25 = require("./index.js");
2007
+ var import_codegen29 = require("./index.js");
1688
2008
  var outcomeCallNested = defineInvariant({
1689
2009
  name: "outcome-call-nested",
1690
2010
  message: "invariant-outcome-call-nested",
1691
2011
  severity: "advisory",
1692
2012
  deps: ["screens", "screenControlMaps"],
1693
2013
  validate: ({ screens, screenControlMaps }) => screens.flatMap((screen) => {
1694
- const onScreen = (outcomes) => outcomes.flatMap(import_codegen25.nestedOutcomeCalls).map((id) => ({
2014
+ const onScreen = (outcomes) => outcomes.flatMap(import_codegen29.nestedOutcomeCalls).map((id) => ({
1695
2015
  subject: `${screen.name} \u2192 ${id}`,
1696
2016
  target: { kind: "screen", screenId: screen.id }
1697
2017
  }));
1698
2018
  const onControls = Object.values(
1699
2019
  screenControlMaps[screen.id] ?? {}
1700
2020
  ).flatMap(
1701
- (control) => Object.values(control.outputOutcomes ?? {}).flatMap(import_codegen25.nestedOutcomeCalls).map((id) => ({
2021
+ (control) => Object.values(control.outputOutcomes ?? {}).flatMap(import_codegen29.nestedOutcomeCalls).map((id) => ({
1702
2022
  subject: `${screen.name} \u2192 ${control.id} \u2192 ${id}`,
1703
2023
  target: {
1704
2024
  kind: "control",
@@ -1753,7 +2073,7 @@ var reactionWritesOwnWatch = defineInvariant({
1753
2073
  });
1754
2074
 
1755
2075
  // apps/m-one-ui/src/app/pages/design/lib/invariants/outcome-nav-complete.ts
1756
- var import_codegen26 = require("./index.js");
2076
+ var import_codegen30 = require("./index.js");
1757
2077
  var outcomeNavComplete = defineInvariant({
1758
2078
  name: "outcome-nav-complete",
1759
2079
  message: "invariant-outcome-nav-incomplete",
@@ -1763,10 +2083,10 @@ var outcomeNavComplete = defineInvariant({
1763
2083
  const controlMap = screenControlMaps[screen.id] ?? {};
1764
2084
  return Object.values(controlMap).flatMap((control) => {
1765
2085
  const broken = Object.values(control.outputOutcomes ?? {}).some(
1766
- (outcome) => import_codegen26.OUTCOME_ARMS.some(
1767
- (arm) => !!(0, import_codegen26.validateOutcomeNav)(outcome?.[arm]?.nav, navMap)
2086
+ (outcome) => import_codegen30.OUTCOME_ARMS.some(
2087
+ (arm) => !!(0, import_codegen30.validateOutcomeNav)(outcome?.[arm]?.nav, navMap)
1768
2088
  )
1769
- ) || (0, import_codegen26.controlNavReferences)(control).some(
2089
+ ) || (0, import_codegen30.controlNavReferences)(control).some(
1770
2090
  (row) => row.some((navId) => !navMap[navId])
1771
2091
  );
1772
2092
  if (!broken) return [];
@@ -1785,7 +2105,7 @@ var outcomeNavComplete = defineInvariant({
1785
2105
  });
1786
2106
 
1787
2107
  // apps/m-one-ui/src/app/pages/design/lib/invariants/field-check-bound.ts
1788
- var import_codegen27 = require("./index.js");
2108
+ var import_codegen31 = require("./index.js");
1789
2109
  var fieldCheckBound = defineInvariant({
1790
2110
  name: "field-check-bound",
1791
2111
  message: "invariant-field-check-unbound",
@@ -1799,9 +2119,9 @@ var unboundChecks = perScreen(
1799
2119
  features,
1800
2120
  functions
1801
2121
  }) => {
1802
- const feature = (0, import_codegen27.isFeatureScreen)(screen) ? features[screen.featureId] : void 0;
2122
+ const feature = (0, import_codegen31.isFeatureScreen)(screen) ? features[screen.featureId] : void 0;
1803
2123
  const properties = feature?.properties ?? {};
1804
- const sources = (0, import_codegen27.limitSources)({
2124
+ const sources = (0, import_codegen31.limitSources)({
1805
2125
  inputs: screen.inputs,
1806
2126
  constants: screen.constants,
1807
2127
  variables: screen.variables,
@@ -1811,13 +2131,13 @@ var unboundChecks = perScreen(
1811
2131
  functions: { ...functions, ...feature?.functions ?? {} }
1812
2132
  });
1813
2133
  return Object.entries(controlMap).flatMap(([controlId, control]) => {
1814
- if (control.type !== import_codegen27.ControlType.FIELD) return [];
1815
- const checks = (0, import_codegen27.fieldChecks)(control);
2134
+ if (control.type !== import_codegen31.ControlType.FIELD) return [];
2135
+ const checks = (0, import_codegen31.fieldChecks)(control);
1816
2136
  if (!checks.length) return [];
1817
- const formId = (0, import_codegen27.owningFormId)(controlId, controlMap);
2137
+ const formId = (0, import_codegen31.owningFormId)(controlId, controlMap);
1818
2138
  const broken = checks.some((check) => {
1819
- if ((0, import_codegen27.checkKind)(check) !== "function") {
1820
- return !(0, import_codegen27.isCheckComplete)(
2139
+ if ((0, import_codegen31.checkKind)(check) !== "function") {
2140
+ return !(0, import_codegen31.isCheckComplete)(
1821
2141
  check,
1822
2142
  functions,
1823
2143
  controlMap,
@@ -1827,15 +2147,15 @@ var unboundChecks = perScreen(
1827
2147
  }
1828
2148
  const fn = functions[check.functionId];
1829
2149
  if (!fn) return true;
1830
- if (!(0, import_codegen27.isFieldCheckEligible)(fn)) return true;
1831
- const writtenFor = (0, import_codegen27.fieldCheckFormId)(fn);
2150
+ if (!(0, import_codegen31.isFieldCheckEligible)(fn)) return true;
2151
+ const writtenFor = (0, import_codegen31.fieldCheckFormId)(fn);
1832
2152
  if (writtenFor && writtenFor !== formId) return true;
1833
- return !(0, import_codegen27.isCheckComplete)(check, functions, controlMap, properties);
2153
+ return !(0, import_codegen31.isCheckComplete)(check, functions, controlMap, properties);
1834
2154
  });
1835
2155
  if (!broken) return [];
1836
2156
  return [
1837
2157
  {
1838
- subject: (0, import_codegen27.resolveFieldName)({
2158
+ subject: (0, import_codegen31.resolveFieldName)({
1839
2159
  id: controlId,
1840
2160
  configs: control.configs
1841
2161
  }),
@@ -1851,7 +2171,7 @@ var unboundChecks = perScreen(
1851
2171
  );
1852
2172
 
1853
2173
  // apps/m-one-ui/src/app/pages/design/lib/invariants/function-case-args.ts
1854
- var import_codegen28 = require("./index.js");
2174
+ var import_codegen32 = require("./index.js");
1855
2175
  var functionCaseArgs = defineInvariant({
1856
2176
  name: "function-case-args",
1857
2177
  message: "invariant-function-case-args",
@@ -1860,20 +2180,20 @@ var functionCaseArgs = defineInvariant({
1860
2180
  validate: ({ features, functions, sharedShapes }) => {
1861
2181
  const shared = sharedShapes ?? {};
1862
2182
  return [
1863
- ...(0, import_codegen28.listFunctions)(functions).map((fn) => ({
2183
+ ...(0, import_codegen32.listFunctions)(functions).map((fn) => ({
1864
2184
  fn,
1865
2185
  featureId: void 0,
1866
- shapes: (0, import_codegen28.shapesInReach)(void 0, shared)
2186
+ shapes: (0, import_codegen32.shapesInReach)(void 0, shared)
1867
2187
  })),
1868
2188
  ...Object.values(features).flatMap(
1869
- (feature) => (0, import_codegen28.listFunctions)(feature.functions).map((fn) => ({
2189
+ (feature) => (0, import_codegen32.listFunctions)(feature.functions).map((fn) => ({
1870
2190
  fn,
1871
2191
  featureId: feature.id,
1872
- shapes: (0, import_codegen28.shapesInReach)(feature, shared)
2192
+ shapes: (0, import_codegen32.shapesInReach)(feature, shared)
1873
2193
  }))
1874
2194
  )
1875
- ].filter(({ fn, shapes }) => (0, import_codegen28.staleCases)(fn, shapes).length > 0).map(({ fn, featureId, shapes }) => ({
1876
- subject: `${fn.name}: ${(0, import_codegen28.staleCases)(fn, shapes).map((entry) => entry.name).join(", ")}`,
2195
+ ].filter(({ fn, shapes }) => (0, import_codegen32.staleCases)(fn, shapes).length > 0).map(({ fn, featureId, shapes }) => ({
2196
+ subject: `${fn.name}: ${(0, import_codegen32.staleCases)(fn, shapes).map((entry) => entry.name).join(", ")}`,
1877
2197
  target: {
1878
2198
  kind: "function",
1879
2199
  ...featureId ? { featureId } : {},
@@ -1884,7 +2204,7 @@ var functionCaseArgs = defineInvariant({
1884
2204
  });
1885
2205
 
1886
2206
  // apps/m-one-ui/src/app/pages/design/lib/invariants/filter-group-squeeze-orphan.ts
1887
- var import_codegen29 = require("./index.js");
2207
+ var import_codegen33 = require("./index.js");
1888
2208
  var orphanIds = (groupId, controlMap) => {
1889
2209
  const found = [];
1890
2210
  const seen = /* @__PURE__ */ new Set();
@@ -1894,8 +2214,8 @@ var orphanIds = (groupId, controlMap) => {
1894
2214
  for (const childId of controlMap[id]?.childrens ?? []) {
1895
2215
  const child = controlMap[childId];
1896
2216
  if (!child) continue;
1897
- if (child.type === import_codegen29.ControlType.SECTION_FILTER) continue;
1898
- if (child.type === import_codegen29.ControlType.COL) {
2217
+ if (child.type === import_codegen33.ControlType.SECTION_FILTER) continue;
2218
+ if (child.type === import_codegen33.ControlType.COL) {
1899
2219
  walk(childId);
1900
2220
  continue;
1901
2221
  }
@@ -1915,12 +2235,12 @@ var filterGroupSqueezeOrphan = defineInvariant({
1915
2235
  });
1916
2236
  var squeezedOrphans = perScreen(
1917
2237
  (controlMap, screen) => Object.entries(controlMap).flatMap(([groupId, control]) => {
1918
- if (control.type !== import_codegen29.ControlType.SECTION_FILTER_GROUP) return [];
2238
+ if (control.type !== import_codegen33.ControlType.SECTION_FILTER_GROUP) return [];
1919
2239
  const parentId = control.parentId;
1920
- const squeezed = !!control.configs?.["squeeze"] || !!parentId && controlMap[parentId]?.type === import_codegen29.ControlType.SECTION_HEADER;
2240
+ const squeezed = !!control.configs?.["squeeze"] || !!parentId && controlMap[parentId]?.type === import_codegen33.ControlType.SECTION_HEADER;
1921
2241
  if (!squeezed) return [];
1922
2242
  return orphanIds(groupId, controlMap).map((orphanId) => ({
1923
- subject: import_codegen29.CONTROL_LABEL[controlMap[orphanId].type],
2243
+ subject: import_codegen33.CONTROL_LABEL[controlMap[orphanId].type],
1924
2244
  target: {
1925
2245
  kind: "control",
1926
2246
  screenId: screen.id,
@@ -1931,7 +2251,7 @@ var squeezedOrphans = perScreen(
1931
2251
  );
1932
2252
 
1933
2253
  // apps/m-one-ui/src/app/pages/design/lib/invariants/context-group-primary-unique.ts
1934
- var import_codegen30 = require("./index.js");
2254
+ var import_codegen34 = require("./index.js");
1935
2255
  var contextGroupPrimaryUnique = defineInvariant({
1936
2256
  name: "context-group-primary-unique",
1937
2257
  message: "invariant-context-group-primary-unique",
@@ -1942,14 +2262,14 @@ var contextGroupPrimaryUnique = defineInvariant({
1942
2262
  });
1943
2263
  var duplicatePrimaries = perScreen(
1944
2264
  (controlMap, screen) => Object.entries(controlMap).flatMap(([groupId, control]) => {
1945
- if (control.type !== import_codegen30.ControlType.SECTION_BUTTON_GROUP) return [];
2265
+ if (control.type !== import_codegen34.ControlType.SECTION_BUTTON_GROUP) return [];
1946
2266
  if (control.configs?.["variant"] !== "context") return [];
1947
2267
  const primaries = (control.childrens ?? []).filter((childId) => {
1948
2268
  const child = controlMap[childId];
1949
- return child?.type === import_codegen30.ControlType.BUTTON && child.configs?.["variant"] === "primary";
2269
+ return child?.type === import_codegen34.ControlType.BUTTON && child.configs?.["variant"] === "primary";
1950
2270
  });
1951
2271
  return primaries.slice(1).map((buttonId) => ({
1952
- subject: import_codegen30.CONTROL_LABEL[import_codegen30.ControlType.BUTTON],
2272
+ subject: import_codegen34.CONTROL_LABEL[import_codegen34.ControlType.BUTTON],
1953
2273
  target: {
1954
2274
  kind: "control",
1955
2275
  screenId: screen.id,
@@ -1960,77 +2280,143 @@ var duplicatePrimaries = perScreen(
1960
2280
  );
1961
2281
 
1962
2282
  // apps/m-one-ui/src/app/pages/design/lib/hand-binding-helper.ts
1963
- var import_codegen32 = require("./index.js");
2283
+ var import_codegen36 = require("./index.js");
1964
2284
 
1965
2285
  // apps/m-one-ui/src/app/pages/design/lib/control-outputs.ts
1966
- var import_codegen31 = require("./index.js");
2286
+ var import_codegen35 = require("./index.js");
2287
+ var embeddedOutputsOf = (screens, contractOf = () => void 0) => (control) => {
2288
+ if (control.type !== import_codegen35.ControlType.SCREEN) return void 0;
2289
+ if (control.handRef) {
2290
+ const contract = contractOf(control.handRef);
2291
+ return contract ? (0, import_codegen35.handTargetOf)(contract).outputs : void 0;
2292
+ }
2293
+ return screens.find((screen) => screen.id === control.screenId)?.outputs;
2294
+ };
2295
+ var embeddedOutputOf = (control, key, embedded) => embedded?.(control)?.[(0, import_codegen35.outputArmBaseKey)(key)];
2296
+ var outputPayloadShape = (control, key, embedded) => control.type === import_codegen35.ControlType.SCREEN ? embeddedOutputOf(control, key, embedded)?.payload?.dataType ?? "void" : (0, import_codegen35.payloadShape)(key, control.type, control.configs);
2297
+ var outputCallLabelOf = (control, key, embedded) => {
2298
+ const label2 = (0, import_codegen35.outputCallLabel)(control, key);
2299
+ const name = embeddedOutputOf(control, key, embedded)?.name;
2300
+ const base = (0, import_codegen35.outputArmBaseKey)(key);
2301
+ return name && label2.startsWith(base) ? `${name}${label2.slice(base.length)}` : label2;
2302
+ };
1967
2303
  var CONTROL_OUTPUTS = {
1968
- [import_codegen31.ControlType.BUTTON]: ["clicked"],
1969
- [import_codegen31.ControlType.CONTEXT_MENU]: ["action"],
2304
+ [import_codegen35.ControlType.BUTTON]: ["clicked"],
2305
+ [import_codegen35.ControlType.CONTEXT_MENU]: ["action"],
1970
2306
  // The picker's own value, once the User has moved it — the write half of the
1971
2307
  // controlled binding, drawn as a StateWrite rather than as `[(audience)]`
1972
2308
  // (ADR 0187, ADR 0065). Offered whatever the two halves hold: a picker bound
1973
2309
  // to no `audience` still edits its own value and still fires this.
1974
- [import_codegen31.ControlType.AUDIENCE_PICKER]: ["audienceChange"],
1975
- [import_codegen31.ControlType.CARD]: ["clicked"],
2310
+ [import_codegen35.ControlType.AUDIENCE_PICKER]: ["audienceChange"],
2311
+ [import_codegen35.ControlType.CARD]: ["clicked"],
1976
2312
  // `submitted` is offered only under a Button declaring `isSubmit` — see
1977
2313
  // `outputsOf` below.
1978
- [import_codegen31.ControlType.FORM]: ["submitted", "dataChange", "formInitialized"],
2314
+ [import_codegen35.ControlType.FORM]: ["submitted", "dataChange", "formInitialized"],
1979
2315
  // The Field's own `dataChange`, at field granularity — the value the User
1980
2316
  // typed into this one field, not the form's record (libs/one ADR 0032).
1981
2317
  // Needs no Button, the way the form's does not (see `outputsOf`).
1982
- [import_codegen31.ControlType.FIELD]: ["dataChange"],
1983
- [import_codegen31.ControlType.SECTION]: ["inView"],
1984
- [import_codegen31.ControlType.SECTION_HEADER]: ["actionClick", "action", "back"],
2318
+ [import_codegen35.ControlType.FIELD]: ["dataChange"],
2319
+ [import_codegen35.ControlType.SECTION]: ["inView"],
2320
+ [import_codegen35.ControlType.SECTION_HEADER]: ["actionClick", "action", "back"],
1985
2321
  // Debounced already by the component — what arrives here is the term the User
1986
2322
  // stopped typing, which is the only thing worth binding a call to.
1987
- [import_codegen31.ControlType.SECTION_SEARCH]: ["searchChange"],
2323
+ [import_codegen35.ControlType.SECTION_SEARCH]: ["searchChange"],
1988
2324
  // One output for the whole bar, carrying the Button that was pressed — an
1989
2325
  // `m-action` names its Buttons rather than holding them, so there is no
1990
2326
  // per-Button Control for a binding to sit on (ADR 0009).
1991
- [import_codegen31.ControlType.SECTION_ACTION]: ["clicked"],
2327
+ [import_codegen35.ControlType.SECTION_ACTION]: ["clicked"],
1992
2328
  // Which slide is showing, every time it changes — by drag, by indicator, or
1993
2329
  // by the clock. Two spellings of the one event, because what a caller binds
1994
2330
  // differs: `slideChange` carries the position, `itemChange` the row behind it,
1995
2331
  // which is what a call needing the slide's own data takes.
1996
- [import_codegen31.ControlType.SECTION_CAROUSEL]: ["slideChange", "itemChange"],
2332
+ [import_codegen35.ControlType.SECTION_CAROUSEL]: ["slideChange", "itemChange"],
1997
2333
  // The whole group's selection, every time any Filter beneath it changes
1998
2334
  // (libs/one ADR 0025). Per-change rather than on-close: a group has no single
1999
2335
  // close event full-width, and `switchMap` in the emitted store already drops
2000
2336
  // the responses of calls a later change supersedes.
2001
- [import_codegen31.ControlType.SECTION_FILTER_GROUP]: ["filterChange"],
2337
+ [import_codegen35.ControlType.SECTION_FILTER_GROUP]: ["filterChange"],
2002
2338
  // Offered only outside a group — see `outputsOf` below.
2003
- [import_codegen31.ControlType.SECTION_FILTER]: ["filterChange"],
2339
+ [import_codegen35.ControlType.SECTION_FILTER]: ["filterChange"],
2004
2340
  // One payload, `{offset, perPage}`, and both members are pickable — a
2005
2341
  // CallArgMapping reading `event.offset` gets a number, which is what an
2006
2342
  // ApiOperation's query param takes. The whole `$event` works too, unlike a
2007
2343
  // FilterGroup's list of pairs (ADR 0097).
2008
- [import_codegen31.ControlType.SECTION_PAGINATION]: ["paginationChange"],
2344
+ [import_codegen35.ControlType.SECTION_PAGINATION]: ["paginationChange"],
2009
2345
  // `{id, direction}`, after the rows were reordered in place — bound when the
2010
2346
  // table holds one page of a longer list and whoever fetches has to sort the
2011
2347
  // rest (ADR 0148). `tableInitialized` fires once, after the first render —
2012
2348
  // no payload, the Form's `formInitialized` for a table.
2013
- [import_codegen31.ControlType.SECTION_TABLE]: ["sortChange", "tableInitialized"],
2349
+ [import_codegen35.ControlType.SECTION_TABLE]: ["sortChange", "tableInitialized"],
2014
2350
  // Repeated rows emit their Repeat item; static rows emit `undefined`.
2015
- [import_codegen31.ControlType.SECTION_TABLE_ROW]: ["rowClick"],
2351
+ [import_codegen35.ControlType.SECTION_TABLE_ROW]: ["rowClick"],
2016
2352
  // The preset picked, and the window it drew as `{from, to}` ISO text — both
2017
2353
  // members pickable, each a date an ApiOperation's param takes. Fired when the
2018
2354
  // reader picks a preset or lets go of the navigator, never because an input
2019
2355
  // moved, so a fetch bound here cannot loop (libs/one GLOSSARY.md
2020
2356
  // SectionChart, the SectionPagination rule of ADR 0097).
2021
- [import_codegen31.ControlType.SECTION_CHART]: ["rangeChange", "windowChange"],
2357
+ [import_codegen35.ControlType.SECTION_CHART]: ["rangeChange", "windowChange"],
2022
2358
  // Offered under the `link` variant alone — see `outputsOf` below.
2023
- [import_codegen31.ControlType.TEXT_OUTPUT]: ["clicked"]
2359
+ [import_codegen35.ControlType.TEXT_OUTPUT]: ["clicked"]
2024
2360
  };
2361
+ function outputsOf(control, controlMap, embedded) {
2362
+ if (control.type === import_codegen35.ControlType.SCREEN) {
2363
+ return (0, import_codegen35.listScreenOutputs)(embedded?.(control)).map((output) => output.id);
2364
+ }
2365
+ if (control.type === import_codegen35.ControlType.PLUGIN) {
2366
+ return (0, import_codegen35.pluginNamesOf)(control.configs, import_codegen35.PLUGIN_OUTPUTS_KEY);
2367
+ }
2368
+ const offered = CONTROL_OUTPUTS[control.type] ?? [];
2369
+ if (control.type === import_codegen35.ControlType.FORM) {
2370
+ return controlMap && !hasSubmitButton(control, controlMap) && !(control.id && (0, import_codegen35.hasSubmitTargetButton)(control.id, controlMap)) ? offered.filter((output) => output !== "submitted") : offered;
2371
+ }
2372
+ if (control.type === import_codegen35.ControlType.SECTION_FILTER) {
2373
+ return controlMap && insideFilterGroup(control, controlMap) ? [] : offered;
2374
+ }
2375
+ if (control.type !== import_codegen35.ControlType.TEXT_OUTPUT) return offered;
2376
+ const variant = control.configs?.["variant"];
2377
+ const isLink = variant === "link" || variant === "link-small";
2378
+ return isLink && !(0, import_codegen35.hasRouterLinkDirective)(control) ? offered : [];
2379
+ }
2380
+ function hasSubmitButton(control, controlMap) {
2381
+ const queue = [...control.childrens ?? []];
2382
+ const seen = /* @__PURE__ */ new Set();
2383
+ while (queue.length) {
2384
+ const id = queue.shift();
2385
+ if (!id || seen.has(id)) continue;
2386
+ seen.add(id);
2387
+ const child = controlMap[id];
2388
+ if (!child || child.type === import_codegen35.ControlType.FORM) continue;
2389
+ if (child.type === import_codegen35.ControlType.BUTTON && child.configs?.["isSubmit"] === true)
2390
+ return true;
2391
+ queue.push(...child.childrens ?? []);
2392
+ }
2393
+ return false;
2394
+ }
2395
+ function insideFilterGroup(control, controlMap) {
2396
+ const seen = /* @__PURE__ */ new Set();
2397
+ let current = control.parentId ? controlMap[control.parentId] : void 0;
2398
+ while (current && !seen.has(current.id)) {
2399
+ if (current.type === import_codegen35.ControlType.SECTION_FILTER_GROUP) return true;
2400
+ seen.add(current.id);
2401
+ current = current.parentId ? controlMap[current.parentId] : void 0;
2402
+ }
2403
+ return false;
2404
+ }
2405
+ function offersOutputKey(control, controlMap, key, embedded) {
2406
+ if ((0, import_codegen35.hasRouterLink)(control.directives?.["routerLink"]?.configs)) return false;
2407
+ const base = (0, import_codegen35.outputArmBaseKey)(key);
2408
+ const output = (0, import_codegen35.isMenuActionKey)(base) ? import_codegen35.MENU_ACTION_OUTPUT : base;
2409
+ return outputsOf(control, controlMap, embedded).includes(output);
2410
+ }
2025
2411
  var OUTPUT_MAP_FIELDS = [
2026
- ...import_codegen31.OUTPUT_GROUP_MAPS,
2412
+ ...import_codegen35.OUTPUT_GROUP_MAPS,
2027
2413
  "outputCalls",
2028
2414
  "outputArms"
2029
2415
  ];
2030
2416
  var wiredOutputKeys = (control) => [
2031
2417
  ...new Set(
2032
2418
  OUTPUT_MAP_FIELDS.flatMap(
2033
- (field) => Object.keys(control[field] ?? {}).map(import_codegen31.outputArmBaseKey)
2419
+ (field) => Object.keys(control[field] ?? {}).map(import_codegen35.outputArmBaseKey)
2034
2420
  )
2035
2421
  )
2036
2422
  ];
@@ -2040,7 +2426,7 @@ var CLEARED_OUTPUT_WIRING = Object.fromEntries(
2040
2426
 
2041
2427
  // apps/m-one-ui/src/app/pages/design/lib/hand-binding-helper.ts
2042
2428
  var handControls = (controlMap) => Object.values(controlMap).filter(
2043
- (control) => control.type === import_codegen32.ControlType.SCREEN && !!control.handRef
2429
+ (control) => control.type === import_codegen36.ControlType.SCREEN && !!control.handRef
2044
2430
  );
2045
2431
  var unmountableReason = (handRef, hand) => {
2046
2432
  const contract = hand.contracts[handRef];
@@ -2050,7 +2436,7 @@ var unmountableReason = (handRef, hand) => {
2050
2436
  );
2051
2437
  return skipped ? skipped.reason : "gone";
2052
2438
  }
2053
- const blockers = (0, import_codegen32.mountBlockers)(contract);
2439
+ const blockers = (0, import_codegen36.mountBlockers)(contract);
2054
2440
  return blockers.length ? `required: ${blockers.join(", ")}` : void 0;
2055
2441
  };
2056
2442
  var memberOf = (screen, binding) => {
@@ -2121,7 +2507,7 @@ var unboundRequiredInputs = (control, contract) => {
2121
2507
  };
2122
2508
  var mountedContract = (control, hand) => {
2123
2509
  const contract = control.handRef ? hand.contracts[control.handRef] : void 0;
2124
- return contract && (0, import_codegen32.isMountable)(contract) ? contract : void 0;
2510
+ return contract && (0, import_codegen36.isMountable)(contract) ? contract : void 0;
2125
2511
  };
2126
2512
 
2127
2513
  // apps/m-one-ui/src/app/pages/design/lib/invariants/hand-binding-resolves.ts
@@ -2210,7 +2596,7 @@ var handScreenResolves = defineInvariant({
2210
2596
  });
2211
2597
 
2212
2598
  // apps/m-one-ui/src/app/pages/design/lib/invariants/reserved-variant-name-free.ts
2213
- var import_codegen33 = require("./index.js");
2599
+ var import_codegen37 = require("./index.js");
2214
2600
  var reservedVariantNameFree = defineInvariant({
2215
2601
  name: "reserved-variant-name-free",
2216
2602
  message: "invariant-reserved-variant-name",
@@ -2222,7 +2608,7 @@ var reservedVariantNameFree = defineInvariant({
2222
2608
  const held = [
2223
2609
  ...Object.values(feature.properties).map((property) => property.name),
2224
2610
  ...Object.values(feature.variants).map((variant) => variant.name)
2225
- ].filter(import_codegen33.isReservedVariantName);
2611
+ ].filter(import_codegen37.isReservedVariantName);
2226
2612
  return held.length ? [
2227
2613
  {
2228
2614
  subject: `${feature.name}.${held[0]}`,
@@ -2239,7 +2625,7 @@ var reservedVariantNameFree = defineInvariant({
2239
2625
  ...Object.values(screen.outputs ?? {}),
2240
2626
  ...Object.values(screen.constants ?? {}),
2241
2627
  ...Object.values(screen.computeds ?? {})
2242
- ].map((member) => member.name).filter(import_codegen33.isReservedVariantName);
2628
+ ].map((member) => member.name).filter(import_codegen37.isReservedVariantName);
2243
2629
  return held.length ? [
2244
2630
  {
2245
2631
  subject: `${screen.name}.${held[0]}`,
@@ -2252,13 +2638,13 @@ var reservedVariantNameFree = defineInvariant({
2252
2638
  });
2253
2639
 
2254
2640
  // apps/m-one-ui/src/app/pages/design/lib/invariants/feature-name-free.ts
2255
- var import_codegen34 = require("./index.js");
2641
+ var import_codegen38 = require("./index.js");
2256
2642
  var featureNameFree = defineInvariant({
2257
2643
  name: "feature-name-free",
2258
2644
  message: "invariant-feature-name-reserved",
2259
2645
  severity: "advisory",
2260
2646
  deps: ["features", "screens"],
2261
- validate: ({ features, screens }) => Object.values(features).filter((feature) => (0, import_codegen34.isReservedFeatureName)(feature.name)).map((feature) => ({
2647
+ validate: ({ features, screens }) => Object.values(features).filter((feature) => (0, import_codegen38.isReservedFeatureName)(feature.name)).map((feature) => ({
2262
2648
  subject: feature.name,
2263
2649
  target: {
2264
2650
  kind: "screen",
@@ -2268,25 +2654,25 @@ var featureNameFree = defineInvariant({
2268
2654
  });
2269
2655
 
2270
2656
  // apps/m-one-ui/src/app/pages/design/lib/compare-register.ts
2271
- var import_codegen38 = require("./index.js");
2657
+ var import_codegen42 = require("./index.js");
2272
2658
 
2273
2659
  // apps/m-one-ui/src/app/pages/design/lib/code-tree.ts
2274
- var import_codegen35 = require("./index.js");
2660
+ var import_codegen39 = require("./index.js");
2275
2661
  var CODE_AREA_ROOTS = [
2276
- ["pages", `${import_codegen35.PAGES_ROOT}/`],
2277
- ["features", `${import_codegen35.FEATURES_ROOT}/`],
2278
- ["widgets", `${import_codegen35.WIDGETS_ROOT}/`],
2662
+ ["pages", `${import_codegen39.PAGES_ROOT}/`],
2663
+ ["features", `${import_codegen39.FEATURES_ROOT}/`],
2664
+ ["widgets", `${import_codegen39.WIDGETS_ROOT}/`],
2279
2665
  ["shared", "src/app/shared/"],
2280
2666
  ["mag_assets", "mag_assets/"],
2281
2667
  ["magmonium", ".magmonium/"]
2282
2668
  ];
2283
2669
 
2284
2670
  // apps/m-one-ui/src/app/pages/design/lib/function-register.ts
2285
- var import_codegen36 = require("./index.js");
2671
+ var import_codegen40 = require("./index.js");
2286
2672
  var everyFunction = (appFunctions, features) => [
2287
- ...(0, import_codegen36.listFunctions)(appFunctions).map((fn) => ({ fn })),
2288
- ...(0, import_codegen36.listFeatures)(features).flatMap(
2289
- (feature) => (0, import_codegen36.listFunctions)(feature.functions).map((fn) => ({
2673
+ ...(0, import_codegen40.listFunctions)(appFunctions).map((fn) => ({ fn })),
2674
+ ...(0, import_codegen40.listFeatures)(features).flatMap(
2675
+ (feature) => (0, import_codegen40.listFunctions)(feature.functions).map((fn) => ({
2290
2676
  fn,
2291
2677
  featureId: feature.id
2292
2678
  }))
@@ -2301,14 +2687,14 @@ var canonical = (value) => {
2301
2687
  };
2302
2688
 
2303
2689
  // apps/m-one-ui/src/app/pages/design/lib/shape-register.ts
2304
- var import_codegen37 = require("./index.js");
2690
+ var import_codegen41 = require("./index.js");
2305
2691
 
2306
2692
  // apps/m-one-ui/src/app/pages/design/lib/compare-register.ts
2307
- var import_codegen39 = require("./index.js");
2693
+ var import_codegen43 = require("./index.js");
2308
2694
  var everyShape = (features, sharedShapes = {}) => [
2309
- ...(0, import_codegen38.listShapes)(sharedShapes).map((shape) => ({ shape })),
2310
- ...(0, import_codegen38.listFeatures)(features).flatMap(
2311
- (feature) => (0, import_codegen38.listShapes)(feature.shapes).filter((shape) => !(0, import_codegen38.isSharedShapeId)(shape.id)).map((shape) => ({ shape, featureId: feature.id }))
2695
+ ...(0, import_codegen42.listShapes)(sharedShapes).map((shape) => ({ shape })),
2696
+ ...(0, import_codegen42.listFeatures)(features).flatMap(
2697
+ (feature) => (0, import_codegen42.listShapes)(feature.shapes).filter((shape) => !(0, import_codegen42.isSharedShapeId)(shape.id)).map((shape) => ({ shape, featureId: feature.id }))
2312
2698
  )
2313
2699
  ];
2314
2700
  var distinctPair = (kind, a, b) => ({ kind, ids: a < b ? [a, b] : [b, a] });
@@ -2394,24 +2780,24 @@ var themeSelectionResolves = defineInvariant({
2394
2780
  });
2395
2781
 
2396
2782
  // apps/m-one-ui/src/app/pages/design/lib/invariants/search-feed-resolves.ts
2397
- var import_codegen40 = require("./index.js");
2783
+ var import_codegen44 = require("./index.js");
2398
2784
  var searchFeedResolves = defineInvariant({
2399
2785
  name: "search-feed-resolves",
2400
2786
  message: "invariant-search-feed-unresolved",
2401
2787
  severity: "advisory",
2402
2788
  deps: ["features", "functions"],
2403
2789
  validate: ({ features, functions }) => Object.values(features).flatMap(
2404
- (feature) => (0, import_codegen40.storesOf)(feature).flatMap((store) => {
2790
+ (feature) => (0, import_codegen44.storesOf)(feature).flatMap((store) => {
2405
2791
  const feed = store.searchFeed;
2406
2792
  if (!feed) return [];
2407
2793
  const property = store.properties[feed.propertyId];
2408
2794
  const rows = property?.cardinality === "many" ? property.dataType : void 0;
2409
2795
  if (feed.functionId) {
2410
2796
  const fn = feature.functions?.[feed.functionId] ?? functions[feed.functionId];
2411
- if (fn && (0, import_codegen40.isSearchFeedFunction)(fn, property, feature.shapes) && (0, import_codegen40.searchFeedArgsComplete)(fn, feed.args)) {
2797
+ if (fn && (0, import_codegen44.isSearchFeedFunction)(fn, property, feature.shapes) && (0, import_codegen44.searchFeedArgsComplete)(fn, feed.args)) {
2412
2798
  return [];
2413
2799
  }
2414
- } else if (rows && (0, import_codegen40.resolveSearchFeedMember)(feed.title, rows, feature.shapes)) {
2800
+ } else if (rows && (0, import_codegen44.resolveSearchFeedMember)(feed.title, rows, feature.shapes)) {
2415
2801
  return [];
2416
2802
  }
2417
2803
  return [
@@ -2430,14 +2816,14 @@ var searchFeedResolves = defineInvariant({
2430
2816
  });
2431
2817
 
2432
2818
  // apps/m-one-ui/src/app/pages/design/lib/invariants/search-answer-resolves.ts
2433
- var import_codegen41 = require("./index.js");
2819
+ var import_codegen45 = require("./index.js");
2434
2820
  var searchAnswerResolves = defineInvariant({
2435
2821
  name: "search-answer-resolves",
2436
2822
  message: "invariant-search-answer-unresolved",
2437
2823
  severity: "advisory",
2438
2824
  deps: ["navMap", "screens"],
2439
2825
  validate: ({ navMap, screens }) => {
2440
- const screenId = (0, import_codegen41.searchAnswerScreenId)(navMap);
2826
+ const screenId = (0, import_codegen45.searchAnswerScreenId)(navMap);
2441
2827
  if (!screenId) return [];
2442
2828
  const screen = screens.find((s) => s.id === screenId);
2443
2829
  if (screen && (screen.kind === "app_widget" || screen.kind === "feature")) {
@@ -2446,30 +2832,50 @@ var searchAnswerResolves = defineInvariant({
2446
2832
  return [
2447
2833
  {
2448
2834
  subject: screen?.name ?? screenId,
2449
- target: { kind: "nav", navId: import_codegen41.SEARCH_NAV_ID }
2835
+ target: { kind: "nav", navId: import_codegen45.SEARCH_NAV_ID }
2450
2836
  }
2451
2837
  ];
2452
2838
  }
2453
2839
  });
2454
2840
 
2455
2841
  // apps/m-one-ui/src/app/pages/design/lib/invariants/state-path-resolves.ts
2456
- var import_codegen42 = require("./index.js");
2842
+ var import_codegen46 = require("./index.js");
2457
2843
  var reachOf = (feature, shared) => ({
2458
2844
  properties: Object.assign(
2459
2845
  {},
2460
- ...(0, import_codegen42.storesOf)(feature).map((store) => store.properties)
2846
+ ...(0, import_codegen46.storesOf)(feature).map((store) => store.properties)
2461
2847
  ),
2462
- shapes: (0, import_codegen42.shapesInReach)(feature, shared)
2848
+ shapes: (0, import_codegen46.shapesInReach)(feature, shared)
2463
2849
  });
2464
- function holdsDeadPath(value, reach) {
2850
+ function declaredIds(value, into = /* @__PURE__ */ new Set()) {
2851
+ if (Array.isArray(value)) value.forEach((item) => declaredIds(item, into));
2852
+ else if (value && typeof value === "object") {
2853
+ const id = value.id;
2854
+ if (typeof id === "string") into.add(id);
2855
+ Object.values(value).forEach((item) => declaredIds(item, into));
2856
+ }
2857
+ return into;
2858
+ }
2859
+ var STATE_ROOT_KINDS = /* @__PURE__ */ new Set(["property", "computed"]);
2860
+ var STATE_SOURCES = /* @__PURE__ */ new Set(["state", "path", "store"]);
2861
+ function holdsDeadPath(value, reach, roots, state) {
2465
2862
  if (Array.isArray(value)) {
2466
2863
  if (value.length > 1 && value.every((id) => typeof id === "string") && value[0] in reach.properties && !value.slice(1).some((id) => id in reach.properties)) {
2467
- return !(0, import_codegen42.isPathResolved)(value, reach.properties, reach.shapes);
2864
+ return !(0, import_codegen46.isPathResolved)(value, reach.properties, reach.shapes);
2468
2865
  }
2469
- return value.some((item) => holdsDeadPath(item, reach));
2866
+ return value.some((item) => holdsDeadPath(item, reach, roots, state));
2470
2867
  }
2471
2868
  if (value && typeof value === "object") {
2472
- return Object.values(value).some((item) => holdsDeadPath(item, reach));
2869
+ const record = value;
2870
+ const path = record.path;
2871
+ if (roots && record.root === void 0 && (record.source === void 0 || typeof record.source === "string" && STATE_SOURCES.has(record.source)) && Array.isArray(path) && path.length > 0 && path.every((id) => typeof id === "string") && !roots.has(path[0])) {
2872
+ return true;
2873
+ }
2874
+ const root = record.root;
2875
+ if (state && root && typeof root.kind === "string" && STATE_ROOT_KINDS.has(root.kind) && typeof root.id === "string" && !state.has(root.id)) {
2876
+ return true;
2877
+ }
2878
+ return Object.values(value).some((item) => holdsDeadPath(item, reach, roots, state));
2473
2879
  }
2474
2880
  return false;
2475
2881
  }
@@ -2486,19 +2892,28 @@ var statePathResolves = defineInvariant({
2486
2892
  validate: ({ features, screens, navMap, sharedShapes }) => {
2487
2893
  const found = [];
2488
2894
  const reaches = /* @__PURE__ */ new Map();
2895
+ const state = new Set(
2896
+ Object.values(features).flatMap(
2897
+ (feature) => (0, import_codegen46.storesOf)(feature).flatMap((store) => [
2898
+ ...Object.keys(store.properties ?? {}),
2899
+ ...Object.keys(store.computeds ?? {})
2900
+ ])
2901
+ )
2902
+ );
2903
+ const rootsFor = (holder, extra = []) => /* @__PURE__ */ new Set([...state, ...declaredIds(holder), ...extra]);
2489
2904
  for (const feature of Object.values(features)) {
2490
2905
  const reach = reachOf(feature, sharedShapes);
2491
2906
  reaches.set(feature.id, reach);
2492
2907
  const at = { kind: "panel", panel: "store", featureId: feature.id };
2493
2908
  for (const variant of named(feature.variants)) {
2494
- if (holdsDeadPath(variant.value, reach)) {
2909
+ if (holdsDeadPath(variant.value, reach, rootsFor(variant.value), state)) {
2495
2910
  found.push({
2496
2911
  subject: `${feature.name} \u2192 variant ${variant.name}`,
2497
2912
  target: { ...at, memberId: variant.id }
2498
2913
  });
2499
2914
  }
2500
2915
  }
2501
- for (const store of (0, import_codegen42.storesOf)(feature)) {
2916
+ for (const store of (0, import_codegen46.storesOf)(feature)) {
2502
2917
  const subStoreId = store.subStore?.id;
2503
2918
  const owner = subStoreId ? { ...at, subStoreId } : at;
2504
2919
  const prefix = store.subStore ? `${feature.name} \u2192 ${store.subStore.name}` : feature.name;
@@ -2508,7 +2923,7 @@ var statePathResolves = defineInvariant({
2508
2923
  ["timer", store.timers]
2509
2924
  ]) {
2510
2925
  for (const member of named(members)) {
2511
- if (holdsDeadPath(member.value, reach)) {
2926
+ if (holdsDeadPath(member.value, reach, rootsFor(member.value), state)) {
2512
2927
  found.push({
2513
2928
  subject: `${prefix} \u2192 ${word} ${member.name}`,
2514
2929
  target: { ...owner, memberId: member.id }
@@ -2519,11 +2934,19 @@ var statePathResolves = defineInvariant({
2519
2934
  }
2520
2935
  }
2521
2936
  for (const screen of screens) {
2522
- const reach = (0, import_codegen42.isFeatureScreen)(screen) ? reaches.get(screen.featureId) : void 0;
2937
+ const reach = (0, import_codegen46.isFeatureScreen)(screen) ? reaches.get(screen.featureId) : void 0;
2523
2938
  if (!reach) continue;
2524
2939
  const at = { kind: "screen", screenId: screen.id, panel: "screen" };
2940
+ const own = [
2941
+ ...Object.keys(screen.inputs ?? {}),
2942
+ ...Object.keys(screen.computeds ?? {}),
2943
+ ...Object.keys(screen.constants ?? {}),
2944
+ ...Object.keys(screen.variables ?? {}),
2945
+ ...Object.keys(screen.formModels ?? {}),
2946
+ ...Object.values(screen.formModels ?? {}).map((model) => model.id)
2947
+ ];
2525
2948
  for (const variant of named(screen.variants)) {
2526
- if (holdsDeadPath(variant.value, reach)) {
2949
+ if (holdsDeadPath(variant.value, reach, rootsFor(variant.value, own), state)) {
2527
2950
  found.push({
2528
2951
  subject: `${screen.name} \u2192 variant ${variant.name}`,
2529
2952
  target: { ...at, memberId: variant.id }
@@ -2531,7 +2954,7 @@ var statePathResolves = defineInvariant({
2531
2954
  }
2532
2955
  }
2533
2956
  for (const computed of named(screen.computeds)) {
2534
- if (holdsDeadPath(computed.value, reach)) {
2957
+ if (holdsDeadPath(computed.value, reach, rootsFor(computed.value, own), state)) {
2535
2958
  found.push({
2536
2959
  subject: `${screen.name} \u2192 computed ${computed.name}`,
2537
2960
  target: { ...at, computedId: computed.id }
@@ -2544,7 +2967,7 @@ var statePathResolves = defineInvariant({
2544
2967
  shapes: Object.assign({}, ...[...reaches.values()].map((r) => r.shapes))
2545
2968
  };
2546
2969
  for (const nav of Object.values(navMap)) {
2547
- if (holdsDeadPath(nav, everywhere)) {
2970
+ if (holdsDeadPath(nav, everywhere, rootsFor(nav), state)) {
2548
2971
  found.push({
2549
2972
  subject: `nav ${nav.label ?? nav.navId}`,
2550
2973
  target: { kind: "nav", navId: nav.navId }
@@ -2556,21 +2979,21 @@ var statePathResolves = defineInvariant({
2556
2979
  });
2557
2980
 
2558
2981
  // apps/m-one-ui/src/app/pages/design/lib/invariants/rule-operand-fits.ts
2559
- var import_codegen43 = require("./index.js");
2982
+ var import_codegen47 = require("./index.js");
2560
2983
  var unfit = (check, properties, shapes) => {
2561
- const error = (0, import_codegen43.checkError)(check, properties, shapes);
2984
+ const error = (0, import_codegen47.checkError)(check, properties, shapes);
2562
2985
  if (error === "rule-path-missing") return false;
2563
2986
  if (error === "rule-operator-invalid" || error === "rule-path-not-leaf" || error === "rule-operand-missing" && check.operand.kind === "path") {
2564
2987
  return true;
2565
2988
  }
2566
- if ((0, import_codegen43.isUnaryOperator)(check.operator) || check.operand.kind !== "literal") {
2989
+ if ((0, import_codegen47.isUnaryOperator)(check.operator) || check.operand.kind !== "literal") {
2567
2990
  return false;
2568
2991
  }
2569
- const segments = (0, import_codegen43.resolvePath)(check.path, properties, shapes);
2570
- if (!check.count && (0, import_codegen43.pathLeafEnumId)(segments)) return false;
2571
- const type = (0, import_codegen43.operandType)((0, import_codegen43.pathLeafType)(segments), !!check.count);
2992
+ const segments = (0, import_codegen47.resolvePath)(check.path, properties, shapes);
2993
+ if (!check.count && (0, import_codegen47.pathLeafEnumId)(segments)) return false;
2994
+ const type = (0, import_codegen47.operandType)((0, import_codegen47.pathLeafType)(segments), !!check.count);
2572
2995
  if (!type) return false;
2573
- return (0, import_codegen43.validateLiteral)(String(check.operand.value), { type }, "one") === "value-type-mismatch";
2996
+ return (0, import_codegen47.validateLiteral)(String(check.operand.value), { type }, "one") === "value-type-mismatch";
2574
2997
  };
2575
2998
  var ruleOperandFits = defineInvariant({
2576
2999
  name: "rule-operand-fits",
@@ -2582,11 +3005,11 @@ var ruleOperandFits = defineInvariant({
2582
3005
  for (const feature of Object.values(features)) {
2583
3006
  const properties = Object.assign(
2584
3007
  {},
2585
- ...(0, import_codegen43.storesOf)(feature).map((store) => store.properties)
3008
+ ...(0, import_codegen47.storesOf)(feature).map((store) => store.properties)
2586
3009
  );
2587
- const shapes = (0, import_codegen43.shapesInReach)(feature, sharedShapes);
3010
+ const shapes = (0, import_codegen47.shapesInReach)(feature, sharedShapes);
2588
3011
  for (const variant of Object.values(feature.variants ?? {})) {
2589
- if ((0, import_codegen43.ruleChecks)(variant.rule).some(
3012
+ if ((0, import_codegen47.ruleChecks)(variant.rule).some(
2590
3013
  (check) => unfit(check, properties, shapes)
2591
3014
  )) {
2592
3015
  found.push({
@@ -2606,7 +3029,7 @@ var ruleOperandFits = defineInvariant({
2606
3029
  });
2607
3030
 
2608
3031
  // apps/m-one-ui/src/app/pages/design/lib/invariants/timer-complete.ts
2609
- var import_codegen44 = require("./index.js");
3032
+ var import_codegen48 = require("./index.js");
2610
3033
  var timerComplete = defineInvariant({
2611
3034
  name: "timer-complete",
2612
3035
  message: "invariant-timer-incomplete",
@@ -2615,7 +3038,7 @@ var timerComplete = defineInvariant({
2615
3038
  validate: ({ features, screens }) => {
2616
3039
  const featureScreen = (featureId) => screens.find((screen) => screen.featureId === featureId)?.id ?? "";
2617
3040
  return Object.values(features).flatMap(
2618
- (feature) => Object.values(feature.timers ?? {}).filter((timer) => (0, import_codegen44.timerError)(timer)).map((timer) => ({
3041
+ (feature) => Object.values(feature.timers ?? {}).filter((timer) => (0, import_codegen48.timerError)(timer)).map((timer) => ({
2619
3042
  subject: `${feature.name}.${timer.name}`,
2620
3043
  target: {
2621
3044
  kind: "screen",
@@ -2627,20 +3050,20 @@ var timerComplete = defineInvariant({
2627
3050
  });
2628
3051
 
2629
3052
  // apps/m-one-ui/src/app/pages/design/lib/invariants/variant-gate-satisfiable.ts
2630
- var import_codegen45 = require("./index.js");
3053
+ var import_codegen49 = require("./index.js");
2631
3054
  var ATOM_CAP2 = 12;
2632
3055
  var foldText2 = (entries, names) => entries.map((entry, index) => {
2633
3056
  const name = names.get(entry.id) ?? entry.id;
2634
- const term = (0, import_codegen45.variantJoinIsNot)(entry.join) ? `!${name}` : name;
3057
+ const term = (0, import_codegen49.variantJoinIsNot)(entry.join) ? `!${name}` : name;
2635
3058
  if (index === 0) return term;
2636
- return `${(0, import_codegen45.variantJoinIsAnd)(entry.join) ? "&&" : "||"} ${term}`;
3059
+ return `${(0, import_codegen49.variantJoinIsAnd)(entry.join) ? "&&" : "||"} ${term}`;
2637
3060
  }).join(" ");
2638
3061
  var variantNames2 = (features, screens, currentScreenId) => {
2639
3062
  const screen = screens.find((one) => one.id === currentScreenId);
2640
3063
  const feature = screen?.featureId ? features[screen.featureId] : void 0;
2641
3064
  const names = /* @__PURE__ */ new Map([
2642
- [import_codegen45.ELSE_VARIANT_ID, import_codegen45.ELSE_VARIANT_NAME],
2643
- [import_codegen45.BUSY_VARIANT_ID, import_codegen45.BUSY_VARIANT_NAME]
3065
+ [import_codegen49.ELSE_VARIANT_ID, import_codegen49.ELSE_VARIANT_NAME],
3066
+ [import_codegen49.BUSY_VARIANT_ID, import_codegen49.BUSY_VARIANT_NAME]
2644
3067
  ]);
2645
3068
  Object.values(feature?.variants ?? {}).forEach(
2646
3069
  (variant) => names.set(variant.id, variant.name)
@@ -2650,16 +3073,16 @@ var variantNames2 = (features, screens, currentScreenId) => {
2650
3073
  var satisfiable = (gates) => {
2651
3074
  const atoms = [
2652
3075
  ...new Set(
2653
- gates.flat().map((entry) => entry.id).filter((id) => !(0, import_codegen45.isReservedVariantId)(id))
3076
+ gates.flat().map((entry) => entry.id).filter((id) => !(0, import_codegen49.isReservedVariantId)(id))
2654
3077
  )
2655
3078
  ];
2656
3079
  if (atoms.length > ATOM_CAP2) return true;
2657
3080
  const rows = 1 << atoms.length;
2658
3081
  for (let row = 0; row < rows; row++) {
2659
3082
  const on = atoms.filter((_, index) => row & 1 << index);
2660
- const base = on.length ? on : [...on, import_codegen45.ELSE_VARIANT_ID];
2661
- for (const withBusy of [base, [...base, import_codegen45.BUSY_VARIANT_ID]]) {
2662
- if (gates.every((gate) => (0, import_codegen45.evaluateVariantGate)(gate, withBusy))) {
3083
+ const base = on.length ? on : [...on, import_codegen49.ELSE_VARIANT_ID];
3084
+ for (const withBusy of [base, [...base, import_codegen49.BUSY_VARIANT_ID]]) {
3085
+ if (gates.every((gate) => (0, import_codegen49.evaluateVariantGate)(gate, withBusy))) {
2663
3086
  return true;
2664
3087
  }
2665
3088
  }
@@ -2678,9 +3101,9 @@ var unsatisfiableGates = perScreen(
2678
3101
  (controlMap, screen, { features, screens }) => {
2679
3102
  const names = variantNames2(features, screens, screen.id);
2680
3103
  return Object.entries(controlMap).flatMap(([controlId, control]) => {
2681
- const own = (0, import_codegen45.controlVariants)(control);
3104
+ const own = (0, import_codegen49.controlVariants)(control);
2682
3105
  if (!own.length) return [];
2683
- const above = (0, import_codegen45.enclosingGates)(controlId, controlMap);
3106
+ const above = (0, import_codegen49.enclosingGates)(controlId, controlMap);
2684
3107
  if (above === null) return [];
2685
3108
  const gates = [own, ...above];
2686
3109
  if (satisfiable(gates)) return [];
@@ -2700,6 +3123,865 @@ var unsatisfiableGates = perScreen(
2700
3123
  }
2701
3124
  );
2702
3125
 
3126
+ // apps/m-one-ui/src/app/pages/design/lib/codec-drops.ts
3127
+ var parse = (text) => {
3128
+ if (text === void 0) return void 0;
3129
+ try {
3130
+ return JSON.parse(text);
3131
+ } catch {
3132
+ return void 0;
3133
+ }
3134
+ };
3135
+ var label = (row, id) => typeof row?.name === "string" && row.name ? row.name : id;
3136
+ function codecDrops(files, source, root = ".magmonium") {
3137
+ const raw = parse(files[`${root}/index.json`]);
3138
+ if (!raw) return [];
3139
+ const found = [];
3140
+ const drop = (kind, key, subject, target2) => found.push({
3141
+ id: `codec-dropped-${kind}::${key}`,
3142
+ invariant: `codec-dropped-${kind}`,
3143
+ message: "invariant-codec-dropped",
3144
+ subject,
3145
+ severity: "blocking",
3146
+ target: target2
3147
+ });
3148
+ for (const [featureId, rawFeature] of Object.entries(raw.features ?? {})) {
3149
+ const fname = label(rawFeature, featureId);
3150
+ const feature = source.features[featureId];
3151
+ const at = { kind: "panel", panel: "store", featureId };
3152
+ if (!feature) {
3153
+ drop("feature", featureId, `Feature ${fname}`, at);
3154
+ continue;
3155
+ }
3156
+ const members = (store, decoded, prefix, owner) => {
3157
+ for (const [word, key] of [
3158
+ ["property", "properties"],
3159
+ ["computed", "computeds"],
3160
+ ["method", "methods"],
3161
+ ["timer", "timers"]
3162
+ ]) {
3163
+ for (const [id, row] of Object.entries(store?.[key] ?? {})) {
3164
+ if (!decoded?.[key]?.[id])
3165
+ drop(word, `${featureId}:${id}`, `${prefix} \u2192 ${word} ${label(row, id)}`, { ...owner, memberId: id });
3166
+ }
3167
+ }
3168
+ };
3169
+ members(rawFeature, feature, fname, at);
3170
+ for (const [subId, rawSub] of Object.entries(rawFeature?.subStores ?? {})) {
3171
+ const sub = feature.subStores?.[subId];
3172
+ if (!sub) {
3173
+ drop("substore", `${featureId}:${subId}`, `${fname} \u2192 store ${label(rawSub, subId)}`, at);
3174
+ continue;
3175
+ }
3176
+ members(rawSub, sub, `${fname} \u2192 ${label(rawSub, subId)}`, { ...at, subStoreId: subId });
3177
+ }
3178
+ }
3179
+ const decodedFunctions = /* @__PURE__ */ new Set([
3180
+ ...Object.keys(source.functions),
3181
+ ...Object.values(source.features).flatMap((feature) => Object.keys(feature.functions ?? {}))
3182
+ ]);
3183
+ const rawFunctions = [
3184
+ ...Object.entries(raw.functions ?? {}).map(([id, row]) => [id, row, void 0]),
3185
+ ...Object.entries(raw.features ?? {}).flatMap(
3186
+ ([featureId, feature]) => Object.entries(feature?.functions ?? {}).map(([id, row]) => [id, row, featureId])
3187
+ )
3188
+ ];
3189
+ for (const [id, row, featureId] of rawFunctions) {
3190
+ if (!decodedFunctions.has(id))
3191
+ drop("function", id, `function ${label(row, id)}`, {
3192
+ kind: "function",
3193
+ ...featureId ? { featureId } : {},
3194
+ functionId: id
3195
+ });
3196
+ }
3197
+ const decodedScreens = new Map(source.screens.map((slot) => [slot.meta.id, slot]));
3198
+ for (const rawScreen of raw.screens ?? []) {
3199
+ const id = typeof rawScreen.id === "string" ? rawScreen.id : void 0;
3200
+ if (!id) continue;
3201
+ const name = label(rawScreen, id);
3202
+ const slot = decodedScreens.get(id);
3203
+ if (!slot) {
3204
+ drop("screen", id, `Screen ${name}`, { kind: "screen", screenId: id });
3205
+ continue;
3206
+ }
3207
+ for (const [cid, row] of Object.entries(rawScreen.computeds ?? {})) {
3208
+ if (!slot.meta.computeds?.[cid])
3209
+ drop("screen-computed", `${id}:${cid}`, `${name} \u2192 computed ${label(row, cid)}`, {
3210
+ kind: "screen",
3211
+ screenId: id,
3212
+ panel: "screen",
3213
+ computedId: cid
3214
+ });
3215
+ }
3216
+ const rawSlot = parse(
3217
+ files[`${root}/screens/${id}.json`]
3218
+ );
3219
+ for (const [controlId, control] of Object.entries(rawSlot?.state?.controlMap ?? {})) {
3220
+ if (!slot.state.controlMap[controlId])
3221
+ drop("control", `${id}:${controlId}`, `${name} \u2192 ${String(control?.type ?? "control")} ${controlId}`, {
3222
+ kind: "screen",
3223
+ screenId: id
3224
+ });
3225
+ }
3226
+ }
3227
+ return found;
3228
+ }
3229
+
3230
+ // apps/m-one-ui/src/app/pages/design/lib/emit-gap-helper.ts
3231
+ var import_codegen51 = require("./index.js");
3232
+
3233
+ // apps/m-one-ui/src/app/pages/design/lib/store-method-check.ts
3234
+ var import_codegen50 = require("./index.js");
3235
+ function storeMethodError(method, scope) {
3236
+ const name = (0, import_codegen50.validateMethodName)(method.name, scope.siblings, method.id);
3237
+ if (name) return name;
3238
+ if ((0, import_codegen50.isStorageMethod)(method)) {
3239
+ const config = method.storage;
3240
+ if (!config?.key.trim()) return "emit-gap-storage-method";
3241
+ if (config.op !== "delete" && !scope.properties[config.propertyId ?? ""]) {
3242
+ return "emit-gap-storage-method";
3243
+ }
3244
+ return void 0;
3245
+ }
3246
+ if ((0, import_codegen50.isCacheMethod)(method)) {
3247
+ return (0, import_codegen50.cacheMethodError)(
3248
+ method,
3249
+ scope.methods,
3250
+ scope.properties,
3251
+ scope.operationOf
3252
+ );
3253
+ }
3254
+ const operation = scope.operationOf(method);
3255
+ if (!operation) return "emit-gap-unknown-operation";
3256
+ return (0, import_codegen50.validateInputs)(method, operation) ?? (0, import_codegen50.computeInputMemberError)(method, scope.functions, scope.shapes);
3257
+ }
3258
+
3259
+ // apps/m-one-ui/src/app/pages/design/lib/emit-gap-helper.ts
3260
+ var controlLabel = (control) => {
3261
+ const name = String(control.configs?.["name"] ?? "").trim();
3262
+ return name || control.type;
3263
+ };
3264
+ var featureSliceOf = (meta, features, appFunctions) => {
3265
+ if (!(0, import_codegen51.isFeatureScreen)(meta)) {
3266
+ return {
3267
+ methods: {},
3268
+ properties: {},
3269
+ functions: { ...appFunctions },
3270
+ computeds: {},
3271
+ roots: {},
3272
+ shapes: {}
3273
+ };
3274
+ }
3275
+ const feature = features[meta.featureId];
3276
+ const functions = { ...appFunctions, ...feature?.functions ?? {} };
3277
+ const readable = feature ? (0, import_codegen51.readableMembers)(feature, import_codegen51.MAIN_STORE_OWNER) : void 0;
3278
+ return {
3279
+ methods: readable?.methods ?? {},
3280
+ properties: readable?.properties ?? {},
3281
+ functions,
3282
+ computeds: readable?.computeds ?? {},
3283
+ roots: (0, import_codegen51.propertiesWithComputeds)(
3284
+ readable?.properties ?? {},
3285
+ readable?.computeds ?? {},
3286
+ functions
3287
+ ),
3288
+ shapes: feature?.shapes ?? {}
3289
+ };
3290
+ };
3291
+ var screenBindingOptions = (meta, controlMap, slice, inputs, variables, where) => ({
3292
+ ...where.controlId ? { controlId: where.controlId } : {},
3293
+ controlMap,
3294
+ roots: slice.roots,
3295
+ properties: slice.properties,
3296
+ shapes: slice.shapes,
3297
+ inputs,
3298
+ screenComputeds: meta.computeds,
3299
+ screenVariables: variables,
3300
+ formModels: meta.formModels,
3301
+ functions: slice.functions,
3302
+ enums: slice.enums,
3303
+ allowAlias: where.allowAlias
3304
+ });
3305
+ var callSiteError = (method, operationOf, rows, payload, constants, functions, bindings, properties = {}, methods = {}, eventMembers = []) => {
3306
+ if (!method) return "emit-gap-unknown-method";
3307
+ const op = operationOf(method);
3308
+ if (!op && !(0, import_codegen51.isStorageMethod)(method) && !(0, import_codegen51.isCacheMethod)(method)) {
3309
+ return "emit-gap-unknown-operation";
3310
+ }
3311
+ const args = (0, import_codegen51.isCacheMethod)(method) ? (0, import_codegen51.cacheMethodArgs)(method, methods, operationOf) : op ? (0, import_codegen51.methodArgs)(method, op) : (0, import_codegen51.storageMethodArgs)(method, properties);
3312
+ return (0, import_codegen51.validateCallArgs)(
3313
+ args,
3314
+ rows,
3315
+ payload,
3316
+ eventMembers,
3317
+ constants,
3318
+ functions,
3319
+ { roots: properties, bindings }
3320
+ );
3321
+ };
3322
+ var collectControlGaps = (gaps, meta, controlMap, slice, constants, inputs, variables, operationOf, screens = []) => {
3323
+ const embedded = embeddedOutputsOf(screens);
3324
+ const emitBindings = (control, scope) => ({
3325
+ options: screenBindingOptions(meta, controlMap, slice, inputs, variables, {
3326
+ controlId: control.id,
3327
+ allowAlias: scope === "template"
3328
+ })
3329
+ });
3330
+ Object.values(controlMap).forEach((control) => {
3331
+ const outputs = new Set([
3332
+ ...Object.keys(control.outputs ?? {}),
3333
+ ...Object.keys(control.outputWrites ?? {}),
3334
+ ...Object.keys(control.outputScreenWrites ?? {}),
3335
+ // An output that only opens a Screen holds nothing in the maps above, and
3336
+ // an overlay naming a Screen that is gone is a gesture that does nothing.
3337
+ ...Object.keys(control.outputOpens ?? {}),
3338
+ // An output whose rows all sit in an arm holds nothing in the three maps
3339
+ // above, and a broken row there is still a row that will not emit.
3340
+ ...Object.keys(control.outputOutcomes ?? {}),
3341
+ // An output whose one block is a ScreenEmit holds nothing in them
3342
+ // either, and a half-drawn emission is still a gesture that does
3343
+ // nothing (ADR 0143).
3344
+ ...Object.keys(control.outputEmits ?? {}),
3345
+ // A ScreenMethod whose parameters this call site leaves unanswered is a
3346
+ // call that cannot be spelled (ADR 0149).
3347
+ ...Object.keys(control.outputScreenMethods ?? {})
3348
+ ].filter(
3349
+ (output) => offersOutputKey(control, controlMap, output, embedded)
3350
+ ));
3351
+ const eventMembers = (0, import_codegen51.formEventMembers)(controlMap, control.id);
3352
+ const eventFields = (0, import_codegen51.formEventFieldTypes)(controlMap, control.id);
3353
+ const callBindings = screenBindingOptions(
3354
+ meta,
3355
+ controlMap,
3356
+ slice,
3357
+ inputs,
3358
+ variables,
3359
+ { controlId: control.id, allowAlias: true }
3360
+ );
3361
+ outputs.forEach((output) => {
3362
+ const methodId = control.outputs?.[output];
3363
+ const globalMethod = methodId ? (0, import_codegen51.globalMethodOf)(methodId) : void 0;
3364
+ if (methodId) {
3365
+ const err = globalMethod ? (0, import_codegen51.validateCallArgs)(
3366
+ (0, import_codegen51.globalMethodArgs)(globalMethod),
3367
+ (0, import_codegen51.outputArgRows)(control.outputArgs, output),
3368
+ outputPayloadShape(control, output, embedded),
3369
+ eventMembers,
3370
+ constants,
3371
+ slice.functions,
3372
+ { roots: slice.properties, bindings: callBindings }
3373
+ ) : callSiteError(
3374
+ slice.methods[methodId],
3375
+ operationOf,
3376
+ (0, import_codegen51.outputArgRows)(control.outputArgs, output),
3377
+ outputPayloadShape(control, output, embedded),
3378
+ constants,
3379
+ slice.functions,
3380
+ callBindings,
3381
+ slice.properties,
3382
+ slice.methods,
3383
+ eventMembers
3384
+ );
3385
+ if (err) {
3386
+ gaps.push({
3387
+ kind: "call-arg",
3388
+ screenId: meta.id,
3389
+ screenName: meta.name,
3390
+ message: err,
3391
+ subject: `${meta.name} \xB7 ${controlLabel(control)} \xB7 ${outputCallLabelOf(control, output, embedded)}`,
3392
+ controlId: control.id,
3393
+ output,
3394
+ methodId
3395
+ });
3396
+ }
3397
+ }
3398
+ const screenMethodId = control.outputScreenMethods?.[output];
3399
+ const screenMethod = screenMethodId ? meta.methods?.[screenMethodId] : void 0;
3400
+ if (screenMethod && (0, import_codegen51.screenMethodArgs)(screenMethod).length) {
3401
+ const err = (0, import_codegen51.validateCallArgs)(
3402
+ (0, import_codegen51.screenMethodArgs)(screenMethod),
3403
+ (0, import_codegen51.outputArgRows)(control.outputArgs, output),
3404
+ outputPayloadShape(control, output, embedded),
3405
+ eventMembers,
3406
+ constants,
3407
+ slice.functions,
3408
+ { roots: slice.properties, bindings: callBindings }
3409
+ );
3410
+ if (err) {
3411
+ gaps.push({
3412
+ kind: "call-arg",
3413
+ screenId: meta.id,
3414
+ screenName: meta.name,
3415
+ message: err,
3416
+ subject: `${meta.name} \xB7 ${controlLabel(control)} \xB7 ${outputCallLabelOf(control, output, embedded)}`,
3417
+ controlId: control.id,
3418
+ output
3419
+ });
3420
+ }
3421
+ }
3422
+ import_codegen51.OUTCOME_ARMS.forEach((arm) => {
3423
+ const rows = control.outputOutcomes?.[output]?.[arm];
3424
+ if (!rows) return;
3425
+ const resetErr = (0, import_codegen51.validateFormResets)(
3426
+ controlMap,
3427
+ rows.formResets ?? [],
3428
+ meta.formModels ?? {}
3429
+ );
3430
+ if (resetErr) {
3431
+ gaps.push({
3432
+ kind: "call-outcome",
3433
+ screenId: meta.id,
3434
+ screenName: meta.name,
3435
+ message: resetErr,
3436
+ subject: `${meta.name} \xB7 ${controlLabel(control)} \xB7 ${outputCallLabelOf(control, output, embedded)} \xB7 ${arm}`,
3437
+ controlId: control.id,
3438
+ output
3439
+ });
3440
+ }
3441
+ const armScreenWriteErr = (0, import_codegen51.validateScreenWrites)(
3442
+ variables,
3443
+ rows.screenWrites ?? [],
3444
+ outputPayloadShape(control, output, embedded),
3445
+ [],
3446
+ inputs,
3447
+ constants,
3448
+ slice.functions,
3449
+ eventFields
3450
+ );
3451
+ if (armScreenWriteErr) {
3452
+ gaps.push({
3453
+ kind: "call-outcome",
3454
+ screenId: meta.id,
3455
+ screenName: meta.name,
3456
+ message: armScreenWriteErr,
3457
+ subject: `${meta.name} \xB7 ${controlLabel(control)} \xB7 ${outputCallLabelOf(control, output, embedded)} \xB7 ${arm}`,
3458
+ controlId: control.id,
3459
+ output
3460
+ });
3461
+ }
3462
+ const armWriteErr = Object.keys(slice.properties).length ? (0, import_codegen51.validateStateWrites)(
3463
+ slice.properties,
3464
+ rows.writes ?? [],
3465
+ outputPayloadShape(control, output, embedded),
3466
+ [],
3467
+ inputs,
3468
+ constants,
3469
+ slice.functions,
3470
+ eventFields
3471
+ ) : void 0;
3472
+ if (armWriteErr) {
3473
+ gaps.push({
3474
+ kind: "call-outcome",
3475
+ screenId: meta.id,
3476
+ screenName: meta.name,
3477
+ message: armWriteErr,
3478
+ subject: `${meta.name} \xB7 ${controlLabel(control)} \xB7 ${outputCallLabelOf(control, output, embedded)} \xB7 ${arm}`,
3479
+ controlId: control.id,
3480
+ output
3481
+ });
3482
+ }
3483
+ });
3484
+ const openErr = (0, import_codegen51.validateOutputOpen)(
3485
+ (0, import_codegen51.outputOpenOf)(control.outputOpens, output),
3486
+ [...screens],
3487
+ outputPayloadShape(control, output, embedded),
3488
+ inputs,
3489
+ constants
3490
+ );
3491
+ if (openErr) {
3492
+ gaps.push({
3493
+ kind: "output-open",
3494
+ screenId: meta.id,
3495
+ screenName: meta.name,
3496
+ message: openErr,
3497
+ subject: `${meta.name} \xB7 ${controlLabel(control)} \xB7 ${output}`,
3498
+ controlId: control.id,
3499
+ output
3500
+ });
3501
+ }
3502
+ const emitErr = (0, import_codegen51.validateScreenEmits)(
3503
+ meta.outputs ?? {},
3504
+ (0, import_codegen51.screenEmitRows)(control.outputEmits, output),
3505
+ outputPayloadShape(control, output, embedded),
3506
+ [],
3507
+ inputs,
3508
+ constants,
3509
+ emitBindings(control, "template")
3510
+ );
3511
+ if (emitErr) {
3512
+ gaps.push({
3513
+ kind: "emit",
3514
+ screenId: meta.id,
3515
+ screenName: meta.name,
3516
+ message: emitErr,
3517
+ subject: `${meta.name} \xB7 ${controlLabel(control)} \xB7 ${output}`,
3518
+ controlId: control.id,
3519
+ output
3520
+ });
3521
+ }
3522
+ const open = (0, import_codegen51.outputOpenOf)(control.outputOpens, output);
3523
+ const opened = open?.screenId ? screens.find((one) => one.id === open.screenId) : void 0;
3524
+ for (const [outputId, wire] of Object.entries(open?.outputs ?? {})) {
3525
+ const declared = opened?.outputs?.[outputId];
3526
+ const failing = [
3527
+ ...wire.binding ? [wire.binding] : [],
3528
+ ...(wire.calls ?? []).filter((call) => !!call.methodId)
3529
+ ].map((one) => ({
3530
+ one,
3531
+ err: callSiteError(
3532
+ slice.methods[one.methodId],
3533
+ operationOf,
3534
+ one.args ?? [],
3535
+ declared?.payload ? declared.payload.dataType : "void",
3536
+ constants,
3537
+ slice.functions,
3538
+ // A wire's call is emitted into the class body (ADR 0144).
3539
+ screenBindingOptions(meta, controlMap, slice, inputs, variables, {
3540
+ allowAlias: false
3541
+ }),
3542
+ slice.properties,
3543
+ slice.methods
3544
+ )
3545
+ })).find(({ err }) => !!err);
3546
+ const callErr = failing?.err;
3547
+ const binding = failing?.one ?? wire.binding;
3548
+ const wireErr = !declared ? "screen-emit-unknown-output" : callErr ?? (0, import_codegen51.validateScreenEmits)(
3549
+ meta.outputs ?? {},
3550
+ wire.emits ?? [],
3551
+ declared.payload ? declared.payload.dataType : "void",
3552
+ [],
3553
+ inputs,
3554
+ constants,
3555
+ emitBindings(control, "class")
3556
+ );
3557
+ if (!wireErr) continue;
3558
+ gaps.push({
3559
+ kind: "output-open-output",
3560
+ screenId: meta.id,
3561
+ screenName: meta.name,
3562
+ message: wireErr,
3563
+ subject: `${meta.name} \xB7 ${controlLabel(control)} \xB7 ${output} \xB7 ${declared?.name ?? outputId}`,
3564
+ controlId: control.id,
3565
+ output,
3566
+ ...binding ? { methodId: binding.methodId } : {}
3567
+ });
3568
+ }
3569
+ const screenWriteErr = (0, import_codegen51.validateScreenWrites)(
3570
+ variables,
3571
+ (0, import_codegen51.screenWriteRows)(control.outputScreenWrites, output),
3572
+ outputPayloadShape(control, output, embedded),
3573
+ [],
3574
+ inputs,
3575
+ constants,
3576
+ slice.functions,
3577
+ eventFields
3578
+ );
3579
+ if (screenWriteErr) {
3580
+ gaps.push({
3581
+ kind: "screen-write",
3582
+ screenId: meta.id,
3583
+ screenName: meta.name,
3584
+ message: screenWriteErr,
3585
+ subject: `${meta.name} \xB7 ${controlLabel(control)} \xB7 ${output}`,
3586
+ controlId: control.id,
3587
+ output
3588
+ });
3589
+ }
3590
+ const writeRows = (0, import_codegen51.stateWriteRows)(control.outputWrites, output);
3591
+ if (!writeRows.length) return;
3592
+ if (!Object.keys(slice.properties).length) return;
3593
+ const writeErr = (0, import_codegen51.validateStateWrites)(
3594
+ slice.properties,
3595
+ writeRows,
3596
+ outputPayloadShape(control, output, embedded),
3597
+ [],
3598
+ inputs,
3599
+ constants,
3600
+ slice.functions,
3601
+ eventFields
3602
+ );
3603
+ if (writeErr) {
3604
+ gaps.push({
3605
+ kind: "state-write",
3606
+ screenId: meta.id,
3607
+ screenName: meta.name,
3608
+ message: writeErr,
3609
+ subject: `${meta.name} \xB7 ${controlLabel(control)} \xB7 ${output}`,
3610
+ controlId: control.id,
3611
+ output
3612
+ });
3613
+ }
3614
+ });
3615
+ });
3616
+ };
3617
+ var collectBindingGaps = (gaps, meta, controlMap, slice) => {
3618
+ Object.values(controlMap).forEach((control) => {
3619
+ Object.entries(control.bindings ?? {}).forEach(([slot, binding]) => {
3620
+ if (!binding.transform) return;
3621
+ const err = (0, import_codegen51.transformIncomplete)(
3622
+ binding.transform,
3623
+ slice.functions,
3624
+ slice.roots,
3625
+ slice.shapes
3626
+ );
3627
+ if (!err) return;
3628
+ gaps.push({
3629
+ kind: "binding",
3630
+ screenId: meta.id,
3631
+ screenName: meta.name,
3632
+ message: err,
3633
+ subject: `${meta.name} \xB7 ${controlLabel(control)} \xB7 ${slot}`,
3634
+ // The parameter still unanswered where one of them is, so the panel
3635
+ // names what to go and fill in rather than only the call it sits under.
3636
+ detail: (0, import_codegen51.transformGapDetail)(
3637
+ binding.transform,
3638
+ slice.functions,
3639
+ slice.roots,
3640
+ slice.shapes
3641
+ ) ?? (0, import_codegen51.transformLabel)(binding.transform, slice.functions),
3642
+ controlId: control.id,
3643
+ slot
3644
+ });
3645
+ });
3646
+ });
3647
+ };
3648
+ var autoCallReadError = (call, bindings) => {
3649
+ if (!call.reads?.length) return void 0;
3650
+ const offered = new Set(
3651
+ (0, import_codegen51.bindingOptions)(bindings, () => true).map((option) => option.value)
3652
+ );
3653
+ return call.reads.every((read) => offered.has((0, import_codegen51.encodeBinding)(read))) ? void 0 : "auto-call-read-gone";
3654
+ };
3655
+ var collectAutoCallGaps = (gaps, meta, calls, slice, constants, operationOf, bindings) => {
3656
+ calls.forEach((call) => {
3657
+ const err = (0, import_codegen51.screenAutoCallError)(call) ?? (call.methodId ? callSiteError(
3658
+ slice.methods[call.methodId],
3659
+ operationOf,
3660
+ call.args,
3661
+ "void",
3662
+ constants,
3663
+ slice.functions,
3664
+ bindings,
3665
+ slice.properties,
3666
+ slice.methods
3667
+ ) : void 0) ?? (0, import_codegen51.validateScreenEmits)(
3668
+ meta.outputs ?? {},
3669
+ call.emits ?? [],
3670
+ "void",
3671
+ [],
3672
+ meta.inputs ?? {},
3673
+ constants,
3674
+ { options: bindings }
3675
+ ) ?? autoCallReadError(call, bindings);
3676
+ if (!err) return;
3677
+ gaps.push({
3678
+ kind: "auto-call",
3679
+ screenId: meta.id,
3680
+ screenName: meta.name,
3681
+ message: err,
3682
+ subject: `${meta.name} \xB7 auto-call`,
3683
+ ...call.methodId ? { methodId: call.methodId } : {},
3684
+ autoCallId: call.id
3685
+ });
3686
+ });
3687
+ };
3688
+ var collectMethodGaps = (gaps, scope) => {
3689
+ Object.values(scope.features).forEach((feature) => {
3690
+ const screen = scope.screens.find(
3691
+ ({ meta }) => (0, import_codegen51.isFeatureScreen)(meta) && meta.featureId === feature.id
3692
+ )?.meta;
3693
+ const functions = { ...scope.functions, ...feature.functions ?? {} };
3694
+ (0, import_codegen51.storesOf)(feature).forEach((owned) => {
3695
+ const readable = (0, import_codegen51.readableMembers)(feature, owned.owner);
3696
+ Object.values(owned.methods).forEach((method) => {
3697
+ const error = storeMethodError(method, {
3698
+ operationOf: scope.operationOf,
3699
+ siblings: owned.methods,
3700
+ methods: readable.methods,
3701
+ properties: readable.properties,
3702
+ functions,
3703
+ shapes: feature.shapes ?? {}
3704
+ });
3705
+ if (!error || error === "emit-gap-unknown-operation") return;
3706
+ gaps.push({
3707
+ kind: "method",
3708
+ screenId: screen?.id ?? "",
3709
+ screenName: screen?.name ?? feature.name,
3710
+ message: error,
3711
+ subject: `${feature.name} \xB7 ${method.name}`,
3712
+ methodId: method.id
3713
+ });
3714
+ });
3715
+ });
3716
+ });
3717
+ };
3718
+ var collectResponseGaps = (gaps, scope) => {
3719
+ Object.values(scope.features).forEach((feature) => {
3720
+ const screen = scope.screens.find(
3721
+ ({ meta }) => (0, import_codegen51.isFeatureScreen)(meta) && meta.featureId === feature.id
3722
+ )?.meta;
3723
+ (0, import_codegen51.storesOf)(feature).forEach((owned) => {
3724
+ const readable = (0, import_codegen51.readableMembers)(feature, owned.owner);
3725
+ Object.values(owned.methods).forEach((method) => {
3726
+ const read = scope.operationOf(method);
3727
+ if (!read) return;
3728
+ const emitted = (0, import_codegen51.emittedOperation)(read, feature.shapes);
3729
+ const roots = (0, import_codegen51.propertiesWithComputeds)(
3730
+ readable.properties,
3731
+ readable.computeds,
3732
+ feature.functions ?? {}
3733
+ );
3734
+ const judge = (mapping, op) => {
3735
+ if (mapping.transform) {
3736
+ const failure = (0, import_codegen51.outcomeTransformFailure)(
3737
+ mapping,
3738
+ method,
3739
+ op,
3740
+ readable.properties,
3741
+ feature.shapes,
3742
+ feature.functions ?? {},
3743
+ roots
3744
+ );
3745
+ return failure && { err: failure.error, ...failure };
3746
+ }
3747
+ const err = (0, import_codegen51.responseMappingError)(
3748
+ mapping,
3749
+ op,
3750
+ readable.properties,
3751
+ feature.shapes
3752
+ );
3753
+ return err && {
3754
+ err,
3755
+ detail: (0, import_codegen51.responseMappingDetail)(
3756
+ mapping,
3757
+ op,
3758
+ readable.properties,
3759
+ feature.shapes
3760
+ ),
3761
+ paramIndex: void 0
3762
+ };
3763
+ };
3764
+ method.response.forEach((mapping) => {
3765
+ const verdict = judge(mapping, read) ?? judge(mapping, emitted);
3766
+ if (!verdict) return;
3767
+ const { err, detail, paramIndex } = verdict;
3768
+ gaps.push({
3769
+ kind: "response",
3770
+ screenId: screen?.id ?? "",
3771
+ screenName: screen?.name ?? feature.name,
3772
+ message: err,
3773
+ subject: `${feature.name} \xB7 ${method.name} \xB7 ${mapping.code}`,
3774
+ ...detail ? { detail } : {},
3775
+ methodId: method.id,
3776
+ anchor: `${mapping.code}:${mapping.propertyId}`,
3777
+ ...paramIndex !== void 0 ? { paramIndex } : {}
3778
+ });
3779
+ });
3780
+ });
3781
+ });
3782
+ });
3783
+ };
3784
+ var collectShadowedShapeGaps = (gaps, scope) => {
3785
+ Object.values(scope.features).forEach((feature) => {
3786
+ const screen = scope.screens.find(
3787
+ ({ meta }) => (0, import_codegen51.isFeatureScreen)(meta) && meta.featureId === feature.id
3788
+ )?.meta;
3789
+ const reads = (0, import_codegen51.storesOf)(feature).flatMap(
3790
+ (owned) => Object.values(owned.methods).flatMap((method) => {
3791
+ const op = scope.operationOf(method);
3792
+ return op ? [{ method, op }] : [];
3793
+ })
3794
+ );
3795
+ (0, import_codegen51.shadowedShapes)(
3796
+ reads.map(({ op }) => op),
3797
+ feature.shapes
3798
+ ).forEach((shadow) => {
3799
+ const first = reads.find(
3800
+ ({ op }) => (0, import_codegen51.shadowedShapes)([op], feature.shapes).some(
3801
+ (row) => row.shapeId === shadow.shapeId
3802
+ )
3803
+ );
3804
+ gaps.push({
3805
+ kind: "response",
3806
+ screenId: screen?.id ?? "",
3807
+ screenName: screen?.name ?? feature.name,
3808
+ message: "emit-gap-shape-shadowed",
3809
+ subject: `${feature.name} \xB7 ${shadow.name}`,
3810
+ detail: shadow.details.join("; "),
3811
+ ...first ? { methodId: first.method.id } : {},
3812
+ anchor: shadow.shapeId
3813
+ });
3814
+ });
3815
+ });
3816
+ };
3817
+ var collectNavInstanceGaps = (gaps, scope) => {
3818
+ const navMap = scope.navMap;
3819
+ if (!navMap) return;
3820
+ Object.values(navMap).filter((nav) => nav.presentation === "dynamic" && !!nav.instanceSource).forEach((nav) => {
3821
+ const source = nav.instanceSource;
3822
+ if (!source?.featureId) return;
3823
+ const subject = `${nav.navId} \xB7 :${(0, import_codegen51.navParam)(nav)}`;
3824
+ const push = (message, detail) => {
3825
+ gaps.push({
3826
+ kind: "nav-instance",
3827
+ screenId: "",
3828
+ screenName: nav.navId,
3829
+ message,
3830
+ subject,
3831
+ ...detail ? { detail } : {},
3832
+ navId: nav.navId
3833
+ });
3834
+ };
3835
+ const feature = scope.features[source.featureId];
3836
+ if (!feature) return push("instance-resolver-feature-gone");
3837
+ if (!source.functionId) return push("instance-resolver-unbound");
3838
+ const fn = feature.functions?.[source.functionId];
3839
+ if (!fn) return push("instance-resolver-function-gone");
3840
+ if (!(0, import_codegen51.navInstanceReturn)(fn, feature))
3841
+ return push("instance-resolver-return-unfit", fn.name);
3842
+ const unmapped = (0, import_codegen51.unmappedParams)(fn, source.args);
3843
+ if (unmapped.length)
3844
+ push("instance-resolver-args-unmapped", unmapped.join(", "));
3845
+ });
3846
+ };
3847
+ var collectEmitGaps = (scope) => {
3848
+ const gaps = [];
3849
+ const embedded = embeddedOutputsOf(scope.screens.map(({ meta }) => meta));
3850
+ scope.screens.forEach(({ meta, state }) => {
3851
+ const slice = {
3852
+ ...featureSliceOf(meta, scope.features, scope.functions),
3853
+ enums: scope.enums
3854
+ };
3855
+ collectControlGaps(
3856
+ gaps,
3857
+ meta,
3858
+ state.controlMap,
3859
+ slice,
3860
+ meta.constants ?? {},
3861
+ meta.inputs ?? {},
3862
+ meta.variables ?? {},
3863
+ scope.operationOf,
3864
+ scope.screens.map((screen) => screen.meta)
3865
+ );
3866
+ Object.values(state.controlMap).forEach((control) => {
3867
+ Object.keys(control.outputArms ?? {}).forEach((output) => {
3868
+ if (!offersOutputKey(control, state.controlMap, output, embedded)) return;
3869
+ (0, import_codegen51.outputArms)(control, output).forEach((arm, index) => {
3870
+ if ((0, import_codegen51.isOutputArmComplete)(arm)) return;
3871
+ gaps.push({
3872
+ kind: "binding",
3873
+ screenId: meta.id,
3874
+ screenName: meta.name,
3875
+ subject: `${meta.name} \xB7 ${controlLabel(control)} \xB7 ${output} ${index + 1}`,
3876
+ controlId: control.id,
3877
+ slot: (0, import_codegen51.outputArmKey)(output, arm.id),
3878
+ message: arm.checks.length ? "Finish this arm condition \u2014 a check is missing its subject, operator or value." : "Give this arm a condition, or it never runs."
3879
+ });
3880
+ });
3881
+ });
3882
+ });
3883
+ Object.values(state.controlMap).forEach((control) => {
3884
+ const outputs = /* @__PURE__ */ new Set([
3885
+ ...Object.keys(control.outputNavs ?? {}),
3886
+ ...Object.keys(control.outputNewTabs ?? {})
3887
+ ]);
3888
+ outputs.forEach((output) => {
3889
+ if (!offersOutputKey(control, state.controlMap, output, embedded)) return;
3890
+ const message = (0, import_codegen51.validateOutputNewTab)(
3891
+ (0, import_codegen51.outputNewTabOf)(control.outputNewTabs, output),
3892
+ slice.functions
3893
+ ) ?? (scope.navMap ? (0, import_codegen51.validateOutputNav)(
3894
+ (0, import_codegen51.outputNavOf)(control.outputNavs, output),
3895
+ scope.navMap
3896
+ ) : void 0);
3897
+ if (!message) return;
3898
+ gaps.push({
3899
+ kind: "output-link",
3900
+ screenId: meta.id,
3901
+ screenName: meta.name,
3902
+ message,
3903
+ subject: `${meta.name} \xB7 ${controlLabel(control)} \xB7 ${output}`,
3904
+ controlId: control.id,
3905
+ output
3906
+ });
3907
+ });
3908
+ });
3909
+ Object.values(state.controlMap).forEach((control) => {
3910
+ if (control.type !== import_codegen51.ControlType.CONTEXT_MENU) return;
3911
+ const binding = control.bindings?.["options"];
3912
+ const message = binding ? (0, import_codegen51.bindingGapReason)(binding, {
3913
+ properties: slice.roots,
3914
+ shapes: slice.shapes,
3915
+ computeds: slice.computeds,
3916
+ functions: slice.functions,
3917
+ inputs: meta.inputs,
3918
+ screenComputeds: meta.computeds,
3919
+ screenVariables: meta.variables,
3920
+ formModels: meta.formModels,
3921
+ constants: meta.constants,
3922
+ storeProp: "store",
3923
+ controlMap: state.controlMap
3924
+ }) : (0, import_codegen51.menuOptionsOf)(control).some((group) => group.length) ? void 0 : "Author menu options or bind a collection.";
3925
+ if (message)
3926
+ gaps.push({
3927
+ kind: "binding",
3928
+ screenId: meta.id,
3929
+ screenName: meta.name,
3930
+ subject: `${meta.name} \xB7 ${controlLabel(control)} \xB7 options`,
3931
+ controlId: control.id,
3932
+ slot: "options",
3933
+ message
3934
+ });
3935
+ (0, import_codegen51.menuActionSlots)(control).forEach((slot, index) => {
3936
+ if ((0, import_codegen51.isMenuActionSlotComplete)(slot)) return;
3937
+ gaps.push({
3938
+ kind: "binding",
3939
+ screenId: meta.id,
3940
+ screenName: meta.name,
3941
+ subject: `${meta.name} \xB7 ${controlLabel(control)} \xB7 action ${index + 1}`,
3942
+ controlId: control.id,
3943
+ slot: (0, import_codegen51.menuActionKey)(slot.id),
3944
+ message: slot.checks.length ? "Finish this action condition \u2014 a check is missing its operator or value." : "Give this action a condition, or it fires for nothing."
3945
+ });
3946
+ });
3947
+ if (binding) return;
3948
+ (0, import_codegen51.staleMenuActionItems)(control).forEach(
3949
+ ({ slotId, itemId }) => gaps.push({
3950
+ kind: "binding",
3951
+ screenId: meta.id,
3952
+ screenName: meta.name,
3953
+ subject: `${meta.name} \xB7 ${controlLabel(control)} \xB7 ${itemId}`,
3954
+ controlId: control.id,
3955
+ slot: (0, import_codegen51.menuActionKey)(slotId),
3956
+ message: "This menu no longer holds the item this action is gated on."
3957
+ })
3958
+ );
3959
+ });
3960
+ collectBindingGaps(gaps, meta, state.controlMap, slice);
3961
+ collectAutoCallGaps(
3962
+ gaps,
3963
+ meta,
3964
+ meta.autoCalls ?? [],
3965
+ slice,
3966
+ meta.constants ?? {},
3967
+ scope.operationOf,
3968
+ screenBindingOptions(
3969
+ meta,
3970
+ state.controlMap,
3971
+ slice,
3972
+ meta.inputs ?? {},
3973
+ meta.variables ?? {},
3974
+ { allowAlias: false }
3975
+ )
3976
+ );
3977
+ });
3978
+ collectShadowedShapeGaps(gaps, scope);
3979
+ collectResponseGaps(gaps, scope);
3980
+ collectMethodGaps(gaps, scope);
3981
+ collectNavInstanceGaps(gaps, scope);
3982
+ return gaps;
3983
+ };
3984
+
2703
3985
  // apps/m-one-ui/src/app/pages/design/lib/invariant-catalog.ts
2704
3986
  var INVARIANTS = [
2705
3987
  appScaffoldComplete,
@@ -2751,17 +4033,32 @@ var INVARIANTS = [
2751
4033
  ruleOperandFits,
2752
4034
  themeSelectionResolves,
2753
4035
  timerComplete,
2754
- variantGateSatisfiable
4036
+ variantGateSatisfiable,
4037
+ // Gesture rules, judged on the design as it stands so an edit made outside
4038
+ // the editor meets them too (0128_11).
4039
+ routerOutletPlaced,
4040
+ controlIdUnique,
4041
+ fieldKeyTypeAgrees,
4042
+ submitTargetResolves,
4043
+ formResetResolves,
4044
+ ruleFieldResolves,
4045
+ embedShapeWithinFeature,
4046
+ storeNameReserved,
4047
+ storeMemberNameUnique,
4048
+ functionNameUnshadowed,
4049
+ functionTierFiled,
4050
+ functionRefExclusive,
4051
+ bindingResolvesOutputs
2755
4052
  ];
2756
4053
  var runInvariants = (scope) => INVARIANTS.flatMap((invariant) => invariant.run(scope));
2757
4054
  var invariantScopeOf = (source, themeCatalog) => ({
2758
4055
  appTarget: source.appTarget,
2759
4056
  wcConfig: source.wcConfig,
2760
- features: (0, import_codegen46.featuresAsRead)(
4057
+ features: (0, import_codegen52.featuresAsRead)(
2761
4058
  source.features,
2762
4059
  source.sharedShapes,
2763
4060
  source.screens.map(({ meta, state }) => ({
2764
- ...(0, import_codegen46.isFeatureScreen)(meta) ? { featureId: meta.featureId } : {},
4061
+ ...(0, import_codegen52.isFeatureScreen)(meta) ? { featureId: meta.featureId } : {},
2765
4062
  controlMap: state.controlMap
2766
4063
  }))
2767
4064
  ),
@@ -2783,6 +4080,8 @@ var invariantScopeOf = (source, themeCatalog) => ({
2783
4080
  // Annotate the CommonJS export names for ESM import in node:
2784
4081
  0 && (module.exports = {
2785
4082
  INVARIANTS,
4083
+ codecDrops,
4084
+ collectEmitGaps,
2786
4085
  invariantScopeOf,
2787
4086
  runInvariants
2788
4087
  });