@kosdev-code/kos-dispense-sdk 2.1.38 → 2.1.39

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