@kosdev-code/kos-dispense-sdk 2.1.21 → 2.1.23

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 (47) hide show
  1. package/{dispense-registration-manager-DEyW37S3.cjs → dispense-registration-manager-BkJ1ggtS.cjs} +2 -2
  2. package/{dispense-registration-manager-DEyW37S3.cjs.map → dispense-registration-manager-BkJ1ggtS.cjs.map} +1 -1
  3. package/{dispense-registration-manager-C36ULeOU.js → dispense-registration-manager-CcFUS_KM.js} +72 -69
  4. package/{dispense-registration-manager-C36ULeOU.js.map → dispense-registration-manager-CcFUS_KM.js.map} +1 -1
  5. package/{extension-utils-C3CjcNm5.cjs → extension-utils-DUV7OQR1.cjs} +2 -2
  6. package/{extension-utils-C3CjcNm5.cjs.map → extension-utils-DUV7OQR1.cjs.map} +1 -1
  7. package/{extension-utils-dTIk56MQ.js → extension-utils-DeLiIgFH.js} +2 -2
  8. package/{extension-utils-dTIk56MQ.js.map → extension-utils-DeLiIgFH.js.map} +1 -1
  9. package/index.cjs +1 -1
  10. package/index.cjs.map +1 -1
  11. package/index.js +112 -113
  12. package/index.js.map +1 -1
  13. package/models/models/generic-pour/generic-pour-model.d.ts +2 -1
  14. package/models/models/generic-pour/generic-pour-model.d.ts.map +1 -1
  15. package/models/models/generic-pour/types/index.d.ts +1 -0
  16. package/models/models/nozzle/index.d.ts +1 -1
  17. package/models/models/nozzle/index.d.ts.map +1 -1
  18. package/models/models/nozzle/nozzle-model.d.ts +2 -2
  19. package/models/models/nozzle/nozzle-model.d.ts.map +1 -1
  20. package/models/models/nozzle/types/index.d.ts +8 -0
  21. package/models.cjs +1 -1
  22. package/models.js +2 -2
  23. package/package.json +2 -2
  24. package/pump-provider-BfSGayrQ.js +1317 -0
  25. package/pump-provider-BfSGayrQ.js.map +1 -0
  26. package/pump-provider-BjaBZfDP.cjs +2 -0
  27. package/pump-provider-BjaBZfDP.cjs.map +1 -0
  28. package/ui/hooks/cui-kit/use-beverages.d.ts +2 -1
  29. package/ui/hooks/cui-kit/use-beverages.d.ts.map +1 -1
  30. package/ui/hooks/cui-kit/use-cui-kit.d.ts.map +1 -1
  31. package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts +2 -1
  32. package/ui/hooks/cui-kit/use-dispense-lifecycle.d.ts.map +1 -1
  33. package/ui/hooks/generic-pour/use-generic-pour.d.ts +2 -2
  34. package/ui/hooks/generic-pour/use-generic-pour.d.ts.map +1 -1
  35. package/ui/hooks/pour/use-pour.d.ts +2 -1
  36. package/ui/hooks/pour/use-pour.d.ts.map +1 -1
  37. package/ui/hooks/utils/pour-strategy/hold-to-pour-strategy.d.ts.map +1 -1
  38. package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts +2 -9
  39. package/ui/hooks/utils/pour-strategy/pour-strategy.d.ts.map +1 -1
  40. package/ui/hooks/utils/pour-strategy/tap-to-pour-strategy.d.ts.map +1 -1
  41. package/ui.cjs +1 -1
  42. package/ui.js +67 -68
  43. package/ui.js.map +1 -1
  44. package/pump-provider-BXvrC3jL.js +0 -1304
  45. package/pump-provider-BXvrC3jL.js.map +0 -1
  46. package/pump-provider-Bp45210p.cjs +0 -2
  47. package/pump-provider-Bp45210p.cjs.map +0 -1
@@ -0,0 +1,1317 @@
1
+ var at = Object.defineProperty;
2
+ var ot = (e, t, r) => t in e ? at(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
+ var X = (e, t, r) => (ot(e, typeof t != "symbol" ? t + "" : t, r), r);
4
+ import { jsx as p } from "@emotion/react/jsx-runtime";
5
+ import { useKosModel as S, getKosCompanionModel as Te, kosAutoEffect as De, KosLog as I, usePressGesture as Pe, EventBus as g, TimerManager as Le } from "@kosdev-code/kos-ui-sdk";
6
+ import { A as Ae, b as ke, e as ct, d as Ee, N as dt, f as Ce, H as ut, j as Se, I as Ne, k as He, G as lt, P as Ke } from "./dispense-registration-manager-CcFUS_KM.js";
7
+ import mt, { createContext as K, useMemo as k, useContext as N, useState as A, useCallback as c, useEffect as j, useRef as le } from "react";
8
+ const Be = () => {
9
+ const e = Ae.type;
10
+ return S({
11
+ modelId: e,
12
+ modelType: Ae.type,
13
+ options: {}
14
+ });
15
+ };
16
+ function Bt(e) {
17
+ return (t) => {
18
+ const { model: r, status: n, KosModelLoader: s } = Be();
19
+ return /* @__PURE__ */ p(s, { ...n, children: /* @__PURE__ */ p(e, { ...t, assembly: r }) });
20
+ };
21
+ }
22
+ const Me = () => {
23
+ const e = ke.type;
24
+ return S({
25
+ modelId: e,
26
+ modelType: ke.type,
27
+ options: {}
28
+ });
29
+ };
30
+ function Mt(e) {
31
+ return (t) => {
32
+ const { model: r, status: n, KosModelLoader: s } = Me();
33
+ return /* @__PURE__ */ p(s, { ...n, children: /* @__PURE__ */ p(e, { ...t, beverage: r }) });
34
+ };
35
+ }
36
+ const _e = (e) => S({
37
+ modelId: e,
38
+ modelType: ct.type,
39
+ options: {}
40
+ });
41
+ function _t(e) {
42
+ return (t) => (r) => {
43
+ const { model: n, status: s, KosModelLoader: a } = _e(t);
44
+ return /* @__PURE__ */ p(a, { ...s, children: /* @__PURE__ */ p(e, { ...r, board: n }) });
45
+ };
46
+ }
47
+ const Oe = () => {
48
+ const e = Ee.type;
49
+ return S({
50
+ modelId: e,
51
+ modelType: Ee.type,
52
+ options: {}
53
+ });
54
+ };
55
+ function Ot(e) {
56
+ return (t) => {
57
+ const { model: r, status: n, KosModelLoader: s } = Oe();
58
+ return /* @__PURE__ */ p(s, { ...n, children: /* @__PURE__ */ p(e, { ...t, boardContainer: r }) });
59
+ };
60
+ }
61
+ const Ye = (e) => S({
62
+ modelId: e,
63
+ modelType: dt.type,
64
+ options: {
65
+ path: e
66
+ }
67
+ }), Fe = K(void 0), ht = ({ children: e, path: t }) => {
68
+ const { model: r, ready: n } = Ye(t), s = k(() => n && r ? { model: r } : {}, [n, r]);
69
+ return /* @__PURE__ */ p(Fe.Provider, { value: s, children: e });
70
+ }, M = () => {
71
+ const e = N(Fe);
72
+ if (!e)
73
+ throw new Error("useNozzleContext must be used within a NozzleProvider");
74
+ return e;
75
+ }, pt = ({
76
+ onBeverageSelected: e,
77
+ onBeverageListUpdated: t,
78
+ onClearBeverage: r,
79
+ companionType: n
80
+ }) => {
81
+ const { model: s } = M(), [a, i] = A([]), [u, v] = A(null), f = k(() => n ? a.map(
82
+ (b) => Te(b, n)
83
+ ) : [], [a, n]), d = c(
84
+ async (b) => {
85
+ v(b), await (s == null ? void 0 : s.setSelectedPourable({ beverage: b })), e == null || e(b);
86
+ },
87
+ [s, e]
88
+ ), l = c(async () => {
89
+ v(null), await (s == null ? void 0 : s.setSelectedPourable({ beverage: void 0 })), r == null || r();
90
+ }, [s, r]);
91
+ return j(() => {
92
+ const b = De(() => {
93
+ if (!s)
94
+ return;
95
+ const w = s.selectedBrand;
96
+ if (!w) {
97
+ const m = s.getGroupAvailabilityItems("beverages").filter((T) => T.visible);
98
+ i(m ?? []), t == null || t(m);
99
+ return;
100
+ }
101
+ const $ = s.getAvailabilityByParent(w.id).filter((m) => m.visible);
102
+ i($ ?? []), t == null || t($);
103
+ });
104
+ return () => {
105
+ b();
106
+ };
107
+ }, [s]), {
108
+ beverages: a,
109
+ beverageCompanions: f,
110
+ selectBeverage: d,
111
+ selectedBeverage: u,
112
+ clearBeverage: l
113
+ };
114
+ }, ft = ({
115
+ onBrandSelected: e,
116
+ onBrandCleared: t,
117
+ companionType: r
118
+ }) => {
119
+ const { model: n } = M(), [s, a] = A(null), [i, u] = A([]), v = k(() => r ? i.map((l) => Te(l, r)) : [], [i, r]), f = c(
120
+ async (l) => {
121
+ a(l), n == null || n.setSelectedBrand(l), e == null || e(l);
122
+ },
123
+ [n, e]
124
+ ), d = c(() => {
125
+ a(null), n == null || n.setSelectedBrand(void 0), t == null || t();
126
+ }, [n, t]);
127
+ return j(() => {
128
+ const l = De(() => {
129
+ n && u(n.visibleBrands);
130
+ });
131
+ return () => {
132
+ l();
133
+ };
134
+ }, [n]), {
135
+ brands: i,
136
+ brandCompanions: v,
137
+ selectedBrand: s,
138
+ selectBrand: f,
139
+ clearBrand: d
140
+ };
141
+ };
142
+ class Ge {
143
+ constructor() {
144
+ X(this, "_data", /* @__PURE__ */ new Map());
145
+ }
146
+ get(t) {
147
+ return this._data.get(t);
148
+ }
149
+ set(t, r) {
150
+ this._data.set(t, r);
151
+ }
152
+ remove(t) {
153
+ this._data.delete(t);
154
+ }
155
+ has(t) {
156
+ return this._data.has(t);
157
+ }
158
+ }
159
+ const bt = I.createLogger({
160
+ name: "HoldToPourStrategy",
161
+ group: "kos-hooks"
162
+ }), je = {
163
+ name: "HoldToPourStrategy",
164
+ async initiate(e) {
165
+ if (!(e != null && e.canPour)) {
166
+ bt.debug(`Nozzle ${e == null ? void 0 : e.id} cannot pour. Returning early.`);
167
+ return;
168
+ }
169
+ await (e == null ? void 0 : e.pour());
170
+ },
171
+ async initiateEnded(e) {
172
+ await (e == null ? void 0 : e.cancelPour());
173
+ }
174
+ }, ce = I.createLogger({
175
+ name: "useNozzlePour",
176
+ group: "kos-hooks"
177
+ }), vt = ({
178
+ onPour: e,
179
+ onPourCancel: t,
180
+ onBeforePour: r,
181
+ onBeforePourRejected: n,
182
+ pourContext: s,
183
+ strategy: a = je
184
+ }) => {
185
+ const { model: i } = M(), [u, v] = A(
186
+ s || new Ge()
187
+ ), f = c(async () => {
188
+ (r ? await (r == null ? void 0 : r(u)) : !0) ? (ce.debug(
189
+ `[${a == null ? void 0 : a.name}] - Pour initiated for nozzle ${i == null ? void 0 : i.id}.`
190
+ ), a == null || a.initiate(i), e == null || e()) : (ce.debug(
191
+ `[${a == null ? void 0 : a.name}] - Did not pass onBeforePour gate for nozzle ${i == null ? void 0 : i.id}. Cancelling pour.`
192
+ ), n == null || n());
193
+ }, [
194
+ e,
195
+ i,
196
+ a,
197
+ r,
198
+ t,
199
+ u,
200
+ n
201
+ ]), d = c(() => {
202
+ var m;
203
+ ce.debug(
204
+ `[${a == null ? void 0 : a.name}] - Pour initiate ended called for nozzle ${i == null ? void 0 : i.id}.`
205
+ ), (m = a == null ? void 0 : a.initiateEnded) == null || m.call(a, i), t == null || t();
206
+ }, [t, i, a]), l = c(() => {
207
+ ce.debug(`Force cancelling pour for nozzle ${i == null ? void 0 : i.id}.`), i == null || i.cancelPour(), t == null || t();
208
+ }, [t, i]), b = c(
209
+ (m, T) => {
210
+ u.set(m, T);
211
+ },
212
+ [u]
213
+ ), w = c(
214
+ (m) => {
215
+ u.remove(m);
216
+ },
217
+ [u]
218
+ );
219
+ return {
220
+ handlers: Pe({
221
+ onPressed: f,
222
+ onRelease: d
223
+ }).dom,
224
+ cancel: l,
225
+ updatePourContext: b,
226
+ removeFromPourContext: w,
227
+ status: i
228
+ };
229
+ }, $t = ({
230
+ onFlavorSelected: e,
231
+ onFlavorCleared: t,
232
+ companionType: r
233
+ }) => {
234
+ const { model: n } = M(), s = k(
235
+ () => (n == null ? void 0 : n.getGroupAvailabilityItems("flavors").filter((d) => d.visible)) ?? [],
236
+ [n]
237
+ ), a = k(() => r ? s.map(
238
+ (d) => Te(d, r)
239
+ ) : [], [s, r]), [i, u] = A([]), v = c(
240
+ async (d) => {
241
+ if (u(
242
+ (l) => l != null && l.includes(d) ? [...l.filter((b) => b !== d)] : [...l ?? [], d]
243
+ ), n != null && n.selectedPourable) {
244
+ const { beverage: l } = n.selectedPourable;
245
+ await n.setSelectedPourable({
246
+ beverage: l,
247
+ additional: i ?? []
248
+ });
249
+ }
250
+ e == null || e(d, i ?? []);
251
+ },
252
+ [n, e, i]
253
+ ), f = c(async () => {
254
+ if (u([]), n != null && n.selectedPourable) {
255
+ const { beverage: d } = n.selectedPourable;
256
+ n.setSelectedPourable({ beverage: d }), t == null || t();
257
+ }
258
+ }, [n, t]);
259
+ return {
260
+ flavors: s,
261
+ flavorCompanions: a,
262
+ selectFlavor: v,
263
+ selectedFlavors: i,
264
+ clearFlavors: f
265
+ };
266
+ }, te = "brands", de = "beverages", se = "flavors", G = I.createLogger({ name: "use-cui-kit" }), gt = ({
267
+ initialGroup: e = te,
268
+ options: t = {}
269
+ }) => {
270
+ var ie, ae, oe;
271
+ const [r, n] = A(e), { model: s } = M(), a = le([]), i = le(), u = le(), v = c(
272
+ (h) => {
273
+ n(se);
274
+ const P = `/kos/dispense/${s == null ? void 0 : s.path}/brand/selected/`;
275
+ g.publish(P, h);
276
+ },
277
+ [s == null ? void 0 : s.path]
278
+ ), f = c(() => {
279
+ const h = `/kos/dispense/${s == null ? void 0 : s.path}/brand/cleared/`;
280
+ g.publish(h, {});
281
+ }, [s == null ? void 0 : s.path]), d = c(
282
+ (h) => {
283
+ const P = `/kos/dispense/${s == null ? void 0 : s.path}/beverage/list/updated/`;
284
+ g.publish(P, h);
285
+ },
286
+ [s == null ? void 0 : s.path]
287
+ ), l = c(
288
+ (h) => {
289
+ var ee;
290
+ n(se), (ee = i.current) == null || ee.call(i, "selectedBeverage", h);
291
+ const P = `/kos/dispense/${s == null ? void 0 : s.path}/beverage/selected/`;
292
+ g.publish(P, h);
293
+ },
294
+ [s == null ? void 0 : s.path]
295
+ ), b = c(() => {
296
+ var P;
297
+ const h = `/kos/dispense/${s == null ? void 0 : s.path}/beverage/cleared/`;
298
+ (P = u.current) == null || P.call(u, "selectedBeverage"), g.publish(h, {});
299
+ }, [s == null ? void 0 : s.path]), w = c(
300
+ (h) => {
301
+ const P = `/kos/dispense/${s == null ? void 0 : s.path}/flavor/selected/`;
302
+ g.publish(P, h);
303
+ },
304
+ [s == null ? void 0 : s.path]
305
+ ), $ = c(() => {
306
+ const h = `/kos/dispense/${s == null ? void 0 : s.path}/flavor/cleared/`;
307
+ g.publish(h, {});
308
+ }, [s == null ? void 0 : s.path]), m = c(() => {
309
+ const h = `/kos/dispense/${s == null ? void 0 : s.path}/pour/`;
310
+ g.publish(h, {});
311
+ }, [s == null ? void 0 : s.path]), T = c(
312
+ async (h) => {
313
+ const P = `/kos/dispense/${s == null ? void 0 : s.path}/pre/pour/`;
314
+ return g.publish(P, {}), await (F == null ? void 0 : F(h)) || !0;
315
+ },
316
+ [s == null ? void 0 : s.path]
317
+ ), o = c(async () => {
318
+ const h = `/kos/dispense/${s == null ? void 0 : s.path}/pre/pour/rejected/`;
319
+ g.publish(h, {});
320
+ }, [s == null ? void 0 : s.path]), _ = c(() => {
321
+ const h = `/kos/dispense/${s == null ? void 0 : s.path}/pour/cancel/`;
322
+ g.publish(h, {});
323
+ }, [s == null ? void 0 : s.path]), { brands: O, selectBrand: y, selectedBrand: Z, clearBrand: Y, brandCompanions: me } = ft({
324
+ companionType: (ie = t.companionTypes) == null ? void 0 : ie.brand,
325
+ onBrandSelected: v,
326
+ onBrandCleared: f
327
+ }), {
328
+ beverages: R,
329
+ selectBeverage: D,
330
+ selectedBeverage: U,
331
+ clearBeverage: L,
332
+ beverageCompanions: q
333
+ } = pt({
334
+ companionType: (ae = t.companionTypes) == null ? void 0 : ae.beverage,
335
+ onBeverageSelected: l,
336
+ onClearBeverage: b,
337
+ onBeverageListUpdated: d
338
+ }), {
339
+ clearFlavors: x,
340
+ flavors: H,
341
+ selectFlavor: J,
342
+ selectedFlavors: E,
343
+ flavorCompanions: V
344
+ } = $t({
345
+ companionType: (oe = t.companionTypes) == null ? void 0 : oe.flavor,
346
+ onFlavorSelected: w,
347
+ onFlavorCleared: $
348
+ }), [F, Q] = A(), he = c((h) => {
349
+ Q(() => h);
350
+ }, []), z = vt({
351
+ onPour: m,
352
+ onPourCancel: _,
353
+ onBeforePour: T,
354
+ onBeforePourRejected: o
355
+ });
356
+ i.current = z.updatePourContext, u.current = z.removeFromPourContext;
357
+ const pe = c(() => {
358
+ switch (G.debug(`Navigating back from group: ${r}`), r) {
359
+ case te:
360
+ L(), Y();
361
+ break;
362
+ case de:
363
+ case se:
364
+ n(e), L(), Y();
365
+ break;
366
+ }
367
+ }, [L, Y, r, e]), fe = c(() => {
368
+ const h = `/kos/dispense/${s == null ? void 0 : s.path}/home/`;
369
+ g.publish(h, {}), n(e), e === te && (L(), Y()), e === de && L();
370
+ }, [L, Y, e]), be = c(() => {
371
+ if (a.current.length === 0) {
372
+ G.debug("No timers to pause.");
373
+ return;
374
+ }
375
+ G.debug(`Pausing ${a.current.length} timers.`), a.current.forEach((h) => {
376
+ G.debug(`Pausing timer with id ${h.id}.`), h.pause();
377
+ });
378
+ }, []), ve = c(() => {
379
+ if (a.current.length === 0) {
380
+ G.debug("No timers to restart.");
381
+ return;
382
+ }
383
+ G.debug(`Restarting ${a.current.length} timers.`), a.current.forEach((h) => {
384
+ G.debug(`Restarting timer with id ${h.id}.`), h.restart();
385
+ });
386
+ }, []);
387
+ return {
388
+ timers: {
389
+ add: c((h) => {
390
+ if (h) {
391
+ if (a.current.some((P) => P.id === h.id)) {
392
+ G.debug(`Timer with id ${h.id} already exists.`);
393
+ return;
394
+ }
395
+ a.current.push(h);
396
+ }
397
+ }, []),
398
+ pause: be,
399
+ restart: ve
400
+ },
401
+ nav: {
402
+ currentGroup: r,
403
+ back: pe,
404
+ home: fe
405
+ },
406
+ pour: z,
407
+ updateOnBeforePour: he,
408
+ selections: {
409
+ [te]: Z,
410
+ [de]: U,
411
+ [se]: E
412
+ },
413
+ [te]: {
414
+ models: O,
415
+ companions: me,
416
+ clear: Y,
417
+ handlers: {
418
+ onSelected: y
419
+ }
420
+ },
421
+ [de]: {
422
+ models: R,
423
+ companions: q,
424
+ clear: L,
425
+ handlers: {
426
+ onSelected: D
427
+ }
428
+ },
429
+ [se]: {
430
+ models: H,
431
+ companions: V,
432
+ clear: x,
433
+ handlers: {
434
+ onSelected: J
435
+ }
436
+ }
437
+ };
438
+ }, wt = (e) => {
439
+ const { model: t } = M(), [r, n] = A(null), {
440
+ onAmbientTimer: s,
441
+ onAttractTimer: a,
442
+ onResetAttractTimer: i,
443
+ onResumeAttractTimer: u,
444
+ defaultAttractTime: v,
445
+ defaultAmbientTime: f
446
+ } = e, d = c(() => {
447
+ s && (I.info("Ambient timer expired. Calling callback"), s == null || s());
448
+ }, [s]), l = c(() => {
449
+ a && (I.info("Attract timer expired. Calling callback"), a == null || a());
450
+ }, [a]), b = c(() => {
451
+ r && (r.restart(), i == null || i());
452
+ }, [r, i]), w = c(() => {
453
+ r && (r.reset(), i == null || i());
454
+ }, [r, i]), $ = c(() => {
455
+ r && (r.pause(), u == null || u());
456
+ }, [r, u]);
457
+ return j(() => {
458
+ if (t && v) {
459
+ I.info("Nozzle is available. Creating timers");
460
+ const m = Le.createTimer(
461
+ "attract-timer-" + t.path,
462
+ v
463
+ );
464
+ return v && (m == null || m.addTimeoutAction({
465
+ name: "attract-timer",
466
+ remainingTime: 0,
467
+ action: l
468
+ })), f && (m == null || m.addTimeoutAction({
469
+ name: "ambient-timer",
470
+ remainingTime: f,
471
+ action: d
472
+ })), v && (m == null || m.start()), n(m ?? null), () => {
473
+ m == null || m.reset(), n(null);
474
+ };
475
+ }
476
+ return () => {
477
+ I.info("Nozzle is not available. No timers to clear");
478
+ };
479
+ }, [
480
+ f,
481
+ v,
482
+ d,
483
+ l,
484
+ t
485
+ ]), {
486
+ attractTimer: r,
487
+ restart: b,
488
+ pause: w,
489
+ resume: $
490
+ };
491
+ }, Tt = (e, t) => {
492
+ if (t)
493
+ return g.subscribe(e, t).unsubscribe;
494
+ }, Pt = ({
495
+ onInit: e,
496
+ onBrandSelected: t,
497
+ onBrandCleared: r,
498
+ onBeverageCleared: n,
499
+ onBeverageSelected: s,
500
+ onBeverageListUpdated: a,
501
+ onFlavorCleared: i,
502
+ onFlavorSelected: u,
503
+ onReturnToHome: v,
504
+ onPour: f,
505
+ onPourCancel: d,
506
+ onBeforePourRejected: l,
507
+ onAmbientTimer: b,
508
+ onAttractTimer: w,
509
+ onResumeAttractTimer: $,
510
+ onIdleTimeout: m,
511
+ onAreYouThereTimeout: T
512
+ }) => {
513
+ const { model: o } = M();
514
+ j(() => {
515
+ const O = [
516
+ {
517
+ topic: `/kos/dispense/${o == null ? void 0 : o.path}/brand/selected/`,
518
+ callback: t
519
+ },
520
+ {
521
+ topic: `/kos/dispense/${o == null ? void 0 : o.path}/brand/cleared/`,
522
+ callback: r
523
+ },
524
+ {
525
+ topic: `/kos/dispense/${o == null ? void 0 : o.path}/beverage/list/updated/`,
526
+ callback: a
527
+ },
528
+ {
529
+ topic: `/kos/dispense/${o == null ? void 0 : o.path}/beverage/selected/`,
530
+ callback: s
531
+ },
532
+ {
533
+ topic: `/kos/dispense/${o == null ? void 0 : o.path}/beverage/cleared/`,
534
+ callback: n
535
+ },
536
+ {
537
+ topic: `/kos/dispense/${o == null ? void 0 : o.path}/flavor/selected/`,
538
+ callback: u
539
+ },
540
+ {
541
+ topic: `/kos/dispense/${o == null ? void 0 : o.path}/flavor/cleared/`,
542
+ callback: i
543
+ },
544
+ { topic: `/kos/dispense/${o == null ? void 0 : o.path}/pour/`, callback: f },
545
+ {
546
+ topic: `/kos/dispense/${o == null ? void 0 : o.path}/pour/cancel/`,
547
+ callback: d
548
+ },
549
+ {
550
+ topic: `/kos/dispense/${o == null ? void 0 : o.path}/pre/pour/rejected/`,
551
+ callback: l
552
+ },
553
+ {
554
+ topic: `/kos/dispense/${o == null ? void 0 : o.path}/ambient/start/`,
555
+ callback: b
556
+ },
557
+ {
558
+ topic: `/kos/dispense/${o == null ? void 0 : o.path}/attract/start/`,
559
+ callback: w
560
+ },
561
+ {
562
+ topic: `/kos/dispense/${o == null ? void 0 : o.path}/attract/resume/`,
563
+ callback: $
564
+ },
565
+ {
566
+ topic: `/kos/dispense/${o == null ? void 0 : o.path}/idle/timeout/`,
567
+ callback: m
568
+ },
569
+ {
570
+ topic: `/kos/dispense/${o == null ? void 0 : o.path}/are-you-there/timeout/`,
571
+ callback: T
572
+ },
573
+ {
574
+ topic: `/kos/dispense/${o == null ? void 0 : o.path}/init/`,
575
+ callback: e
576
+ },
577
+ {
578
+ topic: `/kos/dispense/${o == null ? void 0 : o.path}/home/`,
579
+ callback: v
580
+ }
581
+ ].map(
582
+ ({ topic: y, callback: Z }) => Tt(y, Z)
583
+ );
584
+ return () => {
585
+ O.forEach((y) => y == null ? void 0 : y());
586
+ };
587
+ }, [
588
+ o == null ? void 0 : o.path,
589
+ b,
590
+ w,
591
+ n,
592
+ s,
593
+ r,
594
+ t,
595
+ i,
596
+ u,
597
+ f,
598
+ d,
599
+ $,
600
+ m,
601
+ T,
602
+ e,
603
+ v
604
+ ]);
605
+ }, B = I.createLogger({ name: "useCuiKitTimers" }), Re = (e) => {
606
+ const { model: t } = M(), [r, n] = A(null), {
607
+ onAreYouThereTimer: s,
608
+ onIdleTimer: a,
609
+ onResetIdleTimer: i,
610
+ defaultAreYouThereTime: u = 10,
611
+ defaultIdleTime: v = 20
612
+ } = e, f = le(!1), d = c(() => {
613
+ !f.current && s && (I.info("Are you there timer expired. Calling callback"), f.current = !0, s == null || s());
614
+ }, [s]), l = c(() => {
615
+ B.debug(
616
+ "handleIdleTimer called in useCuiKitTimers, onIdleTimer exists:",
617
+ !!a
618
+ ), a ? (B.debug("Idle timer expired. Calling callback"), a == null || a()) : B.debug("No onIdleTimer callback provided!");
619
+ }, [a]), b = c(() => {
620
+ B.debug(`TIMER RESTART called for ${e.prefix ?? ""}timer`), r && (r.restart(), f.current = !1, i == null || i());
621
+ }, [r, i, e.prefix]), w = c(() => {
622
+ B.debug(`TIMER PAUSE/RESET called for ${e.prefix ?? ""}timer`), r && (r.reset(), f.current = !1, i == null || i());
623
+ }, [r, i, e.prefix]);
624
+ return j(() => {
625
+ if (B.debug(
626
+ `useCuiKitTimers effect triggered - nozzle: ${!!t}, path: ${t == null ? void 0 : t.path}, callbacks: handleIdle=${!!l}, handleAreYouThere=${!!d}`
627
+ ), t) {
628
+ B.info("Nozzle is available. Creating timers");
629
+ const $ = Le.createTimer(
630
+ `${e.prefix ?? ""}idle-timer-${t.path}`,
631
+ v
632
+ );
633
+ return B.debug(
634
+ `Adding idle timer action for ${e.prefix ?? ""}idle-timer-${t.path} with callback:`,
635
+ !!l
636
+ ), $ == null || $.addTimeoutAction({
637
+ name: "idle-timer",
638
+ remainingTime: 0,
639
+ action: l
640
+ }), $ == null || $.addTimeoutAction({
641
+ name: "are-you-there-timer",
642
+ remainingTime: u,
643
+ action: d
644
+ }), n($ ?? null), () => {
645
+ $ == null || $.reset(), n(null);
646
+ };
647
+ }
648
+ return () => {
649
+ B.info("Nozzle is not available. No timers to clear");
650
+ };
651
+ }, [
652
+ u,
653
+ v,
654
+ d,
655
+ l,
656
+ t,
657
+ e.prefix
658
+ ]), {
659
+ idleTimer: r,
660
+ restart: b,
661
+ pause: w
662
+ };
663
+ }, W = I.createLogger({ name: "useDefaultCuiKitLifecycle" }), Yt = ({
664
+ kit: e,
665
+ inactivity: t,
666
+ pour: r,
667
+ screens: n,
668
+ onBeforeAreYouThereTimer: s,
669
+ areYouThereRejectionPolicy: a = "pause"
670
+ }) => {
671
+ var h, P, ee, xe;
672
+ const [i, u] = A(!1), [v, f] = A(!1), { model: d } = M(), [l, b] = A(!1), w = (t == null ? void 0 : t.idleTimeout) ?? 15, $ = (t == null ? void 0 : t.areYouThereTimeoutOffset) ?? 10, m = (r == null ? void 0 : r.idleTimeout) ?? (t == null ? void 0 : t.idleTimeout) ?? 10, T = (r == null ? void 0 : r.areYouThereTimeoutOffset) ?? (t == null ? void 0 : t.areYouThereTimeoutOffset) ?? 5, o = n == null ? void 0 : n.ambientTimeoutOffset, _ = n == null ? void 0 : n.attractTimeout, O = c(() => {
673
+ if (W.info("handleIdleTimeout called - navigating home and publishing event"), q(!1), e == null || e.nav.home(), d) {
674
+ const C = `/kos/dispense/${d.path}/idle/timeout/`;
675
+ g.publish(C, {});
676
+ }
677
+ }, [(h = e == null ? void 0 : e.nav) == null ? void 0 : h.home, d]), y = c(() => {
678
+ W.info("handleResetIdleTimer called - resetting idle timer"), q(!1);
679
+ }, []), Z = c(() => {
680
+ if (o && (u(!0), f(!1), d)) {
681
+ const C = `/kos/dispense/${d.path}/ambient/start/`;
682
+ g.publish(C, {});
683
+ }
684
+ }, [o, d]), Y = c(() => {
685
+ if (_ && (f(!0), u(!1), d)) {
686
+ const C = `/kos/dispense/${d.path}/attract/start/`;
687
+ g.publish(C, {});
688
+ }
689
+ }, [_, d]), me = c(() => {
690
+ if (_ && (f(!1), u(!1), e == null || e.nav.home(), d)) {
691
+ const C = `/kos/dispense/${d.path}/attract/resume/`;
692
+ g.publish(C, {});
693
+ }
694
+ }, [e == null ? void 0 : e.nav, _, d]), {
695
+ pause: R,
696
+ restart: D,
697
+ attractTimer: U
698
+ } = wt({
699
+ defaultAmbientTime: o,
700
+ defaultAttractTime: _,
701
+ onAmbientTimer: Z,
702
+ onAttractTimer: Y,
703
+ onResumeAttractTimer: me
704
+ });
705
+ (P = e == null ? void 0 : e.timers) == null || P.add(U);
706
+ const [L, q] = A(!1);
707
+ W.info(
708
+ "Creating idle timer with timeout:",
709
+ w,
710
+ "seconds and callback:",
711
+ !!O
712
+ );
713
+ const { pause: x, restart: H, idleTimer: J } = Re({
714
+ defaultAreYouThereTime: $,
715
+ defaultIdleTime: w,
716
+ onIdleTimer: O,
717
+ onResetIdleTimer: y
718
+ });
719
+ W.info(
720
+ `Creating pour timer with timeout: ${m} seconds and callback: ${!!O}`
721
+ );
722
+ const {
723
+ pause: E,
724
+ restart: V,
725
+ idleTimer: F
726
+ } = Re({
727
+ defaultAreYouThereTime: T,
728
+ defaultIdleTime: m,
729
+ onIdleTimer: O,
730
+ prefix: "pour-"
731
+ }), Q = c(async () => {
732
+ let C = !0;
733
+ if (s)
734
+ try {
735
+ C = await s();
736
+ } catch ($e) {
737
+ W.error(`onBeforeAreYouThereTimer callback failed: ${$e}`), C = !1;
738
+ }
739
+ if (C) {
740
+ if (d) {
741
+ const $e = `/kos/dispense/${d.path}/are-you-there/timeout/`;
742
+ g.publish($e, {});
743
+ }
744
+ q(!0), l ? E() : x();
745
+ } else
746
+ switch (a) {
747
+ case "pause":
748
+ l ? E() : x();
749
+ break;
750
+ case "restart":
751
+ l ? V() : H();
752
+ break;
753
+ }
754
+ }, [s, d, a, l]), he = c(() => {
755
+ q(!1), R(), l ? (V(), x()) : (H(), E());
756
+ }, [l, x, E, H, V]);
757
+ j(() => {
758
+ J && J.addTimeoutAction({
759
+ name: "are-you-there-timer",
760
+ remainingTime: $,
761
+ action: Q
762
+ });
763
+ }, [J, $, Q]), j(() => {
764
+ F && F.addTimeoutAction({
765
+ name: "pour-are-you-there-timer",
766
+ remainingTime: T,
767
+ action: Q
768
+ });
769
+ }, [F, T, Q]), (ee = e == null ? void 0 : e.timers) == null || ee.add(J), (xe = e == null ? void 0 : e.timers) == null || xe.add(F);
770
+ const z = c(() => {
771
+ b(!1), E(), x(), R();
772
+ }, [x, E]), pe = c(() => {
773
+ b(!0), W.info("restarting pour timer"), V(), R(), x();
774
+ }, [x, V]), fe = c(() => {
775
+ b(!1), W.info("restarting pour timer on before pour rejected"), E(), H();
776
+ }, []), be = c(() => {
777
+ R(), f(!1), u(!1), H();
778
+ }, [R, H]), ve = c(() => {
779
+ f(!1), u(!1), b(!1), E(), D();
780
+ }, [D, E]), Ie = c(() => {
781
+ f(!1), u(!1), b(!1), R(), H();
782
+ }, [R, H]), ie = c(() => {
783
+ f(!1), u(!1), b(!1), D(), x(), E();
784
+ }, [D, x, E]), ae = c(() => {
785
+ f(!1), u(!1), D(), x();
786
+ }, [D, x]);
787
+ Pt({
788
+ onBrandSelected: be,
789
+ onBrandCleared: ve,
790
+ onBeverageSelected: Ie,
791
+ onBeverageCleared: ie,
792
+ onPour: z,
793
+ onPourCancel: pe,
794
+ onBeforePourRejected: fe,
795
+ onInit: ae
796
+ // Note: Timer-related handlers (onIdleTimeout, onAmbientTimer, onAttractTimer,
797
+ // onResumeAttractTimer, onAreYouThereTimeout) are NOT included here since this
798
+ // component's own timer hooks call those handlers directly. Including them would
799
+ // create circular event loops.
800
+ });
801
+ const oe = l ? T : $;
802
+ return j(() => {
803
+ if (d && U) {
804
+ const C = `/kos/dispense/${d == null ? void 0 : d.path}/init/`;
805
+ g.publish(C, {});
806
+ }
807
+ }, [d, U]), {
808
+ showAreYouThere: L,
809
+ clearAreYouThere: he,
810
+ pauseIdleTimer: x,
811
+ restartIdleTimer: H,
812
+ areYouThereCountdown: oe,
813
+ showAmbientScreen: i,
814
+ showAttractScreen: v,
815
+ pauseScreenTimer: R,
816
+ restartScreenTimer: D
817
+ };
818
+ }, Ve = () => {
819
+ const e = Ce.type;
820
+ return S({
821
+ modelId: e,
822
+ modelType: Ce.type,
823
+ options: {}
824
+ });
825
+ };
826
+ function Ft(e) {
827
+ return (t) => {
828
+ const { model: r, status: n, KosModelLoader: s } = Ve();
829
+ return /* @__PURE__ */ p(s, { ...n, children: /* @__PURE__ */ p(e, { ...t, deviceAssembly: r }) });
830
+ };
831
+ }
832
+ const We = (e) => S({
833
+ modelId: e,
834
+ modelType: ut.type,
835
+ options: {}
836
+ });
837
+ function Gt(e, t) {
838
+ return (r) => {
839
+ const { model: n, status: s, KosModelLoader: a } = We(e);
840
+ return /* @__PURE__ */ p(a, { ...s, children: /* @__PURE__ */ p(t, { ...r, holder: n }) });
841
+ };
842
+ }
843
+ const qe = () => {
844
+ const e = Se.type;
845
+ return S({
846
+ modelId: e,
847
+ modelType: Se.type,
848
+ options: {}
849
+ });
850
+ };
851
+ function jt(e) {
852
+ return (t) => {
853
+ const { model: r, status: n, KosModelLoader: s } = qe();
854
+ return /* @__PURE__ */ p(s, { ...n, children: /* @__PURE__ */ p(e, { ...t, holderContainer: r }) });
855
+ };
856
+ }
857
+ const Je = () => {
858
+ const e = Ne.type;
859
+ return S({
860
+ modelId: e,
861
+ modelType: Ne.type,
862
+ options: {}
863
+ });
864
+ }, ge = I.createLogger({
865
+ name: "HoldToPourIntentStrategy",
866
+ group: "kos-hooks"
867
+ }), It = {
868
+ name: "HoldToPourIntentStrategy",
869
+ async initiate(e, t) {
870
+ if (!(e != null && e.canPour)) {
871
+ ge.debug(`${e == null ? void 0 : e.id} cannot pour. Returning early.`);
872
+ return;
873
+ }
874
+ t ? (ge.debug(`performing intent: ${t}`), await (e == null ? void 0 : e.performIntent(t))) : ge.debug("no intent provided. Returning early.");
875
+ },
876
+ async initiateEnded(e) {
877
+ await (e == null ? void 0 : e.cancelPour());
878
+ }
879
+ }, we = I.createLogger({
880
+ name: "useNozzlePour",
881
+ group: "kos-hooks"
882
+ }), Vt = ({
883
+ onPour: e,
884
+ onPourCancel: t,
885
+ intentContainer: r,
886
+ strategy: n = It
887
+ }) => {
888
+ const s = c(() => {
889
+ we.debug(
890
+ `[${n == null ? void 0 : n.name}] - Pour initiated for model ${r == null ? void 0 : r.id}.`
891
+ ), n == null || n.initiate(r), e == null || e();
892
+ }, [e, r, n]), a = c(() => {
893
+ var v;
894
+ we.debug(
895
+ `[${n == null ? void 0 : n.name}] - Pour initiate ended called for nozzle ${r == null ? void 0 : r.id}.`
896
+ ), (v = n == null ? void 0 : n.initiateEnded) == null || v.call(n, r), t == null || t();
897
+ }, [t, r, n]), i = c(() => {
898
+ we.debug(`Force cancelling pour for nozzle ${r == null ? void 0 : r.id}.`), r == null || r.cancelPour(), t == null || t();
899
+ }, [t, r]);
900
+ return {
901
+ handlers: Pe({
902
+ onPressed: s,
903
+ onRelease: a
904
+ }).dom,
905
+ cancel: i,
906
+ status: r
907
+ };
908
+ };
909
+ function Wt(e) {
910
+ return (t) => {
911
+ const { model: r, status: n, KosModelLoader: s } = Je();
912
+ return /* @__PURE__ */ p(s, { ...n, children: /* @__PURE__ */ p(e, { ...t, ingredient: r }) });
913
+ };
914
+ }
915
+ const Qe = () => {
916
+ const e = He.type;
917
+ return S({
918
+ modelId: e,
919
+ modelType: He.type,
920
+ options: {}
921
+ });
922
+ };
923
+ function qt(e) {
924
+ return (t) => {
925
+ const { model: r, status: n, KosModelLoader: s } = Qe();
926
+ return /* @__PURE__ */ p(s, { ...n, children: /* @__PURE__ */ p(e, { ...t, ingredientContainer: r }) });
927
+ };
928
+ }
929
+ function Jt(e, t) {
930
+ return (r) => {
931
+ const { model: n, status: s, KosModelLoader: a } = Ye(e);
932
+ return /* @__PURE__ */ p(a, { ...s, children: /* @__PURE__ */ p(t, { ...r, nozzle: n }) });
933
+ };
934
+ }
935
+ const re = I.createLogger({
936
+ name: "usePour",
937
+ group: "kos-hooks"
938
+ }), Qt = ({
939
+ onBeforePour: e,
940
+ onPour: t,
941
+ onPourCancel: r,
942
+ onPourAbort: n,
943
+ pourTarget: s,
944
+ pourContext: a,
945
+ strategy: i = je
946
+ }) => {
947
+ const [u, v] = A(
948
+ a || new Ge()
949
+ ), f = c(async () => {
950
+ re.debug(
951
+ `[${i == null ? void 0 : i.name}] - calling before pour for pour target ${s == null ? void 0 : s.id}.`
952
+ ), (e ? await (e == null ? void 0 : e(u)) : !0) ? (re.debug(
953
+ `[${i == null ? void 0 : i.name}] - Pour initiated for pour target ${s == null ? void 0 : s.id}.`
954
+ ), await (i == null ? void 0 : i.initiate(s)), t == null || t(), s != null && s.isPouring || n == null || n()) : (re.debug(
955
+ `[${i == null ? void 0 : i.name}] - Pour cancelled for pour target ${s == null ? void 0 : s.id}.`
956
+ ), r == null || r());
957
+ }, [t, e, n, s, i, u]), d = c(async () => {
958
+ var T;
959
+ re.debug(
960
+ `[${i == null ? void 0 : i.name}] - Pour initiate ended called for pour target ${s == null ? void 0 : s.id}.`
961
+ ), await ((T = i == null ? void 0 : i.initiateEnded) == null ? void 0 : T.call(i, s)) || r == null || r();
962
+ }, [r, s, i]), l = c(async () => {
963
+ re.debug(`Force cancelling pour for pour target ${s == null ? void 0 : s.id}.`), await (s == null ? void 0 : s.cancelPour()), r == null || r();
964
+ }, [r, s]), b = c(
965
+ (m, T) => {
966
+ u.set(m, T);
967
+ },
968
+ [u]
969
+ ), w = c(
970
+ (m) => {
971
+ u.remove(m);
972
+ },
973
+ [u]
974
+ );
975
+ return {
976
+ handlers: Pe({
977
+ onPressed: f,
978
+ onRelease: d
979
+ }).dom,
980
+ cancel: l,
981
+ updatePourContext: b,
982
+ removeFromPourContext: w,
983
+ status: s
984
+ };
985
+ }, ne = I.createLogger({
986
+ name: "TapOrHoldIntentStrategy",
987
+ group: "kos-hooks"
988
+ });
989
+ class Xt {
990
+ constructor(t) {
991
+ X(this, "intent");
992
+ X(this, "name", "TapOrHoldIntentStrategy");
993
+ X(this, "isHold", !1);
994
+ X(this, "disposer", null);
995
+ this.intent = t;
996
+ }
997
+ async initiate(t, r) {
998
+ if (this.disposer = setTimeout(() => {
999
+ this.isHold = !0;
1000
+ }, 250), t != null && t.isPouring && !this.isHold) {
1001
+ ne.debug("additional tap detected. cancelling pour"), await t.cancelPour();
1002
+ return;
1003
+ }
1004
+ if (!(t != null && t.canPour)) {
1005
+ ne.debug(`${t == null ? void 0 : t.id} cannot pour. Returning early.`);
1006
+ return;
1007
+ }
1008
+ r ? (ne.debug(`performing intent: ${r}`), await (t == null ? void 0 : t.performIntent(r))) : ne.debug("no intent provided. Returning early.");
1009
+ }
1010
+ async initiateEnded(t) {
1011
+ return this.disposer && clearTimeout(this.disposer), this.disposer = null, this.isHold ? (await (t == null ? void 0 : t.cancelPour()), !1) : (ne.debug("Tap detected. don't cancel and return."), !0);
1012
+ }
1013
+ }
1014
+ const ue = I.createLogger({
1015
+ name: "TapToPourIntentStrategy",
1016
+ group: "kos-hooks"
1017
+ }), Zt = {
1018
+ name: "TapToPourIntentStrategy",
1019
+ async initiate(e, t) {
1020
+ if (e != null && e.isPouring) {
1021
+ ue.debug(`Nozzle ${e == null ? void 0 : e.id} is already pouring. cancelling pour`), await e.cancelPour();
1022
+ return;
1023
+ }
1024
+ if (!(e != null && e.canPour)) {
1025
+ ue.debug(`Nozzle ${e == null ? void 0 : e.id} cannot pour. Returning early.`);
1026
+ return;
1027
+ }
1028
+ t ? (ue.debug(`performing intent: ${t}`), await (e == null ? void 0 : e.performIntent(t))) : ue.debug("no intent provided. Returning early.");
1029
+ },
1030
+ async initiateEnded(e) {
1031
+ return !0;
1032
+ }
1033
+ }, ye = I.createLogger({
1034
+ name: "HoldToPourStrategy",
1035
+ group: "kos-hooks"
1036
+ }), Ut = {
1037
+ name: "TapToPourStrategy",
1038
+ async initiate(e) {
1039
+ if (e != null && e.isPouring) {
1040
+ ye.debug(`Nozzle ${e == null ? void 0 : e.id} is already pouring. cancelling pour`), await e.cancelPour();
1041
+ return;
1042
+ }
1043
+ if (!(e != null && e.canPour)) {
1044
+ ye.debug(`Nozzle ${e == null ? void 0 : e.id} cannot pour. Returning early.`);
1045
+ return;
1046
+ }
1047
+ await (e == null ? void 0 : e.pour());
1048
+ },
1049
+ async initiateEnded(e) {
1050
+ return !0;
1051
+ }
1052
+ }, xt = (e, t, r, n) => S({
1053
+ modelId: e,
1054
+ modelType: lt.type,
1055
+ forceUpdate: !0,
1056
+ options: {
1057
+ servicePathFactory: t,
1058
+ selectedId: r,
1059
+ initialData: n
1060
+ }
1061
+ });
1062
+ function zt(e) {
1063
+ return (t) => {
1064
+ const { model: r, status: n, KosModelLoader: s } = xt(
1065
+ t.id,
1066
+ t.servicePathFactory,
1067
+ t.itemId
1068
+ );
1069
+ return /* @__PURE__ */ p(s, { ...n, children: /* @__PURE__ */ p(e, { ...t, genericPour: r }) });
1070
+ };
1071
+ }
1072
+ const Xe = K(void 0), es = ({ children: e }) => {
1073
+ const { model: t, ready: r } = Be(), n = k(() => r && t ? { model: t } : {}, [r, t]);
1074
+ return /* @__PURE__ */ p(Xe.Provider, { value: n, children: e });
1075
+ }, ts = () => {
1076
+ const e = N(
1077
+ Xe
1078
+ );
1079
+ if (!e)
1080
+ throw new Error(
1081
+ "useAssemblyContext must be used within a AssemblyProvider"
1082
+ );
1083
+ return e;
1084
+ }, Ze = K(void 0), ss = ({ children: e }) => {
1085
+ const { model: t, ready: r } = Me(), n = k(() => r && t ? { model: t } : {}, [r, t]);
1086
+ return /* @__PURE__ */ p(Ze.Provider, { value: n, children: e });
1087
+ }, rs = () => {
1088
+ const e = N(Ze);
1089
+ if (!e)
1090
+ throw new Error(
1091
+ "useAvailabilityContext must be used within a AvailabilityProvider"
1092
+ );
1093
+ return e;
1094
+ }, Ue = K(void 0), ns = ({ children: e, id: t }) => {
1095
+ const { model: r, ready: n } = _e(t), s = k(() => n && r ? { model: r } : {}, [n, r]);
1096
+ return /* @__PURE__ */ p(Ue.Provider, { value: s, children: e });
1097
+ }, is = () => {
1098
+ const e = N(Ue);
1099
+ if (!e)
1100
+ throw new Error("useBoardContext must be used within a BoardProvider");
1101
+ return e;
1102
+ }, ze = K(void 0), as = ({ children: e }) => {
1103
+ const { model: t, ready: r } = Oe(), n = k(() => r && t ? { model: t } : {}, [r, t]);
1104
+ return /* @__PURE__ */ p(ze.Provider, { value: n, children: e });
1105
+ }, os = () => {
1106
+ const e = N(ze);
1107
+ if (!e)
1108
+ throw new Error(
1109
+ "useBoardContainerContext must be used within a BoardContainerProvider"
1110
+ );
1111
+ return e;
1112
+ }, et = K(
1113
+ void 0
1114
+ ), At = ({ children: e }) => {
1115
+ const { model: t, ready: r } = Ve(), n = k(() => {
1116
+ if (r && t) {
1117
+ const a = t.nozzlePaths;
1118
+ return { model: t, nozzlePaths: a };
1119
+ }
1120
+ return {};
1121
+ }, [r, t]), s = r && t ? e : null;
1122
+ return /* @__PURE__ */ p(et.Provider, { value: n, children: s });
1123
+ }, kt = () => {
1124
+ const e = N(et);
1125
+ if (!e)
1126
+ throw new Error(
1127
+ "useDeviceAssemblyContext must be used within a DeviceAssemblyProvider"
1128
+ );
1129
+ return e;
1130
+ };
1131
+ function Et() {
1132
+ const e = mt.createContext(null);
1133
+ return [() => {
1134
+ const r = N(e);
1135
+ if (r === void 0)
1136
+ throw new Error("useDispenseKitContext must be used within a Provider");
1137
+ return r;
1138
+ }, e.Provider];
1139
+ }
1140
+ function Ct({
1141
+ children: e,
1142
+ provider: t,
1143
+ props: r,
1144
+ nozzleProps: n
1145
+ }) {
1146
+ const s = gt(r);
1147
+ return /* @__PURE__ */ p(t, { value: s, children: e(n || {}) });
1148
+ }
1149
+ function St({
1150
+ children: e,
1151
+ provider: t,
1152
+ props: r
1153
+ }) {
1154
+ const { nozzlePaths: n } = kt(), s = (n == null ? void 0 : n.length) || 0;
1155
+ return (n == null ? void 0 : n.map((i, u) => /* @__PURE__ */ p(ht, { path: i, children: /* @__PURE__ */ p(
1156
+ Ct,
1157
+ {
1158
+ provider: t,
1159
+ props: r,
1160
+ nozzleProps: {
1161
+ nozzleIndex: u,
1162
+ nozzlePath: i,
1163
+ totalNozzles: s,
1164
+ isFirstNozzle: u === 0,
1165
+ isLastNozzle: u === s - 1
1166
+ },
1167
+ children: e
1168
+ }
1169
+ ) }, i))) || [];
1170
+ }
1171
+ function Nt({
1172
+ provider: e,
1173
+ props: t
1174
+ }) {
1175
+ return ({ children: r }) => e ? /* @__PURE__ */ p(At, { children: /* @__PURE__ */ p(
1176
+ St,
1177
+ {
1178
+ provider: e,
1179
+ props: t,
1180
+ children: r
1181
+ }
1182
+ ) }) : null;
1183
+ }
1184
+ function cs(e) {
1185
+ const [t, r] = Et();
1186
+ return [
1187
+ t,
1188
+ Nt({ provider: r, props: e })
1189
+ ];
1190
+ }
1191
+ const tt = K(void 0), ds = ({ children: e, id: t }) => {
1192
+ const { model: r, ready: n } = We(t || ""), s = k(() => n && r ? { model: r } : {}, [n, r]);
1193
+ return /* @__PURE__ */ p(tt.Provider, { value: s, children: e });
1194
+ }, us = () => {
1195
+ const e = N(tt);
1196
+ if (!e)
1197
+ throw new Error("useHolderContext must be used within a HolderProvider");
1198
+ return e;
1199
+ }, st = K(
1200
+ void 0
1201
+ ), ls = ({ children: e }) => {
1202
+ const { model: t, ready: r } = qe(), n = k(() => r && t ? { model: t } : {}, [r, t]);
1203
+ return /* @__PURE__ */ p(st.Provider, { value: n, children: e });
1204
+ }, ms = () => {
1205
+ const e = N(st);
1206
+ if (!e)
1207
+ throw new Error(
1208
+ "useHolderContainerContext must be used within a HolderContainerProvider"
1209
+ );
1210
+ return e;
1211
+ }, rt = K(void 0), hs = ({ children: e }) => {
1212
+ const { model: t, ready: r } = Je(), n = k(() => r && t ? { model: t } : {}, [r, t]);
1213
+ return /* @__PURE__ */ p(rt.Provider, { value: n, children: e });
1214
+ }, ps = () => {
1215
+ const e = N(rt);
1216
+ if (!e)
1217
+ throw new Error(
1218
+ "useIngredientContext must be used within a IngredientProvider"
1219
+ );
1220
+ return e;
1221
+ }, nt = K(
1222
+ void 0
1223
+ ), fs = ({ children: e }) => {
1224
+ const { model: t, ready: r } = Qe(), n = k(() => r && t ? { model: t } : {}, [r, t]);
1225
+ return /* @__PURE__ */ p(nt.Provider, { value: n, children: e });
1226
+ }, bs = () => {
1227
+ const e = N(nt);
1228
+ if (!e)
1229
+ throw new Error(
1230
+ "useIngredientContainerContext must be used within a IngredientContainerProvider"
1231
+ );
1232
+ return e;
1233
+ }, Ht = () => {
1234
+ const e = Ke.type;
1235
+ return S({
1236
+ modelId: e,
1237
+ modelType: Ke.type,
1238
+ options: {}
1239
+ });
1240
+ }, it = K(void 0), vs = ({ children: e }) => {
1241
+ const { model: t, ready: r } = Ht(), n = k(() => r && t ? { model: t } : {}, [r, t]);
1242
+ return /* @__PURE__ */ p(it.Provider, { value: n, children: e });
1243
+ }, $s = () => {
1244
+ const e = N(it);
1245
+ if (!e)
1246
+ throw new Error("usePumpContext must be used within a PumpProvider");
1247
+ return e;
1248
+ };
1249
+ export {
1250
+ qt as $,
1251
+ es as A,
1252
+ ns as B,
1253
+ Ct as C,
1254
+ At as D,
1255
+ ft as E,
1256
+ te as F,
1257
+ de as G,
1258
+ ds as H,
1259
+ hs as I,
1260
+ se as J,
1261
+ gt as K,
1262
+ Yt as L,
1263
+ Pt as M,
1264
+ ht as N,
1265
+ Re as O,
1266
+ vs as P,
1267
+ $t as Q,
1268
+ Ve as R,
1269
+ Ft as S,
1270
+ We as T,
1271
+ Gt as U,
1272
+ qe as V,
1273
+ jt as W,
1274
+ Je as X,
1275
+ Vt as Y,
1276
+ Wt as Z,
1277
+ Qe as _,
1278
+ ss as a,
1279
+ Ye as a0,
1280
+ Jt as a1,
1281
+ vt as a2,
1282
+ Qt as a3,
1283
+ It as a4,
1284
+ je as a5,
1285
+ Xt as a6,
1286
+ Zt as a7,
1287
+ Ut as a8,
1288
+ xt as a9,
1289
+ zt as aa,
1290
+ Ge as ab,
1291
+ rs as b,
1292
+ is as c,
1293
+ as as d,
1294
+ os as e,
1295
+ Nt as f,
1296
+ kt as g,
1297
+ us as h,
1298
+ cs as i,
1299
+ ls as j,
1300
+ ms as k,
1301
+ ps as l,
1302
+ fs as m,
1303
+ bs as n,
1304
+ M as o,
1305
+ $s as p,
1306
+ Be as q,
1307
+ Me as r,
1308
+ Mt as s,
1309
+ _e as t,
1310
+ ts as u,
1311
+ _t as v,
1312
+ Bt as w,
1313
+ Oe as x,
1314
+ Ot as y,
1315
+ pt as z
1316
+ };
1317
+ //# sourceMappingURL=pump-provider-BfSGayrQ.js.map