@feedmepos/mf-menu 0.31.51-prod → 0.31.52-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-C68d-eta.js → App-MaktN0h5.js} +9 -9
- package/dist/{ApplyProduct.vue_vue_type_script_setup_true_lang-xvgIqXKV.js → ApplyProduct.vue_vue_type_script_setup_true_lang-DZnCqrjJ.js} +3 -3
- package/dist/{Catalog-jLDUoWhC.js → Catalog-cEpnDQ84.js} +6 -6
- package/dist/{Category-BJqMsx47.js → Category-C3Ypu2VQ.js} +4 -4
- package/dist/{Category-Bj5vG5BH.js → Category-ZiBoYQQN.js} +6 -6
- package/dist/{CookingGuide-BVFIw-HU.js → CookingGuide-DH0pYHsm.js} +4 -4
- package/dist/{CustomAttributeChip.vue_vue_type_script_setup_true_lang-D4DtjtYG.js → CustomAttributeChip.vue_vue_type_script_setup_true_lang-C4e7SpGo.js} +1 -1
- package/dist/{Group-CBK-GGHf.js → Group-WRlOExBi.js} +1 -1
- package/dist/{Group-DYVoz8gS.js → Group-j5TSPPHj.js} +3 -3
- package/dist/{Group.vue_vue_type_script_setup_true_lang-Dyk9yKiZ.js → Group.vue_vue_type_script_setup_true_lang-CpOAdyWu.js} +8 -7
- package/dist/{GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-CVC0loV_.js → GroupMarkupPriceDialog.vue_vue_type_script_setup_true_lang-Da4d_t4d.js} +5 -5
- package/dist/{ImportProductDialog.vue_vue_type_script_setup_true_lang-yG08n5hc.js → ImportProductDialog.vue_vue_type_script_setup_true_lang-DJ7_iBd1.js} +7 -7
- package/dist/{Ingredient-CqHoOPQn.js → Ingredient-7o_2tWwH.js} +3 -3
- package/dist/{InventoryBinding.vue_vue_type_script_setup_true_lang-9LWSZid8.js → InventoryBinding.vue_vue_type_script_setup_true_lang-DVBc2xYW.js} +2 -2
- package/dist/{LinkProductSideSheet-zwWnyibG.js → LinkProductSideSheet-BBLfSM53.js} +3 -3
- package/dist/{MenuSetting-Bu6EU16f.js → MenuSetting-d9jbk0M4.js} +5 -5
- package/dist/{PrintRoute-pmRg4C4l.js → PrintRoute-BQCMHXJ9.js} +4 -4
- package/dist/{Product-d5rkdZFG.js → Product-CXt3FaBK.js} +1 -1
- package/dist/{Product.vue_vue_type_script_setup_true_lang-zU4ga8V2.js → Product.vue_vue_type_script_setup_true_lang-C9SXeiW2.js} +13 -13
- package/dist/{ProductInternalTools-CC3obJlW.js → ProductInternalTools-BBNHbRCz.js} +6 -6
- package/dist/{Products-NnHsb6AR.js → Products-CXRSPmS2.js} +11 -11
- package/dist/{Publish-CqypD54y.js → Publish-BOaAkCRE.js} +3 -3
- package/dist/{Recipe-CK0X3dd7.js → Recipe-DUY4qTTX.js} +4 -4
- package/dist/{Scheduler-D38x6oA_.js → Scheduler-BPEWew1d.js} +3 -3
- package/dist/{ServingSequence-D0bTffsw.js → ServingSequence-9JE73A2n.js} +3 -3
- package/dist/{Setting-DC46Uqik.js → Setting-DdL7wa-o.js} +5 -5
- package/dist/{Subcategory-BH4kjlNQ.js → Subcategory-znLDoHOm.js} +4 -4
- package/dist/{Takeaway-cA_6Xpmx.js → Takeaway-CanMCNoK.js} +4 -4
- package/dist/{Takeaway-C_wX_aMw.js → Takeaway-DLc6Pu42.js} +1 -1
- package/dist/{Takeaway.vue_vue_type_script_setup_true_lang-DBSpVaY9.js → Takeaway.vue_vue_type_script_setup_true_lang-DNQTblGJ.js} +5 -5
- package/dist/{Thumbnail.vue_vue_type_script_setup_true_lang-Wf2062J_.js → Thumbnail.vue_vue_type_script_setup_true_lang-DqzK9R-0.js} +4 -4
- package/dist/{TreeEditorOpenner.vue_vue_type_script_setup_true_lang-BGk3ao7L.js → TreeEditorOpenner.vue_vue_type_script_setup_true_lang-734F0DDo.js} +157 -157
- package/dist/{Unit-BpcIb7Fs.js → Unit-DYPVcncJ.js} +2 -2
- package/dist/{Variant-DT6sfZ-F.js → Variant-CPNPsxlY.js} +3 -3
- package/dist/{_id_-DcY9kltL.js → _id_-BtEgjazW.js} +10 -10
- package/dist/{app-Bbw5qDik.js → app-edIuGM5n.js} +1 -1
- package/dist/{app-BeGADnuI.js → app-m5E6HHmB.js} +26 -26
- package/dist/app.js +1 -1
- package/dist/apps/mf-menu/src/components/feature/TreeEditor/history/jsonDiffPatch.d.ts +130 -0
- package/dist/apps/mf-menu/src/components/feature/TreeEditor/store/menuV2.d.ts +3 -3
- package/dist/apps/mf-menu/src/stores/menu.d.ts +0 -1
- package/dist/apps/mf-menu/tsconfig.app.tsbuildinfo +1 -1
- package/dist/assets/{linked-status-j41VBPOC.js → linked-status-CvGzvMr1.js} +2 -2
- package/dist/assets/{override-menu-BntGqRU_.js → override-menu-143sdmgy.js} +2 -2
- package/dist/assets/{validate-menu-CxVhrJ86.js → validate-menu-GPsZur6N.js} +2 -2
- package/dist/{catalog-D6-ZZrEk.js → catalog-DbBOv8uZ.js} +1 -1
- package/dist/{catalogSetting-Bw6hrDjd.js → catalogSetting-OMF_13MG.js} +1 -1
- package/dist/{category-Be4KQ0Dc.js → category-CkHad8Qe.js} +1 -1
- package/dist/{currency-CvbaKcEI.js → currency-DF2AE_Ev.js} +1 -1
- package/dist/{customAttributes-W2k3ZTP0.js → customAttributes-BBq_Rv5r.js} +1 -1
- package/dist/{dayjs.min-B0H2lZEq.js → dayjs.min-Baxvt3jl.js} +1 -1
- package/dist/{index-ChTXF5Wf.js → index-9LDXtBYA.js} +3 -3
- package/dist/{index-Dx2uQ0oK.js → index-BCaofwYh.js} +1 -1
- package/dist/{index-p-a3dKlm.js → index-BgQC1nrS.js} +4 -4
- package/dist/{index-Clor2yi1.js → index-OrBLJRSr.js} +1 -1
- package/dist/{item-DLXfMovw.js → item-BLAE_RCk.js} +386 -386
- package/dist/{jszip.min-CWdZDwkx.js → jszip.min-BMisfLkQ.js} +245 -245
- package/dist/{menu-CpEtH29G.js → menu-3zZmORBk.js} +1 -1
- package/dist/{menu-CToRFpJn.js → menu-k8bqSg47.js} +7 -7
- package/dist/menuV2-BYX-027p.js +1042 -0
- package/dist/{priceTier-DztgXBu3.js → priceTier-znTjAPPz.js} +1 -1
- package/dist/{scheduler-DlH8J5Hn.js → scheduler-DJbCs-IR.js} +4 -4
- package/dist/{subcategory-5gTdlPYc.js → subcategory-CHBqzP1A.js} +2 -2
- package/dist/{toExcel-CXzIh7Dz.js → toExcel-ZjuZ9iuw.js} +2 -2
- package/dist/{unit-I1STL5Hd.js → unit-BYsP3DYD.js} +2 -2
- package/package.json +7 -2
- package/dist/menuV2-BeGyJxY5.js +0 -712
|
@@ -0,0 +1,1042 @@
|
|
|
1
|
+
var Ue = Object.defineProperty;
|
|
2
|
+
var We = (e, t, n) => t in e ? Ue(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var ne = (e, t, n) => We(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { an as ue, H as C, D as T, A as ae, ao as re, J as q, I as ie, a8 as x, c as L, X as V, ai as oe, ap as Le, aq as ze, B as Ge, aa as qe, ar as He, as as Be, a7 as Je } from "./menu-k8bqSg47.js";
|
|
5
|
+
import { defineStore as Ye } from "pinia";
|
|
6
|
+
import { shallowRef as j, ref as H, computed as S, shallowReactive as Xe, effectScope as Qe, watch as Ze } from "vue";
|
|
7
|
+
import { useCoreStore as se } from "@feedmepos/mf-common";
|
|
8
|
+
import { useSnackbar as et } from "@feedmepos/ui-library";
|
|
9
|
+
const tt = "/assets/linked-status-CvGzvMr1.js", nt = "/assets/override-menu-143sdmgy.js";
|
|
10
|
+
function rt(e) {
|
|
11
|
+
var o;
|
|
12
|
+
const t = C(e), n = (o = t.variant) == null ? void 0 : o.variantCombinations;
|
|
13
|
+
return delete t.variant, delete t.thumbnail, [t, ...n || []];
|
|
14
|
+
}
|
|
15
|
+
function ot(e, t, n, o) {
|
|
16
|
+
const r = C(t), a = n ? r.modules.catalog.find((m) => m._id === n) : null, l = o ? r.modules.scheduler.find((m) => m._id === o) : null, u = a ? C(a) : void 0, c = n ? r.modules.catalog.filter((m) => m._id !== n) : [], i = l ? C(l) : void 0, f = e.reduce((m, v) => (m[v._id] = rt(v), m), {});
|
|
17
|
+
function h(m = []) {
|
|
18
|
+
const v = e.map((p) => p._id);
|
|
19
|
+
return [
|
|
20
|
+
...m.filter((p) => !v.includes(p._id)),
|
|
21
|
+
...Object.values(f).flatMap((p) => p)
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
return u && o ? (u.override.scheduler = {
|
|
25
|
+
...u.override.scheduler,
|
|
26
|
+
[o]: {
|
|
27
|
+
...u.override.scheduler[o],
|
|
28
|
+
_id: o,
|
|
29
|
+
items: h(i == null ? void 0 : i.items).map((m) => ({
|
|
30
|
+
...m,
|
|
31
|
+
orderFrom: ae.F_ORDER_FROM.enum.ALL
|
|
32
|
+
}))
|
|
33
|
+
}
|
|
34
|
+
}, r.modules.catalog = [...c, u], r) : u ? (u.override.items = {
|
|
35
|
+
...u.override.items,
|
|
36
|
+
...f
|
|
37
|
+
}, r.modules.catalog = [...c, u], r) : i ? (i.items = h(i.items), r.modules.scheduler = [
|
|
38
|
+
...r.modules.scheduler.filter((m) => m._id !== o),
|
|
39
|
+
i
|
|
40
|
+
], r) : {
|
|
41
|
+
...re(),
|
|
42
|
+
modules: {
|
|
43
|
+
...re().modules,
|
|
44
|
+
catalog: r.modules.catalog,
|
|
45
|
+
item: r.modules.item,
|
|
46
|
+
group: r.modules.group,
|
|
47
|
+
scheduler: r.modules.scheduler
|
|
48
|
+
},
|
|
49
|
+
_id: r._id
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function $(e, t, n) {
|
|
53
|
+
var a;
|
|
54
|
+
if (n >= 3) return e;
|
|
55
|
+
const o = t.modules.item.find((l) => l._id === e._id);
|
|
56
|
+
if (!o)
|
|
57
|
+
throw new Error(`_insertItemOverriders - Item not found - ${e._id}`);
|
|
58
|
+
const r = (a = o.groups) == null ? void 0 : a.map((l) => {
|
|
59
|
+
var i, f, h;
|
|
60
|
+
const u = (i = e == null ? void 0 : e.groups) == null ? void 0 : i.find((m) => m._id === l._id);
|
|
61
|
+
let c;
|
|
62
|
+
return u ? c = ((f = l.items) == null ? void 0 : f.map((m) => {
|
|
63
|
+
var p;
|
|
64
|
+
const v = (p = u.items) == null ? void 0 : p.find(
|
|
65
|
+
(b) => b._id === m._id && b.combinationKey === m.combinationKey
|
|
66
|
+
);
|
|
67
|
+
return $(v || m, t, n + 1);
|
|
68
|
+
})) ?? [] : c = ((h = l.items) == null ? void 0 : h.map((m) => $(m, t, n + 1))) ?? [], {
|
|
69
|
+
...l,
|
|
70
|
+
items: c
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
_id: o._id,
|
|
75
|
+
name: e.name || o.name,
|
|
76
|
+
code: e.code || o.code,
|
|
77
|
+
combinationKey: e.combinationKey,
|
|
78
|
+
groups: r
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function st(e, t) {
|
|
82
|
+
const n = e.groups.map((a) => {
|
|
83
|
+
const l = t.modules.group.find((c) => c._id === a._id), u = ((l == null ? void 0 : l.items) || []).map((c) => {
|
|
84
|
+
var h;
|
|
85
|
+
const i = (h = a.items) == null ? void 0 : h.find(
|
|
86
|
+
(m) => m._id === c._id && m.combinationKey === c.combinationKey
|
|
87
|
+
);
|
|
88
|
+
if (i)
|
|
89
|
+
return $(i, t, 1);
|
|
90
|
+
const f = {
|
|
91
|
+
...T.generator.initMenuV4ItemOverrider(),
|
|
92
|
+
_id: c._id,
|
|
93
|
+
combinationKey: c.combinationKey
|
|
94
|
+
};
|
|
95
|
+
return $(f, t, 1);
|
|
96
|
+
});
|
|
97
|
+
return { ...a, items: u };
|
|
98
|
+
}), o = e.variant ? e.variant.variantCombinations.map((a) => $(a, t, 1)) : [], r = {
|
|
99
|
+
...T.generator.initMenuV4ItemOverrider(),
|
|
100
|
+
_id: e._id,
|
|
101
|
+
name: e.name,
|
|
102
|
+
code: e.code,
|
|
103
|
+
groups: n
|
|
104
|
+
};
|
|
105
|
+
return [...o, r];
|
|
106
|
+
}
|
|
107
|
+
function B(e, t) {
|
|
108
|
+
var o;
|
|
109
|
+
if (!t)
|
|
110
|
+
return e;
|
|
111
|
+
const n = { ...e, code: t.code };
|
|
112
|
+
return n.groups = (o = n.groups) == null ? void 0 : o.map((r) => {
|
|
113
|
+
var l, u;
|
|
114
|
+
const a = (l = t.groups) == null ? void 0 : l.find((c) => c._id === r._id);
|
|
115
|
+
return r.items = (u = r.items) == null ? void 0 : u.map((c) => {
|
|
116
|
+
var f;
|
|
117
|
+
const i = (f = a == null ? void 0 : a.items) == null ? void 0 : f.find(
|
|
118
|
+
(h) => h._id === c._id && h.combinationKey === c.combinationKey
|
|
119
|
+
);
|
|
120
|
+
return B(c, i);
|
|
121
|
+
}), r;
|
|
122
|
+
}), n;
|
|
123
|
+
}
|
|
124
|
+
function ut(e, t) {
|
|
125
|
+
const n = e.items[t._id];
|
|
126
|
+
t.variant && (t.variant = {
|
|
127
|
+
...t.variant,
|
|
128
|
+
variantCombinations: t.variant.variantCombinations.map((r) => {
|
|
129
|
+
const a = n.find(
|
|
130
|
+
(l) => l._id === r._id && l.combinationKey === r.combinationKey
|
|
131
|
+
);
|
|
132
|
+
if (!a)
|
|
133
|
+
throw new Error(`Item overrider not found - ${r._id} - ${r.combinationKey}`);
|
|
134
|
+
return B(a, r);
|
|
135
|
+
})
|
|
136
|
+
});
|
|
137
|
+
const o = n.find((r) => !r.combinationKey);
|
|
138
|
+
if (!o)
|
|
139
|
+
throw new Error(`Base item overrider not found - ${t._id}`);
|
|
140
|
+
return t.groups = (o.groups || []).map((r) => {
|
|
141
|
+
var l;
|
|
142
|
+
const a = t.groups.find((u) => u._id === r._id);
|
|
143
|
+
return r.items = (l = r.items) == null ? void 0 : l.map((u) => {
|
|
144
|
+
var i;
|
|
145
|
+
const c = (i = a == null ? void 0 : a.items) == null ? void 0 : i.find(
|
|
146
|
+
(f) => f._id === u._id && f.combinationKey === u.combinationKey
|
|
147
|
+
);
|
|
148
|
+
return B(u, c);
|
|
149
|
+
}), r;
|
|
150
|
+
}), {
|
|
151
|
+
...t,
|
|
152
|
+
price: (o == null ? void 0 : o.price) || t.price
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
async function Ot(e, t, n, o, r, a = !0) {
|
|
156
|
+
const l = C(n), u = a ? ot(t, l, o, r) : l, c = t.reduce((h, m) => (h[m._id] = u.modules.item.find((v) => v._id === m._id), h), {}), i = t.reduce((h, m) => {
|
|
157
|
+
const v = m._id;
|
|
158
|
+
return h[v] = st(c[v], e), h;
|
|
159
|
+
}, {}), f = T.getFallbackPrices({
|
|
160
|
+
rawMenu: u,
|
|
161
|
+
items: i,
|
|
162
|
+
catalogId: o || void 0,
|
|
163
|
+
schedulerId: r
|
|
164
|
+
});
|
|
165
|
+
return t.map((h) => {
|
|
166
|
+
const m = h._id, v = c[m];
|
|
167
|
+
return {
|
|
168
|
+
...ut(f, v),
|
|
169
|
+
category: o || r ? v == null ? void 0 : v.category : null
|
|
170
|
+
};
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function Dt(e, t) {
|
|
174
|
+
if (e.length === 0) return "";
|
|
175
|
+
const n = e == null ? void 0 : e.split("variant");
|
|
176
|
+
return ((n == null ? void 0 : n.reduce((r, a) => {
|
|
177
|
+
if (a && a.length > 0) {
|
|
178
|
+
const l = `variant${a.split("/")[0]}`, u = a.split("/")[1], i = t.find(
|
|
179
|
+
({ _id: f }) => f === l
|
|
180
|
+
).options.find(({ _id: f }) => f === u);
|
|
181
|
+
r.push(((i == null ? void 0 : i.name) || "").trim());
|
|
182
|
+
}
|
|
183
|
+
return r;
|
|
184
|
+
}, [])) || []).join(" / ");
|
|
185
|
+
}
|
|
186
|
+
const z = /* @__PURE__ */ new Map();
|
|
187
|
+
async function Vt(e, t) {
|
|
188
|
+
const n = `${e._id}-${e.updatedAt}-${t}`;
|
|
189
|
+
if (z.has(n))
|
|
190
|
+
return z.get(n);
|
|
191
|
+
const o = await ue(
|
|
192
|
+
tt,
|
|
193
|
+
JSON.stringify({
|
|
194
|
+
menu: e,
|
|
195
|
+
itemId: t
|
|
196
|
+
})
|
|
197
|
+
);
|
|
198
|
+
return z.set(n, o), o;
|
|
199
|
+
}
|
|
200
|
+
async function ce(e, t, n) {
|
|
201
|
+
return await ue(nt, {
|
|
202
|
+
menu: e,
|
|
203
|
+
catalogId: t,
|
|
204
|
+
schedulerId: n
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
function Tt(e, t, n) {
|
|
208
|
+
const o = /* @__PURE__ */ new Set();
|
|
209
|
+
function r(a, l) {
|
|
210
|
+
if (!e || !a || !l || o.has(l)) return !1;
|
|
211
|
+
o.add(l);
|
|
212
|
+
const u = e.modules.item.find((c) => c._id === l);
|
|
213
|
+
return !u || !u.groups ? !1 : u.groups.some((c) => c._id === a) ? !0 : u.groups.some((c) => {
|
|
214
|
+
const i = e.modules.group.find((f) => f._id === c._id);
|
|
215
|
+
for (const f of (i == null ? void 0 : i.items) || [])
|
|
216
|
+
if (r(a, f._id)) return !0;
|
|
217
|
+
return !1;
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return r(t, n);
|
|
221
|
+
}
|
|
222
|
+
function Ft(e, t, n) {
|
|
223
|
+
const o = /* @__PURE__ */ new Set();
|
|
224
|
+
function r(a, l) {
|
|
225
|
+
if (!e || !a || !l || o.has(a)) return !1;
|
|
226
|
+
o.add(a);
|
|
227
|
+
const u = e.modules.group.find((c) => c._id === a);
|
|
228
|
+
return !u || !u.items ? !1 : u.items.some((c) => c._id === l) ? !0 : u.items.some((c) => {
|
|
229
|
+
const i = e.modules.item.find((f) => f._id === c._id);
|
|
230
|
+
for (const f of (i == null ? void 0 : i.groups) || [])
|
|
231
|
+
if (r(f._id, l)) return !0;
|
|
232
|
+
return !1;
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
return r(t, n);
|
|
236
|
+
}
|
|
237
|
+
const G = /* @__PURE__ */ new Map();
|
|
238
|
+
async function at(e, t, n) {
|
|
239
|
+
const o = `${e._id}-${e.updatedAt}-${t || "null"}-${n || "null"}`;
|
|
240
|
+
if (G.has(o))
|
|
241
|
+
return G.get(o);
|
|
242
|
+
const r = await ce(e, t, n);
|
|
243
|
+
return G.set(o, r), r;
|
|
244
|
+
}
|
|
245
|
+
async function Kt(e, t, n) {
|
|
246
|
+
var l, u;
|
|
247
|
+
const o = await at(e, t, null), r = [], a = (c, i) => {
|
|
248
|
+
const f = C(c);
|
|
249
|
+
for (const h in i)
|
|
250
|
+
i[h] && (f[h] = i[h]);
|
|
251
|
+
return f;
|
|
252
|
+
};
|
|
253
|
+
for (const c of o.modules.group) {
|
|
254
|
+
const i = (l = c.items) == null ? void 0 : l.find((h) => h._id === n && !h.combinationKey), f = e.modules.item.find((h) => h._id === n);
|
|
255
|
+
if (i) {
|
|
256
|
+
const h = (u = c.items) == null ? void 0 : u.filter((v) => v._id === n && v.combinationKey), m = [i, ...h].map((v) => {
|
|
257
|
+
var w, I;
|
|
258
|
+
const p = v.combinationKey ? (I = (w = f == null ? void 0 : f.variant) == null ? void 0 : w.variantCombinations) == null ? void 0 : I.find(
|
|
259
|
+
(R) => R.combinationKey === v.combinationKey
|
|
260
|
+
) : f, b = p && f ? a(f, p) : v;
|
|
261
|
+
return a(b, v);
|
|
262
|
+
});
|
|
263
|
+
r.push({
|
|
264
|
+
group: c,
|
|
265
|
+
items: m
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return r;
|
|
270
|
+
}
|
|
271
|
+
const M = 0, F = 3;
|
|
272
|
+
function it(e) {
|
|
273
|
+
const t = /^\/(.*)\/([gimyu]*)$/.exec(e.toString());
|
|
274
|
+
if (!t)
|
|
275
|
+
throw new Error("Invalid RegExp");
|
|
276
|
+
return new RegExp(t[1] ?? "", t[2]);
|
|
277
|
+
}
|
|
278
|
+
function O(e) {
|
|
279
|
+
if (typeof e != "object")
|
|
280
|
+
return e;
|
|
281
|
+
if (e === null)
|
|
282
|
+
return null;
|
|
283
|
+
if (Array.isArray(e))
|
|
284
|
+
return e.map(O);
|
|
285
|
+
if (e instanceof Date)
|
|
286
|
+
return new Date(e.getTime());
|
|
287
|
+
if (e instanceof RegExp)
|
|
288
|
+
return it(e);
|
|
289
|
+
const t = {};
|
|
290
|
+
for (const n in e)
|
|
291
|
+
Object.prototype.hasOwnProperty.call(e, n) && (t[n] = O(e[n]));
|
|
292
|
+
return t;
|
|
293
|
+
}
|
|
294
|
+
function P(e) {
|
|
295
|
+
return e instanceof RegExp ? e.toString() : e;
|
|
296
|
+
}
|
|
297
|
+
function k(e) {
|
|
298
|
+
return typeof e == "object" && e !== null && !Array.isArray(e) && !(e instanceof Date) && !(e instanceof RegExp);
|
|
299
|
+
}
|
|
300
|
+
function K(e, t) {
|
|
301
|
+
if (e === t) return !0;
|
|
302
|
+
if (typeof e != typeof t) return !1;
|
|
303
|
+
if (e instanceof Date && t instanceof Date)
|
|
304
|
+
return e.getTime() === t.getTime();
|
|
305
|
+
if (e instanceof RegExp && t instanceof RegExp)
|
|
306
|
+
return e.toString() === t.toString();
|
|
307
|
+
if (Array.isArray(e) && Array.isArray(t)) {
|
|
308
|
+
if (e.length !== t.length) return !1;
|
|
309
|
+
for (let n = 0; n < e.length; n++)
|
|
310
|
+
if (!K(e[n], t[n])) return !1;
|
|
311
|
+
return !0;
|
|
312
|
+
}
|
|
313
|
+
if (k(e) && k(t)) {
|
|
314
|
+
const n = Object.keys(e), o = Object.keys(t);
|
|
315
|
+
if (n.length !== o.length) return !1;
|
|
316
|
+
for (const r of n)
|
|
317
|
+
if (!Object.prototype.hasOwnProperty.call(t, r) || !K(e[r], t[r])) return !1;
|
|
318
|
+
return !0;
|
|
319
|
+
}
|
|
320
|
+
return !1;
|
|
321
|
+
}
|
|
322
|
+
function ct(e, t, n) {
|
|
323
|
+
const o = e.length, r = t.length, a = /* @__PURE__ */ new Map();
|
|
324
|
+
for (let c = 0; c < r; c++) {
|
|
325
|
+
const i = n ? n(t[c]) : JSON.stringify(t[c]);
|
|
326
|
+
a.has(i) || a.set(i, []), a.get(i).push(c);
|
|
327
|
+
}
|
|
328
|
+
const l = [], u = /* @__PURE__ */ new Set();
|
|
329
|
+
for (let c = 0; c < o; c++) {
|
|
330
|
+
const i = e[c], f = n ? n(i) : JSON.stringify(i), h = a.get(f);
|
|
331
|
+
if (h) {
|
|
332
|
+
for (const m of h)
|
|
333
|
+
if (!u.has(m) && K(i, t[m])) {
|
|
334
|
+
l.push({ leftIndex: c, rightIndex: m }), u.add(m);
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return l;
|
|
340
|
+
}
|
|
341
|
+
function lt(e, t, n) {
|
|
342
|
+
var m, v;
|
|
343
|
+
if (K(e, t)) return;
|
|
344
|
+
const o = { _t: "a" }, r = ((m = n == null ? void 0 : n.arrays) == null ? void 0 : m.detectMove) !== !1, a = ((v = n == null ? void 0 : n.arrays) == null ? void 0 : v.includeValueOnMove) === !0, l = n == null ? void 0 : n.objectHash;
|
|
345
|
+
let u = r ? ct(e, t, l) : [];
|
|
346
|
+
if (!l && e.length === t.length && e.length > 0 && u.length < e.length) {
|
|
347
|
+
const p = k(e[0]) || Array.isArray(e[0]), b = u.length > 0;
|
|
348
|
+
if (p || b) {
|
|
349
|
+
u = [];
|
|
350
|
+
for (let w = 0; w < e.length; w++)
|
|
351
|
+
u.push({ leftIndex: w, rightIndex: w });
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
new Set(u.map((p) => p.leftIndex));
|
|
355
|
+
const c = new Set(u.map((p) => p.rightIndex)), i = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
|
|
356
|
+
for (const p of u)
|
|
357
|
+
i.set(p.leftIndex, p.rightIndex), f.set(p.rightIndex, p.leftIndex);
|
|
358
|
+
for (let p = 0; p < e.length; p++) {
|
|
359
|
+
const b = i.get(p);
|
|
360
|
+
if (b !== void 0) {
|
|
361
|
+
const w = J(e[p], t[b], n);
|
|
362
|
+
if (w !== void 0 && (o[b] = w), r && b !== p) {
|
|
363
|
+
const I = `_${p}`, R = a ? [e[p], b, F] : ["", b, F];
|
|
364
|
+
o[I] = R;
|
|
365
|
+
}
|
|
366
|
+
} else {
|
|
367
|
+
const w = `_${p}`;
|
|
368
|
+
o[w] = [e[p], M, M];
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
for (let p = 0; p < t.length; p++)
|
|
372
|
+
c.has(p) || (o[p] = [t[p]]);
|
|
373
|
+
const h = Object.keys(o);
|
|
374
|
+
if (!(h.length === 1 && h[0] === "_t"))
|
|
375
|
+
return o;
|
|
376
|
+
}
|
|
377
|
+
function dt(e, t, n) {
|
|
378
|
+
if (K(e, t)) return;
|
|
379
|
+
const o = {}, r = Object.keys(e), a = Object.keys(t), l = /* @__PURE__ */ new Set([...r, ...a]);
|
|
380
|
+
for (const u of l) {
|
|
381
|
+
if (n != null && n.propertyFilter && !n.propertyFilter(u, { left: e, right: t }))
|
|
382
|
+
continue;
|
|
383
|
+
const c = Object.prototype.hasOwnProperty.call(e, u), i = Object.prototype.hasOwnProperty.call(t, u);
|
|
384
|
+
if (c && i) {
|
|
385
|
+
const f = J(e[u], t[u], n);
|
|
386
|
+
f !== void 0 && (o[u] = f);
|
|
387
|
+
} else if (c && !i) {
|
|
388
|
+
const f = n != null && n.omitRemovedValues ? 0 : e[u];
|
|
389
|
+
o[u] = [f, M, M];
|
|
390
|
+
} else !c && i && (o[u] = [t[u]]);
|
|
391
|
+
}
|
|
392
|
+
return Object.keys(o).length > 0 ? o : void 0;
|
|
393
|
+
}
|
|
394
|
+
function J(e, t, n) {
|
|
395
|
+
if (K(e, t)) return;
|
|
396
|
+
if (e === void 0 && t !== void 0) {
|
|
397
|
+
const u = n != null && n.cloneDiffValues ? O(t) : t;
|
|
398
|
+
return [P(u)];
|
|
399
|
+
}
|
|
400
|
+
if (typeof e !== typeof t || e instanceof Date != t instanceof Date || e instanceof RegExp != t instanceof RegExp || Array.isArray(e) !== Array.isArray(t)) {
|
|
401
|
+
const u = n != null && n.cloneDiffValues ? O(e) : e, c = n != null && n.cloneDiffValues ? O(t) : t;
|
|
402
|
+
return [P(u), P(c)];
|
|
403
|
+
}
|
|
404
|
+
if (Array.isArray(e) && Array.isArray(t))
|
|
405
|
+
return lt(e, t, n);
|
|
406
|
+
if (k(e) && k(t))
|
|
407
|
+
return dt(e, t, n);
|
|
408
|
+
const a = n != null && n.cloneDiffValues ? O(e) : e, l = n != null && n.cloneDiffValues ? O(t) : t;
|
|
409
|
+
return [P(a), P(l)];
|
|
410
|
+
}
|
|
411
|
+
function ft(e, t, n) {
|
|
412
|
+
return J(e, t, n);
|
|
413
|
+
}
|
|
414
|
+
function mt(e, t, n) {
|
|
415
|
+
const o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
|
|
416
|
+
for (const u in t) {
|
|
417
|
+
if (u === "_t" || !u.startsWith("_")) continue;
|
|
418
|
+
const c = parseInt(u.slice(1)), i = t[u];
|
|
419
|
+
Array.isArray(i) && (i.length === 3 && i[2] === M ? o.add(c) : i.length === 3 && i[2] === F && r.set(c, i[1]));
|
|
420
|
+
}
|
|
421
|
+
const a = [];
|
|
422
|
+
let l = 0;
|
|
423
|
+
for (let u = 0; ; u++) {
|
|
424
|
+
const c = u.toString(), i = t[c];
|
|
425
|
+
if (i !== void 0)
|
|
426
|
+
if (Array.isArray(i) && i.length === 1)
|
|
427
|
+
a.push(i[0]);
|
|
428
|
+
else {
|
|
429
|
+
for (; l < e.length && o.has(l); )
|
|
430
|
+
l++;
|
|
431
|
+
l < e.length && (a.push(Y(e[l], i)), l++);
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
let f = !1;
|
|
435
|
+
for (const [h, m] of r.entries())
|
|
436
|
+
if (m === u) {
|
|
437
|
+
a.push(e[h]), f = !0;
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
if (!f) {
|
|
441
|
+
for (; l < e.length && (o.has(l) || r.has(l)); )
|
|
442
|
+
l++;
|
|
443
|
+
if (l < e.length)
|
|
444
|
+
a.push(e[l]), l++;
|
|
445
|
+
else
|
|
446
|
+
break;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return a;
|
|
451
|
+
}
|
|
452
|
+
function vt(e, t, n) {
|
|
453
|
+
const o = { ...e };
|
|
454
|
+
for (const r in t) {
|
|
455
|
+
const a = t[r];
|
|
456
|
+
Array.isArray(a) ? a.length === 1 ? o[r] = a[0] : a.length === 3 && a[2] === M ? delete o[r] : a.length === 2 && (o[r] = a[1]) : o[r] = Y(o[r], a);
|
|
457
|
+
}
|
|
458
|
+
return o;
|
|
459
|
+
}
|
|
460
|
+
function Y(e, t, n) {
|
|
461
|
+
if (t === void 0) return e;
|
|
462
|
+
if (Array.isArray(t)) {
|
|
463
|
+
if (t.length === 1)
|
|
464
|
+
return t[0];
|
|
465
|
+
if (t.length === 2)
|
|
466
|
+
return t[1];
|
|
467
|
+
if (t.length === 3 && t[2] === M)
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
return k(t) && t._t === "a" ? mt(e, t) : k(t) && k(e) ? vt(e, t) : e;
|
|
471
|
+
}
|
|
472
|
+
function le(e, t, n) {
|
|
473
|
+
return Y(e, t);
|
|
474
|
+
}
|
|
475
|
+
function yt(e) {
|
|
476
|
+
const t = { _t: "a" };
|
|
477
|
+
for (const n in e)
|
|
478
|
+
if (n !== "_t")
|
|
479
|
+
if (n.startsWith("_")) {
|
|
480
|
+
const o = parseInt(n.slice(1)), r = e[n];
|
|
481
|
+
if (Array.isArray(r)) {
|
|
482
|
+
if (r.length === 3 && r[2] === M)
|
|
483
|
+
t[o] = [r[0]];
|
|
484
|
+
else if (r.length === 3 && r[2] === F) {
|
|
485
|
+
const a = r[1];
|
|
486
|
+
t[`_${a}`] = [r[0], o, F];
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
} else {
|
|
490
|
+
const o = parseInt(n), r = e[n];
|
|
491
|
+
if (Array.isArray(r) && r.length === 1)
|
|
492
|
+
t[`_${o}`] = [r[0], M, M];
|
|
493
|
+
else {
|
|
494
|
+
const a = X(r);
|
|
495
|
+
a !== void 0 && (t[n] = a);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
return t;
|
|
499
|
+
}
|
|
500
|
+
function ht(e) {
|
|
501
|
+
const t = {};
|
|
502
|
+
for (const n in e) {
|
|
503
|
+
const o = e[n];
|
|
504
|
+
if (Array.isArray(o))
|
|
505
|
+
o.length === 1 ? t[n] = [o[0], M, M] : o.length === 3 && o[2] === M ? t[n] = [o[0]] : o.length === 2 && (t[n] = [o[1], o[0]]);
|
|
506
|
+
else {
|
|
507
|
+
const r = X(o);
|
|
508
|
+
r !== void 0 && (t[n] = r);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
return t;
|
|
512
|
+
}
|
|
513
|
+
function X(e) {
|
|
514
|
+
if (e !== void 0) {
|
|
515
|
+
if (Array.isArray(e)) {
|
|
516
|
+
if (e.length === 1)
|
|
517
|
+
return [e[0], M, M];
|
|
518
|
+
if (e.length === 2)
|
|
519
|
+
return [e[1], e[0]];
|
|
520
|
+
if (e.length === 3 && e[2] === M)
|
|
521
|
+
return [e[0]];
|
|
522
|
+
if (e.length === 3 && e[2] === F)
|
|
523
|
+
return e;
|
|
524
|
+
}
|
|
525
|
+
return k(e) && e._t === "a" ? yt(e) : k(e) ? ht(e) : e;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
function de(e) {
|
|
529
|
+
return X(e);
|
|
530
|
+
}
|
|
531
|
+
function pt(e, t, n) {
|
|
532
|
+
const o = de(t);
|
|
533
|
+
return le(e, o);
|
|
534
|
+
}
|
|
535
|
+
class gt {
|
|
536
|
+
constructor(t) {
|
|
537
|
+
ne(this, "options");
|
|
538
|
+
this.options = t || {};
|
|
539
|
+
}
|
|
540
|
+
diff(t, n) {
|
|
541
|
+
return ft(t, n, this.options);
|
|
542
|
+
}
|
|
543
|
+
patch(t, n) {
|
|
544
|
+
return le(t, n, this.options);
|
|
545
|
+
}
|
|
546
|
+
reverse(t) {
|
|
547
|
+
return de(t);
|
|
548
|
+
}
|
|
549
|
+
unpatch(t, n) {
|
|
550
|
+
return pt(t, n, this.options);
|
|
551
|
+
}
|
|
552
|
+
clone(t) {
|
|
553
|
+
return O(t);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
function _t(e) {
|
|
557
|
+
return new gt(e);
|
|
558
|
+
}
|
|
559
|
+
function St({
|
|
560
|
+
maxHistorySize: e = 10
|
|
561
|
+
}) {
|
|
562
|
+
const t = _t({
|
|
563
|
+
objectHash: (v) => v._id || v.id,
|
|
564
|
+
arrays: {
|
|
565
|
+
detectMove: !0,
|
|
566
|
+
includeValueOnMove: !1
|
|
567
|
+
},
|
|
568
|
+
cloneDiffValues: !1
|
|
569
|
+
}), n = j(null), o = j([]), r = H(-1), a = j(null), l = S(() => r.value > 0), u = S(() => r.value < o.value.length - 1);
|
|
570
|
+
function c(v) {
|
|
571
|
+
if (n.value === null) {
|
|
572
|
+
n.value = C(v), a.value = C(v), o.value = [{ delta: null }], r.value = 0;
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
const p = t.diff(a.value, v);
|
|
576
|
+
if (r.value < o.value.length - 1 && (o.value = o.value.slice(0, r.value + 1)), o.value.push({ delta: p }), r.value++, a.value = C(v), o.value.length > e) {
|
|
577
|
+
const b = o.value[1].delta;
|
|
578
|
+
b && n.value && (n.value = t.patch(C(n.value), b)), o.value.shift(), r.value--;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
function i(v) {
|
|
582
|
+
if (!n.value || v < 0 || v >= o.value.length)
|
|
583
|
+
return;
|
|
584
|
+
let p = C(n.value);
|
|
585
|
+
for (let b = 1; b <= v; b++) {
|
|
586
|
+
const w = o.value[b];
|
|
587
|
+
w.delta && (p = t.patch(p, w.delta));
|
|
588
|
+
}
|
|
589
|
+
return p;
|
|
590
|
+
}
|
|
591
|
+
function f() {
|
|
592
|
+
if (l.value) {
|
|
593
|
+
r.value--;
|
|
594
|
+
const v = i(r.value);
|
|
595
|
+
return v && (a.value = C(v)), v;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
function h() {
|
|
599
|
+
if (u.value) {
|
|
600
|
+
r.value++;
|
|
601
|
+
const v = i(r.value);
|
|
602
|
+
return v && (a.value = C(v)), v;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
function m() {
|
|
606
|
+
n.value = null, a.value = null, o.value = [], r.value = -1;
|
|
607
|
+
}
|
|
608
|
+
return {
|
|
609
|
+
push: c,
|
|
610
|
+
canUndo: l,
|
|
611
|
+
canRedo: u,
|
|
612
|
+
undo: f,
|
|
613
|
+
redo: h,
|
|
614
|
+
clear: m
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
const bt = {
|
|
618
|
+
async updateMenuModule(e, t) {
|
|
619
|
+
const n = q.RequestRunner.operation(t, e.modules);
|
|
620
|
+
if (n.validateError.length > 0)
|
|
621
|
+
throw new Error(n.validateError.join(`
|
|
622
|
+
`));
|
|
623
|
+
const o = {
|
|
624
|
+
...e,
|
|
625
|
+
modules: n.result || e.modules,
|
|
626
|
+
_rev: n.id ?? ""
|
|
627
|
+
};
|
|
628
|
+
return ie.cloneDeep({ menu: o, updateId: n.id ?? null });
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
function fe() {
|
|
632
|
+
return {
|
|
633
|
+
_id: "",
|
|
634
|
+
masterCatalogSetting: { inclusiveTaxes: [] },
|
|
635
|
+
modules: {
|
|
636
|
+
catalog: [],
|
|
637
|
+
category: [],
|
|
638
|
+
group: [],
|
|
639
|
+
item: [],
|
|
640
|
+
printDepartment: [],
|
|
641
|
+
scheduler: [],
|
|
642
|
+
takeaway: [],
|
|
643
|
+
variant: [],
|
|
644
|
+
sku: [],
|
|
645
|
+
recipe: [],
|
|
646
|
+
unit: [],
|
|
647
|
+
cookingGuide: [],
|
|
648
|
+
serveSequence: [],
|
|
649
|
+
subCategory: []
|
|
650
|
+
},
|
|
651
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
function wt() {
|
|
655
|
+
return {
|
|
656
|
+
restaurants: [],
|
|
657
|
+
menu: { ...fe(), _rev: "" },
|
|
658
|
+
currentCatalogId: null,
|
|
659
|
+
currentCategoryIds: null,
|
|
660
|
+
currentSchedulerId: "",
|
|
661
|
+
currentRestaurantAttrParams: {
|
|
662
|
+
restaurantCustomAttributes: null,
|
|
663
|
+
restaurantAttributes: null
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
const Pt = Ye(
|
|
668
|
+
"mf-menu-store-v2",
|
|
669
|
+
() => {
|
|
670
|
+
const e = Xe(wt()), t = se(), n = et(), o = S(() => e.menu.modules.serveSequence ? x(e.menu.modules.serveSequence, {
|
|
671
|
+
selector: "position"
|
|
672
|
+
}) : []), r = S(() => {
|
|
673
|
+
var s;
|
|
674
|
+
return ((s = t.currentBusiness.value) == null ? void 0 : s.menuVersion) || L.F_MENU_VERSION.v3;
|
|
675
|
+
}), a = S(() => r.value === L.F_MENU_VERSION.v4), l = S(() => {
|
|
676
|
+
const s = e.menu.modules.catalog;
|
|
677
|
+
return x(s, { selector: "name" });
|
|
678
|
+
}), u = S(() => {
|
|
679
|
+
var d;
|
|
680
|
+
let s = e.menu.modules.catalog.find(
|
|
681
|
+
(y) => y._id === e.currentCatalogId
|
|
682
|
+
);
|
|
683
|
+
return s && ((d = s.linkItemRules) != null && d.length) && (s = T.populateCatalog({
|
|
684
|
+
catalog: s,
|
|
685
|
+
ruleGroupSettings: e.menu.ruleGroupSettings,
|
|
686
|
+
items: e.menu.modules.item,
|
|
687
|
+
...e.currentRestaurantAttrParams ?? {}
|
|
688
|
+
})), s;
|
|
689
|
+
}), c = S(() => x(h.value.modules.scheduler, { selector: "name" })), i = S(() => e.menu.modules.scheduler.find(
|
|
690
|
+
(s) => s._id === e.currentSchedulerId
|
|
691
|
+
));
|
|
692
|
+
function f(s, d = !0) {
|
|
693
|
+
e.menu = { ...s, _rev: e.menu._rev }, d && D.push(e.menu);
|
|
694
|
+
}
|
|
695
|
+
const h = j(fe()), m = H(!1), v = H(1);
|
|
696
|
+
async function p() {
|
|
697
|
+
var y;
|
|
698
|
+
m.value = !0;
|
|
699
|
+
let s = e.menu.modules.catalog;
|
|
700
|
+
if (u.value && ((y = u.value.linkItemRules) != null && y.length)) {
|
|
701
|
+
const g = T.populateCatalog({
|
|
702
|
+
catalog: u.value,
|
|
703
|
+
ruleGroupSettings: e.menu.ruleGroupSettings,
|
|
704
|
+
items: e.menu.modules.item,
|
|
705
|
+
...e.currentRestaurantAttrParams ?? {}
|
|
706
|
+
});
|
|
707
|
+
s = e.menu.modules.catalog.map((_) => _._id === (g == null ? void 0 : g._id) ? g : _);
|
|
708
|
+
}
|
|
709
|
+
const d = await ce(
|
|
710
|
+
{
|
|
711
|
+
...e.menu,
|
|
712
|
+
modules: {
|
|
713
|
+
...e.menu.modules,
|
|
714
|
+
catalog: s
|
|
715
|
+
}
|
|
716
|
+
},
|
|
717
|
+
e.currentCatalogId,
|
|
718
|
+
e.currentSchedulerId
|
|
719
|
+
);
|
|
720
|
+
if (e.currentSchedulerId != null) {
|
|
721
|
+
const g = e.menu.modules.catalog.find(
|
|
722
|
+
(E) => E._id === e.currentCatalogId
|
|
723
|
+
), _ = g ? g.override.scheduler[e.currentSchedulerId] : e.menu.modules.scheduler.find(
|
|
724
|
+
(E) => E._id === e.currentSchedulerId
|
|
725
|
+
), A = new Set(((_ == null ? void 0 : _.items) || []).map((E) => E._id));
|
|
726
|
+
d.modules.item = d.modules.item.filter((E) => A.has(E._id));
|
|
727
|
+
}
|
|
728
|
+
return h.value = d, m.value = !1, v.value = v.value + 1, d;
|
|
729
|
+
}
|
|
730
|
+
const w = ie.debounce(p, 200);
|
|
731
|
+
let I = null, R = null;
|
|
732
|
+
function Q() {
|
|
733
|
+
R && (R(), R = null), I && I.stop(), I = Qe(!0), R = I.run(() => Ze(
|
|
734
|
+
() => [e.menu, e.currentCatalogId, e.currentSchedulerId],
|
|
735
|
+
() => {
|
|
736
|
+
m.value || w();
|
|
737
|
+
}
|
|
738
|
+
)) || null;
|
|
739
|
+
}
|
|
740
|
+
Q();
|
|
741
|
+
const me = S(() => [
|
|
742
|
+
{
|
|
743
|
+
label: "Main",
|
|
744
|
+
value: null
|
|
745
|
+
},
|
|
746
|
+
...l.value.map((s) => ({
|
|
747
|
+
label: s.name,
|
|
748
|
+
value: s._id
|
|
749
|
+
}))
|
|
750
|
+
]), Z = S(() => {
|
|
751
|
+
const s = h.value.modules.category;
|
|
752
|
+
return [
|
|
753
|
+
...U.value.item.addon ? [
|
|
754
|
+
{
|
|
755
|
+
_id: e.currentCatalogId ? "" : null,
|
|
756
|
+
name: "Addon",
|
|
757
|
+
position: 0
|
|
758
|
+
}
|
|
759
|
+
] : [],
|
|
760
|
+
...V(s, (d) => d.name)
|
|
761
|
+
];
|
|
762
|
+
}), ve = S(() => {
|
|
763
|
+
const s = h.value.modules.subCategory || [];
|
|
764
|
+
return V(s, (d) => d.name);
|
|
765
|
+
}), ee = S(() => {
|
|
766
|
+
var d;
|
|
767
|
+
let s = h.value.modules.item;
|
|
768
|
+
if (u.value) {
|
|
769
|
+
const y = (d = u.value) == null ? void 0 : d.override.items;
|
|
770
|
+
s = s.filter((g) => {
|
|
771
|
+
var A;
|
|
772
|
+
const _ = (A = y == null ? void 0 : y[g._id]) == null ? void 0 : A.find(
|
|
773
|
+
(E) => !E.combinationKey
|
|
774
|
+
);
|
|
775
|
+
return (_ == null ? void 0 : _.orderFrom) !== ae.F_ORDER_FROM.enum.NONE;
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
return V(s, (y) => y.code || y.name);
|
|
779
|
+
}), ye = S(() => {
|
|
780
|
+
const s = e.menu.modules.category, d = V(s, (g) => g.name).reduce(
|
|
781
|
+
(g, _, A) => (g[_._id] = A, g),
|
|
782
|
+
{ "": 0 }
|
|
783
|
+
), y = e.menu.modules.item;
|
|
784
|
+
return V(
|
|
785
|
+
y,
|
|
786
|
+
(g) => g.code || g.name
|
|
787
|
+
).reduce((g, _, A) => (g[_._id] = A + d[_.category || ""], g), {});
|
|
788
|
+
}), he = S(() => oe(N.value, Z.value, ee.value)), pe = S(() => {
|
|
789
|
+
const s = U.value.item.addon ? [
|
|
790
|
+
{
|
|
791
|
+
_id: e.currentCatalogId ? "" : null,
|
|
792
|
+
name: "Addon",
|
|
793
|
+
position: 0
|
|
794
|
+
},
|
|
795
|
+
...e.menu.modules.category
|
|
796
|
+
] : e.menu.modules.category;
|
|
797
|
+
return oe(
|
|
798
|
+
e.menu.modules.variant,
|
|
799
|
+
s,
|
|
800
|
+
e.menu.modules.item
|
|
801
|
+
);
|
|
802
|
+
}), N = S(() => {
|
|
803
|
+
const s = h.value.modules.variant;
|
|
804
|
+
return x(s, { selector: "name" });
|
|
805
|
+
});
|
|
806
|
+
function ge(s = []) {
|
|
807
|
+
const d = s.map((g) => N.value.find((_) => _._id === g)).filter((g) => !!g);
|
|
808
|
+
return T.fullVariantCombination(d).reduce((g, _) => (g[_.combinationKey] = _.selectionName.join(" / "), g), {});
|
|
809
|
+
}
|
|
810
|
+
const _e = S(() => V(h.value.modules.group, (s) => s.name)), Se = S(() => x(h.value.modules.takeaway, { selector: "name" })), be = S(() => x(e.menu.modules.printDepartment || [], {
|
|
811
|
+
selector: "name"
|
|
812
|
+
})), we = S(() => x(e.menu.modules.unit, { selector: "name" })), Me = S(() => x(Le(e.menu.modules.recipe, e.menu.modules.sku), {
|
|
813
|
+
selector: "name"
|
|
814
|
+
})), Ae = S(() => e.menu.modules.cookingGuide), Ce = S(() => {
|
|
815
|
+
const s = ze(e.menu.modules.sku);
|
|
816
|
+
return x(s, { selector: "code" });
|
|
817
|
+
}), U = S(() => {
|
|
818
|
+
const s = !e.currentCatalogId, d = r.value === L.F_MENU_VERSION.v4, y = !e.currentSchedulerId, g = {
|
|
819
|
+
create: s && y,
|
|
820
|
+
edit: s && y,
|
|
821
|
+
delete: s && y
|
|
822
|
+
};
|
|
823
|
+
return {
|
|
824
|
+
item: {
|
|
825
|
+
...g,
|
|
826
|
+
edit: d || y,
|
|
827
|
+
sort: d && s && y,
|
|
828
|
+
addon: d,
|
|
829
|
+
code: y,
|
|
830
|
+
name: s && y,
|
|
831
|
+
description: s && y,
|
|
832
|
+
category: y,
|
|
833
|
+
thumbnail: s && y,
|
|
834
|
+
orderFrom: (d || s) && y,
|
|
835
|
+
orderFromNone: s,
|
|
836
|
+
orderFromActiveOnly: !d,
|
|
837
|
+
openPrice: s && y,
|
|
838
|
+
unit: s && y,
|
|
839
|
+
price: s,
|
|
840
|
+
editPrice: s,
|
|
841
|
+
minPrice: d && y,
|
|
842
|
+
costing: d && s && y,
|
|
843
|
+
tax: s && y,
|
|
844
|
+
variant: s && y,
|
|
845
|
+
maxVariant: d ? 4 : 2,
|
|
846
|
+
group: s && y,
|
|
847
|
+
overrideProductGroup: d && y,
|
|
848
|
+
inventory: (d || s) && y,
|
|
849
|
+
bindToVariant: d,
|
|
850
|
+
print: s && y,
|
|
851
|
+
toRoot: d && y,
|
|
852
|
+
takeaway: (_) => !!_ && (d || s) && y,
|
|
853
|
+
multiScheduler: d,
|
|
854
|
+
canRearrange: d,
|
|
855
|
+
printConfig: d
|
|
856
|
+
},
|
|
857
|
+
category: {
|
|
858
|
+
...g,
|
|
859
|
+
sort: s
|
|
860
|
+
},
|
|
861
|
+
group: {
|
|
862
|
+
...g,
|
|
863
|
+
edit: d || y,
|
|
864
|
+
sort: s,
|
|
865
|
+
applyProduct: s,
|
|
866
|
+
showAppliedProduct: y,
|
|
867
|
+
type: !d,
|
|
868
|
+
insertRawItems: !d,
|
|
869
|
+
multiScheduler: d
|
|
870
|
+
},
|
|
871
|
+
scheduler: {
|
|
872
|
+
override: d
|
|
873
|
+
},
|
|
874
|
+
takeaway: {
|
|
875
|
+
...g,
|
|
876
|
+
edit: (d || s) && y,
|
|
877
|
+
name: s
|
|
878
|
+
},
|
|
879
|
+
catalog: {
|
|
880
|
+
name: !s,
|
|
881
|
+
defaultOrderFrom: d,
|
|
882
|
+
markup: d
|
|
883
|
+
}
|
|
884
|
+
};
|
|
885
|
+
});
|
|
886
|
+
function W(s) {
|
|
887
|
+
return `${s.systemCode}/${s.taxCode}`;
|
|
888
|
+
}
|
|
889
|
+
function Ie(s) {
|
|
890
|
+
const [d, y] = s.split("/");
|
|
891
|
+
return { systemCode: d, taxCode: y };
|
|
892
|
+
}
|
|
893
|
+
function Re(s, d, y) {
|
|
894
|
+
return (s ?? d ?? []).map((g) => W(g)).find((g) => y.some((_) => _.value === g));
|
|
895
|
+
}
|
|
896
|
+
const ke = S(() => {
|
|
897
|
+
var g;
|
|
898
|
+
const s = ["SV5", "SV10"], d = Ge.Country.getCountryFlattenTaxes(
|
|
899
|
+
se().currentCountry.value
|
|
900
|
+
), y = d.filter((_) => a.value || !s.includes(_.taxCode)).map((_) => ({
|
|
901
|
+
label: `${_.name} (${qe(_.rate)}%)`,
|
|
902
|
+
value: W(_),
|
|
903
|
+
meta: {
|
|
904
|
+
rate: _.rate
|
|
905
|
+
}
|
|
906
|
+
}));
|
|
907
|
+
return y.sort((_, A) => _.label.localeCompare(A.label, void 0, { numeric: !0 })), {
|
|
908
|
+
systemCode: (g = d[0]) == null ? void 0 : g.systemCode,
|
|
909
|
+
countryTaxOptions: y
|
|
910
|
+
};
|
|
911
|
+
}), Ee = async () => {
|
|
912
|
+
const s = await Je.readMenu();
|
|
913
|
+
e.menu = s ?? e.menu, te(null);
|
|
914
|
+
}, xe = async () => {
|
|
915
|
+
const { fetchAllRestaurants: s } = Be();
|
|
916
|
+
await s({
|
|
917
|
+
onBatchEnd: (d) => {
|
|
918
|
+
e.restaurants = d;
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
}, te = (s) => {
|
|
922
|
+
e.currentCatalogId = s;
|
|
923
|
+
}, Oe = (s) => {
|
|
924
|
+
e.currentSchedulerId = s;
|
|
925
|
+
}, De = (s) => {
|
|
926
|
+
e.currentCategoryIds = s;
|
|
927
|
+
}, Ve = (s) => {
|
|
928
|
+
e.currentRestaurantAttrParams = s;
|
|
929
|
+
}, Te = async (s, d) => {
|
|
930
|
+
const y = Array.isArray(s) ? s : [s];
|
|
931
|
+
if (!y.length) return;
|
|
932
|
+
const g = y.map((_) => ({
|
|
933
|
+
..._,
|
|
934
|
+
_id: e.menu._id,
|
|
935
|
+
_rev: e.menu._rev
|
|
936
|
+
}));
|
|
937
|
+
try {
|
|
938
|
+
if (d || g.some(
|
|
939
|
+
(A) => [q.F_OPERATION_TYPE.delete, q.F_OPERATION_TYPE.deleteMany].includes(A.operation)
|
|
940
|
+
)) {
|
|
941
|
+
const A = await He(g, e.menu.modules);
|
|
942
|
+
if (A !== !0) throw new Error(A);
|
|
943
|
+
}
|
|
944
|
+
const _ = await bt.updateMenuModule(e.menu, g);
|
|
945
|
+
return f(_.menu), _;
|
|
946
|
+
} catch (_) {
|
|
947
|
+
n.open({
|
|
948
|
+
type: "error",
|
|
949
|
+
title: "Failed to update menu",
|
|
950
|
+
message: _
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
}, Fe = async (s) => {
|
|
954
|
+
const d = {
|
|
955
|
+
...e.menu,
|
|
956
|
+
masterCatalogSetting: s.masterCatalogSetting,
|
|
957
|
+
lowStockThreshold: s.lowStockThreshold,
|
|
958
|
+
priceTierSettings: s.priceTierSettings
|
|
959
|
+
};
|
|
960
|
+
return f(d), d;
|
|
961
|
+
}, D = St({ maxHistorySize: 50 }), Ke = S(() => D.canUndo.value), Pe = S(() => D.canRedo.value), $e = () => {
|
|
962
|
+
const s = D.undo();
|
|
963
|
+
s && f(s, !1);
|
|
964
|
+
}, je = () => {
|
|
965
|
+
const s = D.redo();
|
|
966
|
+
s && f(s, !1);
|
|
967
|
+
}, Ne = () => {
|
|
968
|
+
D.clear();
|
|
969
|
+
};
|
|
970
|
+
return {
|
|
971
|
+
state: e,
|
|
972
|
+
// loading state
|
|
973
|
+
workerIsComputing: m,
|
|
974
|
+
mergedMenuChangeId: v,
|
|
975
|
+
// async computed state
|
|
976
|
+
mergedMenu: h,
|
|
977
|
+
// Computed
|
|
978
|
+
version: r,
|
|
979
|
+
isV4: a,
|
|
980
|
+
serveSequence: o,
|
|
981
|
+
catalogs: l,
|
|
982
|
+
currentCatalog: u,
|
|
983
|
+
schedulers: c,
|
|
984
|
+
currentScheduler: i,
|
|
985
|
+
catalogOptions: me,
|
|
986
|
+
categories: Z,
|
|
987
|
+
subcategories: ve,
|
|
988
|
+
items: ee,
|
|
989
|
+
sortedItems: ye,
|
|
990
|
+
categorizedItems: he,
|
|
991
|
+
categorizedRawMenuItems: pe,
|
|
992
|
+
variants: N,
|
|
993
|
+
groups: _e,
|
|
994
|
+
takeaways: Se,
|
|
995
|
+
printDepartments: be,
|
|
996
|
+
units: we,
|
|
997
|
+
recipes: Me,
|
|
998
|
+
cookingGuide: Ae,
|
|
999
|
+
skus: Ce,
|
|
1000
|
+
rules: U,
|
|
1001
|
+
taxSetting: ke,
|
|
1002
|
+
// Action
|
|
1003
|
+
setMenu: f,
|
|
1004
|
+
readMenu: Ee,
|
|
1005
|
+
readRestaurants: xe,
|
|
1006
|
+
selectCatalog: te,
|
|
1007
|
+
selectScheduler: Oe,
|
|
1008
|
+
selectCategory: De,
|
|
1009
|
+
setRestaurantAttrParams: Ve,
|
|
1010
|
+
updateMenu: Te,
|
|
1011
|
+
updateMenuSetting: Fe,
|
|
1012
|
+
computeMergedMenu: p,
|
|
1013
|
+
// helper
|
|
1014
|
+
encodeTax: W,
|
|
1015
|
+
decodeTax: Ie,
|
|
1016
|
+
getSelectedTax: Re,
|
|
1017
|
+
mapVariant: ge,
|
|
1018
|
+
// history
|
|
1019
|
+
canUndoHistory: Ke,
|
|
1020
|
+
canRedoHistory: Pe,
|
|
1021
|
+
undoHistory: $e,
|
|
1022
|
+
redoHistory: je,
|
|
1023
|
+
// cleanup
|
|
1024
|
+
$dispose: () => {
|
|
1025
|
+
w.cancel(), R && (R(), R = null), I && (I.stop(), I = null), Ne();
|
|
1026
|
+
},
|
|
1027
|
+
$reinitialize: () => {
|
|
1028
|
+
Q();
|
|
1029
|
+
}
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
);
|
|
1033
|
+
export {
|
|
1034
|
+
Vt as a,
|
|
1035
|
+
Tt as b,
|
|
1036
|
+
Ft as c,
|
|
1037
|
+
Kt as f,
|
|
1038
|
+
Dt as g,
|
|
1039
|
+
Ot as m,
|
|
1040
|
+
at as o,
|
|
1041
|
+
Pt as u
|
|
1042
|
+
};
|