@kosdev-code/kos-freestyle-sdk 2.0.17 → 2.0.19

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 (33) hide show
  1. package/{extension-utils-DLH4Qofz.cjs → extension-utils-C8jLUyb0.cjs} +2 -2
  2. package/{extension-utils-DLH4Qofz.cjs.map → extension-utils-C8jLUyb0.cjs.map} +1 -1
  3. package/{extension-utils-DFxANOxc.js → extension-utils-DKTFNnoj.js} +2 -2
  4. package/{extension-utils-DFxANOxc.js.map → extension-utils-DKTFNnoj.js.map} +1 -1
  5. package/freestyle-registration-manager-CqOQC8rw.cjs +2 -0
  6. package/{freestyle-registration-manager-B46wED9t.cjs.map → freestyle-registration-manager-CqOQC8rw.cjs.map} +1 -1
  7. package/freestyle-registration-manager-NQwdiplh.js +923 -0
  8. package/freestyle-registration-manager-NQwdiplh.js.map +1 -0
  9. package/index.cjs +1 -1
  10. package/index.js +14 -13
  11. package/models/models/ice-agitator/ice-agitator-model.d.ts +41 -3
  12. package/models/models/ice-agitator/ice-agitator-model.d.ts.map +1 -1
  13. package/models/models/ice-agitator/ice-agitator-registration.d.ts +2 -1
  14. package/models/models/ice-agitator/ice-agitator-registration.d.ts.map +1 -1
  15. package/models/models/ice-agitator/index.d.ts +1 -0
  16. package/models/models/ice-agitator/index.d.ts.map +1 -1
  17. package/models/models/ice-agitator/services/ice-agitator-services.d.ts +8 -3
  18. package/models/models/ice-agitator/services/ice-agitator-services.d.ts.map +1 -1
  19. package/models/models/ice-agitator/types/index.d.ts +1 -22
  20. package/models/utils/extensions/assembly/types.d.ts +6 -0
  21. package/models/utils/extensions/assembly/types.d.ts.map +1 -1
  22. package/models.cjs +1 -1
  23. package/models.js +14 -13
  24. package/package.json +4 -4
  25. package/ui.cjs +1 -1
  26. package/ui.js +2 -2
  27. package/{use-nutrition-info-BQrtsdMz.js → use-nutrition-info-Cc2lyc0t.js} +8 -8
  28. package/{use-nutrition-info-BQrtsdMz.js.map → use-nutrition-info-Cc2lyc0t.js.map} +1 -1
  29. package/{use-nutrition-info-ho4aniKd.cjs → use-nutrition-info-DIfeVwFs.cjs} +2 -2
  30. package/{use-nutrition-info-ho4aniKd.cjs.map → use-nutrition-info-DIfeVwFs.cjs.map} +1 -1
  31. package/freestyle-registration-manager-B46wED9t.cjs +0 -2
  32. package/freestyle-registration-manager-DkqzBO2O.js +0 -781
  33. package/freestyle-registration-manager-DkqzBO2O.js.map +0 -1
@@ -1,781 +0,0 @@
1
- var he = Object.defineProperty;
2
- var ye = (e, t, r) => t in e ? he(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var i = (e, t, r) => (ye(e, typeof t != "symbol" ? t + "" : t, r), r);
4
- import { Assembly as Z, KosModelRegistry as fe, registerDispenseModels as me, Nozzle as be, Pump as _e, Holder as ve, PumpContainer as Pe, PumpIndex as Ie } from "@kosdev-code/kos-dispense-sdk";
5
- import { kosModel as f, KosModelRegistrationFactory as m, KosModelContainer as Ae, kosChild as $e, resolveServiceUrl as E, ServiceFactory as M, createPropKey as Oe, kosStateProp as Ee, kosFuture as Me, FutureHandler as Te, kosEffect as Ce, EventBus as K, SingletonKosModelRegistrationFactory as Q, KosFeatureFlags as U, KosContextManager as we, KosLog as T, FutureManager as ze, kosParentAware as De, kosAutoEffect as Se, kosAction as X, FetchError as Re, kosConfigProperty as p, KOS_MODEL_ID as y, kosTopicHandler as Fe, modelTypeEventTopicFactory as Le, DependencyLifecycle as je, getKosModelSync as _, RegistrationManager as d, registerCoreModels as Ne, Trouble as Be, ExtensionManager as w, EXTENSION_TROUBLE_DATA_MAPPER as z } from "@kosdev-code/kos-ui-sdk";
6
- var xe = Object.defineProperty, He = Object.getOwnPropertyDescriptor, Ge = (e, t, r, o) => {
7
- for (var s = o > 1 ? void 0 : o ? He(t, r) : t, a = e.length - 1, n; a >= 0; a--)
8
- (n = e[a]) && (s = (o ? n(t, r, s) : n(s)) || s);
9
- return o && s && xe(t, r, s), s;
10
- };
11
- const J = "carb-agitator-model";
12
- let S = class {
13
- constructor(e, t, r) {
14
- i(this, "id");
15
- i(this, "name");
16
- i(this, "path");
17
- i(this, "logger");
18
- this.id = e, this.name = t.name, this.path = t.path, this.logger = r.logger;
19
- }
20
- // -------------------LIFECYCLE----------------------------
21
- async init() {
22
- this.logger.debug(`initializing carb-agitator ${this.id}`);
23
- }
24
- async load() {
25
- this.logger.debug(`loading carb-agitator ${this.id}`);
26
- }
27
- };
28
- S = Ge([
29
- f(J)
30
- ], S);
31
- const k = new m({
32
- class: S,
33
- type: J
34
- });
35
- var Ke = Object.defineProperty, Ue = Object.getOwnPropertyDescriptor, ee = (e, t, r, o) => {
36
- for (var s = o > 1 ? void 0 : o ? Ue(t, r) : t, a = e.length - 1, n; a >= 0; a--)
37
- (n = e[a]) && (s = (o ? n(t, r, s) : n(s)) || s);
38
- return o && s && Ke(t, r, s), s;
39
- };
40
- const te = "cartridge-agitator-container-model";
41
- let $ = class {
42
- constructor(e, t, r) {
43
- i(this, "id");
44
- i(this, "logger");
45
- i(this, "_models");
46
- this.id = e, this.logger = r.logger, this._models = new Ae({
47
- parentId: e
48
- });
49
- }
50
- getModel(e) {
51
- return this._models.getModel(e);
52
- }
53
- get models() {
54
- return this._models;
55
- }
56
- get data() {
57
- return this._models.data;
58
- }
59
- addModel(e) {
60
- this._models.addModel(e);
61
- }
62
- removeModel(e) {
63
- this._models.removeModel(e);
64
- }
65
- // -------------------LIFECYCLE----------------------------
66
- async init() {
67
- this.logger.debug(
68
- `initializing cartridge-agitator-container container ${this.id}`
69
- );
70
- }
71
- async load() {
72
- this.logger.debug(
73
- `loading cartridge-agitator-container container ${this.id}`
74
- );
75
- }
76
- };
77
- ee([
78
- $e
79
- ], $.prototype, "_models", 2);
80
- $ = ee([
81
- f(te)
82
- ], $);
83
- const { URL: re } = E("CARTRIDGE_AGITATOR_SERVICE"), { postModel: qe } = M.build({
84
- basePath: `${re}/api/ext/freestyle/freestyle/ice`
85
- }), Ye = async (e, t) => {
86
- const r = await qe({
87
- model: {},
88
- tracker: t,
89
- urlOverride: `${re}/api/handle/${e}/test`
90
- });
91
- if (!(r != null && r.data))
92
- throw new Error("No response from server");
93
- return r.data;
94
- };
95
- var Ve = Object.defineProperty, We = Object.getOwnPropertyDescriptor, B = (e, t, r, o) => {
96
- for (var s = o > 1 ? void 0 : o ? We(t, r) : t, a = e.length - 1, n; a >= 0; a--)
97
- (n = e[a]) && (s = (o ? n(t, r, s) : n(s)) || s);
98
- return o && s && Ve(t, r, s), s;
99
- };
100
- const se = "cartridge-agitator-model";
101
- class O {
102
- }
103
- i(O, "TOPIC_AGITATION_STARTED", "/kos/events/ddk/agitation-started"), i(O, "TOPIC_AGITATION_ENDED", "/kos/events/ddk/agitation-ended");
104
- const Ze = Oe("statePath");
105
- let v = class {
106
- constructor(e, t, r) {
107
- i(this, "id");
108
- i(this, "futureHandler");
109
- i(this, "logger");
110
- i(this, "disposer");
111
- i(this, "agitating");
112
- i(this, "path");
113
- i(this, "statePath");
114
- i(this, "name");
115
- this.id = e, this.logger = r.logger, this.futureHandler = new Te(this), this.path = t.path, this.name = t.name, this.statePath = t.statePath;
116
- }
117
- get isAgitating() {
118
- return !!this.agitating.value;
119
- }
120
- get future() {
121
- return this.futureHandler.future;
122
- }
123
- async testAgitate(e) {
124
- if (!e)
125
- throw new Error("No tracker provided");
126
- return this.logger.info(`agitating cartridge-agitator ${this.id}`), Ye(this.path, e);
127
- }
128
- // -------------------LIFECYCLE----------------------------
129
- async init() {
130
- this.logger.debug(`initializing cartridge-agitator ${this.id}`);
131
- }
132
- unload() {
133
- var e;
134
- (e = this.disposer) == null || e.call(this);
135
- }
136
- async load() {
137
- this.logger.debug(`loading cartridge-agitator ${this.id}`), this.disposer = Ce(
138
- () => this.isAgitating,
139
- () => {
140
- var e;
141
- this.isAgitating ? (this.logger.info(`agitating cartridge-agitator ${this.id}`), K.publish(O.TOPIC_AGITATION_STARTED, {
142
- path: this.path,
143
- futureId: (e = this.futureHandler.future) == null ? void 0 : e.futureId
144
- })) : K.publish(O.TOPIC_AGITATION_ENDED, {
145
- path: this.path
146
- });
147
- },
148
- {}
149
- );
150
- }
151
- };
152
- B([
153
- Ee({ path: Ze, attribute: "agitating" })
154
- ], v.prototype, "agitating", 2);
155
- B([
156
- Me()
157
- ], v.prototype, "testAgitate", 1);
158
- v = B([
159
- f(se)
160
- ], v);
161
- const oe = new m({
162
- class: v,
163
- type: se
164
- }), x = new Q({
165
- class: $,
166
- type: te
167
- });
168
- x.addRelatedModel(oe);
169
- var Qe = Object.defineProperty, Xe = Object.getOwnPropertyDescriptor, Je = (e, t, r, o) => {
170
- for (var s = o > 1 ? void 0 : o ? Xe(t, r) : t, a = e.length - 1, n; a >= 0; a--)
171
- (n = e[a]) && (s = (o ? n(t, r, s) : n(s)) || s);
172
- return o && s && Qe(t, r, s), s;
173
- };
174
- const ie = "freestyle-assembly-model", ke = "iceAgitator", et = "carbAgitator";
175
- let R = class {
176
- constructor(e, t, r) {
177
- i(this, "id");
178
- i(this, "logger");
179
- i(this, "assembly");
180
- this.id = e, this.logger = r.logger, this.assembly = t.companionParent;
181
- }
182
- get holderGroups() {
183
- return this.assembly.holderGroups;
184
- }
185
- get nozzlePaths() {
186
- return this.assembly.nozzlePaths;
187
- }
188
- get allHolders() {
189
- return this.assembly.allHolders;
190
- }
191
- getHoldersByGroup(e) {
192
- return this.assembly.getHoldersByGroup(e);
193
- }
194
- getHoldersByNozzle(e) {
195
- return this.assembly.getHoldersByNozzle(e);
196
- }
197
- get pumpsByNozzle() {
198
- return this.assembly.pumpsByNozzle;
199
- }
200
- get pumpPaths() {
201
- return this.assembly.pumpPaths;
202
- }
203
- get boards() {
204
- return this.assembly.boards;
205
- }
206
- updateModel(e) {
207
- return this.assembly.updateModel(e);
208
- }
209
- get iceAgitator() {
210
- return this.assembly.iceAgitator;
211
- }
212
- get carbAgitator() {
213
- return this.assembly.carbAgitator;
214
- }
215
- get cartridgeAgitators() {
216
- return this.assembly.cartridgeAgitators;
217
- }
218
- get defaultCartridgeAgitator() {
219
- return this.assembly.cartridgeAgitators.data[0];
220
- }
221
- get cartridgeAgitatorModels() {
222
- return this.assembly.cartridgeAgitators.data;
223
- }
224
- get hasCartridgeAgitators() {
225
- return this.assembly.cartridgeAgitators.data.length > 0;
226
- }
227
- // -------------------LIFECYCLE----------------------------
228
- get supportsIce() {
229
- return U.isFeatureEnabled(ke);
230
- }
231
- get supportsCarb() {
232
- return U.isFeatureEnabled(et);
233
- }
234
- async init() {
235
- this.logger.debug(`initializing freestyle-assembly ${this.id}`);
236
- }
237
- async load() {
238
- this.logger.debug(`loading freestyle-assembly ${this.id}`);
239
- }
240
- };
241
- R = Je([
242
- f(ie)
243
- ], R);
244
- const F = new Q({
245
- class: R,
246
- type: ie
247
- });
248
- var tt = Object.defineProperty, rt = Object.getOwnPropertyDescriptor, st = (e, t, r, o) => {
249
- for (var s = o > 1 ? void 0 : o ? rt(t, r) : t, a = e.length - 1, n; a >= 0; a--)
250
- (n = e[a]) && (s = (o ? n(t, r, s) : n(s)) || s);
251
- return o && s && tt(t, r, s), s;
252
- };
253
- const ae = "freestyle-holder-model";
254
- function ot(e) {
255
- const t = we.getContext(e), r = t == null ? void 0 : t.get(
256
- F.type
257
- );
258
- if (!r) {
259
- T.error("Freestyle assembly not found");
260
- return;
261
- }
262
- return r;
263
- }
264
- async function it(e, t) {
265
- if (!e || !t)
266
- return;
267
- const r = await e[t]();
268
- if (r != null && r.tracker)
269
- return ze.getFuture(r.tracker);
270
- }
271
- let L = class {
272
- constructor(e, t, r) {
273
- i(this, "id");
274
- i(this, "logger");
275
- i(this, "holder");
276
- i(this, "future");
277
- this.id = e, this.logger = r.logger, this.holder = t.companionParent;
278
- }
279
- get agitated() {
280
- return this.holder.data.agitated;
281
- }
282
- async agitate() {
283
- if (!this.holder.data.agitated)
284
- return;
285
- this.future = void 0;
286
- const e = ot(this.id);
287
- if (!e)
288
- return;
289
- if (!e.defaultCartridgeAgitator) {
290
- this.logger.error("Agitator not found");
291
- return;
292
- }
293
- return this.future = await it(
294
- e.defaultCartridgeAgitator,
295
- "testAgitate"
296
- ), this.future;
297
- }
298
- // -------------------LIFECYCLE----------------------------
299
- async init() {
300
- this.logger.debug(`initializing freestyle-holder ${this.id}`);
301
- }
302
- async load() {
303
- this.logger.debug(`loading freestyle-holder ${this.id}`);
304
- }
305
- };
306
- L = st([
307
- f(ae)
308
- ], L);
309
- const q = new m({
310
- class: L,
311
- type: ae
312
- }), { URL: at } = E("FREESTYLE-NOZZLE_SERVICE"), { getOne: nt } = M.build({
313
- basePath: `${at}/api/freestyle-nozzle`
314
- }), A = T.createLogger({
315
- name: "freestyle-nozzle-service",
316
- group: "Services"
317
- });
318
- class lt extends Error {
319
- constructor(t) {
320
- super(t), this.name = "NutritionInfoError";
321
- }
322
- }
323
- class Y extends Error {
324
- constructor(t) {
325
- super(t), this.name = "InvalidRequestError";
326
- }
327
- }
328
- const dt = async (e, t, r, o = "http://localhost:8081") => {
329
- if (A.debug("sending GET for freestyle-nozzle"), !t)
330
- throw A.error("Invalid freestyle-nozzle request: beverageId is required"), new Y("No beverageId provided");
331
- if (!r || r.length === 0)
332
- throw A.error("Invalid freestyle-nozzle request: volumes are required"), new Y("No volumes provided");
333
- const s = await nt({
334
- urlOverride: `${o}${e}/pipeline/beverage/engine/nutrition/${t}?volumes=${r.join(
335
- ","
336
- )}`
337
- });
338
- if (!(s != null && s.data))
339
- throw A.error("Failed to retrieve freestyle-nozzle data"), new Error("Failed to retrieve freestyle-nozzle data");
340
- if (s.data.error)
341
- throw new lt(s.data.error);
342
- return s.data;
343
- };
344
- var ct = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, ut = (e, t, r, o) => {
345
- for (var s = o > 1 ? void 0 : o ? gt(t, r) : t, a = e.length - 1, n; a >= 0; a--)
346
- (n = e[a]) && (s = (o ? n(t, r, s) : n(s)) || s);
347
- return o && s && ct(t, r, s), s;
348
- };
349
- const ne = "freestyle-nozzle-model";
350
- let j = class {
351
- constructor(e, t, r) {
352
- i(this, "id");
353
- i(this, "logger");
354
- i(this, "nozzleModel");
355
- i(this, "_cupSizes");
356
- i(this, "_nutritionInfo");
357
- i(this, "_disposer", null);
358
- this.id = e, this.logger = r.logger, this.nozzleModel = t.companionParent, this._cupSizes = [100];
359
- }
360
- set cupSizes(e) {
361
- this._cupSizes = e;
362
- }
363
- get nutritionInfo() {
364
- return this._nutritionInfo;
365
- }
366
- // -------------------LIFECYCLE----------------------------
367
- async init() {
368
- this.logger.debug(`initializing freestyle-nozzle ${this.id}`), this._disposer = Se(async () => {
369
- if (this.nozzleModel.selectedPourable.beverage && this._cupSizes.length) {
370
- this.logger.debug(
371
- `selected beverage: ${this.nozzleModel.selectedPourable.beverage.rawId}. Volume: ${this._cupSizes.join(", ")}`
372
- );
373
- const e = this.nozzleModel.selectedPourable.beverage.rawId, t = this.nozzleModel.urlPrefix;
374
- try {
375
- const r = await dt(
376
- t,
377
- e,
378
- this._cupSizes
379
- );
380
- X(() => {
381
- this._nutritionInfo = r;
382
- });
383
- } catch (r) {
384
- this.logger.error(`Error fetching nutrition info: ${r}`);
385
- }
386
- }
387
- });
388
- }
389
- unload() {
390
- this.logger.debug(`unloading freestyle-nozzle ${this.id}`), this._disposer && this._disposer();
391
- }
392
- async load() {
393
- this.logger.debug(`loading freestyle-nozzle ${this.id}`);
394
- }
395
- };
396
- j = ut([
397
- De(),
398
- f(ne)
399
- ], j);
400
- const V = new m({
401
- class: j,
402
- type: ne
403
- }), { URL: le } = E("PUMP_SERVICE"), { postModel: pt } = M.build({
404
- basePath: `${le}/api/ext/freestyle/microCalibration`
405
- }), D = T.createLogger({
406
- name: "freestyle-pump-service",
407
- group: "Services"
408
- }), ht = async (e, t) => {
409
- var r, o, s, a, n;
410
- D.debug(
411
- `replacePump - sending POST request to /api/ext/freestyle/microCalibration/cal/${e}/code/${t}`
412
- );
413
- try {
414
- const l = await pt({
415
- model: {},
416
- urlOverride: `${le}/api/ext/freestyle/microCalibration/cal/${e}/code/${t}`
417
- });
418
- return D.debug("replacePump - response:", l), ((l == null ? void 0 : l.status) === 200 || (l == null ? void 0 : l.status) === 499) && ((r = l.data) != null && r.error) ? [l.data.error || "unknownError", l.data] : [void 0, l == null ? void 0 : l.data];
419
- } catch (l) {
420
- if (D.error(
421
- `replacePump - sending POST request to /api/cal/${e}/code/${t}`,
422
- l
423
- ), l instanceof Re) {
424
- const g = ((s = (o = l.payload) == null ? void 0 : o.data) == null ? void 0 : s.error) || ((a = l.payload) == null ? void 0 : a.error) || "unknownError";
425
- return [g, ((n = l.payload) == null ? void 0 : n.data) || { error: g }];
426
- }
427
- }
428
- return ["unknownError", { error: "unknownError" }];
429
- };
430
- var yt = Object.defineProperty, ft = Object.getOwnPropertyDescriptor, mt = (e, t, r, o) => {
431
- for (var s = o > 1 ? void 0 : o ? ft(t, r) : t, a = e.length - 1, n; a >= 0; a--)
432
- (n = e[a]) && (s = (o ? n(t, r, s) : n(s)) || s);
433
- return o && s && yt(t, r, s), s;
434
- };
435
- const de = "freestyle-pump-model";
436
- let N = class {
437
- constructor(e, t, r) {
438
- i(this, "id");
439
- i(this, "logger");
440
- i(this, "pump");
441
- this.id = e, this.logger = r.logger, this.pump = t.companionParent;
442
- }
443
- // -------------------LIFECYCLE----------------------------
444
- async replacePump(e) {
445
- const [t, r] = await ht(this.pump.path, e);
446
- return t && this.logger.error(`Failed to replace the pump, ${this.pump.id}`, t), [t, r];
447
- }
448
- };
449
- N = mt([
450
- f(de)
451
- ], N);
452
- const W = new m({
453
- class: N,
454
- type: de
455
- }), { URL: C } = E("ICE_AGITATOR_SERVICE"), { getAll: ce, postModel: bt } = M.build({
456
- basePath: `${C}/api/ext/freestyle/freestyle/ice`
457
- }), ge = T.createLogger({
458
- name: "ice-agitator-service",
459
- group: "Services"
460
- }), _t = async () => (ge.debug("sending GET for ice types"), await ce({
461
- urlOverride: `${C}/api/ext/freestyle/freestyle/ice/types`
462
- })), vt = async (e, t) => (ge.debug("sending POST for ice types"), await bt({
463
- urlOverride: `${C}/api/ext/freestyle/freestyle/ice/type/${e}/${t}`,
464
- model: {}
465
- })), Pt = async () => await ce({
466
- urlOverride: `${C}/api/kos/config/details/assembly.core.board:macro.iceAgitator/4`
467
- });
468
- var It = Object.defineProperty, At = Object.getOwnPropertyDescriptor, h = (e, t, r, o) => {
469
- for (var s = o > 1 ? void 0 : o ? At(t, r) : t, a = e.length - 1, n; a >= 0; a--)
470
- (n = e[a]) && (s = (o ? n(t, r, s) : n(s)) || s);
471
- return o && s && It(t, r, s), s;
472
- };
473
- const ue = "ice-agitator-model";
474
- let c = class {
475
- constructor(e, t, r) {
476
- i(this, "id");
477
- i(this, "name");
478
- i(this, "path");
479
- i(this, "volWithoutIceMl");
480
- i(this, "durationSec");
481
- i(this, "enableIceChuteClear");
482
- i(this, "iceChuteClearDurationMs");
483
- i(this, "iceChuteClearIntervalSec");
484
- i(this, "iceChuteClearRetryIntervalSec");
485
- i(this, "maxDispenseSec");
486
- i(this, "type");
487
- i(this, "dilutionOffset");
488
- i(this, "inactivitySec");
489
- i(this, "_allIceTypes");
490
- i(this, "logger");
491
- i(this, "resetDefaultValues", async () => await Pt());
492
- this.id = e, this.name = t.name, this.path = t.path, this._allIceTypes = [], this.logger = r.logger;
493
- }
494
- get iceTypes() {
495
- return this._allIceTypes;
496
- }
497
- // -------------------LIFECYCLE----------------------------
498
- async updateIceType(e) {
499
- await vt(this.id, e);
500
- }
501
- async init() {
502
- this.logger.debug(`initializing ice-agitator ${this.id}`);
503
- }
504
- async load() {
505
- this.logger.debug(`loading ice-agitator ${this.id}`);
506
- const e = await _t();
507
- (e == null ? void 0 : e.status) === 200 && X(() => {
508
- this._allIceTypes = e.data || [];
509
- });
510
- }
511
- };
512
- h([
513
- p({
514
- path: y,
515
- attribute: "settings.volWithoutIceMl"
516
- })
517
- ], c.prototype, "volWithoutIceMl", 2);
518
- h([
519
- p({
520
- path: y,
521
- attribute: "settings.durationSec",
522
- converter: {
523
- to: "second"
524
- }
525
- })
526
- ], c.prototype, "durationSec", 2);
527
- h([
528
- p({
529
- path: y,
530
- attribute: "enableIceChuteClear"
531
- })
532
- ], c.prototype, "enableIceChuteClear", 2);
533
- h([
534
- p({
535
- path: y,
536
- attribute: "iceChuteClearDurationMs"
537
- })
538
- ], c.prototype, "iceChuteClearDurationMs", 2);
539
- h([
540
- p({
541
- path: y,
542
- attribute: "iceChuteClearIntervalSec"
543
- })
544
- ], c.prototype, "iceChuteClearIntervalSec", 2);
545
- h([
546
- p({
547
- path: y,
548
- attribute: "iceChuteClearRetryIntervalSec"
549
- })
550
- ], c.prototype, "iceChuteClearRetryIntervalSec", 2);
551
- h([
552
- p({
553
- path: y,
554
- attribute: "maxDispenseSec"
555
- })
556
- ], c.prototype, "maxDispenseSec", 2);
557
- h([
558
- p({
559
- path: y,
560
- attribute: "type"
561
- })
562
- ], c.prototype, "type", 2);
563
- h([
564
- p({
565
- path: y,
566
- attribute: "settings.dilutionOffset"
567
- })
568
- ], c.prototype, "dilutionOffset", 2);
569
- h([
570
- p({
571
- path: y,
572
- attribute: "settings.inactivitySec",
573
- converter: {
574
- to: "minute"
575
- }
576
- })
577
- ], c.prototype, "inactivitySec", 2);
578
- c = h([
579
- f(ue)
580
- ], c);
581
- const pe = new m({
582
- class: c,
583
- type: ue
584
- });
585
- var $t = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, H = (e, t, r, o) => {
586
- for (var s = o > 1 ? void 0 : o ? Ot(t, r) : t, a = e.length - 1, n; a >= 0; a--)
587
- (n = e[a]) && (s = (o ? n(t, r, s) : n(s)) || s);
588
- return o && s && $t(t, r, s), s;
589
- };
590
- const G = "agitation-required-trouble-model", Et = (e) => {
591
- if (e.data.agitationRequired)
592
- return G;
593
- }, Mt = "InsufficientAgitationTrouble";
594
- let P = class {
595
- constructor(e, t, r) {
596
- i(this, "id");
597
- i(this, "logger");
598
- i(this, "trouble");
599
- i(this, "_deferred");
600
- i(this, "_holdersLoaded", !1);
601
- i(this, "agitateBeforePour");
602
- this.id = e, this.logger = r.logger, this._deferred = !1, this.trouble = t.companionParent;
603
- }
604
- async resolve() {
605
- return this.trouble.resolve();
606
- }
607
- get holder() {
608
- const e = this.trouble.data.holderPaths[0], t = _(e);
609
- if (!(!this._holdersLoaded && !t.model))
610
- return t == null ? void 0 : t.model;
611
- }
612
- updateHolder() {
613
- if (!this._holdersLoaded) {
614
- const e = this.trouble.data.holderPaths[0];
615
- _(e).model && (this._holdersLoaded = !0);
616
- }
617
- }
618
- get shouldDefer() {
619
- var o, s;
620
- if (!this.holder)
621
- return !0;
622
- const t = (((o = this.holder) == null ? void 0 : o.troublesByType[Mt]) || []).length > 0;
623
- return !!((s = this.agitateBeforePour) != null && s.value) && t;
624
- }
625
- get deferred() {
626
- return this._deferred;
627
- }
628
- defer() {
629
- this._deferred = !0;
630
- }
631
- clearDefer() {
632
- this._deferred = !1;
633
- }
634
- };
635
- H([
636
- p({
637
- path: "app:kosdev.ddk:app",
638
- attribute: "ncui.agitateBeforePour"
639
- })
640
- ], P.prototype, "agitateBeforePour", 2);
641
- H([
642
- Fe({
643
- topic: Le(Z.type),
644
- lifecycle: je.INIT
645
- })
646
- ], P.prototype, "updateHolder", 1);
647
- P = H([
648
- f(G)
649
- ], P);
650
- const Tt = new m({
651
- class: P,
652
- type: G
653
- }), Ct = ["iceAgitator", "carbAgitator"], wt = {
654
- iceAgitator: pe.factory,
655
- carbAgitator: k.factory
656
- }, Ft = async (e) => {
657
- const t = x.instance().options({}).build(), r = e.assemblies.reduce((a, n) => {
658
- var l;
659
- return Ct.forEach((g) => {
660
- const b = n[g];
661
- if (b) {
662
- const I = wt[g](b.path);
663
- a[g] = I({
664
- name: b.name,
665
- path: b.path
666
- });
667
- }
668
- }), (l = n.cartridgeAgitators) == null || l.forEach((g) => {
669
- var I;
670
- const b = oe.instance(
671
- g.path
672
- ).options({
673
- name: g.name,
674
- path: g.path,
675
- statePath: ((I = g.state) == null ? void 0 : I.path) || ""
676
- }).build();
677
- t.addModel(b);
678
- }), a;
679
- }, {}), o = !!r.iceAgitator, s = !!r.carbAgitator;
680
- return {
681
- ...r,
682
- cartridgeAgitators: t,
683
- supportsCarb: s,
684
- supportsIce: o
685
- };
686
- }, zt = (e) => () => (Ne(e)(), me(e)(), V.register(), F.register(), pe.register(), k.register(), x.register(), W.register(), q.register(), d.companion.register(e)(
687
- be.type,
688
- V.type
689
- ), d.companion.register(e)(
690
- Z.type,
691
- F.type
692
- ), Tt.register(), d.companion.register(e)(
693
- Be.type,
694
- Et
695
- ), d.companion.register(e)(_e.type, W.type), d.companion.register(e)(
696
- ve.type,
697
- q.type
698
- ), w[z].register(
699
- "EnjoyByTrouble",
700
- async (t) => {
701
- if (t.data.enjoyByDate) {
702
- const r = new Date(t.data.enjoyByDate);
703
- return {
704
- enjoyByDays: Math.floor(
705
- ((/* @__PURE__ */ new Date()).getTime() - r.getTime()) / (1e3 * 60 * 60 * 24)
706
- ) || ""
707
- };
708
- }
709
- return {};
710
- }
711
- ), w[z].register(
712
- "SuperPumpRequiredTrouble",
713
- // This is the trouble type
714
- async (t) => {
715
- const { model: r } = _(
716
- Pe.type
717
- );
718
- return r ? {
719
- superPumps: r.models.getIndexByKey(
720
- Ie.byType,
721
- "microSuper"
722
- ).map((a) => a.name).join(", ")
723
- } : {};
724
- }
725
- ), w[z].register(
726
- "MicroPumpAirDetectTrouble",
727
- async (t) => {
728
- if (t.ifaces.includes("container"))
729
- return {};
730
- if (t.data.pumpPath) {
731
- const { model: r } = _(
732
- t.data.pumpPath
733
- );
734
- if (r) {
735
- const o = r.ingredientId ? _(r.ingredientId).model : void 0;
736
- return {
737
- ingredientId: r.ingredientId,
738
- ingredientName: (o == null ? void 0 : o.name) || ""
739
- };
740
- }
741
- }
742
- return {};
743
- }
744
- ), {
745
- preload: d.model.preloadModel(e),
746
- model: d.model.register(e),
747
- companion: d.companion.register(e),
748
- legacy: d.model.registerLegacyModel(e)
749
- }), u = {
750
- ...fe
751
- };
752
- u.freestyle = {
753
- models: zt(u)
754
- };
755
- u.preload = d.model.preloadModel(u);
756
- u.model = d.model.register(u);
757
- u.companion = d.companion.register(u);
758
- u.legacy = d.model.registerLegacyModel(u);
759
- const Lt = u;
760
- export {
761
- Mt as A,
762
- k as C,
763
- F,
764
- pe as I,
765
- Lt as K,
766
- lt as N,
767
- x as a,
768
- O as b,
769
- oe as c,
770
- q as d,
771
- V as e,
772
- W as f,
773
- Tt as g,
774
- Y as h,
775
- dt as i,
776
- ht as j,
777
- Ft as k,
778
- ke as l,
779
- zt as r
780
- };
781
- //# sourceMappingURL=freestyle-registration-manager-DkqzBO2O.js.map