@kosdev-code/kos-dispense-sdk 0.1.0-next.971 → 0.1.0-next.979

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/.kos.json +7 -0
  2. package/{dispense-registration-manager-Da9CW_cN.js → dispense-registration-manager-J59_vyyY.js} +584 -184
  3. package/dispense-registration-manager-J59_vyyY.js.map +1 -0
  4. package/{dispense-registration-manager-Dtb31fcI.cjs → dispense-registration-manager-OYGAiIZy.cjs} +551 -151
  5. package/dispense-registration-manager-OYGAiIZy.cjs.map +1 -0
  6. package/{extension-utils-D_dnBLH6.js → extension-utils-DEM1emOY.js} +2 -2
  7. package/{extension-utils-D_dnBLH6.js.map → extension-utils-DEM1emOY.js.map} +1 -1
  8. package/{extension-utils-Cfhe358W.cjs → extension-utils-Pd5ntKtv.cjs} +2 -2
  9. package/{extension-utils-Cfhe358W.cjs.map → extension-utils-Pd5ntKtv.cjs.map} +1 -1
  10. package/index.cjs +6 -4
  11. package/index.cjs.map +1 -1
  12. package/index.js +66 -64
  13. package/models/models/cui-kit-state/cui-kit-state-model.d.ts +131 -0
  14. package/models/models/cui-kit-state/cui-kit-state-model.d.ts.map +1 -0
  15. package/models/models/cui-kit-state/index.d.ts +4 -0
  16. package/models/models/cui-kit-state/index.d.ts.map +1 -0
  17. package/models/models/cui-kit-state/types/index.d.ts +68 -0
  18. package/models/models/index.d.ts +1 -0
  19. package/models/models/index.d.ts.map +1 -1
  20. package/models/utils/dispense-registration-manager.d.ts +13 -0
  21. package/models/utils/dispense-registration-manager.d.ts.map +1 -1
  22. package/models/utils/pour-context.d.ts +8 -0
  23. package/models/utils/pour-context.d.ts.map +1 -0
  24. package/models/utils/service.d.ts +1 -1
  25. package/models/utils/services/dispense/1.6.5/service.d.ts +1 -1
  26. package/models/utils/services/dispense/1.8.1/service.d.ts +1 -1
  27. package/models/utils/services/dispense/daily/service.d.ts +1 -1
  28. package/models.cjs +4 -2
  29. package/models.cjs.map +1 -1
  30. package/models.js +17 -15
  31. package/package.json +5 -5
  32. package/{pump-provider-uNNMh9uh.cjs → pump-provider-BSbTT-BC.cjs} +371 -418
  33. package/pump-provider-BSbTT-BC.cjs.map +1 -0
  34. package/{pump-provider-BQmCKz7S.js → pump-provider-Ch7NOeRj.js} +417 -464
  35. package/pump-provider-Ch7NOeRj.js.map +1 -0
  36. package/ui/contexts/cui-kit/cui-kit.d.ts +12 -1
  37. package/ui/contexts/cui-kit/cui-kit.d.ts.map +1 -1
  38. package/ui/hooks/cui-kit/use-cui-kit.d.ts +44 -5
  39. package/ui/hooks/cui-kit/use-cui-kit.d.ts.map +1 -1
  40. package/ui/hooks/utils/pour-strategy/hold-to-pour-intent-strategy.d.ts.map +1 -1
  41. package/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.d.ts.map +1 -1
  42. package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts +2 -0
  43. package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts.map +1 -1
  44. package/ui/hooks/utils/pour-strategy/tap-or-hold-to-pour-intent-strategy.d.ts.map +1 -1
  45. package/ui/utils/pour-context.d.ts +1 -7
  46. package/ui/utils/pour-context.d.ts.map +1 -1
  47. package/ui.cjs +3 -2
  48. package/ui.cjs.map +1 -1
  49. package/ui.js +49 -48
  50. package/ui.js.map +1 -1
  51. package/dispense-registration-manager-Da9CW_cN.js.map +0 -1
  52. package/dispense-registration-manager-Dtb31fcI.cjs.map +0 -1
  53. package/pump-provider-BQmCKz7S.js.map +0 -1
  54. package/pump-provider-uNNMh9uh.cjs.map +0 -1
@@ -31,15 +31,15 @@ var DispenseModelType = /* @__PURE__ */ ((DispenseModelType2) => {
31
31
  DispenseModelType2["PumpContainer"] = "pump-container-model";
32
32
  return DispenseModelType2;
33
33
  })(DispenseModelType || {});
34
- var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
35
- var __decorateClass$c = (decorators, target, key, kind) => {
36
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
34
+ var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
35
+ var __decorateClass$d = (decorators, target, key, kind) => {
36
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
37
37
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
38
38
  if (decorator = decorators[i])
39
39
  result = decorator(result) || result;
40
40
  return result;
41
41
  };
42
- const MODEL_TYPE$c = "ingredient-model";
42
+ const MODEL_TYPE$d = "ingredient-model";
43
43
  let IngredientModelImpl = class {
44
44
  id;
45
45
  ingredientId;
@@ -76,19 +76,19 @@ let IngredientModelImpl = class {
76
76
  // -------------------LIFECYCLE----------------------------
77
77
  // -------------------ENTITY----------------------------
78
78
  };
79
- IngredientModelImpl = __decorateClass$c([
80
- kosUiSdk.kosModel(MODEL_TYPE$c)
79
+ IngredientModelImpl = __decorateClass$d([
80
+ kosUiSdk.kosModel(MODEL_TYPE$d)
81
81
  ], IngredientModelImpl);
82
82
  const Ingredient = {
83
83
  registration: {
84
- [MODEL_TYPE$c]: {
84
+ [MODEL_TYPE$d]: {
85
85
  class: IngredientModelImpl,
86
86
  singleton: false
87
87
  }
88
88
  },
89
- type: MODEL_TYPE$c,
90
- predicate: kosUiSdk.isKosModel(MODEL_TYPE$c),
91
- factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$c)
89
+ type: MODEL_TYPE$d,
90
+ predicate: kosUiSdk.isKosModel(MODEL_TYPE$d),
91
+ factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$d)
92
92
  };
93
93
  const { URL: URL$6 } = kosUiSdk.resolveServiceUrl("INGREDIENT_SERVICE");
94
94
  const { getOne: getOne$3 } = kosUiSdk.ServiceFactory.build({
@@ -100,17 +100,17 @@ const getIngredients = async () => {
100
100
  });
101
101
  return response;
102
102
  };
103
- var __defProp$9 = Object.defineProperty;
104
- var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
105
- var __decorateClass$b = (decorators, target, key, kind) => {
106
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
103
+ var __defProp$a = Object.defineProperty;
104
+ var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
105
+ var __decorateClass$c = (decorators, target, key, kind) => {
106
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
107
107
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
108
108
  if (decorator = decorators[i])
109
109
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
110
- if (kind && result) __defProp$9(target, key, result);
110
+ if (kind && result) __defProp$a(target, key, result);
111
111
  return result;
112
112
  };
113
- const MODEL_TYPE$b = "ingredient-container-model";
113
+ const MODEL_TYPE$c = "ingredient-container-model";
114
114
  const log$3 = kosUiSdk.KosLog.createLogger({ name: "ingredient-container-model" });
115
115
  let IngredientContainerModelImpl = class {
116
116
  id;
@@ -169,22 +169,22 @@ let IngredientContainerModelImpl = class {
169
169
  }
170
170
  // -------------------ENTITY----------------------------
171
171
  };
172
- __decorateClass$b([
172
+ __decorateClass$c([
173
173
  kosUiSdk.kosChild
174
174
  ], IngredientContainerModelImpl.prototype, "ingredients", 2);
175
- IngredientContainerModelImpl = __decorateClass$b([
176
- kosUiSdk.kosModel(MODEL_TYPE$b)
175
+ IngredientContainerModelImpl = __decorateClass$c([
176
+ kosUiSdk.kosModel(MODEL_TYPE$c)
177
177
  ], IngredientContainerModelImpl);
178
178
  const IngredientContainer = {
179
179
  registration: {
180
- [MODEL_TYPE$b]: {
180
+ [MODEL_TYPE$c]: {
181
181
  class: IngredientContainerModelImpl,
182
182
  singleton: true
183
183
  }
184
184
  },
185
- type: MODEL_TYPE$b,
186
- predicate: kosUiSdk.isKosModel(MODEL_TYPE$b),
187
- factory: kosUiSdk.Kos.Singleton.create(MODEL_TYPE$b)
185
+ type: MODEL_TYPE$c,
186
+ predicate: kosUiSdk.isKosModel(MODEL_TYPE$c),
187
+ factory: kosUiSdk.Kos.Singleton.create(MODEL_TYPE$c)
188
188
  };
189
189
  const { URL: URL$5 } = kosUiSdk.resolveServiceUrl("HOLDER_SERVICE");
190
190
  const { getAll: getAll$1, postModel: postModel$4, deleteModel: deleteModel$2 } = kosUiSdk.ServiceFactory.build({
@@ -274,17 +274,17 @@ const deleteAssignment = async (id) => {
274
274
  const response = await deleteModel$1({ id, fos: useFos });
275
275
  return response;
276
276
  };
277
- var __defProp$8 = Object.defineProperty;
278
- var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
279
- var __decorateClass$a = (decorators, target, key, kind) => {
280
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
277
+ var __defProp$9 = Object.defineProperty;
278
+ var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
279
+ var __decorateClass$b = (decorators, target, key, kind) => {
280
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
281
281
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
282
282
  if (decorator = decorators[i])
283
283
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
284
- if (kind && result) __defProp$8(target, key, result);
284
+ if (kind && result) __defProp$9(target, key, result);
285
285
  return result;
286
286
  };
287
- const MODEL_TYPE$a = DispenseModelType.Holder;
287
+ const MODEL_TYPE$b = DispenseModelType.Holder;
288
288
  const log$1 = kosUiSdk.KosLog.createLogger({ name: "holder-model" });
289
289
  kosUiSdk.ExtensionManager[kosUiSdk.EXTENSION_TROUBLE_MAPPER].register(
290
290
  "holder",
@@ -611,26 +611,26 @@ let HolderModelImpl = class {
611
611
  // }
612
612
  // -------------------ENTITY----------------------------
613
613
  };
614
- __decorateClass$a([
614
+ __decorateClass$b([
615
615
  kosUiSdk.kosChild
616
616
  ], HolderModelImpl.prototype, "pumps", 2);
617
- __decorateClass$a([
617
+ __decorateClass$b([
618
618
  kosUiSdk.kosDependency({ modelType: IngredientContainer.type })
619
619
  ], HolderModelImpl.prototype, "ingredientContainer", 2);
620
- HolderModelImpl = __decorateClass$a([
621
- kosUiSdk.kosModel(MODEL_TYPE$a),
620
+ HolderModelImpl = __decorateClass$b([
621
+ kosUiSdk.kosModel(MODEL_TYPE$b),
622
622
  kosUiSdk.kosTroubleAware()
623
623
  ], HolderModelImpl);
624
624
  const Holder = {
625
625
  registration: {
626
- [MODEL_TYPE$a]: {
626
+ [MODEL_TYPE$b]: {
627
627
  class: HolderModelImpl,
628
628
  singleton: false
629
629
  }
630
630
  },
631
- type: MODEL_TYPE$a,
632
- predicate: kosUiSdk.isKosModel(MODEL_TYPE$a),
633
- factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$a)
631
+ type: MODEL_TYPE$b,
632
+ predicate: kosUiSdk.isKosModel(MODEL_TYPE$b),
633
+ factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$b)
634
634
  };
635
635
  const mapAssemblyHolderToModel = async (group, holderData) => {
636
636
  const _ingredientId = kosUiSdk.ExtensionManager.propertyMapper.executeMapper(
@@ -686,17 +686,17 @@ const getAssembly = async () => {
686
686
  const response = await getOne$2({});
687
687
  return response;
688
688
  };
689
- var __defProp$7 = Object.defineProperty;
690
- var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
691
- var __decorateClass$9 = (decorators, target, key, kind) => {
692
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
689
+ var __defProp$8 = Object.defineProperty;
690
+ var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
691
+ var __decorateClass$a = (decorators, target, key, kind) => {
692
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
693
693
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
694
694
  if (decorator = decorators[i])
695
695
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
696
- if (kind && result) __defProp$7(target, key, result);
696
+ if (kind && result) __defProp$8(target, key, result);
697
697
  return result;
698
698
  };
699
- const MODEL_TYPE$9 = "board-container-model";
699
+ const MODEL_TYPE$a = "board-container-model";
700
700
  const TOPIC_BOARD_LINKED = "/kos/hardware/board/linked";
701
701
  const TOPIC_BOARD_UNLINKED = "/kos/hardware/board/unlinked";
702
702
  exports.BoardContainerModel = class BoardContainerModel {
@@ -750,25 +750,25 @@ exports.BoardContainerModel = class BoardContainerModel {
750
750
  }
751
751
  }
752
752
  };
753
- __decorateClass$9([
753
+ __decorateClass$a([
754
754
  kosUiSdk.kosChild
755
755
  ], exports.BoardContainerModel.prototype, "models", 2);
756
- __decorateClass$9([
756
+ __decorateClass$a([
757
757
  kosUiSdk.kosTopicHandler({
758
758
  lifecycle: kosUiSdk.DependencyLifecycle.INIT,
759
759
  topic: TOPIC_BOARD_LINKED,
760
760
  websocket: true
761
761
  })
762
762
  ], exports.BoardContainerModel.prototype, "handleBoardLinkEvent", 1);
763
- __decorateClass$9([
763
+ __decorateClass$a([
764
764
  kosUiSdk.kosTopicHandler({
765
765
  lifecycle: kosUiSdk.DependencyLifecycle.INIT,
766
766
  topic: TOPIC_BOARD_UNLINKED,
767
767
  websocket: true
768
768
  })
769
769
  ], exports.BoardContainerModel.prototype, "handleBoardUnlinkEvent", 1);
770
- exports.BoardContainerModel = __decorateClass$9([
771
- kosUiSdk.kosModel(MODEL_TYPE$9)
770
+ exports.BoardContainerModel = __decorateClass$a([
771
+ kosUiSdk.kosModel(MODEL_TYPE$a)
772
772
  ], exports.BoardContainerModel);
773
773
  const boardTroubleDataMapper = async (trouble) => {
774
774
  const boardPath = trouble.data.boardPath;
@@ -777,17 +777,17 @@ const boardTroubleDataMapper = async (trouble) => {
777
777
  boardName: model?.name || ""
778
778
  };
779
779
  };
780
- var __defProp$6 = Object.defineProperty;
781
- var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
782
- var __decorateClass$8 = (decorators, target, key, kind) => {
783
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
780
+ var __defProp$7 = Object.defineProperty;
781
+ var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
782
+ var __decorateClass$9 = (decorators, target, key, kind) => {
783
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
784
784
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
785
785
  if (decorator = decorators[i])
786
786
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
787
- if (kind && result) __defProp$6(target, key, result);
787
+ if (kind && result) __defProp$7(target, key, result);
788
788
  return result;
789
789
  };
790
- const MODEL_TYPE$8 = DispenseModelType.PumpContainer;
790
+ const MODEL_TYPE$9 = DispenseModelType.PumpContainer;
791
791
  var PumpIndex = /* @__PURE__ */ ((PumpIndex2) => {
792
792
  PumpIndex2["byBoard"] = "byBoard";
793
793
  PumpIndex2["byType"] = "byType";
@@ -843,23 +843,23 @@ let PumpContainerModelImpl = class {
843
843
  }
844
844
  // -------------------ENTITY----------------------------
845
845
  };
846
- __decorateClass$8([
846
+ __decorateClass$9([
847
847
  kosUiSdk.kosChild
848
848
  ], PumpContainerModelImpl.prototype, "pumps", 2);
849
- PumpContainerModelImpl = __decorateClass$8([
850
- kosUiSdk.kosModel(MODEL_TYPE$8)
849
+ PumpContainerModelImpl = __decorateClass$9([
850
+ kosUiSdk.kosModel(MODEL_TYPE$9)
851
851
  ], PumpContainerModelImpl);
852
852
  const PumpContainer = {
853
853
  registration: {
854
- [MODEL_TYPE$8]: {
854
+ [MODEL_TYPE$9]: {
855
855
  class: PumpContainerModelImpl,
856
856
  singleton: true
857
857
  }
858
858
  },
859
- type: MODEL_TYPE$8,
860
- predicate: kosUiSdk.isKosModel(MODEL_TYPE$8),
859
+ type: MODEL_TYPE$9,
860
+ predicate: kosUiSdk.isKosModel(MODEL_TYPE$9),
861
861
  factory: kosUiSdk.Kos.Singleton.create(
862
- MODEL_TYPE$8
862
+ MODEL_TYPE$9
863
863
  )
864
864
  };
865
865
  const getPumpRelatedPaths = async (pumpPath) => {
@@ -903,15 +903,15 @@ const boardTroubleResolver = async (trouble) => {
903
903
  }
904
904
  return Array.from(new Set(result));
905
905
  };
906
- var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
907
- var __decorateClass$7 = (decorators, target, key, kind) => {
908
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
906
+ var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
907
+ var __decorateClass$8 = (decorators, target, key, kind) => {
908
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
909
909
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
910
910
  if (decorator = decorators[i])
911
911
  result = decorator(result) || result;
912
912
  return result;
913
913
  };
914
- const MODEL_TYPE$7 = "board-model";
914
+ const MODEL_TYPE$8 = "board-model";
915
915
  const mapOptionsToModel = (options, model) => {
916
916
  const { type, name, path, linked, instanceId, link, ...rest } = options;
917
917
  model.type = type;
@@ -954,45 +954,45 @@ let BoardModelImpl = class {
954
954
  this.logger.debug(`loading board ${this.id}`);
955
955
  }
956
956
  };
957
- BoardModelImpl = __decorateClass$7([
958
- kosUiSdk.kosModel(MODEL_TYPE$7)
957
+ BoardModelImpl = __decorateClass$8([
958
+ kosUiSdk.kosModel(MODEL_TYPE$8)
959
959
  ], BoardModelImpl);
960
960
  const Board = {
961
961
  registration: {
962
- [MODEL_TYPE$7]: {
962
+ [MODEL_TYPE$8]: {
963
963
  class: BoardModelImpl,
964
964
  singleton: false
965
965
  }
966
966
  },
967
- type: MODEL_TYPE$7,
968
- predicate: kosUiSdk.isKosModel(MODEL_TYPE$7),
969
- factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$7)
967
+ type: MODEL_TYPE$8,
968
+ predicate: kosUiSdk.isKosModel(MODEL_TYPE$8),
969
+ factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$8)
970
970
  };
971
971
  const BoardContainer = {
972
972
  registration: {
973
- [MODEL_TYPE$9]: {
973
+ [MODEL_TYPE$a]: {
974
974
  class: exports.BoardContainerModel,
975
975
  singleton: true
976
976
  },
977
977
  ...Board.registration
978
978
  },
979
- type: MODEL_TYPE$9,
980
- predicate: kosUiSdk.isKosModel(MODEL_TYPE$9),
979
+ type: MODEL_TYPE$a,
980
+ predicate: kosUiSdk.isKosModel(MODEL_TYPE$a),
981
981
  factory: kosUiSdk.Kos.Singleton.create(
982
- MODEL_TYPE$9
982
+ MODEL_TYPE$a
983
983
  )
984
984
  };
985
- var __defProp$5 = Object.defineProperty;
986
- var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
987
- var __decorateClass$6 = (decorators, target, key, kind) => {
988
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
985
+ var __defProp$6 = Object.defineProperty;
986
+ var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
987
+ var __decorateClass$7 = (decorators, target, key, kind) => {
988
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
989
989
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
990
990
  if (decorator = decorators[i])
991
991
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
992
- if (kind && result) __defProp$5(target, key, result);
992
+ if (kind && result) __defProp$6(target, key, result);
993
993
  return result;
994
994
  };
995
- const MODEL_TYPE$6 = DispenseModelType.HolderContainer;
995
+ const MODEL_TYPE$7 = DispenseModelType.HolderContainer;
996
996
  const TOPIC_INSERT_START = "/kos/insertion/insert/start";
997
997
  const TOPIC_INSERT_COMPLETE = "/kos/insertion/insert/complete";
998
998
  const TOPIC_INSERT_UPDATE = "/kos/insertion/insert/update";
@@ -1072,17 +1072,17 @@ let HolderContainerModelImpl = class {
1072
1072
  }
1073
1073
  // -------------------ENTITY----------------------------
1074
1074
  };
1075
- __decorateClass$6([
1075
+ __decorateClass$7([
1076
1076
  kosUiSdk.kosChild
1077
1077
  ], HolderContainerModelImpl.prototype, "holders", 2);
1078
- __decorateClass$6([
1078
+ __decorateClass$7([
1079
1079
  kosUiSdk.kosTopicHandler({
1080
1080
  topic: TOPIC_HOLDER_CHANGED,
1081
1081
  websocket: true,
1082
1082
  condition: (event, model) => model.holders.getModel(event.path) !== void 0
1083
1083
  })
1084
1084
  ], HolderContainerModelImpl.prototype, "handleHolderEvents", 1);
1085
- __decorateClass$6([
1085
+ __decorateClass$7([
1086
1086
  kosUiSdk.kosTopicHandler({
1087
1087
  topic: [
1088
1088
  TOPIC_INSERT_START,
@@ -1094,20 +1094,20 @@ __decorateClass$6([
1094
1094
  websocket: true
1095
1095
  })
1096
1096
  ], HolderContainerModelImpl.prototype, "handleInsertion", 1);
1097
- HolderContainerModelImpl = __decorateClass$6([
1098
- kosUiSdk.kosModel(MODEL_TYPE$6)
1097
+ HolderContainerModelImpl = __decorateClass$7([
1098
+ kosUiSdk.kosModel(MODEL_TYPE$7)
1099
1099
  ], HolderContainerModelImpl);
1100
1100
  const HolderContainer = {
1101
1101
  registration: {
1102
- [MODEL_TYPE$6]: {
1102
+ [MODEL_TYPE$7]: {
1103
1103
  class: HolderContainerModelImpl,
1104
1104
  singleton: true
1105
1105
  }
1106
1106
  },
1107
- type: MODEL_TYPE$6,
1108
- predicate: kosUiSdk.isKosModel(MODEL_TYPE$6),
1107
+ type: MODEL_TYPE$7,
1108
+ predicate: kosUiSdk.isKosModel(MODEL_TYPE$7),
1109
1109
  factory: kosUiSdk.Kos.Singleton.create(
1110
- MODEL_TYPE$6
1110
+ MODEL_TYPE$7
1111
1111
  )
1112
1112
  };
1113
1113
  const Logger$1 = kosUiSdk.KosLog.createLogger({ name: "board-utils" });
@@ -1167,17 +1167,17 @@ const getIntentVolume = async (pumpId, intent) => {
1167
1167
  }
1168
1168
  return response.data;
1169
1169
  };
1170
- var __defProp$4 = Object.defineProperty;
1171
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
1172
- var __decorateClass$5 = (decorators, target, key, kind) => {
1173
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
1170
+ var __defProp$5 = Object.defineProperty;
1171
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
1172
+ var __decorateClass$6 = (decorators, target, key, kind) => {
1173
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
1174
1174
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
1175
1175
  if (decorator = decorators[i])
1176
1176
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1177
- if (kind && result) __defProp$4(target, key, result);
1177
+ if (kind && result) __defProp$5(target, key, result);
1178
1178
  return result;
1179
1179
  };
1180
- const MODEL_TYPE$5 = DispenseModelType.Pump;
1180
+ const MODEL_TYPE$6 = DispenseModelType.Pump;
1181
1181
  kosUiSdk.ExtensionManager[kosUiSdk.EXTENSION_TROUBLE_MAPPER].register(
1182
1182
  "pump",
1183
1183
  pumpTroubleResolver
@@ -1321,22 +1321,22 @@ let PumpModelImpl = class {
1321
1321
  }
1322
1322
  // -------------------ENTITY----------------------------
1323
1323
  };
1324
- __decorateClass$5([
1324
+ __decorateClass$6([
1325
1325
  kosUiSdk.kosFuture()
1326
1326
  ], PumpModelImpl.prototype, "performIntent", 1);
1327
- PumpModelImpl = __decorateClass$5([
1328
- kosUiSdk.kosModel(MODEL_TYPE$5)
1327
+ PumpModelImpl = __decorateClass$6([
1328
+ kosUiSdk.kosModel(MODEL_TYPE$6)
1329
1329
  ], PumpModelImpl);
1330
1330
  const Pump = {
1331
1331
  registration: {
1332
- [MODEL_TYPE$5]: {
1332
+ [MODEL_TYPE$6]: {
1333
1333
  class: PumpModelImpl,
1334
1334
  singleton: false
1335
1335
  }
1336
1336
  },
1337
- type: MODEL_TYPE$5,
1338
- predicate: kosUiSdk.isKosModel(MODEL_TYPE$5),
1339
- factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$5)
1337
+ type: MODEL_TYPE$6,
1338
+ predicate: kosUiSdk.isKosModel(MODEL_TYPE$6),
1339
+ factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$6)
1340
1340
  };
1341
1341
  const Logger = kosUiSdk.KosLog.createLogger({ name: "pump-utils" });
1342
1342
  const mapAssemblyPumpToModel = (nozzlePath, pump) => {
@@ -1385,17 +1385,17 @@ const assemblyPumpMap = (pumpContainer) => (holderContainer) => (nozzle) => (ass
1385
1385
  throw error;
1386
1386
  }
1387
1387
  };
1388
- var __defProp$3 = Object.defineProperty;
1389
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
1390
- var __decorateClass$4 = (decorators, target, key, kind) => {
1391
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
1388
+ var __defProp$4 = Object.defineProperty;
1389
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
1390
+ var __decorateClass$5 = (decorators, target, key, kind) => {
1391
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
1392
1392
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
1393
1393
  if (decorator = decorators[i])
1394
1394
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1395
- if (kind && result) __defProp$3(target, key, result);
1395
+ if (kind && result) __defProp$4(target, key, result);
1396
1396
  return result;
1397
1397
  };
1398
- const MODEL_TYPE$4 = "assembly-model";
1398
+ const MODEL_TYPE$5 = "assembly-model";
1399
1399
  const CONTEXT_ASSEMBLY_DATA = "assembly-data";
1400
1400
  const CONTEXT_ASSEMBLY_RAW_DATA = "assembly-raw-data";
1401
1401
  let AssemblyModelImpl = class {
@@ -1525,43 +1525,43 @@ let AssemblyModelImpl = class {
1525
1525
  }
1526
1526
  }
1527
1527
  };
1528
- __decorateClass$4([
1528
+ __decorateClass$5([
1529
1529
  kosUiSdk.kosDependency({
1530
1530
  modelType: "trouble-container-model"
1531
1531
  })
1532
1532
  ], AssemblyModelImpl.prototype, "troubleContainer", 2);
1533
- __decorateClass$4([
1533
+ __decorateClass$5([
1534
1534
  kosUiSdk.kosChild
1535
1535
  ], AssemblyModelImpl.prototype, "holderContainer", 2);
1536
- __decorateClass$4([
1536
+ __decorateClass$5([
1537
1537
  kosUiSdk.kosChild
1538
1538
  ], AssemblyModelImpl.prototype, "boardContainer", 2);
1539
- __decorateClass$4([
1539
+ __decorateClass$5([
1540
1540
  kosUiSdk.kosChild
1541
1541
  ], AssemblyModelImpl.prototype, "pumpContainer", 2);
1542
- AssemblyModelImpl = __decorateClass$4([
1543
- kosUiSdk.kosModel(MODEL_TYPE$4)
1542
+ AssemblyModelImpl = __decorateClass$5([
1543
+ kosUiSdk.kosModel(MODEL_TYPE$5)
1544
1544
  ], AssemblyModelImpl);
1545
1545
  const Assembly = {
1546
1546
  registration: {
1547
- [MODEL_TYPE$4]: {
1547
+ [MODEL_TYPE$5]: {
1548
1548
  class: AssemblyModelImpl,
1549
1549
  singleton: true
1550
1550
  }
1551
1551
  },
1552
- type: MODEL_TYPE$4,
1553
- predicate: kosUiSdk.isKosModel(MODEL_TYPE$4),
1554
- factory: kosUiSdk.Kos.Singleton.create(MODEL_TYPE$4)
1552
+ type: MODEL_TYPE$5,
1553
+ predicate: kosUiSdk.isKosModel(MODEL_TYPE$5),
1554
+ factory: kosUiSdk.Kos.Singleton.create(MODEL_TYPE$5)
1555
1555
  };
1556
- var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
1557
- var __decorateClass$3 = (decorators, target, key, kind) => {
1558
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
1556
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
1557
+ var __decorateClass$4 = (decorators, target, key, kind) => {
1558
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
1559
1559
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
1560
1560
  if (decorator = decorators[i])
1561
1561
  result = decorator(result) || result;
1562
1562
  return result;
1563
1563
  };
1564
- const MODEL_TYPE$3 = DispenseModelType.Availability;
1564
+ const MODEL_TYPE$4 = DispenseModelType.Availability;
1565
1565
  let AvailabilityModelImpl = class {
1566
1566
  id;
1567
1567
  data;
@@ -1607,23 +1607,38 @@ let AvailabilityModelImpl = class {
1607
1607
  // -------------------LIFECYCLE----------------------------
1608
1608
  // -------------------ENTITY----------------------------
1609
1609
  };
1610
- AvailabilityModelImpl = __decorateClass$3([
1610
+ AvailabilityModelImpl = __decorateClass$4([
1611
1611
  kosUiSdk.kosParentAware(),
1612
- kosUiSdk.kosModel(MODEL_TYPE$3)
1612
+ kosUiSdk.kosModel(MODEL_TYPE$4)
1613
1613
  ], AvailabilityModelImpl);
1614
1614
  const Availability = {
1615
1615
  registration: {
1616
- [MODEL_TYPE$3]: {
1616
+ [MODEL_TYPE$4]: {
1617
1617
  class: AvailabilityModelImpl,
1618
1618
  singleton: false
1619
1619
  }
1620
1620
  },
1621
- type: MODEL_TYPE$3,
1622
- predicate: kosUiSdk.isKosModel(MODEL_TYPE$3),
1621
+ type: MODEL_TYPE$4,
1622
+ predicate: kosUiSdk.isKosModel(MODEL_TYPE$4),
1623
1623
  factory: kosUiSdk.Kos.Factory.create(
1624
- MODEL_TYPE$3
1624
+ MODEL_TYPE$4
1625
1625
  )
1626
1626
  };
1627
+ class PourContext {
1628
+ _data = /* @__PURE__ */ new Map();
1629
+ get(key) {
1630
+ return this._data.get(key);
1631
+ }
1632
+ set(key, value) {
1633
+ this._data.set(key, value);
1634
+ }
1635
+ remove(key) {
1636
+ this._data.delete(key);
1637
+ }
1638
+ has(key) {
1639
+ return this._data.has(key);
1640
+ }
1641
+ }
1627
1642
  const { URL: URL$1 } = kosUiSdk.resolveServiceUrl("NOZZLE_SERVICE");
1628
1643
  const { postModel: postModel$1, deleteModel, getOne } = kosUiSdk.ServiceFactory.build({
1629
1644
  basePath: `${URL$1}/api/nozzle`
@@ -1672,17 +1687,17 @@ const clearPourable = async (nozzleId) => {
1672
1687
  });
1673
1688
  return response;
1674
1689
  };
1675
- var __defProp$2 = Object.defineProperty;
1676
- var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
1677
- var __decorateClass$2 = (decorators, target, key, kind) => {
1678
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
1690
+ var __defProp$3 = Object.defineProperty;
1691
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
1692
+ var __decorateClass$3 = (decorators, target, key, kind) => {
1693
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
1679
1694
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
1680
1695
  if (decorator = decorators[i])
1681
1696
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1682
- if (kind && result) __defProp$2(target, key, result);
1697
+ if (kind && result) __defProp$3(target, key, result);
1683
1698
  return result;
1684
1699
  };
1685
- const MODEL_TYPE$2 = DispenseModelType.Nozzle;
1700
+ const MODEL_TYPE$3 = DispenseModelType.Nozzle;
1686
1701
  const PROP_BEVERAGE_TOPIC_PREFIX = kosUiSdk.createPropKey(
1687
1702
  "beverageTopicPrefix"
1688
1703
  );
@@ -2152,42 +2167,42 @@ let NozzleModelImpl = class {
2152
2167
  }
2153
2168
  // -------------------ENTITY----------------------------
2154
2169
  };
2155
- __decorateClass$2([
2170
+ __decorateClass$3([
2156
2171
  kosUiSdk.kosChild
2157
2172
  ], NozzleModelImpl.prototype, "_availabilityItems", 2);
2158
- __decorateClass$2([
2173
+ __decorateClass$3([
2159
2174
  kosUiSdk.kosStateEntry(PourState.POURING)
2160
2175
  ], NozzleModelImpl.prototype, "handlePouringStart", 1);
2161
- __decorateClass$2([
2176
+ __decorateClass$3([
2162
2177
  kosUiSdk.kosStateExit(PourState.POURING)
2163
2178
  ], NozzleModelImpl.prototype, "handlePouringEnd", 1);
2164
- __decorateClass$2([
2179
+ __decorateClass$3([
2165
2180
  kosUiSdk.kosStateEntry(PourState.POUR_CANCELING)
2166
2181
  ], NozzleModelImpl.prototype, "handleCancelStart", 1);
2167
- __decorateClass$2([
2182
+ __decorateClass$3([
2168
2183
  kosUiSdk.kosStateExit(PourState.POUR_CANCELING)
2169
2184
  ], NozzleModelImpl.prototype, "handleCanceled", 1);
2170
- __decorateClass$2([
2185
+ __decorateClass$3([
2171
2186
  kosUiSdk.kosFuture(),
2172
2187
  kosUiSdk.kosStateGuard({ allowedStates: [PourState.IDLE] })
2173
2188
  ], NozzleModelImpl.prototype, "pour", 1);
2174
- __decorateClass$2([
2189
+ __decorateClass$3([
2175
2190
  kosUiSdk.kosFuture(),
2176
2191
  kosUiSdk.kosStateGuard({ allowedStates: [PourState.IDLE] })
2177
2192
  ], NozzleModelImpl.prototype, "fixedPour", 1);
2178
- __decorateClass$2([
2193
+ __decorateClass$3([
2179
2194
  kosUiSdk.kosStateGuard({
2180
2195
  allowedStates: [PourState.POUR_STARTING, PourState.POURING]
2181
2196
  })
2182
2197
  ], NozzleModelImpl.prototype, "cancelPour", 1);
2183
- __decorateClass$2([
2198
+ __decorateClass$3([
2184
2199
  kosUiSdk.kosTopicHandler({
2185
2200
  topic: `${PROP_BEVERAGE_TOPIC_PREFIX}/availability`,
2186
2201
  websocket: true
2187
2202
  })
2188
2203
  ], NozzleModelImpl.prototype, "updateAvailability", 1);
2189
- NozzleModelImpl = __decorateClass$2([
2190
- kosUiSdk.kosModel({ modelTypeId: MODEL_TYPE$2, singleton: false }),
2204
+ NozzleModelImpl = __decorateClass$3([
2205
+ kosUiSdk.kosModel({ modelTypeId: MODEL_TYPE$3, singleton: false }),
2191
2206
  kosUiSdk.kosLoggerAware(),
2192
2207
  kosUiSdk.kosStateMachine(
2193
2208
  {
@@ -2228,15 +2243,391 @@ NozzleModelImpl = __decorateClass$2([
2228
2243
  ], NozzleModelImpl);
2229
2244
  const Nozzle = {
2230
2245
  registration: {
2231
- [MODEL_TYPE$2]: {
2246
+ [MODEL_TYPE$3]: {
2232
2247
  class: NozzleModelImpl,
2233
2248
  singleton: false
2234
2249
  }
2235
2250
  },
2236
- type: MODEL_TYPE$2,
2237
- predicate: kosUiSdk.isKosModel(MODEL_TYPE$2),
2238
- factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$2)
2251
+ type: MODEL_TYPE$3,
2252
+ predicate: kosUiSdk.isKosModel(MODEL_TYPE$3),
2253
+ factory: kosUiSdk.Kos.Factory.create(MODEL_TYPE$3)
2254
+ };
2255
+ var __defProp$2 = Object.defineProperty;
2256
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
2257
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2258
+ var __decorateClass$2 = (decorators, target, key, kind) => {
2259
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
2260
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
2261
+ if (decorator = decorators[i])
2262
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2263
+ if (kind && result) __defProp$2(target, key, result);
2264
+ return result;
2265
+ };
2266
+ var __publicField = (obj, key, value) => __defNormalProp(obj, key + "", value);
2267
+ const MODEL_TYPE$2 = "cui-kit-state-model";
2268
+ const MODEL_CONFIG = {
2269
+ modelTypeId: MODEL_TYPE$2,
2270
+ singleton: false
2271
+ };
2272
+ const cuiKitId = (nozzlePath) => `cui-kit:${nozzlePath}`;
2273
+ let CuiKitStateModelImpl = class {
2274
+ id;
2275
+ nozzlePath;
2276
+ initialGroup;
2277
+ steps;
2278
+ companionTypes;
2279
+ currentGroup;
2280
+ selectedBrand = null;
2281
+ selectedBeverage = null;
2282
+ selectedFlavors = [];
2283
+ pourStrategy;
2284
+ onPourComplete;
2285
+ /** Data passed to the before-pour gate; carries `selectedBeverage`. */
2286
+ pourContext = new PourContext();
2287
+ /** The target of the last pour the kit started. */
2288
+ activeTarget;
2289
+ beforePour;
2290
+ pressCount = 0;
2291
+ released = true;
2292
+ lastPourState;
2293
+ lastPourError;
2294
+ nozzle;
2295
+ constructor(modelId, options) {
2296
+ this.id = modelId;
2297
+ this.nozzlePath = options.nozzlePath;
2298
+ this.initialGroup = options.initialGroup ?? "brands";
2299
+ this.steps = options.steps;
2300
+ this.companionTypes = options.companionTypes ?? {};
2301
+ this.pourStrategy = options.pour?.strategy;
2302
+ this.onPourComplete = options.onPourComplete;
2303
+ this.currentGroup = this.firstGroup;
2304
+ if (options.steps && options.initialGroup) {
2305
+ throw new Error(
2306
+ "CUI Kit: pass steps or initialGroup, not both (initialGroup is replaced by steps.brands)"
2307
+ );
2308
+ }
2309
+ }
2310
+ updateModel(options) {
2311
+ this.companionTypes = options.companionTypes ?? {};
2312
+ }
2313
+ // -------------------STEPS----------------------------
2314
+ /** The steps shown, in order. */
2315
+ get enabledSteps() {
2316
+ if (!this.steps) {
2317
+ return this.initialGroup === "brands" ? ["brands", "beverages", "flavors"] : ["beverages", "flavors"];
2318
+ }
2319
+ return [
2320
+ ...this.steps.brands ? ["brands"] : [],
2321
+ "beverages",
2322
+ ...this.steps.flavors ? ["flavors"] : [],
2323
+ ...this.steps.pour ? ["pour"] : []
2324
+ ];
2325
+ }
2326
+ /** The step navigation starts at and `home()` returns to. */
2327
+ get firstGroup() {
2328
+ if (!this.steps) return this.initialGroup;
2329
+ return this.steps.brands ? "brands" : "beverages";
2330
+ }
2331
+ /** The step `back()` moves to, or undefined when there is none. */
2332
+ get previousGroup() {
2333
+ if (!this.steps) {
2334
+ return this.currentGroup === "brands" ? void 0 : this.initialGroup;
2335
+ }
2336
+ const steps = this.enabledSteps;
2337
+ const index = steps.indexOf(this.currentGroup);
2338
+ return index > 0 ? steps[index - 1] : void 0;
2339
+ }
2340
+ get canBack() {
2341
+ return this.previousGroup !== void 0;
2342
+ }
2343
+ // -------------------LISTS----------------------------
2344
+ get brands() {
2345
+ return this.nozzle?.visibleBrands ?? [];
2346
+ }
2347
+ /** Whether the kit shows a brands step; without `steps` it follows `initialGroup`. */
2348
+ get hasBrands() {
2349
+ return this.enabledSteps.includes("brands");
2350
+ }
2351
+ get beverages() {
2352
+ if (!this.nozzle) return [];
2353
+ const brand = this.steps && !this.hasBrands ? void 0 : this.nozzle.selectedBrand;
2354
+ const items = brand ? this.nozzle.getAvailabilityByParent(brand.id) : this.nozzle.getGroupAvailabilityItems("beverages");
2355
+ return items.filter((item) => item.visible);
2356
+ }
2357
+ get flavors() {
2358
+ return this.nozzle?.getGroupAvailabilityItems("flavors").filter((flavor) => flavor.visible) ?? [];
2359
+ }
2360
+ get brandCompanions() {
2361
+ return this.companionsOf(this.brands, this.companionTypes.brand);
2362
+ }
2363
+ get beverageCompanions() {
2364
+ return this.companionsOf(this.beverages, this.companionTypes.beverage);
2365
+ }
2366
+ get flavorCompanions() {
2367
+ return this.companionsOf(this.flavors, this.companionTypes.flavor);
2368
+ }
2369
+ companionsOf(models, type) {
2370
+ if (!type) return [];
2371
+ return models.map((model) => kosUiSdk.getKosCompanionModel(model, type));
2372
+ }
2373
+ // -------------------SELECTION----------------------------
2374
+ selectBrand(brand, context) {
2375
+ this.selectedBrand = brand;
2376
+ this.nozzle?.setSelectedBrand(brand, context);
2377
+ this.currentGroup = "beverages";
2378
+ this.publish("brand/selected", brand);
2379
+ }
2380
+ clearBrand() {
2381
+ this.selectedBrand = null;
2382
+ this.nozzle?.setSelectedBrand(void 0);
2383
+ this.publish("brand/cleared", {});
2384
+ }
2385
+ async selectBeverage(beverage, context, forceUpdate) {
2386
+ this.selectedBeverage = beverage;
2387
+ this.pourContext.set("selectedBeverage", beverage);
2388
+ await this.nozzle?.setSelectedPourable({ beverage, context }, forceUpdate);
2389
+ if (!this.steps || this.steps.flavors) {
2390
+ this.currentGroup = "flavors";
2391
+ }
2392
+ this.publish("beverage/selected", beverage);
2393
+ }
2394
+ async clearBeverage() {
2395
+ this.selectedBeverage = null;
2396
+ this.pourContext.remove("selectedBeverage");
2397
+ await this.nozzle?.setSelectedPourable({ beverage: void 0 });
2398
+ this.publish("beverage/cleared", {});
2399
+ }
2400
+ /** Toggles a flavor and sends the beverage with the resulting flavors to the nozzle. */
2401
+ async selectFlavor(flavor, context, forceUpdate) {
2402
+ const flavors = this.selectedFlavors.includes(flavor) ? this.selectedFlavors.filter((selected) => selected !== flavor) : [...this.selectedFlavors, flavor];
2403
+ this.selectedFlavors = flavors;
2404
+ const beverage = this.nozzle?.selectedPourable.beverage;
2405
+ if (beverage) {
2406
+ await this.nozzle.setSelectedPourable(
2407
+ { beverage, additional: flavors, context },
2408
+ forceUpdate
2409
+ );
2410
+ }
2411
+ this.publish("flavor/selected", flavor);
2412
+ }
2413
+ async clearFlavors() {
2414
+ this.selectedFlavors = [];
2415
+ const beverage = this.nozzle?.selectedPourable.beverage;
2416
+ if (beverage) {
2417
+ await this.nozzle.setSelectedPourable({ beverage });
2418
+ this.publish("flavor/cleared", {});
2419
+ }
2420
+ }
2421
+ // -------------------NAVIGATION----------------------------
2422
+ /** Moves to the previous step. Without `steps`, returns to the start and clears brand and beverage. */
2423
+ back() {
2424
+ if (!this.steps) {
2425
+ if (this.currentGroup !== "brands") {
2426
+ this.currentGroup = this.initialGroup;
2427
+ }
2428
+ void this.clearBeverage();
2429
+ this.clearBrand();
2430
+ return;
2431
+ }
2432
+ const previous = this.previousGroup;
2433
+ if (previous) {
2434
+ this.currentGroup = previous;
2435
+ }
2436
+ }
2437
+ /** Returns to the first step and clears the selections. */
2438
+ home() {
2439
+ this.publish("home", {});
2440
+ this.currentGroup = this.firstGroup;
2441
+ if (this.steps) {
2442
+ void this.clearFlavors();
2443
+ void this.clearBeverage();
2444
+ if (this.steps.brands) this.clearBrand();
2445
+ return;
2446
+ }
2447
+ void this.clearBeverage();
2448
+ if (this.initialGroup === "brands") {
2449
+ this.clearBrand();
2450
+ }
2451
+ }
2452
+ /** Number of `useCuiKit` hooks attached to this kit. */
2453
+ attached = 0;
2454
+ /**
2455
+ * Attaches a `useCuiKit` hook. A nozzle has one kit hook; components read it through
2456
+ * the kit's context. Returns false, and logs an error, for a second hook.
2457
+ */
2458
+ attach() {
2459
+ this.attached += 1;
2460
+ if (this.attached > 1) {
2461
+ this.logger.error(
2462
+ `useCuiKit is mounted ${this.attached} times for nozzle ${this.nozzlePath}; read the kit with the useCuiKitContext hook returned by initializeCuiKit`
2463
+ );
2464
+ return false;
2465
+ }
2466
+ return true;
2467
+ }
2468
+ detach() {
2469
+ this.attached = Math.max(0, this.attached - 1);
2470
+ }
2471
+ /**
2472
+ * Returns the kit to the first step with nothing selected, as a newly mounted kit
2473
+ * starts. The nozzle's own selection is left as it is.
2474
+ */
2475
+ reset() {
2476
+ this.currentGroup = this.firstGroup;
2477
+ this.selectedBrand = null;
2478
+ this.selectedBeverage = null;
2479
+ this.selectedFlavors = [];
2480
+ this.pourContext.remove("selectedBeverage");
2481
+ }
2482
+ /**
2483
+ * Moves to the pour step. Only available when `steps.pour` is on. With `start`, also
2484
+ * starts a pour; ignored, with a warning, when the pour needs a held button.
2485
+ */
2486
+ toPour(options = {}) {
2487
+ if (!this.steps?.pour) {
2488
+ this.logger.warn("toPour() ignored: the pour step is not enabled");
2489
+ return;
2490
+ }
2491
+ this.currentGroup = "pour";
2492
+ if (!options.start) return;
2493
+ if (!options.fixedPourName && this.strategyFor(options)?.requiresHold) {
2494
+ this.logger.warn(
2495
+ "toPour({ start: true }) ignored: the pour strategy needs a held button"
2496
+ );
2497
+ return;
2498
+ }
2499
+ void this.startPour(options);
2500
+ }
2501
+ // -------------------POUR----------------------------
2502
+ /** Sets the before-pour gate the kit calls before every pour. */
2503
+ setBeforePour(callback) {
2504
+ this.beforePour = callback;
2505
+ }
2506
+ /** Starts a pour without a gesture (a click-to-pour button or an automated pour). */
2507
+ startPour(options = {}) {
2508
+ return this.runPour(options, false);
2509
+ }
2510
+ /** The press half of a pour gesture; `releasePour` is the release. */
2511
+ pressPour(options = {}) {
2512
+ return this.runPour(options, true);
2513
+ }
2514
+ /** The release half of a pour gesture. */
2515
+ releasePour(options = {}) {
2516
+ this.released = true;
2517
+ const target = options.target ?? this.nozzle;
2518
+ const ended = this.strategyFor(options)?.initiateEnded?.(target);
2519
+ void Promise.resolve(ended).then((keepPouring) => {
2520
+ if (keepPouring !== true) {
2521
+ this.publish("pour/cancel", {});
2522
+ }
2523
+ });
2524
+ }
2525
+ /** Cancels the pour the kit started last. */
2526
+ async cancelPour() {
2527
+ await (this.activeTarget ?? this.nozzle)?.cancelPour();
2528
+ this.publish("pour/cancel", {});
2529
+ }
2530
+ /** The pour target whose state the kit reports: the last one poured, else the nozzle. */
2531
+ get pourTarget() {
2532
+ return this.activeTarget ?? this.nozzle;
2533
+ }
2534
+ strategyFor(options) {
2535
+ return options.strategy ?? this.pourStrategy;
2536
+ }
2537
+ /**
2538
+ * select → prepare → before-pour gate → pour. While the target is pouring nothing is
2539
+ * selected; for a gesture, a release before the pour starts stops the sequence.
2540
+ */
2541
+ async runPour(options, gesture) {
2542
+ const press = ++this.pressCount;
2543
+ this.released = false;
2544
+ const target = options.target ?? this.nozzle;
2545
+ const strategy = this.strategyFor(options);
2546
+ if (!target || !strategy && !options.fixedPourName) {
2547
+ this.logger.error("pour ignored: no pour target or strategy");
2548
+ return false;
2549
+ }
2550
+ const releasedEarly = () => gesture && (this.released || press !== this.pressCount);
2551
+ if (options.select && !target.isPouring) {
2552
+ await this.selectForPour(options.select);
2553
+ }
2554
+ if (releasedEarly()) return false;
2555
+ await options.prepare?.(this.pourContext);
2556
+ if (releasedEarly()) return false;
2557
+ this.publish("pre/pour", {});
2558
+ await this.beforePour?.(this.pourContext) || true;
2559
+ if (releasedEarly()) return false;
2560
+ this.activeTarget = target;
2561
+ this.lastPourError = void 0;
2562
+ const started = options.fixedPourName ? this.nozzle.fixedPour(options.fixedPourName) : strategy?.initiate(target);
2563
+ void Promise.resolve(started).catch((error) => {
2564
+ this.lastPourError = error;
2565
+ this.logger.error(`pour failed: ${error}`);
2566
+ });
2567
+ this.publish("pour", {});
2568
+ return true;
2569
+ }
2570
+ /**
2571
+ * Selects a beverage, and its brand first when the kit has a brands step, and waits
2572
+ * for the nozzle.
2573
+ */
2574
+ async selectForPour(beverage) {
2575
+ const brand = this.hasBrands ? this.nozzle?.brands.find((b) => b.id === beverage.parentId) : void 0;
2576
+ if (brand && this.selectedBrand !== brand) {
2577
+ this.selectBrand(brand);
2578
+ }
2579
+ if (this.selectedBeverage !== beverage) {
2580
+ await this.selectBeverage(beverage);
2581
+ }
2582
+ }
2583
+ trackPourCompletion() {
2584
+ const state = this.pourTarget?.currentState;
2585
+ const previous = this.lastPourState;
2586
+ this.lastPourState = state;
2587
+ const completed = state === PourState.IDLE && (previous === PourState.POURING || previous === PourState.POUR_STARTING);
2588
+ if (!completed || !this.onPourComplete) return;
2589
+ const target = this.pourTarget;
2590
+ const endState = target?.future?.endState;
2591
+ setTimeout(() => {
2592
+ this.onPourComplete?.({ endState, error: this.lastPourError });
2593
+ }, 0);
2594
+ }
2595
+ publishBeverageList() {
2596
+ this.publish("beverage/list/updated", this.beverages);
2597
+ }
2598
+ publish(path, body) {
2599
+ kosUiSdk.EventBus.publish(`/kos/dispense/${this.nozzlePath}/${path}/`, body);
2600
+ }
2601
+ // -------------------LIFECYCLE----------------------------
2602
+ async init() {
2603
+ this.logger.debug(`initializing cui-kit-state ${this.id}`);
2604
+ }
2239
2605
  };
2606
+ __publicField(CuiKitStateModelImpl, "Registration");
2607
+ __decorateClass$2([
2608
+ kosUiSdk.kosDependency({
2609
+ modelType: Nozzle.type,
2610
+ id: kosUiSdk.createPropKey("nozzlePath")
2611
+ })
2612
+ ], CuiKitStateModelImpl.prototype, "nozzle", 2);
2613
+ __decorateClass$2([
2614
+ kosUiSdk.kosModelEffect({
2615
+ dependencies: (model) => [
2616
+ model.pourTarget?.currentState
2617
+ ]
2618
+ })
2619
+ ], CuiKitStateModelImpl.prototype, "trackPourCompletion", 1);
2620
+ __decorateClass$2([
2621
+ kosUiSdk.kosModelEffect({
2622
+ dependencies: (model) => [model.beverages],
2623
+ options: { fireImmediately: true }
2624
+ })
2625
+ ], CuiKitStateModelImpl.prototype, "publishBeverageList", 1);
2626
+ CuiKitStateModelImpl = __decorateClass$2([
2627
+ kosUiSdk.kosModel(MODEL_CONFIG),
2628
+ kosUiSdk.kosLoggerAware()
2629
+ ], CuiKitStateModelImpl);
2630
+ const CuiKitState = CuiKitStateModelImpl.Registration;
2240
2631
  var __defProp$1 = Object.defineProperty;
2241
2632
  var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
2242
2633
  var __decorateClass$1 = (decorators, target, key, kind) => {
@@ -2577,6 +2968,7 @@ const kosModels = {
2577
2968
  const registerDispenseModels = (root) => () => {
2578
2969
  kosUiSdk.registerCoreModels(root)();
2579
2970
  DeviceAssembly.register();
2971
+ CuiKitState.register();
2580
2972
  Object.keys(kosModels).forEach((key) => {
2581
2973
  const model = kosModels[key];
2582
2974
  kosUiSdk.registerLegacyModel(root)(key, model);
@@ -2607,12 +2999,16 @@ const registerDispenseModels = (root) => () => {
2607
2999
  legacy: kosUiSdk.RegistrationManager.model.registerLegacyModel(root)
2608
3000
  };
2609
3001
  };
3002
+ const registerCuiKitModels = (root) => () => registerDispenseModels(root)();
2610
3003
  const _KosModelRegistry = {
2611
3004
  ...kosUiSdk.KosModelRegistry
2612
3005
  };
2613
3006
  _KosModelRegistry.dispense = {
2614
3007
  models: registerDispenseModels(_KosModelRegistry)
2615
3008
  };
3009
+ _KosModelRegistry.cuiKit = {
3010
+ models: registerCuiKitModels(_KosModelRegistry)
3011
+ };
2616
3012
  _KosModelRegistry.preload = kosUiSdk.RegistrationManager.model.preloadModel(_KosModelRegistry);
2617
3013
  _KosModelRegistry.model = kosUiSdk.RegistrationManager.model.register(_KosModelRegistry);
2618
3014
  _KosModelRegistry.companion = kosUiSdk.RegistrationManager.companion.register(_KosModelRegistry);
@@ -2624,6 +3020,7 @@ exports.Board = Board;
2624
3020
  exports.BoardContainer = BoardContainer;
2625
3021
  exports.CONTEXT_ASSEMBLY_DATA = CONTEXT_ASSEMBLY_DATA;
2626
3022
  exports.CONTEXT_ASSEMBLY_RAW_DATA = CONTEXT_ASSEMBLY_RAW_DATA;
3023
+ exports.CuiKitState = CuiKitState;
2627
3024
  exports.DeviceAssembly = DeviceAssembly;
2628
3025
  exports.DispenseModelType = DispenseModelType;
2629
3026
  exports.ExtensionType = ExtensionType;
@@ -2634,6 +3031,7 @@ exports.Ingredient = Ingredient;
2634
3031
  exports.IngredientContainer = IngredientContainer;
2635
3032
  exports.KosModelRegistry = KosModelRegistry;
2636
3033
  exports.Nozzle = Nozzle;
3034
+ exports.PourContext = PourContext;
2637
3035
  exports.PourState = PourState;
2638
3036
  exports.Pump = Pump;
2639
3037
  exports.PumpContainer = PumpContainer;
@@ -2646,6 +3044,7 @@ exports.TOPIC_GENERIC_POUR_STARTED = TOPIC_GENERIC_POUR_STARTED;
2646
3044
  exports.addAssignment = addAssignment;
2647
3045
  exports.assignHolderIngredient = assignHolderIngredient;
2648
3046
  exports.clearPourable = clearPourable;
3047
+ exports.cuiKitId = cuiKitId;
2649
3048
  exports.deleteAssignment = deleteAssignment;
2650
3049
  exports.getAssembly = getAssembly;
2651
3050
  exports.getAssignments = getAssignments;
@@ -2657,10 +3056,11 @@ exports.kosModels = kosModels;
2657
3056
  exports.pourNamedPourable = pourNamedPourable;
2658
3057
  exports.pourOnTarget = pourOnTarget;
2659
3058
  exports.pourPourable = pourPourable;
3059
+ exports.registerCuiKitModels = registerCuiKitModels;
2660
3060
  exports.registerDispenseModels = registerDispenseModels;
2661
3061
  exports.replaceLine = replaceLine;
2662
3062
  exports.selectPourable = selectPourable;
2663
3063
  exports.sendIntent = sendIntent;
2664
3064
  exports.sendRfidOverride = sendRfidOverride;
2665
3065
  exports.unassignHolderIngredient = unassignHolderIngredient;
2666
- //# sourceMappingURL=dispense-registration-manager-Dtb31fcI.cjs.map
3066
+ //# sourceMappingURL=dispense-registration-manager-OYGAiIZy.cjs.map